/* ==========================================================================
   Murder at the Prompt — "Golden Age whodunit" theme
   A warm, printed-page aesthetic in the tradition of the 1920s–30s parlour
   mystery: ivory paper, sepia ink, deep oxblood and brass accents, elegant
   serif type and Art Deco double rules. color-scheme:light is set so native
   UI (scrollbars, form fields on the login page) renders light to match.
   ========================================================================== */

:root {
    color-scheme: light;

    --paper:      #f4ead2;   /* aged ivory page */
    --paper-soft: #eaddbf;   /* slightly deeper panel */
    --ink:        #20180f;   /* sepia-black ink */
    --ink-dim:    #6f5f49;   /* faded ink */
    --rule:       #c8b083;   /* aged hairline */
    --rule-soft:  #d8c8a4;
    --oxblood:    #7c1f1f;   /* deep burgundy, used for emphasis */
    --oxblood-dk: #5c1717;
    --brass:      #9a7426;   /* antique gold */
    --plum:       #6c4a86;   /* muted aubergine, for suspect presence */
    --danger:     #8c1c1c;

    --serif:   "Spectral", Georgia, "Times New Roman", Times, serif;
    --display: "Playfair Display", Georgia, "Times New Roman", Times, serif;

    --map-cell: 1.7rem;   /* mini-map tile size (shared by JS grid tracks) */

    --radius:    10px;    /* squircle corner radius for buttons, fields, panels */
    --radius-sm: 6px;     /* tighter radius for small chips / cells */
    --deck-h: clamp(54px, 16vw, 76px);  /* typewriter footer banner height */

    --mono: "Special Elite", ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Code",
            "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

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

body {
    font-family: var(--serif);
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--ink);
    background-color: var(--paper);
    min-height: 100vh;   /* fallback */
    min-height: 100svh;  /* mobile dynamic viewport */
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

:focus-visible {
    outline: 2px solid var(--oxblood);
    outline-offset: 2px;
}

/* --- chrome ------------------------------------------------------------- */

header {
    padding: 0.9rem 1.25rem;
    border-bottom: 3px double var(--rule);
    text-align: center;
}

header nav a {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    color: var(--ink);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

header nav a::before { content: "❧ "; color: var(--oxblood); }

main {
    flex: 1;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 2.5rem 1.35rem 3.5rem;
}

footer {
    padding: 1.1rem 1.25rem;
    border-top: 3px double var(--rule);
    text-align: center;
    font-size: 0.82rem;
    font-style: italic;
    color: var(--ink-dim);
}

/* --- hero --------------------------------------------------------------- */

.hero { padding: 0.5rem 0; text-align: center; }

.kicker {
    font-size: 0.72rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--oxblood);
    margin-bottom: 0.9rem;
}

.hero h1 {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(2.4rem, 10vw, 3.8rem);
    line-height: 1.08;
    letter-spacing: 0.01em;
}

/* masthead logo (replaces the text title) */
.masthead { margin: 0; }
.masthead__logo {
    display: block;
    width: clamp(280px, 78vw, 480px);
    height: auto;
    margin: 0 auto;
}

/* decorative rule beneath the title */
.byline {
    font-style: italic;
    color: var(--ink-dim);
    margin-top: 0.65rem;
    font-size: 1.02rem;
}
.byline::before,
.byline::after {
    content: "—";
    color: var(--brass);
    margin: 0 0.55em;
}

.lede {
    margin: 1.6rem auto 0;
    max-width: 52ch;
    text-align: left;
}

/* --- case file (replaces the old boot terminal) ------------------------- */

.case-file {
    margin: 2.25rem 0;
    padding: 1.5rem 1.4rem 1.6rem;
    border: 1px solid var(--rule);
    outline: 1px solid var(--rule);
    outline-offset: 4px;             /* Art Deco double frame */
    background: var(--paper-soft);
    text-align: center;
}

.case-file__label {
    font-family: var(--display);
    font-size: 0.78rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--oxblood);
    margin-bottom: 0.6rem;
}

.case-file__brief {
    font-style: italic;
    color: var(--ink-dim);
    margin-bottom: 1.1rem;
}

.case-file__stats {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 1.5rem;
    padding: 0.9rem 0;
    border-top: 1px solid var(--rule-soft);
    border-bottom: 1px solid var(--rule-soft);
}
.case-file__stats li {
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    color: var(--ink-dim);
    text-transform: lowercase;
}
.case-file__stats .num {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--ink);
    margin-right: 0.3em;
}

.case-file__motto {
    margin-top: 1.1rem;
    font-style: italic;
    color: var(--ink);
}

/* --- how it plays ------------------------------------------------------- */

.section-label {
    font-family: var(--display);
    font-size: 0.82rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-dim);
    text-align: center;
    margin: 2.5rem 0 1.25rem;
}
.section-label::before,
.section-label::after {
    content: "·";
    color: var(--brass);
    margin: 0 0.6em;
}

