/* The Séance Table: the back page of an old pulp paperback, the "solve it yourself" page.
   Notebook signature: thin ink rules, pen marks, notes in the margin, no filled panels.
   Colours and fonts come from kit.css (--ak-*); nothing here imports a font. */

:root {
  --ink: var(--ak-ink);
  --ink-soft: var(--ak-ink-muted);
  --paper: var(--ak-bg);
  --rule: color-mix(in srgb, var(--ak-ink) 55%, transparent);
  --rule-faint: color-mix(in srgb, var(--ak-ink) 16%, transparent);
  --graph: color-mix(in srgb, var(--ak-ink) 7%, transparent);
  --hand: var(--ak-font-body);
  --print: var(--ak-font-display);
  --edge: 12px;
  --slow: 1400ms;
  --fade: 600ms;
  --say-px: clamp(12px, min(3.3vw, 1.64dvh), 15px);
  --clue-px: clamp(11.5px, min(3.05vw, 1.48dvh), 14px);
  --name-px: clamp(10px, min(2.9vw, 1.4dvh), 13px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body { margin: 0; min-height: 100%; }

body {
  min-height: 100dvh;
  background-color: var(--ak-bg);
  background-image: var(--ak-bg-art);
  background-size: var(--ak-bg-size);
  color: var(--ink);
  font-family: var(--hand);
  -webkit-text-size-adjust: 100%;
}

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible { outline: 3px solid var(--ak-focus); outline-offset: 2px; }

/* ---- The page ---------------------------------------------------------------------------- */

.play[hidden] { display: none; }

.play {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(var(--ac-status-h, 76px) + 6px)
    max(var(--edge), env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(var(--edge), env(safe-area-inset-left));
  touch-action: manipulation;
}

/* The painted table under its wash, then faint graph-paper cells printed over it. */
.play::before,
.play::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.play::before {
  background-color: var(--ak-bg);
  background-image: var(--ak-backdrop-layer);
  background-size: cover;
  background-position: center top;
}

.play::after {
  background-image:
    linear-gradient(var(--graph) 1px, transparent 1px),
    linear-gradient(90deg, var(--graph) 1px, transparent 1px);
  background-size: 18px 18px;
}

/* ---- Masthead: the logo, the timeline and the goal as margin notes ---------------------- */

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--rule);
}

/* Upright, the logo sits small in the top band, between the status label and the help button. */
.logo {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: calc(max(var(--edge), env(safe-area-inset-right)) + 62px);
  display: block;
  width: auto;
  height: 44px;
}

@media (orientation: portrait) and (max-width: 374px) {
  .logo { height: 38px; right: calc(max(var(--edge), env(safe-area-inset-right)) + 60px); }
}

.notes { min-width: 0; }

.notes p {
  margin: 0;
  font-size: clamp(11px, min(3vw, 1.45dvh), 13px);
  font-style: italic;
  line-height: 1.3;
  color: var(--ink-soft);
}

.notes .how-lie { display: none; color: var(--ink); }
.notes .goal { color: var(--ink); }

/* The first sitting's first move: the seating chart's words are marked "start here" until it is opened. */
.clue-line.is-first {
  border-left: 3px solid var(--ink);
  background: var(--ak-surface);
}
.clue-line.is-first .title::before {
  content: 'start here: ';
  font-family: var(--hand);
  font-style: italic;
}

.candle { width: 14px; height: 18px; overflow: visible; }
.candle path { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.candle .smoke { stroke: var(--ak-accent); stroke-width: 1; }
.candle .flame { display: none; fill: var(--ak-accent); stroke: var(--ink); }
:root.ac-lights-up .candle .smoke { display: none; }
:root.ac-lights-up .candle .flame { display: block; }

/* ---- The board: sitters across the top, statements ruled underneath ---------------------- */

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: auto 36px auto repeat(5, auto);
  column-gap: 4px;
}

.sitter { display: contents; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 48px;
  padding: 3px 3px 2px;
  border: 1px solid var(--rule);
  background: transparent;
  grid-row: 1;
  transition: border-color var(--fade) ease, box-shadow var(--fade) ease;
}

.sitter:nth-child(1) .card { grid-column: 1; }
.sitter:nth-child(2) .card { grid-column: 2; }
.sitter:nth-child(3) .card { grid-column: 3; }
.sitter:nth-child(4) .card { grid-column: 4; }
.sitter:nth-child(5) .card { grid-column: 5; }

.portrait {
  display: block;
  width: 100%;
  aspect-ratio: 768 / 460;
  background-image: url("art/sitter-cards.png");
  background-repeat: no-repeat;
  background-size: 500% auto;
  background-position-y: 4.6%;
}

.card[data-sprite="0"] .portrait { background-position-x: 0%; }
.card[data-sprite="1"] .portrait { background-position-x: 25%; }
.card[data-sprite="2"] .portrait { background-position-x: 50%; }
.card[data-sprite="3"] .portrait { background-position-x: 75%; }
.card[data-sprite="4"] .portrait { background-position-x: 100%; }

.card .name {
  display: block;
  margin-top: 2px;
  font-family: var(--print);
  font-size: var(--name-px);
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pins {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0 4px;
  min-height: 0;
  font-size: 11px;
  font-style: italic;
  line-height: 13px;
  color: var(--ink);
}

.pin-mark { display: inline-flex; align-items: center; gap: 1px; }
.pin-mark svg { width: 9px; height: 9px; overflow: visible; }
.pin-mark path { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* A cleared sitter: one firm pen strike through the card. The name stays readable. */
.strike-card {
  position: absolute;
  inset: 4px;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  overflow: visible;
  pointer-events: none;
}

.strike-card path { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; }
.card:not(.is-struck) .strike-card { display: none; }
.card.is-struck .portrait { opacity: 0.55; }

.card.is-target { border-style: dashed; border-color: var(--ink); }
.card.is-answer { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ak-accent), 0 0 18px color-mix(in srgb, var(--ak-accent) 45%, transparent); }

.rail {
  grid-row: 2;
  grid-column: 1 / -1;
  align-self: center;
  height: 0;
  border-top: 1px dashed var(--rule-faint);
}

.planchette {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: auto;
  height: 44px;
  pointer-events: none;
  filter: drop-shadow(1px 2px 0 color-mix(in srgb, var(--ak-ink) 45%, transparent));
}

/* Statements: one ruled line per sitter, written in a slanted hand. */
.say {
  position: relative;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(70px, 23%) minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  min-height: 48px;
  padding: 3px 4px;
  border-bottom: 1px solid var(--rule);
}

.say .margin { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }

.sitter:nth-child(1) .say { grid-row: 4; border-top: 1px solid var(--rule); }
.sitter:nth-child(2) .say { grid-row: 5; }
.sitter:nth-child(3) .say { grid-row: 6; }
.sitter:nth-child(4) .say { grid-row: 7; }
.sitter:nth-child(5) .say { grid-row: 8; }

.say .who {
  position: relative;
  justify-self: start;
  font-family: var(--print);
  font-size: var(--name-px);
  line-height: 1.15;
  padding: 2px 4px;
}

.say .quote {
  position: relative;
  font-size: var(--say-px);
  font-style: italic;
  line-height: 1.22;
}

.say .pins { padding-left: 4px; }

.lie-ring,
.lie-strike {
  position: absolute;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--fade) ease;
}

.lie-ring { inset: -5px -8px; width: calc(100% + 16px); height: calc(100% + 10px); }
.lie-strike { left: -2px; top: 50%; width: calc(100% + 4px); height: 10px; translate: 0 -50%; }
.lie-ring path,
.lie-strike path { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; filter: url(#ink-bleed); }

.say.is-lie .lie-ring,
.say.is-lie .lie-strike { opacity: 1; }

.say.has-stamp { padding-right: 70px; }
.say.is-cleared .quote { color: var(--ink-soft); }
.say.is-cleared .who::after {
  content: ' cleared';
  font-family: var(--hand);
  font-size: 11px;
  font-style: italic;
  color: var(--ink-soft);
}

/* The CASE CLOSED stamp, set in the margin beside the broken statement. */
.stamp {
  position: absolute;
  z-index: 3;
  width: 92px;
  height: 92px;
  pointer-events: none;
  opacity: 0;
  rotate: -14deg;
}

.stamp circle { fill: none; stroke: var(--ink); }
.stamp text { fill: var(--ink); font-family: var(--print); letter-spacing: 0.08em; }
.stamp g { filter: url(#stamp-wear); opacity: 0.9; }
.play.is-solved .stamp { opacity: 1; }

/* ---- The desk: clue sketches clipped in the margin, their words below, then Hint and Accuse */

.desk {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}

.desk-head {
  margin: 0;
  font-family: var(--print);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
}

.clues {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.clues li { display: block; min-width: 0; }

.clue {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 100%;
  min-height: 48px;
  padding: 2px 1px;
}

.sketch {
  position: relative;
  display: block;
  width: min(100%, 52px);
  aspect-ratio: 166 / 128;
  background-image: url("art/clue-sketches.png");
  background-repeat: no-repeat;
  background-size: 200% 300%;
}

.clue .label {
  font-size: 11px;
  font-style: italic;
  line-height: 1.1;
  white-space: nowrap;
}

.clue-list {
  margin: 0;
  padding: 2px 0 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.clue-line {
  padding: 0 4px 0 8px;
  border-left: 2px solid transparent;
  font-size: var(--clue-px);
  line-height: 1.16;
}

.clue-line + .clue-line { border-top: 1px dotted var(--rule-faint); }
.clue-line.is-pen { border-left-color: var(--ink); background: color-mix(in srgb, var(--ak-surface) 75%, transparent); }
.clue-line.is-pointed { border-left: 2px dashed var(--ink); }
.clue-line .num { font-style: italic; color: var(--ink-soft); margin-right: 3px; }
.clue-line .title { font-family: var(--print); margin-right: 4px; }
.clue-line .title::after { content: '.'; }

.clue[data-sprite="0"] .sketch { background-position: 0% 0%; }
.clue[data-sprite="1"] .sketch { background-position: 100% 0%; }
.clue[data-sprite="2"] .sketch { background-position: 0% 50%; }
.clue[data-sprite="3"] .sketch { background-position: 100% 50%; }
.clue[data-sprite="4"] .sketch { background-position: 0% 100%; }
.clue[data-sprite="5"] .sketch { background-position: 100% 100%; }

/* The pen: a loose hand-drawn ring round the clue being pinned. */
.clue-ring {
  position: absolute;
  left: 50%;
  top: 0;
  width: min(108%, 66px);
  height: 100%;
  translate: -50% 0;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--fade) ease;
}

.clue-ring path { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; filter: url(#ink-bleed); }
.clue.is-pen .clue-ring,
.clue.is-pointed .clue-ring { opacity: 1; }
.clue.is-pointed .clue-ring path { stroke-dasharray: 5 4; }


/* The how-to lines: always on screen beside the two headings, in the margin hand. */
.say-head {
  grid-column: 1 / -1;
  grid-row: 3;
  margin: 0;
  padding: 0 2px;
  font-size: 12px;
  line-height: 1.2;
}

.say-head .label,
.desk-head .label { font-family: var(--print); font-size: 14px; }

.say-head .how,
.desk-head .how {
  margin-left: 4px;
  font-family: var(--hand);
  font-size: 12px;
  font-style: italic;
  color: var(--ink);
}

/* The latest hint, on its own line under the clues heading. */
.note {
  margin: 0;
  padding: 1px 6px;
  border-left: 2px solid var(--ink);
  font-size: var(--clue-px);
  font-style: italic;
  line-height: 1.25;
}

.note[hidden] { display: none; }

/* With a clue picked, every card and statement is outlined in dashes as a place to pin it. */
.play.has-pen .card { outline: 2px dashed var(--ink); outline-offset: -3px; }

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.word {
  flex: none;
  min-height: 48px;
  min-width: 64px;
  padding: 0 6px;
  white-space: nowrap;
  font-family: var(--print);
  font-size: 18px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.word.hint { font-family: var(--hand); font-style: italic; font-size: 17px; }
.word.accuse { text-align: right; }
.word[disabled] { opacity: 0.45; cursor: default; }
.play.is-accusing .word.accuse { text-decoration-style: wavy; }

.kept {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 11px;
  font-style: italic;
  line-height: 1.25;
  color: var(--ink-soft);
  text-align: center;
}

.kept.is-trouble { color: var(--ink); }

/* ---- Guided first round: ring, arrow, caption on a solid paper note ---------------------- */

.guide {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}

.guide[hidden] { display: none; }

.guide-ring {
  position: absolute;
  border: 2.5px solid var(--ink);
  border-radius: 50% / 45%;
}

.guide-ring.is-wide { border-radius: 22px; }

.guide-arrow {
  position: absolute;
  width: 34px;
  height: 34px;
  overflow: visible;
}

.guide-arrow path { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

.guide-caption {
  position: absolute;
  margin: 0;
  max-width: min(330px, calc(100vw - 24px));
  padding: 12px 14px;
  border: 1px solid var(--ink);
  background: var(--ak-surface);
  color: var(--ink);
  font-size: 18px;
  font-style: italic;
  line-height: 1.35;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

/* ---- Sideways: board on the left, clues and controls on the right ------------------------ */

@media (orientation: landscape) {
  :root {
    --say-px: clamp(11.5px, min(1.7vw, 3.3dvh), 15px);
    --clue-px: clamp(11px, min(1.45vw, 3dvh), 14px);
    --name-px: clamp(10px, min(1.4vw, 2.9dvh), 13px);
  }

  .play {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 18px;
    row-gap: 4px;
    max-width: 1180px;
    height: 100dvh;
    min-height: 0;
  }

  .masthead { grid-column: 1; grid-row: 1; grid-template-columns: auto minmax(0, 1fr) auto; }
  .say-head { display: none; }
  .notes .timeline { display: none; }
  .notes .how-lie { display: block; }
  /* The sketch strip runs level with start.js's help button, so it stops short of that corner. */
  .clues { margin-right: calc(62px + env(safe-area-inset-right)); }
  .logo { position: static; height: clamp(30px, 9dvh, 44px); }
  .board { grid-column: 1; grid-row: 2; }

  /* The right column starts higher: only the help button sits above it, at its far right. */
  .desk {
    grid-column: 2;
    grid-row: 1 / -1;
    margin-top: calc(-1 * var(--ac-status-h, 76px) + max(6px, env(safe-area-inset-top)));
    min-height: 0;
  }

  .desk-head { min-height: 48px; display: flex; align-items: center; flex-wrap: wrap; padding-right: 66px; }

  .board {
    grid-template-columns: 40px clamp(56px, 15dvh, 96px) minmax(0, 1fr);
    grid-template-rows: repeat(5, minmax(48px, auto));
    column-gap: 6px;
    align-content: start;
  }

  .rail {
    grid-column: 1;
    grid-row: 1 / -1;
    align-self: stretch;
    justify-self: center;
    width: 0;
    height: auto;
    border-top: 0;
    border-left: 1px dashed var(--rule-faint);
  }

  .sitter:nth-child(n) .card { grid-column: 2; padding: 2px; justify-content: center; }
  .sitter:nth-child(1) .card { grid-row: 1; }
  .sitter:nth-child(2) .card { grid-row: 2; }
  .sitter:nth-child(3) .card { grid-row: 3; }
  .sitter:nth-child(4) .card { grid-row: 4; }
  .sitter:nth-child(5) .card { grid-row: 5; }
  .card { align-self: center; }
  .card .name { display: none; }

  .say { grid-column: 3; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; align-content: center; row-gap: 0; padding: 2px 4px; }
  .say .margin { flex-direction: row; align-items: center; gap: 8px; }
  .sitter:nth-child(1) .say { grid-row: 1; }
  .sitter:nth-child(2) .say { grid-row: 2; }
  .sitter:nth-child(3) .say { grid-row: 3; }
  .sitter:nth-child(4) .say { grid-row: 4; }
  .sitter:nth-child(5) .say { grid-row: 5; }
  .say .who { padding: 0 4px; }
  .say .quote { grid-row: 2; }

  .sketch { width: min(100%, 54px); }
}

/* A shorter upright phone: tighter portraits, the clue words in two columns, same layout. */
@media (orientation: portrait) and (max-height: 800px) {
  .portrait { aspect-ratio: 768 / 470; background-position-y: 3.6%; }
  .board { grid-template-rows: auto 36px auto repeat(5, auto); }
  .say { padding: 2px 4px; }
  .notes p { font-size: 11px; }
  .sketch { width: min(100%, 50px); }
  .candle { height: 20px; }
}

/* Desktop: the same layout, centred, a touch roomier. */
@media (min-width: 900px) and (orientation: landscape) {
  .play { padding-left: max(32px, env(safe-area-inset-left)); padding-right: max(32px, env(safe-area-inset-right)); }
  .foot { margin-top: 18px; }
}

/* ---- Motion: slow, and only when the player has not asked for stillness ------------------ */

@media (prefers-reduced-motion: no-preference) {
  :root:not(.ac-still) .planchette.is-sliding {
    transition: left var(--slow) cubic-bezier(0.45, 0, 0.2, 1), top var(--slow) cubic-bezier(0.45, 0, 0.2, 1), rotate var(--slow) ease-in-out;
  }

  :root:not(.ac-still) .say.is-lie .lie-ring path,
  :root:not(.ac-still) .say.is-lie .lie-strike path {
    stroke-dasharray: 400;
    animation: pen-draw 700ms ease-out both;
  }

  :root:not(.ac-still) .say.is-lie .lie-strike path { animation-delay: 380ms; }

  :root:not(.ac-still) .card.is-struck .strike-card path {
    stroke-dasharray: 400;
    animation: pen-draw 600ms ease-out both;
  }

  :root:not(.ac-still) .guide-ring { animation: guide-breathe 2400ms ease-in-out infinite; }

  :root:not(.ac-still) .play.is-solved .stamp { animation: stamp-land 520ms cubic-bezier(0.3, 0, 0.3, 1) 420ms both; }

  :root:not(.ac-still) .play.is-solved .pins .pin-mark {
    animation: pin-settle 500ms ease-out both;
    animation-delay: calc(var(--n, 0) * 90ms);
  }

  :root:not(.ac-still) .play.is-solved .card.is-answer { animation: answer-glow 900ms ease-out both; }

  :root:not(.ac-still) .play.is-arriving .board,
  :root:not(.ac-still) .play.is-arriving .desk { animation: page-in 900ms ease-out both; }

  :root:not(.ac-still) .pin-mark.is-new svg path { stroke-dasharray: 40; animation: pen-draw 360ms ease-out both; }
}

@keyframes pen-draw { from { stroke-dashoffset: 400; } to { stroke-dashoffset: 0; } }
@keyframes guide-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes stamp-land {
  0% { opacity: 0; scale: 1.35; }
  70% { opacity: 1; scale: 0.97; }
  100% { opacity: 1; scale: 1; }
}
@keyframes pin-settle { from { opacity: 0.2; translate: 0 -4px; } to { opacity: 1; translate: 0 0; } }
@keyframes answer-glow { from { box-shadow: 0 0 0 0 transparent; } to { box-shadow: 0 0 0 2px var(--ak-accent), 0 0 18px color-mix(in srgb, var(--ak-accent) 45%, transparent); } }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

/* The chrome's note stays until the next tap; that tap should still land on what is under it. */
#activity-chrome-toast { pointer-events: none; }

/* The case page turns over as one page in the dark, and the board is put away behind it, so
   nothing competes with it: the reason was on the board for a second before the page turned.
   The page carries the case file itself (timeline, five sitters, the lie, the clue that broke
   it, the stamp) as its picture, then the plan's words and one dry closing line. The extra
   specificity is needed because chrome.js injects its ending styles later. */
.play.is-ending .masthead,
.play.is-ending .board,
.play.is-ending .desk { visibility: hidden; }

:root body #activity-chrome-ending.site-shriversify {
  justify-content: flex-start;
  padding: max(72px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.8);
}
/* Auto margins centre the page when there is room and keep its top on screen when there is not. */
:root body #activity-chrome-ending.site-shriversify .ac-card {
  display: flex;
  flex-direction: column;
  margin: auto 0;
  padding: 22px 20px 12px;
}
:root body #activity-chrome-ending.site-shriversify .ac-number { order: 0; }
:root body #activity-chrome-ending.site-shriversify .ac-verdict { order: 1; font-size: clamp(22px, 6vw, 30px); }
:root body #activity-chrome-ending.site-shriversify .ac-work { order: 2; width: 100%; max-width: 290px; margin: 2px auto 10px; }
:root body #activity-chrome-ending.site-shriversify .ac-actions { flex-wrap: wrap; gap: 4px 14px; }
:root body #activity-chrome-ending.site-shriversify .ac-actions button { padding: 0 4px; font-size: 15px; white-space: nowrap; }

@media (orientation: portrait) and (max-height: 800px) {
  :root body #activity-chrome-ending.site-shriversify .ac-work { max-width: 230px; }
  :root body #activity-chrome-ending.site-shriversify .ac-verdict { font-size: 22px; }
  :root body #activity-chrome-ending.site-shriversify .ac-lines { font-size: 14px; line-height: 1.38; }
}
:root body #activity-chrome-ending.site-shriversify .ac-work img { width: 100%; }
:root body #activity-chrome-ending.site-shriversify .ac-lines { order: 3; font-size: 15px; line-height: 1.42; }
:root body #activity-chrome-ending.site-shriversify .ac-line:nth-child(2) { margin: 8px 0 0; font-style: normal; color: var(--ak-ink); }
/* The player's file: a quiet footnote. */
:root body #activity-chrome-ending.site-shriversify .ac-line:nth-child(3) { margin: 6px 0 0; font-size: 13px; }
:root body #activity-chrome-ending.site-shriversify .ac-actions { order: 4; }

/* Sideways, the page is recomposed rather than stretched: the case file on the left, the
   verdict, the words and the two ways on at its right, so the width is used and no band of
   empty paper is left under it. It keeps clear of the help button's column on both sides. */
@media (orientation: landscape) {
  :root body #activity-chrome-ending.site-shriversify {
    align-items: center;
    padding: max(10px, env(safe-area-inset-top)) 72px max(10px, env(safe-area-inset-bottom));
  }

  :root body #activity-chrome-ending.site-shriversify .ac-card {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    grid-template-rows: auto auto 1fr auto;
    column-gap: clamp(14px, 3vw, 28px);
    width: 100%;
    max-width: 980px;
    max-height: 100%;
    overflow-y: auto;
    padding: clamp(10px, 3dvh, 24px) clamp(14px, 2.5vw, 28px);
    text-align: left;
  }

  :root body #activity-chrome-ending.site-shriversify .ac-work {
    grid-column: 1;
    grid-row: 1 / -1;
    align-self: center;
    width: 100%;
    max-width: none;
    margin: 0;
  }

  :root body #activity-chrome-ending.site-shriversify .ac-work img { max-height: calc(100dvh - 48px); object-fit: contain; }
  :root body #activity-chrome-ending.site-shriversify .ac-number { grid-column: 2; grid-row: 1; margin: 0 0 2px; font-size: 12px; letter-spacing: 0.08em; }

  :root body #activity-chrome-ending.site-shriversify .ac-verdict {
    grid-column: 2;
    grid-row: 2;
    margin: 0 0 6px;
    padding-bottom: 6px;
    font-size: clamp(18px, 5.4dvh, 28px);
  }

  :root body #activity-chrome-ending.site-shriversify .ac-lines {
    grid-column: 2;
    grid-row: 3;
    align-self: start;
    font-size: clamp(12.5px, 3.5dvh, 16px);
    line-height: 1.32;
  }

  :root body #activity-chrome-ending.site-shriversify .ac-line:nth-child(3) { font-size: 12px; }
  :root body #activity-chrome-ending.site-shriversify .ac-actions button { padding: 0 4px; font-size: 14px; }

  :root body #activity-chrome-ending.site-shriversify .ac-line { margin-bottom: 4px; }
  :root body #activity-chrome-ending.site-shriversify .ac-actions { grid-column: 2; grid-row: 4; justify-content: flex-start; margin-top: clamp(4px, 1.5dvh, 12px); gap: 12px; }
}

/* A short phone on its side (about 430px tall or less): the timeline note gives way to the goal,
   the rail narrows, and each sitter's name starts the first line of their statement, so all
   five statements fit their 48px rows without spilling into the next. */
@media (orientation: landscape) and (max-height: 430px) {
  .notes .timeline { display: none; }
  .candle { height: 20px; }
  .board { grid-template-columns: 30px clamp(44px, 12dvh, 96px) minmax(0, 1fr); column-gap: 5px; }
  .say { display: flow-root; padding: 3px 4px; }
  .say .margin { float: left; display: flex; flex-direction: row; align-items: center; gap: 4px; margin: 0 6px 0 0; }
  .say .quote { display: block; }
  .logo { height: 22px; }
  .masthead { gap: 6px; padding-bottom: 0; }
  .play { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .notes p { font-size: 11px; line-height: 1.2; }
  .desk-head { min-height: 34px; }
  .desk { gap: 2px; }
  .sketch { width: min(100%, 44px); }
  .clue .label { font-size: 10.5px; }
  .clue-line { font-size: 11px; line-height: 1.1; padding-top: 0; padding-bottom: 0; }
  .note { font-size: 11px; line-height: 1.15; padding: 0 6px; }
  .desk-head { min-height: 30px; }
  .clue .label { line-height: 1; }
  .foot .word { min-height: 48px; }
}

/* ---- The opening: a letter on foxed paper, read by one candle in the dark -------------------
   start.js draws this screen; these rules only dress it in this case's look. Two ids beat
   start.js's own short-screen rules, and this sheet is linked before start.js injects its own. */
html body #activity-start#activity-start.site-shriversify { background-color: var(--ak-ink); box-shadow: none; }

html body #activity-start#activity-start.site-shriversify.has-backdrop::before {
  background:
    radial-gradient(ellipse 60% 48% at 50% 34%, color-mix(in srgb, var(--ak-accent) 16%, transparent), transparent 72%),
    linear-gradient(color-mix(in srgb, var(--ak-ink) 84%, transparent), color-mix(in srgb, var(--ak-ink) 84%, transparent)),
    url("art/seance-table.jpg") center / cover no-repeat;
}

html body #activity-start#activity-start.site-shriversify.has-backdrop::after {
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.7) 100%);
}

/* The paper: foxed at the edges, a little askew, lit from above. */
html body #activity-start#activity-start.site-shriversify .ak-scene,
html body #activity-start#activity-start.site-shriversify .ak-sheet {
  background-color: var(--ak-surface);
  background-image:
    radial-gradient(circle at 9% 12%, color-mix(in srgb, var(--ak-link) 13%, transparent) 0 3%, transparent 8%),
    radial-gradient(circle at 91% 22%, color-mix(in srgb, var(--ak-link) 9%, transparent) 0 2%, transparent 6%),
    radial-gradient(circle at 84% 88%, color-mix(in srgb, var(--ak-link) 12%, transparent) 0 4%, transparent 10%),
    radial-gradient(circle at 14% 82%, color-mix(in srgb, var(--ak-link) 8%, transparent) 0 2%, transparent 7%),
    radial-gradient(ellipse at center, transparent 62%, color-mix(in srgb, var(--ak-link) 12%, transparent) 100%);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65), 0 0 0 1px color-mix(in srgb, var(--ak-ink) 30%, transparent);
}

