/* Compressor Room Builder — design tokens, components, layouts. */

:root {
  color-scheme: light;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f7;
  --border: #e3e8ef;
  --border-2: #d2dae5;
  --text: #0e1a2b;
  --text-2: #4a5a72;
  --text-3: #8290a6;
  --accent: #0a8fd6;
  --accent-2: #0877b3;
  --accent-soft: #e3f3fc;
  --accent-ink: #ffffff;
  --status-ink: #ffffff; /* text on --danger / --ok */
  --ok: #16a05a;
  --ok-soft: #e2f5ea;
  --warn: #d98a00;
  --warn-ink: #9a6200;
  --warn-soft: #fdf3dc;
  --ask: #6d5ae6;
  --ask-soft: #efecfe;
  --danger: #d9344a;
  --danger-soft: #fde8eb;
  --canvas: #eef2f7;
  --grid: #d0d9e5;
  --overlay: rgba(12, 22, 38, 0.38);
  --shadow-1: 0 1px 2px rgba(16, 30, 54, 0.06), 0 1px 1px rgba(16, 30, 54, 0.04);
  --shadow-2: 0 10px 28px rgba(16, 30, 54, 0.1), 0 2px 6px rgba(16, 30, 54, 0.06);
  --shadow-3: 0 28px 70px rgba(16, 30, 54, 0.2), 0 6px 18px rgba(16, 30, 54, 0.08);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --font: system-ui, -apple-system, 'Segoe UI Variable Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  --appbar: 60px;
  --tabbar: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0c1626;
    --surface: #121f36;
    --surface-2: #16253f;
    --surface-3: #1c2d4b;
    --border: #213350;
    --border-2: #2c4266;
    --text: #e9eff8;
    --text-2: #a8b7cd;
    --text-3: #71839f;
    --accent: #35b8ee;
    --accent-2: #62c8f3;
    --accent-soft: rgba(53, 184, 238, 0.14);
    --accent-ink: #06121f;
    --status-ink: #06121f;
    --ok: #3ccf7a;
    --ok-soft: rgba(60, 207, 122, 0.14);
    --warn: #f5a524;
    --warn-ink: #f7b64c;
    --warn-soft: rgba(245, 165, 36, 0.14);
    --ask: #a393ff;
    --ask-soft: rgba(163, 147, 255, 0.16);
    --danger: #ff6479;
    --danger-soft: rgba(255, 100, 121, 0.14);
    --canvas: #172539;
    --grid: #2a3b57;
    --overlay: rgba(3, 8, 16, 0.6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
    --shadow-3: 0 30px 80px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0c1626;
  --surface: #121f36;
  --surface-2: #16253f;
  --surface-3: #1c2d4b;
  --border: #213350;
  --border-2: #2c4266;
  --text: #e9eff8;
  --text-2: #a8b7cd;
  --text-3: #71839f;
  --accent: #35b8ee;
  --accent-2: #62c8f3;
  --accent-soft: rgba(53, 184, 238, 0.14);
  --accent-ink: #06121f;
  --status-ink: #06121f;
  --ok: #3ccf7a;
  --ok-soft: rgba(60, 207, 122, 0.14);
  --warn: #f5a524;
  --warn-ink: #f7b64c;
  --warn-soft: rgba(245, 165, 36, 0.14);
  --ask: #a393ff;
  --ask-soft: rgba(163, 147, 255, 0.16);
  --danger: #ff6479;
  --danger-soft: rgba(255, 100, 121, 0.14);
  --canvas: #172539;
  --grid: #2a3b57;
  --overlay: rgba(3, 8, 16, 0.6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-3: 0 30px 80px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.3);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}
/* shown until the first screen replaces it (the app modules are still loading) */
.boot-splash { height: 100%; display: grid; place-items: center; }
.boot-splash img { border-radius: 14px; animation: pulseDot 1.4s ease-in-out infinite; animation-delay: 0.3s; }
#app { height: 100dvh; overflow: auto; padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px); } /* landscape iPhone: clear the notch */
.view-host { min-height: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
kbd { font: 600 11px/1 var(--font); padding: 2px 5px; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--text-2); }
.muted { color: var(--text-3); }
.ic { width: 20px; height: 20px; flex: none; }
.ic-xs { width: 14px; height: 14px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---------- buttons ---------- */
.btn {
  --h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 16px; border-radius: 11px; border: 1px solid transparent;
  background: var(--surface-3); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s var(--ease), box-shadow 0.15s;
  user-select: none; -webkit-user-select: none; position: relative;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 4px 14px -4px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn.secondary { background: var(--surface); border-color: var(--border-2); box-shadow: var(--shadow-1); }
.btn.secondary:hover:not(:disabled) { border-color: var(--text-3); }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn.tonal { background: var(--accent-soft); color: var(--accent); }
.btn.tonal:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.btn.danger { background: var(--danger); color: var(--status-ink); }
.btn.danger-ghost { background: transparent; color: var(--danger); }
.btn.danger-ghost:hover { background: var(--danger-soft); }
.btn.icon { width: var(--h); padding: 0; }
.btn.sm { --h: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; gap: 6px; }
.btn.sm.icon { width: 32px; padding: 0; }
.btn.sm .ic { width: 16px; height: 16px; }
.btn.lg { --h: 50px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.btn.grow { flex: 1; min-width: 0; }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--text-3) var(--text-3) var(--text-3) transparent; animation: spin 0.7s linear infinite; }
.btn.primary.busy::after { border-color: var(--accent-ink) var(--accent-ink) var(--accent-ink) transparent; }
.btn.on-dark { color: #e9eff8; }
.btn.on-dark:hover { background: rgba(255, 255, 255, 0.08); }
@keyframes spin { to { transform: rotate(360deg); } }
.linkish { background: none; border: 0; padding: 6px 0 0; color: var(--text-3); font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--text-2); }

/* ---------- segmented ---------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 11px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; transition: background 0.15s, color 0.15s, box-shadow 0.15s; }
.seg button .ic { width: 16px; height: 16px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1), 0 0 0 1px var(--border); }
.seg.sm button { height: 28px; padding: 0 10px; font-size: 12.5px; }

/* ---------- pills, tags ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; flex: none; }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.ask { background: var(--ask-soft); color: var(--ask); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.draft { background: var(--surface-3); color: var(--text-2); }
.tag { display: inline-flex; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.tag.missing { background: var(--warn-soft); color: var(--warn-ink); }
.tag.ask { background: var(--ask-soft); color: var(--ask); }

/* ---------- ring ---------- */
.ring { display: block; flex: none; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg { transition: stroke-dashoffset 0.6s var(--ease); }
.ring.warn .ring-fg { stroke: var(--warn); }
.ring.accent .ring-fg { stroke: var(--accent); }
.ring.ok .ring-fg { stroke: var(--ok); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }

/* ---------- form fields ---------- */
.flds { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.fld { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 7px; min-width: 0; position: relative; }
.fld.half { grid-column: auto; }
.fld-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.fld-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.req-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); display: inline-block; }
.req-dot[hidden] { display: none; }
.fld-hint { font-size: 12px; color: var(--text-3); line-height: 1.35; }
.inp {
  width: 100%; height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); font-size: 15px; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; outline: none;
  -webkit-appearance: none; appearance: none;
}
textarea.inp { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; min-height: 44px; }
.inp::placeholder { color: var(--text-3); }
.inp:hover { border-color: var(--text-3); }
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp-wrap { position: relative; display: flex; align-items: center; }
.inp-wrap .inp { padding-right: 58px; font-variant-numeric: tabular-nums; }
.inp-wrap .unit { position: absolute; right: 12px; color: var(--text-3); font-size: 13px; font-weight: 600; pointer-events: none; }
.inp-wrap.pre .inp { padding-right: 12px; padding-left: 46px; }
.inp-wrap.pre .unit { left: 12px; right: auto; }
.fld.is-unk .inp { border-style: dashed; border-color: color-mix(in srgb, var(--ask) 50%, transparent); background: var(--ask-soft); }
.fld.is-missing .inp:not(:focus) { border-color: color-mix(in srgb, var(--warn) 45%, var(--border-2)); }
.fld.flash { animation: flash 1.4s var(--ease); border-radius: 12px; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 6px var(--accent-soft); background: var(--accent-soft); } 100% { box-shadow: 0 0 0 6px transparent; background: transparent; } }
.unk { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 999px; border: 1px dashed var(--border-2); background: transparent; color: var(--text-3); font-size: 11.5px; font-weight: 600; transition: all 0.15s; }
.unk:hover { color: var(--ask); border-color: var(--ask); }
.unk.on { background: var(--ask-soft); color: var(--ask); border: 1px solid transparent; }
.unk[hidden] { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.sub { margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--border); }
.chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 38px; padding: 0 13px; border-radius: 10px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 550;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s var(--ease);
}
.chip:hover { border-color: var(--text-3); }
.chip:active { transform: scale(0.96); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.sm { min-height: 28px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.sugg { display: flex; flex-wrap: wrap; gap: 5px; }
.fld.is-unk .chip:not(.on) { border-style: dashed; }

.fld-toggle { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.fld-tl { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fld-toggle .fld-label { color: var(--text); font-size: 14px; font-weight: 550; }
.switch { flex: none; width: 46px; height: 28px; border-radius: 999px; border: 0; padding: 3px; background: var(--border-2); transition: background 0.2s; display: inline-flex; }
.switch span { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.25s var(--spring); }
.switch.on { background: var(--accent); }
.switch.on span { transform: translateX(18px); }

/* ---------- photos ---------- */
.photos { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: -2px; scrollbar-width: none; }
.photos::-webkit-scrollbar { display: none; }
/* laptop: the panel is narrow, so the slots wrap instead of hiding "More" off to the side */
@media (min-width: 900px) { .photos { flex-wrap: wrap; overflow: visible; } }
.pslot, .pthumb {
  flex: none; width: 108px; height: 92px; border-radius: 12px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
}
.pslot { border: 1.5px dashed var(--border-2); background: var(--surface-2); color: var(--text-2); padding: 8px; transition: border-color 0.15s, background 0.15s; }
.pslot:hover { border-color: var(--accent); color: var(--accent); }
.pslot .ic { width: 22px; height: 22px; }
.pslot .pl { font-size: 11.5px; font-weight: 600; line-height: 1.2; }
.pslot .pr { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--warn-ink); }
.pslot.need { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: var(--warn-soft); }
.pslot.unk { border-color: color-mix(in srgb, var(--ask) 50%, transparent); background: var(--ask-soft); }
.pslot.unk .pr { color: var(--ask); }
.pslot.add { width: 64px; }
.pthumb { border: 0; padding: 0; background: var(--surface-3); }
.pthumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.3s; }
.pthumb.loaded img { opacity: 1; }
.pcap { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 5px; font-size: 10.5px; font-weight: 650; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.6)); text-align: left; }