.steps {
    list-style: none;
    counter-reset: step;
    display: grid;
    gap: 0.2rem;
    text-align: left;
}
.steps li {
    counter-increment: step;
    display: grid;
    grid-template-columns: minmax(6.5rem, max-content) 1fr;
    gap: 0.15rem 1.1rem;
    align-items: baseline;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--rule-soft);
}
.steps li:last-child { border-bottom: 0; }
.steps .verb {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--oxblood);
    white-space: nowrap;
}
.steps .verb::before {
    content: counter(step, upper-roman) ". ";
    color: var(--brass);
    font-weight: 700;
}
.steps .desc { color: var(--ink-dim); }

@media (max-width: 30rem) {
    .steps li { grid-template-columns: 1fr; }
}

/* --- calls to action ---------------------------------------------------- */

.commands {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.85rem;
    margin-top: 2rem;
}

.note {
    margin-top: 1.4rem;
    font-size: 0.86rem;
    font-style: italic;
    text-align: center;
    color: var(--ink-dim);
}

/* --- buttons (links that read like an engraved plate) ------------------- */

.cmd {
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-block;
    padding: 1rem 1.4rem;
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.cmd:hover,
.cmd:focus-visible {
    background: var(--ink);
    color: var(--paper);
}
.cmd-primary {
    border-color: var(--oxblood);
    background: var(--oxblood);
    color: var(--paper);
}
.cmd-primary:hover,
.cmd-primary:focus-visible {
    background: var(--oxblood-dk);
    border-color: var(--oxblood-dk);
}
.cmd.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-style: dashed;
}
.cmd.is-disabled:hover {
    background: transparent;
    color: var(--paper);
    border-color: var(--oxblood);
}

/* --- auth (login) ------------------------------------------------------- */

.auth { max-width: 380px; margin: 2.5rem auto; }
.auth h1 {
    font-family: var(--display);
    margin-bottom: 1.25rem;
    font-size: 1.7rem;
    text-align: center;
}
.auth label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-dim);
}
.auth input {
    display: block;
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.6rem 0.7rem;
    font: inherit;
    color: var(--ink);
    background: #fbf5e6;
    border: 1px solid var(--rule);
}
.auth input:focus-visible { border-color: var(--oxblood); outline: none; }

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

.btn {
    font-family: var(--display);
    font-weight: 600;
    display: inline-block;
    padding: 0.6rem 1.4rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--paper);
    background: var(--oxblood);
    border: 1px solid var(--oxblood);
    cursor: pointer;
}
.btn:hover { background: var(--oxblood-dk); border-color: var(--oxblood-dk); }

.error {
    color: var(--danger);
    margin-bottom: 1rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.9rem;
    border: 1px solid var(--danger);
    background: rgba(140, 28, 28, 0.07);
}

.error-page { text-align: center; padding: 3rem 0; }
.error-page h1 { font-family: var(--display); margin-bottom: 0.5rem; }
.error-page p { margin-bottom: 1rem; color: var(--ink-dim); }
.error-page a { color: var(--oxblood); text-decoration: underline; }
.error-page a:hover { color: var(--oxblood-dk); }

/* --- game (the play loop) ----------------------------------------------- */

.game-loading { color: var(--ink-dim); font-style: italic; text-align: center; padding: 2rem 0; }

/* the play view is immersive — drop the site footer here */
body:has(.game) footer { display: none; }

/* sticky header: id + map on the left, the cluebook on the right */
.game-top {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 0.6rem 0 1.7rem;
    margin-bottom: 1rem;
    border-bottom: 3px double var(--rule);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background-color: #f4ead2;
}
.game-id { min-width: 0; }
.game-case {
    font-family: var(--display);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--oxblood);
}
.game-locale { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-dim); margin-bottom: 0.5rem; }

.game-top-left {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: stretch;
}

/* hidden beta control: a faint "replay" glyph tucked beside the case number.
   Near-invisible until hovered/focused; lets testers replay the same day. */
.reset-link {
    margin-left: 0.5rem; padding: 0 0.25rem;
    font-family: var(--mono); font-size: 0.8rem; line-height: 1;
    background: transparent; border: 0; cursor: pointer;
    color: var(--ink-dim); opacity: 0.12; transition: opacity 0.15s, color 0.15s;
}
.reset-link:hover, .reset-link:focus-visible { opacity: 1; color: var(--oxblood); }
.game-dev { font-family: var(--display); font-size: 0.6rem; letter-spacing: 0.12em; background: var(--oxblood); color: var(--paper); padding: 0.05rem 0.4rem; border-radius: 3px; }

