/* ==========================================================================
   webmystery — candlelit noir
   One stylesheet, no build step, no external fonts.
   ========================================================================== */

:root {
  --ink:        #120d12;
  --ink-2:      #1a141c;
  --ink-3:      #241c27;
  --ink-line:   #392e3d;

  --paper:      #f2e6cf;
  --paper-2:    #e5d5b6;
  --paper-ink:  #2b2118;
  --paper-soft: #6a5a45;

  --gold:       #e0ae52;
  --gold-dim:   #9c7838;
  --blood:      #b81d24;
  --blood-deep: #7a0f16;
  --green:      #4f9d69;
  --mist:       #a898b0;
  --text:       #ede5ea;

  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 18px 44px rgba(0,0,0,.55);
  --shadow-sm:  0 6px 18px rgba(0,0,0,.4);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1120px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--ink);
  background-image:
    radial-gradient(1100px 620px at 12% -10%, rgba(224,174,82,.16), transparent 62%),
    radial-gradient(900px 560px at 92% 4%, rgba(184,29,36,.16), transparent 60%),
    radial-gradient(1200px 900px at 50% 110%, rgba(120,60,140,.13), transparent 65%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Film grain over everything, purely decorative. */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .32;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

img, svg { max-width: 100%; }

a { color: var(--gold); text-decoration-color: rgba(224,174,82,.4); text-underline-offset: 3px; }
a:hover { color: #f3c877; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

::selection { background: var(--blood); color: #fff; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

/* ---------------------------------------------------------------- topbar -- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem clamp(.9rem, 3vw, 2rem);
  background: rgba(18,13,18,.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ink-line);
}

.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: inherit; }
.brand-seal { display: grid; place-items: center; filter: drop-shadow(0 3px 6px rgba(0,0,0,.5)); transition: transform .35s cubic-bezier(.2,1.4,.4,1); }
.brand:hover .brand-seal { transform: rotate(-12deg) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-family: var(--serif); font-size: 1.22rem; letter-spacing: .01em; }
.brand-text i { font-size: .68rem; color: var(--mist); font-style: italic; letter-spacing: .04em; }

.topnav { display: flex; align-items: center; gap: clamp(.4rem, 2vw, 1.1rem); }
.topnav > a[data-nav] { font-size: .9rem; color: var(--mist); text-decoration: none; padding: .3rem .1rem; border-bottom: 1px solid transparent; }
.topnav > a[data-nav]:hover { color: var(--text); border-bottom-color: var(--gold-dim); }
.topnav > a.btn { color: var(--ink); }

.langswitch { display: flex; border: 1px solid var(--ink-line); border-radius: 999px; overflow: hidden; background: rgba(0,0,0,.3); }
.lang-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: 600 .72rem/1 var(--sans); letter-spacing: .09em;
  color: var(--mist); padding: .48rem .62rem; transition: background .18s, color .18s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn[aria-pressed="true"] { background: var(--gold); color: #23180a; }

/* ----------------------------------------------------------------- shell -- */

.app { position: relative; z-index: 1; max-width: var(--wrap); margin: 0 auto; padding: clamp(1.4rem, 4vw, 3rem) clamp(.9rem, 3vw, 2rem) 4rem; }

.footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--ink-line); margin-top: 2rem;
  padding: 1.8rem clamp(.9rem, 3vw, 2rem) 3rem;
  text-align: center; color: var(--mist); font-size: .85rem;
}
.footer-small { font-size: .74rem; opacity: .65; letter-spacing: .05em; }

.boot { display: grid; place-items: center; gap: 1rem; padding: 5rem 0; color: var(--mist); }
.boot-spinner { width: 34px; height: 34px; border: 2px solid var(--ink-line); border-top-color: var(--gold); border-radius: 50%; animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.noscript { max-width: 42rem; margin: 4rem auto; padding: 2rem; text-align: center; }

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

.btn {
  --btn-bg: var(--gold);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 600 .92rem/1 var(--sans); letter-spacing: .02em;
  padding: .78rem 1.25rem; border-radius: 999px; border: 1px solid transparent;
  background: var(--btn-bg); color: #22170a; text-decoration: none; cursor: pointer;
  transition: transform .16s cubic-bezier(.2,1.3,.4,1), box-shadow .2s, background .2s, color .2s;
  box-shadow: 0 5px 0 rgba(0,0,0,.28), var(--shadow-sm);
}
.btn:hover { transform: translateY(-2px); color: #22170a; box-shadow: 0 7px 0 rgba(0,0,0,.3), 0 12px 26px rgba(0,0,0,.45); }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.btn[disabled] { opacity: .45; pointer-events: none; }

.btn-ghost { background: transparent; color: var(--gold); border-color: var(--gold-dim); box-shadow: none; }
.btn-ghost:hover { background: rgba(224,174,82,.12); color: #f3c877; box-shadow: none; }
.btn-blood { --btn-bg: var(--blood); color: #fff; }
.btn-blood:hover { color: #fff; }
.btn-sm { padding: .5rem .9rem; font-size: .82rem; box-shadow: 0 3px 0 rgba(0,0,0,.28); }
.btn-lg { padding: 1rem 1.8rem; font-size: 1.05rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

/* ----------------------------------------------------------------- cards -- */

.card {
  background: linear-gradient(165deg, var(--ink-2), var(--ink-3));
  border: 1px solid var(--ink-line); border-radius: var(--radius);
  padding: clamp(1.1rem, 2.6vw, 1.7rem);
  box-shadow: var(--shadow-sm);
}

.stack > * + * { margin-top: 1.4rem; }
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
/* Four features read better as a 2x2 block than as 3 + an orphan. */
.grid-feat { grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 1.6rem 2rem; }

.quote {
  margin: 0; padding: .1rem 0 .1rem 1.1rem;
  border-left: 3px solid rgba(184,29,36,.55);
  font-family: var(--serif); font-size: 1.05rem;
}

.eyebrow {
  font: 600 .72rem/1 var(--sans); letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold-dim); margin-bottom: .7rem; display: flex; align-items: center; gap: .55rem;
}
.eyebrow::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--ink-line), transparent); }

.muted { color: var(--mist); }
.small { font-size: .86rem; }
.tiny { font-size: .76rem; }
.center { text-align: center; }

/* ------------------------------------------------------------------ home -- */

.hero { position: relative; text-align: center; padding: clamp(1rem, 4vw, 2.6rem) 0 1.6rem; }
.hero h1 { margin-bottom: .3rem; }
.hero h1 .accent { color: var(--gold); }
.hero .kicker { font: 600 .74rem/1 var(--sans); letter-spacing: .3em; text-transform: uppercase; color: var(--blood); margin-bottom: 1.1rem; }
.hero .lede { max-width: 44rem; margin: 0 auto 1.7rem; color: var(--mist); font-size: clamp(1rem, 2.2vw, 1.15rem); }
.hero-art { max-width: 620px; margin: .5rem auto 1.4rem; filter: drop-shadow(0 24px 40px rgba(0,0,0,.6)); }

.feature { display: flex; gap: .85rem; align-items: flex-start; }
.feature-icon { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: rgba(224,174,82,.11); border: 1px solid rgba(224,174,82,.24); font-size: 1.15rem; }
.feature h3 { margin-bottom: .2rem; font-size: 1.02rem; font-family: var(--sans); font-weight: 700; }
.feature p { font-size: .88rem; color: var(--mist); }

/* ------------------------------------------------------- scenario chooser -- */

/* Four mysteries sit as a 2x2 block; below ~900px they stack. */
.scenario-grid { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }

.scenario-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--ink-line);
  background: linear-gradient(170deg, var(--ink-2), var(--ink-3));
  text-align: left; padding: 0; cursor: pointer; color: inherit; font: inherit;
  text-decoration: none; -webkit-tap-highlight-color: transparent;
  transition: transform .22s cubic-bezier(.2,1.2,.4,1), border-color .22s, box-shadow .22s;
}
.scenario-card:hover { transform: translateY(-4px); border-color: var(--gold-dim); box-shadow: var(--shadow); }
.scenario-card[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(224,174,82,.28), var(--shadow); }
.scenario-card[aria-pressed="true"]::after {
  content: "✓"; position: absolute; top: .7rem; right: .7rem; z-index: 3;
  width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%;
  background: var(--gold); color: #22170a; font-weight: 800; font-size: .82rem;
}
.scenario-cover { aspect-ratio: 16 / 9; overflow: hidden; background: #0c0910; border-bottom: 1px solid var(--ink-line); }
.scenario-cover svg { display: block; width: 100%; height: 100%; }
.scenario-body { padding: 1.05rem 1.15rem 1.25rem; display: flex; flex-direction: column; flex: 1; }
.scenario-body h3 { font-size: 1.22rem; margin-bottom: .25rem; }
.scenario-tag { font-size: .78rem; color: var(--gold); font-style: italic; margin-bottom: .6rem; }
.scenario-body p { font-size: .89rem; color: var(--mist); flex: 1; }
.scenario-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }

.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  font: 600 .7rem/1 var(--sans); letter-spacing: .05em;
  padding: .34rem .6rem; border-radius: 999px;
  background: rgba(255,255,255,.05); border: 1px solid var(--ink-line); color: var(--mist);
}
.pill-gold { background: rgba(224,174,82,.13); border-color: rgba(224,174,82,.3); color: var(--gold); }
.pill-blood { background: rgba(184,29,36,.15); border-color: rgba(184,29,36,.36); color: #f08c91; }
.pill-green { background: rgba(79,157,105,.14); border-color: rgba(79,157,105,.34); color: #86d3a0; }

/* --------------------------------------------------------------- stepper -- */

.steps { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.step { display: flex; align-items: center; gap: .5rem; font-size: .84rem; color: var(--mist); }
.step-num { width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center; font: 700 .75rem/1 var(--sans); border: 1px solid var(--ink-line); background: rgba(0,0,0,.3); }
.step[data-state="active"] { color: var(--text); }
.step[data-state="active"] .step-num { background: var(--gold); border-color: var(--gold); color: #22170a; }
.step[data-state="done"] .step-num { background: rgba(224,174,82,.16); border-color: var(--gold-dim); color: var(--gold); }
.step-sep { width: 22px; height: 1px; background: var(--ink-line); }

/* ------------------------------------------------------------ cast picker -- */

.cast-list { display: grid; gap: .65rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.cast-row {
  display: flex; align-items: center; gap: .8rem; padding: .6rem .8rem;
  border: 1px solid var(--ink-line); border-radius: var(--radius-sm);
  background: rgba(0,0,0,.22); transition: border-color .18s, background .18s, opacity .18s;
}
.cast-row[data-on="false"] { opacity: .42; }
.cast-row[data-on="true"] { border-color: rgba(224,174,82,.35); background: rgba(224,174,82,.05); }
.cast-avatar { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; background: #0c0910; }
.cast-avatar svg { display: block; width: 100%; height: 100%; }
.cast-info { flex: 1; min-width: 0; }
.cast-info b { display: block; font-family: var(--serif); font-size: 1rem; }
.cast-info span { display: block; font-size: .77rem; color: var(--mist); }
.cast-name-input { width: 100%; margin-top: .3rem; }

.switch { flex: 0 0 auto; position: relative; width: 44px; height: 25px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #3a2f3e; transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #cbbfd0; transition: transform .2s, background .2s; }
.switch input:checked + span { background: var(--gold-dim); }
.switch input:checked + span::after { transform: translateX(19px); background: #fff3dd; }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

input[type="text"], input[type="number"], textarea, select {
  font: 400 .92rem/1.4 var(--sans); color: var(--text);
  background: rgba(0,0,0,.38); border: 1px solid var(--ink-line); border-radius: 8px;
  padding: .55rem .7rem; width: 100%;
}
input::placeholder { color: #6d5f74; }
input:focus, textarea:focus, select:focus { border-color: var(--gold-dim); outline: none; box-shadow: 0 0 0 3px rgba(224,174,82,.13); }

label.field { display: block; }
label.field > span { display: block; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--mist); margin-bottom: .3rem; }

/* --------------------------------------------------------- host console -- */

.hostbanner {
  display: flex; gap: .9rem; align-items: flex-start;
  border-radius: var(--radius); padding: 1rem 1.2rem;
  border: 1px solid rgba(79,157,105,.35); background: rgba(79,157,105,.09);
}
.hostbanner .big { font-size: 1.5rem; line-height: 1; }
.hostbanner h3 { font-family: var(--sans); font-size: .98rem; margin-bottom: .15rem; color: #9fdcb4; }
.hostbanner p { font-size: .87rem; color: var(--mist); }

.linkrow {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .7rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--ink-line); background: rgba(0,0,0,.26);
}
.linkrow + .linkrow { margin-top: .55rem; }
.linkrow .cast-avatar { width: 46px; height: 46px; }
.linkrow-main { flex: 1 1 220px; min-width: 0; }
.linkrow-main b { display: block; font-family: var(--serif); font-size: 1.02rem; }
.linkrow-main code { display: block; font: 400 .7rem/1.5 var(--mono); color: var(--paper-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkrow-actions { display: flex; gap: .4rem; flex: 0 0 auto; }

.copybtn { position: relative; }
.copybtn.copied { background: var(--green); color: #06180d; }

/* --------------------------------------------------------- sealed / spoiler */

.sealed {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px dashed rgba(184,29,36,.5); background: rgba(184,29,36,.07); padding: 1.2rem;
}
.sealed-inner { filter: blur(9px); opacity: .5; user-select: none; pointer-events: none; transition: filter .4s, opacity .4s; }
.sealed[data-open="true"] .sealed-inner { filter: none; opacity: 1; user-select: auto; pointer-events: auto; }

/* While the seal is intact, the *cover* decides how tall the box is and the
   hidden content is taken out of the flow behind it. The solution page is
   several screens long; when it set the height, an absolutely positioned cover
   centred "Break the seal" halfway down that wall of blur, so you had to scroll
   blind — or drag a text selection — to reach a button you could not see. */
.sealed[data-open="false"] { padding: 0; }
.sealed[data-open="false"] .sealed-inner { position: absolute; inset: 0; overflow: hidden; }
.sealed[data-open="false"] .sealed-cover { position: relative; min-height: 8.5rem; padding: 1.8rem 1.2rem; }

.sealed-cover {
  z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 1rem; gap: .7rem; background: rgba(18,13,18,.72);
}
.sealed[data-open="true"] .sealed-cover { display: none; }
.sealed-cover strong { font-family: var(--serif); font-size: 1.15rem; display: block; }
.sealed-cover p { font-size: .84rem; color: var(--mist); max-width: 32rem; margin: 0; }

/* ------------------------------------------------------- character sheet -- */

.sheet {
  position: relative;
  background:
    radial-gradient(120% 90% at 10% 0%, rgba(255,255,255,.5), transparent 55%),
    linear-gradient(158deg, var(--paper), var(--paper-2));
  color: var(--paper-ink);
  border-radius: var(--radius); padding: clamp(1.2rem, 3.4vw, 2.3rem);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sheet::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.6' numOctaves='4'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23p)' opacity='.24'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.sheet > * { position: relative; }
.sheet a { color: #8a2f12; }
.sheet h1, .sheet h2, .sheet h3 { color: #1f1710; }
.sheet .muted { color: var(--paper-soft); }

.sheet-head { display: flex; gap: clamp(1rem, 3vw, 1.7rem); align-items: center; flex-wrap: wrap; }
.sheet-portrait { flex: 0 0 auto; width: clamp(110px, 22vw, 156px); border-radius: 50%; overflow: hidden; box-shadow: 0 10px 26px rgba(60,40,20,.35); border: 3px solid rgba(255,255,255,.55); }
.sheet-portrait svg { display: block; width: 100%; height: auto; }
.sheet-id { flex: 1 1 240px; min-width: 0; }
.sheet-id .role { font: 600 .72rem/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: #9a3b1c; margin-bottom: .5rem; }
.sheet-id h1 { font-size: clamp(1.7rem, 4.4vw, 2.5rem); margin-bottom: .15rem; }
.sheet-id .title { font-style: italic; color: var(--paper-soft); font-size: 1.02rem; }

.rule { height: 1px; background: linear-gradient(90deg, transparent, rgba(107,90,69,.5), transparent); margin: 1.5rem 0; border: 0; }
.rule-orn { display: flex; align-items: center; gap: .9rem; margin: 1.6rem 0; color: rgba(154,59,28,.65); font-size: 1.1rem; line-height: 1; }
.rule-orn::before, .rule-orn::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(107,90,69,.45), transparent); }

.block { margin-top: 1.4rem; }
.block > h3 {
  font: 600 .74rem/1 var(--sans); letter-spacing: .17em; text-transform: uppercase;
  color: #9a3b1c; margin-bottom: .55rem; display: flex; align-items: center; gap: .5rem;
}
.block > h3::after { content: ""; flex: 1; height: 1px; background: rgba(107,90,69,.28); }

.note {
  border-left: 3px solid rgba(154,59,28,.5); padding: .1rem 0 .1rem .9rem;
  font-size: .96rem;
}

.callout {
  border-radius: var(--radius-sm); padding: 1rem 1.15rem; border: 1px solid;
  background: rgba(255,255,255,.4);
}
.callout h4 { font-family: var(--sans); font-size: .95rem; font-weight: 800; margin: 0 0 .35rem; letter-spacing: .01em; }
.callout p { font-size: .92rem; }
.callout-guilty { border-color: rgba(160,20,26,.5); background: linear-gradient(160deg, rgba(184,29,36,.14), rgba(184,29,36,.06)); }
.callout-guilty h4 { color: #8f1119; }
.callout-innocent { border-color: rgba(46,110,68,.4); background: linear-gradient(160deg, rgba(79,157,105,.15), rgba(79,157,105,.05)); }
.callout-innocent h4 { color: #2c6b43; }
.callout-secret { border-color: rgba(120,74,150,.4); background: linear-gradient(160deg, rgba(140,90,175,.13), rgba(140,90,175,.05)); }
.callout-secret h4 { color: #6a3d8a; }
.callout-evidence { border-color: rgba(154,90,20,.45); background: linear-gradient(160deg, rgba(214,150,50,.18), rgba(214,150,50,.06)); }
.callout-evidence h4 { color: #8a5410; }

.tick-list { list-style: none; margin: 0; padding: 0; }
.tick-list li { position: relative; padding-left: 1.5rem; margin-bottom: .5rem; font-size: .95rem; }
.tick-list li::before { content: "❧"; position: absolute; left: 0; top: -.05em; color: #9a3b1c; font-size: .95em; }
.tick-list.plain li::before { content: "•"; }

.round-tag {
  display: inline-block; font: 700 .64rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  padding: .28rem .5rem; border-radius: 5px; margin-right: .45rem; vertical-align: .08em;
  background: #2b2118; color: var(--paper);
}
.round-tag.r2 { background: #7a4a12; }
.round-tag.r3 { background: #8f1119; }

/* --------------------------------------------------------------- dossier -- */

.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.dossier { border-collapse: collapse; width: 100%; font-size: .84rem; min-width: 520px; }
table.dossier th, table.dossier td { padding: .5rem .55rem; text-align: center; border-bottom: 1px solid rgba(107,90,69,.22); }
table.dossier thead th { font: 600 .68rem/1.25 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: #9a3b1c; vertical-align: bottom; }
table.dossier tbody th { text-align: left; font-family: var(--serif); font-weight: 600; font-size: .95rem; white-space: nowrap; }
table.dossier tbody tr:hover { background: rgba(255,255,255,.32); }
.yes { color: #1f6b3c; font-weight: 800; }
.no { color: #b8a894; }

/* dossier on dark cards */
.card table.dossier th, .card table.dossier td { border-bottom-color: var(--ink-line); }
.card table.dossier thead th { color: var(--gold-dim); }
.card table.dossier tbody th { color: var(--text); }
.card table.dossier tbody tr:hover { background: rgba(255,255,255,.04); }
.card .yes { color: #86d3a0; }
.card .no { color: #5e5165; }

/* The blank deduction worksheet: same table, boxes instead of ticks. */
table.worksheet { min-width: 420px; }
table.worksheet thead th { width: 21%; }
.tickbox { height: 2.1rem; }
.tickbox::after {
  content: ""; display: block; width: 1.15rem; height: 1.15rem; margin: 0 auto;
  border: 1px solid rgba(107,90,69,.5); border-radius: 3px;
}
.card .tickbox::after { border-color: var(--ink-line); }

/* --------------------------------------------------------- host timeline -- */

.timeline { list-style: none; margin: 0; padding: 0 0 0 1.5rem; border-left: 2px solid var(--ink-line); }
.timeline > li { position: relative; padding: 0 0 1.5rem 1.1rem; }
.timeline > li::before {
  content: ""; position: absolute; left: -1.63rem; top: .42rem; width: 11px; height: 11px;
  border-radius: 50%; background: var(--ink); border: 2px solid var(--gold-dim);
}
.timeline > li:last-child { padding-bottom: 0; }
.timeline h4 { font-family: var(--serif); font-size: 1.1rem; margin-bottom: .1rem; }
.timeline .when { font: 600 .7rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); display: block; margin-bottom: .35rem; }
.timeline .say { border-left: 2px solid var(--ink-line); padding-left: .8rem; margin-top: .6rem; font-style: italic; color: var(--mist); font-size: .9rem; }

/* ---------------------------------------------------------- misc widgets -- */

.accordion { border: 1px solid var(--ink-line); border-radius: var(--radius-sm); overflow: hidden; background: rgba(0,0,0,.2); }
.accordion + .accordion { margin-top: .55rem; }
.accordion > summary {
  cursor: pointer; padding: .8rem 1rem; font-family: var(--serif); font-size: 1.02rem;
  display: flex; align-items: center; gap: .6rem; list-style: none;
}
.accordion > summary::-webkit-details-marker { display: none; }
.accordion > summary::before { content: "▸"; color: var(--gold); transition: transform .2s; font-size: .8em; }
.accordion[open] > summary::before { transform: rotate(90deg); }
.accordion > summary:hover { background: rgba(255,255,255,.03); }
.accordion .accordion-body { padding: 0 1rem 1rem; font-size: .92rem; color: var(--mist); }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; }

.toast {
  position: fixed; left: 50%; bottom: 1.6rem; transform: translate(-50%, 140%); z-index: 90;
  background: var(--gold); color: #22170a; font-weight: 700; font-size: .88rem;
  padding: .7rem 1.2rem; border-radius: 999px; box-shadow: var(--shadow);
  transition: transform .35s cubic-bezier(.2,1.3,.4,1);
}
.toast.show { transform: translate(-50%, 0); }

.error-box { border: 1px solid rgba(184,29,36,.4); background: rgba(184,29,36,.09); border-radius: var(--radius); padding: 1.4rem; }

.victim-figure { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.victim-portrait { width: 108px; flex: 0 0 auto; border-radius: 50%; overflow: hidden; filter: grayscale(.85) contrast(.95); border: 3px solid rgba(255,255,255,.2); position: relative; }
.victim-portrait svg { display: block; width: 100%; }

.scene-art { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--ink-line); background: #0c0910; }
.scene-art svg { display: block; width: 100%; height: auto; }

.numbered { counter-reset: n; list-style: none; padding: 0; margin: 0; }
.numbered > li { counter-increment: n; position: relative; padding-left: 2.3rem; margin-bottom: .9rem; }
.numbered > li::before {
  content: counter(n); position: absolute; left: 0; top: -.1rem;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font: 700 .78rem/1 var(--sans); background: rgba(224,174,82,.14); border: 1px solid rgba(224,174,82,.3); color: var(--gold);
}

.sheet .numbered > li::before { background: rgba(154,59,28,.12); border-color: rgba(154,59,28,.3); color: #9a3b1c; }

.backlink { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--mist); text-decoration: none; margin-bottom: 1.1rem; }
.backlink:hover { color: var(--gold); }

.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ----------------------------------------------------------------- print -- */

@media print {
  :root { --shadow: none; --shadow-sm: none; }
  body { background: #fff !important; color: #000; }
  .grain, .topbar, .footer, .no-print, .btn, .backlink, .toast { display: none !important; }
  .app { max-width: none; padding: 0; }
  .sheet { box-shadow: none; border: 1px solid #bbb; background: #fff !important; color: #000; page-break-inside: avoid; break-inside: avoid; }
  .sheet::before { display: none; }
  .card { background: #fff !important; border: 1px solid #bbb; color: #000; }
  .card h1, .card h2, .card h3, .card .muted, .card p, .card li { color: #000 !important; }
  .fade-in { animation: none !important; opacity: 1 !important; transform: none !important; }
  .print-page { page-break-after: always; break-after: page; }
  .print-page:last-child { page-break-after: auto; break-after: auto; }
  a { color: #000; text-decoration: none; }
  .callout { border-color: #999 !important; }
  /* the worksheet is the main reason anyone prints the case file */
  .card table.dossier th, .card table.dossier td { border-bottom-color: #ccc !important; }
  .card table.dossier thead th { color: #444 !important; }
  .tickbox::after, .card .tickbox::after { border-color: #666 !important; }
}

/* --------------------------------------------------- inline language switch */

.langswitch-inline {
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.langswitch-inline .tiny { letter-spacing: .14em; text-transform: uppercase; }
.langswitch-inline .lang-btn { padding: .5rem .95rem; font-size: .78rem; letter-spacing: .04em; }
.langswitch-inline.above-sheet { justify-content: flex-end; }
