/* VTT Prototype. Tokens on :root; dark by default, light when the device prefers it. Phone first.
   The one memorable thing is the signal chain: each step wears the color of the machine it runs on. */

:root {
  --bg: #101a21; --panel: #172530; --panel2: #1e303d; --text: #e7eff3; --muted: #92a8b5; --line: #2b4252;
  --accent: #f0b44c; --accent-ink: #1d1503;
  --pc: #4cc4b0; --lan: #a995ff; --cloud: #62b0ff;
  --good: #55c27f; --warn: #e9b44c; --bad: #ff8d7d;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --col: 1080px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #edf2f5; --panel: #ffffff; --panel2: #e3ebf0; --text: #14232c; --muted: #51656f; --line: #c4d3dc;
    --accent: #9a5f00; --accent-ink: #ffffff;
    --pc: #0a7d6b; --lan: #5b45cf; --cloud: #1560bd;
    --good: #1f8a4c; --warn: #8a5d00; --bad: #b4311f;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.5; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
code { font-family: var(--mono); font-size: .86em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vt-boot { padding: 2rem 1rem; color: var(--muted); }
.vt-skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem; z-index: 50; }
.vt-skip:focus { left: 0; }

/* header and tabs */
.vt-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); padding: max(.6rem, env(safe-area-inset-top)) 1rem 0; }
.vt-brand { display: flex; align-items: center; gap: .6rem; max-width: var(--col); margin: 0 auto; }
.vt-logo { color: var(--accent); flex: none; }
.vt-brand h1 { font-family: var(--display); font-size: 1.25rem; font-weight: 600; letter-spacing: .01em; }
.vt-wip { margin-left: auto; font-size: .75rem; padding: .15rem .6rem; border-radius: 99px; border: 1px solid var(--cloud); color: var(--cloud); white-space: nowrap; }
.vt-tabs { display: flex; gap: .1rem; max-width: var(--col); margin: .4rem auto 0; overflow-x: auto; scrollbar-width: none; }
.vt-tabs::-webkit-scrollbar { display: none; }
.vt-tabs a { flex: 1 0 auto; text-align: center; text-decoration: none; padding: .7rem .6rem; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; font-size: .92rem; min-height: 44px; white-space: nowrap; }
.vt-tabs a:hover { color: var(--text); }
.vt-tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.vt-demo { max-width: var(--col); margin: .9rem auto 0; padding: .65rem 1rem; border: 1px dashed var(--warn); border-radius: 8px; font-size: .88rem; background: color-mix(in srgb, var(--warn) 9%, transparent); width: calc(100% - 2rem); }
.vt-demo strong { color: var(--warn); }

.vt-main { max-width: var(--col); margin: 0 auto; padding: 1rem 1rem calc(4rem + env(safe-area-inset-bottom)); }
.vt-view > h2 { font-family: var(--display); font-size: 1.6rem; font-weight: 600; margin-bottom: .25rem; }
.vt-view h3 { font-family: var(--display); font-weight: 600; font-size: 1.15rem; }
.vt-lead { color: var(--muted); max-width: 70ch; margin-bottom: 1rem; }
.vt-empty { color: var(--muted); font-size: .92rem; }
.vt-id { font-family: var(--mono); font-size: .8rem; background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: .05rem .4rem; white-space: nowrap; }

/* buttons, chips, inputs */
.vt-btn { background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; border-radius: 8px; padding: .55rem .95rem; min-height: 44px; font-weight: 600; cursor: pointer; }
.vt-btn:hover { filter: brightness(1.08); }
.vt-btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.vt-btn.ghost:hover { border-color: var(--accent); filter: none; }
.vt-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.vt-chip { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: .4rem .9rem; min-height: 40px; cursor: pointer; }
.vt-chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.vt-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
select, input[type="search"] { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; min-height: 44px; }
input[type="search"] { flex: 1 1 14rem; }
.vt-check { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
.vt-pick { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.vt-pick label { display: flex; align-items: center; gap: .5rem; flex: 1 1 16rem; min-width: 0; }
.vt-pick select { flex: 1; min-width: 0; max-width: 100%; }
.vt-stage-pill { font-size: .75rem; padding: .1rem .55rem; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.vt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; margin-bottom: 1rem; }
.vt-dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.vt-dots i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--muted); display: block; }
.vt-dots i.on { background: var(--accent); border-color: var(--accent); }
.vt-count { margin-left: auto; font-size: .78rem; color: var(--muted); }

/* signal chain */
.vt-legend { display: flex; flex-wrap: wrap; gap: 1rem; list-style: none; padding: 0; margin: 0 0 .75rem; font-size: .85rem; color: var(--muted); }
.vt-legend li::before { content: ""; display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-right: .4rem; vertical-align: -1px; background: var(--lane); }
.lane-pc { --lane: var(--pc); } .lane-lan { --lane: var(--lan); } .lane-cloud { --lane: var(--cloud); }

