/* Nights to Release - a countdown calendar of numbered paper doors on a late-night couch: oat paper, ink-blue type, an amber
 * marquee for what you play, a teal stripe for what you recap. Dark mode is the living room with the lights off. */
:root {
  --bg: #f4efe4; --paper: #fffbf2; --ink: #1c2236; --muted: #5b6275; --line: #d9d1bf; --soft: #ece5d5;
  --accent: #b4410f; --accent-ink: #ffffff;
  --play: #f2b33d; --play-ink: #3d2600; --recap: #b9e4dc; --recap-ink: #0d4a42; --recap-stripe: #8fd0c4;
  --skip: #e3dfd6; --skip-ink: #4b4f5c; --star: #8f1d3d; --star-ink: #fff4f6;
  --door: #fffdf8; --door-shut: #efe8d8; --door-edge: #c9bea6;
  --ok: #1d6f45; --warn: #9a3b0a; --info: #39557f;
  --v-thin: #e3dfd6; --v-thin-ink: #343846; --v-all: #cdebd4; --v-all-ink: #14532d; --v-trim: #fde3a7; --v-trim-ink: #5c3a00; --v-long: #f7c9d3; --v-long-ink: #6b1027;
  --shadow: 0 1px 0 rgba(28, 34, 54, 0.08), 0 6px 18px rgba(28, 34, 54, 0.07);
  --mono: ui-monospace, Menlo, Consolas, monospace; --panel: var(--paper);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1220; --paper: #181c2d; --ink: #ece6d6; --muted: #a7aabb; --line: #2e3450; --soft: #23283d;
  --accent: #ff9a5c; --accent-ink: #1a0e05;
  --play: #6a4a0e; --play-ink: #ffe2a3; --recap: #11423d; --recap-ink: #b8f0e6; --recap-stripe: #1b5a52;
  --skip: #2a2f44; --skip-ink: #c4c7d4; --star: #c23a5f; --star-ink: #fff4f6;
  --door: #1e2336; --door-shut: #151929; --door-edge: #3a415e;
  --ok: #7fd9a3; --warn: #ffb27f; --info: #a6c4ff;
  --v-thin: #2f3448; --v-thin-ink: #e3e5ee; --v-all: #173d27; --v-all-ink: #c9f2d6; --v-trim: #4d3a10; --v-trim-ink: #ffe3a3; --v-long: #4f1a2a; --v-long-ink: #ffd3dd;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.45), 0 6px 18px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
a { color: var(--accent); }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 0.86rem; } .muted { color: var(--muted); } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
h1, h2, h3, .serif { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }

/* Header */
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); flex-wrap: wrap; }
.back { text-decoration: none; font-size: 0.9rem; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.logo { width: 26px; height: 26px; }
.lg-door { fill: var(--door); stroke: var(--ink); stroke-width: 1.3; }
.lg-star { fill: var(--star); stroke: var(--ink); stroke-width: 1.3; }
.session { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); border-radius: 6px; padding: 5px 12px; font: inherit; font-size: 0.88rem; cursor: pointer; text-decoration: none; }
.pill:hover { background: var(--soft); }
.pill.solid { background: var(--ink); color: var(--paper); }
.pill.solid:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill.ghost { border-style: dashed; cursor: default; }
.pill.tiny { padding: 3px 9px; font-size: 0.8rem; }
.pill:disabled { opacity: 0.45; cursor: not-allowed; }

main { max-width: 1180px; margin: 0 auto; padding: 0 16px 40px; }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 22px; align-items: center; padding: 26px 0 18px; }
.kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.76rem; color: var(--accent); margin: 0 0 4px; font-weight: 700; }
h1 { font-size: clamp(2.2rem, 6.5vw, 3.6rem); line-height: 1.02; margin: 0 0 10px; letter-spacing: -0.01em; font-weight: 700; }
.lede { margin: 0 0 14px; max-width: 62ch; }
.samples { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 0.86rem; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip.on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.hero-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 360px; justify-self: end; width: 100%; }
.mini { aspect-ratio: 1; display: grid; place-items: start; padding: 6px 8px; border: 1px solid var(--door-edge); border-radius: 6px; background: var(--door-shut); font: 700 1.1rem/1 "Iowan Old Style", Georgia, serif; color: var(--muted); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.05); }
.miniopen { background: var(--play); color: var(--play-ink); border-color: var(--ink); }
.ministar { background: var(--star); color: var(--star-ink); border-color: var(--ink); place-items: center; font-size: 1.5rem; grid-column: span 2; aspect-ratio: auto; }