/* ---------- overlays ---------- */
#layer { position: relative; z-index: 100; }
.overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.backdrop { position: absolute; inset: 0; background: var(--overlay); opacity: 0; transition: opacity 0.22s; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.overlay.open .backdrop { opacity: 1; }
.sheet {
  position: relative; width: min(520px, calc(100vw - 32px)); max-height: min(84dvh, 760px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-3); border: 1px solid var(--border);
  transform: translateY(12px) scale(0.98); opacity: 0; transition: transform 0.26s var(--ease), opacity 0.2s; outline: none;
}
.overlay.open .sheet { transform: none; opacity: 1; }
.sheet-grip { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 8px 22px; }
.sheet-head h2 { font-size: 17px; }
.sheet-body { padding: 8px 22px 22px; overflow: auto; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--border); }
.is-confirm .sheet { width: min(420px, calc(100vw - 32px)); }
.confirm-msg { color: var(--text-2); }
.is-palette .sheet { width: min(640px, calc(100vw - 32px)); }
.is-lightbox .sheet { width: min(900px, calc(100vw - 32px)); max-height: 92dvh; }
.is-lightbox .sheet-body { padding: 14px; }
.lb { margin: 0; }
.lb img { display: block; max-width: 100%; max-height: 70dvh; margin: 0 auto; border-radius: 12px; }
.lb figcaption { text-align: center; color: var(--text-2); font-size: 13px; padding-top: 10px; }