.vt-chain { display: grid; grid-template-columns: 1fr; gap: 0; align-items: stretch; }
.vt-stage { display: flex; flex-direction: column; gap: .35rem; text-align: left; background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--lane); border-radius: 8px; padding: .8rem .85rem; cursor: pointer; min-width: 0; }
.vt-stage:hover { border-color: var(--lane); background: var(--panel2); }
.vt-stage h3 { font-size: 1.05rem; }
.vt-lane-tag { font-size: .75rem; font-weight: 700; color: var(--lane); }
.vt-hint { color: var(--muted); font-size: .85rem; }
.vt-cats { display: flex; flex-wrap: wrap; gap: .25rem; }
.vt-cats code { font-size: .74rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; color: var(--muted); }
.vt-fallback { font-size: .76rem; border: 1px dashed var(--cloud); color: var(--cloud); border-radius: 5px; padding: .05rem .4rem; align-self: flex-start; }
.vt-stage .vt-count { margin: auto 0 0; padding-top: .25rem; }
.vt-link { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 38px; color: var(--lane, var(--pc)); }
.vt-link em { font-style: normal; font-size: .72rem; font-weight: 700; }
.vt-arrow { position: relative; display: block; flex: none; width: 2px; height: 22px; background: currentColor; }
.vt-arrow::after { content: ""; position: absolute; bottom: 0; left: 50%; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translate(-50%, 1px) rotate(45deg); }
@media (min-width: 900px) {
  .vt-chain { grid-template-columns: repeat(5, minmax(0, 1fr) auto) minmax(0, 1fr); }
  .vt-link { flex-direction: column; gap: .15rem; min-height: 0; padding: 0 .35rem; }
  .vt-arrow { width: 28px; height: 2px; }
  .vt-arrow::after { bottom: auto; left: auto; right: 0; top: 50%; transform: translate(1px, -50%) rotate(-45deg); }
}
.vt-around { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin: .9rem 0 1.25rem; font-size: .9rem; color: var(--muted); }

.vt-facts { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.1rem; margin-bottom: 1.5rem; }
.vt-facts > p { max-width: 70ch; margin-top: .3rem; }
.vt-flowline { font-weight: 600; color: var(--text); }
.vt-facts dl, .vt-card dl { display: grid; grid-template-columns: 1fr; gap: .15rem .9rem; margin-top: .8rem; }
.vt-facts dt, .vt-card dt { color: var(--muted); font-size: .85rem; }
.vt-facts dd, .vt-card dd { margin-bottom: .45rem; }
@media (min-width: 700px) {
  .vt-facts dl { grid-template-columns: 11rem 1fr; }
  .vt-facts dd { margin-bottom: .2rem; }
}

