/* A candlelit table: dark everywhere, so the photo is the brightest thing on screen.
   Layout follows the available width, so unfolding the Fold just reflows the page. */
@font-face { font-family: "Grenze Gotisch"; font-weight: 700; font-display: swap; src: url(fonts/grenze-gotisch-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1EFF, U+20A0-20C0; }
@font-face { font-family: "Grenze Gotisch"; font-weight: 700; font-display: swap; src: url(fonts/grenze-gotisch-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "Alegreya Sans"; font-weight: 400; font-display: swap; src: url(fonts/alegreya-sans-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1EFF, U+20A0-20C0; }
@font-face { font-family: "Alegreya Sans"; font-weight: 400; font-display: swap; src: url(fonts/alegreya-sans-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "Alegreya Sans"; font-weight: 500; font-display: swap; src: url(fonts/alegreya-sans-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1EFF, U+20A0-20C0; }
@font-face { font-family: "Alegreya Sans"; font-weight: 500; font-display: swap; src: url(fonts/alegreya-sans-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: "Alegreya Sans"; font-weight: 700; font-display: swap; src: url(fonts/alegreya-sans-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1EFF, U+20A0-20C0; }
@font-face { font-family: "Alegreya Sans"; font-weight: 700; font-display: swap; src: url(fonts/alegreya-sans-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }

:root {
  color-scheme: dark;
  --ink: #100c0e;
  --surface: #1a1315;
  --raised: #281c1f;
  --line: #41302f;
  --text: #f1e6d3;
  --muted: #b5a493;
  --crimson: #a91d2a;
  --crimson-hi: #c42b38;
  --gold: #e9ae3f;
  --display: "Grenze Gotisch", Georgia, serif;
  --body: "Alegreya Sans", "Segoe UI", Roboto, sans-serif;
  --gut-l: max(16px, env(safe-area-inset-left, 0px));
  --gut-r: max(16px, env(safe-area-inset-right, 0px));
  --page: 1040px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { background: var(--ink); }
body { margin: 0; background: var(--ink); color: var(--text); font: 400 17px/1.45 var(--body); font-variant-numeric: lining-nums; }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 700; line-height: 1.08; text-wrap: balance; }

.app { position: relative; height: 100%; container: app / inline-size; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.view { height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.view.fixed { overflow: hidden; }
/* Side padding grows on wide screens, which keeps every page in one centred column */
.pad { padding-left: max(var(--gut-l), calc((100cqw - var(--page)) / 2)); padding-right: max(var(--gut-r), calc((100cqw - var(--page)) / 2)); }
.library { --page: 1240px; }
.run-page { --page: 1120px; }
.top { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; min-height: 56px; flex: none; background: var(--ink); border-bottom: 1px solid var(--line); }
.top h2 { font-size: 22px; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 10px; color: var(--muted); margin-left: -10px; font-size: 24px; line-height: 1; }
.iconbtn:hover { background: var(--raised); color: var(--text); }
.listbtn { margin: 0 -10px 0 0; }

/* Library */
.masthead { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-block: 12px 4px; text-align: center; }
.masthead h1 { margin: 0; line-height: 0; }
.masthead img { display: block; width: 160px; height: auto; }
.masthead small { color: var(--muted); font: 400 15px/1.3 var(--body); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 8px 14px; }
.search { flex: 1 1 100%; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.search::placeholder { color: var(--muted); }
.chip { min-height: 38px; padding: 4px 13px; border: 1px solid var(--line); border-radius: 19px; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--raised); border-color: var(--gold); color: var(--gold); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; padding-block-end: 24px; }
.tile { display: flex; flex-direction: column; gap: 7px; }
.tile .name { font-weight: 500; line-height: 1.2; }
.meta { color: var(--muted); font-size: 15px; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; }
.cover { position: relative; aspect-ratio: 1; max-width: 100%; border-radius: 6px; overflow: hidden; display: flex; align-items: flex-end; padding: 10px; background: var(--c, var(--raised)); box-shadow: inset 0 0 0 1px #fff2; }
.cover::before { content: ""; position: absolute; inset: -30% -30% auto auto; width: 90%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--c2), transparent 68%); }
.cover.has-image { padding: 0; }
.cover.has-image::before { display: none; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover span { position: relative; font: 700 26px/1.02 var(--display); color: #fff3df; text-shadow: 0 1px 6px #0009; overflow-wrap: anywhere; }
.lang { font-size: 12.5px; font-weight: 700; letter-spacing: .06em; padding: 0 6px; border-radius: 4px; border: 1px solid var(--gold); color: var(--gold); }
.lang.cz { border-color: var(--muted); color: var(--muted); }
.cover .lang { position: absolute; top: 8px; left: 8px; background: #0009; }
.empty { color: var(--muted); padding-block: 32px; }

/* Game page */
.game { display: grid; gap: 22px; padding-block: 16px 28px; }
.hero { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: end; }
.hero .cover span { font-size: 19px; }
.hero h1 { font-size: 34px; }
.summary { max-width: 62ch; }
.primary { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 58px; padding: 8px 18px; border-radius: 10px; background: var(--crimson); color: #fff6e6; font-weight: 700; font-size: 20px; text-align: center; }
.primary:hover { background: var(--crimson-hi); }
.primary.off, .primary.off:hover { background: var(--raised); color: var(--muted); }
.block h3 { font-size: 13.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--gold); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { border-bottom: 1px solid var(--line); }
.rowbtn { min-height: 50px; display: flex; gap: 10px; justify-content: space-between; align-items: center; padding-block: 6px; }
.rowbtn span:last-child { color: var(--muted); font-size: 15px; flex: none; }
.notes { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 7px; max-width: 62ch; }
.resume { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 12px; background: var(--raised); border-radius: 10px; }
.resume div { display: flex; gap: 8px; }
.resume button, .resume .go { display: flex; align-items: center; min-height: 44px; padding: 4px 14px; border-radius: 8px; border: 1px solid var(--line); }
.resume .go { background: var(--crimson); border-color: var(--crimson); font-weight: 700; color: #fff6e6; }
.twocol { display: grid; gap: 22px; }

/* Choosing add-ons */
.setup { flex: 1; display: grid; gap: 22px; padding-block: 16px; align-content: start; }
.opt { min-height: 54px; width: 100%; display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); cursor: pointer; }
.opt input, .stepper input { position: absolute; opacity: 0; pointer-events: none; }
.box { width: 26px; height: 26px; flex: none; border: 2px solid var(--muted); border-radius: 6px; display: grid; place-items: center; color: var(--ink); font-weight: 700; font-size: 18px; line-height: 1; }
.box.round { border-radius: 50%; }
.opt input:checked + .box { background: var(--gold); border-color: var(--gold); }
.opt input:checked + .box::after { content: "✓"; }
.opt input:checked + .box.round::after { content: "•"; }
.opt input:focus-visible + .box, .stepper input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.stepper { display: flex; gap: 6px; padding-top: 10px; }
.stepper label { flex: 1; cursor: pointer; }
.stepper span { display: grid; place-items: center; min-height: 50px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 19px; }
.stepper input:checked + span { border-color: var(--gold); color: var(--gold); background: var(--raised); }
.saved { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
.preview { display: none; }
.preview ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: 16px; }
.preview .sec { color: var(--gold); font-weight: 500; padding-top: 8px; }
.preview .off { color: #7d6e63; text-decoration: line-through; }
.foot { position: sticky; bottom: 0; z-index: 3; display: flex; gap: 10px; align-items: center; padding-block: 10px; flex: none; background: var(--ink); border-top: 1px solid var(--line); margin-top: auto; }
#setup .foot { flex-wrap: wrap; }
.warnings { flex: 1 1 100%; display: grid; gap: 6px; padding: 8px 12px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold); font-size: 16px; line-height: 1.3; }
.foot .count { flex: 1; min-width: 0; color: var(--muted); }
.foot .count b { color: var(--text); font-weight: 700; display: block; }
.foot .primary { width: auto; flex: 1; }

/* Setup run */
.runwrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.progress { display: flex; gap: 4px; padding-block: 8px 0; flex: none; }
.progress i { flex: var(--n) 1 0; height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.progress i b { display: block; height: 100%; background: var(--gold); }
.main { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.stepbody { flex: 1; min-height: 0; overflow-y: auto; }
.stepgrid { display: grid; gap: 14px; padding-block: 12px; }
.photos { display: grid; gap: 10px; min-width: 0; }
.photo { display: block; width: 100%; padding: 0; border-radius: 8px; overflow: hidden; }
.photo img { display: block; width: 100%; height: auto; }
.seclabel { color: var(--gold); font-size: 15px; font-weight: 500; }
.step { min-width: 0; }
.step h2 { font-size: 31px; margin-block: 2px 8px; }
.text { display: grid; gap: 10px; max-width: 58ch; }
.text ul, .text ol { margin: 0; padding-left: 20px; }
.link { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.badge { display: inline-block; margin-bottom: 8px; font-size: 14px; padding: 1px 8px; border-radius: 4px; background: var(--crimson); color: #fff6e6; }
.badge.todo { background: none; box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold); }
.note { margin-top: 12px; padding: 9px 12px; background: var(--surface); border-radius: 8px; font-size: 16px; }
.note b { color: var(--gold); font-weight: 500; }
.list { display: none; }
.sections { list-style: none; margin: 0; padding: 0; }
.sections .sh { font: 700 13.5px/1 var(--body); letter-spacing: .09em; text-transform: uppercase; color: var(--gold); padding: 16px 0 6px; }
.sections a { min-height: 46px; display: flex; gap: 10px; align-items: center; padding: 4px 8px; border-radius: 7px; line-height: 1.2; }
.sections a.now { background: var(--raised); }
.sections .tick { width: 20px; height: 20px; flex: none; border: 1.5px solid var(--muted); border-radius: 50%; display: grid; place-items: center; font-size: 13px; color: var(--ink); font-weight: 700; }
.sections .is-done { color: var(--muted); }
.sections .is-done .tick { background: var(--gold); border-color: var(--gold); }
.foot .back { display: flex; align-items: center; min-height: 58px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); flex: none; }

/* Pop-ups */
dialog.over { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--ink); color: var(--text); }
dialog.over[open] { display: flex; flex-direction: column; }
.over .scroll { flex: 1; min-height: 0; overflow: auto; }
.lightbox { background: #000; display: grid; place-items: center; }
.lightbox img { width: 100%; max-width: 1600px; cursor: zoom-in; }
.lightbox img.zoom { width: 220%; max-width: none; cursor: zoom-out; }

/* Rulebook viewer */
.pdf { flex: 1; min-height: 0; overflow: auto; background: #2c2527; padding: 8px; display: flex; flex-direction: column; align-items: center; }
.pdf canvas { display: block; flex: none; margin: auto; background: #fff; }
.pager { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; justify-content: center; padding-block: 8px; border-top: 1px solid var(--line); flex: none; }
.pager button { min-width: 48px; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; }
.pager button:disabled { opacity: .4; cursor: default; }

.done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding-block: 24px; }
.done img { width: min(62%, 260px); height: auto; }
.done h1 { font-size: 42px; color: var(--gold); }
.done .primary { max-width: 340px; }

/* Fold open and up */
@container app (min-width: 600px) {
  .search { flex: 1 1 240px; }
  .filters { justify-content: center; }
  .masthead img { width: 200px; }
  .search { flex: 1 1 100%; max-width: 520px; }
  /* A few games stay in the middle instead of filling up from the left */
  .grid { grid-template-columns: repeat(auto-fit, minmax(180px, 220px)); justify-content: center; gap: 20px 16px; }
  .cover span { font-size: 32px; }
  .hero { grid-template-columns: 180px minmax(0, 1fr); gap: 22px; }
  .hero .cover span { font-size: 28px; }
  .hero h1 { font-size: 46px; }
  .twocol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
  .preview { display: block; grid-column: 2; grid-row: 1 / span 6; }
  .setup .block:not(.preview) { grid-column: 1; }
  .stepgrid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; padding-block: 16px; }
  .stepgrid.no-photo { grid-template-columns: minmax(0, 1fr); }
  .step h2 { font-size: 36px; }
}
/* iPad: the step list stays on screen */
@container app (min-width: 960px) {
  .cover span { font-size: 27px; }
  /* Step list plus step, together in the middle of the screen */
  .runwrap { flex-direction: row; width: 100%; max-width: 1120px; margin-inline: auto; }
  .main .pad { padding-left: var(--gut-l); padding-right: var(--gut-r); }
  .list { display: block; width: 300px; flex: none; overflow-y: auto; border-right: 1px solid var(--line); padding: 0 12px 16px; }
  .stepgrid { grid-template-columns: minmax(0, 1fr); max-width: 760px; margin-inline: auto; }
  .listbtn { display: none; }
}
