    /* 鈹€鈹€鈹€ Reset & Variables 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    :root {
      --bg: #0f0a1e;
      --bg2: #1a1035;
      --bg3: #221545;
      --card: rgba(255,255,255,0.05);
      --card-border: rgba(192,132,252,0.2);
      --card-hover: rgba(192,132,252,0.35);
      --pink: #e879f9;
      --purple: #a855f7;
      --violet: #c084fc;
      --text: #f3e8ff;
      --text2: #c4b5fd;
      --text3: #9ca3af;
      --danger: #f87171;
      --success: #34d399;
      --radius: 16px;
      --shadow: 0 8px 32px rgba(168,85,247,0.2);
    }
    html, body { height: 100%; }
    body {
      font-family: 'Segoe UI', system-ui, sans-serif;
      background: var(--bg);
      color: var(--text);
      overflow-x: hidden;
      min-height: 100vh;
    }
    body.draw-view-lock {
      overflow: hidden;
    }
    button[role="switch"] {
      appearance: none;
      border: 0;
      padding: 0;
      line-height: 0;
      display: inline-block;
      vertical-align: middle;
    }
    button[role="switch"] > span {
      pointer-events: none;
      box-shadow: 0 1px 4px rgba(0,0,0,0.28);
    }

    /* 鈹€鈹€鈹€ Starfield 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    .stars-container {
      position: fixed; inset: 0; pointer-events: none; z-index: 0;
      overflow: hidden;
    }
    .star {
      position: absolute;
      background: white;
      border-radius: 50%;
      animation: twinkle var(--dur) ease-in-out infinite;
      opacity: 0;
    }
    @keyframes twinkle {
      0%, 100% { opacity: 0; transform: scale(0.5); }
      50% { opacity: var(--op); transform: scale(1); }
    }

    /* 鈹€鈹€鈹€ Layout 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    #app { position: relative; z-index: 1; min-height: 100vh; }
    .main-content { padding-top: 72px; }

    /* 鈹€鈹€鈹€ Navbar 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    .navbar {
      position: fixed; top: 0; left: 0; right: 0; z-index: 100;
      height: 64px;
      background: rgba(15,10,30,0.85);
      backdrop-filter: blur(20px);
      border-bottom: 1px solid var(--card-border);
      display: flex; align-items: center;
      padding: 0 24px; gap: 16px;
    }
    .navbar-logo {
      font-size: 1rem; font-weight: 700;
      background: linear-gradient(135deg, var(--violet), var(--pink));
      -webkit-background-clip: text; -webkit-text-fill-color: transparent;
      background-clip: text;
      white-space: nowrap; flex-shrink: 0;
    }
    .logo-text { display: inline; }
    @media (max-width: 480px) {
      .navbar-logo { font-size: 0.9rem; }
      .logo-text { display: none; }
    }
    .navbar-nav { display: flex; gap: 4px; flex: 1; justify-content: center; min-width: 0; overflow: hidden; }
    .nav-btn {
      background: none; border: none; cursor: pointer;
      color: var(--text2); padding: 8px 16px; border-radius: 10px;
      font-size: 0.9rem; transition: all 0.2s; white-space: nowrap;
    }

    .nav-btn:hover { background: var(--card); color: var(--text); }
    .nav-btn.active {
      background: linear-gradient(135deg, rgba(192,132,252,0.2), rgba(232,121,249,0.2));
      color: var(--violet);
      border: 1px solid var(--card-border);
    }
    .navbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
    .btn-outline {
      background: none; border: 1px solid var(--card-border);
      color: var(--text2); padding: 6px 14px; border-radius: 10px;
      cursor: pointer; font-size: 0.85rem; transition: all 0.2s;
    }
    .btn-outline:hover { border-color: var(--violet); color: var(--violet); }
    .avatar-btn {
      width: 36px; height: 36px; border-radius: 50%;
      background: linear-gradient(135deg, var(--violet), var(--pink));
      border: none; cursor: pointer; color: white; font-weight: 700;
      font-size: 0.9rem; position: relative;
    }
    .dropdown {
      position: relative;
    }
    .dropdown-menu {
      position: absolute; right: 0; top: calc(100% + 8px);
      background: var(--bg2); border: 1px solid var(--card-border);
      border-radius: 12px; min-width: 150px; overflow: hidden;
      box-shadow: var(--shadow);
      animation: fadeIn 0.15s ease;
    }
    .dropdown-item {
      display: block; width: 100%;
      background: none; border: none; text-align: left;
      color: var(--text2); padding: 10px 16px; cursor: pointer;
      font-size: 0.9rem; transition: all 0.15s;
    }
    .dropdown-item:hover { background: var(--card); color: var(--text); }
    .dropdown-item.danger { color: var(--danger); }
    .dropdown-item.danger:hover { background: rgba(248,113,113,0.1); }
    @keyframes fadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }

    /* 鈹€鈹€鈹€ Cards 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    .card {
      background: var(--card);
      border: 1px solid var(--card-border);
      border-radius: var(--radius);
      backdrop-filter: blur(12px);
    }
    .card-glow {
      box-shadow: 0 0 20px rgba(192,132,252,0.1), var(--shadow);
    }

    /* 鈹€鈹€鈹€ Draw View 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    .draw-layout {
      display: grid;
      grid-template-columns: minmax(0, 35%) minmax(0, 65%);
      gap: 16px;
      max-width: 1400px;
      height: calc(100vh - 72px);
      margin: 0 auto;
      padding: 24px 20px 140px;
      box-sizing: border-box;
      overscroll-behavior: none;
    }
    .right-col { display: contents; min-width: 0; }
    .draw-layout > .card.card-glow.panel {
      max-height: calc(100vh - 220px);
      overflow-y: auto;
      overscroll-behavior: contain;
      overscroll-behavior-y: contain;
      scroll-padding-bottom: 132px;
    }
    .right-extras {
      max-height: calc(100vh - 220px);
      overflow-y: auto;
      overscroll-behavior: contain;
      overscroll-behavior-y: contain;
    }
    .left-action-bar {
      position: fixed;
      left: var(--left-action-left, max(20px, calc((100vw - 1400px) / 2 + 20px)));
      bottom: 24px;
      width: var(--left-action-width, min(470px, calc(35vw - 24px)));
      min-width: 0;
      z-index: 40;
      margin: 0;
      padding: 12px;
      background: rgba(29, 21, 43, 0.96);
      border: 1px solid var(--card-border);
      border-radius: 18px;
      box-shadow: 0 0 24px rgba(168,85,247,0.24), var(--shadow);
      backdrop-filter: blur(12px);
      display: flex;
      gap: 10px;
      align-items: stretch;
    }
    .left-action-bar .gen-btn {
      margin-top: 0;
      flex: 1;
      min-width: 0;
    }
    .session-cache-btn {
      width: 54px;
      min-height: 54px;
      border-radius: 14px;
      border: 1px solid rgba(192,132,252,0.32);
      background: rgba(255,255,255,0.06);
      color: var(--text2);
      cursor: pointer;
      font-size: 1.35rem;
      font-weight: 700;
      position: relative;
      flex-shrink: 0;
      transition: all 0.18s;
    }
    .session-cache-btn:hover {
      border-color: var(--violet);
      color: white;
      background: rgba(192,132,252,0.16);
    }
    .session-cache-btn span {
      position: absolute;
      right: -5px;
      top: -7px;
      min-width: 20px;
      height: 20px;
      padding: 0 5px;
      border-radius: 999px;
      background: var(--pink);
      color: white;
      font-size: 0.72rem;
      display: grid;
      place-items: center;
      box-shadow: 0 0 10px rgba(232,121,249,0.5);
    }
    .session-cache-panel {
      position: fixed;
      right: 12px;
      top: 92px;
      width: 150px;
      max-height: calc(100vh - 128px);
      z-index: 70;
      padding: 10px;
      border: 1px solid var(--card-border);
      border-radius: 14px;
      background: rgba(24, 17, 38, 0.96);
      box-shadow: 0 0 22px rgba(168,85,247,0.22), var(--shadow);
      backdrop-filter: blur(12px);
      transform: translateX(calc(100% + 18px));
      opacity: 0;
      pointer-events: none;
      transition: transform 0.2s ease, opacity 0.2s ease;
    }
    .session-cache-panel.open {
      transform: translateX(0);
      opacity: 1;
      pointer-events: auto;
    }
    .session-cache-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      color: var(--text2);
      margin-bottom: 8px;
      font-weight: 700;
    }
    .session-cache-head button {
      width: 22px;
      height: 22px;
      border: 0;
      border-radius: 50%;
      background: rgba(255,255,255,0.08);
      color: var(--text2);
      cursor: pointer;
      line-height: 1;
    }
    .session-cache-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
      overflow-y: auto;
      max-height: calc(100vh - 178px);
      padding-right: 4px;
      overscroll-behavior: contain;
    }
    .session-cache-thumb {
      width: 100%;
      height: 150px;
      flex: 0 0 auto;
      border: 1px solid rgba(192,132,252,0.26);
      border-radius: 9px;
      padding: 4px;
      overflow: hidden;
      background: #08040f;
      cursor: pointer;
      transition: border-color 0.18s, transform 0.18s;
    }
    .session-cache-thumb:hover {
      border-color: var(--pink);
      transform: translateX(-2px);
    }
    .session-cache-thumb img {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: contain;
      object-position: center;
      border-radius: 6px;
    }
    .session-cache-empty {
      height: 60px;
      display: grid;
      place-items: center;
      color: var(--text3);
      font-size: 0.78rem;
    }
    .inline-generate-action { display: none; }
    .mobile-drawer-handle { display: none; }
    .right-col > .card:not(.right-extras) {
      grid-column: 2;
      grid-row: 1;
      align-self: start;
      position: sticky;
      top: 88px;
      height: calc(100vh - 112px);
      min-height: 520px;
      overflow: visible;
      display: grid;
      place-items: stretch;
    }
    .right-extras {
      grid-column: 1;
      align-self: start;
      padding-bottom: 148px;
      scroll-padding-bottom: 148px;
    }
    .draw-layout > .card.card-glow.panel .right-extras,
    .merged-left-extras {
      grid-column: auto;
      max-height: none;
      overflow: visible;
      margin-top: 16px;
      padding: 16px 0 148px;
      background: transparent;
      border: 0;
      border-top: 1px solid var(--card-border);
      border-radius: 0;
      box-shadow: none;
      backdrop-filter: none;
    }

    @media (orientation: portrait) {
      body.draw-view-lock {
        overflow: hidden;
        height: 100dvh;
      }
      #app,
      .main-content {
        height: 100dvh;
        min-height: 100dvh;
      }
      .main-content {
        padding-top: 64px;
      }
      .draw-layout {
        position: fixed;
        inset: 64px 0 0;
        display: block;
        width: 100%;
        max-width: none;
        height: auto;
        margin: 0;
        padding: 0;
        overflow: hidden;
      }
      .right-col {
        display: block;
        width: 100%;
        height: 100%;
      }
      .right-col > .card:not(.right-extras) {
        position: fixed;
        inset: 64px 0 112px;
        width: 100%;
        height: calc(100dvh - 176px);
        min-height: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: rgba(20, 14, 34, 0.92);
        overflow: hidden;
        display: block;
        z-index: 20;
      }
      .right-col > .card:not(.right-extras) > div:not(.result-area) {
        width: 100%;
        height: 100%;
        display: grid;
        place-items: center;
        padding: 24px;
      }
      .result-area,
      .result-img-wrap,
      .result-img {
        border-radius: 0;
      }
      .result-area {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        min-height: 0;
        overflow: hidden;
        z-index: 1;
      }
      .result-img-wrap {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        min-height: 0;
        background: transparent;
        display: block;
        overflow: hidden;
      }
      .result-img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        object-fit: contain;
        object-position: center center;
        display: block;
      }
      .result-info,
      .left-result-actions {
        display: none;
      }
      .draw-layout > .card.card-glow.panel {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: 66px;
        width: auto;
        max-height: min(78dvh, 720px);
        padding: 0 14px 16px;
        border-radius: 18px 18px 12px 12px;
        overflow-y: auto;
        z-index: 45;
        background: #1b1429;
        backdrop-filter: none;
        transform: translateY(calc(100% - 46px));
        transition: transform 0.22s ease, box-shadow 0.22s ease;
        scroll-padding-bottom: 18px;
      }
      .draw-layout.mobile-drawer-open > .card.card-glow.panel {
        transform: translateY(0);
        box-shadow: 0 -10px 36px rgba(168,85,247,0.34), var(--shadow);
      }
      .mobile-drawer-handle {
        position: sticky;
        top: 0;
        z-index: 2;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 10px;
        width: calc(100% + 28px);
        height: 46px;
        margin: 0 -14px 12px;
        padding: 0 16px;
        border: 0;
        border-bottom: 1px solid rgba(192,132,252,0.2);
        background: #1b1429;
        color: var(--text2);
        font-size: 0.95rem;
        font-weight: 700;
        cursor: pointer;
        backdrop-filter: none;
      }
      .drawer-grip {
        justify-self: end;
        width: 34px;
        height: 4px;
        border-radius: 999px;
        background: rgba(196,181,253,0.42);
      }
      .drawer-chevron {
        justify-self: start;
        color: var(--violet);
        transition: transform 0.2s ease;
      }
      .drawer-chevron.open {
        transform: rotate(180deg);
      }
      .draw-layout > .card.card-glow.panel .right-extras,
      .merged-left-extras {
        padding-bottom: 0;
      }
      .left-action-bar {
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: auto;
        min-width: 0;
        max-width: none;
        padding: 7px;
        border-radius: 14px;
        z-index: 60;
        background: #1b1429;
        backdrop-filter: none;
      }
      .left-action-bar .gen-btn {
        min-height: 42px;
        padding: 0 18px;
        border-radius: 11px;
        font-size: 1rem;
      }
      .session-cache-btn {
        width: 46px;
        min-height: 42px;
        border-radius: 11px;
        font-size: 1.12rem;
      }
      .session-cache-panel {
        top: 76px;
        right: 8px;
        width: 118px;
        max-height: calc(100dvh - 144px);
      }
      .session-cache-list {
        max-height: calc(100dvh - 194px);
      }
      .session-cache-thumb {
        height: 128px;
      }
      .ref-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .ref-tab {
        height: 38px;
      }
    }
    .panel { padding: 20px; }

    /* Prompt tabs */
    .tab-bar { display: flex; gap: 4px; margin-bottom: 12px; }
    .tab-btn {
      background: none; border: none; cursor: pointer;
      color: var(--text3); padding: 6px 16px; border-radius: 8px;
      font-size: 0.9rem; transition: all 0.2s; position: relative;
    }
    .tab-btn.active { color: var(--violet); }
    .tab-btn.active::after {
      content: '';
      position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%);
      width: 60%; height: 2px;
      background: linear-gradient(90deg, var(--violet), var(--pink));
      border-radius: 2px;
    }
    .prompt-area {
      width: 100%; min-height: 110px; resize: vertical;
      background: rgba(255,255,255,0.04);
      border: 1px solid var(--card-border);
      border-radius: 12px;
      color: var(--text); padding: 12px;
      font-size: 1rem; line-height: 1.6;
      font-family: inherit;
      transition: border-color 0.2s;
    }
    .prompt-area:focus { outline: none; border-color: var(--violet); }
    .prompt-area.neg:focus { border-color: var(--danger); }

    .prompt-library { margin-top: 10px; }
    .prompt-library-head {
      display: flex; align-items: center; justify-content: space-between; gap: 8px;
      margin-bottom: 8px;
    }
    .prompt-library-head > span {
      font-size: 0.78rem; color: var(--text3); letter-spacing: 0.05em;
    }
    .prompt-library-actions { display: flex; gap: 6px; flex-shrink: 0; }
    .prompt-library-actions button {
      background: rgba(192,132,252,0.1);
      border: 1px solid rgba(192,132,252,0.25);
      border-radius: 999px;
      padding: 3px 9px;
      font-size: 0.72rem;
      color: var(--light-purple);
      cursor: pointer;
      transition: background 0.16s, border-color 0.16s;
      white-space: nowrap;
    }
    .prompt-library-actions button:hover {
      background: rgba(192,132,252,0.18);
      border-color: rgba(192,132,252,0.42);
    }
    .prompt-folder-list {
      display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
    }
    .prompt-folder-chip {
      display: inline-flex; align-items: center; gap: 5px;
      min-height: 26px; border-radius: 7px;
      padding: 3px 8px;
      background: rgba(59,130,246,0.08);
      border: 1px solid rgba(96,165,250,0.18);
      color: #bfdbfe;
      font-size: 0.74rem;
      cursor: pointer;
    }
    .prompt-folder-chip.active {
      background: rgba(52,211,153,0.14);
      border-color: rgba(52,211,153,0.42);
      color: #a7f3d0;
    }
    .prompt-folder-chip small {
      color: inherit; opacity: 0.7; font-size: 0.68rem;
    }
    .prompt-folder-chip.folder { padding: 0 5px 0 8px; cursor: default; }
    .prompt-folder-chip .folder-name {
      border: 0; background: transparent; color: inherit;
      padding: 4px 0; cursor: pointer; max-width: 118px;
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      font: inherit;
    }
    .folder-mini {
      border: 0; background: transparent; color: inherit;
      opacity: 0.72; cursor: pointer; padding: 2px 2px; line-height: 1;
    }
    .folder-mini:hover { opacity: 1; }
    .prompt-empty {
      font-size: 0.78rem; color: var(--text3); padding: 6px 0;
    }
    .prompt-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
    .prompt-chip {
      display: flex; align-items: center; gap: 4px;
      background: rgba(168,85,247,0.08);
      border: 1px solid rgba(168,85,247,0.2);
      border-radius: 999px;
      padding: 3px 7px 3px 11px;
      cursor: pointer;
      min-width: 0;
    }
    .prompt-chip span {
      font-size: 0.78rem; color: var(--light-purple);
      max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .prompt-chip button {
      background: none; border: none; color: var(--text3);
      font-size: 0.72rem; cursor: pointer; padding: 0 2px; line-height: 1;
    }
    .prompt-chip button:hover { color: var(--text); }

    /* Quick tags */
    .tags-wrap { display: none; }


    /* Size cards */
    .size-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 16px; }
    .size-card {
      background: var(--card); border: 1px solid var(--card-border);
      border-radius: 12px; padding: 10px 8px; cursor: pointer;
      text-align: center; transition: all 0.2s;
    }
    .size-card:hover { border-color: var(--violet); }
    .size-card.selected {
      border-color: var(--violet);
      background: rgba(192,132,252,0.15);
      box-shadow: 0 0 12px rgba(192,132,252,0.2);
    }
    .size-card.disabled {
      opacity: 0.3;
      pointer-events: none;
      filter: grayscale(0.8);
    }
    .size-grid.locked {
      opacity: 0.9;
    }
    .size-thumb {
      display: block; margin: 0 auto 6px;
      background: linear-gradient(135deg, var(--violet), var(--pink));
      border-radius: 4px;
    }
    .size-label { font-size: 0.75rem; color: var(--text2); }

    /* Sliders */
    .slider-row { margin-bottom: 16px; }
    .slider-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.85rem; color: var(--text2); }
    .slider-val { color: var(--violet); font-weight: 600; min-width: 36px; text-align: right; flex-shrink: 0; }
    input[type=range] {
      width: 100%; height: 4px;
      -webkit-appearance: none; appearance: none;
      background: linear-gradient(90deg, var(--violet) var(--pct, 50%), rgba(255,255,255,0.1) var(--pct, 50%));
      border-radius: 2px; cursor: pointer;
    }
    input[type=range]::-webkit-slider-thumb {
      -webkit-appearance: none; width: 16px; height: 16px;
      border-radius: 50%; background: white;
      box-shadow: 0 0 6px rgba(192,132,252,0.6);
      cursor: pointer;
    }

    /* Select */
    .magic-select {
      width: 100%;
      background: rgba(255,255,255,0.06);
      border: 1px solid var(--card-border);
      color: var(--text); padding: 9px 12px;
      border-radius: 10px; font-size: 0.98rem;
      appearance: none; cursor: pointer;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23c4b5fd' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 10px center;
      background-size: 20px;
      padding-right: 36px;
    }
    .magic-select option {
      background: #1a1035;
      color: #f3e8ff;
    }
    .magic-select:focus { outline: none; border-color: var(--violet); }

    /* Input */
    .magic-input {
      width: 100%; background: rgba(255,255,255,0.06);
      border: 1px solid var(--card-border);
      color: var(--text); padding: 9px 12px;
      border-radius: 10px; font-size: 0.98rem;
    }
    .magic-input:focus { outline: none; border-color: var(--violet); }

    /* Seed row */
    .seed-row { display: flex; gap: 8px; align-items: center; }
    .seed-row .magic-input { flex: 1; }
    .icon-btn {
      background: var(--card); border: 1px solid var(--card-border);
      color: var(--text2); width: 38px; height: 38px; border-radius: 10px;
      cursor: pointer; font-size: 1rem; display: flex; align-items: center;
      justify-content: center; transition: all 0.2s; flex-shrink: 0;
    }
    .icon-btn:hover { border-color: var(--violet); color: var(--violet); }

    /* Format toggle */
    .format-toggle { display: flex; gap: 8px; }
    .fmt-btn {
      flex: 1; background: var(--card); border: 1px solid var(--card-border);
      color: var(--text3); padding: 7px; border-radius: 10px;
      cursor: pointer; font-size: 0.85rem; transition: all 0.2s;
    }
    .fmt-btn.active {
      background: rgba(192,132,252,0.2); border-color: var(--violet);
      color: var(--violet);
    }

    /* Characters */
    .section-header {
      display: flex; justify-content: space-between; align-items: center;
      margin-bottom: 12px; cursor: pointer;
    }
    .section-title { font-size: 0.9rem; color: var(--text2); font-weight: 600; }
    .chevron { transition: transform 0.2s; font-size: 0.75rem; color: var(--text3); }
    .chevron.open { transform: rotate(180deg); }
    .char-item {
      background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
      border-radius: 12px; padding: 12px; margin-bottom: 8px;
    }
    .char-item textarea {
      width: 100%; min-height: 60px; resize: none;
      background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
      color: var(--text); padding: 8px; border-radius: 8px; font-size: 0.95rem;
      font-family: inherit;
    }
    .char-item textarea:focus { outline: none; border-color: var(--violet); }
    .char-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
    .char-label { font-size: 0.8rem; color: var(--text3); }
    .char-del { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 0.8rem; }

    /* Generate button */
    .gen-btn {
      width: 100%; padding: 16px;
      background: linear-gradient(135deg, var(--violet), var(--pink), var(--purple));
      background-size: 200% 200%;
      border: none; border-radius: 14px; color: white;
      font-size: 1.1rem; font-weight: 700; cursor: pointer;
      transition: all 0.3s; box-shadow: 0 4px 24px rgba(168,85,247,0.4);
      margin-top: 8px; letter-spacing: 0.5px;
    }
    .gen-btn:hover:not(:disabled) {
      background-position: right;
      transform: translateY(-2px);
      box-shadow: 0 8px 32px rgba(168,85,247,0.55);
    }
    .gen-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
    .gen-btn.loading {
      animation: pulseBg 1.5s ease-in-out infinite;
    }
    @keyframes pulseBg {
      0%, 100% { box-shadow: 0 4px 24px rgba(168,85,247,0.4); }
      50% { box-shadow: 0 4px 40px rgba(232,121,249,0.7); }
    }

    /* Result */
    .result-area {
      position: relative;
      margin-top: 0;
      width: 100%;
      height: 100%;
      min-height: 0;
      overflow: hidden;
    }
    .result-img-wrap {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      min-width: 0;
      min-height: 0;
      border-radius: 14px;
      overflow: hidden;
      border: 1px solid var(--card-border);
      box-shadow: 0 0 40px rgba(168,85,247,0.25);
      display: grid;
      place-items: center;
      background: #0a0514;
    }
    .result-img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      max-width: none;
      max-height: none;
      display: block;
      object-fit: contain;
      object-position: center center;
      border-radius: 0;
    }
    .result-info {
      display: flex; align-items: center; justify-content: space-between;
      margin-top: 10px; padding: 10px 14px;
      background: var(--card); border-radius: 10px;
      border: 1px solid var(--card-border); font-size: 0.85rem;
    }
    .seed-info { color: var(--text2); }
    .seed-info span { color: var(--violet); font-weight: 600; }
    .result-actions { display: flex; gap: 8px; }
    .left-result-actions { flex-wrap: wrap; margin-top: 8px; }
    .right-col .result-info { display: none; }
    .right-col > .card:not(.right-extras) > div:not(.result-area) {
      align-self: center;
      justify-self: center;
    }
    .action-btn {
      background: var(--card); border: 1px solid var(--card-border);
      color: var(--text2); padding: 6px 14px; border-radius: 8px;
      cursor: pointer; font-size: 0.8rem; transition: all 0.2s;
    }
    .action-btn:hover { border-color: var(--violet); color: var(--violet); }
    .action-btn.save-private { border-color: rgba(96,165,250,0.42); color: #bfdbfe; }
    .action-btn.save-private:hover { background: rgba(96,165,250,0.1); border-color: #60a5fa; color: #dbeafe; }
    .action-btn.share { border-color: rgba(52,211,153,0.4); color: var(--success); }
    .action-btn.share:hover { background: rgba(52,211,153,0.1); }

    /* Loading spinner */
    .spinner { display: flex; align-items: center; justify-content: center; height: 200px; }
    .spin-ring {
      width: 48px; height: 48px; border-radius: 50%;
      border: 3px solid rgba(192,132,252,0.2);
      border-top-color: var(--violet);
      animation: spin 0.8s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* 鈹€鈹€鈹€ Gallery View 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    .gallery-view { max-width: 1440px; margin: 0 auto; padding: 22px 20px 34px; }
    .gallery-hero {
      display: flex; justify-content: space-between; align-items: flex-end;
      gap: 16px; margin-bottom: 14px;
    }
    .gallery-title { font-size: 1.45rem; font-weight: 800; color: var(--text); letter-spacing: 0; }
    .gallery-subtitle { margin-top: 4px; color: var(--text3); font-size: 0.86rem; }
    .gallery-tabs {
      display: inline-flex; gap: 4px; padding: 4px;
      border: 1px solid rgba(255,255,255,0.08);
      background: rgba(255,255,255,0.04); border-radius: 8px;
    }
    .gallery-tab {
      min-width: 64px; height: 34px; border: 0; border-radius: 6px;
      color: var(--text2); background: transparent; cursor: pointer;
      font-weight: 700; transition: background 0.16s, color 0.16s;
    }
    .gallery-tab.active { background: rgba(52,211,153,0.16); color: #a7f3d0; }
    .gallery-toolbar {
      display: grid; grid-template-columns: minmax(220px, 1fr) 210px 150px 150px;
      gap: 10px; align-items: center; margin-bottom: 18px;
    }
    .gallery-search { min-width: 0; }
    .gallery-filter-select { min-width: 0; font-size: 0.88rem; }
    .gallery-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 14px;
    }
    .gallery-card {
      margin-bottom: 0;
      background: rgba(18, 14, 32, 0.84); border: 1px solid rgba(255,255,255,0.08);
      border-radius: 8px; overflow: hidden; cursor: pointer;
      transition: all 0.2s;
      display: flex;
      flex-direction: column;
      min-width: 0;
    }
    .gallery-card:hover {
      border-color: rgba(52,211,153,0.45);
      box-shadow: 0 12px 32px rgba(0,0,0,0.22);
      transform: translateY(-2px);
    }
    .gallery-thumb-wrap { position: relative; aspect-ratio: 1 / 1.18; background: rgba(0,0,0,0.24); overflow: hidden; }
    .gallery-thumb-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; cursor: zoom-in; }
    .gallery-privacy {
      position: absolute; top: 8px; right: 8px; padding: 3px 8px;
      border-radius: 999px; font-size: 0.72rem; font-weight: 800;
      color: #052e2b; background: #67e8f9; border: 1px solid rgba(255,255,255,0.2);
    }
    .gallery-privacy.private { color: #451a03; background: #fbbf24; }
    .gallery-privacy.detail { position: static; align-self: flex-start; }
    .gallery-card-info { padding: 10px 12px; }
    .gallery-meta-line {
      display: flex; justify-content: space-between; gap: 8px;
      color: var(--text3); font-size: 0.72rem; margin-bottom: 6px;
    }
    .gallery-meta-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .gallery-card-prompt {
      font-size: 0.8rem; color: var(--text2);
      display: -webkit-box; -webkit-line-clamp: 2;
      -webkit-box-orient: vertical; overflow: hidden;
      line-height: 1.4;
      min-height: 2.24em;
    }
    .gallery-card-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; min-height: 20px; }
    .gallery-card-tags span {
      padding: 2px 7px; border-radius: 999px; color: #bfdbfe;
      background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.18);
      font-size: 0.68rem;
    }
    .gallery-card-time { font-size: 0.7rem; color: var(--text3); margin-top: 6px; opacity: 0.6; }
    .gallery-card-footer { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px 8px; }
    .like-btn {
      display: flex; align-items: center; gap: 4px;
      background: none; border: none; cursor: pointer;
      color: var(--text3); font-size: 0.85rem; transition: all 0.2s;
      padding: 4px 8px; border-radius: 8px;
    }
    .like-btn:hover { background: rgba(248,113,113,0.1); }
    .like-btn.liked { color: #f87171; }
    .like-btn .heart { font-size: 1rem; transition: transform 0.2s; }
    .like-btn:hover .heart { transform: scale(1.2); }
    .like-btn.liked .heart { animation: heartPop 0.3s ease; }
    .favorite-btn {
      display: inline-flex; align-items: center; gap: 4px;
      background: none; border: 0; color: var(--text3); cursor: pointer;
      font-size: 0.86rem; padding: 4px 8px; border-radius: 8px;
    }
    .favorite-btn:hover { background: rgba(251,191,36,0.1); }
    .favorite-btn.active { color: #fbbf24; }
    @keyframes heartPop { 0% { transform: scale(1); } 50% { transform: scale(1.4); } 100% { transform: scale(1); } }
    .like-count { font-size: 0.78rem; }
    .load-more-btn {
      display: block; margin: 24px auto; padding: 12px 32px;
      background: linear-gradient(135deg, rgba(192,132,252,0.2), rgba(232,121,249,0.2));
      border: 1px solid var(--card-border); border-radius: 12px;
      color: var(--violet); font-size: 0.95rem; cursor: pointer;
      transition: all 0.2s;
    }
    .load-more-btn:hover { border-color: var(--violet); background: rgba(192,132,252,0.3); }
    .load-more-btn:disabled { opacity: 0.5; cursor: not-allowed; }
    .detail-like-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
    .gallery-pagination { display: flex; justify-content: center; gap: 8px; margin-top: 24px; }
    .page-btn {
      background: var(--card); border: 1px solid var(--card-border);
      color: var(--text2); width: 36px; height: 36px; border-radius: 8px;
      cursor: pointer; font-size: 0.9rem; transition: all 0.2s;
    }
    .page-btn:hover, .page-btn.active { border-color: var(--violet); color: var(--violet); }
    .page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
    .gallery-empty {
      text-align: center; padding: 60px 20px; color: var(--text3);
    }
    .gallery-empty-icon { font-size: 3rem; margin-bottom: 12px; }
    @media (max-width: 860px) {
      .gallery-hero { align-items: stretch; flex-direction: column; }
      .gallery-tabs { width: 100%; }
      .gallery-tab { flex: 1; }
      .gallery-toolbar { grid-template-columns: 1fr 1fr; }
    }
    @media (max-width: 560px) {
      .gallery-view { padding: 16px 12px 28px; }
      .gallery-toolbar { grid-template-columns: 1fr; }
      .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
      .gallery-card-info { padding: 8px; }
    }

    /* 鈹€鈹€鈹€ Modals 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    .modal-overlay {
      position: fixed; inset: 0; z-index: 200;
      background: rgba(0,0,0,0.7);
      backdrop-filter: blur(6px);
      display: flex; align-items: center; justify-content: center;
      padding: 20px;
      animation: overlayIn 0.2s ease;
    }
    @keyframes overlayIn { from { opacity:0; } to { opacity:1; } }
    .modal-box {
      background: var(--bg2);
      border: 1px solid var(--card-border);
      border-radius: 20px;
      padding: 28px;
      width: 100%; max-width: 440px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.5);
      animation: modalIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
      max-height: 90vh; overflow-y: auto;
    }
    .modal-box.wide { max-width: min(1120px, calc(100vw - 32px)); }
    @keyframes modalIn { from { opacity:0; transform:scale(0.9); } to { opacity:1; transform:none; } }
    .modal-title {
      font-size: 1.2rem; font-weight: 700; margin-bottom: 20px;
      background: linear-gradient(135deg, var(--violet), var(--pink));
      -webkit-background-clip: text; -webkit-text-fill-color: transparent;
      background-clip: text;
    }
    .modal-close {
      position: absolute; top: 20px; right: 20px;
      background: none; border: none; color: var(--text3);
      cursor: pointer; font-size: 1.2rem;
    }
    .form-group { margin-bottom: 16px; }
    .form-label { display: block; font-size: 0.85rem; color: var(--text2); margin-bottom: 6px; }
    .form-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; }
    .modal-actions { display: flex; gap: 10px; margin-top: 20px; }
    .btn-primary {
      flex: 1; background: linear-gradient(135deg, var(--violet), var(--pink));
      border: none; color: white; padding: 11px 20px; border-radius: 10px;
      cursor: pointer; font-size: 0.95rem; font-weight: 600;
      transition: all 0.2s;
    }
    .btn-primary:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
    .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
    .btn-secondary {
      background: var(--card); border: 1px solid var(--card-border);
      color: var(--text2); padding: 11px 20px; border-radius: 10px;
      cursor: pointer; font-size: 0.95rem; transition: all 0.2s;
    }
    .btn-secondary:hover { border-color: var(--violet); color: var(--violet); }
    .btn-secondary.danger { border-color: rgba(248,113,113,0.42); color: var(--danger); }
    .btn-secondary.danger:hover { background: rgba(248,113,113,0.1); color: #fecaca; }

    /* 鈹€鈹€ 瑁佸壀/缂╂斁寮圭獥 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    .crop-dialog-box { max-width: 680px !important; }
    .crop-dialog-overlay { z-index: 999 !important; background: rgba(0,0,0,0.88) !important; }
    .crop-mode-tabs {
      display: flex; gap: 8px; margin-bottom: 14px;
    }
    .crop-mode-tabs button {
      flex: 1; padding: 9px 0; border-radius: 10px;
      border: 1px solid var(--card-border);
      background: var(--card); color: var(--text2);
      cursor: pointer; font-size: 0.9rem; transition: all 0.2s;
    }
    .crop-mode-tabs button.active {
      background: linear-gradient(135deg, var(--violet), var(--pink));
      border-color: transparent; color: white; font-weight: 600;
    }
    .crop-size-info {
      display: flex; align-items: center; gap: 10px;
      font-size: 0.82rem; color: var(--text3); margin-bottom: 14px;
    }
    .crop-size-info b { color: var(--text2); }
    .crop-arrow { color: var(--violet); font-size: 1rem; }
    .crop-preview-wrap { margin-bottom: 4px; }
    .crop-canvas-wrap {
      position: relative;
      display: inline-block;
      cursor: move;
      border-radius: 8px;
      overflow: hidden;
      user-select: none;
      margin: 0 auto;
      display: flex;
      justify-content: center;
      max-height: 60vh;
      overflow: hidden;
    }
    .crop-bg-img {
      display: block;
      border-radius: 8px;
    }
    .crop-frame {
      position: absolute;
      border: 2px solid var(--violet);
      box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), 0 0 12px rgba(192,132,252,0.6);
      cursor: move;
      box-sizing: border-box;
      border-radius: 3px;
    }
    .crop-frame::before, .crop-frame::after {
      content: '';
      position: absolute;
      background: var(--violet);
      border-radius: 2px;
    }
    .crop-frame::before { top:50%; left:-8px; width:8px; height:2px; transform:translateY(-50%); }
    .crop-frame::after  { top:-8px; left:50%; width:2px; height:8px; transform:translateX(-50%); }

    /* Gallery detail modal */
    .gallery-detail-modal { max-width: min(1060px, calc(100vw - 32px)); }
    .gallery-detail-grid { display: grid; grid-template-columns: minmax(280px, 1.05fr) minmax(280px, 0.95fr); gap: 18px; }
    .detail-img-wrap { border-radius: 8px; overflow: hidden; background: #05020b; min-height: 280px; display: flex; align-items: center; justify-content: center; }
    .detail-img { width: 100%; max-height: 72vh; object-fit: contain; display: block; cursor: zoom-in; }
    .detail-side { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
    .detail-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
    .detail-title { font-size: 1.05rem; font-weight: 800; color: var(--text); }
    .detail-sub { margin-top: 3px; color: var(--text3); font-size: 0.78rem; }
    .detail-actions { display: flex; gap: 8px; align-items: center; }
    .detail-section { margin-bottom: 0; }
    .detail-label { font-size: 0.75rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 4px; }
    .detail-value { font-size: 0.875rem; color: var(--text2); line-height: 1.5; word-break: break-word; }
    .detail-params { display: flex; flex-wrap: wrap; gap: 8px; }
    .param-tag {
      background: rgba(168,85,247,0.1); border: 1px solid rgba(168,85,247,0.2);
      color: var(--text2); padding: 3px 10px; border-radius: 6px; font-size: 0.78rem;
    }
    .detail-edit {
      display: flex; flex-direction: column; gap: 8px;
      background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.08);
      border-radius: 8px; padding: 12px;
    }
    .detail-edit label { font-size: 0.78rem; color: var(--text2); font-weight: 700; }
    .detail-edit textarea { resize: vertical; min-height: 72px; }
    .privacy-toggle {
      display: flex; align-items: center; gap: 8px; cursor: pointer;
      color: var(--text2); font-size: 0.82rem;
    }
    .privacy-toggle input { width: 16px; height: 16px; accent-color: #34d399; }
    .detail-footer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
    @media (max-width: 760px) {
      .gallery-detail-grid { grid-template-columns: 1fr; }
      .detail-img { max-height: 56vh; }
    }

    /* 鈹€鈹€鈹€ Toast 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    .toast-container {
      position: fixed; bottom: 24px; right: 24px; z-index: 9999;
      display: flex; flex-direction: column; gap: 8px; pointer-events: none;
    }
    .toast {
      background: var(--bg2); border: 1px solid var(--card-border);
      border-radius: 12px; padding: 12px 18px;
      font-size: 0.9rem; color: var(--text);
      box-shadow: var(--shadow);
      animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
      pointer-events: auto; max-width: 320px;
      display: flex; align-items: center; gap: 10px;
    }
    .toast.success { border-color: rgba(52,211,153,0.4); }
    .toast.error { border-color: rgba(248,113,113,0.4); }
    .toast-icon { font-size: 1.1rem; }
    @keyframes toastIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:none; } }
    @keyframes toastOut { from { opacity:1; transform:none; } to { opacity:0; transform:translateX(20px); } }

    /* 鈹€鈹€鈹€ Misc 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    .divider { height: 1px; background: var(--card-border); margin: 16px 0; }
    .row-label { font-size: 0.85rem; color: var(--text2); margin-bottom: 8px; font-weight: 500; }
    .text-link {
      background: none; border: none; color: var(--violet); cursor: pointer;
      font-size: 0.9rem; text-decoration: underline;
    }
    .text-link:hover { color: var(--pink); }
    .tab-content { animation: tabFade 0.2s ease; }
    @keyframes tabFade { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }

    /* scrollbar */
    ::-webkit-scrollbar { width: 6px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: rgba(192,132,252,0.3); border-radius: 3px; }
    ::-webkit-scrollbar-thumb:hover { background: rgba(192,132,252,0.5); }

    .no-login-banner {
      text-align: center; padding: 80px 20px; color: var(--text3);
    }
    .no-login-icon { font-size: 3rem; margin-bottom: 16px; }
    .no-login-text { font-size: 1rem; margin-bottom: 20px; }
    .model-select-row { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
    .model-select-row .magic-select { flex: 1; }
    .model-refresh { flex-shrink: 0; }

    /* Admin console */
    .admin-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 14px; padding-right: 42px; }
    .admin-title { text-align: left; margin-bottom: 2px; }
    .admin-subtitle { color: var(--text3); font-size: 0.84rem; }
    .admin-tabs {
      display: flex; gap: 6px; padding: 4px; margin-bottom: 16px;
      background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.08);
      border-radius: 8px; overflow-x: auto;
    }
    .admin-tab {
      min-width: 92px; height: 34px; border: 0; border-radius: 6px;
      color: var(--text2); background: transparent; cursor: pointer;
      font-weight: 800; transition: background 0.16s, color 0.16s;
    }
    .admin-tab.active { background: rgba(96,165,250,0.16); color: #bfdbfe; }
    .admin-panel { animation: tabFade 0.2s ease; }
    .usage-grid {
      display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 10px; margin-bottom: 14px;
    }
    .usage-stat {
      background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
      border-radius: 8px; padding: 12px; min-width: 0;
    }
    .usage-stat span { display: block; color: var(--text3); font-size: 0.74rem; margin-bottom: 6px; }
    .usage-stat strong { display: block; color: var(--text); font-size: 1.22rem; line-height: 1.1; overflow-wrap: anywhere; }
    .admin-grid-two { display: grid; grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr); gap: 12px; }
    .admin-card-flat {
      background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.08);
      border-radius: 8px; padding: 12px; min-height: 220px;
    }
    .admin-card-title { font-weight: 800; margin-bottom: 10px; color: var(--text); }
    .usage-row, .event-row {
      display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
      padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
      font-size: 0.84rem;
    }
    .usage-row:last-child, .event-row:last-child { border-bottom: 0; }
    .usage-row em { font-style: normal; color: var(--text3); }
    .event-row { grid-template-columns: auto 1fr; align-items: start; }
    .event-row b { display: block; color: var(--text2); font-size: 0.84rem; }
    .event-row small { display: block; color: var(--text3); margin-top: 2px; overflow-wrap: anywhere; }
    .event-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; background: #60a5fa; }
    .event-dot.success { background: #34d399; }
    .event-dot.failed { background: #f87171; }
    .event-dot.blocked { background: #fbbf24; }
    .admin-empty { color: var(--text3); font-size: 0.8rem; padding: 12px 0; }
    .risk-grid {
      display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px; margin-bottom: 14px;
    }
    .risk-switch, .risk-field {
      background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.08);
      border-radius: 8px; padding: 12px; min-width: 0;
    }
    .risk-switch {
      display: flex; align-items: center; justify-content: space-between; gap: 16px;
    }
    .risk-switch b, .risk-field span { display: block; color: var(--text); font-size: 0.9rem; margin-bottom: 3px; }
    .risk-switch small { display: block; color: var(--text3); font-size: 0.74rem; }
    .risk-switch input[type="checkbox"] { width: 42px; height: 22px; flex-shrink: 0; accent-color: #34d399; }
    .risk-field span { margin-bottom: 8px; }
    .risk-field.wide { grid-column: 1 / -1; }
    .admin-actions-right { display: flex; justify-content: flex-end; }
    .user-table {
      border: 1px solid rgba(255,255,255,0.08); border-radius: 8px;
      overflow: hidden; background: rgba(255,255,255,0.03);
    }
    .user-row {
      display: grid; grid-template-columns: minmax(220px, 1.4fr) 130px 80px 120px minmax(190px, 1fr);
      gap: 10px; align-items: center; padding: 10px 12px;
      border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 0.84rem;
    }
    .user-row:last-child { border-bottom: 0; }
    .user-row.head { color: var(--text3); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
    .user-cell-main { display: flex; gap: 10px; align-items: center; min-width: 0; }
    .user-avatar {
      width: 34px; height: 34px; border-radius: 8px;
      background: linear-gradient(135deg, #60a5fa, #34d399);
      color: #07111f; display: flex; align-items: center; justify-content: center;
      font-weight: 900; flex-shrink: 0;
    }
    .user-cell-main b { display: block; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .user-cell-main small { display: block; color: var(--text3); margin-top: 2px; }
    .status-pill {
      display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 999px;
      font-style: normal; font-size: 0.72rem; font-weight: 800; margin-right: 4px;
    }
    .status-pill.ok { background: rgba(52,211,153,0.14); color: #a7f3d0; }
    .status-pill.admin { background: rgba(96,165,250,0.14); color: #bfdbfe; }
    .status-pill.banned { background: rgba(248,113,113,0.14); color: #fecaca; }
    .user-actions { display: flex; gap: 6px; flex-wrap: wrap; }
    .danger-mini {
      background: rgba(248,113,113,0.14); color: #fecaca;
      border: 1px solid rgba(248,113,113,0.28); border-radius: 6px;
    }
    @media (max-width: 900px) {
      .usage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .admin-grid-two, .risk-grid { grid-template-columns: 1fr; }
      .risk-field.wide { grid-column: auto; }
      .user-row { grid-template-columns: 1fr; gap: 6px; }
      .user-row.head { display: none; }
    }

    /* Announcement button */
    .ann-btn {
      background: none; border: 1px solid rgba(232,121,249,0.4);
      color: var(--pink); padding: 5px 12px; border-radius: 10px;
      cursor: pointer; font-size: 0.82rem;
      display: flex; align-items: center; gap: 5px;
      transition: all 0.2s; flex-shrink: 0; max-width: 160px;
    }
    .ann-btn:hover { background: rgba(232,121,249,0.1); }
    .ann-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100px; }
    .announcement-admin { margin-top: 2px; }
    .ann-admin-head {
      display: flex; align-items: center; justify-content: space-between;
      gap: 16px; margin-bottom: 14px;
    }
    .ann-admin-title,
    .ann-editor-title {
      font-size: 1rem; font-weight: 800; color: var(--text);
    }
    .ann-admin-sub,
    .ann-editor-sub {
      margin-top: 3px; color: var(--text3); font-size: 0.78rem;
    }
    .ann-new-btn { flex: 0 0 auto; padding: 9px 14px; font-size: 0.86rem; }
    .ann-admin-grid {
      display: grid;
      grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.5fr);
      gap: 14px;
      align-items: start;
    }
    .ann-list {
      min-height: 360px; max-height: 58vh; overflow-y: auto;
      border: 1px solid rgba(192,132,252,0.18);
      border-radius: 12px; padding: 8px;
      background: rgba(255,255,255,0.035);
    }
    .ann-row {
      width: 100%; border: 1px solid transparent;
      background: transparent; color: inherit; cursor: pointer;
      border-radius: 10px; padding: 10px;
      display: grid; grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px; text-align: left; transition: all 0.18s;
    }
    .ann-row + .ann-row { margin-top: 6px; }
    .ann-row:hover,
    .ann-row.active {
      border-color: rgba(192,132,252,0.32);
      background: rgba(192,132,252,0.09);
    }
    .ann-row-title {
      color: var(--text); font-weight: 700; font-size: 0.9rem;
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .ann-row-text {
      margin-top: 4px; color: var(--text2); font-size: 0.78rem;
      line-height: 1.45;
    }
    .ann-row-meta { margin-top: 6px; color: var(--text3); font-size: 0.7rem; }
    .ann-status {
      align-self: start; border-radius: 999px; padding: 3px 8px;
      border: 1px solid rgba(52,211,153,0.32);
      color: var(--success); background: rgba(52,211,153,0.08);
      font-size: 0.72rem; white-space: nowrap;
    }
    .ann-status.off {
      border-color: rgba(156,163,175,0.28);
      color: var(--text3); background: rgba(255,255,255,0.05);
    }
    .ann-empty {
      height: 100%; min-height: 220px; display: grid; place-items: center;
      text-align: center; color: var(--text3); font-size: 0.85rem;
    }
    .ann-empty-icon { font-size: 2rem; margin-bottom: 8px; }
    .ann-editor {
      border: 1px solid rgba(192,132,252,0.2);
      border-radius: 12px; padding: 16px;
      background: rgba(255,255,255,0.045);
    }
    .ann-editor-head {
      display: flex; align-items: center; justify-content: space-between;
      gap: 16px; margin-bottom: 16px;
    }
    .ann-enable {
      display: flex; align-items: center; gap: 8px;
      color: var(--text2); font-size: 0.82rem; cursor: pointer; flex-shrink: 0;
    }
    .ann-field { margin-bottom: 13px; }
    .ann-field label {
      display: block; margin-bottom: 6px; color: var(--text2);
      font-size: 0.78rem; font-weight: 700;
    }
    .ann-title-input { font-size: 0.95rem; font-weight: 700; }
    .ann-content-input {
      min-height: 180px; resize: vertical; font-size: 0.9rem;
      line-height: 1.7;
    }
    .ann-count { text-align: right; color: var(--text3); font-size: 0.72rem; margin-top: 5px; }
    .ann-preview {
      border: 1px solid rgba(192,132,252,0.16);
      border-radius: 10px; padding: 12px; margin-top: 6px;
      background: rgba(15,10,30,0.28);
    }
    .ann-preview-label {
      color: var(--text3); font-size: 0.7rem; text-transform: uppercase;
      margin-bottom: 7px;
    }
    .ann-preview-title { color: var(--text); font-size: 0.95rem; font-weight: 800; margin-bottom: 6px; }
    .ann-preview-content { color: var(--text2); white-space: pre-wrap; line-height: 1.7; font-size: 0.85rem; }
    .ann-actions {
      display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
      margin-top: 14px;
    }
    .ann-actions .btn-primary,
    .ann-actions .btn-secondary { flex: 0 0 auto; padding: 9px 13px; font-size: 0.84rem; }
    .announcement-modal { max-width: 620px; }
    .ann-public-list {
      display: grid; gap: 10px; max-height: 54vh; overflow-y: auto; margin-bottom: 18px;
    }
    .ann-public-item {
      background: rgba(192,132,252,0.06);
      border: 1px solid rgba(192,132,252,0.18);
      border-radius: 12px; padding: 16px 18px;
    }
    .ann-public-title { color: var(--text); font-weight: 800; font-size: 1rem; margin-bottom: 8px; }
    .ann-public-content { color: var(--text2); white-space: pre-wrap; line-height: 1.8; font-size: 0.9rem; }
    .ann-public-time { color: var(--text3); font-size: 0.72rem; margin-top: 10px; }
    .ann-public-footer {
      display: flex; align-items: center; justify-content: space-between; gap: 14px;
    }
    .ann-no-more {
      display: flex; align-items: center; gap: 6px; color: var(--text3);
      font-size: 0.78rem; cursor: pointer;
    }
    .ann-no-more input { accent-color: var(--violet); width: 14px; height: 14px; }
    @media (max-width: 720px) {
      .ann-admin-grid { grid-template-columns: 1fr; }
      .ann-list { max-height: 260px; min-height: 180px; }
      .ann-public-footer { align-items: stretch; flex-direction: column; }
    }
    @media (max-width: 600px) {
      .ann-label { display: none; }
      .ann-btn { padding: 5px 8px; max-width: none; border: none; font-size: 1rem; }
    }
    /* 鈹€鈹€鈹€ 鍙傝€冨浘闈㈡澘 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    .ref-tabs {
      display: grid;
      grid-template-columns: 0.78fr 0.92fr 1.35fr 1.02fr 1.02fr;
      gap: 6px;
      background: rgba(255,255,255,0.03);
      padding: 6px;
      border-radius: 11px;
      margin-bottom: 12px;
    }
    .ref-tab {
      min-width: 0;
      height: 36px;
      padding: 0 8px;
      border-radius: 8px;
      border: 1px solid rgba(192,132,252,0.08);
      background: rgba(255,255,255,0.035);
      color: var(--text2);
      font-size: 0.86rem;
      font-weight: 600;
      line-height: 1;
      cursor: pointer;
      transition: all 0.18s;
      white-space: nowrap;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
    }
    .ref-tab:hover { color:var(--text); border-color:rgba(192,132,252,0.28); background:rgba(192,132,252,0.08); }
    .ref-tab.active { background:linear-gradient(135deg, rgba(192,132,252,0.42), rgba(232,121,249,0.35)); border-color:rgba(232,121,249,0.36); color:white; box-shadow:0 0 10px rgba(192,132,252,0.28); }
    .uploader { border:1.5px dashed rgba(192,132,252,0.4); border-radius:12px; padding:18px 14px; text-align:center; cursor:pointer; transition:all 0.2s; background:rgba(192,132,252,0.04); }
    .uploader:hover { border-color:var(--pink); background:rgba(232,121,249,0.08); }
    .uploader.dragover { border-color:var(--pink); background:rgba(232,121,249,0.15); transform:scale(1.01); }
    .uploader .hint { font-size:0.85rem; color:var(--text3); }
    .uploader .hint b { color:var(--pink); }
    .ref-thumb-wrap { position:relative; display:inline-block; }
    .ref-thumb { width:100%; max-width:200px; border-radius:10px; border:1px solid rgba(192,132,252,0.25); display:block; }
    .ref-thumb-del { position:absolute; top:6px; right:6px; width:24px; height:24px; border-radius:50%; border:none; background:rgba(0,0,0,0.6); color:white; cursor:pointer; font-size:0.85rem; display:flex; align-items:center; justify-content:center; backdrop-filter:blur(4px); }
    .ref-thumb-del:hover { background:#f87171; }
    .vibe-card { background:rgba(255,255,255,0.04); border:1px solid rgba(192,132,252,0.18); border-radius:12px; padding:12px; margin-bottom:10px; }
    .vibe-card-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; font-size:0.82rem; color:var(--text2); font-weight:600; }
    .cache-badge { font-size:0.7rem; padding:2px 8px; border-radius:6px; background:rgba(74,222,128,0.15); color:#4ade80; border:1px solid rgba(74,222,128,0.3); }
    /* mask editor */
    .mask-editor { background:#1a1024; border-radius:12px; padding:10px; border:1px solid rgba(192,132,252,0.2); }
    .mask-toolbar { display:flex; gap:6px; align-items:center; margin-bottom:8px; flex-wrap:wrap; font-size:0.78rem; }
    .mask-toolbar button { padding:5px 10px; border-radius:6px; border:1px solid rgba(192,132,252,0.3); background:rgba(255,255,255,0.04); color:var(--text2); cursor:pointer; font-size:0.78rem; }
    .mask-toolbar button:hover { background:rgba(192,132,252,0.15); color:white; }
    .mask-toolbar button.on { background:var(--pink); color:white; border-color:var(--pink); }
    .mask-canvas-wrap { position:relative; display:flex; justify-content:center; background:#000; border-radius:8px; overflow:hidden; }
    .mask-canvas-wrap canvas { display:block; max-width:100%; cursor:crosshair; touch-action:none; }
    .ref-row-label { font-size:0.78rem; color:var(--text3); margin:8px 0 4px; display:flex; justify-content:space-between; }
    .ref-row-label .slider-val { color:var(--pink); font-family:monospace; }

    /* 鈹€鈹€鈹€ Lightbox 鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€ */
    .lightbox-overlay {
      position: fixed; inset: 0; z-index: 9999;
      background: rgba(0,0,0,0.92);
      backdrop-filter: blur(12px);
      display: flex; align-items: center; justify-content: center;
      flex-direction: column;
      animation: lbFadeIn 0.25s ease;
    }
    @keyframes lbFadeIn { from { opacity:0; } to { opacity:1; } }
    .lightbox-img-wrap {
      display: flex; align-items: center; justify-content: center;
      max-width: 95vw; max-height: 90vh;
      animation: lbZoomIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
    }
    @keyframes lbZoomIn { from { opacity:0; transform:scale(0.92); } to { opacity:1; transform:none; } }
    .lightbox-img {
      max-width: 95vw; max-height: 90vh;
      object-fit: contain; border-radius: 8px;
      cursor: zoom-in;
    }
    .lightbox-close {
      position: absolute; top: 20px; right: 24px;
      width: 44px; height: 44px; border-radius: 50%;
      background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
      color: white; font-size: 1.4rem; cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: all 0.2s; backdrop-filter: blur(8px); z-index: 10;
    }
    .lightbox-close:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.4); }
    .lightbox-toolbar {
      position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
      display: flex; gap: 10px; align-items: center;
      background: rgba(15,10,30,0.75); border: 1px solid var(--card-border);
      border-radius: 14px; padding: 10px 20px;
      backdrop-filter: blur(12px); z-index: 10;
    }
    .lightbox-toolbar .action-btn {
      background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
      color: var(--text2); padding: 8px 16px; border-radius: 10px;
      cursor: pointer; font-size: 0.85rem; transition: all 0.2s;
      display: flex; align-items: center; gap: 6px;
    }
    .lightbox-toolbar .action-btn:hover { background: rgba(192,132,252,0.2); border-color: var(--violet); color: var(--violet); }
    .lightbox-hint { font-size: 0.72rem; color: var(--text3); margin-left: 8px; }