.popover { position: fixed; z-index: 110; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-3); padding: 6px; opacity: 0; transform: translateY(-4px); transition: opacity 0.15s, transform 0.15s var(--ease); }
.popover.open { opacity: 1; transform: none; }
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu-head { padding: 8px 12px 2px; font-size: 11px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; font-weight: 550; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item .ic { color: var(--text-2); }
.menu-item span { display: flex; flex-direction: column; min-width: 0; }
.menu-item small { font-size: 12px; color: var(--text-3); font-weight: 400; }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 8px; }
.menu-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; flex: none; }
.empty-note { color: var(--text-3); padding: 12px 0; text-align: center; }

.toasts { position: fixed; left: 50%; bottom: calc(88px + var(--safe-b)); transform: translateX(-50%); z-index: 140; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 16px; min-height: 44px; border-radius: 14px; background: #122037; color: #eef3fa; box-shadow: var(--shadow-3); font-size: 13.5px; font-weight: 550; opacity: 0; transform: translateY(10px) scale(0.98); transition: opacity 0.2s, transform 0.25s var(--ease); }
:root[data-theme='dark'] .toast { background: #26395a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .toast { background: #26395a; } }
.toast.in { opacity: 1; transform: none; }
.toast.error { background: #7a1d2b; }
.toast-a { border: 0; background: rgba(255, 255, 255, 0.12); color: #7fd3f7; font-weight: 700; height: 30px; padding: 0 12px; border-radius: 9px; }
.toast-a:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------- home ---------- */
.home { min-height: 100%; display: flex; flex-direction: column; }
.home-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand .logo { flex: none; border-radius: 10px; box-shadow: var(--shadow-1); }
.brand b { display: block; font-size: 15px; letter-spacing: -0.01em; }
.brand span { display: block; font-size: 12px; color: var(--text-3); }
.home-actions { display: flex; align-items: center; gap: 6px; }
.home-main { width: min(1180px, 100%); margin: 0 auto; padding: 12px 28px 48px; }
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 14px 0 18px; flex-wrap: wrap; }
.home-head h1 { font-size: 26px; letter-spacing: -0.02em; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--border-2); background: var(--surface); width: min(320px, 100%); color: var(--text-3); }
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: 14px; color: var(--text); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.vcard { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s; }
.vcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--border-2); }
.vcard-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.vcard-thumb { height: 150px; background: #172539; background-image: radial-gradient(#2a3b57 1px, transparent 1px); background-size: 16px 16px; display: flex; }
.thumb-svg { width: 100%; height: 100%; display: block; }
.vcard-body { padding: 14px 14px 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.vcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.vcard-top h3 { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-top: 3px; }
.vcard-top .btn { position: relative; z-index: 2; margin: -2px -6px 0 0; }
.vcard-site { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcard-meta { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.vcard-meta b { color: var(--text); font-variant-numeric: tabular-nums; }
.vcard-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcard-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12px; }

.hero { flex: 1; width: min(760px, 100%); margin: 0 auto; padding: 24px 24px 64px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; }
.hero-art { width: 100%; height: 260px; border-radius: 24px; overflow: hidden; background: #172539; background-image: radial-gradient(#2a3b57 1px, transparent 1px); background-size: 20px 20px; box-shadow: var(--shadow-3); display: flex; margin-bottom: 18px; border: 1px solid rgba(255, 255, 255, 0.06); }
.hero h1 { font-size: clamp(26px, 4.5vw, 40px); line-height: 1.1; letter-spacing: -0.03em; max-width: 620px; }
.hero > p { color: var(--text-2); font-size: 16px; max-width: 540px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.hero-points { list-style: none; padding: 0; margin: 18px 0 0; display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; color: var(--text-2); font-size: 13px; }
.hero-points li { display: flex; align-items: center; gap: 7px; }
.hero-points .ic { width: 17px; height: 17px; color: var(--accent); }

.settings { display: flex; flex-direction: column; gap: 18px; }
.settings-info { display: flex; gap: 12px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 13px; }
.settings-info .ic { color: var(--accent); margin-top: 1px; }
.settings-info b { color: var(--text); }

/* ---------- start ---------- */
.start { min-height: 100%; display: flex; flex-direction: column; }
.start-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 12px 20px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.start-bar h1 { font-size: 18px; }
.start-grid { width: min(1280px, 100%); margin: 0 auto; padding: 8px 28px 120px; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr); gap: 24px; align-items: start; }
.start-form { display: flex; flex-direction: column; gap: 16px; }
.st-card { padding: 20px 20px 22px; }
.st-card h2 { font-size: 16px; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.st-p { color: var(--text-2); font-size: 13px; margin: -8px 0 12px; }
.step { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 12.5px; font-weight: 700; }
.qs { display: flex; flex-direction: column; }
.qs-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); }
.qs-row:first-child { border-top: 0; }
.qs-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex: none; transition: opacity 0.2s; }
.qs-ic .ic { width: 22px; height: 22px; }
.qs-row.zero .qs-ic { opacity: 0.45; }
.qs-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qs-t b { font-size: 14.5px; font-weight: 600; }
.qs-t small { color: var(--text-3); font-size: 12.5px; }
.stepper { display: flex; align-items: center; background: var(--surface-3); border-radius: 12px; padding: 3px; flex: none; }
.stepper button { width: 40px; height: 38px; border: 0; border-radius: 9px; background: var(--surface); box-shadow: var(--shadow-1); display: grid; place-items: center; color: var(--text); transition: transform 0.12s var(--ease), opacity 0.15s; }
.stepper button:active:not(:disabled) { transform: scale(0.9); }
.stepper button:disabled { opacity: 0.35; box-shadow: none; background: transparent; cursor: default; }
.stepper button .ic { width: 18px; height: 18px; }
.stepper output { width: 40px; text-align: center; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.qs-sub { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 2px 0 12px 56px; font-size: 13px; color: var(--text-2); }
.start-preview { position: sticky; top: 76px; }
.preview-card { border-radius: 24px; overflow: hidden; background: #172539; border: 1px solid rgba(255, 255, 255, 0.06); box-shadow: var(--shadow-3); color: #dbe5f2; }
.preview-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; font-size: 12.5px; font-weight: 650; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.preview-h > span:first-child { display: flex; align-items: center; gap: 7px; color: #7fd3f7; text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.preview-h .ic { width: 15px; height: 15px; }
.preview-c { color: #8fa3c0; font-weight: 500; }
.preview-svg { height: 300px; display: flex; transition: height 0.25s var(--ease); background-image: radial-gradient(#2a3b57 1px, transparent 1px); background-size: 18px 18px; }
.preview-svg .thumb-svg { animation: fadeIn 0.3s var(--ease); }
.preview-p { padding: 12px 18px 16px; color: #8fa3c0; font-size: 12.5px; }
.start-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: flex-end; padding: 14px 28px calc(14px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 40%); pointer-events: none; }
.start-foot .btn { pointer-events: auto; min-width: 220px; }
@keyframes fadeIn { from { opacity: 0.4; } to { opacity: 1; } }

/* ---------- survey shell ---------- */
.shell { height: 100dvh; display: grid; grid-template-rows: var(--appbar) minmax(0, 1fr) auto; }
.appbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 0 14px 0 10px; background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 20; }
.ab-title { min-width: 0; }
.ab-t1 { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.ab-t2 { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.ab-site { overflow: hidden; text-overflow: ellipsis; }
.save { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font: inherit; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 6px; }
.save:hover .sv-l { text-decoration: underline; text-underline-offset: 2px; }
.save .sv-s { display: none; }
.save.is-error { color: var(--danger); font-weight: 650; }
.save.is-error .ic { color: var(--danger); }
.save.is-offline .ic { color: var(--warn); }
.save .ic { color: var(--ok); }
.save-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulseDot 1s infinite; }
@keyframes pulseDot { 50% { opacity: 0.3; } }
.tabs { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-3); }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: 13.5px; transition: background 0.15s, color 0.15s; }
.tab .ic { width: 17px; height: 17px; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1), 0 0 0 1px var(--border); }
.tab-badge, .tb .tab-badge { position: absolute; top: 3px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--warn); color: #1c1300; font: 700 10px/16px var(--font); font-style: normal; text-align: center; }
.tab .tab-badge { position: static; margin-left: 2px; }
.ab-actions { display: flex; align-items: center; gap: 2px; }
.ready { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 8px; margin-left: 6px; border-radius: 12px; border: 1px solid var(--border); transition: background 0.15s; }
.ready:hover { background: var(--surface-2); }
.ready-t { display: flex; flex-direction: column; line-height: 1.1; }
.ready-t b { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ready-t span { font-size: 10.5px; color: var(--text-3); }
.shell-main { min-height: 0; position: relative; overflow: hidden; }
.tabbar { display: none; }

/* ---------- builder ---------- */
.builder { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 392px; }
.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--canvas); }
.canvas-wrap, .listview { position: absolute; inset: 0; }
.canvas { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; font-family: var(--font); }
.canvas:active { cursor: grabbing; }
.grid-dot { fill: var(--grid); }
.world .n, .world .il { transition: transform 0.36s var(--ease); cursor: pointer; }
.world .n .card { transition: stroke 0.15s; }
@media (hover: hover) { .world .n:hover .card { stroke: var(--accent); } .world .ph:hover { stroke: color-mix(in srgb, var(--accent) 22%, transparent); } }
.world .n.enter, .world .il.enter { animation: pop 0.42s var(--spring) both; animation-delay: calc(var(--i, 0) * 28ms); }
@keyframes pop { from { opacity: 0; } to { opacity: 1; } }
.world .pp.fade { animation: fadeIn 0.35s var(--ease); }
.world .ph { cursor: pointer; }
.world .n.on .card { filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.25)); }
.world .sel-ring { animation: ring 0.3s var(--ease); }
@keyframes ring { from { opacity: 0; } }
.world .handle { cursor: crosshair; }
.world .handle-dot { transition: r 0.15s; }
.world .handle:hover .handle-dot { r: 14; }
.world .n.dragging, .world .il.dragging { opacity: 0.3; }
.vp .ghost { opacity: 0.92; filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.35)); pointer-events: none; }
.builder.is-dragging .canvas, .builder.is-connecting .canvas { cursor: grabbing; }
.world .pp.drop-ok, .world .pp.place-ok { stroke: var(--accent); stroke-dasharray: 5 6; stroke-width: 2.5; animation: march 0.8s linear infinite; }
.world .pp.drop-hot, .world .pp.place-suggest { stroke: var(--accent); stroke-width: 6; stroke-dasharray: none; stroke-opacity: 0.9; animation: none; }
.world .pp.place-suggest { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { stroke-width: 9; stroke-opacity: 0.55; } }
@keyframes march { to { stroke-dashoffset: -22; } }
.world .n.drop-ok .card, .world .n.connect-ok .card { stroke: var(--accent); stroke-dasharray: 5 4; }
.world .n.drop-hot .card { stroke: var(--accent); stroke-width: 3; stroke-dasharray: none; }
.vp .rubber { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-dasharray: 6 5; animation: march 0.8s linear infinite; pointer-events: none; }
.builder.is-placing .world .n, .builder.is-placing .world .il { opacity: 0.55; }
.builder.is-connecting .world .n:not(.connect-ok):not(.on) { opacity: 0.4; }
.builder.is-dragging .world .pp:not(.drop-ok):not(.drop-hot) { opacity: 0.45; }

