/* Time Use Charts — styled after the salmon newsprint of Indian business dailies' data pages (Mint, after the FT):
   warm paper, black serif headlines, a newspaper-red accent, hairline rules. Dark theme is the same paper at night.
   One token set via light-dark(). The .poster block is also used by the offline renderer: keep it self-contained. */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f7e6d9, #15110f);
  --paper: light-dark(#fdf3eb, #1e1916);
  --paper-2: light-dark(#f1dccd, #2a221e);
  --rule: light-dark(#d9bfae, #43372f);
  --ink: light-dark(#1f1a17, #f3e9e1);
  --muted: light-dark(#6b574b, #bba99c);
  --red: light-dark(#b8321b, #ff7a5c);
  --red-ink: light-dark(#fff, #1c0d08);
  --teal: light-dark(#0f6b66, #5ccfc4);
  --ok: light-dark(#1d6e40, #6fd79b);
  --warn: light-dark(#8a5300, #ffc566);
  --focus: light-dark(#0b5fd1, #8ec5ff);
  --r: 4px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Instrument Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  font: 16px/1.5 var(--sans);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.1; margin: 0 0 .5rem; text-wrap: balance; font-optical-sizing: auto; }
h1 { font-size: clamp(1.9rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font: 700 .78rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--red); margin: 1rem 0 .4rem; }
p { margin: 0 0 .75rem; text-wrap: pretty; }
a { color: var(--red); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: .86rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--paper); padding: .5rem 1rem; }
[hidden] { display: none !important; }

/* ---------- masthead ---------- */
.topbar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center;
  padding: .55rem clamp(1rem, 3vw, 2rem); background: color-mix(in oklch, var(--bg) 90%, transparent); backdrop-filter: blur(8px);
  border-bottom: 3px double var(--ink); }
.brand { display: flex; gap: .6rem; align-items: center; color: var(--ink); text-decoration: none; }
.brand strong { display: block; font: 800 1.25rem/1 var(--serif); letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.brand svg { width: 2.2rem; height: 2.2rem; flex: none; }
.stage { justify-self: center; display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; justify-content: center; text-align: center; }
.stage-name { font: 700 .8rem/1 var(--sans); text-transform: uppercase; letter-spacing: .1em; padding: .35rem .6rem; border: 1px solid var(--ink); }
.stage[data-stage="create"] .stage-name { background: var(--red); color: var(--red-ink); border-color: transparent; }
.stage[data-stage="grace"] .stage-name, .stage[data-stage="closed"] .stage-name { background: var(--ink); color: var(--bg); }
.countdown { font: 700 clamp(1.5rem, 4vw, 2.2rem)/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.stage[data-urgent] .countdown { color: var(--red); animation: pulse 1s steps(2) infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.stage-sub { color: var(--muted); font-size: .82rem; }
.top-tools { display: flex; gap: .5rem; align-items: center; }
.icon-btn { font: inherit; background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r); width: 2.4rem; height: 2.4rem; cursor: pointer; }
.link { width: .7rem; height: .7rem; border-radius: 50%; background: var(--muted); }
.link[data-state="open"] { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in oklch, var(--ok) 25%, transparent); }
.link[data-state="reconnecting"], .link[data-state="connecting"] { background: var(--warn); animation: pulse 1s steps(2) infinite; }
.link[data-state="closed"] { background: var(--red); }
.timeline { position: relative; height: 8px; margin: 0 clamp(1rem, 3vw, 2rem); display: flex; }
.timeline .seg-bar { height: 100%; background: var(--paper-2); border-right: 2px solid var(--bg); }
.timeline .seg-bar.create { background: color-mix(in oklch, var(--red) 40%, var(--paper-2)); }
.timeline .seg-bar.past { opacity: .4; }
.timeline .now { position: absolute; top: -4px; width: 3px; height: 16px; background: var(--ink); translate: -1px 0; transition: left 1s linear; }
.help-line { margin: .5rem clamp(1rem, 3vw, 2rem) 0; color: var(--muted); font-size: .9rem; text-align: center; }

main { padding: 1rem clamp(1rem, 3vw, 2rem) 3rem; max-width: 1480px; margin: 0 auto; outline: none; }
.card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); padding: 1rem 1.15rem; }
.screen > *, .room-main > *, .side > * { animation: rise .45s ease backwards; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; translate: 0 10px; } }
@media (prefers-reduced-motion: reduce) { *, ::before, ::after { animation: none !important; transition: none !important; } }

.btn { font: inherit; font-weight: 700; padding: .55rem 1rem; border-radius: var(--r); border: 1px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; }
.btn:hover:not(:disabled) { background: var(--paper-2); }
.btn.primary { background: var(--red); color: var(--red-ink); border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: color-mix(in oklch, var(--red) 85%, var(--ink)); }
.btn.big { font-size: 1.05rem; padding: .75rem 1.3rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.chip { font: inherit; font-size: .82rem; padding: .25rem .6rem; border-radius: 99px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .15rem .5rem; border: 1px solid currentColor; border-radius: 99px; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.red { color: var(--red); }
label { display: block; font-weight: 700; font-size: .9rem; margin: .7rem 0 .25rem; }
/* One look for every field (inputs, textareas and selects share box, height and font). */
input:not([type="radio"], [type="checkbox"], [type="file"]), textarea, select { font: inherit; width: 100%; min-height: 2.6rem; padding: .55rem .7rem; border: 1px solid var(--rule); border-radius: var(--r); background-color: light-dark(#fffaf6, #120e0c); color: var(--ink); }
select { appearance: none; padding-right: 2.2rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) 52%, calc(100% - .8rem) 52%; background-size: .35rem .35rem; background-repeat: no-repeat; }
/* A button paragraph right after fields gets breathing room. */
p:has(> .btn:first-child) { margin-top: .9rem; }
textarea { resize: vertical; min-height: 4.5rem; line-height: 1.45; }
input:read-only, textarea:read-only { background: var(--paper-2); color: var(--muted); }
.count { float: right; font: 500 .75rem var(--mono); color: var(--muted); }
.count[data-over] { color: var(--red); }
.note { min-height: 1.4em; font-size: .9rem; color: var(--muted); margin: .5rem 0 0; }
.note.good { color: var(--ok); } .note.bad { color: var(--red); font-weight: 700; }

/* ---------- sessions, lobby ---------- */
.hero { max-width: 56rem; margin: 1.5rem 0 1.5rem; }
.hero h1 span { color: var(--red); font-style: italic; font-weight: 600; }
.lede { font-size: 1.12rem; max-width: 48rem; }
.sessions { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.session .when { font: 700 1.25rem/1.2 var(--serif); margin: .4rem 0 .1rem; }
.session .local { color: var(--muted); font-size: .85rem; margin-bottom: .7rem; }
.brief { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); margin-top: 1rem; }
.theme-card { border-top: 4px solid var(--red); }
.theme-card .kicker { font: 700 .75rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.theme-card h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); margin: .35rem 0 .3rem; }
.theme-card .hook { font: italic 500 1.12rem/1.4 var(--serif); }
.theme-card ul, .rules ul, .rules ol { padding-left: 1.2rem; margin: .3rem 0 .8rem; }
.theme-card li, .rules li { margin: .25rem 0; }
.brief > :last-child { grid-column: 1 / -1; }
.all-themes { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); padding: 0; list-style: none; }
.all-themes li { border-left: 3px solid var(--rule); padding-left: .6rem; }
.all-themes li[data-mine] { border-color: var(--red); }
.all-themes b { font-family: var(--serif); }
.lobby-clock { display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; font-size: 1.05rem; }
.lobby-clock time { font: 700 1.8rem var(--mono); }

/* ---------- room ---------- */
.room { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) 22rem; align-items: start; }
.room-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; min-width: 0; }
.side { display: grid; gap: 1rem; position: sticky; top: 5.5rem; }
.banner { background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: var(--r); margin-bottom: 1rem; font-weight: 700; }
.members { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.members li { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center; }
.avatar { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; font: 800 .9rem var(--serif); background: var(--paper-2); border: 2px solid var(--rule); }
.members li[data-online] .avatar { border-color: var(--ok); }
.members .you { font-weight: 700; }
.role-help { font-size: .86rem; color: var(--muted); }

.ideas { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.idea { position: relative; border: 1px solid var(--rule); border-radius: var(--r); padding: .9rem 1rem 1rem; background: var(--paper); display: flex; flex-direction: column; gap: .5rem; }
.idea .by { font: 700 .74rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.idea blockquote { margin: 0; font: 500 1.08rem/1.4 var(--serif); flex: 1; overflow-wrap: anywhere; }
.idea[data-mine-vote] { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.idea[data-chosen] { border-color: var(--ok); box-shadow: inset 0 0 0 2px var(--ok); }
.voters { display: flex; gap: .3rem; flex-wrap: wrap; min-height: 1.6rem; }
.voters span { font-size: .75rem; font-weight: 700; padding: .1rem .45rem; border-radius: 99px; background: var(--ink); color: var(--bg); }
.consensus { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.consensus .state { font: 700 1.05rem var(--serif); }

.studio { display: grid; gap: 1rem; grid-template-columns: minmax(16rem, 30rem) minmax(0, 1fr); align-items: start; }
.studio-poster { position: sticky; top: 5.5rem; display: grid; gap: .5rem; }
.drop { border: 2px dashed var(--rule); border-radius: var(--r); padding: .9rem; text-align: center; }
.drop[data-over] { border-color: var(--red); background: color-mix(in oklch, var(--red) 8%, transparent); }
.drop input[type="file"] { width: auto; max-width: 100%; border: 0; padding: 0; background: none; }
.fields-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.approve-box { border-top: 4px solid var(--ink); }
.approvals { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0 .7rem; }
.approvals span { font-size: .8rem; padding: .15rem .5rem; border: 1px solid var(--rule); border-radius: 99px; }
.approvals span[data-ok] { border-color: var(--ok); color: var(--ok); font-weight: 700; }
.fit-warn { color: var(--red); font-weight: 700; font-size: .9rem; }

/* ---------- chat ---------- */
.chat { display: grid; grid-template-rows: auto 1fr auto; max-height: calc(100vh - 13rem); min-height: 16rem; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.chat-toggle { display: none; }
.messages { list-style: none; margin: 0; padding: 0 .2rem 0 0; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; min-height: 6rem; }
.messages li { border-left: 3px solid var(--rule); padding-left: .55rem; overflow-wrap: anywhere; }
.messages li.mine-msg { border-color: var(--red); }
.messages .who { font-weight: 700; font-size: .82rem; } .messages time { color: var(--muted); font: .72rem var(--mono); margin-left: .4rem; }
.messages li.system { border: 0; color: var(--muted); font-size: .85rem; font-style: italic; }
.chat-form { display: flex; gap: .4rem; margin-top: .6rem; }
.badge { font-size: .7rem; background: var(--red); color: var(--red-ink); border-radius: 99px; padding: 0 .4rem; vertical-align: middle; }
.receipt-box textarea { font: .8rem var(--mono); }

@media (max-width: 1100px) { .studio { grid-template-columns: minmax(0, 1fr); } .studio-poster { position: static; max-width: 30rem; } }
@media (max-width: 960px) {
  .room { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .chat { position: fixed; inset: auto 0 0 0; z-index: 6; max-height: 70vh; min-height: 0; border-radius: 0; border-width: 3px 0 0; border-top-color: var(--ink); }
  .chat:not([data-open]) .messages, .chat:not([data-open]) .chat-form { display: none; }
  .chat-toggle { display: inline-block; }
  main { padding-bottom: 6rem; }
}
@media (max-width: 640px) { .topbar { grid-template-columns: auto 1fr; } .stage { grid-column: 1 / -1; grid-row: 2; } .brand small { display: none; } }

/* ---------- the poster (1080 × 1350 design pixels; every length is in --px) ---------- */
.poster { container-type: inline-size; position: relative; width: 100%; aspect-ratio: 1080 / 1350; overflow: hidden; margin: 0;
  background: #fff; color: #1d1a16; box-shadow: 0 1px 0 var(--rule), 0 10px 30px -18px #0008; }
.poster > * { --px: calc(100cqw / 1080); position: absolute; }
.poster-img { inset: 0; width: 100%; height: 100%; display: block; }
.poster-guides { inset: 0; background: linear-gradient(#fbeee4 0 25.2%, transparent 25.2% 77.8%, #fbeee4 77.8%); }
.poster-guides::after { content: "Chart area · 1080 × 1350 px"; position: absolute; inset: 26.7% 5.9% 23.7%; display: grid; place-items: center;
  border: calc(2 * var(--px)) dashed #9b8b80; color: #9b8b80; font: 700 calc(34 * var(--px)) var(--sans); text-align: center; }
.poster-top { left: calc(64 * var(--px)); right: calc(64 * var(--px)); top: calc(56 * var(--px)); height: calc(270 * var(--px)); }
.poster-bottom { left: calc(64 * var(--px)); right: calc(64 * var(--px)); top: calc(1062 * var(--px)); height: calc(252 * var(--px));
  display: flex; flex-direction: column; justify-content: flex-end; }
.poster p, .poster h2 { margin: 0; overflow: hidden; overflow-wrap: anywhere; text-shadow: 0 0 calc(5 * var(--px)) #fffd, 0 0 calc(2 * var(--px)) #fff; }
.p-title { font: 700 calc(56 * var(--px)) / 1.04 var(--serif); letter-spacing: -.015em; max-height: calc(2 * 1.04 * 56 * var(--px)); text-wrap: balance; color: #16120f; }
.p-subtitle { margin-top: calc(16 * var(--px)) !important; font: 500 calc(27 * var(--px)) / 1.3 var(--sans); max-height: calc(3 * 1.3 * 27 * var(--px)); color: #3b312b; }
.p-narrative { font: 400 calc(26 * var(--px)) / 1.3 var(--sans); max-height: calc(6 * 1.3 * 26 * var(--px)); color: #1d1a16; }
.p-source { margin-top: calc(10 * var(--px)) !important; font: 600 calc(17 * var(--px)) / 1.2 var(--sans); color: #6b5a50; letter-spacing: .02em; flex: none; }
.poster [data-placeholder] { color: #b9a597; font-style: italic; }
.pill + .pill { margin-left: .35rem; }

/* ---------- your role (always at the top of the room) ---------- */
.role-card { border-left: 6px solid var(--red); display: grid; gap: .2rem; }
.role-card .kicker { font: 700 .75rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.role-card h2 { font-size: clamp(1.9rem, 4vw, 2.6rem); color: var(--red); margin: .1rem 0 .3rem; }
.role-card ul { margin: 0 0 .5rem; padding-left: 1.2rem; font-size: 1.02rem; }
.role-card li { margin: .15rem 0; }
.warn-line { border-left: 3px solid var(--warn); padding: .35rem 0 .35rem .7rem; background: color-mix(in oklch, var(--warn) 10%, transparent); margin: .5rem 0 .75rem; }
.stage[data-stage="approve"] .stage-name { background: var(--warn); color: light-dark(#fff, #1c1205); border-color: transparent; }
.approve-box[data-last-call] { border-color: var(--warn); box-shadow: 0 0 0 3px color-mix(in oklch, var(--warn) 40%, transparent); }
.idea blockquote.blank { color: var(--muted); font-style: italic; font-size: .95rem; }
