:root {
    --primary: #5a6bf2;
    --primary-dark: #4a5ae0;
    --primary-light: #7b8cff;
    --bg: #131627;
    --text: #d5d7e3;
    --card-bg: rgba(19, 22, 39, 0.7);
    --glow: 0 0 16px rgba(90, 107, 242, 0.5);
  }

  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  body {
    background-color: #0e1120;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    min-height: 100vh;
    background-image:
      radial-gradient(circle at 15% 25%, rgba(90, 107, 242, 0.08) 0%, transparent 45%),
      radial-gradient(circle at 85% 75%, rgba(123, 140, 255, 0.05) 0%, transparent 45%);
    padding-top: 76px;
    padding-bottom: 50px;
  }

  #contentWrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
  }

  .headbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(16px);
    background: rgba(19, 22, 39, 0.65);
    border-bottom: 1px solid rgba(90, 107, 242, 0.25);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  }

  .headbar h1 {
    font-size: 1.45rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
  }

  .headbar a,
  .headbar button {
    color: #ffffff !important;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    transition: all 0.25s ease;
  }

  .headbar a:hover,
  .headbar button:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .toggle-icon {
    display: block;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .toggle-icon.rotated {
    transform: rotate(180deg);
  }

  .breadcrumb {
    padding: 14px 0 22px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.94rem;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
  }

  .breadcrumb a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
  }

  .breadcrumb .separator {
    color: var(--primary);
    font-weight: 400;
  }

  .breadcrumb .active {
    color: var(--primary);
    font-weight: 600;
  }

  .card {
    background: var(--card-bg);
    backdrop-filter: blur(14px);
    border-radius: 18px;
    padding: 2.2rem 2rem;
    border: 1px solid rgba(90, 107, 242, 0.23);
    margin-bottom: 2rem;
    box-shadow: 0 7px 24px rgba(0, 0, 0, 0.27);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
  }

  .card:hover {
    transform: translateY(-2px);
  }

  .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3.5px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    opacity: 0.85;
  }

  .input-group {
    margin-bottom: 1.4rem;
  }

  label {
    display: block;
    margin-bottom: 0.7rem;
    font-weight: 600;
    font-size: 1rem;
    color: white;
  }

  input[type="text"] {
    width: 100%;
    padding: 0.85rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1.02rem;
    font-family: 'Inter', sans-serif;
  }

  .upload-area {
    position: relative;
    border: 2px dashed rgba(90, 107, 242, 0.45);
    border-radius: 18px;
    padding: 38px 0;
    text-align: center;
    cursor: pointer;
    background: rgba(90, 107, 242, 0.03);
    transition: all 0.4s cubic-bezier(0.25, 0.45, 0.35, 0.95);
    margin-top: 14px;
    animation: pulse 2.8s infinite;
  }

  @keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(90, 107, 242, 0.2); }
    70% { box-shadow: 0 0 0 10px rgba(90, 107, 242, 0); }
    100% { box-shadow: 0 0 0 0 rgba(90, 107, 242, 0); }
  }

  .upload-area:hover {
    border-color: var(--primary-light);
    background: rgba(90, 107, 242, 0.08);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    animation: none;
  }

  .upload-area i {
    font-size: 3.3rem;
    color: var(--primary-light);
    margin-bottom: 18px;
    display: block;
    transition: transform 0.35s, color 0.35s;
  }

  .upload-area:hover i {
    transform: scale(1.18) rotate(6deg);
    color: white;
  }

  .upload-area p {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
  }

  .file-name {
    font-size: 0.91rem;
    color: var(--primary-light);
    font-weight: 700;
    margin-top: 8px;
  }

  .upload-input {
    display: none;
  }

  .custom-mode-dropdown {
    position: relative;
    width: 100%;
  }

  .dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 18px;
    background: rgba(30, 35, 60, 0.65);
    border: 1px solid rgba(90, 107, 242, 0.3);
    border-radius: 15px;
    color: white;
    font-weight: 600;
    font-size: 1.03rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(14px);
  }

  .dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 7px;
    background: rgba(19, 22, 39, 0.88);
    border: 1px solid rgba(90, 107, 242, 0.3);
    border-radius: 0 0 15px 15px;
    list-style: none;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    z-index: 10;
    backdrop-filter: blur(16px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.33);
    transition: all 0.37s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .custom-mode-dropdown.open .dropdown-list {
    max-height: 190px;
    opacity: 1;
    padding: 9px 0;
  }

  .dropdown-item {
    padding: 13px 22px;
    color: var(--text);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
  }

  .dropdown-item:hover {
    background: rgba(90, 107, 242, 0.15);
    color: white;
  }

  .dropdown-item.selected {
    color: var(--primary-light);
    font-weight: 700;
  }

  .btn-enhance {
    width: 100%;
    padding: 17px 26px;
    border: none;
    border-radius: 17px;
    font-family: 'Inter', sans-serif;
    font-size: 1.12rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    transition: all 0.36s cubic-bezier(0.2, 0.6, 0.3, 1);
    box-shadow: var(--glow), inset 0 3px 5px rgba(255,255,255,0.18);
    letter-spacing: 0.5px;
  }

  .btn-enhance i {
    font-size: 1.35rem;
    animation: pulse-icon 1.9s infinite;
  }

  @keyframes pulse-icon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.16); }
  }

  .btn-enhance:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 11px 28px rgba(90, 107, 242, 0.82), inset 0 3px 5px rgba(255,255,255,0.26);
  }

  .btn-enhance:active {
    transform: translateY(0) scale(1.005);
  }

  .btn-download {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 15px;
    font-family: 'Inter', sans-serif;
    font-size: 1.06rem;
    font-weight: 700;
    color: white;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--primary);
    display: none;
    margin-top: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
  }

  .btn-download:hover {
    background: rgba(90, 107, 242, 0.27);
    box-shadow: var(--glow);
  }

  .loading-container {
    display: none;
    margin-top: 1.6rem;
    width: 100%;
  }

  .loading-bar-container {
    width: 100%;
    height: 9px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
  }

  .loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, var(--primary), var(--primary-light));
    border-radius: 5px;
    transition: width 0.43s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
  }

  .loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 30%;
    height: 100%;
    background: rgba(255, 255, 255, 0.78);
    transform: skewX(-25deg);
    animation: shine 2.1s infinite;
  }

  @keyframes shine {
    0% { left: -100%; }
    100% { left: 100%; }
  }

  .loading-text {
    margin-top: 0.8rem;
    color: var(--primary-light);
    text-align: center;
    font-size: 0.93rem;
    font-style: italic;
  }

  .result-card {
    display: none;
  }

  .result-img {
    width: 100%;
    border-radius: 14px;
    display: block;
  }

  .result-label {
    position: absolute;
    top: 18px;
    left: 18px;
    background: rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(7px);
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 7px;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.12);
  }

  .social-sidebar {
    position: fixed;
    top: 0;
    right: -270px;
    width: 260px;
    height: 100vh;
    background: rgba(19, 22, 39, 0.87);
    backdrop-filter: blur(19px);
    border-left: 1px solid rgba(90, 107, 242, 0.27);
    padding: 85px 22px 36px;
    display: flex;
    flex-direction: column;
    gap: 26px;
    z-index: 999;
    transition: right 0.43s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .social-sidebar.open {
    right: 0;
  }

  .social-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 13px 22px;
    border-radius: 15px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.26s ease;
    background: rgba(30, 35, 60, 0.44);
  }

  .social-link:hover {
    background: rgba(90, 107, 242, 0.27);
    transform: translateX(-5px);
    color: var(--primary-light);
  }

  footer {
    text-align: center;
    padding: 2.2rem 1rem;
    color: #9aa0b5;
    font-size: 0.93rem;
    margin-top: 2.8rem;
    border-top: 1px solid rgba(90, 107, 242, 0.17);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
  }

  footer a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
  }

  #toast-container {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 11px;
  }

  .toast {
    padding: 15px 22px;
    border-radius: 13px;
    font-weight: 600;
    font-size: 0.96rem;
    color: white;
    backdrop-filter: blur(13px);
    max-width: 330px;
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.33);
    display: flex;
    align-items: center;
    gap: 11px;
    transform: translateX(210%);
    opacity: 0;
    transition: transform 0.33s ease, opacity 0.33s ease;
  }

  .toast.show {
    transform: translateX(0);
    opacity: 1;
  }

  .toast.success {
    background: rgba(46, 184, 124, 0.87);
    border: 1px solid rgba(46, 200, 124, 0.43);
  }

  .toast.error {
    background: rgba(231, 76, 60, 0.87);
    border: 1px solid rgba(240, 90, 70, 0.43);
  }

  .login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(19, 22, 39, 0.93);
    backdrop-filter: blur(11px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    pointer-events: all;
    transition: opacity 0.43s ease, visibility 0.43s;
  }

  .login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }

  .login-card {
    background: var(--card-bg);
    border: 1px solid rgba(90, 107, 242, 0.3);
    border-radius: 22px;
    padding: 2.4rem;
    width: 93%;
    max-width: 430px;
    text-align: center;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.53s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  @keyframes slideUp {
    from { transform: translateY(34px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  .login-card h2 {
    color: white;
    font-weight: 800;
    margin-bottom: 10px;
    font-size: 1.65rem;
  }

  .login-card p {
    color: var(--text);
    margin-bottom: 1.9rem;
    font-size: 0.98rem;
    line-height: 1.58;
  }

  .login-card .input-group {
    position: relative;
    margin-bottom: 1.5rem;
  }

  .login-card .input-group input {
    width: 100%;
    padding: 15px 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.37);
    color: white;
    border-radius: 13px;
    font-size: 1.03rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.31s ease;
  }

  .login-card .input-group input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(90, 107, 242, 0.27);
  }

  .login-card .input-group label {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #8a90a6;
    font-size: 1.03rem;
    transition: all 0.27s ease;
  }

  .login-card .input-group input:focus + label,
  .login-card .input-group input:not(:placeholder-shown) + label {
    top: -9px;
    left: 14px;
    font-size: 0.89rem;
    background: var(--card-bg);
    padding: 0 7px;
    color: var(--primary-light);
    font-weight: 700;
  }

  .btn-login {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    border-radius: 15px;
    font-weight: 700;
    font-size: 1.08rem;
    cursor: pointer;
    transition: transform 0.27s, box-shadow 0.27s;
    margin-top: 9px;
    font-family: 'Inter', sans-serif;
    box-shadow: var(--glow);
  }

  .btn-login:hover {
    transform: translateY(-2.5px);
    box-shadow: 0 7px 22px rgba(90, 107, 242, 0.62);
  }

  .login-footer {
    margin-top: 2.1rem;
    color: #7a80a0;
    font-size: 0.89rem;
  }

  .forgot-password {
    display: block;
    margin-top: 14px;
    color: var(--primary-light);
    text-decoration: none;
    font-size: 0.93rem;
    font-weight: 600;
    transition: opacity 0.2s;
  }

  .forgot-password:hover {
    opacity: 0.85;
  }

  #welcomeCard {
    text-align: center;
  }

  #welcomeCard img {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    border: 2px solid var(--primary-light);
    box-shadow: 0 0 22px rgba(90, 107, 242, 0.55);
    margin-bottom: 22px;
    animation: float 4.2s ease-in-out infinite;
  }

  @keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-9px); }
  }

  #welcomeName {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #ffffff, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  #welcomeCard p {
    color: var(--text);
    line-height: 1.62;
    margin-bottom: 26px;
    font-size: 1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }

  #closeWelcomeBtn {
    display: none;
  }

  main#mainContent {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.53s ease, transform 0.53s ease;
  }

  main#mainContent.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
  }