@font-face { font-family: 'General Sans'; src: url('fonts/general-sans-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'General Sans'; src: url('fonts/general-sans-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'General Sans'; src: url('fonts/general-sans-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'General Sans'; src: url('fonts/general-sans-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;

  --bg: #f4f2ec;
  --surface: #fcfbf8;
  --surface-2: #eeebe3;
  --border: #d9d4c8;
  --text: #1b2225;
  --text-muted: #5b6366;
  --target: #1e5a78;
  --target-soft: #dbe7ee;
  --peer: #b7731f;
  --peer-soft: #f4e6d2;
  --pos: #2c7449;
  --pos-soft: #dcefe2;
  --neg: #ae3d33;
  --neg-soft: #f6dfdb;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(27, 34, 37, .06), 0 1px 0 rgba(27, 34, 37, .03);
  --font: 'General Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { 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: var(--text-base); line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-base); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--text-muted); }
.small { font-size: var(--text-xs); }
.eyebrow { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 500; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--target); outline-offset: 2px; }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--space-6);
  padding: var(--space-3) clamp(1rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.brand-mark {
  font-weight: 700; font-size: .9rem; letter-spacing: .06em;
  background: var(--text); color: var(--surface);
  padding: .3rem .5rem; border-radius: 5px;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { font-weight: 600; font-size: var(--text-sm); white-space: nowrap; }
.brand-sub { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.tabs { display: flex; gap: var(--space-1); margin-left: auto; background: var(--surface-2); padding: 3px; border-radius: 9px; }
.tab {
  border: 0; background: transparent; padding: .45rem .9rem; border-radius: 7px;
  font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); white-space: nowrap;
}
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tab:hover { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  padding: .55rem 1rem; font-size: var(--text-sm); font-weight: 500; min-height: 44px;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--target); border-color: var(--target); color: #fff; min-width: 9rem; }
.btn-primary:hover { background: #174a63; }
.btn-primary.running { background: var(--text); border-color: var(--text); }
.btn-ghost { background: transparent; }
.link-btn { border: 0; background: none; padding: 0; color: var(--target); font-size: var(--text-sm); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); width: 270px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(27,34,37,.14); padding: var(--space-2); display: flex; flex-direction: column;
}
.menu-item { text-align: left; border: 0; background: none; padding: .6rem .75rem; border-radius: var(--radius-sm); font-size: var(--text-sm); cursor: pointer; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--neg); }
.menu-panel hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-1) 0; width: 100%; }

/* ---------- Layout ---------- */
main { max-width: 1320px; margin: 0 auto; padding: var(--space-6) clamp(1rem, 3vw, 2rem) var(--space-10); }
.panel { display: flex; flex-direction: column; gap: var(--space-5); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-5); }
.card-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); flex-wrap: wrap; }

/* Session */
.session { padding: 0; }
.session > summary { list-style: none; cursor: pointer; padding: var(--space-4) var(--space-5); display: flex; align-items: baseline; gap: var(--space-4); flex-wrap: wrap; }
.session > summary::-webkit-details-marker { display: none; }
.session > summary::before { content: '▸'; color: var(--text-muted); font-size: .8em; transition: transform .15s; }
.session[open] > summary::before { transform: rotate(90deg); }
.session-brief { font-size: var(--text-sm); color: var(--text-muted); }
.session-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); padding: 0 var(--space-5) var(--space-5); }
.field { display: flex; flex-direction: column; gap: .3rem; font-size: var(--text-xs); color: var(--text-muted); font-weight: 500; }
.field.wide { grid-column: span 2; }
.field input, .field select {
  font-size: var(--text-sm); color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .55rem .65rem; min-height: 42px; width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--target); outline-offset: -1px; background: #fff; }
.field.hint output { font-size: var(--text-sm); color: var(--text); padding: .55rem 0; }

/* Observe */
.observe-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-5); }
.timer-card, .strip-card, .mini-summary { grid-column: 1 / -1; }
.coder { display: contents; }