html body #activity-start#activity-start.site-shriversify .ak-scene {
  position: relative;
  justify-content: flex-start;
  gap: 18px;
  width: min(100%, 540px);
  min-height: 0;
  margin: max(2vh, 8px) auto;
  padding: 30px clamp(20px, 6vw, 40px) 26px;
  rotate: -0.6deg;
  text-align: left;
}

html body #activity-start#activity-start.site-shriversify .ak-scene .ak-head { align-self: center; }
html body #activity-start#activity-start.site-shriversify .ak-scene .ak-logo { max-height: clamp(70px, 16dvh, 130px); }

/* The words: plain ink in a letter-writer's hand, no blur, readable at a glance. */
html body #activity-start#activity-start.site-shriversify .ak-scene-lines {
  gap: 10px;
  max-width: 34ch;
}

html body #activity-start#activity-start.site-shriversify .ak-scene-lines::before {
  content: 'To whoever sits at this table next,';
  font-family: var(--ak-font-body);
  font-size: 15px;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--ak-ink-muted);
}

html body #activity-start#activity-start.site-shriversify .ak-scene-line {
  font-family: var(--ak-font-body);
  font-size: clamp(17px, 4.6vw, 21px);
  font-style: italic;
  line-height: 1.5;
  color: var(--ak-ink);
  text-shadow: none;
}