.drag-hint { position: absolute; left: 0; top: 0; z-index: 4; padding: 7px 12px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 12.5px; font-weight: 650; box-shadow: var(--shadow-2); pointer-events: none; white-space: nowrap; }
.banner { position: absolute; top: 66px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-3); width: max-content; max-width: calc(100% - 24px); animation: drop 0.3s var(--ease); }
.banner-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.banner-t { display: flex; flex-direction: column; font-weight: 600; font-size: 13.5px; min-width: 0; }
.banner-t small { font-weight: 450; color: var(--text-3); font-size: 12px; }
.banner.pulse { animation: shake 0.4s var(--ease); }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }
@keyframes shake { 25% { transform: translate(calc(-50% - 6px), 0); } 75% { transform: translate(calc(-50% + 6px), 0); } }

.empty-canvas { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; color: var(--text-2); pointer-events: none; }
.empty-canvas > * { pointer-events: auto; }
.empty-ic { width: 64px; height: 64px; border-radius: 18px; background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow-2); color: var(--accent); }
.empty-ic .ic { width: 30px; height: 30px; }

.stage-top { position: absolute; top: 14px; left: 14px; z-index: 5; display: flex; gap: 8px; align-items: center; }
.stage-top .seg { background: var(--surface); box-shadow: var(--shadow-2); border: 1px solid var(--border); }
.stage-top .seg button.on { background: var(--surface-3); box-shadow: none; }
.sugg-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--warn-ink); font-weight: 700; box-shadow: var(--shadow-2); }
.sugg-btn .ic { color: var(--warn); }
.builder.is-placing .stage-top { opacity: 0.45; }
.cv-tools { position: absolute; right: 14px; bottom: 16px; z-index: 5; display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-2); }
.legend { position: absolute; left: 16px; bottom: 18px; z-index: 4; display: flex; gap: 14px; font-size: 11.5px; color: var(--text-2); padding: 7px 12px; border-radius: 10px; background: color-mix(in srgb, var(--surface) 80%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.lg-dot.warn { background: var(--warn); }
.lg-dot.ask { background: var(--ask); }
.lg-dot.ok { background: var(--ok); }
.lg-hex { width: 12px; height: 13px; display: inline-block; background: none; border: 1.5px dashed var(--accent); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.dock { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5; display: flex; gap: 8px; padding: 6px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-3); }
.builder.is-placing .dock, .builder.is-dragging .dock { opacity: 0; pointer-events: none; transform: translate(-50%, 10px); }
.dock, .stage-top, .cv-tools { transition: opacity 0.2s, transform 0.2s var(--ease); }

.coach { position: absolute; bottom: 64px; left: 14px; z-index: 6; animation: drop2 0.4s var(--ease) 0.4s both; }
.coach-card { width: 300px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-3); font-size: 13px; }
.coach-card b { font-size: 14px; }
.coach-card ul { list-style: none; padding: 0; margin: 10px 0 14px; display: flex; flex-direction: column; gap: 9px; color: var(--text-2); }
.coach-card li { display: flex; gap: 10px; align-items: flex-start; }
.coach-card li .ic { width: 18px; height: 18px; color: var(--accent); margin-top: 1px; }
@keyframes drop2 { from { opacity: 0; transform: translateY(-6px); } }

.listview { overflow: auto; padding: 72px 16px 110px; }
.list { display: flex; flex-direction: column; gap: 18px; width: min(720px, 100%); margin: 0 auto; }
.list.flat { gap: 6px; }
.lgrp { display: flex; flex-direction: column; gap: 6px; }
.lg-h { display: flex; align-items: center; gap: 8px; padding: 0 4px 2px; }
.lg-h h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 700; }
.lg-c { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.lg-add { margin-left: auto; }
.lg-empty { padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--border-2); color: var(--text-3); font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 10px 8px 8px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); text-align: left; box-shadow: var(--shadow-1); transition: border-color 0.15s, background 0.15s, transform 0.12s var(--ease); }
.row:hover { border-color: var(--border-2); }
.row:active { transform: scale(0.99); }
.row.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row-ic { width: 42px; height: 42px; border-radius: 11px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex: none; }
.row-ic.hex { clip-path: polygon(50% 0, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%); border-radius: 0; }
.row-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-chev { color: var(--text-3); width: 18px; height: 18px; }

