/* App shell — layout, header, hero, command bar, stats, panels, tabs, responsive */

/* ambient background — retired: flat surfaces read calmer than blurred blobs */
.aura { display: none; }

/* header */
.hdr { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: rgba(9, 9, 11, 0.78); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); border-bottom: 1px solid var(--hairline); }
.hdr-in { max-width: var(--maxw); margin: 0 auto; height: 100%; padding: 0 var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.mark { position: relative; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--accent); flex: none; }
.mark i { position: absolute; inset: -4px; border-radius: 50%; animation: spin 7s linear infinite; }
.mark i::after { content: ""; position: absolute; top: 50%; right: -1px; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--accent-2); }
.wordmark { font-weight: 700; font-size: 18px; letter-spacing: 1.2px; }
.wordmark b { color: var(--accent); font-weight: 700; }
.brand-sep { width: 1px; height: 18px; background: var(--hairline-2); }
.brand-tag { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.hdr-right { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px; font-size: 12px; color: var(--text-2); border: 1px solid var(--hairline-2); background: var(--surface-0); white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 196, 81, 0.15); }
.pill.is-live i { background: var(--ok); box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.18); animation: livePulse 2s var(--ease-in-out) infinite; }
.pill-agent span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.pill-btn { transition: border-color var(--t-fast), background var(--t-fast); }
.pill-btn:hover { border-color: var(--hairline-3); background: var(--surface-2); }
.pill-btn svg { color: var(--accent); }
.pill-btn b { color: var(--text); font-weight: 600; }
.kbd-btn { display: inline-flex; gap: 3px; padding: 4px; border-radius: 9px; transition: background var(--t-fast); }
.kbd-btn:hover { background: var(--surface-2); }
@keyframes livePulse { 50% { box-shadow: 0 0 0 6px rgba(61, 220, 151, 0); } }

.scanbar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; opacity: 0; transition: opacity var(--t-slow) var(--ease-out); }
.scanbar i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: var(--brand-grad); transition: transform 600ms var(--spring); }
.scanbar.is-on { opacity: 1; }
.scanbar.is-on::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent); width: 30%; animation: scanShine 1.4s linear infinite; }
@keyframes scanShine { from { transform: translateX(-100%); } to { transform: translateX(400%); } }

/* shell */
.shell { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) 24px; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px; align-items: center; padding: 34px 0 26px; }
.eyebrow { display: block; font-size: 13.5px; font-weight: 500; color: var(--accent); }
.eb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.h1 { margin: 16px 0 12px; font-size: clamp(34px, 4.4vw, 56px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 640; text-wrap: balance; }
.grad { color: var(--text-2); }
.lede { margin: 0 0 22px; max-width: 540px; font-size: 15.5px; line-height: 1.6; color: var(--text-2); text-wrap: pretty; }

/* command bar */
.cmd { position: relative; display: flex; align-items: center; gap: 10px; height: 58px; padding: 0 7px 0 16px; border-radius: 16px; background: rgba(18, 21, 27, 0.8); border: 1px solid var(--hairline-2); box-shadow: var(--shadow-2); transition: border-color var(--t-med), box-shadow var(--t-med); }
.cmd:focus-within { border-color: rgba(122, 162, 255, 0.55); box-shadow: 0 0 0 4px rgba(122, 162, 255, 0.12), var(--shadow-2); }
.cmd-ic { color: var(--accent); flex: none; display: grid; }
.cmd input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; font-size: 16px; color: var(--text); position: relative; z-index: 1; }
.cmd-ph { position: absolute; left: 46px; right: 150px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--text-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; transition: opacity var(--t-med), transform var(--t-med) var(--ease-out); }
.cmd-ph.is-out { opacity: 0; transform: translateY(calc(-50% - 6px)); }
.cmd-ph.is-hidden { opacity: 0; }
.cmd-kbd { flex: none; }
.cmd-go { position: relative; flex: none; height: 44px; min-width: 92px; padding: 0 18px; border-radius: 11px; font-weight: 650; font-size: 14.5px; color: var(--accent-ink); background: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,0.45) inset; transition: transform 120ms var(--ease-out), filter var(--t-fast); }
.cmd-go:hover { filter: brightness(1.07); }
.cmd-go:active { transform: scale(0.97); }
.cmd-go-spin { display: none; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(10, 17, 36, 0.3); border-top-color: var(--accent-ink); animation: spin 0.7s linear infinite; }
.cmd.is-busy .cmd-go { pointer-events: none; }
.cmd.is-busy .cmd-go-label { opacity: 0; }
.cmd.is-busy .cmd-go-spin { display: block; }

