
    :root {
      --bg: #0b1020;
      --side: #12182b;
      --panel: #171e33;
      --line: rgba(255, 255, 255, .08);
      --text: #f4f7fb;
      --muted: #8b95a7;
      --gold: #c4b5fd;
      --gold-dim: #a78bfa;
      --accent: #7c6cf6;
      --accent-soft: rgba(124, 108, 246, .18);
      --ok: #7dba98;
      --bad: #e08b8b;
      --run: #8b95a7;
      --btn-bg: #7c6cf6;
      --btn-fg: #ffffff;
      --field-bg: rgba(255, 255, 255, .04);
      --top-bg: rgba(18, 24, 43, .92);
      --drop-bg: #1c2438;
      --avatar-bg: #7c6cf6;
      --veil: rgba(6, 8, 16, .62);
      --radius: 16px;
      --side-w: 230px;
      --row-h: 66px;
      --shadow: 0 12px 32px rgba(0, 0, 0, .28);
    }
    html[data-mode="light"] {
      --bg: #f4f6fb;
      --side: #ffffff;
      --panel: #ffffff;
      --line: rgba(28, 36, 52, .08);
      --text: #1c2434;
      --muted: #6b7280;
      --gold: #4f46e5;
      --gold-dim: #4338ca;
      --accent: #4f46e5;
      --accent-soft: rgba(79, 70, 229, .12);
      --ok: #2f6b4f;
      --bad: #9a3b2f;
      --run: #6b7280;
      --btn-bg: #4f46e5;
      --btn-fg: #ffffff;
      --field-bg: #f8f9fd;
      --top-bg: rgba(255, 255, 255, .92);
      --drop-bg: #ffffff;
      --avatar-bg: #4f46e5;
      --veil: rgba(244, 246, 251, .72);
      --shadow: 0 12px 32px rgba(28, 36, 52, .08);
    }
    * { box-sizing: border-box; }
    html { -webkit-text-size-adjust: 100%; }
    html, body {
      margin: 0; min-height: 100%; min-height: 100dvh; color: var(--text);
      font: 15px/1.5 "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
      background: var(--bg);
    }
    button, a, .chip, .clip-x, .clip-cancel { touch-action: manipulation; }
    html, body, .top, .nav, .nav button, .ghost, .avatar, .user-drop, .glass, .bench, .feed-panel,
    .clip, .primary, .field, textarea, select, input, .spec-lock, .auth-frame, .modal-card,
    .modal, .ref-card, .mention, .up-chip, code, .brand, .top-bal, .hint, .muted, a, h1, .bell-btn, .notice-drop {
      transition: background-color .4s ease, color .4s ease, border-color .4s ease, box-shadow .4s ease, fill .4s ease, stroke .4s ease;
    }
    @media (prefers-reduced-motion: reduce) {
      html, body, .top, .nav, .nav button, .ghost, .avatar, .user-drop, .glass, .bench, .feed-panel,
      .clip, .primary, .field, textarea, select, input, .spec-lock, .auth-frame, .modal-card,
      .modal, .ref-card, .mention, .up-chip, code, .brand, .top-bal, .hint, .muted, a, h1, .bell-btn, .notice-drop {
        transition: none;
      }
    }
    a { color: var(--gold); text-decoration: none; }
    a:hover { color: var(--gold-dim); }
    button, input, textarea, select { font: inherit; color: inherit; }
    .nav, .ghost, .avatar, .user-drop, .glass, .auth-frame,
    textarea, select.field, .field, .chip, .primary, .spec-lock,
    .auth input, .up-chip, code, .clip, .ref-card, .mention, .modal-card, .modal-key {
      border-radius: var(--radius);
    }
    .top {
      display: none; align-items: center; gap: 8px;
      padding: 0 20px; height: 64px;
      border-bottom: 1px solid var(--line);
      background: var(--top-bg);
      backdrop-filter: blur(22px) saturate(1.2);
      -webkit-backdrop-filter: blur(22px) saturate(1.2);
      position: sticky; top: 0; z-index: 5;
    }
    body.in-app .top { display: flex; }
    .notice-bar {
      display: none; padding: 8px 20px 8px 28px;
      border-bottom: 1px solid var(--line);
      background: var(--panel);
      font-size: 13px; line-height: 1.45;
    }
    body.in-app .notice-bar.on { display: block; }
    .notice-bar strong { margin-right: 8px; }
    .brand {
      display: flex; align-items: center; gap: 12px;
      font-family: Bahnschrift, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
      font-weight: 700; color: var(--gold); font-size: 20px; letter-spacing: .08em;
      background: none; border: 0; padding: 0; cursor: pointer;
    }
    .brand-logo {
      width: 40px; height: 40px; object-fit: contain; flex: 0 0 40px;
      background: transparent; border: 0;
    }
    .brand:hover { color: var(--gold-dim); }
    .top-bal {
      display: none;
      font-family: Bahnschrift, "Segoe UI", sans-serif; font-size: 16px; font-weight: 600;
      color: var(--gold); font-variant-numeric: tabular-nums; margin-right: 4px;
      background: none; border: 0; padding: 0; cursor: pointer;
    }
    body.in-app .top-bal { display: block; }
    .top-bal:hover { color: var(--gold-dim); }
    .bell-wrap { position: relative; margin-right: 4px; }
    .bell-btn { position: relative; }
    .bell-dot {
      position: absolute; top: 7px; right: 7px; width: 7px; height: 7px;
      border-radius: 50%; background: var(--text); pointer-events: none;
    }
    .notice-drop {
      position: absolute; right: 0; top: calc(100% + 8px); width: 300px;
      max-height: 380px; overflow: auto; overscroll-behavior: contain;
      background: var(--drop-bg);
      backdrop-filter: blur(22px) saturate(1.2);
      -webkit-backdrop-filter: blur(22px) saturate(1.2);
      border: 1px solid var(--line);
      box-shadow: 0 16px 40px rgba(0,0,0,.45); z-index: 20;
    }
    .notice-item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .notice-item:last-child { border-bottom: 0; }
    .notice-item .when { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
    .notice-item .ttl { font-weight: 600; margin-bottom: 4px; }
    .notice-item .bd { font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
    .notice-empty { padding: 16px 14px; color: var(--muted); font-size: 13px; }
    .user-drop .bal { cursor: pointer; }
    .user-drop .bal:hover { color: var(--gold); }
    .nav {
      display: flex; align-items: center; gap: 0; height: 40px; margin-left: 16px;
      background: var(--field-bg); border: 1px solid var(--line);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
    }
    .nav button, .nav a {
      display: inline-flex; align-items: center; gap: 8px;
      height: 38px; padding: 0 16px; border: 0; cursor: pointer;
      background: transparent; color: var(--muted); font-size: 15px;
      text-decoration: none;
    }
    .nav button.on {
      background: rgba(255, 255, 255, .92);
      color: #111;
    }
    html[data-mode="light"] .nav button.on {
      background: #111;
      color: #fff;
    }
    .nav button:hover:not(.on), .nav a:hover { color: var(--text); }
    .nav a:focus-visible, .dock a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
    .nav button svg, .nav a svg, .mode-btn svg, .bell-btn svg {
      width: 18px; height: 18px; stroke: currentColor; fill: none;
      stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 18px;
    }
    .mode-btn {
      width: 36px; padding: 0; margin-left: 8px;
      display: inline-flex; align-items: center; justify-content: center;
    }
    .ghost {
      background: transparent; color: var(--muted); cursor: pointer;
      height: 30px; padding: 0 12px; margin-left: 8px; line-height: 1;
      display: inline-flex; align-items: center; justify-content: center;
      border: 1px solid var(--line); font-size: 13px;
    }
    .ghost:hover { border-color: var(--gold-dim); color: var(--gold-dim); }
    .spacer { flex: 1; }
    .user { position: relative; margin-left: 8px; }
    .avatar {
      width: 36px; height: 36px; padding: 0;
      border: 1px solid var(--line); cursor: pointer;
      background: var(--avatar-bg);
      color: var(--btn-fg); font-family: Bahnschrift, "Segoe UI", sans-serif; font-weight: 700; font-size: 14px;
    }
    .user-drop {
      position: absolute; right: 0; top: calc(100% + 8px); width: 220px;
      background: var(--drop-bg);
      backdrop-filter: blur(22px) saturate(1.2);
      -webkit-backdrop-filter: blur(22px) saturate(1.2);
      border: 1px solid var(--line);
      box-shadow: 0 16px 40px rgba(0,0,0,.45); z-index: 20; overflow: hidden;
    }
    .user-drop .meta { padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .user-mail { font-size: 13px; word-break: break-all; }
    .user-drop .bal { display: block; margin-top: 4px; }
    .user-drop button {
      display: block; width: 100%; text-align: left; background: none; border: 0;
      padding: 10px 14px; color: var(--text); cursor: pointer; font-size: 13px;
    }
    .user-drop button:hover { background: color-mix(in srgb, var(--gold) 12%, transparent); color: var(--gold); }
    .wrap { max-width: 880px; margin: 0 auto; padding: 28px 24px 64px; }
    body.in-app.page-gen { overflow: hidden; }
    body.page-gen #app.wrap { max-width: none; margin: 0; padding: 0; height: calc(100dvh - 56px); }
    #page-gen { height: 100%; }
    h1 { font-family: Bahnschrift, "Segoe UI", sans-serif; font-size: 18px; font-weight: 600; margin: 0 0 6px; }
    .hint { color: var(--muted); margin: 0; font-size: 13px; }
    .glass {
      background: var(--panel);
      backdrop-filter: blur(22px) saturate(1.2);
      -webkit-backdrop-filter: blur(22px) saturate(1.2);
      border: 1px solid var(--line);
    }
    .stage { position: relative; padding: 12px; }
    .stage-frame { }
    .stage-head { padding: 16px 20px; border-bottom: 1px solid var(--line); }
    .stage-body { padding: 16px 20px 20px; }
    body.page-admin #app.wrap { max-width: 1080px; }
    .admin-tabs {
      display: flex; flex-wrap: wrap; gap: 0;
      padding: 0 12px;
      border-bottom: 1px solid var(--line);
    }
    .admin-tabs button {
      height: 42px; padding: 0 14px; border: 0; background: none;
      color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1;
      display: inline-flex; align-items: center; justify-content: center;
      border-bottom: 2px solid transparent; margin-bottom: -1px;
    }
    .admin-tabs button.on { color: var(--text); border-bottom-color: var(--text); }
    .admin-pane { display: none; }
    .admin-pane.on { display: block; }
    .admin-stats {
      display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 10px;
    }
    .admin-stat {
      border: 1px solid var(--line); background: var(--field-bg); padding: 12px 14px;
    }
    .admin-stat b {
      display: block; font-family: Bahnschrift, "Segoe UI", sans-serif;
      font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
    }
    .admin-stat span { font-size: 12px; color: var(--muted); }
    .admin-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
    .admin-search input.field { flex: 1; min-width: 160px; max-width: none; height: 36px; }
    .admin-table { overflow-x: auto; }
    .admin-detail {
      margin-top: 12px; padding: 12px; border: 1px solid var(--line);
      background: var(--field-bg); font-size: 13px;
    }
    .skill-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
      gap: 12px;
      align-items: stretch;
    }
    .skill-card {
      display: flex;
      flex-direction: column;
      height: 100%;
      border: 1px solid var(--line);
      background: var(--field-bg);
      padding: 16px;
      overflow: hidden;
    }
    .skill-card h2 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
    .skill-card p { font-size: 13px; color: var(--muted); margin: 0 0 14px; flex: 1; }
    .skill-card .row { margin-top: auto; justify-content: space-between; align-items: center; flex-wrap: nowrap; }
    .skill-meta { font-size: 12px; color: var(--muted); }
    .skill-lead {
      font-size: 22px;
      font-weight: 800;
      color: var(--text);
      line-height: 1.55;
      margin: 0 0 20px;
      letter-spacing: 0.02em;
    }
    .skill-lead span { display: block; }
    .skill-how {
      font-size: 13px;
      font-weight: 400;
      color: var(--muted);
      line-height: 1.5;
      margin: 0 0 20px;
    }
    .skill-rule {
      height: 0;
      margin: 0 0 22px;
      border: 0;
      border-top: 1px solid var(--line);
    }
    textarea, select.field, .field {
      width: 100%; padding: 10px 12px;
      background: var(--field-bg); border: 2px solid var(--line);
    }
    textarea { min-height: 160px; resize: vertical; margin: 12px 0 0; }
    textarea:focus, input:focus, select:focus { outline: none; border-color: #fff; }
    select.field { max-width: 280px; height: 40px; }
    .kind-switch {
      display: inline-flex; border: 1px solid var(--line); margin-bottom: 16px;
    }
    .kind-switch button {
      min-width: 112px; height: 38px; padding: 0 12px; border: 0; cursor: pointer;
      background: transparent; color: var(--muted);
      display: inline-flex; align-items: center; justify-content: center; gap: 7px;
      font-size: 13px; font-weight: 600;
    }
    .kind-switch button.on {
      background: rgba(255, 255, 255, .92); color: #111;
    }
    html[data-mode="light"] .kind-switch button.on {
      background: #111; color: #fff;
    }
    .kind-switch svg {
      width: 18px; height: 18px; stroke: currentColor; fill: none;
      stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
    }
    .model-block { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
    .model-summary { margin: 0; color: var(--muted); font-size: 12px; }
    #model.field {
      width: 100%; max-width: none; min-width: 0; height: 44px;
      padding-right: 36px; font-size: 14px;
    }
    #dur { width: 180px; accent-color: var(--gold); }
    #dur:disabled, #res:disabled { opacity: .55; cursor: not-allowed; }
    #durVal { font-variant-numeric: tabular-nums; min-width: 3em; }
    .dur-bar { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
    .dur-ticks { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
    .dur-ticks span.on { color: var(--gold); font-weight: 600; }
    .go-price {
      font-family: Bahnschrift, "Segoe UI", sans-serif; font-size: 18px; font-weight: 600;
      color: var(--gold); font-variant-numeric: tabular-nums;
    }
    .go-was { margin-right: 6px; color: #e23d3d; font-size: 13px; font-weight: 500; text-decoration: line-through; }
    .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 0; }
    .chip {
      border: 1px solid var(--line); background: var(--field-bg);
      height: 36px; padding: 0 12px; line-height: 1;
      display: inline-flex; align-items: center; justify-content: center;
      cursor: pointer; color: var(--muted);
    }
    .chip.on { border-color: var(--gold); color: var(--gold); }
    .primary {
      background: var(--btn-bg); color: var(--btn-fg); border: 1px solid #fff;
      padding: 0 18px; height: 36px; line-height: 1; font-weight: 600; cursor: pointer;
      display: inline-flex; align-items: center; justify-content: center;
    }
    .primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
    .go-btn {
      display: flex; align-items: center; justify-content: space-between;
      width: 100%; height: 48px; padding: 0 16px; font-size: 16px; line-height: 1;
    }
    .go-btn .go-price { color: var(--btn-fg); }
    #durWrap, #resWrap { display: inline-flex; align-items: center; gap: 8px; }
    .spec-lock {
      display: inline-flex; align-items: baseline; gap: 4px;
      padding: 8px 14px 8px 12px;
      border: 1px solid var(--line);
      background: var(--panel);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      color: var(--text);
    }
    .spec-lock em {
      font-family: Bahnschrift, "Segoe UI", sans-serif;
      font-style: normal; font-size: 32px; font-weight: 700; line-height: .9;
      color: var(--gold); font-variant-numeric: tabular-nums; letter-spacing: -.03em;
    }
    .spec-lock .unit { font-size: 14px; font-weight: 600; }
    .spec-lock.quiet {
      font-family: Bahnschrift, "Segoe UI", sans-serif;
      font-size: 15px; font-weight: 600; padding: 10px 12px;
    }
    .card { background: var(--field-bg); border: 1px solid var(--line); padding: 14px 16px; margin-top: 14px; }
    video { width: 100%; background: #000; }
    table { width: 100%; border-collapse: collapse; font-size: 13px; }
    th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
    th { color: var(--muted); font-weight: 500; }
    .hidden { display: none !important; }
    .gate {
      min-height: 100dvh; display: flex; align-items: center; justify-content: center;
      padding: 32px 20px;
    }
    .auth { width: 100%; max-width: 400px; }
    .auth-gate { position: relative; padding: 12px; }
    .tick {
      position: absolute; width: 14px; height: 14px;
      border: 1px solid rgba(255, 255, 255, .7); pointer-events: none;
    }
    .tick-tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
    .tick-tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-color: var(--gold-dim); }
    .tick-bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-color: var(--gold-dim); }
    .tick-br { bottom: 0; right: 0; border-left: 0; border-top: 0; }
    .auth-frame { overflow: hidden; }
    .auth-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
    .auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
    .auth-logo {
      width: 52px; height: 52px; object-fit: contain; flex: 0 0 52px;
      background: transparent; border: 0;
    }
    .auth-mark {
      font-family: Bahnschrift, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
      font-size: 22px; font-weight: 700; color: var(--gold); letter-spacing: .08em;
    }
    .pay-group {
      display: flex; flex-direction: column; align-items: center;
      gap: 14px; padding: 12px 0 8px; max-width: 360px;
    }
    .pay-qr-frame {
      width: min(280px, 100%);
      border-radius: var(--radius);
      overflow: hidden;
      border: 1px solid var(--line);
      background: #111;
      line-height: 0;
    }
    .pay-channels { display: flex; gap: 10px; margin-bottom: 14px; }
    .pay-qr {
      width: 100%; height: auto; display: block;
      border: 0; background: #111;
    }
    .pay-lead { margin: 0; font-size: 15px; line-height: 1.6; text-align: center; }
    .pay-note { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
    .auth h1 { font-family: Bahnschrift, "Segoe UI", sans-serif; font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; }
    .auth-sub { color: var(--muted); margin: 0; font-size: 13px; }
    .auth-body { padding: 20px 24px 24px; }
    .auth label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
    .auth input {
      width: 100%; margin: 0 0 14px; padding: 10px 12px; height: 40px;
      background: var(--field-bg); border: 1px solid var(--line);
    }
    .auth input:focus { outline: none; border-color: #fff; }
    .pw { position: relative; }
    .pw input { padding-right: 56px; margin-bottom: 14px; }
    .pw-toggle {
      position: absolute; right: 0; top: 0; height: 40px; padding: 0 12px;
      background: none; border: 0; border-left: 1px solid var(--line);
      color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1;
      display: inline-flex; align-items: center; justify-content: center;
    }
    .pw-toggle:hover { color: var(--text); }
    .code-row { position: relative; margin: 0 0 14px; }
    .code-row input { padding-right: 108px; margin-bottom: 0; }
    .code-send {
      position: absolute; right: 0; top: 0; height: 40px; padding: 0 12px;
      background: none; border: 0; border-left: 1px solid var(--line);
      color: var(--gold); cursor: pointer; font-size: 13px; line-height: 1;
      display: inline-flex; align-items: center; justify-content: center;
    }
    .code-send:disabled { color: var(--muted); cursor: not-allowed; }
    .auth-btn.primary {
      width: 100%; height: 42px; margin-top: 6px;
    }
    .auth-foot { padding: 12px 24px; border-top: 1px solid var(--line); text-align: left; }
    .auth-switch { color: var(--muted); margin: 0; font-size: 13px; }
    .auth-switch a { color: var(--text); }
    .auth-switch a:hover { color: var(--gold-dim); }
    .auth .err { min-height: 0; margin: 0 0 10px; }
    .field-hint { margin: -8px 0 14px; font-size: 12px; color: var(--muted); }
    .err { color: var(--bad); font-size: 13px; min-height: 1.2em; }
    .budget { color: var(--muted, #8a8a8a); font-size: 12px; margin: 6px 0 0; }
    .budget.over { color: var(--bad); }
    .muted { color: var(--muted); font-size: 13px; }
    .admin-block h2 { margin: 0 0 10px; font-size: 16px; font-weight: 600; }
    code { background: var(--field-bg); padding: 2px 6px; border: 1px solid var(--line); font-size: 12px; }
    .file { color: var(--muted); font-size: 13px; }
    .gen-split {
      display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 0; height: 100%;
    }
    .bench {
      display: flex; flex-direction: column; height: 100%;
      background: var(--panel);
      backdrop-filter: blur(22px) saturate(1.2);
      -webkit-backdrop-filter: blur(22px) saturate(1.2);
      position: relative;
    }
    .bench::before {
      content: "";
      position: absolute; left: 0; top: 0; bottom: 0; width: 12px;
      background: repeating-linear-gradient(
        to bottom,
        transparent 0 8px,
        var(--bg) 8px 14px,
        transparent 14px 22px
      );
      border-right: 1px solid var(--line);
      pointer-events: none;
    }
    .bench-scroll { flex: 1; overflow: auto; padding: 28px 32px 12px 28px; }
    .bench-go { padding: 12px 32px 20px 28px; border-top: 1px solid var(--line); }
    .bench select.field { max-width: none; }
    .bench textarea { min-height: 220px; }
    .feed-panel {
      display: flex; flex-direction: column; height: 100%; min-height: 0;
      background: var(--panel);
      backdrop-filter: blur(22px) saturate(1.2);
      -webkit-backdrop-filter: blur(22px) saturate(1.2);
      border-left: 1px solid var(--line);
      position: relative;
    }
    .feed-panel::before {
      content: "";
      position: absolute; left: 0; top: 0; bottom: 0; width: 12px;
      background: repeating-linear-gradient(
        to bottom,
        transparent 0 8px,
        var(--bg) 8px 14px,
        transparent 14px 22px
      );
      border-right: 1px solid var(--line);
      pointer-events: none;
    }
    .feed-panel .stage-head { flex: 0 0 auto; padding: 14px 14px 12px 22px; }
    #feed { flex: 1; overflow: auto; padding: 8px 12px 20px 22px; max-height: none; }
    @media (max-width: 900px) {
      .gen-split { grid-template-columns: 1fr; height: 100%; overflow: auto; }
      .bench { height: auto; border-bottom: 1px solid var(--line); }
      .feed-panel { min-height: 42vh; height: auto; border-left: 0; }
    }
    .drop-page { display: none; }
    .dock { display: none; }
    @media (max-width: 720px) {
      .top {
        height: calc(52px + env(safe-area-inset-top, 0px));
        padding: env(safe-area-inset-top, 0px) 10px 0;
        gap: 6px;
      }
      .brand { gap: 0; }
      .brand span { display: none; }
      .brand-logo { width: 36px; height: 36px; flex-basis: 36px; }
      .nav { display: none !important; }
      body.in-app .dock {
        display: flex; align-items: stretch;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        height: calc(52px + env(safe-area-inset-bottom, 0px));
        padding: 0 4px env(safe-area-inset-bottom, 0px);
        justify-content: space-around;
        border-top: 1px solid var(--line);
        background: var(--top-bg);
        backdrop-filter: blur(22px) saturate(1.2);
        -webkit-backdrop-filter: blur(22px) saturate(1.2);
      }
      .dock button, .dock a {
        flex: 1; flex-direction: column; gap: 2px;
        height: 52px; padding: 0 4px; font-size: 11px; line-height: 1;
        border: 0; background: transparent; color: var(--muted); cursor: pointer;
        display: inline-flex; align-items: center; justify-content: center;
        text-decoration: none;
      }
      .dock button.on { color: var(--text); }
      .dock button svg, .dock a svg {
        width: 20px; height: 20px; flex: 0 0 20px;
        stroke: currentColor; fill: none; stroke-width: 1.75;
        stroke-linecap: round; stroke-linejoin: round;
      }
      .drop-page { display: block; }
      .mode-btn, .avatar, .bell-btn {
        width: 44px; height: 44px; min-width: 44px; margin-left: 0;
      }
      .top-bal { font-size: 15px; margin-right: 2px; min-height: 44px; }
      .notice-drop { width: min(300px, calc(100vw - 20px)); }
      .user-drop { width: min(240px, calc(100vw - 20px)); }
      body.in-app .workspace {
        padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px));
      }
      body.in-app #app.wrap { padding: 0; }
      body.page-gen #app.wrap { padding: 0; }
      body.in-app .stage-frame { border-radius: 0; box-shadow: none; }
      .bench::before, .feed-panel::before { display: none; }
      .bench-scroll { padding: 16px 16px 12px; overflow: visible; }
      .bench textarea { min-height: 132px; font-size: 16px; }
      .bench-go {
        position: sticky; z-index: 4;
        bottom: calc(52px + env(safe-area-inset-bottom, 0px));
        padding: 10px 16px;
        background: var(--panel);
      }
      .go-btn { height: 52px; }
      .kind-switch button { min-width: 112px; height: 44px; }
      #model.field, #ratio.field, #res.field, .auth input {
        height: 44px; font-size: 16px;
      }
      #durWrap { width: 100%; }
      .dur-bar, #dur { width: 100%; min-width: 0; }
      #hist { grid-template-columns: 1fr; }
      .clip-ok .clip-x {
        position: static; float: right; margin: 8px 8px 0 0;
        width: 32px; height: 32px; line-height: 30px; font-size: 18px;
      }
      .clip-x { width: 32px; height: 32px; line-height: 30px; font-size: 18px; }
      .clip-sec { font-size: 32px; }
      .gate { padding: max(24px, env(safe-area-inset-top, 0px)) 16px max(24px, env(safe-area-inset-bottom, 0px)); }
      .auth-body, .auth-head, .auth-foot { padding-left: 18px; padding-right: 18px; }
      .auth input { font-size: 16px; height: 44px; }
      .pw-toggle, .code-send { height: 44px; }
      .auth-btn.primary { height: 48px; }
      .modal {
        padding: max(12px, env(safe-area-inset-top, 0px)) 12px max(12px, env(safe-area-inset-bottom, 0px));
        align-items: flex-end;
      }
      .modal-card { width: 100%; max-height: calc(100dvh - 24px); overflow: auto; }
      .stage-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
      .notice-bar { padding-left: 16px; padding-right: 16px; }
    }
    .clip {
      border: 1px solid var(--line);
      background: rgba(255, 255, 255, .05);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      margin: 0 0 12px;
      overflow: hidden;
      position: relative;
    }
    .clip-x {
      position: absolute; top: 6px; right: 6px; z-index: 3;
      width: 22px; height: 22px; padding: 0; cursor: pointer;
      border: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 72%, transparent);
      color: var(--text); font-size: 16px; line-height: 20px;
    }
    .clip-x:hover { color: var(--bad); border-color: var(--bad); }
    .clip-cancel {
      margin-top: 8px; padding: 4px 10px; cursor: pointer;
      border: 1px solid var(--line); background: transparent;
      color: var(--text); font-size: 12px;
    }
    .clip-cancel:hover { border-color: var(--gold); }
    .clip-run { border-color: var(--run); }
    .clip-ok {
      border-color: var(--ok);
      overflow: hidden;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }
    .clip-bad { border-color: var(--bad); }
    .clip-well {
      aspect-ratio: 16 / 9;
      display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 6px; background: var(--field-bg);
    }
    .clip-state { font-size: 12px; color: var(--muted); }
    .clip-sec {
      font-family: Bahnschrift, "Segoe UI", sans-serif;
      font-size: 40px; font-weight: 700; line-height: 1;
      color: var(--gold); font-variant-numeric: tabular-nums;
    }
    .clip-sec .unit { font-size: 14px; font-weight: 600; margin-left: 4px; }
    .clip-eta { font-size: 12px; color: var(--muted); }
    .clip-actions {
      display: flex; gap: 8px; padding: 8px 10px;
      border-top: 1px solid var(--line);
    }
    .clip-actions a, .clip-actions button {
      background: none; border: 0; padding: 0; cursor: pointer;
      font-size: 12px; color: var(--gold);
    }
    .clip-actions .clip-del { color: var(--muted); }
    .clip-actions .clip-del:hover { color: var(--bad); }
    .clip-ok img {
      width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
      margin: 0; border: 0; background: var(--bg); display: block;
      border-top-left-radius: var(--radius); border-top-right-radius: var(--radius);
    }
    #hist .clip-ok .clip-actions {
      position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
      background: linear-gradient(transparent, rgba(0, 0, 0, .72));
      border-top: 0;
    }
    #hist .clip-ok .clip-actions a,
    #hist .clip-ok .clip-actions button { color: #fff; }
    .clip-ok video {
      width: 100%; max-height: min(70dvh, 560px); aspect-ratio: auto;
      object-fit: contain; margin: 0; border: 0; background: #000; display: block;
      border-top-left-radius: var(--radius); border-top-right-radius: var(--radius);
    }
    .clip-ok video:fullscreen,
    .clip-ok video:-webkit-full-screen {
      width: 100%; height: 100%; max-height: none;
      object-fit: contain; background: #000;
    }
    .clip-dl { color: var(--ok); }
    .clip-err {
      margin: 0; padding: 12px 10px; font-size: 13px; line-height: 1.45;
      color: var(--bad);
    }
    .clip-prompt {
      margin: 0; padding: 8px 10px; font-size: 12px; color: var(--muted);
      border-top: 1px solid var(--line);
      max-height: 7.8em; overflow-y: auto; -webkit-overflow-scrolling: touch;
      white-space: pre-wrap; word-break: break-word;
      user-select: text; -webkit-user-select: text;
    }
    .clip-meta {
      padding: 0 10px 8px; font-size: 12px; color: var(--muted);
      overflow-wrap: anywhere;
    }
    .clip-bar {
      width: min(220px, 80%); height: 6px; margin-top: 10px;
      background: color-mix(in srgb, var(--line) 80%, var(--bg));
      overflow: hidden;
    }
    .clip-bar > i {
      display: block; height: 100%; width: 0;
      background: var(--gold);
      transition: width .25s ease;
    }
    .clip-bar.indeterminate > i {
      width: 36%;
      animation: clip-bar-slide 1.15s ease-in-out infinite;
    }
    @keyframes clip-bar-slide {
      0% { transform: translateX(-120%); }
      100% { transform: translateX(320%); }
    }
    .clip-copy { color: var(--muted); }
    .clip-copy:hover { color: var(--gold); }
    #hist { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
    #hist .clip { margin: 0; }
    .prompt-wrap { position: relative; }
    textarea#prompt { padding-bottom: 34px; }
    #promptBudget {
      position: absolute; right: 10px; bottom: 10px; margin: 0;
      font-size: 12px; pointer-events: none;
    }
    .refs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
    .ref-card {
      width: 56px; height: 56px; padding: 0;
      border: 2px solid var(--line); background: var(--field-bg);
      position: relative; cursor: pointer;
      overflow: hidden;
    }
    .ref-card:hover, .ref-card:focus-visible {
      border-color: var(--gold); z-index: 2; outline: none;
    }
    .ref-plus { position: absolute; inset: 0; pointer-events: none; }
    .ref-plus::before, .ref-plus::after {
      content: ""; position: absolute; left: 50%; top: 50%; background: var(--text);
    }
    .ref-plus::before { width: 14px; height: 1.5px; transform: translate(-50%, -50%); }
    .ref-plus::after { width: 1.5px; height: 14px; transform: translate(-50%, -50%); }
    .ref-card.filled { background-size: cover; background-position: center; }
    .ref-tag {
      position: absolute; left: 4px; bottom: 4px;
      font-size: 10px; color: var(--btn-fg); background: var(--gold); padding: 1px 4px;
    }
    .ref-x {
      position: absolute; top: 0; right: 0; width: 20px; height: 20px;
      border: 0; background: rgba(7,11,20,.7); color: #fff; cursor: pointer;
      display: none; font-size: 14px; line-height: 20px;
    }
    .ref-card.filled:hover .ref-x { display: block; }
    .mention {
      position: absolute; left: 0; bottom: calc(100% - 8px);
      width: min(280px, 100%); max-height: 240px; overflow: auto;
      border: 1px solid var(--line); background: var(--drop-bg);
      backdrop-filter: blur(22px);
      -webkit-backdrop-filter: blur(22px);
      z-index: 9;
      box-shadow: 0 12px 32px rgba(0,0,0,.25);
    }
    .mention button {
      display: flex; align-items: center; gap: 10px; width: 100%;
      background: transparent; border: 0; border-bottom: 1px solid var(--line);
      padding: 8px 10px; color: var(--text); cursor: pointer; text-align: left;
    }
    .mention button:hover, .mention button.on {
      background: color-mix(in srgb, var(--gold) 12%, transparent); color: var(--text);
    }
    .mention i {
      width: 28px; height: 40px; flex: 0 0 28px;
      border: 1px solid var(--line); background-size: cover; background-position: center;
    }
    .mention i.mention-media-icon {
      display: flex; align-items: center; justify-content: center;
      background: var(--field-bg); font-size: 16px; font-style: normal;
    }
    #refView { cursor: zoom-out; }
    #refView img { max-width: 92vw; max-height: 92vh; object-fit: contain; }
    .ref-view-x {
      position: fixed; top: 16px; right: 16px; z-index: 41;
      width: 36px; height: 36px; border: 0; border-radius: 50%;
      background: rgba(7,11,20,.7); color: #fff; cursor: pointer; font-size: 20px;
    }
    @media (prefers-reduced-motion: reduce) {
      .ref-card, .ref-card:hover { transition: none; transform: none; }
    }
    .stage-body input[type="text"] {
      background: var(--field-bg); border: 1px solid var(--line); padding: 8px 10px; height: 36px;
    }
    .modal {
      position: fixed; inset: 0; z-index: 40;
      background: var(--veil); display: flex; align-items: center; justify-content: center;
      padding: 20px;
    }
    .modal-card { width: min(440px, 100%); padding: 22px 22px 20px; position: relative; }
    .modal-x {
      position: absolute; top: 10px; right: 12px; width: 32px; height: 32px;
      border: 0; background: none; color: var(--text); font-size: 22px; cursor: pointer;
    }
    .modal-key {
      display: block; margin: 12px 0; padding: 10px; word-break: break-all;
      background: var(--field-bg); border: 1px solid var(--line); font-size: 12px;
    }

    .side { display: none; }
    body.in-app {
      display: flex;
      align-items: stretch;
      min-height: 100dvh;
    }
    body.in-app .side {
      display: flex;
      flex-direction: column;
      width: var(--side-w);
      flex: 0 0 var(--side-w);
      height: 100dvh;
      position: sticky;
      top: 0;
      overflow: auto;
      background: var(--side);
      border-right: 1px solid var(--line);
      z-index: 6;
    }
    .workspace { min-width: 0; flex: 1; display: flex; flex-direction: column; min-height: 100dvh; }
    body.in-app .workspace {
      height: 100dvh;
      max-height: 100dvh;
      min-height: 0;
      overflow: hidden;
    }
    .side .brand { padding: 22px 18px 8px; font-size: 18px; }
    .side .nav {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 4px;
      height: auto;
      margin: 8px 12px 16px;
      padding: 6px;
      background: transparent;
      border: 0;
      backdrop-filter: none;
    }
    .side .nav button, .side .nav a {
      width: 100%;
      height: 44px;
      justify-content: flex-start;
      align-items: center;
      line-height: 1;
      border-radius: 12px;
      padding: 0 12px;
      color: var(--muted);
    }
    .side .nav button.on,
    html[data-mode="light"] .side .nav button.on {
      background: var(--accent-soft);
      color: var(--accent);
    }
    .page-title {
      font-family: Bahnschrift, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
      font-size: 18px;
      font-weight: 600;
      letter-spacing: .02em;
    }
    .wrap { max-width: 1120px; }
    body.in-app #app.wrap {
      width: 100%;
      max-width: none;
      margin: 0;
      flex: 1;
      min-height: 0;
      height: auto;
      padding: 16px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }
    body.in-app #app.wrap > section:not(.hidden) {
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }
    body.in-app #page-gen { height: auto; min-height: 0; }
    body.in-app .gen-split { flex: 1; min-height: 0; height: auto; }
    body.in-app .stage-frame {
      flex: 1;
      min-height: 0;
      width: 100%;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    body.in-app .stage-head,
    body.in-app .admin-tabs { flex: 0 0 auto; }
    body.in-app .stage-body { flex: 1; min-height: 0; overflow: auto; }
    body.page-gen #app.wrap { padding: 0; }
    .stage-frame { width: 100%; }
    .stage-frame, .skill-card, .admin-stat, .card, .clip, .modal-card {
      border-radius: var(--radius);
      box-shadow: var(--shadow);
    }
    .admin-stats { gap: 14px; }
    .admin-stat {
      border-radius: var(--radius);
      background: var(--panel);
      padding: 16px 16px 14px;
      min-height: 112px;
    }
    .admin-stat .k { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
    .admin-stat b { font-size: 26px; }
    .meter {
      margin-top: 12px;
      height: 6px;
      border-radius: 99px;
      background: var(--field-bg);
      overflow: hidden;
    }
    .meter i {
      display: block;
      height: 100%;
      border-radius: inherit;
      background: var(--accent);
    }
    .progress-row { margin-top: 14px; }
    .progress-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
    .gen-split { gap: 16px; padding: 16px; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); }
    .bench, .feed-panel {
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      overflow: hidden;
    }
    .bench::before, .feed-panel::before { display: none; }
    .feed-panel { border-left: 1px solid var(--line); }
    body.page-gen #app.wrap, body.page-canvas #app.wrap { padding: 0; }
    #page-canvas { min-height: 0; }
    #canvasRoot { flex: 1; min-height: 0; width: 100%; height: 100%; }
    textarea:focus, input:focus, select:focus, .auth input:focus { border-color: var(--accent); }
    .primary { border-color: transparent; border-radius: 12px; }
    #payPacks { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 12px; }
    #payPacks .chip {
      height: 76px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: Bahnschrift, "Segoe UI", sans-serif;
      font-size: 22px;
      font-weight: 700;
      background: var(--panel);
      box-shadow: var(--shadow);
    }
    #payPacks .chip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
    .admin-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
    table { background: transparent; }
    th, td { padding: 12px 10px; }
    @media (max-width: 720px) {
      body.in-app { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
      body.in-app .side { display: none !important; }
      body.in-app .workspace { flex: 1; min-height: 0; height: auto; max-height: none; }
      body.in-app #page-hist .stage-body { overflow-x: hidden; overflow-y: auto; }
      body.in-app #app.wrap { padding: 0; }
      body.in-app .stage-frame { border-radius: 0; box-shadow: none; }
      .gen-split { padding: 0; gap: 0; }
      .bench, .feed-panel { border-radius: 0; box-shadow: none; }
    }
    .top-brand { display: none; border: 0; background: none; padding: 0; }
    @media (max-width: 720px) {
      .top-brand { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; cursor: pointer; }
      .top-brand img { width: 36px; height: 36px; object-fit: contain; }
    }

    /* Shared narrow-screen layout: keep controls readable without horizontal page scroll. */
    .stage-head, .stage-body, .row, .admin-search, .clip-actions { min-width: 0; }
    .stage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
    .stage-head h1, .stage-head p { min-width: 0; }
    .stage-head p { margin: 0; }
    .admin-table, #payOrders, #bill, #keyList, #feed, #hist { min-width: 0; overflow-wrap: anywhere; }
    .admin-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .clip-actions { flex-wrap: wrap; }
    .clip-actions a, .clip-actions button { min-height: 36px; }

    @media (max-width: 720px) {
      html, body { overscroll-behavior-x: none; }
      body.in-app .top { min-width: 0; overflow: hidden; }
      body.in-app .top > * { min-width: 0; }
      body.in-app .top-bal { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      body.in-app .workspace { width: 100%; overflow: hidden; }
      body.in-app .stage-head { padding: 14px 16px; }
      body.in-app .stage-head h1 { font-size: 20px; }
      body.in-app .stage-body { padding: 14px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
      body.in-app .row { align-items: stretch; gap: 8px; }
      body.in-app .row > .field,
      body.in-app .row > input.field,
      body.in-app .row > select.field { width: 100% !important; max-width: none !important; flex: 1 1 100%; }
      body.in-app .row > .primary,
      body.in-app .row > .ghost { min-height: 42px; flex: 1 1 auto; }
      body.in-app #payLive .pay-channels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
      body.in-app #payLive .pay-channels .chip { min-height: 42px; }
      body.in-app #payPacks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
      body.in-app #payPacks .chip { min-width: 0; height: 64px; font-size: 19px; }
      body.in-app #payCustom { flex: 1 1 auto; width: auto !important; }
      body.in-app .admin-tabs { overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
      body.in-app .admin-tabs::-webkit-scrollbar { display: none; }
      body.in-app .admin-tabs button { flex: 0 0 auto; min-width: 64px; padding: 0 12px; }
      body.in-app .admin-search input.field { min-width: 0; width: 100%; flex-basis: 100%; }
      body.in-app .admin-search .primary { min-height: 40px; }
      body.in-app .clip { border-radius: 12px; }
      body.in-app .clip-actions a, body.in-app .clip-actions button { flex: 1 1 auto; min-width: 92px; }
      body.in-app .pay-qr { max-width: min(280px, 80vw); height: auto; }
    }

/* TapNow canvas replacement */
#canvasRoot.tapnow-canvas-host { flex: 1; min-height: 0; width: 100%; height: auto; display: flex; flex-direction: column; overflow: hidden; }
.canvas-board-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; flex: 0 0 auto; border-bottom: 1px solid var(--line); background: var(--panel); }
.canvas-board-bar .field { width: min(280px, 40%); min-width: 0; height: 40px; min-height: 40px; padding: 0 12px; line-height: normal; }
.canvas-board-bar button { height: 40px; min-height: 40px; flex: 0 0 auto; white-space: nowrap; }
.canvas-board-status { min-width: 0; margin-left: auto; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas-board-status.error { color: var(--bad); }
.canvas-frame-slot { position: relative; flex: 1; min-height: 0; min-width: 0; }
#tapnowCanvasFrame { position: absolute; inset: 0; display: block; width: 100%; height: 100%; min-height: 0; border: 0; background: transparent; }
@media (max-width: 720px) {
  .canvas-board-bar { gap: 8px; padding: 6px 10px; }
  .canvas-board-bar .field { flex: 1; width: auto; }
  .canvas-board-status { max-width: 86px; font-size: 11px; }
}