/* mini-map: a small floor-plan grid built from room x/y */
.minimap { display: grid; gap: 4px; justify-content: start; }
.map-cell {
    display: flex; align-items: center; justify-content: center;
    width: var(--map-cell); height: var(--map-cell);
    font-family: var(--display); font-size: 0.8rem;
    border: 1px solid var(--rule); color: var(--ink-dim); background: var(--paper-soft);
}
.map-empty { border: 0; background: transparent; }
.map-unseen { opacity: 0.4; }
.map-seen { color: var(--ink); }
.map-here { background: var(--oxblood); border-color: var(--oxblood); color: var(--paper); }
/* visited cells are buttons (re-read the room); strip UA chrome, keep the cell look */
.map-link { padding: 0; margin: 0; appearance: none; -webkit-appearance: none; cursor: pointer; }
.map-link:hover { border-color: var(--oxblood); }
.map-link:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 1px; }

/* room dossier: re-read a visited room's first-visit description (reuses cluebook modal chrome) */
.room-dossier-body { margin: 0; padding: 0.25rem 0; color: var(--ink); line-height: 1.6; }

/* top-right cluster: cluebook illustration with the accusation link beneath it */
.game-top-right {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
    height: stretch;
}
/* cluebook + suspects grouped together at the top of the right column */
.game-books {
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
}
/* suspects dossier link — a row of face pips (one per suspect) plus a count badge */
.suspects-btn {
    flex: none; background: transparent; border: 0; cursor: pointer; padding: 0;
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.suspect-pips { display: inline-flex; align-items: center; gap: 3px; }
.suspect-pip { display: inline-flex; color: var(--ink-dim); opacity: 0.4; transition: color 0.12s, opacity 0.12s; }
.suspect-pip.is-found { color: var(--oxblood); opacity: 1; }   /* examined → red */
.pip-ico { width: 18px; height: 18px; display: block; fill: currentColor; transform-origin: center; }
.suspects-btn:hover .suspect-pip:not(.is-found) { opacity: 0.6; }
/* a just-examined suspect's pip pulses once to flag it was added to the dossier */
.suspect-pip.is-new .pip-ico { animation: pip-pulse 0.7s ease-out; }
@keyframes pip-pulse {
    0%   { transform: scale(1); }
    25%  { transform: scale(1.6); }
    50%  { transform: scale(1); }
    75%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}
/* the decisive call-to-action — a filled oxblood button so it reads as the key move */
.accuse-link {
    font-family: var(--display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--paper);
    background: var(--oxblood); border: 1px solid var(--brass); border-radius: var(--radius-sm);
    padding: 0.45rem 0.9rem; cursor: pointer; white-space: nowrap;
    box-shadow: 0 1px 3px rgba(60, 30, 20, 0.35);
    transition: background 0.12s, transform 0.05s;
}
.accuse-link:hover, .accuse-link:focus-visible { background: var(--oxblood-dk); color: var(--paper); }
.accuse-link:active { transform: translateY(1px); }

/* cluebook control (the leather book illustration + caption) */
.cluebook-btn {
    flex: none;
    display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
    background: transparent; border: 0; cursor: pointer; padding: 0;
}
.cluebook-img {
    width: 135px;
    height: auto;
    cursor: pointer;
    display: block;
    filter: drop-shadow(0 2px 3px rgba(60, 30, 20, 0.25));
    transition: transform 0.12s;
}
.cluebook-btn:hover .cluebook-img, .cluebook-btn:focus-visible .cluebook-img { transform: translateY(-2px); }
/* shared count badge — clue count on the book corner, suspect count after the pips */
.count-badge {
    font-family: var(--display); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.03em;
    color: var(--paper); background: var(--oxblood);
    border: 1px solid var(--brass); border-radius: 999px;
    padding: 0.1rem 0.42rem; line-height: 1.25;
    box-shadow: 0 1px 2px rgba(60, 30, 20, 0.35);
    white-space: nowrap;
}
.cluebook-icon { position: relative; display: inline-block; line-height: 0; }
.cluebook-badge { position: absolute; top: 4px; right: 2px; pointer-events: none; }

/* cluebook modal (clue cards) — opens over the play view, light-dismiss */
.cluebook-modal { max-width: 460px; }
.cluebook-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; margin-bottom: 0.9rem;
}
/* fixed-size cluebook so it doesn't jump as clues/filters change: the card is a
   flex column at a stable height; head + filter stay pinned, the list scrolls.
   (scoped to .clue-modal — the suspects/room dossiers stay content-sized.) */