.timer-row { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-6); align-items: center; }
.interval-id { display: flex; flex-direction: column; }
.interval-num { font-size: var(--text-xl); font-weight: 600; line-height: 1; }
.interval-num .of { font-size: var(--text-base); color: var(--text-muted); font-weight: 500; }
.phase-labels { display: grid; grid-template-columns: 1fr 2fr; font-size: var(--text-xs); color: var(--text-muted); margin-bottom: .35rem; font-weight: 500; }
.phase { transition: color .2s; }
.phase.active { color: var(--text); font-weight: 600; }
.phase-bar { position: relative; height: 14px; border-radius: 7px; overflow: hidden; display: grid; grid-template-columns: 1fr 2fr; gap: 2px; background: var(--surface); }
.phase-seg { background: var(--surface-2); }
.phase-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--target); opacity: .85; }
body.phase-i .phase-fill { background: var(--peer); }
.clock { font-size: var(--text-sm); margin-top: .35rem; }
.clock #clockSec { font-weight: 600; }
.timer-btns { display: flex; gap: var(--space-2); }
.timer-opts { display: flex; gap: var(--space-5); align-items: center; flex-wrap: wrap; margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border); font-size: var(--text-sm); }
.check { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--target); }

/* Who columns */
.who { padding: var(--space-4); display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--target); }
.who-peer { border-top-color: var(--peer); }
.who-head { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-3); }
.who-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--target); align-self: center; }
.who-peer .who-dot { background: var(--peer); }
.who-head .small { margin-left: auto; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }

.eng-toggle {
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
  border: 1.5px dashed var(--border); background: var(--bg); border-radius: 8px; padding: .65rem .8rem; margin-bottom: var(--space-2);
  text-align: left; min-height: 52px; transition: background .12s, border-color .12s;
}
.eng-box { width: 30px; height: 30px; border-radius: 6px; border: 1.5px solid var(--text-muted); display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; background: var(--surface); flex: none; }
.eng-text { font-size: var(--text-sm); }
.who-target .eng-toggle.on { background: var(--target-soft); border: 1.5px solid var(--target); }
.who-target .eng-toggle.on .eng-box { background: var(--target); border-color: var(--target); color: #fff; }
.who-peer .eng-toggle.on { background: var(--peer-soft); border: 1.5px solid var(--peer); }
.who-peer .eng-toggle.on .eng-box { background: var(--peer); border-color: var(--peer); color: #fff; }

.code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--space-3); align-items: center; padding: .3rem 0; border-top: 1px solid var(--surface-2); }
.code-lab { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.code-lab b { font-size: var(--text-sm); min-width: 2.6rem; }
.code-lab span { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slots { display: flex; gap: 4px; }
.slot {
  width: 30px; height: 30px; border-radius: 5px; border: 1px solid var(--border); background: var(--bg);
  font-weight: 700; font-size: 1rem; padding: 0; display: grid; place-items: center; line-height: 1;
}
.slot:disabled { cursor: default; }
.slot.pos { background: var(--pos-soft); border-color: var(--pos); color: var(--pos); }
.slot.neg { background: var(--neg-soft); border-color: var(--neg); color: var(--neg); }
.slot.occ { background: var(--surface-2); border-color: var(--text); color: var(--text); }
.slot:not(:disabled):hover { text-decoration: line-through; }
.adds { display: flex; gap: 6px; }
.add {
  width: 46px; height: 42px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 700; font-size: 1.25rem; padding: 0; line-height: 1; transition: transform .06s, background .12s;
}
.add:active { transform: scale(.94); }
.add-pos { color: var(--pos); }
.add-pos:hover { background: var(--pos-soft); border-color: var(--pos); }
.add-neg { color: var(--neg); }
.add-neg:hover { background: var(--neg-soft); border-color: var(--neg); }
.add-occ { width: 98px; }
.add-occ:hover { background: var(--surface-2); border-color: var(--text); }
.add:disabled { opacity: .3; cursor: not-allowed; }

/* Strip */
.strip-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.legend { display: flex; gap: var(--space-4); flex-wrap: wrap; font-size: var(--text-xs); color: var(--text-muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sw-t { background: var(--target); }
.sw-p { background: var(--peer); }
.sw-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text); }
.sw-neg { background: repeating-linear-gradient(135deg, var(--text-muted) 0 2px, transparent 2px 5px); border: 1px solid var(--text-muted); }
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 5px; }
.cell {
  position: relative; border: 1px solid var(--border); background: var(--bg); border-radius: 6px;
  padding: 4px 4px 5px; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 44px;
}
.cell:hover { border-color: var(--text-muted); }
.cell.cur { border: 2px solid var(--text); background: var(--surface); padding: 3px 3px 4px; }
.cell-n { font-size: var(--text-xs); font-weight: 600; line-height: 1.1; }
.cell-bars { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.cell-bars i { height: 5px; border-radius: 2px; background: var(--surface-2); }
.cell-bars i.t-on { background: var(--target); }
.cell-bars i.p-on { background: var(--peer); }
.cell-dot { position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--text); }

/* Mini summary */
.mini-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); margin-bottom: var(--space-4); }
.mini-lab { font-size: var(--text-xs); color: var(--text-muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-lab b { color: var(--text); }
.mini-vals { display: flex; gap: var(--space-4); font-weight: 600; font-size: var(--text-lg); }
.v-t, .t { color: var(--target); }
.v-p, .p { color: var(--peer); }
.mini-bars { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.mini-bars i { display: block; height: 5px; border-radius: 3px; min-width: 2px; transition: width .3s; }
.b-t { background: var(--target); }
.b-p { background: var(--peer); }

/* ---------- Report header ---------- */
.report-head { display: flex; flex-direction: column; gap: var(--space-4); }
.rh-title { display: flex; align-items: baseline; gap: var(--space-4); flex-wrap: wrap; }
.rh-title h1 { font-size: var(--text-xl); }
.rh-title .muted { font-size: var(--text-sm); }
.rh-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-2) var(--space-5); padding: var(--space-4) var(--space-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.rh-grid div { display: flex; flex-direction: column; min-width: 0; }
.rh-grid span { font-size: var(--text-xs); color: var(--text-muted); }
.rh-grid b { font-size: var(--text-sm); font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Summary table ---------- */
.table-wrap { overflow-x: auto; margin: 0 calc(var(--space-5) * -1); padding: 0 var(--space-5); }
.sum-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); min-width: 860px; }
.sum-table.compact { min-width: 560px; }
.sum-table th, .sum-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--surface-2); vertical-align: middle; }
.sum-table th { font-size: var(--text-xs); line-height: 1.25; font-weight: 600; color: var(--text-muted); text-align: left; background: var(--bg); }
.sum-table thead tr.grp th { border-bottom: 0; }
.sum-table th.g-t { color: #fff; background: var(--target); text-align: center; border-radius: 6px 6px 0 0; }
.sum-table th.g-p { color: #fff; background: var(--peer); text-align: center; border-radius: 6px 6px 0 0; }
.sum-table th.t { background: var(--target-soft); color: var(--target); }
.sum-table th.p { background: var(--peer-soft); color: #8a5512; }
.num { text-align: right !important; white-space: nowrap; }
.sum-table td.beh { min-width: 240px; }
.sum-table tr.has-sub td { border-bottom: 0; }
.sgn { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; font-weight: 700; margin-right: .5rem; font-size: .8rem; }
.sgn.pos { background: var(--pos-soft); color: var(--pos); }
.sgn.neg { background: var(--neg-soft); color: var(--neg); }
.sum-table tr.sub-row.last td { border-bottom: 1px solid var(--border); padding-bottom: .5rem; }
.sum-table tr.sub-row td { color: var(--text-muted); font-size: var(--text-xs); padding-top: .3rem; padding-bottom: .3rem; border-bottom: 0; }
.sum-table tr.sub-row td.beh { padding-left: 3rem; }
.sum-table tr.tot-row td { font-weight: 500; border-bottom: 1px solid var(--border); }
.sum-table td.t { background: color-mix(in srgb, var(--target-soft) 35%, transparent); }
.sum-table td.p { background: color-mix(in srgb, var(--peer-soft) 40%, transparent); }
.sum-table td.strong { font-weight: 700; }
.sum-table td.t.strong { color: var(--target); }
.sum-table td.p.strong { color: #8a5512; }
.sum-table td.flag { color: var(--neg); font-weight: 700; }
.abbr { display: inline-block; min-width: 2.4rem; font-weight: 700; font-size: var(--text-xs); color: var(--text); }
.abbr.big { font-size: var(--text-sm); background: var(--text); color: var(--surface); border-radius: 5px; padding: .2rem .45rem; min-width: 0; text-align: center; }
.footnote { font-size: var(--text-xs); color: var(--text-muted); margin: var(--space-4) 0 0; max-width: 90ch; line-height: 1.6; }

/* ---------- Graphs ---------- */
.graph-toolbar { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; padding: var(--space-3) var(--space-5); }
.graph-toolbar .legend { margin-left: auto; }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 9px; }
.seg-btn { border: 0; background: transparent; padding: .45rem .85rem; border-radius: 7px; font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); min-height: 38px; }
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 470px; }
.chart-box.short { height: 210px; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-5); }
.item-card { display: flex; flex-direction: column; gap: var(--space-3); }
.item-head { display: flex; align-items: flex-start; gap: var(--space-3); }
.item-head .abbr.big { flex: none; }
.item-measure { font-size: var(--text-xs); font-weight: 600; color: var(--text); margin-bottom: calc(var(--space-2) * -1); }
.item-head h3 { font-size: var(--text-base); }
.item-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); border-top: 1px solid var(--surface-2); border-bottom: 1px solid var(--surface-2); padding: var(--space-2) 0; }
.item-stats div { display: flex; flex-direction: column; }
.item-stats b { font-size: var(--text-lg); font-weight: 600; }
.item-pm { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--text-muted); gap: var(--space-2); flex-wrap: wrap; }

