/* ==========================================================================
   ASYAAI — Design System
   Theme: Light Neobrutalism (DeepSeek-ish) • Dark Neon • DEEP-AI Red (isolated)
   (C) BSD-SYBER
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --font-ui: "Segoe UI", system-ui, -apple-system, "Inter", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, "SF Mono", monospace;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --t-fast: .16s cubic-bezier(.2,.8,.3,1);
  --t-med: .28s cubic-bezier(.2,.8,.3,1);
}

html[data-theme="light"] {
  --bg: #f2f3f9;
  --bg-2: #e8eaf4;
  --panel: #ffffff;
  --panel-2: #fbfbff;
  --ink: #0b1220;
  --ink-2: #3a4358;
  --muted: #6b7488;
  --line: #0b1220;
  --line-soft: #d7dbe8;
  --accent: #4d6bfe;
  --accent-ink: #ffffff;
  --accent-2: #ffd166;
  --accent-3: #ff5c8a;
  --good: #14a06a;
  --warn: #d97706;
  --bad: #e11d48;
  --shadow: 5px 5px 0 var(--line);
  --shadow-sm: 3px 3px 0 var(--line);
  --shadow-lg: 9px 9px 0 var(--line);
  --glow: 0 0 0 transparent;
  --chat-user: #4d6bfe;
  --chat-user-ink: #fff;
  --grid-dot: rgba(11,18,32,.12);
}

html[data-theme="dark"] {
  --bg: #070a12;
  --bg-2: #0b1120;
  --panel: #0e1424;
  --panel-2: #111a2e;
  --ink: #e8eefc;
  --ink-2: #b9c4dc;
  --muted: #7f8ca8;
  --line: #263355;
  --line-soft: #1a2540;
  --accent: #6d8cff;
  --accent-ink: #0a1020;
  --accent-2: #ffd166;
  --accent-3: #ff5c8a;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --shadow: 0 0 0 1px rgba(109,140,255,.18), 0 14px 34px rgba(0,0,0,.55);
  --shadow-sm: 0 0 0 1px rgba(109,140,255,.14);
  --shadow-lg: 0 0 0 1px rgba(109,140,255,.25), 0 24px 60px rgba(0,0,0,.6);
  --glow: 0 0 22px rgba(109,140,255,.35);
  --chat-user: #22306a;
  --chat-user-ink: #dbe4ff;
  --grid-dot: rgba(109,140,255,.16);
}

/* ---------- DEEP-AI isolated canvas theme ---------- */
body.is-deep {
  --bg: #0a0205;
  --bg-2: #140309;
  --panel: #180409;
  --panel-2: #21060d;
  --ink: #ffe8ee;
  --ink-2: #f3c3cf;
  --muted: #b97d8d;
  --line: #5c1024;
  --line-soft: #3a0a19;
  --accent: #ff2d55;
  --accent-ink: #1a0007;
  --accent-2: #ff8fa3;
  --accent-3: #ff2d55;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #ff4d6d;
  --shadow: 0 0 0 1px rgba(255,45,85,.28), 0 14px 40px rgba(255,45,85,.10);
  --shadow-sm: 0 0 0 1px rgba(255,45,85,.22);
  --shadow-lg: 0 0 0 1px rgba(255,45,85,.4), 0 24px 60px rgba(255,45,85,.18);
  --glow: 0 0 26px rgba(255,45,85,.45);
  --chat-user: #450817;
  --chat-user-ink: #ffe3ea;
  --grid-dot: rgba(255,45,85,.18);
  --font-ui: var(--font-mono);
}
body.is-deep::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9000;
  background: repeating-linear-gradient(to bottom, rgba(255,45,85,.035) 0 1px, transparent 1px 4px);
  mix-blend-mode: overlay;
  opacity: .7;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
h1,h2,h3,h4,p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
svg { display: block; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-soft) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-soft); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ---------- Utility ---------- */
.grow { flex: 1; }
.center { text-align: center; }
.fine { font-size: 12px; color: var(--muted); line-height: 1.55; }
.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
.ico svg, .icon-btn svg, .btn svg, .chip svg { width: 18px; height: 18px; }
.ico { display: inline-flex; }

/* ---------- Layout ---------- */
.app {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  height: 100dvh;
}
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }

.view {
  position: absolute; inset: 0;
  display: none;
  overflow-y: auto;
  padding: 22px clamp(16px, 3vw, 36px) 30px;
  animation: viewIn .28s ease both;
}
.view.is-active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

#view-chat { display: none; flex-direction: column; padding: 0; overflow: hidden; }
#view-chat.is-active { display: flex; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h2 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -.03em; line-height: 1.1; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 62ch; }
.eyebrow {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .16em;
  color: var(--accent); text-transform: uppercase; margin-bottom: 8px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 14px 12px;
  background: var(--panel);
  border-right: 2.5px solid var(--line);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 40;
}
html[data-theme="dark"] .sidebar { border-right-width: 1px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  border: 2.5px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm);
  flex: none;
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 19px; letter-spacing: .06em; }
.brand-text small { font-size: 10.5px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.sidebar-close { display: none; margin-left: auto; }

.new-chat {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 12px;
  background: var(--accent); color: var(--accent-ink);
  border: 2.5px solid var(--line); border-radius: var(--r-md);
  font-weight: 800; box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.new-chat:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--line); }
.new-chat:active { transform: translate(3px,3px); box-shadow: 0 0 0 var(--line); }
.new-chat kbd { margin-left: auto; font-size: 10px; opacity: .7; border: 1px solid currentColor; border-radius: 5px; padding: 1px 5px; }
html[data-theme="dark"] .new-chat { border-width: 1px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 11px;
  color: var(--ink-2); font-weight: 600; font-size: 14px;
  border: 2px solid transparent;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-2); color: var(--ink); text-decoration: none; }
.nav-item.is-active {
  background: var(--panel-2); color: var(--ink);
  border-color: var(--line); box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .nav-item.is-active { background: rgba(109,140,255,.12); border-color: transparent; }
.nav-item .ico { color: var(--muted); }
.nav-item.is-active .ico { color: var(--accent); }
.nav-deep { color: var(--accent-3); }
.nav-deep.is-active { background: rgba(255,45,85,.1); border-color: var(--accent-3); }
html[data-theme="dark"] .nav-deep.is-active { background: rgba(255,45,85,.14); border-color: rgba(255,45,85,.5); }
.nav-owner { color: var(--accent); }
.pill.iso { margin-left: auto; font-size: 8.5px; letter-spacing: .08em; padding: 2px 5px; border-radius: 4px; background: var(--accent-3); color: #fff; }

.sidebar-section { display: flex; flex-direction: column; min-height: 120px; flex: 1; }
.section-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.mini-btn { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); border: 1px solid transparent; }
.mini-btn:hover { background: var(--bg-2); color: var(--ink); border-color: var(--line-soft); }
.mini-btn svg { width: 13px; height: 13px; }

.history { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; padding-right: 2px; }
.history-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 9px; border-radius: 9px; text-align: left;
  font-size: 12.5px; color: var(--ink-2); border: 1.5px solid transparent;
}
.history-item:hover { background: var(--bg-2); }
.history-item.is-active { background: var(--bg-2); border-color: var(--line-soft); color: var(--ink); font-weight: 600; }
.history-item span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.history-item .del { opacity: 0; transition: opacity var(--t-fast); }
.history-item:hover .del { opacity: 1; }
.history-empty { font-size: 12px; color: var(--muted); padding: 8px 10px; line-height: 1.6; }