.clue-modal {
    height: min(85vh, 640px);
    display: flex; flex-direction: column;
    overflow: hidden;   /* inner .clue-scroll owns the scrolling */
}
.clue-modal .cluebook-modal-head,
.clue-modal .clue-filter { flex: 0 0 auto; }
.clue-modal .clue-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.cluebook-head {
    font-family: var(--display); font-size: 0.82rem; letter-spacing: 0.18em;
    text-transform: uppercase; color: var(--oxblood);
}
.cluebook-close {
    font-family: var(--display); font-size: 1.5rem; line-height: 1;
    background: transparent; border: 0; color: var(--ink-dim); cursor: pointer; padding: 0 0.3rem;
}
.cluebook-close:hover, .cluebook-close:focus-visible { color: var(--oxblood); }
.clue-list { list-style: none; display: grid; gap: 0.7rem; }
.clue { display: grid; gap: 0.15rem; padding: 0.65rem 0.8rem; border: 1px solid var(--rule-soft); background: var(--paper); }
.clue-cat {
    justify-self: start; display: inline-block;
    font-family: var(--display); font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--oxblood); border: 1px solid currentColor; border-radius: var(--radius-sm);
    padding: 0.06rem 0.42rem; line-height: 1.35;
}
/* per-type pill colour (border follows the text via currentColor) */
.clue-cat--method { color: #3a5f6e; }
.clue-cat--evidence { color: var(--oxblood); }
.clue-cat--motive { color: var(--plum); }
.clue-cat--opportunity { color: var(--brass); }
.clue-title { font-family: var(--display); font-weight: 700; }
.clue-summary { color: var(--ink); }
.clue-source { font-size: 0.76rem; font-style: italic; color: var(--ink-dim); }
.clue-empty { font-style: italic; color: var(--ink-dim); }

/* cluebook category filter + grouping */
.clue-filter { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.8rem; }
.clue-filter-chip {
    font-family: var(--display); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase;
    padding: 0.16rem 0.6rem; border: 1px solid var(--rule); border-radius: var(--radius-sm);
    background: transparent; color: var(--ink-dim); cursor: pointer;
}
.clue-filter-chip:hover, .clue-filter-chip:focus-visible { border-color: var(--oxblood); color: var(--oxblood); }
.clue-filter-chip.is-active { background: var(--oxblood); border-color: var(--oxblood); color: var(--paper); }
.clue-filter-n { opacity: 0.7; }
.clue-group {
    font-family: var(--display); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--ink-dim); margin: 0.9rem 0 0.4rem; padding-bottom: 0.2rem; border-bottom: 1px solid var(--rule-soft);
}
.clue-group-n { opacity: 0.7; font-size: 0.82em; }

/* the game log (MUD-style scrollback) */
.log { font-family: var(--mono); font-size: 1rem; line-height: 1.65; }
.log-entry { padding: 0.55rem 0; border-bottom: 1px dashed var(--rule-soft); }
.log-entry:last-child { border-bottom: 0; }
.log-cmd { color: var(--oxblood); font-weight: 600; letter-spacing: 0.02em; }
.log-loc { color: var(--oxblood); font-weight: 700; letter-spacing: 0.06em; }
.log-sub { color: var(--ink-dim); }
.log-body { color: var(--ink); margin: 0.15rem 0; }
.log-pres, .log-pres-suspect { font-style: normal; margin-block: 0.4rem; font-size: 1rem; line-height: 1.35; }
.log-pres { color: var(--brass); }
.log-pres-suspect { color: var(--plum); }
.log-note { color: var(--brass); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 1rem; margin-top: 0.3rem; }
.log-verdict { font-family: var(--display); font-size: 1.3rem; color: var(--ink); margin: 0.2rem 0; }
/* the killer's confession — a quote block shown above the epilogue on a solve.
   pre-wrap preserves paragraph breaks in longer authored confessions. */
.log-confession {
    font-style: italic; color: var(--ink); white-space: pre-wrap;
    margin: 0.6rem 0 0.2rem; padding-left: 0.9rem; border-left: 2px solid var(--oxblood);
}
.log-confession-by {
    font-family: var(--display); color: var(--oxblood); text-align: right;
    letter-spacing: 0.04em; margin-bottom: 0.5rem;
}

/* typewriter reveal for a freshly logged turn: the command line types out one
   character at a time (with a blinking caret), then after a beat the rest of the
   response fades up line by line. Empty typing line keeps a line's height so the
   layout doesn't jump as text fills in. */
.log-cmd.is-typing { min-height: 1.65em; }
.log-cmd.is-typing.is-caret::after {
    content: "\2588";          /* block caret */
    color: var(--oxblood);
    margin-left: 0.04em;
    animation: log-caret 0.7s step-end infinite;
}
@keyframes log-caret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

.log-reveal { opacity: 0; transform: translateY(0.35rem); }
.log-reveal.is-shown {
    opacity: 1; transform: none;
    transition: opacity 0.32s ease, transform 0.32s ease;
}

@media (prefers-reduced-motion: reduce) {
    .log-cmd.is-typing { min-height: 0; }
    .log-reveal { opacity: 1; transform: none; transition: none; }
}

/* command bar — typewriter keys */
.cmd-bar { display: flex; flex-wrap: wrap; gap: 0 0.75rem; margin-top: 1.1rem; }

/* the room actions are glued to the bottom of the screen like a prompt input,
   sitting on a dark "typewriter deck" that spans the viewport; the key cluster
   is centred to the content column */
.prompt-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--deck-h);   /* rests on top of the typewriter footer banner */
    z-index: 20;
    margin: 0;
    padding: 0.7rem max(calc(50% - 640px / 2), 20px);
    background: #fff8e7;
    border-top: 1px dotted var(--rule);
    box-shadow: 0 -16px 16px -8px var(--paper);     /* content gently fades into the choices */
    max-height: 46vh;
    overflow-y: auto;
}