/* panel */
.panel { background: var(--surface); border-left: 1px solid var(--border); min-height: 0; display: flex; flex-direction: column; position: relative; z-index: 10; }
.panel-inner { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.p-head { display: flex; align-items: center; gap: 12px; padding: 14px 10px 12px 16px; border-bottom: 1px solid var(--border); flex: none; }
.p-grip { display: none; }
.p-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; flex: none; }
.p-ic .ic { width: 24px; height: 24px; }
.p-ic.hex { clip-path: polygon(50% 0, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%); border-radius: 0; }
.p-titles { flex: 1; min-width: 0; }
.p-name { width: 100%; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 2px 6px; margin-left: -7px; outline: none; color: var(--text); text-overflow: ellipsis; }
.p-name:not(.ro):hover { border-color: var(--border-2); }
.p-name:not(.ro):focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.p-name.ro { padding-left: 0; margin-left: 0; overflow: hidden; white-space: nowrap; }
.p-sub { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-scroll { flex: 1; min-height: 0; overflow: hidden auto; padding: 4px 16px 24px; overscroll-behavior: contain; }
.p-progress { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 12px 0 10px; margin-bottom: 2px; }
.prog { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.prog b { color: var(--text); }
.prog-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.prog-bar i { display: block; height: 100%; border-radius: inherit; background: var(--warn); transition: width 0.5s var(--ease), background 0.3s; }
.prog.open .prog-bar i { background: var(--ask); }
.prog.done .prog-bar i { background: var(--ok); }
.prog.done span { color: var(--ok); font-weight: 600; }
.prog.none { color: var(--text-3); }
.prog.none .prog-bar { display: none; }
.p-sec { padding: 16px 0 4px; display: flex; flex-direction: column; gap: 12px; }
.p-sec + .p-sec { border-top: 1px solid var(--border); margin-top: 12px; }
.p-sec h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 700; }
.p-more { border-top: 1px solid var(--border); margin-top: 16px; }
.p-more > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 14px 0; cursor: pointer; font-weight: 600; font-size: 14px; }
.p-more > summary::-webkit-details-marker { display: none; }
.p-more-chev { width: 16px; height: 16px; color: var(--text-3); transition: transform 0.2s var(--ease); }
.p-more[open] .p-more-chev { transform: rotate(90deg); }
.p-more-c { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--text-3); }
.p-more > .flds { padding-bottom: 8px; }
.conn { display: flex; gap: 10px; align-items: flex-start; }
.conn-l { width: 40px; flex: none; font-size: 12px; color: var(--text-3); font-weight: 600; padding-top: 6px; }
.conn-v { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.cchip { display: inline-flex; align-items: center; border-radius: 9px; background: var(--surface-3); overflow: hidden; max-width: 100%; }
.cchip-t { border: 0; background: none; padding: 5px 4px 5px 10px; font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cchip-t:hover { color: var(--accent); }
.cchip-x { border: 0; background: none; width: 26px; height: 28px; display: grid; place-items: center; color: var(--text-3); }
.cchip-x:hover { color: var(--danger); }
.cchip-x .ic { width: 14px; height: 14px; }
.conn-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.p-foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(10px + var(--safe-b)); border-top: 1px solid var(--border); background: var(--surface); }
.p-pos { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 34px; text-align: center; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; transition: border-color 0.15s, background 0.15s, transform 0.12s var(--ease); }
.tile:hover { border-color: var(--accent); background: var(--accent-soft); }
.tile:active { transform: scale(0.96); }
.tile-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--surface); display: grid; place-items: center; color: var(--text-2); }
.tile.hex .tile-ic { clip-path: polygon(50% 0, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%); border-radius: 0; }

