:root { --rel: #8a2b2b; --paper: #f3ead7; --ink: #1c1a17; --red: #8a2b2b; --term: #0f0d0a; --term-text: #d9c89a; --gold: #c9a35a; --card: #fffdf5; --rule: #c9b98f; --shade: #e9dfc6; --accent: var(--red);
  --sql-kw: #e8a652; --sql-fn: #8fc1dc; --sql-str: #a6cf8c; --sql-num: #df9bbd; --sql-com: #9a9080;
  --r-box: 6px; --r-panel: 8px; --r-card: 10px; }   /* corner radii, option C 'Rounded' (2026-10-09) */
/* Part II mood, set once as data-mood="night" on <html> when the code is accepted (see app.js).
   Same tokens, dark values: everything already styled off these variables shifts for free. */
:root[data-mood="night"] { --rel: #e0806f; --paper: #131820; --ink: #e6dfcb; --card: #1d2531; --rule: #33404f; --shade: #232c39; --term: #0a0e14; --term-text: #9fc0ee; --accent: #3f6fb5;
  --sql-kw: #f0c46e; --sql-fn: #b9a8f2; --sql-str: #9fd69c; --sql-num: #e7a0c6; --sql-com: #8a98aa; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.4 "Cormorant Garamond", Georgia, serif; transition: background .8s, color .8s; }
button, a.btn { font: inherit; background: var(--ink); color: var(--paper); border: 1px solid var(--ink); padding: 4px 12px; cursor: pointer; letter-spacing: 1px; border-radius: var(--r-box); }
button.quiet { background: transparent; color: var(--ink); }
a.btn { display: inline-block; text-decoration: none; }
a.btn[hidden] { display: none; }
button:disabled { opacity: .4; cursor: default; }
input, textarea { font: inherit; background: var(--card); color: var(--ink); border: 1px solid var(--ink); padding: 4px 6px; border-radius: var(--r-box); }
.label { font: 700 13px/1.2 "Playfair Display", serif; letter-spacing: 1px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
/* the schema's Enlarge icon sits right after its title, centred on it (course owner, 2026-10-09) */
.col-erd .label-row { justify-content: flex-start; gap: 8px; align-items: center; }
/* the legend on the SCHEMA row, right-aligned, Enlarge beside the label (owner, 2026-10-25) */
.label-row .erd-legend { margin: 0 0 0 auto; justify-content: flex-end; }
.muted { opacity: .75; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.box { border: 1px solid var(--ink); border-radius: var(--r-box); padding: 6px 8px; margin: 10px 0; }
.answer-form { margin-top: 6px; padding-top: 5px; border-top: 1px dotted var(--rule); }

/* masthead */
.masthead { position: relative; text-align: center; border-bottom: 2px solid var(--ink); padding: 10px 16px 6px; }
.back-small { margin-left: 10px; padding: 0 6px; font-size: 11px; letter-spacing: 0; vertical-align: 1px; }
.back-small[hidden] { display: none; }
.chapter-menu-toggle { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.chapter-menu { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); display: flex; flex-wrap: wrap; gap: 6px; max-width: 90vw; background: var(--card); border: 1px solid var(--ink); border-radius: var(--r-panel); box-shadow: 0 3px 8px rgba(0,0,0,.22); padding: 8px; z-index: 21; }
.chapter-menu[hidden] { display: none; }
.chapter-menu-item { cursor: pointer; padding: 4px 10px; border: 1px solid var(--rule); border-radius: var(--r-box); background: var(--paper); font-size: 13px; }
.chapter-menu-item:hover { background: var(--shade); }
.chapter-menu-item[aria-current] { font-weight: 700; color: var(--rel); border-color: currentColor; }
.mast-title { font: 900 32px/1 "Playfair Display", serif; letter-spacing: 1px; }
.reset-corner { position: absolute; left: 16px; top: 12px; font-size: 13px; padding: 2px 10px; }
/* fixed, above the landing overlay (z-index 20), so it works on the landing page and in the game */
.corners { position: absolute; right: 16px; top: 12px; z-index: 21; display: flex; gap: 6px; }   /* Send feedback, then Day/Night */
.theme-corner, .feedback-corner { font-size: 13px; padding: 2px 10px; background: var(--paper); }
.mast-sub { font-size: 11px; letter-spacing: 2px; margin-top: 4px; }
.theme-corner svg, .feedback-corner svg, .reset-corner svg { vertical-align: -3px; margin-right: 6px; }

/* landing */
/* scrolls when the card is taller than the window; the card's auto margins centre it only when it fits
   (flex centring would push the overflow above the top, out of reach) */
#landing { position: fixed; inset: 0; background: var(--paper); z-index: 20; display: flex; overflow: auto; padding: 16px; }
#landing[hidden] { display: none; }
.landing-card { max-width: 640px; margin: auto; text-align: center; border: 2px solid var(--ink); border-radius: var(--r-card); padding: 24px; }
.landing-card h1 { font: 700 26px/1.15 "Playfair Display", serif; margin: 12px 0 0; padding-top: 12px; border-top: 3px double var(--ink); }
/* a red band above the masthead says what the game is at first glance (Nick's feedback, owner chose option A, 2026-10-19) */
.landing-band { margin: -24px -24px 16px; padding: 7px 10px; background: var(--red); color: #fffdf5; border-radius: calc(var(--r-card) - 2px) calc(var(--r-card) - 2px) 0 0; font: 14px/1.2 "Special Elite", monospace; letter-spacing: 2px; }
.landing-photo { margin: 14px 0 16px; }
.landing-photo img { display: block; width: 100%; height: auto; border: 1px solid var(--ink); border-radius: var(--r-panel); }
.landing-photo figcaption { font: italic 400 15px/1.3 "Cormorant Garamond", Georgia, serif; margin-top: 4px; text-align: left; }
.landing-story { text-align: justify; hyphens: none; font-size: 18px; line-height: 1.5; margin: 0 auto; max-width: 34em; }
.landing-story::first-letter { float: left; font: 900 48px/.85 "Playfair Display", serif; margin: 4px 8px 0 0; }
.landing-kicker { font: italic 400 21px/1.3 "Cormorant Garamond", Georgia, serif; margin: 16px 0 0; }
.landing-foot { margin: 16px 0 0; border-top: 1px solid var(--rule); padding-top: 8px; }
/* the handbook's chrome: its header nav under the masthead lines, its footer in .landing-foot (also privacy.html) */
.landing-nav { margin-top: 6px; }
.landing-foot a, .landing-nav a, .mast-sub a { color: inherit; }
/* the section the page belongs to (the game or the handbook) in the red, bold, lightly underlined, like the desk menu's current item */
.landing-nav .current, .learn-nav .current { color: var(--rel); font-weight: 700; text-decoration: underline 1px color-mix(in srgb, var(--rel) 45%, transparent); text-underline-offset: 4px; }
.masthead .landing-nav { margin-top: 4px; }
.masthead .mast-nav { font-size: 16px; opacity: 1; }   /* full red on the section and chapter; the other link stays muted */
.masthead .mast-nav a { opacity: .75; }
#masthead-chapter { color: var(--rel); font-weight: 700; }   /* the chapter line in the section's red, its numeral bigger */
#masthead-chapter b { font-size: 1.4em; line-height: 1; }   /* the game page: section nav with the chapter line next to The Ritz Affair */
/* About this game: crawlable prose for readers without JavaScript, closed so the card looks the same */
.landing-about { margin: 16px 0 0; border-top: 1px solid var(--rule); padding-top: 8px; }
.landing-about summary { cursor: pointer; }
.landing-about p { text-align: justify; hyphens: none; font-size: 17px; line-height: 1.5; margin: 10px auto 0; max-width: 34em; }
.landing-about .landing-sub { margin-top: 16px; text-align: left; }
.landing-about a { color: var(--rel); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.landing-sql { text-align: left; max-width: 34em; margin: 8px auto 0; padding: 8px 12px; background: var(--term); color: var(--term-text); border-radius: var(--r-panel);
  font: 14px/1.4 "Special Elite", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.landing-chapters code { font-size: .9em; }
.landing-chapters { border-collapse: collapse; margin: 12px auto 0; font-size: 15px; }
.landing-chapters th, .landing-chapters td { text-align: left; padding: 2px 10px; border-bottom: 1px dotted var(--rule); }
.landing-buttons { display: flex; gap: 12px; justify-content: center; margin: 16px 0 8px; }
/* Investigate, the landing's one call to action: the band's red, bigger (owner, 2026-11-03); Compete shows only
   when a season link is live (enabled), on every width */
.landing-buttons button { font-size: 24px; font-weight: 700; padding: 10px 34px; }
#btn-investigate { background: var(--red); border-color: var(--red); color: #fffdf5; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
#btn-investigate:not(:disabled):hover { filter: brightness(1.12); }
#btn-compete:disabled { display: none; }
.landing-buttons + #status { margin: 0 0 8px; }   /* the status right under the buttons it speaks for (owner, 2026-11-03) */
.compete-form { border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 8px; }
.compete-form[hidden] { display: none; }
.compete-form .row { justify-content: center; }
.compete-form input { flex: 1; min-width: 160px; max-width: 320px; font-family: "Special Elite", monospace; }
.compete-info { font-family: "Special Elite", monospace; color: var(--red); letter-spacing: 1px; margin-top: 6px; }
.compete-info[hidden] { display: none; }

/* columns */
.columns { display: grid; grid-template-columns: clamp(340px, 28vw, 440px) minmax(0, 1fr) 380px; gap: 16px; padding: 16px; align-items: start; }
.col-story h2 { font: 700 22px/1.15 "Playfair Display", serif; margin: 0 0 6px; }
.chapter-head { display: flex; align-items: center; gap: 10px; }
.chapter-head h2 { margin: 0; }   /* no bottom margin, so the title centres on the icon */
.chapter-icon { width: 56px; height: 56px; flex: none; object-fit: contain; }
.story { text-align: justify; hyphens: none; font-size: 17px; line-height: 1.5; }
/* same front-page treatment as the landing story: a drop cap on the chapter text */
.story::first-letter { float: left; font: 900 44px/.85 "Playfair Display", serif; margin: 4px 7px 0 0; }
.story b { font-weight: 700; }
.story p { margin: 0 0 .6em; }
.story table { border-collapse: collapse; margin: .2em 0 .8em; font-size: 15px; text-align: left; width: 100%; }
.story th { font: 700 11px "Cormorant Garamond", Georgia, serif; letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--ink); padding: 2px 8px 2px 0; }
.story td { border-bottom: 1px solid var(--rule); padding: 3px 8px 3px 0; vertical-align: top; }

/* terminal */
.editor { position: relative; background: var(--term); border: 1px solid #6b5a33; border-radius: var(--r-panel); overflow: hidden; }
#sql, #prologue-sql, .task-sql, .sql-hl { display: block; width: 100%; margin: 0; border: 0; padding: 8px 10px; font: 14px/1.4 "Special Elite", monospace;
  tab-size: 4; white-space: pre-wrap; overflow-wrap: anywhere; letter-spacing: normal; }
#sql, #prologue-sql, .task-sql { position: relative; min-height: 160px; background: transparent; color: transparent; caret-color: var(--term-text); resize: none; overflow: hidden; }
#sql::placeholder { color: var(--term-text); opacity: .45; }
#sql::selection, #prologue-sql::selection, .task-sql::selection { background: rgba(201,163,90,.35); color: transparent; }
.sql-hl { position: absolute; inset: 0; color: var(--term-text); pointer-events: none; overflow: hidden; }
.sql-kw { color: var(--sql-kw); } .sql-fn { color: var(--sql-fn); } .sql-str { color: var(--sql-str); }
.sql-num { color: var(--sql-num); } .sql-com { color: var(--sql-com); font-style: italic; }
/* Tab completion (wireSuggest): fixed under the caret, outside .editor so its overflow never clips it */
.sql-suggest { position: fixed; z-index: 40; margin: 0; padding: 3px; list-style: none; min-width: 140px; max-width: 80vw; background: var(--term);
  color: var(--term-text); border: 1px solid var(--gold); border-radius: var(--r-box); box-shadow: 0 3px 8px rgba(0,0,0,.3); font: 13px/1.3 "Special Elite", monospace; }
.sql-suggest[hidden] { display: none; }
.sql-suggest li { padding: 2px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; display: flex; justify-content: space-between; gap: 12px; }
.sql-suggest li[aria-selected="true"] { background: var(--term-text); color: var(--term); }
.sql-suggest .k { opacity: .6; font-size: 11px; }
.results { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-panel); font: 13px "Special Elite", monospace; overflow: auto; max-height: 36vh; margin-top: 6px; }
.results table { border-collapse: collapse; width: 100%; }
.results th { text-align: left; border-bottom: 1px solid var(--ink); padding: 2px 6px; font-weight: normal; letter-spacing: 1px; font-size: 11px; position: sticky; top: 0; background: var(--card); }
.results td { padding: 2px 6px; border-bottom: 1px dotted var(--rule); white-space: nowrap; }
.results .error { color: var(--red); padding: 8px; white-space: pre-wrap; }
/* the strict terminal: PostgreSQL's error line, then why in plain English, then the handbook section */
.results .error.strict { color: var(--ink); white-space: normal; }
.results .pg-error { color: var(--rel); white-space: pre-wrap; }
.results .error .why { margin: 4px 0; font: 15px/1.35 "Cormorant Garamond", Georgia, serif; }
.results .error a { color: var(--ink); font: 600 14px "Cormorant Garamond", Georgia, serif; }
/* the terminal's key hints as key caps, each group spaced apart (owner, 2026-10-25); Ctrl works on Mac too, Cmd+Enter also runs */
.keys { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; justify-content: flex-end; }
.keys .kgrp { white-space: nowrap; }
.keys kbd { display: inline-block; min-width: 14px; text-align: center; padding: 1px 5px; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px;
  font: 700 11px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--card); color: var(--ink); }
.keys .plus { margin: 0 2px; font-weight: 700; }
.term-meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; justify-content: flex-end; text-align: right; }
.dialect { font: 11px/1 "Special Elite", monospace; letter-spacing: .5px; color: var(--ink); text-decoration: none; border: 1px solid var(--rule);
  border-radius: var(--r-box); padding: 2px 6px; background: var(--card); white-space: nowrap; }
.dialect:hover { border-color: var(--ink); }
.answer-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.answer-row[hidden] { display: none; }
.answer-row input { flex: 1; font-family: "Special Elite", monospace; }
.reply { min-height: 1.4em; font-style: italic; }
.next-chapter { border-radius: var(--r-card); display: block; width: 100%; margin: 4px 0 10px; padding: 12px 16px; font: 700 20px "Playfair Display", serif;
  background: var(--accent); border-color: var(--accent); color: var(--card); animation: pulse 1.8s ease-in-out infinite; }
.next-chapter[hidden] { display: none; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 transparent } 50% { box-shadow: 0 0 0 6px var(--shade) } }
#history { font: 12px "Special Elite", monospace; padding-left: 20px; }
#history li { cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ERD */
.erd { background: var(--card); border: 1px solid var(--ink); border-radius: var(--r-panel); overflow: auto; max-height: 55vh; position: relative; }
/* The ad box under the schema: a <details>, its summary the toggle (open by default). */
.press-box { margin-top: 12px; border: 1px solid var(--ink); background: var(--card); border-radius: var(--r-panel); overflow: hidden; }   /* rounded like the schema box (owner, 2026-10-25) */
.press-box summary { cursor: pointer; padding: 7px 10px; list-style-position: inside; }
/* typewritten title, option D (owner, 2026-10-19); the wording stays one of AdSense's two permitted labels */
.press-box summary.label { font: 14px/1.2 "Special Elite", monospace; letter-spacing: 2px; }
.press-box[open] summary { border-bottom: 1px dotted var(--rule); }
.press-slot { min-height: 250px; display: grid; place-items: center; }
/* the house ad shown until AdSense approves the site (owner, 2026-10-19): one engraved 1912 advertisement, all of it the link */
.press-notice { display: block; width: 100%; padding: 8px; }
.press-notice[hidden] { display: none; }
.press-notice img { display: block; width: 100%; height: auto; }
/* its night print (cream on navy, drawn as a positive, not an inverted day ad) swaps in with the night edition */
.press-notice .night, :root[data-mood="night"] .press-notice .day { display: none; }
:root[data-mood="night"] .press-notice .night { display: block; }
.press-notice:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.erd.large { position: fixed; inset: 16px; z-index: 15; max-height: none; }
/* enlarged, its Close sits in the overlay's top-right corner (clear of the scrollbar), like the panels' Close */
#btn-erd { width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
#btn-badges svg, #btn-suspects svg, #btn-run svg { vertical-align: -3px; margin-right: 5px; }
body:has(.erd.large) #btn-erd { position: fixed; top: 24px; right: 36px; z-index: 16; background: var(--paper); }
/* fitErd() (app.js) crops the viewBox to the revealed tables and sets the width: the column's, capped at natural size. */
.erd svg { display: block; height: auto; margin: 0 auto; font: 11px "Special Elite", monospace; }
.erd .table rect { fill: var(--paper); stroke: var(--ink); }
.erd .table .head { fill: var(--ink); stroke: var(--ink); }
.erd .table .tname { fill: var(--paper); }
.erd .table .col { fill: var(--ink); font-size: 10px; }
.erd .table .type { fill: var(--ink); fill-opacity: .5; font-size: 9px; }   /* the declared type, right-aligned */
/* Relationship lines: one soft red S-curve each (erd.py), round ends, a dot and 1 / N at each end. */
.erd .fk path { stroke: var(--rel); stroke-opacity: .8; fill: none; stroke-width: 1.3; stroke-linecap: round; }
.erd .fk circle { fill: var(--rel); }
.erd .fk text { fill: var(--rel); font: 700 10px "Special Elite", monospace; }
/* Keys (erd.py's #erd-key symbol, and the legend under the schema): gold = primary key, silver = foreign key. */
.key { fill: none; stroke-width: 1.8; }
.key.pk { stroke: #c9a227; }
.key.fk { stroke: #9ea4aa; }
.erd-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 11px; margin: 4px 0 0; }
.erd-legend svg { vertical-align: -1px; margin-right: 4px; }
.erd-legend .rel { stroke: var(--rel); stroke-opacity: .8; fill: none; stroke-width: 1.3; stroke-linecap: round; }
.erd-legend .rel-dot { fill: var(--rel); }
.erd-legend .rel-t { fill: var(--rel); font: 700 9px "Special Elite", monospace; }
.erd .hidden { display: none; }
/* A new table fades in with a glow on its frame. Opacity and stroke only: a CSS transform would replace the
   table's transform="translate(...)" placement. */
.erd .reveal { animation: fadein 1.2s ease-out both; }
.erd .reveal rect:first-child { animation: glow 3s ease-out both; }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
@keyframes glow { 0%, 40% { stroke: var(--accent); stroke-width: 4 } 100% { stroke: var(--ink); stroke-width: 1 } }
.stamp { position: absolute; right: 12px; top: 12px; border: 3px solid var(--red); color: var(--red); font: 900 18px "Playfair Display", serif; padding: 3px 8px; letter-spacing: 2px; transform: rotate(-12deg); animation: stamp 1s ease-out both; pointer-events: none; }
@keyframes slidein { from { transform: translateY(-30px); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes stamp { 0% { transform: scale(3) rotate(-12deg); opacity: 0 } 60% { transform: scale(1) rotate(-12deg); opacity: 1 } 100% { transform: scale(1) rotate(-12deg); opacity: 1 } }

/* story column */
.board { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 12px; min-height: 40px; padding: 8px 5px 3px; border-radius: var(--r-panel);
  background-color: #cda876; background-image: radial-gradient(rgba(0,0,0,.12) 1px, transparent 1px); background-size: 6px 6px; }
.card { position: relative; background: var(--card); border-radius: var(--r-card); box-shadow: 0 3px 8px rgba(0,0,0,.25); padding: 5px 6px 4px; font-size: 13px; animation: drop .6s ease-out both; transform: rotate(-2deg); cursor: pointer; }
.card::before { content: ""; position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0, var(--accent) 35%, #3a0d0d 100%); transform: translateX(-50%); box-shadow: 1px 2px 2px rgba(0,0,0,.4); }
.card .card-label { font: italic 400 12px/1.2 "Cormorant Garamond", Georgia, serif; text-transform: none; }
.card .card-step { font-size: 11px; opacity: .75; }
.card:hover { box-shadow: 0 4px 10px rgba(0,0,0,.32); }
.card:nth-child(even) { transform: rotate(1.5deg); }
/* case-board pictures: a portrait when the answer is a cast person, else the chapter's painted icon (cardPicture) */
.card .card-pic { float: left; width: 24px; height: 32px; margin: 0 4px 0 0; object-fit: contain; }
.card .card-pic.face { object-fit: cover; border-radius: 50% / 40%; }
/* the board's suspects strip (renderStrip): a face crossed out once the case clears it */
.board-suspects { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 4px; cursor: pointer; }
.board-suspects[hidden] { display: none; }
.strip-face { position: relative; width: 27px; height: 36px; }
.strip-face img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50% / 40%; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.strip-face.cleared img { filter: grayscale(1); opacity: .55; }
.strip-face.cleared::after { content: ""; position: absolute; left: -3px; right: -3px; top: 50%; border-top: 2px solid var(--red); transform: rotate(-40deg); }
/* the query that cracked a solved chapter, under its answer on review (crackedHtml) */
.cracked { margin-top: 6px; }
.cracked .sql-view { margin: 4px 0 0; padding: 6px 8px; background: var(--term); color: var(--term-text); border-radius: var(--r-panel);
  font: 13px/1.4 "Special Elite", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
/* "How it's done" under a solved chapter (howto.js howtoHtml, learn only): steps, then the reference SQL */
.howto-done { margin-top: 8px; }
.howto-done ol { margin: 6px 0; padding-left: 22px; }
.howto-done li { margin: 3px 0; }
.howto-done li code { font-size: .85em; }
.howto-done .label { margin-top: 8px; }
.howto-done p { margin: 6px 0 2px; }
.howto-done .sql-view { margin: 2px 0 0; padding: 6px 8px; background: var(--term); color: var(--term-text); border-radius: var(--r-panel);
  font: 13px/1.4 "Special Elite", monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; overflow-x: auto; }

/* suspects gallery: portraits are site/portraits/*.jpg (Style A/Lavery colour, see the spec) */
.suspect .note { font-style: italic; margin-top: 4px; }
#btn-badges[data-unseen]:not([data-unseen=""])::after { content: attr(data-unseen); display: inline-block; min-width: 16px; height: 16px; margin-left: 5px; padding: 0 4px; box-sizing: border-box; border-radius: 8px; background: var(--red); color: #fff; font: 700 10px/16px sans-serif; text-align: center; vertical-align: 1px; }
#btn-suspects.new::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 4px; border-radius: 50%; background: var(--red); vertical-align: 2px; }
.suspects { position: fixed; inset: 0; z-index: 19; background: var(--paper); overflow: auto; padding: 20px 16px 40px;
  display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; align-content: flex-start; }
.suspects[hidden] { display: none; }
/* Chapter VIII: the extra edition (showExtra in app.js), a full page over the game, styled off the tokens */
.extra { position: fixed; inset: 0; z-index: 22; background: var(--paper); overflow: auto; overflow-x: hidden; padding: 24px 16px 48px; }
.extra[hidden] { display: none; }
.extra-card { max-width: 640px; margin: 0 auto; border: 2px solid var(--ink); border-radius: var(--r-card); padding: 24px; text-align: center; animation: fadein .8s ease-out both; }
.extra-card h1 { font: 900 34px/1.1 "Playfair Display", serif; margin: 12px 0 16px; padding-top: 12px; border-top: 3px double var(--ink); letter-spacing: .5px; }
.extra-card .story { text-align: justify; margin-bottom: 12px; }
.extra-card .portrait { width: 180px; }
/* the film breaks out of the 640px card: up to 1100px, centred on the page */
.film-wrap { position: relative; left: 50%; transform: translateX(-50%); width: min(1100px, calc(100vw - 32px)); margin: 14px 0 4px; border-radius: var(--r-panel); }
.film { display: block; width: 100%; aspect-ratio: 16/9; background: #000; border: 1px solid var(--ink); border-radius: var(--r-panel); }
.film-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 12px 26px; font: 700 20px "Playfair Display", serif; box-shadow: 0 4px 18px rgba(0,0,0,.45); }
.film-play[hidden] { display: none; }
.extra-badge { clear: both; text-align: left; border: 1px solid var(--rule); border-radius: var(--r-panel); padding: 10px 12px; margin: 12px 0; }
.extra-badge b { font: 700 20px "Playfair Display", serif; display: inline-block; margin-right: 6px; }
/* Part II pop-up (#part2, opened by the extra edition's Continue): a native <dialog>, the extra card's look */
.part2 { max-width: min(480px, calc(100vw - 32px)); box-sizing: border-box; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: var(--r-card); padding: 24px; text-align: center; font-size: 17px; }
.part2::backdrop { background: rgba(0,0,0,.6); }
.part2 h2 { font: 900 30px/1.15 "Playfair Display", serif; margin: 10px 0 14px; padding-top: 10px; border-top: 3px double var(--ink); }
.part2 p { text-align: left; margin: 0 0 16px; }
.part2 button, .part2 a.btn { padding: 8px 22px; }
.part2.feedback-dialog { width: min(720px, calc(100vw - 32px)); max-width: none; }
.feedback-dialog label { display: block; font-weight: 700; } .feedback-dialog textarea, .feedback-dialog input { width: 100%; margin-top: 4px; }
.feedback-dialog .feedback-status:empty { display: none; } .feedback-dialog .feedback-status a { color: inherit; }
#names-input { width: 100%; box-sizing: border-box; margin-top: 6px; }
.part2 .closed-time { text-align: center; font: 700 15px "Playfair Display", serif; letter-spacing: 1px; }
/* a newly met suspect (#newsuspects): the Part II pop-up's frame, the gallery's cards side by side */
.newsuspects { max-width: min(640px, calc(100vw - 32px)); }
.newsuspects .cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin: 14px 0 18px; }
#btn-extra, #btn-extra2, #btn-replay { margin-top: 8px; padding: 8px 22px; }
.suspects-close { position: fixed; top: 16px; right: 16px; }
/* the Day/Night button shares that corner: step aside while a panel with its own Close is open */
body:has(.suspects:not([hidden]), .erd.large) .corners { display: none; }
.suspect { width: 180px; text-align: center; position: relative; }
.suspect img { display: block; width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 50% / 40%;
  box-shadow: 0 1px 0 rgba(0,0,0,.3), 0 6px 14px rgba(0,0,0,.25); position: relative; }
/* halftone: the same dot-screen technique as the cork board, laid over the portrait */
.suspect::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 3/4;
  border-radius: 50% / 40%; background-image: radial-gradient(#000 1px, transparent 1px); background-size: 3px 3px;
  opacity: .10; mix-blend-mode: multiply; pointer-events: none; }
.suspect b { display: block; font: 700 15px "Playfair Display", serif; margin-top: 8px; }
.suspect p { font-size: 13px; margin: 2px 0 0; }
.badges-title { flex-basis: 100%; text-align: center; font: 700 22px "Playfair Display", serif; margin: 8px 0 0; }
.badge { width: 200px; background: var(--card); border: 1px solid var(--ink); border-radius: var(--r-card); padding: 8px 10px; box-shadow: 0 3px 8px rgba(0,0,0,.18); }
.badge b { font: 700 15px "Playfair Display", serif; }
.badge p { font-size: 14px; margin: 4px 0 0; }
.badge.locked { opacity: .45; border-style: dashed; box-shadow: none; }
/* a single portrait set into running text: the two endings (Blakeney, the Comtesse) */
.portrait { float: left; width: 96px; aspect-ratio: 3/4; object-fit: cover; border-radius: 50% / 40%; margin: 4px 14px 6px 0;
  box-shadow: 0 1px 0 rgba(0,0,0,.3), 0 6px 14px rgba(0,0,0,.25); }
:root[data-mood="night"] .suspect img, :root[data-mood="night"] .portrait { filter: brightness(.85) saturate(.9) contrast(1.15) drop-shadow(0 0 20px rgba(63,111,181,.35)); }
/* the board's small faces: the same night filter, its glow scaled down */
:root[data-mood="night"] .card-pic.face, :root[data-mood="night"] .strip-face img { filter: brightness(.85) saturate(.9) contrast(1.15) drop-shadow(0 0 4px rgba(63,111,181,.35)); }
:root[data-mood="night"] .strip-face.cleared img { filter: grayscale(1) brightness(.85); }
@keyframes drop { from { transform: translateY(-40px) rotate(-6deg); opacity: 0 } to { opacity: 1 } }
.telegram { font: 13px/1.4 "Special Elite", monospace; white-space: pre-wrap; background: #fff8e8; color: #1c1a17;   /* a paper slip in both editions: its own ink, never --ink */ border: 1px solid var(--rule); border-radius: var(--r-panel); padding: 8px; min-height: 3em; cursor: pointer; }
.telegram:empty { display: none; }
#notes { border-radius: var(--r-panel); width: 100%; min-height: 120px; margin-top: 6px; resize: vertical; font: 13px/1.4 "Special Elite", monospace; }

/* toasts */
/* ?admin in the URL only; not linked from anywhere a student would find */
.admin-panel { position: fixed; left: 16px; bottom: 16px; background: var(--card); border: 2px dashed var(--accent); border-radius: var(--r-panel);
  padding: 6px 8px; z-index: 20; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; max-width: min(420px, calc(100vw - 32px)); }
.admin-panel button { padding: 2px 8px; font-size: 12px; border-radius: var(--r-box); }
.admin-board { flex: 1 1 60%; box-sizing: border-box; font-size: 12px; }
.admin-panel a { font-size: 12px; }

/* usage-statistics consent banner: above the landing overlay (20) and the theme button (21) */
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 22; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: center; background: var(--card); color: var(--ink); border: 1px solid var(--ink); border-radius: var(--r-panel); box-shadow: 0 3px 8px rgba(0,0,0,.22); padding: 8px 12px; text-align: center; }
.consent[hidden] { display: none; }
.consent a { color: inherit; margin-left: 6px; font-size: 13px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 10; }
.toast { background: var(--ink); color: var(--paper); padding: 8px 12px; border-left: 4px solid var(--gold); border-radius: var(--r-panel); animation: slidein .4s ease-out both; max-width: 320px; }
.toast b { color: var(--gold); }

/* certificate and print */
#certificate { display: none; }
@media print {
  body > *:not(#certificate) { display: none !important; }
  #certificate { display: block; padding: 40px; text-align: center; font-size: 18px; }
  #certificate .mast-title { font-size: 40px; }
  #certificate h1 { font: 700 30px "Playfair Display", serif; }
  #certificate .badges { columns: 2; text-align: left; }
}

@media (max-width: 900px) {
  .masthead .landing-nav { padding: 0 40px; }   /* clear of the 32 px corner buttons; wraps under the title */
  .masthead .landing-nav a, .mast-chapter { white-space: nowrap; }
  .columns { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  /* a phone reads the story and objective, then the schema right above the SQL box, then the terminal; the case
     board with its telegrams, the notepad and the ad box after it, so the SQL box starts on the first screen
     (2026-11-03, docs/research/2026-11-03-chapter-1-phones.md). The two asides are flattened (display: contents) so
     their parts can be ordered; the row gap goes, each group keeps a 16 px top margin. */
  .columns { row-gap: 0; }
  .col-story, .col-erd { display: contents; }
  .col-story > * { order: 1; } .col-erd > * { order: 2; } .col-terminal { order: 3; }
  .col-story > .board-row, #board, #taunt { order: 4; } .notepad { order: 5; } #press-box { order: 6; }
  .col-erd > .label-row, .col-terminal, .board-row, .notepad { margin-top: 16px; }
  .results td.long { white-space: normal; min-width: 8ch; }
  #sql { min-height: 64px; }   /* about three lines; it grows as the query does (wireEditor) */
  .keys { display: none; }   /* keyboard shortcuts mean nothing on a phone (2026-11-03, owner) */
  .reply:empty { display: none; }   /* no empty reply slot under ANSWER until there is a reply */   /* Duroc's transcript wraps instead of running 1,700 px to the right */
  .erd { max-height: 40vh; }
  .mast-title { font-size: 24px; }
  /* icon-only 32px squares in the top corners: the 24px title (~262px at 430px) clears both */
  .reset-corner, .theme-corner, .feedback-corner { width: 32px; height: 32px; padding: 0; top: 8px; display: flex; align-items: center; justify-content: center; }
  .reset-corner { left: 8px; } .corners { right: 8px; top: 8px; flex-direction: column-reverse; }   /* Feedback under Day/Night: side by side they met the title */
  .theme-corner svg, .feedback-corner svg, .reset-corner svg { margin: 0; }
  .reset-corner .btn-text, .theme-corner .btn-text, .feedback-corner .btn-text { display: none; }   /* Run, Badges and Suspects keep their text */
  .mast-sub { letter-spacing: 1px; font-size: 10px; }   /* the bold numeral widened the line: keep it on one line at 430 px */
  .row, .landing-buttons, .answer-row { flex-wrap: wrap; }
  .landing-card { padding: 16px; }
  .landing-band { margin: -16px -16px 12px; }
  /* the landing on a phone (2026-11-03, owner): Investigate on the first screen. The two corner squares sit side by
     side above the card, the photograph is cropped shorter, the text is ragged-right, and what a lone visitor cannot
     use (Compete without a season link, the idle status line) is hidden */
  #landing { padding-top: 48px; }
  body:has(#landing:not([hidden])) .corners { flex-direction: row; }
  .landing-card h1 { font-size: 22px; }
  .landing-photo { margin: 10px 0 12px; }
  .landing-photo img { height: 130px; object-fit: cover; object-position: 50% 55%; }
  .landing-photo figcaption { font-size: 13px; }
  .landing-story { font-size: 17px; line-height: 1.45; }
  .landing-story, .landing-about p { text-align: left; }
  #status.idle { display: none; }
  .landing-warmup strong { display: block; }   /* "New to SQL?" on its own line, the link under it (owner, 2026-11-03) */
}
/* iOS zooms into a focused field under 16 px: the SQL boxes and their highlight layer grow together (same metrics) */
@media (max-width: 900px), (pointer: coarse) {
  #sql, #prologue-sql, .task-sql, .sql-hl { font-size: 16px; }
}
/* Phones (owner, 2026-11-12): the prologue's terminal, Run and results in one screen; a compact consent banner,
   its buttons still 44 px tap targets */
@media (max-width: 900px), (pointer: coarse) {
  .prologue h2 { font-size: 22px; margin: 6px 0 8px; padding-top: 6px; }
  .prologue .prologue-intro { display: none; }
  .consent { left: 8px; right: 8px; bottom: 8px; padding: 4px 10px; gap: 0 10px; font-size: 14px; line-height: 1.3; }
  .consent button { min-height: 44px; padding: 0 16px; }
}
.landing-story b, .landing-kicker b { font-weight: 700; }
/* Part II ending: Lupin's photograph of the Blue Star (site/blue-star.jpg), set below the text like a news photo */
.ending-photo { clear: both; margin: 16px auto 0; max-width: 420px; }
.ending-photo img { display: block; width: 100%; height: auto; border: 1px solid var(--ink); border-radius: var(--r-panel); }
.ending-photo figcaption { font-style: italic; font-size: 14px; margin-top: 6px; text-align: center; }
:root[data-mood="night"] .ending-photo img { filter: brightness(.9) contrast(1.05); }

/* audit 2026-10-03: the current chapter's tables stay marked until it is solved (R2) */
.erd .current rect:first-child { stroke: var(--accent); stroke-width: 2.5; }
.chapter-tools { margin-top: 6px; }
.chapter-tools summary { cursor: pointer; width: max-content; }
.chapter-tools b { font-weight: 700; }
.hint-where { margin: 4px 0 0 12px; }
/* a table name in the Hint: a chip that takes the reader to that table in the schema (showTable, app.js) */
.table-link { font: inherit; color: var(--ink); background: var(--shade); border: 1px solid var(--rule); border-radius: var(--r-box); padding: 0 5px; margin: 1px 0; cursor: pointer; }
.table-link code { font-family: "Special Elite", monospace; font-size: .92em; }
.table-link:hover, .table-link:focus-visible { border-color: var(--accent); }
.erd .flash rect:first-child { animation: glow 2.4s ease-out both; }
/* night edition: a darker accent behind the Next chapter button keeps its text at AA (T8) */
:root[data-mood="night"] .next-chapter { background: #2b5190; }
/* keyboard users see where they are (T7) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* The clerk's first morning (#prologue) and chapter I's callouts (owner, 2026-10-25) */
.prologue { max-width: min(640px, calc(100vw - 32px)); }
.prologue p.prologue-step { font-weight: 700; text-align: left; margin: 10px 0; padding: 8px 10px; border-left: 4px solid var(--rel); border-radius: var(--r-box); background: rgba(201,163,90,.12); }
.prologue .step-no { display: block; font: 700 12px/1.4 "Playfair Display", Georgia, serif; letter-spacing: .08em; text-transform: uppercase; color: var(--rel); }
.prologue p.prologue-step.fresh { animation: step-flash 1.6s ease-out; }
@keyframes step-flash { 0%, 25% { background: rgba(201,163,90,.55); } 100% { background: rgba(201,163,90,.12); } }
@media (prefers-reduced-motion: reduce) { .prologue p.prologue-step.fresh { animation: none; } }
#prologue-sql { min-height: 48px; }
.prologue .row { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.prologue .results { max-height: 30vh; text-align: left; } .prologue .results:empty { display: none; }
.prologue .editor { text-align: left; }
.prologue-answer[hidden] { display: none; }
.prologue-answer input { flex: 1; min-width: 120px; font-family: "Special Elite", monospace; }
.callout { position: absolute; z-index: 18; width: min(300px, calc(100vw - 32px)); box-sizing: border-box; background: var(--card); color: var(--ink);
  border: 2px solid var(--accent); border-radius: var(--r-panel); box-shadow: 0 3px 8px rgba(0,0,0,.25); padding: 10px 12px; font-size: 16px; }
.callout p { margin: 0 0 8px; }
.callout::before { content: ""; position: absolute; top: -10px; left: 18px; border: 8px solid transparent; border-top: 0; border-bottom: 9px solid var(--accent); }
.callout .row { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.callout .row .muted { margin-right: auto; font-size: 13px; }
/* the newcomers' line, set off as a ruled slip so it is seen (owner, 2026-10-25) */
.landing-warmup { display: inline-block; margin: 10px 0 10px; padding: 7px 14px; font-size: 17px; border: 1px solid var(--rule); border-left: 4px solid var(--rel); border-radius: var(--r-box); background: var(--shade); }
.landing-warmup a { font-weight: 700; color: var(--rel); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.share .share-text { font-style: italic; margin: 6px 0 8px; }
.share a.btn { text-decoration: none; }
.share .share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.share .share-row > * { display: inline-flex; align-items: center; gap: 6px; }
.share .share-row > [hidden] { display: none; }
.share .logo-btn { padding: 6px 10px; } .share .logo { display: block; } .share a.btn.quiet { background: transparent; color: var(--ink); }

.feedback-status a { color: inherit; }