.sidebar-foot { display: flex; flex-direction: column; gap: 8px; }
.status-card {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px; border-radius: 12px; border: 2px solid var(--line-soft);
  background: var(--panel-2); text-align: left;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.status-card:hover { border-color: var(--line); transform: translateY(-1px); }
html[data-theme="dark"] .status-card { border-width: 1px; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff; font-weight: 800; font-size: 14px; flex: none;
}
.status-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.status-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-text small { font-size: 10.5px; color: var(--muted); letter-spacing: .02em; }
.status-card .ico { color: var(--muted); }
.sidebar-foot .fine { font-size: 10px; text-align: center; }

.scrim { position: fixed; inset: 0; background: rgba(4,7,15,.5); z-index: 30; backdrop-filter: blur(2px); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px clamp(12px, 2.4vw, 24px);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 2px solid var(--line-soft);
  min-height: 60px; z-index: 20;
}
html[data-theme="dark"] .topbar { border-bottom-width: 1px; }
.mode-switch {
  display: flex; gap: 3px; padding: 3px;
  background: var(--bg-2); border-radius: 12px; border: 1.5px solid var(--line-soft);
}
.mode-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 800;
  color: var(--muted); letter-spacing: .02em;
  transition: all var(--t-fast);
}
.mode-btn:hover { color: var(--ink); }
.mode-btn.is-active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.mode-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.mode-btn.mode-deep { font-family: var(--font-mono); }
.mode-btn.mode-deep.is-active { background: var(--accent-3); color: #fff; }
.mode-btn.mode-deep.is-active .dot { background: #fff; }
.lock-badge svg { width: 12px; height: 12px; }
.lock-badge { display: inline-flex; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 999px;
  border: 1.5px solid var(--line-soft); background: var(--panel-2); color: var(--ink-2);
  white-space: nowrap;
}
.badge.tier-free { border-color: var(--line-soft); }
.badge.tier-pro { background: var(--accent-2); color: #3a2c00; border-color: var(--line); }
.badge.tier-vip { background: linear-gradient(135deg, var(--accent), var(--accent-3)); color: #fff; border-color: var(--line); }
.badge.tier-deep { background: var(--accent-3); color: #fff; border-color: var(--line); font-family: var(--font-mono); }
.badge.danger { background: var(--bad); color: #fff; border-color: var(--line); }
.badge.usage-badge { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.good { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }

.avatar-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3)); color: #fff;
  border: 2px solid var(--line); box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .avatar-btn { border-width: 1px; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; color: var(--ink-2);
  border: 1.5px solid transparent;
  transition: all var(--t-fast);
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); border-color: var(--line-soft); }
.icon-btn.is-on { color: var(--accent); }
.only-mobile { display: none; }

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 11px;
  border: 2px solid var(--line); background: var(--panel); color: var(--ink);
  font-weight: 700; font-size: 13px; box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}
html[data-theme="dark"] .btn { border-width: 1px; border-color: var(--line); }
.btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--line); }
.btn:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--line); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.dark { background: var(--ink); color: var(--panel); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--bg-2); transform: none; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: var(--shadow-sm) !important; }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 9px; font-size: 12px; font-weight: 700;
  border: 1.5px solid var(--line-soft); background: var(--panel-2); color: var(--ink-2);
  transition: all var(--t-fast);
}
.chip:hover { border-color: var(--line); color: var(--ink); transform: translateY(-1px); }
.chip.danger { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.chip svg { width: 13px; height: 13px; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px;
  background: var(--panel-2); color: var(--ink);
  border: 1.5px solid var(--line-soft); border-radius: 10px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  font-size: 13.5px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { resize: vertical; line-height: 1.55; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-form { display: flex; gap: 8px; margin-bottom: 8px; }
.inline-form input { flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--panel);
  border: 2.5px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px;
}
html[data-theme="dark"] .card { border-width: 1px; }
.card h3 { font-size: 16px; margin-bottom: 8px; letter-spacing: -.01em; }
.card p { color: var(--ink-2); font-size: 13.5px; line-height: 1.6; }
.note-card { display: flex; gap: 12px; margin-top: 16px; box-shadow: var(--shadow-sm); }
.note-card > .ico { color: var(--accent); flex: none; margin-top: 2px; }

/* ---------- Chat view ---------- */
.chat-scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; padding: 24px clamp(14px, 4vw, 48px) 12px; transition: padding-right var(--t-med); }
.messages { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.split-toggle { display: grid; }
.chat-history-panel {
  position: absolute; z-index: 24; top: 0; right: 0; bottom: 0; width: min(340px, 36vw);
  display: flex; flex-direction: column; gap: 12px; padding: 18px 14px;
  background: var(--panel); border-left: 2px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(102%); transition: transform var(--t-med); visibility: hidden;
}
.chat-panel-open .chat-history-panel { transform: none; visibility: visible; }
.chat-panel-open .chat-history-panel { z-index: 24; }
.chat-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-panel-head .eyebrow { margin-bottom: 3px; }
.chat-panel-head h3 { font-size: 16px; }
.panel-new-chat { width: 100%; }
.panel-history { flex: 1; }
.chat-panel-scrim { display: none; }
.chat-panel-open #view-chat .chat-scroll { padding-right: clamp(350px, 38vw, 400px); }
.msg.user { flex-direction: row-reverse; }
.msg.user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .msg-head { flex-direction: row-reverse; }
.msg.user .msg-text { text-align: left; }
.msg.user .msg-actions { justify-content: flex-end; }
.msg-edit-box { width: min(100%, 620px); }
.msg-edit-box textarea { min-height: 84px; resize: vertical; }
.msg-edit-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; margin-top: 7px; }
.model-bar { max-width: 880px; margin: 0 auto 7px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.model-label { flex: none; color: var(--muted); font: 800 10px/1 var(--font-mono); letter-spacing: .08em; }
.model-select-wrap { flex: 1; min-width: 0; }
.model-select-wrap select { width: min(100%, 420px); padding: 6px 26px 6px 9px; font-size: 11px; border-radius: 8px; }

.empty-state { max-width: 940px; margin: 0 auto; padding-bottom: 8px; }
.hero {
  display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,.9fr);
  gap: 20px; align-items: center;
  padding: clamp(18px, 3vw, 30px);
  background: var(--panel);
  border: 2.5px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 18px 18px; opacity: .5; pointer-events: none;
}
html[data-theme="dark"] .hero { border-width: 1px; }
.hero-copy { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(26px, 4.2vw, 46px); line-height: 1.05; letter-spacing: -.045em; margin: 4px 0 10px; }
.hero h1 .hl { color: var(--accent); }
.hero p { color: var(--muted); max-width: 46ch; line-height: 1.6; font-size: 14.5px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero-art { position: relative; height: 150px; z-index: 1; }
.orb {
  position: absolute; inset: 12px 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--accent), transparent 62%),
              radial-gradient(circle at 70% 75%, var(--accent-3), transparent 58%);
  filter: blur(2px); opacity: .85;
  animation: floaty 7s ease-in-out infinite;
}
.hero-card {
  position: absolute; display: flex; flex-direction: column; align-items: center;
  padding: 8px 12px; border-radius: 12px; background: var(--panel);
  border: 2px solid var(--line); box-shadow: var(--shadow-sm);
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.hero-card b { font-size: 18px; color: var(--ink); letter-spacing: -.02em; }
.hero-card.c1 { left: 4%; top: 6%; transform: rotate(-6deg); }
.hero-card.c2 { right: 2%; top: 28%; transform: rotate(5deg); }
.hero-card.c3 { left: 22%; bottom: 2%; transform: rotate(3deg); }
@keyframes floaty { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }

.chip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 14px; }
.quick {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 13px; border-radius: var(--r-md);
  background: var(--panel); border: 2px solid var(--line-soft);
  transition: all var(--t-fast);
}
.quick:hover { border-color: var(--line); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.quick b { font-size: 13px; }
.quick small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.q-ico { color: var(--accent); margin-bottom: 2px; }
.q-ico svg { width: 20px; height: 20px; }

/* Messages */
.msg { display: flex; gap: 12px; animation: msgIn .25s ease both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 12px;
  border: 2px solid var(--line); background: var(--panel);
}
html[data-theme="dark"] .msg-avatar { border-width: 1px; }
.msg.assistant .msg-avatar { background: var(--accent); color: var(--accent-ink); border-color: var(--line); }
.msg.user .msg-avatar { background: var(--accent-3); color: #fff; }
.msg.deepep .msg-avatar { background: var(--accent-3); color: #fff; }
.msg-body { min-width: 0; flex: 1; }
.msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.msg-head strong { font-size: 12.5px; letter-spacing: .02em; }
.msg-head time { font-size: 10.5px; color: var(--muted); }
.msg-head .tag { font-size: 9px; font-weight: 800; letter-spacing: .1em; padding: 2px 5px; border-radius: 4px; background: color-mix(in srgb, var(--accent-3) 18%, transparent); color: var(--accent-3); }
.msg.user .msg-text {
  background: var(--chat-user); color: var(--chat-user-ink);
  padding: 10px 14px; border-radius: 4px 14px 14px 14px;
  border: 1.5px solid var(--line); display: inline-block; max-width: 100%;
  white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.6;
}
.msg.assistant .msg-text { font-size: 14.3px; line-height: 1.68; color: var(--ink); }
.msg-actions { display: flex; gap: 4px; margin-top: 8px; opacity: 0; transition: opacity var(--t-fast); }
.msg:hover .msg-actions { opacity: 1; }
.msg-actions button {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; color: var(--muted); padding: 3px 7px; border-radius: 6px;
  border: 1px solid transparent;
}
.msg-actions button:hover { color: var(--ink); background: var(--bg-2); border-color: var(--line-soft); }
.msg-actions svg { width: 12px; height: 12px; }

.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%,60%,100% { opacity: .25; transform: translateY(0) } 30% { opacity: 1; transform: translateY(-3px) } }
.msg-live-status { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding: 3px 7px; border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.thinking-glow {
  color: var(--accent); font: 800 9px/1 var(--font-mono);
  letter-spacing: .1em; text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 65%, transparent);
  animation: thinkingPulse 1.5s ease-in-out infinite;
}
.msg.is-generating .msg-avatar {
  animation: avatarGlow 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent), 0 0 20px color-mix(in srgb, var(--accent) 55%, transparent);
}
.msg-text.is-streaming { border-left: 2px solid var(--accent); padding-left: 10px; animation: answerGlow 1.8s ease-in-out infinite; }
@keyframes thinkingPulse { 0%,100% { opacity: .55; text-shadow: 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); } 50% { opacity: 1; text-shadow: 0 0 13px color-mix(in srgb, var(--accent) 85%, transparent); } }
@keyframes avatarGlow { 0%,100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 10%, transparent); } 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent), 0 0 20px color-mix(in srgb, var(--accent) 55%, transparent); } }
@keyframes answerGlow { 0%,100% { border-color: color-mix(in srgb, var(--accent) 35%, transparent); } 50% { border-color: color-mix(in srgb, var(--accent) 85%, transparent); } }
.gateway-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 14px; align-items: start; }
.gateway-layout .card { min-width: 0; }
.gateway-routes { margin: 12px 0; }
.gateway-layout .field { margin: 12px 0; }
.gateway-layout input, .gateway-layout select { width: 100%; }
.gateway-layout .icon-row { flex-wrap: wrap; }
.gateway-layout [aria-live] { min-height: 1.5em; margin-top: 8px; }
.reduce-motion .thinking-glow,
.reduce-motion .typing i,
.reduce-motion .msg.is-generating .msg-avatar,
.reduce-motion .msg-text.is-streaming { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .thinking-glow, .typing i, .msg.is-generating .msg-avatar, .msg-text.is-streaming { animation: none; }
}