/* Inputs */
.layout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.checkbox { grid-column: span 2; } .askbox { grid-column: span 1; }
.ph { margin: 0 0 10px; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.num-tag { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 4px; border: 1px solid var(--ink); background: var(--door); color: var(--ink); font: 700 0.9rem/1 Georgia, serif; flex: none; }
.lbl { display: block; font-size: 0.86rem; font-weight: 600; margin: 10px 0 4px; }
textarea, input[type="text"], input[type="date"], input[type="number"], select { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: inherit; background: var(--bg); color: var(--ink); min-width: 0; }
textarea { resize: vertical; }
#entries { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.86rem; }
textarea:focus, select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.dropping { border-color: var(--accent); border-style: dashed; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.filerow { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.filebtn { cursor: pointer; }
.wc { margin: 8px 0 0; }

/* Verdict */
.lean { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.lean-l { display: flex; flex-direction: column; gap: 4px; max-width: 62ch; min-width: 0; }
.lean-r { display: flex; gap: 8px; flex-wrap: wrap; }
.lean-r div { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 4px 12px; min-width: 76px; background: var(--door); }
.lean-r b { font: 700 1.35rem/1.15 Georgia, serif; }
.lean-r span { font-size: 0.72rem; color: var(--muted); text-align: center; }
.badge { display: inline-block; align-self: flex-start; border-radius: 4px; padding: 3px 10px; font-weight: 800; font-size: 0.88rem; border: 1px solid var(--ink); background: var(--soft); color: var(--ink); }
.badge.v-thin { background: var(--v-thin); color: var(--v-thin-ink); }
.badge.v-all-in { background: var(--v-all); color: var(--v-all-ink); }
.badge.v-trim { background: var(--v-trim); color: var(--v-trim-ink); }
.badge.v-long-shot { background: var(--v-long); color: var(--v-long-ink); }
.flags { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.flags li { font-size: 0.88rem; display: flex; gap: 8px; align-items: baseline; }
.lv { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; border-radius: 3px; padding: 1px 6px; flex: none; background: var(--soft); color: var(--ink); }
.lv-warn .lv { background: var(--v-trim); color: var(--v-trim-ink); }
.lv-info .lv { background: var(--v-thin); color: var(--v-thin-ink); }
.rules { margin: 10px 0 0; }

/* Ask */
.note { background: var(--soft); border-left: 3px solid var(--info); padding: 6px 10px; border-radius: 4px; font-size: 0.88rem; margin: 0 0 8px; }
.note.warn { border-left-color: var(--warn); }
.go { width: 100%; border: 1px solid var(--ink); background: var(--accent); color: var(--accent-ink); font-family: inherit; font-weight: 700; font-size: 1.05rem; line-height: 1.2; padding: 12px 14px; border-radius: 8px; cursor: pointer; }
.go:hover:not(:disabled) { filter: brightness(1.08); }
.go:disabled { opacity: 0.5; cursor: not-allowed; }
.meter { margin: 8px 0 0; }
.gate { font-size: 0.88rem; margin: 8px 0 6px; }

/* Progress */
.progress { margin-top: 14px; }
.stages { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 3px; }
.stage { font-size: 0.9rem; color: var(--muted); }
.stage.active { color: var(--ink); font-weight: 700; }
.stage.done { color: var(--ok); }
.stage-ic { display: inline-block; width: 16px; font-family: ui-monospace, Menlo, monospace; }
.raw { white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; font-size: 0.8rem; background: var(--bg); padding: 10px; border-radius: 6px; }

/* Result */
.result { margin-top: 16px; background: var(--paper); border: 1px solid var(--ink); border-radius: 10px; padding: 16px; box-shadow: var(--shadow); }
.rhead h2 { margin: 6px 0 6px; font-size: clamp(1.35rem, 4vw, 1.9rem); line-height: 1.15; overflow-wrap: anywhere; }
.summary { margin: 0 0 10px; max-width: 75ch; }
.picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.pick { margin: 0; border: 1px dashed var(--door-edge); border-radius: 6px; padding: 8px 10px; background: var(--door); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pick-k { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.pick b { overflow-wrap: anywhere; }
.pacing { margin: 6px 0 0; padding: 8px 12px; background: var(--soft); border-radius: 6px; }
.askfirst { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
.asks { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.askq label { display: block; font-size: 0.92rem; margin-bottom: 3px; }
.askIn { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font: inherit; background: var(--bg); color: var(--ink); }
.afterword { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
.afterword h3, .askfirst h3 { margin: 0 0 6px; font-size: 1.02rem; }
.recon { margin: 0 0 6px; padding-left: 18px; font-size: 0.9rem; }
.recon .warn { color: var(--warn); } .recon .info { color: var(--info); }
.none { color: var(--muted); font-style: italic; list-style: none; }

/* The countdown */
.calbox, .listpanel, .exports, .history { margin-top: 16px; }
.calhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.calhead .ph { margin-bottom: 4px; }
#calSummary { margin: 0; font-weight: 600; }
#calSource { margin: 0 0 10px; }
.doors { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.door { position: relative; min-height: 112px; border: 1px solid var(--door-edge); border-radius: 6px; padding: 6px 8px 10px; background: var(--door); display: flex; flex-direction: column; gap: 4px; overflow: hidden; min-width: 0; }
.door.shut { background: var(--door-shut); border-style: dashed; }
.door.open { border-color: var(--ink); box-shadow: var(--shadow); }
.door-top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.door-n { font: 700 1.35rem/1 "Iowan Old Style", Georgia, serif; }
.door-d { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.door-free { margin: auto 0; font-size: 0.8rem; color: var(--muted); font-style: italic; }
.door-fill { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); opacity: 0.75; }
.segs { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.seg { border-radius: 4px; padding: 3px 6px; font-size: 0.78rem; line-height: 1.25; display: flex; flex-direction: column; min-width: 0; }
.seg-t { font-weight: 700; overflow-wrap: anywhere; }
.seg-m { font-size: 0.72rem; }
.seg.c-play { background: var(--play); color: var(--play-ink); }
.seg.c-recap { background: repeating-linear-gradient(135deg, var(--recap), var(--recap) 6px, var(--recap-stripe) 6px, var(--recap-stripe) 12px); color: var(--recap-ink); }
.door.star { background: var(--star); color: var(--star-ink); border-color: var(--ink); grid-column: span 2; }
.door.star .door-d { color: var(--star-ink); opacity: 0.9; }
.star-t { margin: auto 0 0; font: 700 1.1rem/1.2 "Iowan Old Style", Georgia, serif; overflow-wrap: anywhere; }
.star-s { margin: 0; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em; }
.door.more { display: grid; place-items: center; color: var(--muted); font-style: italic; }
.door-empty { color: var(--muted); font-style: italic; grid-column: 1 / -1; }
.trayrow { margin-top: 12px; }
.trayrow h3 { margin: 0 0 4px; font-family: inherit; }
.tray { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tray .seg { max-width: 260px; }
.legend { margin: 10px 0 0; }
.key { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--ink); vertical-align: -2px; margin: 0 2px 0 6px; }
.k-play { background: var(--play); }
.k-recap { background: repeating-linear-gradient(135deg, var(--recap), var(--recap) 3px, var(--recap-stripe) 3px, var(--recap-stripe) 6px); }

/* The list as tickets */
.tickets { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.ticket { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 0; border: 1px solid var(--door-edge); border-radius: 8px; background: var(--door); overflow: hidden; align-items: stretch; }
.ticket.t-skip { opacity: 0.72; }
.stub { display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 2px dashed var(--door-edge); padding: 6px 4px; background: var(--soft); }
.stub-n { font: 700 1.4rem/1 Georgia, serif; }
.stub-k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.tbody { padding: 8px 12px; min-width: 0; }
.tbody p { margin: 0 0 2px; }
.t-title { overflow-wrap: anywhere; }
.t-meta { color: var(--muted); overflow-wrap: anywhere; }
.t-why { font-size: 0.92rem; }
.t-focus { color: var(--recap-ink); background: var(--recap); border-radius: 4px; padding: 3px 6px; margin-top: 4px !important; }
.t-pick { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--accent); color: var(--ink); font-size: 0.74rem; font-weight: 700; vertical-align: 1px; white-space: nowrap; }
.t-find { display: inline-block; margin-top: 4px; }
.flags li.past { flex-wrap: wrap; align-items: center; }
.call { align-self: center; margin: 8px 10px; min-width: 72px; border-radius: 999px; border: 1px solid var(--ink); font-family: inherit; font-weight: 700; font-size: 0.86rem; line-height: 1; padding: 8px 12px; cursor: pointer; }
.call.c-play { background: var(--play); color: var(--play-ink); }
.call.c-recap { background: var(--recap); color: var(--recap-ink); }
.call.c-skip { background: var(--skip); color: var(--skip-ink); }
.call.mine { outline: 2px dashed var(--accent); outline-offset: 2px; }

/* Exports, history, footer, toasts */
.exports h3, .history h3 { margin: 0 0 8px; }
.cardrow { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.hlist { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.hrow { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; flex-wrap: wrap; }
.hinfo { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hinfo b { overflow-wrap: anywhere; }
.foot { max-width: 1180px; margin: 0 auto; padding: 18px 16px 40px; font-size: 0.86rem; color: var(--muted); border-top: 1px solid var(--line); }
.toasts { position: fixed; right: 14px; bottom: 14px; display: grid; gap: 6px; z-index: 50; max-width: min(380px, calc(100vw - 28px)); }
.toast { background: var(--ink); color: var(--paper); padding: 9px 12px; border-radius: 6px; font-size: 0.9rem; box-shadow: var(--shadow); transition: opacity .4s; }
.toast.err { background: var(--star); color: var(--star-ink); }
.toast a { color: inherit; font-weight: 700; }
.toast.gone { opacity: 0; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .checkbox { grid-column: 1 / -1; } .askbox { grid-column: 1 / -1; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-strip { justify-self: start; }
}
@media (max-width: 620px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .picks { grid-template-columns: minmax(0, 1fr); }
  .doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .door.star { grid-column: 1 / -1; }
  .ticket { grid-template-columns: 48px minmax(0, 1fr); }
  .call { grid-column: 1 / -1; justify-self: end; margin: 0 10px 8px; }
  .hero-strip { max-width: 260px; }
  .bar { gap: 8px; }
}
