/* Tokens from src/theme/tokens.ts and CONCEPT.md 5.2-5.5, same as the website */
@font-face { font-family: Playfair; src: url(assets/PlayfairDisplay-Italic.ttf) format('truetype'); font-style: italic; font-display: swap; }
@font-face { font-family: Jakarta; src: url(assets/jakarta-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Jakarta; src: url(assets/jakarta-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
:root {
  --void: #0A090C; --blush: #F2DADA; --gold: #C5A880; --muted: #B3A6AB; --danger: #E46A7A;
  --hair: rgba(242,218,218,.12); --paper: #1A1418; --gold-wash: rgba(197,168,128,.12); --ink: #17120d;
  --x: 20px; --section: 24px; --gap: 10px; --pad: 16px; --max: 560px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --tabs: 58px;
}
* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--void); -webkit-text-size-adjust: 100%; }
body { background: var(--void); color: var(--blush); font: 400 15px/22px Jakarta, system-ui, sans-serif; }
button, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--gold); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: var(--section) var(--x) calc(var(--safe-b) + var(--section)); display: grid; gap: var(--section); min-width: 0; }
.group { display: grid; gap: var(--gap); min-width: 0; }
.l { font: italic 400 34px/40px Playfair, serif; text-wrap: balance; }
.sub { font: italic 400 24px/30px Playfair, serif; text-wrap: balance; }
.label { font-size: 13px; line-height: 18px; color: var(--muted); }
.small { font-size: 12px; line-height: 16px; color: var(--muted); }
.eyebrow { font-weight: 600; font-size: 11px; line-height: 16px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
.strong { font-weight: 600; }
.error { color: var(--danger); font-size: 13px; line-height: 18px; }

.card { background: var(--paper); border: 1px solid var(--hair); border-radius: 16px; padding: var(--pad); display: grid; gap: var(--gap); min-width: 0; }
.card.gold { border-color: var(--gold); background: linear-gradient(var(--gold-wash), var(--gold-wash)), var(--paper); }
.banner { border: 1px solid var(--gold); border-radius: 12px; padding: 10px var(--pad); font-size: 13px; line-height: 18px; }

.btn { min-height: 48px; padding: 0 var(--pad); border-radius: 999px; border: 1px solid var(--hair); font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; text-align: center; }
a.btn { color: var(--text, inherit); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn.yes { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.gone { color: var(--danger); border-color: rgba(228,106,122,.4); }
.btn[disabled] { opacity: .5; }
.row2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--gap); }
.row2.even { grid-template-columns: 1fr 1fr; }

/* Frame: tabs on top, chapters left on the desktop and as a swipeable row on the phone */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--section); padding: var(--safe-t) var(--x) 0; background: rgba(10,9,12,.94); border-bottom: 1px solid var(--hair); backdrop-filter: blur(12px); overflow-x: auto; scrollbar-width: none; }
.top::-webkit-scrollbar, .subnav::-webkit-scrollbar { display: none; }
.brand { display: none; font: italic 400 18px/24px Playfair, serif; color: var(--gold); text-decoration: none; white-space: nowrap; }
.tabs { display: flex; gap: 2px; }
.tabs a { display: flex; align-items: center; gap: 6px; height: 50px; padding: 0 12px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; box-shadow: inset 0 -2px 0 transparent; }
.tabs a[aria-current="true"] { color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); }
.count { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold-wash); color: var(--gold); font-size: 11px; line-height: 18px; font-weight: 600; text-align: center; }
.subnav { display: flex; gap: 6px; padding: var(--gap) var(--x); overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--hair); }
.subnav a { flex: none; display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--hair); font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; }
.subnav a[aria-current="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.subnav a[aria-current="true"] .count { background: rgba(23,18,13,.16); color: var(--ink); }
.side { display: none; }
.shell { display: block; }

/* Home */
.home-grid { display: grid; gap: var(--section); min-width: 0; }
.rows { display: grid; border-top: 1px solid var(--hair); }
.rowline { display: flex; align-items: center; gap: var(--gap); min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--hair); min-width: 0; }
.rowlink { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; min-height: 44px; }
.rowlink .when { flex: none; width: 74px; font-size: 12px; line-height: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rowlink .text { flex: 1; min-width: 0; display: grid; gap: 1px; }
a.rowlink:hover .strong { color: var(--gold); }
.check { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--hair); color: var(--muted); font-size: 15px; }
.check:hover { border-color: var(--gold); color: var(--gold); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap); }
.kpis a { color: inherit; text-decoration: none; }
a.tile:hover, a.area:hover { border-color: var(--gold); }
.areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--gap); }
.area { display: grid; gap: 3px; padding: 12px var(--pad); border: 1px solid var(--hair); border-radius: 12px; color: inherit; text-decoration: none; align-content: start; }