html body #activity-start#activity-start.site-shriversify .ak-scene-lines::after {
  content: 'The house';
  align-self: flex-end;
  font-family: var(--ak-font-display);
  font-size: 18px;
  color: var(--ak-ink);
}

html body #activity-start#activity-start.site-shriversify .ak-scene-actions { align-self: center; margin-top: 4px; }

/* The wax seal: the first thing to press, warm in the candlelight, never bright. */
html body #activity-start#activity-start.site-shriversify .ak-go {
  border: 3px solid color-mix(in srgb, var(--ak-btn-active) 45%, var(--ak-ink));
  background: radial-gradient(circle at 36% 30%, color-mix(in srgb, var(--ak-btn-active) 78%, var(--ak-ink)), color-mix(in srgb, var(--ak-btn-active) 46%, var(--ak-ink)) 62%, color-mix(in srgb, var(--ak-btn-active) 30%, var(--ak-ink)));
  color: var(--ak-btn-ink);
  box-shadow:
    inset 0 0 0 6px color-mix(in srgb, var(--ak-btn-active) 38%, var(--ak-ink)),
    inset 0 0 0 7px color-mix(in srgb, var(--ak-btn-ink) 25%, transparent),
    0 6px 16px rgba(0, 0, 0, 0.45),
    0 0 26px color-mix(in srgb, var(--ak-accent) 30%, transparent);
}

/* The letter's first move shows the clue it names: the seating chart's sketch beside it. */
html body #activity-start#activity-start.site-shriversify .ak-first {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  text-align: left;
}

html body #activity-start#activity-start.site-shriversify .ak-first::before {
  content: '';
  grid-row: 1 / span 2;
  width: 72px;
  aspect-ratio: 166 / 128;
  background: url("art/clue-sketches.png") 0 0 / 200% 300% no-repeat;
}

html body #activity-start#activity-start.site-shriversify .ak-first-label { display: block; }

/* The crawl becomes a slow fade, line by line, as if the ink were surfacing on the page. */
@media (prefers-reduced-motion: no-preference) {
  html body #activity-start#activity-start.site-shriversify .scene-crawl .ak-scene-line {
    animation: ak-fade calc(900ms * var(--ak-pace, 1)) ease-out both;
    animation-delay: calc((300ms + var(--ak-line) * 700ms) * var(--ak-pace, 1));
  }
}

@media (prefers-reduced-motion: reduce) {
  html body #activity-start#activity-start.site-shriversify .scene-crawl .ak-scene-line { animation: none; }
}