.followups { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.followups button {
  font-size: 11.5px; padding: 6px 10px; border-radius: 8px;
  border: 1.5px dashed var(--line-soft); color: var(--ink-2); background: transparent;
  transition: all var(--t-fast); text-align: left;
}
.followups button:hover { border-style: solid; border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* Markdown */
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { margin: 18px 0 8px; line-height: 1.25; letter-spacing: -.02em; }
.md h1 { font-size: 22px; } .md h2 { font-size: 18.5px; } .md h3 { font-size: 16px; } .md h4 { font-size: 14px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li::marker { color: var(--accent); }
.md strong { font-weight: 800; }
.md em { color: var(--ink-2); }
.md code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  padding: 1.5px 5px; border-radius: 5px;
}
.md blockquote {
  margin: 0 0 10px; padding: 8px 12px;
  border-left: 4px solid var(--accent); background: var(--bg-2);
  border-radius: 0 8px 8px 0; color: var(--ink-2);
}
.md table { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: 12.5px; }
.md th, .md td { border: 1px solid var(--line-soft); padding: 6px 9px; text-align: left; }
.md th { background: var(--bg-2); font-weight: 800; }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md hr { border: 0; border-top: 1.5px dashed var(--line-soft); margin: 14px 0; }

.code-block {
  margin: 0 0 12px; border: 1.5px solid var(--line-soft);
  border-radius: 11px; overflow: hidden; background: var(--bg-2);
}
.code-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px;
  padding: 6px 10px; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--muted); background: color-mix(in srgb, var(--panel) 60%, transparent);
  border-bottom: 1.5px solid var(--line-soft); text-transform: uppercase; letter-spacing: .08em;
}
.code-actions, .table-actions { display: flex; align-items: center; gap: 9px; }
.code-actions { min-width: 0; max-width: 100%; flex-wrap: wrap; justify-content: flex-end; gap: 5px 8px; }
.code-head button, .table-actions button { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); white-space: nowrap; }
.code-head button:hover, .table-actions button:hover { color: var(--accent); }
.code-actions svg, .table-actions svg { width: 13px; height: 13px; }
.html-preview-frame { display: block; width: 100%; height: min(440px, 60vh); border: 0; border-top: 1px solid var(--line-soft); background: #fff; }
.html-preview-frame[hidden] { display: none; }
.markdown-table-wrap .table-actions { justify-content: flex-end; padding: 6px 9px; border-bottom: 1px solid var(--line-soft); }
.code-block pre { margin: 0; padding: 12px; overflow-x: auto; }
.code-block code { background: none; border: 0; padding: 0; font-size: 12.5px; line-height: 1.62; color: var(--ink); }
.media-result { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; margin-top: 8px; }
.media-preview-button { display: block; max-width: min(100%, 520px); padding: 0; overflow: hidden; border: 2px solid var(--line); border-radius: 12px; background: var(--panel); cursor: zoom-in; }
.media-preview-button img { display: block; max-width: 100%; max-height: 520px; object-fit: contain; }
.media-result-actions { display: flex; gap: 6px; }
.media-result-actions button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid var(--line-soft); border-radius: 8px; color: var(--muted); font-size: 11px; }
.media-result-actions button:hover { color: var(--accent); border-color: var(--accent); }
.media-result-actions svg { width: 14px; height: 14px; }
.image-preview-wrap { display: grid; place-items: center; max-height: 72vh; min-height: 160px; overflow: auto; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--bg-2); }
.image-preview-large { display: block; width: auto; max-width: 100%; max-height: 68vh; object-fit: contain; }
.modal.image-preview-modal { width: 100vw; max-width: none; height: 100dvh; max-height: none; border: 0; border-radius: 0; padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); }
.image-preview-modal .image-preview-wrap { width: 100%; height: calc(100dvh - 145px); max-height: none; }
.image-preview-modal .image-preview-large { max-width: 100%; max-height: 100%; }
.image-preview-wrap:fullscreen { width: 100vw; height: 100dvh; max-height: none; border: 0; border-radius: 0; background: #080b12; }
.image-preview-wrap:fullscreen .image-preview-large { max-width: 100vw; max-height: 100dvh; }
.image-preview-backdrop-fullscreen { padding: 0; }
.modal.image-preview-fullscreen { position: fixed; inset: 0; z-index: 250; width: 100vw; max-width: none; height: 100dvh; max-height: none; padding: 16px; border: 0; border-radius: 0; }
.image-preview-fullscreen .image-preview-wrap { width: 100%; height: calc(100dvh - 90px); max-height: none; }
.image-preview-fullscreen .image-preview-large { max-height: 100%; max-width: 100%; }
.tok-k { color: #c792ea; } .tok-s { color: #a5d6a7; } .tok-c { color: #7f8ca8; font-style: italic; } .tok-n { color: #ffb86c; } .tok-f { color: #82aaff; }
html[data-theme="light"] .tok-k { color: #a626a4; } html[data-theme="light"] .tok-s { color: #2e7d32; } html[data-theme="light"] .tok-n { color: #b45309; } html[data-theme="light"] .tok-f { color: #1d4ed8; }

/* ---------- Composer ---------- */
.composer-dock {
  padding: 8px clamp(12px, 4vw, 48px) 12px;
  background: linear-gradient(to top, var(--bg) 62%, transparent);
  position: relative;
}
.composer {
  max-width: 880px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 6px;
  padding: 7px 7px 7px 8px;
  background: var(--panel);
  border: 2.5px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
}
html[data-theme="dark"] .composer { border-width: 1px; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent), var(--shadow); }
.composer textarea {
  flex: 1; border: 0; background: transparent; resize: none;
  padding: 8px 4px; max-height: 168px; min-height: 24px;
  font-size: 14px; line-height: 1.5;
}
.composer textarea:focus { box-shadow: none; }
.send-btn {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 11px; background: var(--accent); color: var(--accent-ink);
  border: 2px solid var(--line); transition: all var(--t-fast);
}
.send-btn:hover { transform: translateY(-1px); }
.send-btn:active { transform: translateY(1px); }
.send-btn.is-stop { background: var(--bad); color: #fff; }
.send-btn svg { width: 17px; height: 17px; }
html[data-theme="dark"] .send-btn { border-width: 1px; }
.composer-meta {
  max-width: 880px; margin: 6px auto 0; display: flex; justify-content: space-between; gap: 10px;
  font-size: 10.5px; color: var(--muted); padding: 0 4px;
}
.limit-hint { color: var(--warn); font-weight: 700; }
.attach-row { max-width: 880px; margin: 0 auto 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.attach-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 8px; font-size: 11.5px;
  background: var(--panel); border: 1.5px solid var(--line-soft);
}
.attach-pill button { color: var(--muted); }
.attach-pill button:hover { color: var(--bad); }
.attach-pill svg { width: 12px; height: 12px; }

.slash-palette {
  position: absolute; bottom: calc(100% - 4px); left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  background: var(--panel); border: 2px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 15;
  max-height: 320px; overflow-y: auto;
}
html[data-theme="dark"] .slash-palette { border-width: 1px; }
.slash-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 9px; text-align: left; font-size: 13px;
}
.slash-item:hover, .slash-item.is-sel { background: var(--bg-2); }
.slash-item code { font-family: var(--font-mono); font-weight: 700; color: var(--accent); font-size: 12px; min-width: 76px; }
.slash-item small { color: var(--muted); font-size: 11.5px; }

.deep-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px clamp(14px, 4vw, 48px);
  background: color-mix(in srgb, var(--accent-3) 12%, var(--panel));
  border-bottom: 1.5px solid color-mix(in srgb, var(--accent-3) 40%, transparent);
  font-size: 11.5px; color: var(--ink-2);
}
.deep-banner strong { font-family: var(--font-mono); letter-spacing: .1em; color: var(--accent-3); font-size: 11px; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-3); animation: rec 1.6s infinite; flex: none; }
@keyframes rec { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,45,85,.5) } 50% { opacity: .5; box-shadow: 0 0 0 6px rgba(255,45,85,0) } }
.deep-banner-close { width: 30px; height: 30px; flex: none; }