/* the typewriter "desk": a fixed full-bleed strip at the very bottom that the
   action dock sits on. Shows the whole banner (contain) centred on deck-dark,
   and absorbs the iOS home-indicator safe area below the image. */
.deck-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    height: var(--deck-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #1d1610 url("/assets/img/typewriter.png?v=12") center no-repeat;
    background-size: cover;
}
/* baseline clearance so content is never hidden behind the dock before JS
   measures its exact height */
.game { padding-bottom: 8rem; }

/* room actions read as typewriter-typed text in square brackets — e.g. [ GO HALL ] —
   sitting on the page rather than as raised keys */
.game-cmd {
    display: inline-flex;
    align-items: center;
    font-family: var(--mono);
    font-size: 1rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--ink);
    background: transparent;
    border: 0;
    padding: 0.45rem 0.1rem;
    cursor: pointer;
    transition: color 0.12s ease, opacity 0.12s ease, transform 0.05s ease;
}
.game-cmd:hover { color: var(--oxblood); }
.game-cmd:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.game-cmd:active { color: var(--oxblood-dk); transform: translateY(1px); }
.game-cmd.is-done { opacity: 0.55; text-decoration: line-through; }      /* already examined / questioned — struck through like crossed-out type */
/* the accusation action — same typed-text form, but oxblood and bold so it reads as the decisive move */
.game-accuse { color: var(--oxblood); font-weight: 700; }
.game-accuse:hover { color: var(--oxblood-dk); }

/* finished (Wordle-style summary) */
.finish { margin-top: 1.2rem; padding: 1rem 1.1rem; border: 1px solid var(--brass); background: var(--paper-soft); }
.finish-head { font-family: var(--display); font-size: 1.3rem; margin-bottom: 0.3rem; }
.finish-tally { font-family: var(--display); letter-spacing: 0.06em; color: var(--oxblood); margin-bottom: 0.8rem; }
.finish-note { margin-top: 0.8rem; font-style: italic; color: var(--ink-dim); font-size: 0.85rem; }
.share-text {
    font-family: var(--mono); font-size: 0.82rem; white-space: pre-wrap;
    padding: 0.8rem 0.9rem; border: 1px dashed var(--rule); background: var(--paper); margin-bottom: 0.6rem;
}