.chips { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; color: var(--text-2); border: 1px solid var(--hairline); background: var(--surface-0); transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast), transform 120ms; }
.chips button:hover { color: var(--text); border-color: var(--hairline-3); background: var(--surface-2); }
.chips button:active { transform: scale(0.97); }
.chips i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 22px 0 0; border-radius: 16px; overflow: hidden; background: var(--hairline); border: 1px solid var(--hairline); }
.stat { position: relative; padding: 14px 16px 13px; background: rgba(12, 14, 18, 0.92); min-width: 0; }
.stat dt { font-size: 11px; font-weight: 550; letter-spacing: 0.9px; text-transform: uppercase; color: var(--text-3); }
.stat dd { margin: 4px 0 2px; font-size: var(--fs-2xl); line-height: 1.1; font-weight: 640; letter-spacing: -0.8px; color: var(--text); }
.stat-ok dd { color: var(--ok); }
.stat-sub { display: block; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* map */
.hero-map { min-width: 0; }
.map-card { position: relative; border-radius: 22px; padding: 10px; background: var(--surface-1); border: 1px solid var(--hairline); box-shadow: var(--shadow-3); }
.map-card::before { content: none; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.map-legend { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 10px; font-size: 11.5px; color: var(--text-3); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 7px; height: 7px; border-radius: 50%; }
.lg-read { background: var(--accent); } .lg-write { background: var(--ok); } .lg-result { background: var(--notion); opacity: 0.6; }
.map-hint { color: var(--text-4); }

/* panels */
.work { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.panel { border-radius: 20px; background: rgba(11, 13, 17, 0.82); border: 1px solid var(--hairline); box-shadow: var(--shadow-2); min-width: 0; overflow: hidden; }
.col-live { position: sticky; top: calc(var(--header-h) + 14px); height: calc(100dvh - var(--header-h) - 28px); display: flex; flex-direction: column; }
.col-live .tl { flex: 1; min-height: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--hairline); flex: none; }
.panel-head h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.2px; }
.panel-meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); transition: background var(--t-med); }
.live-dot.is-on { background: var(--ok); animation: livePulse 1.4s var(--ease-in-out) infinite; box-shadow: 0 0 0 3px rgba(61,220,151,0.2); }

.tabs { position: relative; display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-1); border: 1px solid var(--hairline); }
.tabs button { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 550; color: var(--text-3); transition: color var(--t-med); }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs-ind, .seg-ind { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; border-radius: 8px; background: var(--surface-3); box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 1px 3px rgba(0,0,0,0.4); transition: transform 460ms var(--spring), width 460ms var(--spring); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 10.5px; font-weight: 700; color: #1a0e08; background: var(--ROTTED); animation: badgeIn 420ms var(--spring); }
.badge.is-ok { background: var(--ok); color: #04150d; }
@keyframes badgeIn { from { transform: scale(0.4); opacity: 0; } }
.tabpane[hidden] { display: none; }
.tabpane { animation: paneIn 380ms var(--ease-out); }
@keyframes paneIn { from { opacity: 0; transform: translateY(6px); } }

/* segmented control (phones) */
.seg { display: none; }

/* footer */
.foot { margin-top: 28px; padding: 22px 0 8px; border-top: 1px solid var(--hairline); display: grid; gap: 10px; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; font-size: 12.5px; color: var(--text-3); }
.foot-row b { color: var(--text-2); font-weight: 550; margin-right: 4px; }
.foot-sub a { color: var(--text-2); text-decoration: none; border-bottom: 1px solid var(--hairline-3); transition: color var(--t-fast), border-color var(--t-fast); }
.foot-sub a:hover { color: var(--text); border-color: var(--text-2); }
.foot-link { font-size: 12.5px; color: var(--text-3); transition: color var(--t-fast); }
.foot-link:hover { color: var(--text); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 24px; }
  .hero-map { order: 2; }
  .work { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
}

@media (max-width: 860px) {
  :root { --header-h: 56px; }
  .brand-sep, .brand-tag, .pill-label, .pill-agent, .kbd-btn { display: none; }
  .hero { padding: 18px 0 8px; }
  .h1 { font-size: 34px; letter-spacing: -1.2px; margin: 12px 0 8px; }
  .lede { font-size: 14.5px; margin-bottom: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; }
  .stat dd { font-size: 24px; }
  .map-legend .map-hint { display: none; }

  /* bottom dock: the command bar lives under the thumb */
  .cmd { position: fixed; z-index: 60; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); height: 58px; background: rgba(18, 21, 27, 0.92); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); box-shadow: var(--shadow-3); }
  .cmd-kbd { display: none; }
  .cmd-ph { right: 120px; }
  .shell { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

  .seg { position: sticky; top: calc(var(--header-h) + 8px); z-index: 40; display: flex; margin: 16px 0 12px; padding: 3px; border-radius: 13px; background: rgba(13, 15, 19, 0.9); border: 1px solid var(--hairline-2); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  .seg button { position: relative; z-index: 1; flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border-radius: 10px; font-size: 13.5px; font-weight: 550; color: var(--text-3); transition: color var(--t-med); }
  .seg button.is-on { color: var(--text); }
  .seg-ind { border-radius: 10px; }

  .work { display: block; }
  .work .panel-head .tabs { display: none; }
  .work[data-view="live"] .col-right, .work:not([data-view="live"]) .col-live { display: none; }
  .col-live { position: static; height: min(64dvh, 560px); }
  .panel { border-radius: 18px; }
  .foot { margin-top: 18px; }
}

@media (max-width: 380px) {
  .h1 { font-size: 30px; }
  .stat { padding: 12px; }
  .cmd-go { min-width: 76px; padding: 0 14px; }
}
