/* Inferno: report a problem. DESIGN.md has the reasons behind what is here.
   Layers, lowest first: page, rail (sticky), bar (30), sparks canvas (40), dialog (top layer). */

@font-face { font-family: "Archivo"; src: url("fonts/archivo.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }

/* How much of the report is filled in, 0 to 1. The emblem and the small ring read it. */
@property --p { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  color-scheme: dark;
  --void: #070504;      /* the page. Baked into the emblem art: tools/build-art.sh */
  --crust: #120c09;     /* fields, answers, panels */
  --crust-2: #1b120d;
  --seam: #2e1f17;      /* edges */
  --seam-2: #4a2c1b;
  --bone: #f5ede5;      /* text */
  --ash: #b5a698;       /* helper text */
  --ember: #ff7a1a;     /* the one accent: heat */
  --flame: #ffb133;
  --core: #ffe6a0;
  --coal: #1c0d04;      /* text on heat */
  --bad: #ff9a85;
  --heat: linear-gradient(180deg, #ffbc44, #ff7d1b 72%, #f25c12);
  --r: 10px;            /* everything pressed or typed into */
  --r-box: 18px;        /* panels */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: "Archivo", "Segoe UI", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --p: 0;
  transition: --p 900ms var(--ease);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--void); -webkit-text-size-adjust: 100%; scroll-padding-top: 32px; scrollbar-color: var(--seam-2) var(--void); scrollbar-gutter: stable; }
body { margin: 0; min-height: 100dvh; background: var(--void); color: var(--bone); font: 400 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: rgba(255, 122, 26, 0.38); color: #fff; }
a { color: var(--flame); text-underline-offset: 3px; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.visually-hidden, .hp { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 16px; top: -80px; z-index: 50; padding: 12px 16px; border-radius: var(--r); background: var(--flame); color: var(--coal); font-weight: 700; }
.skip:focus { top: 16px; }
:focus-visible { outline: 2px solid var(--core); outline-offset: 2px; }

.embers { position: fixed; inset: 0; z-index: 40; width: 100%; height: 100%; pointer-events: none; }

/* ------------------------------------------------------------ the page: rail and questions */

.page { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 700px); justify-content: center; column-gap: clamp(40px, 7vw, 128px); max-width: 1400px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px); }
.rail { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; height: 100dvh; padding: 20px 0 32px; background: var(--void); }
.flow { min-width: 0; padding: 56px 0 96px; }

/* ------------------------------------------------------------ the emblem */

/* The flames reach the picture's edges, so all four edges fade out. */
.emblem { position: relative; flex: none; width: min(100%, 42dvh, 380px); aspect-ratio: 1; margin: 0 0 -10px -34px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 13%, #000 87%, transparent), linear-gradient(to right, transparent, #000 13%, #000 87%, transparent); -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, transparent, #000 13%, #000 87%, transparent), linear-gradient(to right, transparent, #000 13%, #000 87%, transparent); mask-composite: intersect; }
.emblem img, .emblem video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
/* The burning picture, shown clockwise from the top as far as the report has come. Both ends of the
   burning part are soft; the first one closes up as the report nears its end, so a full emblem has no seam. */
.emblem-hot { position: absolute; inset: 0; opacity: calc(var(--p) * 30); --at: calc(var(--p) * 374deg); --from: calc((1 - var(--p)) * 16deg);
  -webkit-mask-image: conic-gradient(from 0deg, transparent 0deg, #000 var(--from), #000 calc(var(--at) - 14deg), transparent var(--at)); mask-image: conic-gradient(from 0deg, transparent 0deg, #000 var(--from), #000 calc(var(--at) - 14deg), transparent var(--at)); }
.emblem .emblem-intro { display: none; }
.emblem video { opacity: 0; transition: opacity 700ms; }
.emblem.live video { opacity: 1; }
.emblem-glow { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: calc(var(--p) * var(--p) * 0.5);
  background: radial-gradient(closest-side, rgba(255, 120, 30, 0.42), rgba(210, 40, 12, 0.14) 58%, transparent 78%); }

.brand { margin: 0; font: 700 13px/1 var(--sans); font-stretch: 125%; letter-spacing: 0.34em; text-transform: uppercase; color: var(--ember); }
h1 { margin: 14px 0 0; font: 800 clamp(36px, 3.5vw, 52px)/1.03 var(--sans); font-stretch: 122%; letter-spacing: -0.025em; text-wrap: balance; }
.lede { margin: 16px 0 0; max-width: 34ch; color: var(--ash); font-size: 17px; line-height: 1.5; }

/* What is still needed; each one jumps to its question. */
.status { margin-top: 26px; }
.status p { margin: 0 0 10px; color: var(--ash); font-size: 14px; font-weight: 500; }
body.ready .status p { color: var(--flame); font-weight: 600; }
.left-list { display: flex; flex-wrap: wrap; gap: 6px; }
.left-list button { padding: 7px 11px; border: 1px solid var(--seam); border-radius: var(--r); background: var(--crust); color: var(--bone); font: 500 13px/1.1 var(--sans); cursor: pointer; transition: border-color 0.2s, background-color 0.2s; }
.left-list button:hover { border-color: #7a3c16; background: var(--crust-2); }

.rail-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 24px; }

/* A short window (most laptops): everything in the rail tightens so Send stays in view. */
@media (min-width: 1024px) and (max-height: 860px) {
  .rail { padding: 12px 0 20px; }
  .emblem { width: min(100%, 39dvh); margin-left: -30px; }
  h1 { margin-top: 12px; font-size: clamp(30px, 2.9vw, 40px); }
  .lede { margin-top: 12px; font-size: 16px; }
  .status { margin-top: 18px; }
  .left-list button { padding: 6px 9px; font-size: 12.5px; }
  .rail-actions { flex-direction: row; padding-top: 16px; }
  .rail-actions .btn-go { flex: 1; }
}
@media (min-width: 1024px) and (max-height: 700px) {
  .lede { display: none; }
  .emblem { width: min(100%, 32dvh); }
}

/* ------------------------------------------------------------ buttons */

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border: 1px solid var(--seam-2); border-radius: var(--r); background: var(--crust-2); color: var(--bone); font: 600 15px/1.1 var(--sans); white-space: nowrap; text-decoration: none; cursor: pointer; transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.4s, transform 0.12s; }
.btn:hover { border-color: #7a3c16; background: #23160f; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.7; cursor: progress; }
.btn-quiet { border-color: var(--seam); background: transparent; color: var(--ash); font-weight: 500; }
.btn-quiet:hover { background: var(--crust); color: var(--bone); }
/* Send lies cold until every needed answer is in, then it is hot. It can be pressed either way. */
.btn-go { min-height: 54px; padding: 12px 28px; font-size: 16px; font-weight: 700; font-stretch: 110%; letter-spacing: 0.01em; }
body.ready .btn-go, .done .btn-go { border-color: #ffd27a; background: var(--heat); color: var(--coal); box-shadow: 0 12px 32px -14px rgba(255, 96, 20, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
body.ready .btn-go:hover, .done .btn-go:hover { background: linear-gradient(180deg, #ffc95c, #ff8a26 72%, #f76516); }
.count { min-width: 20px; height: 20px; margin-left: 8px; padding: 0 6px; border-radius: var(--r); background: var(--seam-2); color: var(--bone); font: 600 12px/20px var(--mono); text-align: center; }

/* ------------------------------------------------------------ questions */

.step + .step { margin-top: 56px; }
.step h2 { margin: 0 0 20px; font: 750 clamp(24px, 2.2vw, 30px)/1.1 var(--sans); font-stretch: 116%; letter-spacing: -0.015em; }
/* A cold bar over each part; it takes heat once that part has what it needs. */
.step h2::before { content: ""; display: block; width: 44px; height: 4px; margin-bottom: 14px; border-radius: 2px; background: var(--seam-2); transition: background-color 0.5s, box-shadow 0.5s, width 0.6s var(--ease); }
.step.lit h2::before { width: 76px; background: linear-gradient(90deg, var(--core), var(--flame) 40%, var(--ember)); box-shadow: 0 0 18px rgba(255, 122, 26, 0.55); }

.q { min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
.step > .q:last-child, .duo .q { margin-bottom: 0; }
.q.short { max-width: 380px; }
.q > legend { display: block; margin: 0 0 8px; padding: 0; color: var(--ash); font: 500 13.5px/1.35 var(--sans); }
.q > label { display: block; margin: 0 0 8px; padding: 0; color: var(--bone); font: 600 15px/1.35 var(--sans); }
.q small, summary small { margin-left: 6px; color: var(--ash); font-size: 13px; font-weight: 400; }
.hint { max-width: 62ch; margin: 10px 0 0; color: var(--ash); font-size: 13.5px; }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chip { position: relative; display: block; cursor: pointer; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip span { display: flex; flex-direction: column; justify-content: center; min-height: 44px; padding: 9px 16px; border: 1px solid var(--seam); border-radius: var(--r); background: var(--crust); color: var(--bone); font: 500 15px/1.25 var(--sans); transition: background-color 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.35s, transform 0.12s; }
.chip span small { margin: 3px 0 0; color: var(--ash); font-size: 12.5px; }
.chip:hover span { border-color: #7a3c16; background: var(--crust-2); }
.chip:active span { transform: scale(0.98); }
.chip input:focus-visible + span { outline: 2px solid var(--core); outline-offset: 2px; }
/* A chosen answer is iron taking heat: its edge glows and its face warms. Only Send is ever solid heat. */
.chip input:checked + span { border-color: var(--ember); background: linear-gradient(180deg, #2c1508, #3a1907); color: #ffd9a6; font-weight: 650; box-shadow: inset 0 0 0 1px rgba(255, 122, 26, 0.55), inset 0 -10px 18px -10px rgba(255, 122, 26, 0.5), 0 8px 22px -14px rgba(255, 96, 20, 0.8); }
.chip input:checked + span small { color: #e0a878; }
.chip.big span { min-height: 68px; padding: 12px 18px; font-size: 20px; font-weight: 750; font-stretch: 114%; letter-spacing: -0.01em; }
.chip.big span small { margin-top: 1px; font-size: 13px; font-weight: 400; font-stretch: 100%; letter-spacing: 0; }
/* A class is marked with its own colour from the game. */
.chip.cls span { box-shadow: inset 3px 0 0 var(--c); }
.chip.cls input:checked + span { box-shadow: inset 0 0 0 1px rgba(255, 122, 26, 0.55), inset 0 -10px 18px -10px rgba(255, 122, 26, 0.5), 0 8px 22px -14px rgba(255, 96, 20, 0.8); }

input:not([type="radio"]):not([type="file"]), textarea { display: block; width: 100%; padding: 12px 14px; border: 1px solid var(--seam); border-radius: var(--r); background: var(--crust); color: var(--bone); font: 400 16px/1.5 var(--sans); transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s; }
textarea { min-height: 76px; resize: vertical; }
textarea.mono { font-family: var(--mono); font-size: 14px; }
input::placeholder, textarea::placeholder { color: #938477; opacity: 1; }
input:not([type="radio"]):not([type="file"]):hover, textarea:hover { border-color: var(--seam-2); }
input:not([type="radio"]):not([type="file"]):focus, textarea:focus { border-color: var(--ember); background: #150e0a; box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.22); outline: none; }

.q.invalid input, .q.invalid textarea, .q.invalid .chip span { border-color: var(--bad); }
.msg { margin: 8px 0 0; color: var(--bad); font-size: 14px; font-weight: 500; }
.form-err { margin: 20px 0 0; color: var(--bad); font-weight: 500; }

.more { margin: 8px 0 0; border-top: 1px solid var(--seam); }
.more summary { display: flex; align-items: baseline; padding: 16px 0; color: var(--bone); font-weight: 600; list-style: none; cursor: pointer; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "+"; flex: none; width: 22px; color: var(--ember); font-weight: 700; }
.more[open] summary::before { content: "\2212"; }
.more-body { padding: 8px 0 0; }

/* ------------------------------------------------------------ the log */

.logbox { margin: 0 0 20px; padding: 18px; border: 1px solid var(--seam); border-radius: var(--r-box); background: var(--crust); }
.log-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px; border: 1.5px dashed var(--seam-2); border-radius: var(--r); transition: border-color 0.2s, background-color 0.2s; }
.log-pick.over { border-color: var(--ember); background: rgba(255, 122, 26, 0.07); }
.log-pick .msg { flex-basis: 100%; margin: 0; }
.log-or { color: var(--ash); font-size: 14px; }
.log-have p { margin: 0 0 10px; }
.log-have summary { margin-bottom: 12px; color: var(--flame); font-size: 14px; cursor: pointer; }
#log-peek { max-height: 220px; margin: 0 0 14px; padding: 12px; overflow: auto; border: 1px solid var(--seam); border-radius: var(--r); background: #0b0706; color: var(--ash); font: 12px/1.5 var(--mono); white-space: pre; }

/* ------------------------------------------------------------ sending, and after */

.send-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }

.done { outline: none; }
.done h2 { margin: 0; font: 800 clamp(40px, 4.4vw, 64px)/1.03 var(--sans); font-stretch: 122%; letter-spacing: -0.025em; text-wrap: balance; }
.done-id { margin: 22px 0 0; color: var(--flame); font-size: clamp(20px, 2.2vw, 28px); font-weight: 600; letter-spacing: 0.02em; }
.done-status { max-width: 56ch; margin: 14px 0 28px; color: var(--ash); font-size: 17px; }
.done .more { margin-top: 40px; }
.done textarea { font-size: 13px; line-height: 1.5; }
body.is-done .rail-actions .btn-go, body.is-done .status { display: none; }

/* ------------------------------------------------------------ the bar on small screens */

.bar { display: none; }

@media (max-width: 1023px) {
  .page { display: block; padding: 0 20px; }
  .rail { position: static; height: auto; padding: 12px 0 0; }
  .emblem { width: min(62vw, 260px); margin: 0 0 -6px -22px; }
  .status, .rail-actions .btn-go { display: none; }
  .rail-actions { flex-direction: row; margin-top: 0; padding-top: 20px; }
  .flow { padding: 40px 0 130px; }
  .step + .step { margin-top: 48px; }
  .bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--seam); background: rgba(9, 6, 4, 0.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .bar-ring { flex: none; width: 30px; height: 30px; border-radius: 50%; background: conic-gradient(var(--flame) calc(var(--p) * 360deg), var(--seam-2) 0);
    -webkit-mask-image: radial-gradient(closest-side, transparent 58%, #000 62%); mask-image: radial-gradient(closest-side, transparent 58%, #000 62%); }
  #bar-left { flex: 1; min-width: 0; color: var(--ash); font-size: 14px; line-height: 1.3; }
  .bar .btn-go { min-height: 48px; padding: 10px 22px; }
  body.is-done .bar { display: none; }
}
@media (max-width: 560px) {
  .duo { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .chip.big span { min-height: 64px; padding: 10px 14px; font-size: 18px; }
  .logbox { padding: 16px; }
}

/* ------------------------------------------------------------ your reports */

.sheet-dialog { width: min(640px, calc(100vw - 32px)); max-height: min(80dvh, 720px); padding: 24px; border: 1px solid var(--seam-2); border-radius: var(--r-box); background: var(--crust); color: var(--bone); }
.sheet-dialog::backdrop { background: rgba(0, 0, 0, 0.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.sheet-dialog h2 { margin: 0; font: 750 24px/1.1 var(--sans); font-stretch: 116%; }
.past { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--seam); }
.past b { color: var(--flame); font-weight: 600; }
.past span { grid-column: 1; color: var(--bone); font-size: 14.5px; }
.past .when { color: var(--ash); font-size: 13px; }
.past .btn { grid-column: 2; grid-row: 1 / span 3; }
.empty { margin: 0; color: var(--ash); }

/* ------------------------------------------------------------ motion. Each one has a job; DESIGN.md lists them. */

@media (prefers-reduced-motion: no-preference) {
  .emblem { animation: kindle 1200ms var(--ease) both; }
  .emblem .emblem-intro { display: block; opacity: 0; pointer-events: none; animation: cool 3400ms 200ms ease-in-out both; }
  .brand, h1, .lede, .status, .rail-actions, .flow { animation: rise 760ms var(--ease) both; }
  .brand { animation-delay: 140ms; }
  h1 { animation-delay: 200ms; }
  .lede { animation-delay: 260ms; }
  .status { animation-delay: 320ms; }
  .rail-actions { animation-delay: 380ms; }
  .flow { animation-delay: 300ms; }
  .emblem.flare { animation: flare 1300ms var(--ease); }
  body.ready .btn-go { animation: breathe 2.8s ease-in-out infinite; }
  .done:not([hidden]) > * { animation: rise 700ms var(--ease) both; }
  .done > :nth-child(2) { animation-delay: 90ms; }
  .done > :nth-child(3) { animation-delay: 160ms; }
  .done > :nth-child(4) { animation-delay: 230ms; }
  .done > :nth-child(5) { animation-delay: 300ms; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes kindle { from { opacity: 0; transform: scale(0.94); } }
@keyframes cool { 0% { opacity: 1; } 42% { opacity: 1; } 100% { opacity: 0; } }
@keyframes flare { 0% { transform: scale(1); filter: brightness(1); } 16% { transform: scale(1.06); filter: brightness(1.7) saturate(1.15); } 100% { transform: scale(1); filter: brightness(1); } }
@keyframes breathe { 50% { box-shadow: 0 12px 44px -10px rgba(255, 96, 20, 1), inset 0 1px 0 rgba(255, 255, 255, 0.35); } }

@media (prefers-reduced-motion: reduce) {
  :root { transition: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; scroll-behavior: auto !important; }
}
