:root {
  --ink: #405e54;
  --ink-soft: #6d7b6b;
  --paper: #f1f2e6;
  --paper-light: #fffaf0;
  --line: #d9decd;
  --blue: #75b7d7;
  --blue-deep: #578274;
  --yellow: #f5c84b;
  --coral: #ea8469;
  --mint: #8ac9a8;
  --lilac: #b9a6d7;
  --danger: #a94c43;
  color: var(--ink);
  background: #f1f2e6;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f1f2e6; }
button, select { font: inherit; }
button { color: inherit; }
button:focus, select:focus, a:focus, [tabindex="0"]:focus { outline: 3px solid #d28d00; outline-offset: 3px; }
.topbar { height: 64px; background: #fcfbf0; border-bottom: 1px solid #dce1d0; color: var(--ink); display: flex; justify-content: space-between; align-items: center; padding: 0 20px; }
.brand { display: flex; align-items: center; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: .01em; }
.brand-mark { margin-right: 10px; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px 9px 9px 2px; background: #6c9485; color: #fff8dc; font-size: 17px; }
.top-note { margin: 0; color: #829081; font-size: 13px; }
.app-shell { max-width: 1260px; padding: 22px 24px 40px; margin: auto; }
.loading-note { text-align: center; padding: 80px 10px; }
.game-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.case-kicker { margin: 0 0 2px; color: var(--blue-deep); font-size: 14px; font-weight: 800; }
h1 { margin: 0; font-size: 36px; line-height: 1.12; letter-spacing: -.035em; }
.case-intro { color: var(--ink-soft); margin: 7px 0 0; max-width: 620px; }
.heading-copy { min-width: 0; }
 .puzzle-picker { display: flex; flex-wrap: wrap; align-items: flex-end; margin: 0 0 22px; padding: 14px 16px 6px; border: 1px solid #cbd7c2; border-radius: 14px; background: #f7f6e8; }
.picker-field { flex: 1 1 210px; min-width: 0; margin: 0 12px 8px 0; }
.picker-field:last-child { flex-grow: 2; margin-right: 0; }
.picker-field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.picker-field select { width: 100%; max-width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #bfcbb8; border-radius: 9px; color: var(--ink); background: var(--paper-light); }
.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; grid-template-rows: auto auto 1fr; grid-template-areas: "map people" "map clues" "map tools"; gap: 14px 18px; align-items: start; }
.people-panel { grid-area: people; }
.clues-panel { grid-area: clues; }
.tools-panel { grid-area: tools; }
.map-panel { grid-area: map; min-width: 0; border-radius: 14px; background: #a7cfca; border: 1px solid #9abeb4; overflow: hidden; }
.map-panel-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 14px 16px 10px; }
.map-panel-head h2, .panel-card h2 { margin: 0; font-size: 17px; }
.map-hint { margin: 2px 0 0; color: var(--ink-soft); font-size: 12px; }
.map-view-controls { display: flex; align-items: center; padding: 0 16px 8px; }
.map-size-button { flex: 0 0 auto; }
.map-view-note { margin: 0 0 7px 4px; color: #527367; font-size: 12px; }
.map-wrap { overflow-x: auto; overflow-y: hidden; padding: 0 8px 12px; -webkit-overflow-scrolling: touch; }
.room-map { display: block; width: 100%; height: auto; }
.building-scenery, .room-interior, .room-outline, .room-mark-overlay { pointer-events: none; }
.room-cell { cursor: pointer; }
.room-cell .tile { stroke: #d0bd9b; stroke-width: 3; }
.room-outline { stroke: transparent; stroke-width: 3; }
.room-cell.is-occupied .room-outline { stroke: #8da28a; stroke-width: 2; }
.room-cell:hover .room-outline { stroke: #6b9380; stroke-width: 3; }
.room-cell:focus .room-outline, .room-cell.is-target .room-outline { stroke: #bb893c; stroke-width: 4; }
.room-cell:focus { outline: none; }
.room-label { fill: #536052; font-size: 12px; font-weight: 700; text-anchor: middle; }
.map-axis { fill: #5d786a; font-size: 12px; font-weight: 700; text-anchor: middle; }
.person-name { fill: #526452; font-size: 10px; font-weight: 700; text-anchor: middle; }
.person-nameplate, .person-name, .map-person, .room-scenery, .target-object-icon { pointer-events: none; }
.mark-x { fill: #b07860; font-size: 30px; text-anchor: middle; pointer-events: none; }
.map-panel.theme-archaeology { background: #cbd0ae; }
.map-panel.theme-space { background: #c0d1df; border-color: #a5bbc9; }
.map-panel.theme-greek { background: #bbd6dc; border-color: #aac5cb; }
.map-panel.theme-castle { background: #bfcbd1; border-color: #acbac2; }
.map-panel.theme-museum { background: #b4ceca; }
.panel-card { min-width: 0; padding: 15px; border-radius: 13px; background: var(--paper-light); border: 1px solid #dce0cf; }
.panel-card h2 { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.small-count { flex: 0 0 auto; white-space: nowrap; background: #edf3ee; border-radius: 20px; padding: 2px 8px; font-size: 12px; color: var(--ink-soft); }
.student-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.student-button { display: flex; align-items: center; min-width: 0; min-height: 44px; border: 1px solid #ced8d8; border-radius: 9px; background: #fff; padding: 6px 8px; text-align: left; font-weight: 700; cursor: pointer; }
.student-button[aria-pressed="true"] { border: 2px solid var(--blue-deep); background: #eaf1de; padding: 5px 7px; }
.student-token { margin-right: 7px; width: 24px; height: 24px; flex: 0 0 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--ink); font-size: 11px; font-weight: 900; border: 1px solid rgba(23,58,87,.18); }
.instruction { margin: 8px 0 0; color: var(--ink-soft); font-size: 12px; }
.clue-list { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.clue-list li { padding-left: 2px; font-size: 14px; }
.clue-list li::marker { color: var(--blue-deep); font-weight: 800; }
.hinted-clue { background: #fff2c5; border-radius: 5px; padding: 3px 5px; }
.tools { display: flex; flex-wrap: wrap; }
.action-button { margin: 0 7px 7px 0; border: 1px solid #b6c5c8; border-radius: 9px; background: #f8fbf9; min-height: 44px; padding: 7px 11px; font-weight: 700; font-size: 13px; cursor: pointer; }
.action-button.primary { color: white; border-color: var(--ink); background: var(--ink); }
.action-button[aria-pressed="true"] { background: #f7edbd; border-color: #ca9a21; }
.action-button:disabled { opacity: .48; cursor: not-allowed; }
.status { min-height: 22px; margin: 9px 0 0; color: var(--ink-soft); font-size: 13px; }
.status.error { color: var(--danger); font-weight: 700; }
.answer-prompt { margin: 8px 0 0; font-weight: 800; }
.answer-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.answer-button { text-align: left; border: 1px solid #c7d5d5; background: white; border-radius: 8px; padding: 8px 9px; cursor: pointer; font-size: 13px; font-weight: 700; }
.answer-button:hover { background: #f3f8e8; }
.answer-result { margin: 9px 0 0; padding: 9px 10px; background: #e5f3e7; border-radius: 8px; color: #285d43; font-size: 13px; }
.answer-result.try-again { background: #f8edda; color: #805627; }
.site-footer { max-width: 1260px; margin: auto; border-top: 1px solid #cbd7d8; padding: 14px 24px 20px; display: flex; justify-content: space-between; color: #82917b; font-size: 12px; }
@media (max-width: 1150px) {
  .play-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "people people" "map map" "clues tools"; gap: 14px; }
  .people-panel .student-list { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .people-panel[data-count="4"] .student-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .people-panel .instruction { margin-top: 9px; }
  h1 { font-size: 32px; }
  .app-shell { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 800px) {
  .game-heading { display: block; }

  .people-panel .student-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .topbar { height: 56px; padding: 0 14px; }
  .top-note { display: none; }
  .app-shell { padding: 16px 12px 28px; }
  h1 { font-size: 28px; }
  .picker-field { flex-basis: 100%; margin-right: 0; }
  .play-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "people" "map" "clues" "tools"; gap: 12px; }
  .people-panel[data-count="4"] .student-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-card { padding: 12px; }
  .student-button { font-size: 14px; padding: 6px; }
  .student-button[aria-pressed="true"] { padding: 5px; }
  .student-token { margin-right: 5px; width: 22px; height: 22px; flex-basis: 22px; }
  .map-panel-head { padding: 12px 12px 8px; }
  .map-panel-head > div { min-width: 0; margin-right: 8px; }
  .map-view-controls { padding-left: 12px; padding-right: 12px; }
  .map-wrap { padding-left: 0; padding-right: 0; }
  .map-view-note { font-size: 11px; }
  .site-footer { padding-left: 14px; padding-right: 14px; flex-wrap: wrap; }
  .site-footer span { margin-right: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
.answer-button[aria-pressed="true"] { border-color: #d28d00; background: #fff1c7; }

.person-check { margin-left: auto; color: #578274; font-size: 12px; }
@media (max-width: 360px) { .top-note { display: none; } }

.topbar-actions { display: flex; align-items: center; }
.topbar-actions .top-note { margin-right: 18px; }
.language-control { position: relative; flex: 0 0 auto; }
.language-toggle { display: flex; align-items: center; justify-content: center; min-width: 72px; min-height: 44px; padding: 6px 9px; border: 1px solid #c4d0be; border-radius: 9px; background: #fffaf0; cursor: pointer; }
.language-toggle img, .language-choice img { display: block; object-fit: cover; border-radius: 2px; flex: 0 0 auto; }
.language-code { margin-left: 6px; font-size: 12px; font-weight: 700; }
.language-menu { position: absolute; right: 0; top: 100%; margin-top: 7px; z-index: 20; min-width: 180px; padding: 6px; border: 1px solid #c4d0be; border-radius: 10px; background: #fffaf0; box-shadow: 0 5px 16px rgba(64,94,84,.14); }
.language-menu[hidden] { display: none; }
.language-choice { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; cursor: pointer; }
.language-choice img { margin-right: 10px; }
.language-choice[aria-pressed="true"], .language-choice:hover { background: #e7eddf; }
@media (max-width: 800px) { .topbar-actions .top-note { display: none; } }

.print-controls { min-width: 0; margin: 16px 0 0; padding: 8px 0 0; border: 0; border-top: 1px solid #dce0cf; }
.print-controls legend { padding: 0 6px 0 0; font-size: 14px; font-weight: 700; }
.print-mode-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-bottom: 5px; }
.print-mode-options label { display: flex; align-items: center; min-height: 44px; padding-right: 6px; font-size: 13px; cursor: pointer; }
.print-mode-options input { flex: 0 0 auto; margin: 0 6px 0 0; width: 16px; height: 16px; }

.new-puzzle-panel { margin: -8px 0 22px; padding: 16px; border: 1px solid #b6cbb8; border-radius: 14px; background: #edf2e5; }
.new-puzzle-panel h2 { font-size: 17px; margin: 0 0 12px; }
.new-puzzle-actions { display: flex; flex-wrap: wrap; align-items: flex-end; }
.new-puzzle-actions .picker-field { flex: 0 1 140px; }
.new-puzzle-actions .picker-field select { display: block; height: 44px; }
.new-puzzle-actions .action-button { display: inline-flex; align-items: center; justify-content: center; height: 44px; min-height: 44px; margin: 0 8px 8px 0; }

.starting-placement-option { display: flex; align-items: center; min-height: 44px; font-size: 14px; cursor: pointer; }
.starting-placement-option input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0 8px 0 0; }
.people-panel[data-count="5"] .student-list { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (min-width: 1151px) { .people-panel[data-count="5"] .student-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) { .people-panel[data-count="5"] .student-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 420px) { .new-puzzle-actions .picker-field { flex: 1 1 100%; margin-right: 0; } }