/* accusation overlay (dialog) */
.overlay {
    position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
    padding: 1.25rem; background: rgba(33, 24, 15, 0.55);
}
.overlay-card { width: 100%; max-width: 420px; background: var(--paper); border: 1px solid var(--ink); padding: 1.2rem 1.25rem 1.35rem; max-height: 90vh; overflow-y: auto; }
.accuse-form { display: grid; gap: 0.9rem; }
.accuse-intro { color: var(--ink-dim); font-size: 0.9rem; }
.accuse-form label { display: grid; gap: 0.35rem; font-family: var(--display); font-size: 0.76rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
.accuse-form select { font: inherit; min-height: 44px; padding: 0.5rem 0.6rem; color: var(--ink); background: #fbf5e6; border: 1px solid var(--rule); }
.accuse-form select:focus-visible { border-color: var(--oxblood); outline: none; }
.game-label { font-family: var(--display); font-size: 1.1rem; }


/* --- admin -------------------------------------------------------------- */

.admin { max-width: 1000px; justify-self: center; }
.admin-bar { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.admin-bar h1 { font-family: var(--display); font-size: 1.6rem; }
.admin-empty { color: var(--ink-dim); font-style: italic; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--rule-soft); }
.admin-table th { font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.admin-table th.num, .admin-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table td.num .rate { color: var(--ink-dim); font-size: 0.82em; }

/* play metrics: 2-week chart + per-case counts */
.metrics-panel { margin: 0 0 1.5rem; padding: 1rem 1.1rem 0.6rem; border: 1px solid var(--rule); background: var(--paper-soft); }
.metrics-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.metrics-head h2 { font-family: var(--display); font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }
.metrics-legend { list-style: none; display: flex; gap: 1rem; font-size: 0.78rem; color: var(--ink-dim); }
.metrics-legend li { display: flex; align-items: center; gap: 0.35rem; }
.metrics-legend .swatch { width: 0.7rem; height: 0.7rem; display: inline-block; border: 1px solid rgba(0,0,0,0.15); }
.metrics-chart { width: 100%; height: auto; display: block; }
.metrics-chart .m-axis { fill: var(--ink-dim); font-family: var(--mono); font-size: 9px; }
.metrics-chart .m-axis-line { stroke: var(--rule); stroke-width: 1; }
/* shared bar/swatch colours */
.m-start { background: var(--brass); fill: var(--brass); }
.m-accuse { background: var(--ink-dim); fill: var(--ink-dim); }
.m-solve { background: var(--oxblood); fill: var(--oxblood); }

.admin-form { display: grid; gap: 0.9rem; margin: 1.25rem 0; }
.admin-form label { display: grid; gap: 0.35rem; font-family: var(--display); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.admin-form textarea, .admin-form select, .admin-inline input {
    font: inherit; padding: 0.55rem 0.7rem; color: var(--ink); background: #fbf5e6; border: 1px solid var(--rule);
}
.admin-form textarea:focus-visible, .admin-form select:focus-visible { border-color: var(--oxblood); outline: none; }
.json-edit { font-family: var(--mono, ui-monospace, monospace); font-size: 0.82rem; line-height: 1.5; white-space: pre; }
/* AI prompt settings: prose prompts wrap rather than scroll horizontally */
.settings-field { margin: 1.6rem 0; }
.settings-field .json-edit { white-space: pre-wrap; width: 100%; }
.settings-field code { font-family: var(--mono); font-size: 0.85em; background: var(--paper-soft); padding: 0 0.2rem; }
.admin-blank { margin-top: 0; }
.admin-hint, .admin-foot { font-size: 0.82rem; color: var(--ink-dim); font-style: italic; }
.admin-foot { margin-top: 1.5rem; }
.admin-foot a, .admin-table a { color: var(--oxblood); }

.admin-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 1rem 0 1.5rem; }
.admin-inline { display: flex; gap: 0.4rem; align-items: center; }
/* match the inline publish-date field to the adjacent .cmd button's height */
.admin-inline input[type="date"] { font-family: var(--display); font-size: 0.95rem; line-height: 1.7; padding: 0.5rem 1rem; }

.audit { padding: 0.8rem 1rem; border: 1px solid var(--rule); background: var(--paper-soft); margin-bottom: 1rem; }
.audit-pass { border-color: var(--brass); }
.audit-fail { border-color: var(--oxblood); }
.audit-list { margin: 0.5rem 0 0 1.1rem; font-size: 0.88rem; }
.audit-err { color: var(--oxblood); }
.audit-warn { color: var(--ink-dim); }

/* /admin is desktop-first — widen the column */
body:has(.admin) main { max-width: 1100px; }

/* case editor — structured read view */
.editor .admin-bar { align-items: flex-start; }
.editor .admin-bar h1 { font-size: 1.7rem; }
.ed-meta { font-size: 0.85rem; color: var(--ink-dim); margin-top: 0.25rem; }
.ed-bar-actions { display: flex; gap: 0.5rem; flex: none; }
.badge { font-family: var(--display); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; padding: 0.12rem 0.45rem; border: 1px solid var(--rule); }
.badge-published { color: var(--paper); background: var(--oxblood); border-color: var(--oxblood); }
.badge-draft { color: var(--ink-dim); }

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin: 1.4rem 0; align-items: start; }
.ed-col { display: grid; gap: 1.4rem; align-content: start; }
@media (max-width: 60rem) { .editor-grid { grid-template-columns: 1fr; } }

.ed-card { border: 1px solid var(--rule); background: var(--paper-soft); padding: 1rem 1.1rem 1.2rem; }
.ed-card > h2 {
    font-family: var(--display); font-size: 1.05rem; margin-bottom: 0.7rem;
    padding-bottom: 0.4rem; border-bottom: 1px solid var(--rule-soft);
    display: flex; justify-content: space-between; align-items: baseline;
}
.ed-count { font-size: 0.78rem; color: var(--ink-dim); }
.ed-card p { margin: 0.15rem 0; }
.ed-label { font-family: var(--display); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--oxblood); margin-top: 1.7rem !important; }
.ed-sub { font-size: 0.82rem; color: var(--ink-dim); }

.ed-solution { border-color: var(--brass); background: #f3e8cf; }
.ed-secret { font-family: var(--display); font-size: 0.58rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--oxblood); border: 1px solid var(--oxblood); padding: 0 0.3rem; }

.ed-clue { padding: 0.55rem 0; border-bottom: 1px dashed var(--rule-soft); display: grid; gap: 0.1rem; }
.ed-clue:last-child { border-bottom: 0; }

.ed-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }
.ed-tags li { font-size: 0.82rem; padding: 0.2rem 0.55rem; border: 1px solid var(--rule); background: var(--paper); }

/* map panel: floor-plan grid on the left, clicked-room detail on the right */
.ed-map-wrap { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 34rem) { .ed-map-wrap { grid-template-columns: 1fr; } }

.ed-map { display: grid; gap: 0.7rem; margin: 0.3rem 0 0.6rem; }
.ed-cell {
    display: flex; align-items: center; justify-content: center;
    width: 2.4rem; height: 2.4rem; font-family: var(--display); font-size: 0.78rem;
    border: 1px solid var(--rule); background: var(--paper); color: var(--ink-dim);
}
.ed-cell-empty { border: 0; background: transparent; }
.ed-cell-start { background: var(--oxblood); color: var(--paper); border-color: var(--oxblood); }
.ed-cell-room { position: relative; cursor: pointer; font: inherit; font-size: 0.78rem; }
.ed-cell-room:hover { border-color: var(--oxblood); color: var(--ink); }
.ed-cell-room.is-selected { background: var(--brass); color: var(--paper); border-color: var(--brass); }