.ov-ready { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); transition: border-color 0.15s; }
.ov-ready:hover { border-color: var(--border-2); }
.ov-t { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--text-2); }
.ov-t b { font-size: 15px; color: var(--text); }
.tips ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--text-2); }
.tips li { display: flex; gap: 10px; }
.tips li .ic { width: 17px; height: 17px; color: var(--text-3); margin-top: 1px; }
.sgs { display: flex; flex-direction: column; gap: 8px; }
.sg { display: flex; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.sg-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.sg.warn .sg-ic { background: var(--warn-soft); color: var(--warn); }
.sg-ic .ic { width: 19px; height: 19px; }
.sg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sg-t { font-weight: 650; font-size: 13.5px; }
.sg-x { font-size: 12.5px; color: var(--text-2); }
.sg-a { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }

/* palette */
.pal-h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 700; margin: 6px 0 10px; }
.pal-h4 + .pal-grid { margin-bottom: 18px; }
.pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pal-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); text-align: left; transition: border-color 0.15s, background 0.15s, transform 0.12s var(--ease); }
.pal-tile:hover { border-color: var(--accent); background: var(--accent-soft); }
.pal-tile:active { transform: scale(0.97); }
.pal-ic { width: 40px; height: 40px; border-radius: 11px; background: var(--surface); display: grid; place-items: center; color: var(--text-2); margin-bottom: 4px; box-shadow: var(--shadow-1); }
.pal-ic.hex { clip-path: polygon(50% 0, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%); border-radius: 0; box-shadow: none; }
.pal-t { font-weight: 650; font-size: 13.5px; }
.pal-h { font-size: 11.5px; color: var(--text-3); line-height: 1.3; }