/* simulator */
.vt-sim { border-top: 1px solid var(--line); padding-top: 1.25rem; }
.vt-choices { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.vt-choice { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: .45rem .7rem; min-height: 44px; cursor: pointer; text-align: left; }
.vt-choice code { color: var(--muted); }
.vt-choice[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.vt-sim-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 800px) { .vt-sim-grid { grid-template-columns: 1.2fr 1fr; } }
.vt-frame { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-height: 13rem; overflow: hidden; }
.vt-frame-bar { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .8rem; background: var(--panel2); border-bottom: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.vt-status { font-weight: 700; }
.vt-frame[data-state="rec"] .vt-status { color: var(--bad); }
.vt-frame[data-state="work"] .vt-status { color: var(--cloud); }
.vt-page-text { padding: 1rem; font-size: 1.1rem; line-height: 1.6; min-height: 7rem; }
.vt-page-text.empty::before { content: "Your text appears here."; color: var(--muted); }
.seg-f { color: var(--text); }
.seg-d { color: var(--muted); font-style: italic; }
.seg-x { color: var(--bad); text-decoration: line-through; }
.vt-overlay { position: absolute; right: .8rem; bottom: .8rem; max-width: calc(100% - 1.6rem); display: flex; align-items: center; gap: .55rem; background: var(--bg); border: 1px solid var(--accent); border-radius: 99px; padding: .4rem .9rem; font-size: .88rem; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.vt-dot { flex: none; width: .7rem; height: .7rem; border-radius: 50%; background: var(--muted); }
.vt-frame[data-state="rec"] .vt-dot { background: var(--bad); animation: vt-pulse 1.1s ease-in-out infinite; }
.vt-frame[data-state="work"] .vt-dot { background: var(--cloud); }
@keyframes vt-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .vt-frame[data-state="rec"] .vt-dot { animation: none; } }
.vt-log { list-style: none; padding: 0; margin: 0; font-size: .88rem; display: grid; gap: .35rem; align-content: start; min-height: 3rem; }
.vt-log li { display: grid; grid-template-columns: 3.4rem 1fr; gap: .5rem; }
.vt-log time { font-family: var(--mono); font-size: .78rem; color: var(--muted); padding-top: .1rem; }
.vt-takeaway { margin-top: 1rem; max-width: 70ch; }

/* types */
.vt-tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 1.5rem; }
.vt-table { border-collapse: collapse; width: 100%; min-width: 980px; font-size: .86rem; }
.vt-table th, .vt-table td { text-align: left; vertical-align: top; padding: .5rem .65rem; border-bottom: 1px solid var(--line); }
.vt-table thead th { background: var(--panel2); font-weight: 600; position: sticky; top: 0; }
.vt-table tbody tr:last-child th, .vt-table tbody tr:last-child td { border-bottom: 0; }
.vt-table tbody th { white-space: nowrap; }
.vt-group { font-family: var(--display); font-size: 1.2rem; margin: 1.5rem 0 .2rem; }
.vt-cards { display: grid; gap: .9rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
@media (min-width: 760px) { .vt-cards { grid-template-columns: 1fr 1fr; } }
.vt-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .9rem 1rem; display: flex; flex-direction: column; }
.vt-card.current { border-color: var(--accent); }
.vt-card header { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; margin-bottom: .4rem; }
.vt-card h4 { font-family: var(--display); font-size: 1.05rem; font-weight: 600; }
.vt-card header .vt-stage-pill { margin-left: auto; }
.vt-card .vt-actions { margin-top: auto; padding-top: .8rem; }

/* options */
.vt-catnav { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.vt-catnav a { text-decoration: none; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .55rem; font-size: .82rem; }
.vt-catnav a:hover { color: var(--text); border-color: var(--accent); }
.vt-cat { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); margin-bottom: .9rem; padding: 0 1rem .4rem; scroll-margin-top: 7.5rem; }
.vt-cat > summary { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; cursor: pointer; padding: .8rem 0; min-height: 44px; list-style-position: inside; }
.vt-cat > summary strong { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.vt-total { color: var(--muted); font-size: .8rem; }
.vt-opt { display: grid; grid-template-columns: 2.2rem 1fr; gap: .4rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.vt-opt.misfit .vt-opt-body { opacity: .6; }
.vt-opt-pick { padding-top: .15rem; }
.vt-opt-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-bottom: .2rem; }
.vt-fit { margin-left: auto; font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.vt-ud { display: grid; gap: .2rem; margin-top: .3rem; font-size: .9rem; color: var(--muted); }
.vt-ud b { color: var(--text); font-weight: 600; }
.vt-note { margin-top: .3rem; font-size: .85rem; color: var(--warn); }

/* my build */
.vt-summary { display: grid; gap: .6rem; grid-template-columns: 1fr; margin-bottom: 1.5rem; }
@media (min-width: 760px) { .vt-summary { grid-template-columns: 1fr 1fr; } }
.vt-sum-row { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .85rem; }
.vt-sum-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.vt-picks { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.vt-picks li { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .92rem; }
.vt-picks li.misfit { color: var(--warn); }
.vt-picks code { color: var(--muted); }
.vt-x { margin-left: auto; background: transparent; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; min-height: 32px; padding: 0 .3rem; }
.vt-x:hover { color: var(--bad); }
.vt-checks { margin-bottom: 1.5rem; }
.vt-checks h3 { margin-bottom: .5rem; }
.vt-check-row { border-left: 4px solid var(--line); background: var(--panel); border-radius: 0 8px 8px 0; padding: .55rem .8rem; margin-bottom: .5rem; font-size: .92rem; }
.vt-check-row.error { border-left-color: var(--bad); }
.vt-check-row.warn { border-left-color: var(--warn); }
.vt-check-row.info { border-left-color: var(--cloud); }
.vt-copy { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; font-family: var(--mono); font-size: .82rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }

/* full list */
.vt-outline h3 { margin: 1.5rem 0 .3rem; }
.vt-outline h4 { margin: 1.1rem 0 .3rem; font-size: 1rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.vt-outline ul { padding-left: 1.1rem; margin: 0 0 .5rem; display: grid; gap: .5rem; }
.vt-outline li { max-width: 80ch; }
.vt-outline li .vt-id { margin-right: .4rem; }
.vt-outline li strong { margin-right: .4rem; }
.vt-sub { display: block; color: var(--muted); font-size: .88rem; margin-top: .15rem; }
.vt-sub b { color: var(--text); font-weight: 600; }
.vt-notes { padding-left: 1.1rem; }

@media (max-width: 480px) {
  .vt-tabs a { padding: .7rem .45rem; font-size: .84rem; }
}