/* connectors drawn from a room toward its east/south neighbour, bridging the gap */
.ed-link { position: absolute; background: var(--rule); z-index: 0; }
.ed-link-e { top: 50%; left: 100%; width: 0.7rem; height: 2px; transform: translateY(-50%); }
.ed-link-s { left: 50%; top: 100%; height: 0.7rem; width: 2px; transform: translateX(-50%); }

/* per-room count badges: objects (brass) bottom-left, suspects (oxblood) bottom-right */
.ed-cell-badge {
    position: absolute; bottom: -0.4rem; z-index: 2;
    min-width: 0.95rem; height: 0.95rem; padding: 0 0.16rem;
    border-radius: 0.5rem; box-shadow: 0 0 0 1px var(--paper);
    font-family: var(--mono); font-size: 0.56rem; line-height: 0.95rem;
    text-align: center; color: var(--paper);
}
.ed-badge-obj { left: -0.3rem; background: var(--brass); }
.ed-badge-sus { right: -0.3rem; background: var(--oxblood); }
.ed-map-legend { margin-top: 0.2rem; font-size: 0.7rem; }
.ed-map-legend .lg-obj { color: var(--brass); }
.ed-map-legend .lg-sus { color: var(--oxblood); }

.ed-map-detail { font-size: 0.9rem; min-width: 0; }
.ed-map-detail .ed-room-name { margin-bottom: 0.35rem; }
.ed-map-detail a { color: var(--oxblood); }
.ed-map-hint { font-style: italic; }

.ed-room, .ed-person { padding: 0.65rem 0; border-bottom: 1px dashed var(--rule-soft); }
.ed-room:last-child, .ed-person:last-child { border-bottom: 0; }
.ed-room-name { font-family: var(--display); font-weight: 700; }
/* collapsible room/object/suspect cards */
details.ed-collapse > summary { cursor: pointer; }
details.ed-collapse > summary::marker { color: var(--brass); }
details.ed-collapse > summary::-webkit-details-marker { color: var(--brass); }
details.ed-collapse[open] > summary { margin-bottom: 0.45rem; }
/* nested subsections (suspect interview responses, room exits) indent under their label */
.ed-interview, .ed-subsection { margin-left: 0.5rem; padding-left: 0.9rem; border-left: 2px solid var(--rule-soft); }
.ed-interview .ed-label:first-child, .ed-subsection .ed-label:first-child { margin-top: 0.6rem !important; }
.ed-subsection a { color: var(--oxblood); }
.ed-clue-summary {
    margin: -0.2rem 0 0.8rem; padding-bottom: 0.6rem;
    border-bottom: 1px dashed var(--rule-soft);
    letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.7rem;
}
/* inline jump list of suspect names, deep-linking to each card below */
.ed-jump {
    margin: -0.2rem 0 0.9rem; padding-bottom: 0.6rem;
    border-bottom: 1px dashed var(--rule-soft);
    font-size: 0.8rem; line-height: 1.7; color: var(--ink-dim);
}
.ed-jump a { color: var(--oxblood); text-decoration: none; }
.ed-jump a:hover, .ed-jump a:focus-visible { text-decoration: underline; }
.ed-person, .ed-room { scroll-margin-top: 1rem; }
.ed-code { font-size: 0.66rem; color: var(--ink-dim); border: 1px solid var(--rule); padding: 0 0.3rem; margin-left: 0.3rem; text-transform: uppercase; letter-spacing: 0.06em; }
.ed-start { font-size: 0.6rem; color: var(--oxblood); border: 1px solid var(--oxblood); padding: 0 0.3rem; margin-left: 0.3rem; text-transform: uppercase; letter-spacing: 0.06em; }

.ed-json { margin-top: 1.4rem; border-top: 3px double var(--rule); padding-top: 1rem; }
.ed-json summary { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; color: var(--oxblood); cursor: pointer; margin-bottom: 0.8rem; }