/* ---------- Definitions ---------- */
.defs-intro p { max-width: 75ch; margin: var(--space-3) 0; }
.structure-bar { display: grid; grid-template-columns: 1fr 2fr; gap: 3px; margin: var(--space-4) 0; font-size: var(--text-xs); font-weight: 600; }
.structure-bar div { padding: .6rem .75rem; color: #fff; }
.s-e { background: var(--target); border-radius: 6px 0 0 6px; }
.s-i { background: var(--peer); border-radius: 0 6px 6px 0; }
.marks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; font-size: var(--text-sm); }
.mk { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 5px; background: var(--surface-2); margin-right: .5rem; }
.mk.pos { background: var(--pos-soft); color: var(--pos); }
.mk.neg { background: var(--neg-soft); color: var(--neg); }
.defs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-5); }
.def-card p { margin: var(--space-3) 0; font-size: var(--text-sm); }
.def-card dl { margin: 0; font-size: var(--text-sm); }
.def-card dt { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: var(--space-2); }
.def-card dd { margin: .15rem 0 0; }

/* ---------- Title & About pages ---------- */
.page .card { padding: clamp(1.5rem, 4vw, 3.5rem); }
.cover { max-width: 900px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: var(--space-8); }
.cover-top { display: flex; flex-direction: column; gap: var(--space-3); }
.cover-title { font-size: clamp(2rem, 1.2rem + 3vw, 3.5rem); line-height: 1.05; letter-spacing: -0.02em; max-width: 14ch; }
.cover-acronym { margin: 0; font-size: clamp(3rem, 2rem + 5vw, 6rem); font-weight: 700; letter-spacing: .08em; line-height: 1; color: var(--target); }
.cover-bar { display: grid; grid-template-columns: 1fr 2fr; gap: 3px; margin-top: var(--space-4); font-size: var(--text-xs); font-weight: 600; color: #fff; }
.cover-bar span { padding: .55rem .75rem; }
.cb-e { background: var(--target); border-radius: 6px 0 0 6px; }
.cb-i { background: var(--peer); border-radius: 0 6px 6px 0; }
.cover-author { border-top: 1px solid var(--border); padding-top: var(--space-6); }
.cover-author p { margin: 0; }
.author-name { font-size: var(--text-xl); font-weight: 600; }
.author-org { font-size: var(--text-lg); color: var(--text-muted); margin-top: .2rem !important; }
.author-web { margin-top: var(--space-2) !important; font-size: var(--text-sm); }
.author-web a, .cover-bio a { color: var(--target); }
.cover-bio { background: var(--bg); border-radius: var(--radius); padding: var(--space-6); }
.cover-bio h2 { font-size: var(--text-base); margin-bottom: var(--space-3); }
.cover-bio p { margin: 0 0 var(--space-3); max-width: 75ch; font-size: var(--text-sm); line-height: 1.65; }
.cover-bio p:last-child { margin-bottom: 0; }
.page-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); border-top: 1px solid var(--border); padding-top: var(--space-5); flex-wrap: wrap; }
.page-nav .muted:first-child { margin-right: auto; }
.about { max-width: 1000px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: var(--space-6); }
.about-head { display: flex; flex-direction: column; gap: var(--space-2); }
.about-head h1 { font-size: var(--text-xl); max-width: 26ch; }
.lead { font-size: var(--text-base); line-height: 1.7; margin: 0; max-width: 72ch; }
.about-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.about-block { background: var(--bg); border-radius: var(--radius); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.about-block h2 { font-size: var(--text-base); }
.about-block p { margin: 0; font-size: var(--text-sm); line-height: 1.6; }
.ab-tag { align-self: flex-start; font-size: var(--text-xs); font-weight: 600; padding: .2rem .55rem; border-radius: 999px; }
.ab-eng { background: var(--target-soft); color: var(--target); }
.ab-ts { background: #e3e0f0; color: #4a3f86; }
.ab-sp { background: var(--peer-soft); color: #8a5512; }
.about-sub { font-size: var(--text-lg); }
.about-list { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: var(--space-2); max-width: 75ch; line-height: 1.6; }
@media (max-width: 800px) { .about-cols { grid-template-columns: minmax(0, 1fr); } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--surface); padding: .7rem 1.1rem; border-radius: 8px; font-size: var(--text-sm);
  transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .app-header { flex-wrap: wrap; gap: var(--space-3); }
  .tabs { order: 3; margin-left: 0; width: 100%; overflow-x: auto; }
  .tab { flex: 1; }
  .header-actions { margin-left: auto; }
}
@media (max-width: 900px) {
  .session-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .observe-layout { grid-template-columns: minmax(0, 1fr); }
  .timer-row { grid-template-columns: auto 1fr; }
  .timer-btns { grid-column: 1 / -1; }
  .timer-btns .btn { flex: 1; }
  .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .brand-sub { display: none; }
  .brand-title { white-space: normal; font-size: var(--text-xs); }
  .session-grid { grid-template-columns: minmax(0, 1fr); }
  .field.wide { grid-column: auto; }
  .timer-row { gap: var(--space-4); }
  .code-lab { flex-direction: column; gap: 0; }
  .code-lab span { white-space: normal; line-height: 1.25; }
  .slot { width: 26px; height: 26px; font-size: .9rem; }
  .add { width: 42px; }
  .add-occ { width: 90px; }
  .tab { padding: .45rem .5rem; }
  .graph-toolbar .legend { margin-left: 0; }
  .defs-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-box.tall { height: 520px; }
  .rh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: var(--space-3) var(--space-4); }
  .seg-btn { padding: .4rem .55rem; white-space: nowrap; font-size: var(--text-xs); }
  .graph-toolbar { padding: var(--space-3); }
}

/* ---------- Print ---------- */
@media print {
  @page { size: letter landscape; margin: 0.45in; }
  body { background: #fff; font-size: 11pt; }
  #tab-title, #tab-about { break-after: page; }
  .page-nav { display: none !important; }
  .page .card { border: 0; padding: 0; }
  .app-header, .graph-toolbar, #btnExportSummary2, .toast, #tab-observe, #tab-codes { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  #tab-graphs .report-head { display: none; }
  #tab-graphs { break-before: page; }
  .table-wrap { overflow: visible; margin: 0; padding: 0; }
  .sum-table { min-width: 0; font-size: 9pt; }
  .item-grid { grid-template-columns: repeat(3, 1fr); }
  .chart-box.tall { height: 380px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.menu-note { font-size: var(--text-xs); color: var(--text-muted); margin: .25rem .75rem .5rem; line-height: 1.4; }
.sum-table td.na { color: var(--text-muted); }
.item-stats .rate { font-size: var(--text-xs); font-weight: 500; }
.mini-vals small { display: block; font-size: var(--text-xs); font-weight: 500; line-height: 1.1; }
.mini-vals > span { display: flex; flex-direction: column; }

/* Interval phase sections */
.sec-head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; font-size: var(--text-xs); padding: .35rem .55rem; border-radius: 6px; margin: var(--space-2) 0 var(--space-2); }
.sec-head b { font-weight: 700; letter-spacing: .02em; }
.sec-time { font-weight: 700; padding: .05rem .4rem; border-radius: 4px; color: #fff; }
.sec-e { background: var(--target-soft); color: var(--target); }
.sec-e .sec-time { background: var(--target); }
.sec-i { background: var(--peer-soft); color: #8a5512; margin-top: var(--space-3); }
.sec-i .sec-time { background: var(--peer); }
.sec-i .muted { font-weight: 500; }
body.phase-e .who .code-row, body.phase-e .who .sec-i { opacity: .38; }
body.phase-i .who .eng-toggle, body.phase-i .who .sec-e { opacity: .38; }
.who .code-row, .who .eng-toggle, .who .sec-head { transition: opacity .2s; }
/* About timeline */
.timeline-callout { display: grid; grid-template-columns: 1fr 2fr; gap: 3px; }
.timeline-callout > div { display: flex; flex-direction: column; gap: .25rem; padding: var(--space-4) var(--space-5); color: #fff; }
.timeline-callout b { font-size: var(--text-base); letter-spacing: .01em; }
.timeline-callout span { font-size: var(--text-sm); line-height: 1.5; }
.timeline-callout .tc-time { font-size: var(--text-xs); font-weight: 700; opacity: .85; text-transform: uppercase; letter-spacing: .08em; }
.tc-e { background: var(--target); border-radius: var(--radius) 0 0 var(--radius); }
.tc-i { background: #9a5f17; border-radius: 0 var(--radius) var(--radius) 0; }
.about-note { margin: 0; font-size: var(--text-sm); background: var(--peer-soft); border-left: 3px solid var(--peer); padding: var(--space-3) var(--space-4); border-radius: 0 6px 6px 0; max-width: 85ch; }
.def-card .when { font-size: var(--text-xs); padding: .35rem .55rem; border-radius: 6px; margin-bottom: 0; }
.when-e { background: var(--target-soft); color: var(--target); }
.when-i { background: var(--peer-soft); color: #8a5512; }
@media (max-width: 700px) { .timeline-callout { grid-template-columns: 1fr; } .tc-e { border-radius: var(--radius) var(--radius) 0 0; } .tc-i { border-radius: 0 0 var(--radius) var(--radius); } }

/* ---------- Product: legal line ---------- */
.cover-legal { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-4); max-width: 70ch; }

/* ---------- Product: license gate ---------- */
.gate { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom)); overflow-y: auto; }
.gate[hidden] { display: none; }
body.locked > main, body.locked > header { visibility: hidden; }
body.locked { overflow: hidden; }
.gate-card { margin: auto 0; flex-shrink: 0; width: min(520px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(27,34,37,.10); padding: clamp(1.25rem, 4vw, 2rem); display: flex; flex-direction: column; gap: var(--space-4); }
.gate-brand { display: flex; align-items: center; gap: var(--space-3); }
.gate-kicker { font-weight: 600; font-size: var(--text-sm); }
.gate-card h1 { font-size: var(--text-xl); line-height: 1.15; margin: 0; }
.gate-card p { margin: 0; }
.gate-card form { display: flex; flex-direction: column; gap: var(--space-3); }
.gate-card input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.gate-card .btn-primary { width: 100%; }
.gate-tip { background: var(--target-soft); border-left: 4px solid var(--target); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.gate-setup { background: var(--peer-soft); border-left: 4px solid var(--peer); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.gate-msg { min-height: 1.5em; font-size: var(--text-sm); }
.gate-msg.err { color: var(--neg); }
.gate-foot { display: flex; gap: var(--space-2); justify-content: center; font-size: var(--text-sm); }
.gate-foot a { color: var(--target); }

/* ---------- Product: dialogs ---------- */
.dlg { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: min(640px, calc(100% - 2rem)); max-height: calc(100% - 2rem); background: var(--surface); color: var(--text); box-shadow: 0 20px 48px rgba(27,34,37,.22); }
.dlg::backdrop { background: rgba(27,34,37,.45); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
.dlg-head h2 { margin: 0; }
.dlg-x { border: 0; background: none; font-size: 1.6rem; line-height: 1; width: 44px; height: 44px; cursor: pointer; color: var(--text-muted); }
.dlg-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.dlg-body p { margin: 0; }
.dlg-actions { display: flex; gap: var(--space-3); justify-content: flex-end; flex-wrap: wrap; }
.danger-btn { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, var(--border)); }
.lic-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-4); margin: 0; font-size: var(--text-sm); }
.lic-list dt { color: var(--text-muted); }
.lic-list dd { margin: 0; overflow-wrap: anywhere; }
.inst-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.inst-grid h3 { margin: 0 0 var(--space-1); font-size: var(--text-sm); }
.inst-grid ol { margin: 0; padding-left: 1.2rem; font-size: var(--text-sm); }
@media (max-width: 560px) { .inst-grid { grid-template-columns: minmax(0, 1fr); } .lic-list { grid-template-columns: minmax(0, 1fr); } .lic-list dt { margin-top: var(--space-2); } }

/* ---------- Product: phone coding layout ---------- */
.who-switch, .phone-bar { display: none; }
@media (max-width: 560px) {
  .who-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; grid-column: 1 / -1; position: sticky; top: 0; z-index: 5; }
  .ws-btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border: 0; border-radius: 7px; background: none; font: inherit; font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); cursor: pointer; }
  .ws-btn .who-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--target); }
  .ws-peer .who-dot { background: var(--peer); }
  .ws-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
  .ws-target[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--target), var(--shadow); }
  .ws-peer[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--peer), var(--shadow); }
  .ws-count { color: var(--text-muted); font-weight: 400; }
  body:not(.show-peer) .who-peer, body.show-peer .who-target { display: none; }

  /* Fixed bottom timer on the Observe tab; the in-page timer card is hidden */
  body[data-tab="observe"] .timer-card { display: none; }
  body[data-tab="observe"] .phone-bar { display: flex; }
  body[data-tab="observe"] main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  body[data-tab="observe"] .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
  .phone-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; flex-direction: column; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(27,34,37,.08); }
  .pb-top { display: flex; align-items: baseline; gap: 8px; font-size: var(--text-xs); }
  .pb-int b { font-size: 1rem; }
  .pb-phase { flex: 1; text-align: center; font-weight: 600; }
  .pb-phase.is-e { color: var(--target); }
  .pb-phase.is-i { color: var(--peer); }
  .pb-sec b { font-size: 1rem; font-variant-numeric: tabular-nums; }
  .pb-bar { height: 8px; }
  .pb-btns { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
  .pb-btns .btn { min-width: 0; padding-left: .5rem; padding-right: .5rem; }
}
@media print { .gate, .phone-bar, .who-switch, .dlg { display: none !important; } }
@media (max-width: 560px) { body[data-tab="observe"] .app-header { position: static; } }
.gate-tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); border-top: 1px solid var(--border); padding-top: var(--space-4); }
.tier { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); background: var(--bg); display: flex; flex-direction: column; gap: 2px; }
.tier-name { font-weight: 600; font-size: var(--text-sm); }
.tier-price { font-weight: 700; font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.tier-who { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.35; }
.tier-note { grid-column: 1 / -1; margin: 0; }
@media (max-width: 560px) { .gate-tiers { grid-template-columns: minmax(0, 1fr); } .tier { display: grid; grid-template-columns: 1fr auto; } .tier-who { grid-column: 1 / -1; } }
.tier-link { color: inherit; text-decoration: none; transition: border-color .15s, background .15s; }
.tier-link:hover { border-color: var(--target); background: var(--target-soft); }
.tier-buy { margin-top: var(--space-2); font-size: var(--text-xs); font-weight: 600; color: var(--target); }
@media (max-width: 560px) { .tier-buy { grid-column: 1 / -1; } }