/* ---------- pages (site, review) ---------- */
.page { height: 100%; overflow: auto; overscroll-behavior: contain; }
.page-inner { width: min(860px, 100%); margin: 0 auto; padding: 28px 24px 80px; display: flex; flex-direction: column; gap: 16px; }
.page-inner.wide { width: min(1180px, 100%); }
.page-head h1 { font-size: 26px; letter-spacing: -0.02em; }
.page-head p { color: var(--text-2); margin-top: 6px; max-width: 620px; }
.sec-nav { position: sticky; top: -28px; z-index: 3; display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; margin: 0 -4px; scrollbar-width: none; background: linear-gradient(var(--bg) 70%, transparent); }
.sec-nav::-webkit-scrollbar { display: none; }
.sec-chip { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); }
.sec-chip .ic { width: 16px; height: 16px; }
.sec-chip b { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--warn-ink); }
.sec-chip.done b { color: var(--ok); }
.sec-chip.open b { color: var(--ask); }
.sec-chip.none b { color: var(--text-3); }
.sec-chip.here { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.sec-nav.more-r { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.sec-nav.more-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%); mask-image: linear-gradient(90deg, transparent, #000 15%); }
.sec-nav.more-l.more-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.sec { padding: 18px 20px 22px; scroll-margin-top: 60px; }
.sec-h { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sec-h h2 { font-size: 16px; flex: 1; }
.sec-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.sec-ic .ic { width: 19px; height: 19px; }
.sec-c { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--warn-ink); padding: 3px 9px; border-radius: 999px; background: var(--warn-soft); }
.sec-c.done { color: var(--ok); background: var(--ok-soft); }
.sec-c.open { color: var(--ask); background: var(--ask-soft); }
.sec-c.none { display: none; }
.sec-p { color: var(--text-2); font-size: 13px; margin: -8px 0 14px; }

.rv-hero { display: flex; align-items: center; gap: 32px; padding: 28px 32px; }
.rv-ring { position: relative; flex: none; }
.rv-pct { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rv-pct b { font-size: 28px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rv-pct span { font-size: 11px; color: var(--text-3); margin-top: -2px; }
.rv-hero-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.rv-hero-t h1 { font-size: 26px; letter-spacing: -0.02em; }
.rv-hero-t p { color: var(--text-2); max-width: 620px; }
.rv-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.rv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rv-span { grid-column: 1 / -1; }
.rv-sec { padding: 18px 18px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rv-sh { display: flex; align-items: center; gap: 10px; }
.rv-sh h2 { font-size: 15.5px; flex: 1; }
.rv-list { display: flex; flex-direction: column; gap: 6px; }
.rv-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); text-align: left; transition: border-color 0.15s; }
.rv-row:hover { border-color: var(--accent); }
.rv-row .row-ic { width: 38px; height: 38px; }
.rv-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rv-empty { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 600; font-size: 13.5px; }
.rv-note { font-size: 12.5px; color: var(--text-3); }
.sgs.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.rv-thumb { display: flex; height: 240px; border: 0; padding: 0; border-radius: 14px; overflow: hidden; background: #172539; background-image: radial-gradient(#2a3b57 1px, transparent 1px); background-size: 16px 16px; cursor: zoom-in; }
.pkg { display: flex; flex-direction: column; }
.pkg-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.pkg-row:first-child { border-top: 0; padding-top: 0; }
.pkg-ic { width: 40px; height: 40px; border-radius: 11px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex: none; }
.pkg-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--text-3); }
.pkg-t b { color: var(--text); font-size: 14px; }
.pkg-t .seg { align-self: flex-start; margin-top: 6px; }
.pkg-all { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); }
.pkg-all .btn { flex: 1; }

.submit { display: flex; flex-direction: column; gap: 14px; }
.submit-sum { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.submit-sum div { display: flex; flex-direction: column; font-size: 12.5px; color: var(--text-2); }
.submit-sum b { font-size: 15px; color: var(--text); }
.submit-warn { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn-ink); font-size: 13px; }
.submit-warn .ic { flex: none; }
.submit-p { font-size: 13.5px; color: var(--text-2); }
.submit-actions { display: flex; flex-direction: column; gap: 8px; }
.submit-actions .btn { height: auto; min-height: 58px; padding: 10px 18px; justify-content: flex-start; flex-wrap: wrap; row-gap: 0; }
.submit-actions .btn small { width: 100%; padding-left: 26px; font-size: 12px; font-weight: 450; opacity: 0.8; text-align: left; }

.present { position: fixed; inset: 0; z-index: 130; background: #172539; color: #e9eff8; display: flex; flex-direction: column; opacity: 0; transition: opacity 0.25s; }
.present.open { opacity: 1; }
.present-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 24px; }
.present-h div { display: flex; flex-direction: column; }
.present-h b { font-size: 17px; }
.present-h span { font-size: 13px; color: #9fb0c8; }
.present-svg { flex: 1; width: 100%; touch-action: none; cursor: grab; }
.present-f { display: flex; justify-content: space-between; gap: 12px; padding: 10px 24px calc(14px + var(--safe-b)); font-size: 12px; color: #9fb0c8; }
.present-f span { display: inline-flex; align-items: center; gap: 8px; }
.present .lg-hex { border-color: #35b8ee; }

/* ---------- phone ---------- */
@media (max-width: 899px) {
  :root { --appbar: 56px; --tabbar: calc(62px + var(--safe-b)); }
  body { font-size: 15px; }
  .shell { grid-template-rows: var(--appbar) minmax(0, 1fr) var(--tabbar); }
  .appbar { grid-template-columns: auto minmax(0, 1fr) auto; padding: 0 8px 0 4px; gap: 4px; }
  .tabs { display: none; }
  .ready { padding: 0 8px 0 6px; margin-left: 2px; }
  .ready-t span { display: none; }
  .ab-actions [data-act='redo'] { display: none; }
  .save { order: -1; flex: none; min-height: 24px; }
  .save .sv-l { display: none; }
  .save .sv-s { display: inline; }
  .tabbar { display: flex; background: var(--surface); border-top: 1px solid var(--border); padding: 4px 8px var(--safe-b); z-index: 20; }
  .tb { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 56px; color: var(--text-3); font-size: 11.5px; font-weight: 650; border-radius: 12px; }
  .tb .ic { width: 24px; height: 24px; }
  .tb.on { color: var(--accent); }
  .tb .tab-badge { top: 4px; right: calc(50% - 24px); }

  .builder { grid-template-columns: 1fr; }
  .legend, .cv-tools [data-act='zoom-in'], .cv-tools [data-act='zoom-out'] { display: none; }
  .cv-tools { top: 12px; right: 12px; bottom: auto; border-radius: 12px; }
  .stage-top { top: 12px; left: 12px; }
  .stage-top .seg button span { display: none; }
  .stage-top .seg button { width: 44px; justify-content: center; padding: 0; height: 36px; }
  .dock { left: auto; right: 14px; bottom: 16px; transform: none; padding: 0; border: 0; background: none; box-shadow: none; }
  .dock-sensor { display: none; }
  .dock-add { --h: 56px; width: 56px; padding: 0; border-radius: 18px; box-shadow: var(--shadow-3), 0 8px 20px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
  .dock-add span { display: none; }
  .dock-add .ic { width: 26px; height: 26px; }
  .builder.is-placing .dock, .builder.is-dragging .dock { transform: translateY(10px); }
  .builder.has-sel .dock { opacity: 0; pointer-events: none; }
  .coach { left: 12px; right: 12px; top: 60px; bottom: auto; }
  .coach-card { width: auto; }
  .banner { top: 58px; width: calc(100% - 20px); flex-wrap: wrap; }
  .banner-t { flex: 1 1 60%; }

  .panel {
    position: fixed; left: 0; right: 0; bottom: 0; height: min(66dvh, 640px); border-left: 0; border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.25); transform: translateY(105%); transition: transform 0.34s var(--ease), height 0.3s var(--ease); z-index: 40;
  }
  .builder.has-sel .panel { transform: translateY(0); }
  .panel.expanded { height: calc(100dvh - 44px); }
  .p-head { position: relative; padding-top: 22px; }
  .p-grip { display: block; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 80px; height: 22px; border: 0; background: none; touch-action: none; }
  .p-grip i { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--border-2); margin: 8px auto 0; }
  .p-scroll { padding: 0 16px 24px; }
  .inp { font-size: 16px; }
  .chip { min-height: 42px; }
  .flds { gap: 16px 10px; }

  .overlay { align-items: flex-end; }
  .sheet { width: 100%; max-height: 90dvh; border-radius: 22px 22px 0 0; border-bottom: 0; transform: translateY(100%); opacity: 1; padding-bottom: var(--safe-b); transition: transform 0.32s var(--ease); }
  .sheet-grip { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--border-2); margin: 8px auto 0; touch-action: none; padding: 8px 40px; background-clip: content-box; box-sizing: content-box; }
  .sheet-head { padding: 4px 12px 4px 20px; }
  .sheet-body { padding: 8px 18px 20px; }
  .is-confirm .sheet, .is-palette .sheet, .is-lightbox .sheet { width: 100%; }
  .pal-grid { grid-template-columns: 1fr 1fr; }

  .home-bar { padding: 12px 16px; }
  .brand span { display: none; }
  .home-actions .btn.primary span { display: none; }
  .home-actions .btn.primary { width: 40px; padding: 0; }
  .home-main { padding: 4px 16px 40px; }
  .vgrid { grid-template-columns: 1fr; gap: 12px; }
  .hero { padding: 8px 18px 48px; }
  .hero-art { height: 200px; border-radius: 20px; }

  .start-bar { padding: 8px 10px; }
  .start-grid { grid-template-columns: 1fr; padding: 0 14px 120px; gap: 14px; }
  .start-preview { position: static; order: -1; }
  .preview-svg { height: 190px; }
  .preview-p { display: none; }
  .st-card { padding: 16px; }
  .qs-sub { padding-left: 0; }
  .start-foot { padding: 12px 14px calc(12px + var(--safe-b)); }
  .start-foot .btn { width: 100%; }

  .page-inner { padding: 20px 14px 40px; }
  .sec-nav { top: -20px; }
  .sec { padding: 16px; }
  .flds .fld.half { grid-column: 1 / -1; }
  .rv-hero { flex-direction: column; text-align: center; padding: 24px 18px; gap: 16px; }
  .rv-hero-t p { margin: 0 auto; }
  .rv-actions { justify-content: center; }
  .rv-actions .btn { flex: 1; }
  .rv-grid { grid-template-columns: 1fr; }
  .sgs.cols { grid-template-columns: 1fr; }
  .toasts { bottom: calc(var(--tabbar) + 14px); }
}

@media (min-width: 900px) and (max-width: 1180px) {
  .builder { grid-template-columns: minmax(0, 1fr) 360px; }
  .legend { display: none; }
  .ready-t span { display: none; }
  .tab span { display: none; }
  .tab { padding: 0 12px; }
}

/* touch: small controls keep their look but get a finger-sized hit area (≥ 40 px) */
@media (pointer: coarse) {
  .unk, .cchip-x, .toast-a, .chip.sm, .btn.sm.icon, .btn.icon.sm, .lg-add, .src-note { position: relative; }
  .unk::after, .cchip-x::after, .btn.sm.icon::after, .btn.icon.sm::after { content: ''; position: absolute; inset: -8px; }
  .unk { height: 28px; padding: 0 10px; font-size: 12px; }
  .cchip { overflow: visible; }
  .cchip-x { width: 34px; height: 34px; }
  .cchip-t { padding-top: 8px; padding-bottom: 8px; }
  .toast-a { height: 40px; padding: 0 14px; }
  .chip.sm { min-height: 36px; }
  .chip.sm::after { content: ''; position: absolute; inset: -3px 0; }
  /* small text buttons, small segmented controls and source chips: hit area grows, the look stays */
  .btn.sm:not(.icon)::before { content: ''; position: absolute; inset: -5px 0; }
  .seg.sm button { position: relative; }
  .seg.sm button::after { content: ''; position: absolute; inset: -7px -1px; }
  .srcchip { position: relative; }
  .srcchip::after { content: ''; position: absolute; inset: -10px -3px; }
}

/* text for screen readers only */
.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; }
.sec-chip b .ic { width: 12px; height: 12px; vertical-align: -1px; margin-right: 2px; }