/* AI assistant panel */
.ai-panel { border: 1px solid var(--brass); background: #f3e8cf; padding: 1rem 1.1rem 1.2rem; margin: 1.2rem 0; }
.ai-panel > h2 { font-family: var(--display); font-size: 1.05rem; margin-bottom: 0.7rem; }
.ai-row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.ai-critique {
    font-size: 0.9rem; line-height: 1.55;
    background: var(--paper); border: 1px solid var(--rule); padding: 0.8rem 0.9rem; margin-bottom: 1rem;
    max-height: 28rem; overflow-y: auto;
}
/* structured test-play findings: section → status-dotted items, with fix actions */
.crit-section { margin-bottom: 0.9rem; }
.crit-section:last-child { margin-bottom: 0; }
.crit-title { font-family: var(--display); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--oxblood); margin-bottom: 0.35rem; }
.crit-item { display: flex; align-items: baseline; gap: 0.45rem; padding: 0.28rem 0; flex-wrap: wrap; }
.crit-dot { flex: none; font-size: 0.8rem; }
.crit-text { flex: 1 1 12rem; }
.crit-problem .crit-text { font-weight: 600; }
.crit-summary { color: var(--ink-dim); font-style: italic; margin: 0 0 0.5rem; line-height: 1.45; }
.crit-note { padding: 0.18rem 0; }
.crit-note .crit-text { color: var(--ink-dim); }
.crit-fix {
    flex: none; font-family: var(--display); font-size: 0.7rem; letter-spacing: 0.04em;
    background: var(--oxblood); color: var(--paper); border: 0; border-radius: 3px;
    padding: 0.22rem 0.6rem; cursor: pointer; transition: background 0.12s;
}
.crit-fix:hover, .crit-fix:focus-visible { background: var(--oxblood-dk); }
.chat { display: grid; gap: 0.6rem; max-height: 26rem; overflow-y: auto; margin-bottom: 0.8rem; }
.chat:empty { display: none; }
.chat-msg { padding: 0.5rem 0.7rem; border: 1px solid var(--rule-soft); background: var(--paper); max-width: 90%; }
.chat-msg p { white-space: pre-wrap; }
.chat-user { justify-self: end; background: var(--paper-soft); border-color: var(--rule); }
.chat-assistant { justify-self: start; }
.chat-edits { font-size: 0.74rem; font-style: italic; color: var(--oxblood); margin-top: 0.3rem; }
.chat-form { display: grid; gap: 0.5rem; }
.chat-form textarea { font: inherit; padding: 0.55rem 0.7rem; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); resize: vertical; }
.chat-form textarea:focus-visible { border-color: var(--oxblood); outline: none; }
.chat-form button { justify-self: start; }

/* version history */
.ed-versions { margin: 0.6rem 0 0.4rem; border: 1px solid var(--rule); background: var(--paper-soft); padding: 0.7rem 0.9rem; }
.ed-versions summary { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; color: var(--oxblood); cursor: pointer; }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px dashed var(--rule-soft); }
.version-row:last-child { border-bottom: 0; }
.version-row form { margin: 0; }

/* inline editing */
.ed-hint { font-size: 0.85rem; font-style: italic; color: var(--ink-dim); margin: 0.4rem 0 0.2rem; }
.ed-edit {
    cursor: text;
    border-bottom: 1px dotted var(--rule);
    transition: background-color 0.12s;
}
.ed-edit:hover { background: rgba(154, 116, 38, 0.14); }
.ed-edit:empty::before { content: '— empty —'; color: var(--ink-dim); font-style: italic; }
.ed-edit.editing { display: block; cursor: auto; border-bottom: 0; }
.ed-input {
    width: 100%;
    font: inherit;
    padding: 0.35rem 0.45rem;
    color: var(--ink);
    background: #fbf5e6;
    border: 1px solid var(--oxblood);
}
textarea.ed-input { min-height: 5rem; resize: vertical; line-height: 1.5; }
.ed-edit-select {
    font: inherit;
    padding: 0.25rem 0.4rem;
    color: var(--ink);
    background: #fbf5e6;
    border: 1px solid var(--rule);
}
.ed-edit-select:focus-visible { border-color: var(--oxblood); outline: none; }
.ed-clue-top { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.2rem; }
.ed-check { font-size: 0.82rem; color: var(--ink-dim); display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.ed-stage { margin-left: 0.5rem; padding-left: 0.9rem; border-left: 2px solid var(--oxblood); margin-top: 0.6rem; }
.ed-stage-reqs { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; margin-top: 0.3rem; }
.ed-stage-action { font-family: var(--mono); font-size: 0.72rem; background: none; border: 1px solid var(--rule-soft); border-radius: 3px; color: var(--oxblood); padding: 0.05rem 0.45rem; cursor: pointer; }
.ed-stage-action:hover { background: var(--paper-soft); }
.ed-saved { animation: ed-saved-flash 0.7s ease; }
@keyframes ed-saved-flash { from { background: rgba(110, 150, 90, 0.45); } to { background: transparent; } }

/* --- motion ------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .cmd, .game-cmd { transition: none; }
    .suspect-pip.is-new .pip-ico { animation: none; }
}

/* --- squircles ---------------------------------------------------------- */
/* Rounded corners throughout, with corner-shape:squircle layered on as a
   progressive enhancement. border-radius is the universally-supported
   fallback; non-Chromium browsers simply get plain rounded corners. */

.cmd, .btn, .crit-fix,
.admin-form textarea, .admin-form select, .admin-inline input,
.accuse-form select, .auth input,
.case-file, .audit, .finish, .overlay-card, .share-text,
.clue, .json-edit {
    border-radius: var(--radius);
    corner-shape: squircle;
    text-box: trim-both cap alphabetic;
}

.badge, .game-dev, .map-cell, .ed-cell {
    border-radius: var(--radius-sm);
    corner-shape: squircle;
}