/* Week */
.days { display: grid; border-top: 1px solid var(--hair); }
.day { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 10px 0; border-bottom: 1px solid var(--hair); text-align: left; min-height: 96px; }
.day.letter { grid-template-columns: 1fr auto; min-height: 64px; }
.day img, .day .noimg { width: 56px; height: 78px; object-fit: cover; border-radius: 8px; background: var(--paper); display: block; }
.day .text { min-width: 0; display: grid; gap: 2px; }
.day .caption { font-size: 13px; line-height: 18px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chip { min-width: 44px; min-height: 28px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--hair); font-size: 12px; line-height: 18px; font-weight: 600; color: var(--muted); text-align: center; white-space: nowrap; }
.chip.on { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.chip.warn { color: var(--danger); border-color: rgba(228,106,122,.5); }
.chip.line { color: var(--gold); border-color: var(--gold); }

/* One post */
.sheet { position: fixed; inset: 0; z-index: 10; background: var(--void); display: flex; flex-direction: column; padding-top: var(--safe-t); padding-bottom: var(--safe-b); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); padding: 4px var(--pad); }
.close { width: 44px; height: 44px; font-size: 20px; color: var(--muted); }
.player { flex: 1; min-height: 120px; background: #000; }
.player video { width: 100%; height: 100%; object-fit: contain; display: block; }
.sheet-body { padding: 12px var(--pad) var(--pad); display: grid; gap: var(--gap); max-width: var(--max); width: 100%; margin: 0 auto; max-height: 56vh; overflow: auto; }
.caption-full { font-size: 13px; line-height: 18px; white-space: pre-line; }
.caption-full.open { max-height: none; }
.caption-clip { max-height: 72px; overflow: hidden; }
textarea { width: 100%; min-height: 76px; resize: vertical; background: var(--paper); border: 1px solid var(--hair); border-radius: 12px; padding: 10px 12px; font-size: 16px; line-height: 22px; }
textarea:focus { border-color: var(--gold); outline: 0; }

/* Numbers */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap); }
.tile { background: var(--paper); border: 1px solid var(--hair); border-radius: 12px; padding: 12px var(--pad); display: grid; gap: 2px; align-content: start; }
.num { font: italic 400 29px/35px Playfair, serif; font-variant-numeric: tabular-nums; }
.goal { height: 8px; border-radius: 4px; background: var(--hair); overflow: hidden; }
.goal i { display: block; height: 100%; min-width: 4px; border-radius: 4px; background: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--hair); font-size: 13px; font-weight: 600; color: var(--muted); }
.pick[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-wash); color: var(--gold); }
.chart { display: grid; gap: 6px; }
.chart svg { width: 100%; height: 150px; display: block; touch-action: pan-y; }
.chart .read { min-height: 18px; font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; width: 100%; }
th, td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--hair); text-align: right; white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 12px; }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 130px; }
.bars { display: grid; gap: 8px; }
.barline { display: grid; gap: 4px; font-size: 13px; line-height: 18px; }
.barline .top { display: flex; justify-content: space-between; gap: 12px; }
.barline .top span:last-child { font-variant-numeric: tabular-nums; color: var(--muted); }
.list { display: grid; }
.list > * { padding: 10px 0; border-bottom: 1px solid var(--hair); display: grid; gap: 2px; min-width: 0; }
.list > *:last-child { border-bottom: 0; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; font-weight: 600; }
details summary::-webkit-details-marker { display: none; }
.pre { white-space: pre-line; font-size: 14px; line-height: 21px; }
.field { display: grid; gap: 4px; font-size: 13px; line-height: 18px; }

.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: var(--section); max-width: 360px; margin: 0 auto; padding: var(--x); }
.login input { width: 100%; height: 52px; background: var(--paper); border: 1px solid var(--hair); border-radius: 12px; color: var(--blush); text-align: center; font-size: 20px; letter-spacing: .3em; }
.login input:focus { border-color: var(--gold); outline: 0; }
.login form { display: grid; gap: var(--gap); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } .btn:active { transform: none; } }

.error:empty { display: none; }

@media (min-width: 900px) {
  .brand { display: block; }
  .top { padding-left: var(--section); padding-right: var(--section); }
  .subnav { display: none; }
  .shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: calc(100dvh - 51px); }
  .shell.solo { grid-template-columns: minmax(0, 1fr); }
  .side:not([hidden]) { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 51px; align-self: start; height: calc(100dvh - 51px); padding: 18px 10px; border-right: 1px solid var(--hair); overflow-y: auto; }
  .side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 10px; font-size: 14px; color: var(--muted); text-decoration: none; }
  .side a:hover { color: var(--blush); }
  .side a[aria-current="true"] { background: var(--gold-wash); color: var(--gold); font-weight: 600; }
  .side .source { margin-top: auto; padding: 14px 12px 4px; }
  .wrap { max-width: 1080px; margin: 0; padding: 28px 32px 48px; width: 100%; }
  .shell.solo .wrap { margin: 0 auto; }
  .home-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; align-items: start; }
  /* One post: video left, decision right */
  .sheet:has(.player) { display: grid; grid-template-columns: minmax(0, 1fr) 420px; grid-template-rows: auto minmax(0, 1fr); }
  .sheet:has(.player) .sheet-head { grid-column: 1 / -1; }
  .sheet:has(.player) .sheet-body { max-height: none; align-content: start; }
}
