/* ============================================================
   Einstein's Riddle - style.css
   Fluid, responsive layout — no fixed canvas size
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  user-select: none; -webkit-user-select: none;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background: #e8e6e0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  color: #1a1a1a;
}

body {
  display: flex;
  justify-content: center;
  padding: 20px 12px;
}

/* ── Fluid app card — replaces the old fixed 800x600 canvas ── */
#game-canvas {
  width: 100%;
  max-width: 860px;
  background: #f5f5f0;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.14);
  overflow: hidden;
}

/* ── Screens ── */
.screen {
  display: none;
  width: 100%;
  padding: 16px 20px 20px;
}
.screen.active { display: block; }

/* ============================================================
   TITLE SCREEN
   ============================================================ */
.title-hero {
  background: #3C3489;
  border-radius: 12px;
  padding: 20px 20px 18px;
  margin-bottom: 14px;
  text-align: center;
}
.title-icon {
  width: 46px; height: 46px;
  background: #534AB7; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
}
.title-icon i { font-size: 22px; color: #CECBF6; }
.title-hero h1 { color: #EEEDFE; font-size: 21px; font-weight: 500; margin-bottom: 5px; }
.title-hero p  { color: #AFA9EC; font-size: 12px; line-height: 1.55; max-width: 380px; margin: 0 auto; }

.title-btns {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 14px; max-width: 220px;
  margin-left: auto; margin-right: auto;
}
.btn-play {
  background: #1D9E75; color: #E1F5EE;
  border: none; padding: 10px 0; border-radius: 999px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(15,110,86,.3);
}
.btn-play:hover { background: #0F6E56; }
.btn-how {
  background: #534AB7; color: #CECBF6;
  border: none; padding: 9px 0; border-radius: 999px;
  font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit;
}
.btn-how:hover { background: #3C3489; }

.title-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 12px;
}
.stat-card { background: #fff; border: 1px solid #e0ddd5; border-radius: 10px; padding: 11px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.stat-num  { font-size: 19px; font-weight: 600; color: #534AB7; }
.stat-lbl  { font-size: 10px; color: #888780; margin-top: 2px; }

.cat-pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pill { font-size: 10px; font-weight: 500; padding: 4px 10px; border-radius: 20px; font-family: inherit; }
.p-nat { background: #E6F1FB; color: #0C447C; }
.p-col { background: #FAEEDA; color: #633806; }
.p-drk { background: #E1F5EE; color: #085041; }
.p-smk { background: #FBEAF0; color: #72243E; }
.p-pet { background: #FCEBEB; color: #791F1F; }

/* ============================================================
   HOW TO PLAY SCREEN
   ============================================================ */
.how-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.how-header h2 { font-size: 16px; font-weight: 500; color: #1a1a1a; }
.back-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: #F1EFE8; border: 1px solid #D3D1C7;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.back-btn i { font-size: 14px; color: #5F5E5A; }

.steps { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.step {
  background: #fff; border: 1px solid #e0ddd5;
  border-radius: 10px; padding: 9px 13px;
  display: flex; gap: 10px; align-items: flex-start;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.step-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-icon i { font-size: 14px; }
.si-purple { background: #EEEDFE; } .si-purple i { color: #534AB7; }
.si-teal   { background: #E1F5EE; } .si-teal i   { color: #1D9E75; }
.si-amber  { background: #FAEEDA; } .si-amber i  { color: #854F0B; }
.si-pink   { background: #FBEAF0; } .si-pink i   { color: #993556; }
.si-blue   { background: #E6F1FB; } .si-blue i   { color: #185FA5; }
.step-body h3 { font-size: 12px; font-weight: 500; color: #1a1a1a; margin-bottom: 2px; }
.step-body p  { font-size: 11px; color: #5F5E5A; line-height: 1.5; }

.tip-box {
  background: #EEEDFE; border: 1px solid #AFA9EC;
  border-radius: 9px; padding: 9px 12px;
  display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px;
}
.tip-box i { font-size: 13px; color: #534AB7; flex-shrink: 0; margin-top: 1px; }
.tip-box p { font-size: 11px; color: #3C3489; line-height: 1.5; }

.start-btn {
  width: 100%; background: #3C3489; color: #CECBF6;
  border: none; padding: 11px; border-radius: 999px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit;
}
.start-btn:hover { background: #26215C; }

/* ============================================================
   GAME SCREEN
   ============================================================ */
.game-wrap { padding: 14px 18px 18px; }

.g-header {
  background: #3C3489; border-radius: 12px;
  padding: 11px 16px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  box-shadow: 0 3px 10px rgba(38,33,92,.25);
}
.g-header-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.g-title  { color: #EEEDFE; font-size: 14px; font-weight: 600; }
.g-badge  { background: #534AB7; color: #CECBF6; font-size: 10px; padding: 3px 9px; border-radius: 20px; }
.check-dots { display: flex; gap: 6px; align-items: center; }
.cdot { width: 9px; height: 9px; border-radius: 50%; background: #9C95E8; transition: all .25s; }
.cdot.used { background: #26215C; opacity: .5; }

.prog-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.prog-txt { font-size: 11px; color: #888780; flex-shrink: 0; }
.prog-bar-wrap { flex: 1; height: 6px; background: #E8E6DF; border-radius: 6px; overflow: hidden; }
.prog-bar { height: 6px; background: #534AB7; border-radius: 6px; transition: width .3s; }

.fb { border-radius: 8px; padding: 8px 13px; font-size: 11px; display: none; margin-bottom: 8px; line-height: 1.4; }
.fb.ok   { background: #E1F5EE; color: #085041; border: 1px solid #5DCAA5; }
.fb.err  { background: #FCEBEB; color: #791F1F; border: 1px solid #F09595; }
.fb.warn { background: #FAEEDA; color: #633806; border: 1px solid #FAC775; }

/* ── Grid ── */
.grid-section {
  background: #fff; border: 1px solid #e0ddd5;
  border-radius: 12px; overflow: hidden; overflow-x: auto;
  margin-bottom: 8px; transition: opacity .3s;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.grid-section.frozen { opacity: .55; pointer-events: none; }

table { width: 100%; min-width: 460px; border-collapse: collapse; table-layout: fixed; }
thead tr { background: #534AB7; }
thead th {
  color: #EEEDFE; font-size: 11px; font-weight: 500;
  padding: 9px 3px; text-align: center;
  font-family: 'Inter', sans-serif;
}
thead th:first-child { text-align: left; padding-left: 12px; color: #CECBF6; width: 24%; }

.house-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: #26215C; color: #FFD66B;
  font-size: 12px; font-weight: 600;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

.cat-row:nth-child(odd)  { background: #faf9f7; }
.cat-row:nth-child(even) { background: #fff; }
.cat-row td { padding: 5px 3px; border-bottom: 1px solid #eeecea; vertical-align: middle; }
.cat-row:last-child td { border-bottom: none; }
.cat-label {
  padding-left: 12px !important;
  font-size: 11px; font-weight: 600;
  white-space: nowrap; font-family: 'Inter', sans-serif;
}
.nat .cat-label { color: #185FA5; } .col .cat-label { color: #854F0B; }
.drk .cat-label { color: #0F6E56; } .smk .cat-label { color: #993556; }
.pet .cat-label { color: #A32D2D; }
.cat-row td:not(.cat-label) { text-align: center; }

.cell-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto; width: 92%; min-width: 54px; min-height: 26px;
  border-radius: 6px; border: 1px solid #d0cdc7;
  background: #fff; color: #1a1a1a;
  font-size: 11px; font-weight: 500;
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer; padding: 3px;
  text-align: center; line-height: 1.2;
  transition: background .15s, border-color .15s;
}
.cell-btn:hover { background: #f5f5f0; border-color: #888; }
.cell-btn.empty { color: #b0ada8; font-weight: 400; }

/* ── Filled cells: solid color badge per category ── */
.cell-btn.filled { font-weight: 600; border-color: transparent; }
.cell-btn.filled.nat { background: #185FA5; color: #E6F1FB; }
.cell-btn.filled.col { background: #854F0B; color: #FAEEDA; }
.cell-btn.filled.drk { background: #0F6E56; color: #E1F5EE; }
.cell-btn.filled.smk { background: #993556; color: #FBEAF0; }
.cell-btn.filled.pet { background: #A32D2D; color: #FCEBEB; }

/* Correct/wrong add a ring + corner icon on top of the category color */
.cell-btn.correct { box-shadow: 0 0 0 2px #1D9E75 inset; }
.cell-btn.wrong   { box-shadow: 0 0 0 2px #E24B4A inset; opacity: .82; }
.cell-btn.correct::after, .cell-btn.wrong::after {
  position: absolute; top: -6px; right: -6px;
  width: 14px; height: 14px; border-radius: 50%;
  font-size: 9px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.cell-btn.correct::after { content: "✓"; background: #1D9E75; }
.cell-btn.wrong::after   { content: "✕"; background: #E24B4A; }

/* ── Clues ── */
.clues-section {
  background: #fff; border: 1px solid #e0ddd5;
  border-radius: 12px; overflow: hidden; margin-bottom: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.clues-header {
  background: #1D9E75; padding: 9px 13px;
  display: flex; align-items: center; gap: 7px;
}
.clues-header span { color: #E1F5EE; font-size: 11px; font-weight: 600; }
.clues-header i    { color: #9FE1CB; font-size: 13px; }
.clues-header .hint { margin-left: auto; font-size: 10px; color: #9FE1CB; }

.clues-grid { display: grid; grid-template-columns: 1fr 1fr; }
.clue-item {
  padding: 7px 11px; border-bottom: 1px solid #eeecea;
  border-right: 1px solid #eeecea;
  display: flex; gap: 7px; align-items: flex-start;
  cursor: pointer; transition: background .15s;
}
.clue-item:nth-child(even) { border-right: none; }
.clue-item:nth-last-child(-n+2) { border-bottom: none; }
.clue-item:hover  { background: #f5f5f0; }
.clue-item.marked { background: #EEEDFE; }

/* Radio-dot style marker (filled dot instead of checkmark icon) */
.clue-mark {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid #AFA9EC; flex-shrink: 0;
  margin-top: 1px; background: transparent;
  transition: all .15s;
}
.clue-mark i { display: none; }
.clue-item.marked .clue-mark { background: #534AB7; border-color: #534AB7; box-shadow: inset 0 0 0 3px #fff; }
.clue-text { font-size: 11px; font-weight: 500; color: #1a1a1a; line-height: 1.45; font-family: 'Inter', sans-serif; }
.clue-item.marked .clue-text { color: #3C3489; }

/* ── Actions + footer row ── */
.g-actions {
  display: flex; gap: 8px;
  flex-wrap: wrap; align-items: center;
}
.btn {
  font-size: 12px; padding: 9px 18px; border-radius: 999px;
  border: none; cursor: pointer; font-weight: 500;
  font-family: 'Inter', sans-serif;
  display: flex; align-items: center; gap: 5px;
  transition: opacity .2s, background .15s; white-space: nowrap;
}
.btn:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }
.btn-check  { background: #534AB7; color: #EEEDFE; box-shadow: 0 2px 8px rgba(83,74,183,.3); }
.btn-check:hover:not(:disabled) { background: #3C3489; }
.btn-reset  { background: #F1EFE8; color: #5F5E5A; border: 1px solid #D3D1C7; }
.btn-reset:hover  { background: #D3D1C7; }
.btn-reveal { background: #E24B4A; color: #fff; border: none; display: none; }
.btn-reveal:hover:not(:disabled) { background: #A32D2D; }
.btn-home   { background: #F1EFE8; color: #5F5E5A; border: 1px solid #D3D1C7; }
.btn-home:hover { background: #D3D1C7; }
.checks-badge { background: #3C3489; border-radius: 10px; padding: 1px 7px; font-size: 10px; }

.freeze-notice {
  font-size: 11px; color: #5F5E5A;
  display: none; align-items: center; gap: 4px;
  font-family: 'Inter', sans-serif; white-space: nowrap;
}
.freeze-notice i { font-size: 12px; color: #E24B4A; }

/* Logo sits inline with buttons on the right; wraps below on narrow screens */
.game-footer {
  margin-left: auto;
}
.game-footer img {
  height: 40px;
  object-fit: contain;
  opacity: 0.85;
  display: block;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (max-width: 640px) {
  html, body { font-size: 12px; }
  body { padding: 10px 6px; }
  .screen { padding: 12px 14px 16px; }
  .game-wrap { padding: 12px 14px 16px; }

  .title-hero { padding: 16px 14px 14px; }
  .title-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat-card { padding: 8px; }
  .stat-num { font-size: 16px; }

  .g-header { padding: 10px 12px; }
  .g-title { font-size: 13px; }

  table { min-width: 420px; }
  .cell-btn { min-width: 46px; font-size: 10px; }

  .clues-grid { grid-template-columns: 1fr; }
  .clue-item { border-right: none !important; }
  .clue-item:last-child { border-bottom: none; }

  .g-actions { justify-content: center; }
  .game-footer { margin-left: 0; width: 100%; display: flex; justify-content: center; order: 99; margin-top: 4px; }
}

@media (max-width: 420px) {
  .title-stats { grid-template-columns: 1fr; }
  .btn { flex: 1 1 auto; justify-content: center; }
}

/* ============================================================
   PUZZLE BOARD REFINEMENT
   A compact, high-contrast board inspired by classic web logic games.
   ============================================================ */
:root {
  --ink: #18212f;
  --panel: #f8f6f0;
  --charcoal: #232936;
  --charcoal-2: #303847;
  --gold: #d9ad35;
  --gold-soft: #f7e7a8;
  --line: #d9d2c5;
}

html, body { background: radial-gradient(circle at top, #f2ede1 0, #dbd2bf 100%); }
body { padding: clamp(8px, 2vw, 24px); }
#game-canvas { max-width: 1120px; border: 1px solid rgba(51, 42, 24, .16); }
.game-wrap { padding: clamp(12px, 2vw, 24px); }

.g-header {
  background: linear-gradient(105deg, #202638, #39435a);
  border-radius: 14px;
  padding: 13px 17px;
}
.g-title { font-size: 15px; letter-spacing: .01em; }
.g-badge { background: rgba(217,173,53,.2); color: var(--gold-soft); border: 1px solid rgba(247,231,168,.22); }
.cdot { background: var(--gold); box-shadow: 0 0 0 3px rgba(217,173,53,.12); }
.cdot.used { background: #697183; opacity: .65; }
.prog-row { margin: 13px 2px; }
.prog-bar-wrap { height: 7px; background: #e3ddd1; }
.prog-bar { height: 7px; background: linear-gradient(90deg, #d9ad35, #f0c94f); }

.grid-section { overflow: hidden; border-radius: 14px; border-color: #cfc6b5; box-shadow: 0 8px 24px rgba(37, 31, 20, .1); }
.grid-toolbar {
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f7f3e9;
  border-bottom: 1px solid var(--line);
}
.grid-toolbar .eyebrow { color: #89702b; text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 700; }
.grid-toolbar p { color: #64605a; font-size: 11px; margin-top: 2px; }
.scroll-hint { display: none; color: #756d61; font-size: 10px; white-space: nowrap; }
.grid-scroll { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.grid-scroll::-webkit-scrollbar { height: 8px; }
.grid-scroll::-webkit-scrollbar-thumb { background: #c7beae; border-radius: 99px; }

table { min-width: 650px; }
thead tr { background: linear-gradient(90deg, #7c6733, #a58945); }
thead th { padding: 10px 5px; color: #fff9df; }
thead th:first-child { color: #ffe870; width: 21%; }
.house-num { background: #101b55; color: #ffdf45; width: 29px; height: 29px; font-size: 15px; }
.cat-row:nth-child(odd), .cat-row:nth-child(even) { background: #eeeae2; }
.cat-row:nth-child(even) { background: #e1dcd2; }
.cat-row td { border-color: #d1c9bc; padding: 7px 4px; }
.cat-label { color: var(--ink) !important; font-size: 12px; }
.cat-row td:not(.cat-label) { background: #d8d0c3; }
.cell-btn {
  width: calc(100% - 8px); min-width: 84px; min-height: 40px;
  border: 1px solid #404958; border-radius: 5px;
  background: var(--charcoal); color: #f7f5ee;
  font-size: clamp(10px, 1.1vw, 12px); padding: 5px 7px;
  box-shadow: inset 0 1px rgba(255,255,255,.06), 0 1px 1px rgba(0,0,0,.12);
}
.cell-btn:hover, .cell-btn:focus-visible { background: var(--charcoal-2); border-color: var(--gold); outline: 2px solid rgba(217,173,53,.35); outline-offset: 1px; }
.cell-btn.empty { color: #e1ddd5; }
.cell-btn.empty::before { content: 'click to change'; }
.cell-btn.empty { font-size: 0; }
.cell-btn.empty::before { font-size: 11px; font-weight: 500; }
.cell-btn.filled { border-color: rgba(0,0,0,.12); }

.clues-section { border-radius: 14px; border-color: #cfc6b5; }
.clues-header { background: linear-gradient(90deg, #7c6733, #a58945); padding: 11px 14px; }
.clues-header span { color: #fff9df; font-size: 12px; }
.clues-header i, .clues-header .hint { color: #f7e7a8; }
.clue-item { padding: 9px 12px; }
.clue-text { font-size: 11px; font-weight: 500; }
.clue-item.marked { background: #fff8da; }

.g-actions { gap: 9px; padding: 2px 0; }
.btn { min-height: 40px; padding: 9px 17px; }
.btn-check { background: #223d8f; }
.btn-check:hover:not(:disabled) { background: #152c70; }
.checks-badge { background: #101b55; }
.btn-reset { background: #faf8f2; }
.game-footer img { height: 34px; }

@media (max-width: 720px) {
  #game-canvas { border-radius: 12px; }
  .g-header { align-items: flex-start; }
  .check-dots { padding-top: 4px; }
  .grid-toolbar { padding: 10px 12px; }
  .scroll-hint { display: inline-flex; align-items: center; gap: 4px; }
  .grid-toolbar p { max-width: 270px; }
  .clues-grid { grid-template-columns: 1fr; }
  .clue-item, .clue-item:nth-child(even) { border-right: none; }
  .clue-item:nth-last-child(-n+2) { border-bottom: 1px solid #eeecea; }
  .clue-item:last-child { border-bottom: none; }
  .g-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-actions .btn { justify-content: center; }
  .game-footer { grid-column: 1 / -1; justify-self: center; margin: 2px 0 0; }
}

@media (max-width: 440px) {
  .g-header { padding: 11px 12px; }
  .g-badge { display: none; }
  .grid-toolbar p { font-size: 10px; max-width: 205px; }
  .scroll-hint { font-size: 9px; }
  table { min-width: 620px; }
  thead th:first-child,
  .cat-label { position: sticky; left: 0; z-index: 2; }
  thead th:first-child { background: #7c6733; }
  .cat-row:nth-child(odd) .cat-label { background: #eeeae2; }
  .cat-row:nth-child(even) .cat-label { background: #e1dcd2; }
  .cell-btn { min-width: 80px; }
  .btn { padding: 8px 10px; font-size: 11px; }
}

/* ============================================================
   FULL-SCREEN CASE FILE
   This layer intentionally behaves like a game canvas, not a web page.
   ============================================================ */
html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: #111823;
}
body {
  height: 100dvh;
  min-height: 100dvh;
  align-items: center;
  padding: clamp(5px, 1.2vw, 16px);
  background:
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 24px 24px,
    #111823;
}
#game-canvas {
  height: 100%;
  max-height: 100%;
  max-width: min(1180px, 100%);
  border: 1px solid #c3b590;
  border-radius: clamp(8px, 1.2vw, 14px);
  background: #e8e1d2;
  box-shadow: 0 18px 48px rgba(0,0,0,.45), inset 0 0 0 4px rgba(255,255,255,.2);
}
.screen {
  height: 100%;
  overflow: hidden;
  padding: clamp(10px, 1.7vw, 20px);
}
#s-title.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Title: a deliberately editorial case-file design, not a generic app hero. */
.title-hero {
  position: relative;
  height: min(58%, 390px);
  min-height: 260px;
  margin: 0 0 clamp(9px, 1.4vh, 14px);
  padding: clamp(16px, 3vh, 32px) clamp(18px, 4vw, 55px);
  overflow: hidden;
  text-align: left;
  border: 1px solid #28394a;
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 0 64%, rgba(234,221,181,.08) 64% 64.2%, transparent 64.2%),
    linear-gradient(135deg, #1c2b3b, #263e4f);
}
.title-hero::after {
  content: 'E = mc²';
  position: absolute; right: clamp(16px, 5vw, 65px); bottom: -22px;
  color: rgba(235,217,166,.16); font: italic clamp(72px, 13vw, 180px)/1 Georgia, serif;
  transform: rotate(-8deg); pointer-events: none;
}
.case-line {
  display: flex; justify-content: space-between; max-width: 510px;
  color: #ddc46e; font-size: 9px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  padding-bottom: 10px; border-bottom: 1px solid rgba(221,196,110,.38);
}
.title-mark {
  position: absolute; top: 50%; right: clamp(20px, 10vw, 150px); transform: translateY(-46%);
  display: grid; place-items: center; width: clamp(66px, 11vw, 120px); height: clamp(66px, 11vw, 120px);
  border: 1px solid rgba(221,196,110,.6); border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(221,196,110,.07), inset 0 0 0 8px rgba(221,196,110,.07);
}
.title-mark span { color: #e7ca69; font: italic clamp(46px, 7vw, 80px)/1 Georgia, serif; transform: translateY(-3px); }
.title-kicker { margin: clamp(15px, 3vh, 34px) 0 4px; color: #cbb878 !important; font-size: 10px !important; letter-spacing: .14em; text-transform: uppercase; }
.title-hero h1 { position: relative; z-index: 1; color: #f8f2e2; font: normal clamp(31px, 5vw, 57px)/.92 Georgia, 'Times New Roman', serif; letter-spacing: -.045em; margin: 0 0 10px; }
.title-hero h1 em { color: #e7ca69; font-weight: normal; }
.title-hero .title-copy { position: relative; z-index: 1; max-width: 375px; margin: 0; color: #d4d8d3; font-size: clamp(11px, 1.2vw, 13px); line-height: 1.45; }
.title-btns { position: absolute; z-index: 2; bottom: clamp(15px, 3vh, 28px); left: clamp(18px, 4vw, 55px); flex-direction: row; max-width: none; margin: 0; }
.btn-play, .btn-how { min-width: 125px; padding: 10px 15px; border-radius: 3px; }
.btn-play { background: #d0a937; color: #192334; box-shadow: none; }
.btn-play:hover { background: #e3c053; }
.btn-how { background: transparent; border: 1px solid rgba(245,239,218,.55); color: #f4efda; }
.btn-how:hover { background: rgba(255,255,255,.1); }
.title-stats { margin: 0 auto clamp(7px, 1.3vh, 13px); max-width: 690px; }
.stat-card { padding: clamp(7px, 1.2vh, 11px); border-radius: 4px; border-color: #c9bfae; box-shadow: none; background: #f5f0e6; }
.stat-num { color: #20394d; font-family: Georgia, serif; }
.cat-pills { gap: 5px; }
.pill { border-radius: 3px; }

/* The game screen is a fixed dashboard. Nothing makes the browser page scroll. */
#s-game.active { display: flex; flex-direction: column; gap: clamp(6px, 1vh, 10px); }
.game-wrap { padding: clamp(9px, 1.5vw, 17px); }
.g-header { flex: 0 0 auto; margin: 0; padding: clamp(8px, 1.2vh, 12px) 15px; border-radius: 5px; }
.prog-row { flex: 0 0 auto; margin: 0 2px; }
.grid-section { flex: 0 0 auto; margin: 0; }
.grid-toolbar { padding: clamp(6px, 1vh, 10px) 13px; }
.grid-toolbar p { font-size: clamp(11px, 1.35vh, 13px); }
thead th { padding: clamp(6px, 1vh, 10px) 5px; }
.house-num { width: clamp(22px, 3vh, 29px); height: clamp(22px, 3vh, 29px); font-size: clamp(12px, 1.8vh, 15px); }
.cat-row td { padding: clamp(4px, .8vh, 8px) 4px; }
.cat-label { font-size: clamp(12px, 1.55vh, 15px); }
.cell-btn {
  min-height: clamp(30px, 5.2vh, 44px);
  font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: clamp(13px, 1.75vh, 16px);
  font-weight: 700;
  letter-spacing: .01em;
}
.cell-btn.empty::before { font-size: clamp(13px, 1.75vh, 16px); }
.clues-section { flex: 1 1 0; min-height: 0; margin: 0; display: flex; flex-direction: column; }
.clues-header { flex: 0 0 auto; background: #20394d; padding: clamp(8px, 1.1vh, 11px) 14px; }
.clues-header span { font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif; font-size: clamp(13px, 1.7vh, 16px); font-weight: 700; }
.clues-header .hint { font-size: clamp(11px, 1.35vh, 13px); font-weight: 600; }
.clues-grid { flex: 1 1 auto; min-height: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; }
.clue-item { min-height: 0; padding: clamp(6px, .95vh, 11px) clamp(9px, 1.1vw, 14px); gap: 8px; border-color: #d7cfc0; align-items: center; }
.clue-number { display: none; }
.clue-mark { width: clamp(12px, 1.6vh, 15px); height: clamp(12px, 1.6vh, 15px); border-width: 2px; border-color: #9b8b62; margin: 0; }
.clue-text {
  font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: clamp(13px, 1.75vh, 16px);
  font-weight: 600;
  line-height: 1.22;
  color: #171b1f;
}
.clue-item.marked { background: #e7dfbd; }
.clue-item.marked .clue-mark { background: #20394d; border-color: #20394d; box-shadow: inset 0 0 0 2px #e7dfbd; }
.clue-item.marked .clue-text { color: #20394d; }
.g-actions { flex: 0 0 auto; padding: 0; }
.btn { min-height: clamp(31px, 4.8vh, 40px); padding: 7px 14px; }
.game-footer img { height: clamp(23px, 3.8vh, 34px); }

/* Case-file actions and status reports. */
.btn-check {
  background: #c39a31;
  color: #172535;
  border: 1px solid #d9ba63;
  box-shadow: 0 2px 5px rgba(65, 48, 12, .22);
}
.btn-check:hover:not(:disabled) { background: #d4ad45; }
.checks-badge { background: #20394d; color: #f9edbd; }
.btn-reveal { background: #84382e; }
.btn-reveal:hover:not(:disabled) { background: #692a23; }
.fb { font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif; font-size: clamp(13px, 1.7vh, 16px); font-weight: 600; }
.fb.ok { background: #dfe9d5; color: #244837; border-color: #90ad7b; }
.fb.err { background: #f2dfd7; color: #713226; border-color: #c88375; }
.fb.warn { background: #f1e6be; color: #5c491a; border-color: #c9ad57; }

@media (max-width: 720px) {
  .title-hero { height: min(53%, 330px); min-height: 240px; }
  .title-mark { right: 22px; opacity: .75; }
  .clues-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clue-item:nth-last-child(-n+2) { border-bottom: none; }
  .grid-scroll { scrollbar-width: none; }
  .grid-scroll::-webkit-scrollbar { display: none; }
}

@media (max-width: 440px) {
  body { padding: 5px; }
  .title-hero { min-height: 235px; }
  .case-line { font-size: 8px; }
  .title-hero h1 { font-size: 34px; }
  .title-mark { width: 62px; height: 62px; right: 23px; }
  .title-mark span { font-size: 42px; }
  .title-btns { bottom: 15px; left: 18px; gap: 6px; }
  .btn-play, .btn-how { min-width: 100px; font-size: 11px; padding: 9px 8px; }
  .title-stats { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .stat-card { padding: 6px 3px; }
  .stat-num { font-size: 15px; }
  .stat-lbl { font-size: 8px; }
  .grid-toolbar p { max-width: 190px; }
  .g-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .btn { font-size: 10px; padding: 6px 7px; }
  .clue-item { padding: 3px 5px; gap: 4px; }
  .clue-number { font-size: 7px; }
  .clue-mark { width: 9px; height: 9px; border-width: 1px; }
  .clue-text { font-size: 8.5px; line-height: 1.15; }
  .game-footer { display: none; }
}

@media (max-height: 650px) {
  .screen { padding: 7px 10px; }
  .title-hero { min-height: 215px; height: 60%; }
  .title-kicker { margin-top: 10px; }
  .title-hero h1 { font-size: 31px; }
  .title-stats { margin-bottom: 6px; }
  .g-header { padding: 7px 12px; }
  .grid-toolbar { display: none; }
  .clue-text { font-size: 8px; }
  .clue-item { padding: 2px 5px; }
}

/* Briefing screen: matched to the case-file world and designed for reading. */
#s-how.active { display: flex; flex-direction: column; }
.how-header {
  flex: 0 0 auto;
  gap: 11px;
  padding: 11px 14px;
  margin: 0 0 clamp(8px, 1.5vh, 14px);
  border: 1px solid #1b2e3d;
  border-radius: 5px;
  background: #20394d;
}
.back-btn { width: 31px; height: 31px; border: 1px solid rgba(232,218,170,.65); border-radius: 3px; background: transparent; }
.back-btn i { color: #eadca8; }
.brief-kicker { color: #dfc66e; font-size: 8px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 2px; }
.how-header h2 { color: #f7f1df; font: normal clamp(17px, 2.3vh, 22px)/1.05 Georgia, 'Times New Roman', serif; }
.steps {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1vh, 10px);
  margin: 0 0 clamp(8px, 1.3vh, 12px);
  counter-reset: briefing;
}
.step {
  position: relative;
  min-height: 0;
  padding: clamp(8px, 1.4vh, 13px) clamp(10px, 1.5vw, 16px) clamp(8px, 1.4vh, 13px) clamp(40px, 4vw, 53px);
  gap: 0;
  border: 1px solid #c9bea9;
  border-radius: 4px;
  box-shadow: none;
  background: #f8f4e9;
}
.step:nth-child(5) { grid-column: 1 / -1; }
.step::before {
  counter-increment: briefing;
  content: counter(briefing, decimal-leading-zero);
  position: absolute; top: clamp(8px, 1.4vh, 13px); left: clamp(9px, 1.3vw, 14px);
  color: #987e31; font: 700 clamp(13px, 1.8vh, 17px)/1 Georgia, serif;
}
.step-icon { display: none; }
.step-body { display: flex; flex-direction: column; justify-content: center; min-height: 100%; }
.step-body h3 { color: #1e3445; font: 700 clamp(16px, 2.2vh, 20px)/1.2 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif; margin: 0 0 5px; }
.step-body p { color: #20292f; font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif; font-size: clamp(13px, 1.75vh, 16px); font-weight: 500; line-height: 1.35; }
.tip-box {
  flex: 0 0 auto;
  margin: 0 0 clamp(8px, 1.3vh, 12px);
  padding: clamp(7px, 1.1vh, 10px) 12px;
  border: 1px solid #c0ad70;
  border-radius: 4px;
  background: #eee3bb;
}
.tip-box i { color: #806624; }
.tip-box p { color: #2a2924; font: 600 clamp(13px, 1.7vh, 16px)/1.35 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif; }
.tip-box strong { color: #20394d; }
.start-btn {
  flex: 0 0 auto;
  width: auto; align-self: flex-end;
  padding: 10px 18px; border-radius: 3px;
  background: #20394d; color: #f9f0d2;
}
.start-btn:hover { background: #152b3c; }

@media (max-width: 560px) {
  .how-header { padding: 9px 10px; }
  .steps { gap: 5px; }
  .step { padding: 7px 7px 7px 33px; }
  .step::before { top: 7px; left: 8px; font-size: 12px; }
  .step-body h3 { font-size: 12px; margin-bottom: 2px; }
  .step-body p { font-size: 10px; line-height: 1.28; }
  .tip-box { padding: 6px 8px; }
  .tip-box p { font-size: 10px; }
  .start-btn { width: 100%; justify-content: center; padding: 9px; }
}

/* On an ordinary desktop monitor, use the original game's reading pattern:
   one generous clue per line, instead of compressing prose into columns. */
@media (min-width: 760px) and (min-height: 780px) {
  .clues-grid { grid-template-columns: 1fr; }
  .clue-item { padding: 6px 14px; }
  .clue-text { font-size: clamp(15px, 1.8vh, 18px); font-weight: 600; }
  .clue-mark { width: 15px; height: 15px; }
}

/* Publisher logo on title screen */
.title-logo {
  width: 230px;
  height: 120px;
  margin: 22px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-logo img {
  width: 110px;
  height: auto;
  max-height: 90px;
  object-fit: contain;
  display: block;
}

@media (max-width: 440px) {
  .title-logo {
    width: 180px;
    height: 85px;
    margin-top: 12px;
  }

  .title-logo img {
    width: 90px;
    max-height: 70px;
  }
}