/* ---------- Image studio ---------- */
.studio { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0,1fr); gap: 16px; align-items: start; }
.studio-form { position: sticky; top: 0; }
.studio-gallery { min-height: 320px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.gallery-empty {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 50px 20px; color: var(--muted); text-align: center; font-size: 13px;
  border: 2px dashed var(--line-soft); border-radius: 14px;
}
.gallery-empty svg { width: 34px; height: 34px; opacity: .5; }
.gallery-item {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 2px solid var(--line); background: var(--bg-2);
  animation: msgIn .3s ease both;
}
html[data-theme="dark"] .gallery-item { border-width: 1px; }
.gallery-preview { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.gallery-preview img { display: block; aspect-ratio: 1/1; object-fit: cover; width: 100%; }
.gallery-item .meta { padding: 7px 9px; font-size: 10.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.gallery-item .meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-item .acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity var(--t-fast); }
.gallery-item:hover .acts, .gallery-item:focus-within .acts { opacity: 1; }
.gallery-item .acts button { width: 26px; height: 26px; display: grid; place-items: center; background: var(--panel); border: 1.5px solid var(--line); border-radius: 7px; color: var(--ink); }
.gallery-item .acts svg { width: 12px; height: 12px; }
@media (hover: none) { .gallery-item .acts { opacity: 1; } }

/* ---------- Tools ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tool-card {
  display: flex; flex-direction: column; gap: 7px; text-align: left;
  padding: 14px; border-radius: var(--r-md);
  background: var(--panel); border: 2px solid var(--line-soft);
  transition: all var(--t-fast); position: relative;
}
.tool-card:hover { border-color: var(--line); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.tool-card .t-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tool-card .t-ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.tool-card .t-ico svg { width: 18px; height: 18px; }
.tool-card h4 { font-size: 13.5px; }
.tool-card p { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.tool-card .tier-tag { font-size: 8.5px; font-weight: 800; letter-spacing: .08em; padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line-soft); color: var(--muted); }
.tool-card .tier-tag.pro { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.tool-card .tier-tag.vip { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.tool-card .tier-tag.deep { color: var(--accent-3); border-color: color-mix(in srgb, var(--accent-3) 45%, transparent); }

/* ---------- Plugins ---------- */
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.plugin-card {
  display: flex; align-items: center; gap: 12px;
  padding: 13px; border-radius: var(--r-md);
  background: var(--panel); border: 2px solid var(--line-soft);
  transition: all var(--t-fast);
}
.plugin-card:hover { border-color: var(--line); }
.plugin-card.is-on { border-color: var(--good); box-shadow: 0 0 0 1px color-mix(in srgb, var(--good) 30%, transparent); }
.plugin-logo {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  border: 2px solid var(--line); color: #fff;
}
html[data-theme="dark"] .plugin-logo { border-width: 1px; }
.plugin-info { flex: 1; min-width: 0; }
.plugin-info b { display: block; font-size: 13px; }
.plugin-info small { color: var(--muted); font-size: 11px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch {
  width: 40px; height: 22px; border-radius: 999px; flex: none;
  background: var(--line-soft); position: relative; border: 1.5px solid var(--line-soft);
  transition: background var(--t-fast);
}
.switch::after {
  content: ""; position: absolute; top: 1px; left: 1px;
  width: 17px; height: 17px; border-radius: 50%; background: var(--panel);
  border: 1.5px solid var(--line-soft);
  transition: transform var(--t-fast), background var(--t-fast);
}
.switch.is-on { background: var(--good); border-color: var(--good); }
.switch.is-on::after { transform: translateX(17px); background: #fff; border-color: #fff; }

/* ---------- Pricing ---------- */
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.price-card {
  display: flex; flex-direction: column; gap: 10x;
  padding: 16px; border-radius: var(--r-lg);
  border: 2.5px solid var(--line); background: var(--panel);
  box-shadow: var(--shadow-sm); position: relative;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
html[data-theme="dark"] .price-card { border-width: 1px; }
.price-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.price-card.featured { box-shadow: var(--shadow); outline: 3px solid var(--accent); outline-offset: -3px; }
.price-card.deep { border-color: var(--accent-3); background: color-mix(in srgb, var(--accent-3) 6%, var(--panel)); }
.price-card .p-head { display: flex; align-items: center; justify-content: space-between; }
.price-card h3 { font-size: 15px; letter-spacing: .06em; }
.price-card .amount { font-size: 28px; font-weight: 900; letter-spacing: -.04em; line-height: 1; }
.price-card .amount small { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.price-card .p-tag { font-size: 10.5px; color: var(--muted); }
.price-card ul { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 5px; }
.price-card li { display: flex; gap: 6px; font-size: 11.5px; color: var(--ink-2); line-height: 1.45; }
.price-card li::before { content: "✓"; color: var(--good); font-weight: 900; flex: none; }
.price-card .btn { margin-top: auto; }
.ribbon {
  position: absolute; top: -10px; right: 12px; font-size: 9px; font-weight: 800;
  letter-spacing: .1em; padding: 3px 8px; border-radius: 5px;
  background: var(--accent-2); color: #3a2c00; border: 1.5px solid var(--line);
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.pay-methods { display: flex; flex-wrap: wrap; gap: 7px; }
.pay-methods .chip { cursor: default; }
.compare-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.table th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table td.yes { color: var(--good); font-weight: 800; }
.table td.no { color: var(--muted); }

/* ---------- Account / Owner ---------- */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.acc-grid .card { margin: 0; }
.account-chat-history { display: grid; gap: 14px; margin-top: 14px; }
.account-history-section { min-width: 0; }
.account-history-list { display: flex; flex-direction: column; gap: 5px; max-height: 280px; overflow: auto; }
.account-history-item { width: 100%; display: flex; align-items: center; gap: 9px; text-align: left; padding: 9px; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 10px; }
.account-history-item:hover { border-color: var(--accent); }
.account-history-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 3px; }
.account-history-copy b, .account-history-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-history-copy b { font-size: 12px; }
.account-history-copy small { font-size: 10.5px; color: var(--muted); }
.account-history-item > .ico { color: var(--accent); flex: none; }
.membership-guide { padding: 11px; margin: 10px 0; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line-soft)); border-radius: 10px; background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.membership-guide > b { font-size: 12px; }
.membership-guide ol { margin: 7px 0 10px; padding-left: 20px; font-size: 11px; color: var(--ink-2); line-height: 1.55; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12.5px; }
.kv:last-child { border-bottom: 0; }
.kv b { font-weight: 700; }
.kv span { color: var(--muted); }
.usage-box {
  background: var(--bg-2); border: 1.5px solid var(--line-soft); border-radius: 11px;
  padding: 12px; margin-top: 8px;
}
.usage-box .u-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.usage-box .u-line strong { font-size: 13px; }
.usage-box code { font-family: var(--font-mono); font-size: 11px; color: var(--muted); word-break: break-all; }
.meter { height: 10px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-3)); transition: width .5s ease; }
.meter.is-hot i { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.hidden-reveal { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.icon-row { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-row .icon-btn { border: 1.5px solid var(--line-soft); }
.tag-line { display: flex; flex-wrap: wrap; gap: 5px; }

.owner-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.owner-panel-head h2 { font-size: 18px; }
.owner-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.owner-tab {
  padding: 7px 11px; border-radius: 9px; font-size: 12px; font-weight: 700;
  border: 1.5px solid var(--line-soft); color: var(--muted); background: var(--panel);
}
.owner-tab.is-active { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.owner-pane { display: none; }
.owner-pane.is-active { display: block; animation: viewIn .2s ease both; }
.owner-pane .card { margin-bottom: 12px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 8px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.log-list { display: flex; flex-direction: column; gap: 4px; max-height: 340px; overflow-y: auto; }
.log-row { display: flex; gap: 8px; align-items: baseline; font-size: 11.5px; padding: 5px 7px; border-radius: 6px; background: var(--bg-2); }
.log-row time { font-family: var(--font-mono); font-size: 10px; color: var(--muted); flex: none; }
.log-row .lt { color: var(--accent); font-weight: 700; flex: none; text-transform: uppercase; font-size: 9.5px; letter-spacing: .05em; }
.log-row span:last-child { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }

.lock-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 70px 20px;
  border: 2px dashed var(--line-soft); border-radius: var(--r-lg);
  background: var(--panel); max-width: 520px; margin: 20px auto;
}
.lock-screen svg { width: 40px; height: 40px; color: var(--accent-3); }
.lock-screen h3 { font-size: 18px; }
.lock-screen p { color: var(--muted); font-size: 13px; max-width: 40ch; }

/* ---------- Owner console (monitoring + tier test) ---------- */
.oc-wrap { display: flex; flex-direction: column; gap: 16px; }
.oc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; }
.oc-head h2 { font-size: 19px; letter-spacing: -.02em; margin: 0; }
.oc-under { display: flex; align-items: center; gap: 8px; margin: 5px 0 0; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.oc-under .sep { width: 1px; height: 11px; background: var(--line-soft); }
.oc-spacer { margin-left: auto; }
.oc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 12px;
  border: 2px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink);
  font-family: inherit; font-size: 12px; font-weight: 700; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.oc-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }
.oc-btn:active { transform: none; box-shadow: 1px 1px 0 var(--line); }
.oc-btn.is-primary { background: var(--accent); color: var(--accent-ink); }
.oc-btn svg { width: 14px; height: 14px; }
.oc-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.oc-sel {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 8px 0 10px;
  border: 2px solid var(--line); border-radius: 8px; background: var(--panel);
  font-family: var(--font-mono); font-size: 11px; color: var(--ink);
}
.oc-sel select { border: none; background: none; font-family: inherit; font-size: 11px; color: inherit; padding: 0 2px; cursor: pointer; }
.oc-state { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border: 2px solid var(--line); border-radius: 8px; font-family: var(--font-mono); font-size: 11px; background: var(--panel); }
.oc-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.oc-state.is-live .dot { background: var(--good); }
.oc-state.is-local .dot { background: var(--warn); }
.oc-chk { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.oc-chk input { appearance: none; width: 16px; height: 16px; margin: 0; border: 2px solid var(--line); border-radius: 4px; background: var(--panel); position: relative; cursor: pointer; }
.oc-chk input:checked { background: var(--ink); }
.oc-chk input:checked::after { content: ""; position: absolute; left: 3px; top: 0; width: 5px; height: 9px; border: solid var(--panel); border-width: 0 2px 2px 0; transform: rotate(45deg); }

.oc-split { display: grid; grid-template-columns: minmax(0, 580px) minmax(320px, 1fr); gap: 16px; align-items: stretch; }
.oc-mon { border: 2px solid var(--line); border-radius: var(--r-md); background: var(--panel); box-shadow: var(--shadow-sm); padding: 12px; display: flex; flex-direction: column; gap: 11px; min-width: 0; }
.oc-rates { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.oc-rate .v { font-size: 23px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.oc-rate .l { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-top: 4px; }
.oc-rate-sub { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--muted); text-align: right; line-height: 1.65; }
.oc-plot-h { display: flex; align-items: baseline; gap: 8px; font-size: 11.5px; font-weight: 700; }
.oc-plot-h em { font-style: normal; font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-left: auto; font-weight: 400; white-space: nowrap; }
.oc-yax span { white-space: nowrap; }
.oc-plot-body { display: flex; gap: 6px; }
.oc-yax { width: 34px; display: flex; flex-direction: column; justify-content: space-between; font-family: var(--font-mono); font-size: 9px; color: var(--muted); text-align: right; }
.oc-spark { flex: 1; height: 58px; display: block; }
.oc-grid-l { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 3 4; }
.oc-ln-tok { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.oc-ln-req { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.oc-xax { display: flex; justify-content: space-between; padding-left: 40px; font-family: var(--font-mono); font-size: 9px; color: var(--muted); }
.oc-bd { border-top: 2px solid var(--line-soft); padding-top: 9px; }
.oc-bd-h { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.oc-bd-h button { margin-left: auto; border: none; background: none; font-family: inherit; font-size: 10px; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0; text-transform: none; letter-spacing: 0; }
.oc-trow { display: grid; grid-template-columns: 64px 1fr 74px 48px; align-items: center; gap: 8px; height: 27px; font-size: 11.5px; }
.oc-trow .nm { font-weight: 700; }
.oc-trow.is-head { height: 20px; font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.oc-trow.is-head .nm { font-weight: 400; }
.oc-trow .nm.is-deep { color: var(--bad); }
.oc-trbar { height: 7px; border: 1.5px solid var(--line); border-radius: 3px; overflow: hidden; background: var(--panel); }
.oc-trbar i { display: block; height: 100%; background: var(--accent); }
.oc-trow .num { font-family: var(--font-mono); font-size: 10.5px; text-align: right; font-variant-numeric: tabular-nums; }
.oc-mrow { display: grid; grid-template-columns: 1fr 84px; align-items: center; min-height: 24px; padding: 2px 0; font-size: 11px; }
.oc-mrow .mid { font-family: var(--font-mono); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-mrow .mid em.oc-caps { display: block; font-style: normal; font-size: 9px; line-height: 1.3; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; }
.oc-mrow .num { font-family: var(--font-mono); font-size: 10.5px; text-align: right; font-variant-numeric: tabular-nums; }

.oc-session { border: 2px solid var(--accent); border-radius: var(--r-md); background: var(--panel); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.oc-ctx-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 2px solid var(--line); background: var(--panel-2); flex-wrap: wrap; }
.oc-ctx-h b { font-size: 12.5px; }
.oc-seg { display: inline-flex; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); box-shadow: 2px 2px 0 var(--line); }
.oc-seg button { height: 26px; padding: 0 9px; border: none; border-right: 1.5px solid var(--line-soft); background: none; font-family: var(--font-mono); font-size: 10.5px; cursor: pointer; color: var(--ink-2); }
.oc-seg button:last-child { border-right: none; }
.oc-seg button.is-on { background: var(--ink); color: var(--panel); font-weight: 700; }
.oc-seg.is-mode button.is-on { background: var(--bad); color: #fff; }
.oc-band { display: flex; align-items: center; gap: 14px; padding: 0 14px; height: 40px; background: var(--panel-2); border-bottom: 2px solid var(--line); font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.oc-band .kv { display: inline-flex; align-items: baseline; gap: 5px; flex: none; }
.oc-band b { color: var(--ink); font-weight: 700; }
.oc-end { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 1.5px solid var(--line-soft); border-radius: 6px; background: var(--panel); font-family: inherit; font-size: 10.5px; color: var(--ink-2); cursor: pointer; flex: none; }
.oc-end:hover { border-color: var(--bad); color: var(--bad); }
.oc-msgs { flex: 1; min-height: 220px; max-height: 340px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--panel-2); }
.oc-msg { max-width: 96%; font-size: 12.5px; line-height: 1.55; word-break: break-word; }
.oc-msg.is-user { align-self: flex-end; background: var(--chat-user); color: var(--chat-user-ink); border: 2px solid var(--line); border-radius: 11px 11px 3px 11px; padding: 9px 11px; box-shadow: 2px 2px 0 var(--line); }
.oc-msg.is-bot { align-self: flex-start; background: var(--panel); border: 2px solid var(--line); border-radius: 11px 11px 11px 3px; padding: 10px 12px; box-shadow: 2px 2px 0 var(--line); }
.oc-msg.is-error { border-color: var(--bad); }
.oc-mh { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.oc-msg-empty { margin: auto; text-align: center; font-size: 11.5px; color: var(--muted); max-width: 32ch; line-height: 1.6; }
.oc-typing { display: inline-block; color: var(--muted); }
.oc-composer { border-top: 2px solid var(--line); padding: 10px 14px; background: var(--panel); display: flex; flex-direction: column; gap: 7px; }
.oc-cbox { display: flex; align-items: flex-end; gap: 8px; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; box-shadow: 2px 2px 0 var(--line); background: var(--panel); }
.oc-cbox textarea { flex: 1; border: none; outline: none; resize: none; font-family: inherit; font-size: 12.5px; line-height: 1.45; background: none; color: var(--ink); max-height: 96px; min-height: 20px; }
.oc-send { width: 28px; height: 28px; flex: none; border: 2px solid var(--line); border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 2px 2px 0 var(--line); cursor: pointer; }
.oc-send svg { width: 13px; height: 13px; }
.oc-send[disabled] { opacity: .5; cursor: not-allowed; }
.oc-cmeta { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.oc-cmeta .rv { margin-left: auto; border: 1.5px solid var(--line-soft); border-radius: 5px; padding: 2px 6px; background: var(--panel); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.oc-ops { border: 2px solid var(--line); border-radius: var(--r-md); background: var(--panel); box-shadow: var(--shadow-sm); display: grid; grid-template-columns: 1.1fr .9fr 1.2fr; overflow: hidden; }
.oc-ops > div { padding: 12px 14px; display: flex; flex-direction: column; min-width: 0; }
.oc-ops > div + div { border-left: 2px solid var(--line-soft); }
.oc-ops-h { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.oc-ops-h .cnt { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; background: var(--accent-2); border: 1.5px solid var(--line); border-radius: 5px; padding: 1px 6px; font-weight: 700; }
.oc-pay { display: grid; grid-template-columns: 1fr 56px 92px; align-items: center; gap: 8px; height: 26px; font-size: 11.5px; }
.oc-pay .em { font-family: var(--font-mono); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-pay .tier { font-family: var(--font-mono); font-size: 9.5px; border: 1.5px solid var(--line); border-radius: 4px; padding: 1px 4px; text-align: center; background: var(--panel-2); }
.oc-pay .amt { font-family: var(--font-mono); font-size: 10.5px; text-align: right; }
.oc-lic { display: flex; gap: 16px; }
.oc-lic div { display: flex; flex-direction: column; gap: 1px; }
.oc-lic b { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.oc-lic span { font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.oc-ev { display: flex; align-items: baseline; gap: 8px; height: 24px; font-size: 11px; min-width: 0; }
.oc-ev time { font-family: var(--font-mono); font-size: 10px; color: var(--muted); flex: none; }
.oc-ev b { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-ev span { font-family: var(--font-mono); font-size: 10px; color: var(--ink-2); margin-left: auto; flex: none; }
.oc-empty { display: flex; align-items: center; justify-content: center; height: 58px; border: 1.5px dashed var(--line-soft); border-radius: 8px; font-size: 11px; color: var(--muted); }
.oc-est { opacity: .8; }
.oc-ops.is-secondary { margin-top: -4px; }
.oc-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.oc-chip { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; border: 1.5px solid var(--line-soft); border-radius: 5px; padding: 2px 6px; color: var(--ink-2); background: var(--panel-2); }

@media (max-width: 1239px) {
  .oc-split { grid-template-columns: minmax(0, 1fr); }
  .oc-ops { grid-template-columns: minmax(0, 1fr); }
  .oc-ops > div + div { border-left: none; border-top: 2px solid var(--line-soft); }
  .oc-msgs { max-height: 300px; }
}
@media (max-width: 620px) {
  .oc-rates { gap: 12px; }
  .oc-rate .v { font-size: 20px; }
  .oc-rate-sub { margin-left: 0; text-align: left; width: 100%; }
  .oc-trow { grid-template-columns: 58px 1fr 66px; }
  .oc-trow .num:last-child { display: none; }
  .oc-head .oc-btn { flex: 1; }
}

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.about-grid .card { margin: 0; }
ul.clean { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
ul.clean li { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
ul.clean li::before { content: "▸"; color: var(--accent); margin-right: 6px; }
.mini-code {
  font-family: var(--font-mono); font-size: 11px; line-height: 1.7;
  background: var(--bg-2); border: 1.5px solid var(--line-soft); border-radius: 9px;
  padding: 10px; margin-top: 8px; overflow-x: auto; color: var(--ink-2); white-space: pre;
}

/* ---------- Mascot ---------- */
.mascot-layer { position: fixed; inset: 0; pointer-events: none; z-index: 120; }
.mascot {
  position: fixed; width: 92px; height: 110px;
  pointer-events: auto; cursor: grab; touch-action: none;
  filter: drop-shadow(3px 5px 0 rgba(0,0,0,.18));
  transition: filter var(--t-fast);
  user-select: none;
  z-index: 121;
}
.mascot:active { cursor: grabbing; }
.mascot svg { width: 100%; height: 100%; overflow: visible; }
.mascot .cat-body { fill: var(--accent); stroke: var(--line); stroke-width: 2.5; }
.mascot .cat-panel { fill: #fff; stroke: var(--line); stroke-width: 2.2; }
body.is-deep .mascot .cat-panel { fill: #ffd7e0; }
.mascot .cat-eye { fill: #0b1220; transition: transform .1s; transform-origin: center; }
.mascot .cat-ear-in { fill: var(--accent-3); }
.mascot .cat-paw { fill: var(--accent-2); stroke: var(--line); stroke-width: 2; }
.mascot .cat-tail { fill: none; stroke: var(--line); stroke-width: 5; stroke-linecap: round; transform-origin: 20px 84px; animation: tail 2.8s ease-in-out infinite; }
.mascot .cat-antenna { stroke: var(--line); stroke-width: 2.5; }
.mascot .cat-bulb { fill: var(--good); animation: bulb 2s ease-in-out infinite; }
.mascot.is-sleep .cat-eye { transform: scaleY(.12); }
.mascot.is-happy .cat-tail { animation-duration: .5s; }
.mascot.is-thinking .cat-bulb { animation-duration: .4s; fill: var(--warn); }
@keyframes tail { 0%,100% { transform: rotate(-6deg) } 50% { transform: rotate(14deg) } }
@keyframes bulb { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.mascot .mascot-hide {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--panel); border: 2px solid var(--line);
  display: grid; place-items: center; opacity: 0; transition: opacity var(--t-fast);
  color: var(--ink);
}
.mascot:hover .mascot-hide { opacity: 1; }
.mascot-hide svg { width: 10px; height: 10px; }
.mascot-bubble {
  position: fixed; max-width: 216px;
  padding: 9px 11px; border-radius: 12px;
  background: var(--panel); border: 2px solid var(--line);
  box-shadow: var(--shadow-sm); font-size: 11.5px; line-height: 1.5; color: var(--ink);
  pointer-events: auto; z-index: 122;
  animation: bubbleIn .2s ease both;
}
.mascot-bubble b { color: var(--accent); }
.mascot-bubble::after {
  content: ""; position: absolute; bottom: -8px; left: 22px;
  width: 12px; height: 12px; background: var(--panel);
  border-right: 2px solid var(--line); border-bottom: 2px solid var(--line);
  transform: rotate(45deg);
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px) scale(.96) } to { opacity: 1; transform: none } }

/* ---------- Modal / Toast ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4,7,15,.55); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px;
  animation: fadeIn .18s ease both;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: min(520px, 100%); max-height: 88dvh; overflow-y: auto;
  background: var(--panel); border: 2.5px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 20px; animation: popIn .22s cubic-bezier(.2,.9,.3,1.2) both;
}
html[data-theme="dark"] .modal { border-width: 1px; }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97) } to { opacity: 1; transform: none } }
.modal h3 { font-size: 18px; margin-bottom: 6px; letter-spacing: -.02em; }
.modal .m-sub { color: var(--muted); font-size: 12.5px; line-height: 1.55; margin-bottom: 14px; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.modal .field:last-of-type { margin-bottom: 0; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab { padding: 6px 10px; font-size: 12px; font-weight: 700; border-radius: 8px; color: var(--muted); }
.tab.is-active { background: var(--bg-2); color: var(--ink); }
.qr-box { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 12px; border: 2px solid var(--line); margin: 10px 0; }
.qr-box canvas { width: 168px; height: 168px; image-rendering: pixelated; }
.pay-amount { font-size: 24px; font-weight: 900; letter-spacing: -.03em; }
.pay-steps { font-size: 12px; color: var(--muted); line-height: 1.6; padding-left: 18px; margin: 8px 0 0; }
.pay-steps li { margin: 2px 0; }

.toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 11px;
  background: var(--ink); color: var(--bg);
  font-size: 12.5px; font-weight: 600;
  border: 2px solid var(--line); box-shadow: var(--shadow-sm);
  animation: toastIn .25s cubic-bezier(.2,.9,.3,1.2) both;
  pointer-events: auto;
}
.toast.good { background: var(--good); color: #04140d; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.warn { background: var(--warn); color: #2a1a00; }
.toast svg { width: 15px; height: 15px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96) } to { opacity: 1; transform: none } }
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.97) } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .studio { grid-template-columns: 1fr; }
  .studio-form { position: static; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .chat-history-panel { z-index: 41; left: 0; right: auto; width: min(360px, 88vw); border-left: 0; border-right: 2px solid var(--line); box-shadow: 18px 0 50px rgba(0,0,0,.25); }
  .chat-panel-open .chat-history-panel { z-index: 41; }
  .chat-panel-open #view-chat .chat-scroll { padding-right: clamp(14px, 4vw, 48px); }
  .chat-panel-scrim { display: block; position: absolute; inset: 0; z-index: 22; background: rgba(4,7,15,.38); backdrop-filter: blur(2px); }
  .chat-panel-open .chat-panel-scrim { display: block; }
  .chat-panel-open .deep-banner, .chat-panel-open .composer-dock { position: relative; z-index: 20; }
  body.chat-panel-open .mascot-layer { z-index: 19; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 272px;
    transform: translateX(-104%);
    transition: transform var(--t-med);
    box-shadow: 20px 0 60px rgba(0,0,0,.35);
  }
  @media (max-width: 600px) {
    .image-preview-backdrop { padding: 0; }
    .modal.image-preview-modal { padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom)); }
    .image-preview-modal .image-preview-wrap { height: calc(100dvh - 145px); }
    .image-preview-modal .modal-actions { justify-content: center; }
  }
  body.sidebar-open .sidebar { transform: none; }
  .sidebar-close { display: grid; }
  .only-mobile { display: grid; }
  .two-col { grid-template-columns: 1fr; }
  .mode-switch .mode-btn { padding: 6px 9px; font-size: 11.5px; }
}
@media (min-width: 901px) {
  .app { transition: grid-template-columns var(--t-med); }
  body.sidebar-collapsed .app { grid-template-columns: 0 minmax(0, 1fr); }
  body.sidebar-collapsed .sidebar {
    width: 0; min-width: 0; padding-inline: 0; border-right-width: 0;
    overflow: hidden; visibility: hidden;
  }
}
@media (max-width: 640px) {
  .mode-switch .mode-label { display: none; }
  .mode-switch .mode-btn { padding: 7px 10px; }
}
@media (max-width: 640px) {
  .topbar { gap: 4px; padding: 8px 10px; min-height: 54px; }
  .mode-switch { order: 2; }
  .topbar .status-badge { display: none; }
  .usage-badge { display: none; }
  .chat-scroll { padding: 14px 12px 8px; }
  .composer-dock { padding: 6px 10px 10px; }
  .composer { border-radius: 15px; }
  .hero { padding: 16px; border-radius: 20px; }
  .hero-actions .btn { flex: 1; }
  .messages { gap: 18px; }
  .msg-avatar { width: 28px; height: 28px; font-size: 10px; }
  .msg.user .msg-text { font-size: 13.5px; }
  .msg.assistant .msg-text { font-size: 13.5px; }
  .view { padding: 16px 12px 24px; }
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 14px; border-radius: 16px; }
  .price-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .price-card { padding: 12px; }
  .price-card .amount { font-size: 22px; }
  .price-card ul { display: none; }
  .tool-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .plugin-grid { grid-template-columns: 1fr; }
  .acc-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .composer-meta { font-size: 9.5px; }
  .model-bar { gap: 6px; }
  .mascot { width: 74px; height: 90px; }
  .price-card.deep { grid-column: 1 / -1; }
  .inline-form { flex-direction: column; }
  .toast { font-size: 11.5px; }
}
@media (max-width: 400px) {
  .price-grid { grid-template-columns: 1fr; }
  .price-card ul { display: flex; }
}

/* ---------- Loader ---------- */
.spin {
  width: 14px; height: 14px; display: inline-block; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important;
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .composer-dock, .mascot-layer { display: none !important; }
  .app { display: block; }
  .view { position: static; display: block; overflow: visible; }
  body { overflow: visible; background: #fff; }
}