:root {
  --ink: #17211b;
  --muted: #647064;
  --paper: #fffaf0;
  --card: rgba(255, 253, 245, 0.9);
  --line: rgba(23, 33, 27, 0.14);
  --leaf: #2f6b4f;
  --mint: #9fd8b3;
  --sun: #f4b942;
  --clay: #d96c45;
  --blue: #4f8cc9;
  --shadow: 0 24px 70px rgba(37, 47, 36, 0.18);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background:
    radial-gradient(circle at 10% 8%, rgba(244, 185, 66, 0.38), transparent 24rem),
    radial-gradient(circle at 86% 18%, rgba(159, 216, 179, 0.62), transparent 26rem),
    linear-gradient(135deg, #fff7dc 0%, #eaf4d5 58%, #d8eef0 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.13;
  background-image: linear-gradient(90deg, var(--ink) 1px, transparent 1px), linear-gradient(var(--ink) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

.made-by { position: fixed; top: 14px; right: 16px; z-index: 30; padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.78); border: 1px solid var(--line); color: var(--leaf); font-size: 12px; font-weight: 900; box-shadow: 0 10px 28px rgba(23, 33, 27, .12); backdrop-filter: blur(10px); }

.wrap { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 26px 0 48px; }
.hero { display: grid; grid-template-columns: 1.35fr 0.65fr; gap: 18px; align-items: stretch; margin-bottom: 18px; }
.panel, .hero-card { background: var(--card); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.hero-card { padding: 28px; position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; right: -50px; bottom: -56px; width: 210px; height: 210px; border-radius: 42% 58% 44% 56%; background: var(--mint); opacity: .55; }
.hero-title-row { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; position: relative; z-index: 1; }
.class-qr-box {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 12px 28px rgba(23, 33, 27, .12);
}
.class-qr-box[hidden] { display: none; }
.class-qr-box img { width: 104px; height: 104px; border-radius: 10px; }
.class-qr-box span { font-size: 12px; font-weight: 900; color: var(--leaf); }
.qr-zoom-btn { display: grid; place-items: center; gap: 6px; padding: 0; border-radius: 12px; background: transparent; color: var(--leaf); box-shadow: none; }
.qr-modal-card { width: min(520px, 100%); text-align: center; }
.qr-modal-card img { width: min(420px, 100%); border-radius: 22px; background: white; padding: 12px; }
.eyebrow { margin: 0 0 10px; font-weight: 900; color: var(--leaf); letter-spacing: .08em; font-size: 13px; }
h1 { margin: 0; font-size: clamp(34px, 6vw, 68px); line-height: .95; letter-spacing: -0.06em; }
h2 { margin: 0 0 14px; font-size: 24px; letter-spacing: -0.03em; }
h3 { margin: 0 0 10px; font-size: 18px; }
p { color: var(--muted); line-height: 1.6; }
.panel { padding: 20px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack { display: grid; gap: 12px; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.72);
  padding: 13px 14px;
  color: var(--ink);
  outline: none;
}
textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--leaf); box-shadow: 0 0 0 4px rgba(47, 107, 79, .13); }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 800; color: #405047; }
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input { width: auto; }
button {
  border: 0;
  border-radius: 999px;
  padding: 12px 17px;
  background: var(--ink);
  color: white;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(23, 33, 27, .18);
}
button.secondary { background: white; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
button.sun { background: var(--sun); color: #3d2b00; }
button.clay { background: var(--clay); }
button.leaf { background: var(--leaf); }
button.danger { background: var(--clay); color: white; }
button:disabled { opacity: .45; cursor: not-allowed; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; border-radius: 999px; background: rgba(47, 107, 79, .1); color: var(--leaf); font-weight: 900; font-size: 13px; }
.topic-card, .student-card, .score-card { border: 1px solid var(--line); border-radius: 22px; padding: 16px; background: rgba(255,255,255,.54); }
.class-list-panel { min-width: 0; }
.class-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.class-choice-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 92px; cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.class-choice-card:hover { transform: translateY(-2px); border-color: rgba(47, 107, 79, .45); background: rgba(255,255,255,.82); }
.score-row { display: grid; grid-template-columns: 1fr 64px; gap: 12px; align-items: center; padding: 12px 14px; }
.score-row span { justify-self: center; font-size: 30px; line-height: 1; font-weight: 900; }
.topic-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.stat { border-radius: 16px; padding: 10px; background: rgba(255,250,240,.82); border: 1px dashed rgba(23,33,27,.16); }
.stat b { display: block; font-size: 19px; margin-top: 4px; }
.tiny { font-size: 12px; color: var(--muted); }
.selected { outline: 4px solid rgba(244, 185, 66, .55); background: rgba(255, 246, 210, .9); }
.answer-box { background: var(--ink); color: #fff8e6; border-radius: 26px; padding: 22px; }
.answer-box p, .answer-box .tiny { color: rgba(255,248,230,.75); }
.big-number { font-size: clamp(40px, 10vw, 86px); line-height: 1; font-weight: 900; letter-spacing: -.06em; }
.list { display: grid; gap: 8px; }
.list-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); padding: 10px 0; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: white; padding: 12px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .25s; z-index: 10; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }
.empty { border: 1px dashed var(--line); border-radius: 22px; padding: 18px; color: var(--muted); text-align: center; }
a { color: var(--leaf); font-weight: 900; }

.student-wrap { width: min(1040px, calc(100% - 24px)); }
.student-hero { grid-template-columns: 1fr 0.45fr; }
.compact-panel { padding: 16px; }
.topic-set-tools { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.student-class-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.choice-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 15px;
  background: rgba(255,255,255,.58);
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.choice-card:hover { transform: translateY(-2px); border-color: rgba(47, 107, 79, .45); background: rgba(255,255,255,.82); }
.choice-card h3 { margin-bottom: 4px; }
.choice-card p { margin: 0; font-size: 13px; }
.team-chip-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.team-chip {
  width: auto;
  min-width: 0;
  box-shadow: none;
  background: rgba(255,255,255,.72);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 11px 16px;
}
.team-chip.selected { outline: 4px solid rgba(244, 185, 66, .55); background: rgba(255, 246, 210, .9); }
.inline-profile-form { display: grid; grid-template-columns: 110px minmax(160px, 1fr) auto; gap: 10px; align-items: center; }
.inline-profile-form input { padding: 12px 14px; }
.compact-topic-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.compact-topic-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(110px, 160px) minmax(48px, .45fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.55);
  padding: 9px 10px;
}
.compact-topic-row input { padding: 10px 12px; border-radius: 12px; text-align: right; }
.compact-topic-row input:disabled { color: var(--ink); opacity: 1; background: rgba(244,185,66,.16); }
.submit-actions { margin-top: 12px; justify-content: flex-end; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 33, 27, .38);
  z-index: 20;
}
.modal-card {
  width: min(420px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.modal-backdrop[hidden] { display: none; }
.game-console { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: stretch; }
.game-main { display: grid; min-height: 520px; place-items: center; }
.mega-random {
  width: min(620px, 100%);
  min-height: 260px;
  border-radius: 44px;
  font-size: clamp(36px, 7vw, 76px);
  line-height: 1.05;
  background: radial-gradient(circle at 25% 20%, #ffe08a, var(--sun) 42%, #d96c45 100%);
  color: #281700;
  box-shadow: 0 34px 80px rgba(217, 108, 69, .36);
}
.game-side { display: grid; align-content: start; gap: 14px; }
.roulette-card {
  width: min(820px, 100%);
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--ink);
  color: #fff8e6;
  border-radius: 38px;
  padding: 34px;
  box-shadow: var(--shadow);
}
.roulette-card .eyebrow { color: var(--sun); }
.roulette-name { font-size: clamp(48px, 10vw, 110px); font-weight: 900; letter-spacing: -.06em; }
.roulette-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; }
.roulette-pause, .roulette-reveal { min-width: 170px; font-size: 22px; }
.roulette-close { position: absolute; right: 28px; bottom: 24px; }
.winner-line { font-size: clamp(34px, 7vw, 72px); font-weight: 900; color: var(--clay); line-height: 1; }
.result-card { width: min(820px, 100%); animation: resultPop .42s cubic-bezier(.2, 1.35, .35, 1); position: relative; overflow: hidden; }
.result-card::before { content: ""; position: absolute; inset: -40%; pointer-events: none; background: conic-gradient(from 20deg, transparent, rgba(244,185,66,.28), transparent, rgba(47,107,79,.22), transparent); animation: shimmerSpin 4s linear infinite; }
.result-card > * { position: relative; z-index: 1; }
.answer-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.answer-summary b { font-size: clamp(24px, 4vw, 42px); letter-spacing: -.04em; }
.answer-meta-chip { display: inline-flex; padding: 8px 11px; border-radius: 999px; background: rgba(47, 107, 79, .1); color: var(--leaf); font-size: 13px; font-weight: 900; }
.answer-hero { display: grid; grid-template-columns: .75fr 1.25fr; gap: 12px; margin: 12px 0 16px; }
.answer-hero > div { border-radius: 26px; padding: 18px; background: var(--ink); color: #fff8e6; box-shadow: 0 18px 38px rgba(23,33,27,.2); }
.answer-hero span { display: block; margin-bottom: 7px; color: var(--sun); font-size: 13px; font-weight: 900; letter-spacing: .08em; }
.answer-hero strong { display: block; font-size: clamp(36px, 7vw, 72px); line-height: .95; letter-spacing: -.06em; }
.answer-hero b { display: block; font-size: clamp(48px, 10vw, 104px); line-height: .9; letter-spacing: -.07em; }
.rank-list { display: grid; gap: 10px; }
.rank-card { border: 1px solid var(--line); border-radius: 20px; padding: 12px 14px; background: rgba(255,255,255,.6); }
.rank-first { background: linear-gradient(135deg, rgba(244, 185, 66, .32), rgba(255,255,255,.82)); border-color: rgba(217, 108, 69, .32); transform: scale(1.01); }
.rank-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rank-title > div { display: flex; align-items: center; gap: 10px; }
.rank-title b { font-size: 22px; color: var(--ink); }
.rank-first .rank-title b { font-size: clamp(30px, 5vw, 48px); color: var(--clay); line-height: 1; }
.rank-detail { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--muted); font-weight: 900; }
.rank-draggable { cursor: grab; user-select: none; transition: transform .16s ease, opacity .16s ease, border-color .16s ease, box-shadow .16s ease; }
.rank-draggable:active { cursor: grabbing; }
.rank-draggable.dragging { opacity: .42; transform: scale(.98); }
.rank-draggable.drag-over { border-color: var(--leaf); box-shadow: 0 0 0 4px rgba(47,107,79,.14); transform: translateY(2px); }
.drag-handle { display: inline-grid; place-items: center; width: 30px; height: 34px; border-radius: 10px; background: rgba(23,33,27,.09); color: var(--muted); font-weight: 900; letter-spacing: -4px; }
.ranking-guide { margin: 14px 0 10px; padding: 12px 14px; border-radius: 16px; background: rgba(47,107,79,.09); color: var(--leaf); font-weight: 900; text-align: center; }
.award-points-btn { width: 100%; font-size: 18px; }
.result-card { max-height: calc(100vh - 36px); overflow-y: auto; }
.answer-reason { margin: 14px 0 0; }
.status-details { border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.5); padding: 4px 12px 12px; }
.status-details summary { cursor: pointer; font-size: 20px; font-weight: 900; padding: 12px 0; }
.student-topic-banner {
  border-radius: 30px;
  background: var(--ink);
  color: #fff8e6;
  box-shadow: var(--shadow);
  padding: 34px 24px;
  margin-bottom: 16px;
  text-align: center;
  font-size: clamp(42px, 8vw, 88px);
  font-weight: 900;
  letter-spacing: -.06em;
}
.round-timer { padding: 12px 20px; border-radius: 999px; background: #fff8e6; color: var(--clay); font-size: clamp(34px, 6vw, 72px); line-height: 1; font-weight: 900; box-shadow: 0 18px 44px rgba(23,33,27,.22); }
.student-timer { width: max-content; margin: -4px auto 12px; }
.countdown-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: radial-gradient(circle, rgba(244,185,66,.9), rgba(23,33,27,.78)); }
.countdown-overlay[hidden] { display: none; }
.countdown-overlay span { color: #fff8e6; font-size: clamp(120px, 24vw, 320px); line-height: 1; font-weight: 900; text-shadow: 0 22px 70px rgba(23,33,27,.5); }
.pop-count { animation: countPop .86s cubic-bezier(.2, 1.4, .35, 1); }
.student-game-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.prediction-bar { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 10px; align-items: end; }
.student-game-mode .student-wrap { width: min(1280px, calc(100% - 22px)); padding: 12px 0; }
.student-game-mode .student-hero { display: none; }
.student-game-mode #gameStudentScreen { min-height: calc(100vh - 24px); display: grid; grid-template-rows: auto 1fr; gap: 12px; }
.student-game-mode .student-topic-banner { margin-bottom: 0; min-height: 150px; display: grid; place-items: center; }
.student-game-mode .student-game-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.student-game-mode .student-game-grid > .panel { margin-bottom: 0; }
.student-game-mode .prediction-card { min-height: 0; height: auto; padding: 14px; }
.student-game-mode .prediction-card p { margin: 0 0 10px; }
.student-game-mode .prediction-bar { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.student-game-mode .prediction-bar select { padding: 10px 12px; }
.student-game-mode .prediction-bar button { white-space: nowrap; padding: 11px 14px; }
.student-game-mode .compact-answer { padding: 16px; }
.student-game-mode .score-row span { font-size: 40px; }
.teacher-entry-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.entry-control-panel { display: grid; gap: 12px; }
.compact-topic-form { display: grid; gap: 8px; }
.compact-topic-form input { padding: 10px 12px; border-radius: 12px; }
.start-game-small { width: 100%; padding: 14px 12px; }
.compact-teacher-topics, .compact-roster { display: grid; gap: 8px; }
.teacher-topic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.52);
  padding: 10px 12px;
}
.mini-select { width: auto; min-width: 92px; padding: 8px 10px; border-radius: 12px; }
.mini-btn { width: auto; padding: 8px 11px; font-size: 12px; box-shadow: none; }
.roster-chip {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.52);
  padding: 8px 10px;
  font-size: 13px;
}
.roster-chip.offline { opacity: .72; }
.roster-team { border: 1px solid var(--line); border-radius: 16px; padding: 8px; background: rgba(255,255,255,.32); }
.roster-team summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; font-weight: 900; color: var(--leaf); list-style: none; }
.roster-team summary::-webkit-details-marker { display: none; }
.roster-team summary::before { content: "▶"; color: var(--clay); font-size: 11px; }
.roster-team[open] summary { margin-bottom: 6px; }
.roster-team[open] summary::before { content: "▼"; }

/* The class selector becomes a detective's case-file desk. */
body.teacher-class-mode {
  --detective-navy: #111923;
  --detective-navy-soft: #1d2935;
  --detective-paper: #d7bd85;
  --detective-paper-light: #ead8ad;
  --detective-ink: #272116;
  --detective-red: #8f2f2b;
  --detective-brass: #a77b32;
  color: var(--detective-ink);
  font-family: Georgia, "Times New Roman", "Malgun Gothic", serif;
  background:
    radial-gradient(ellipse at 50% -12%, rgba(81, 106, 127, .24), transparent 54%),
    radial-gradient(circle at 16% 78%, rgba(0, 0, 0, .38), transparent 31rem),
    repeating-radial-gradient(ellipse at 32% 28%, rgba(255,255,255,.018) 0 1px, transparent 1px 5px),
    linear-gradient(128deg, #142332 0%, #09131e 58%, #111e2a 100%);
  background-attachment: fixed;
}
body.teacher-class-mode::before {
  z-index: 0;
  opacity: .36;
  background-image:
    linear-gradient(rgba(175, 197, 211, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(175, 197, 211, .09) 1px, transparent 1px),
    repeating-linear-gradient(97deg, transparent 0 13px, rgba(255,255,255,.025) 14px, transparent 16px 31px);
  background-size: 34px 34px, 34px 34px, 100% 100%;
  mask-image: radial-gradient(ellipse at center, #000 34%, rgba(0,0,0,.4) 78%, transparent 100%);
}
body.teacher-class-mode::after {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 12px;
  border: 1px solid rgba(193, 154, 82, .22);
  border-radius: 18px;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 4px rgba(0,0,0,.22),
    inset 0 0 0 6px rgba(217,182,113,.07),
    inset 0 0 46px rgba(0,0,0,.62),
    0 8px 25px rgba(0,0,0,.45);
}
.teacher-class-mode .wrap { position: relative; z-index: 1; width: min(1240px, calc(100% - 32px)); padding-top: 34px; }
.teacher-class-mode .made-by {
  border: 1px solid #6f5427;
  border-radius: 4px;
  background: linear-gradient(#b08b45, #72501f);
  color: #17130c;
  font-family: "Courier New", monospace;
  letter-spacing: .08em;
  box-shadow: inset 0 1px rgba(255,255,255,.3), 0 8px 20px rgba(0,0,0,.35);
}
.teacher-class-mode .hero { grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 20px; }
.teacher-class-mode .hero-card {
  border: 1px solid rgba(201,168,99,.35);
  border-radius: 10px 24px 12px 18px;
  background:
    linear-gradient(96deg, transparent 0 5%, rgba(255,255,255,.035) 5.2% 5.6%, transparent 5.8%),
    linear-gradient(145deg, var(--detective-navy-soft), var(--detective-navy));
  color: #f2e4bf;
  box-shadow: inset 0 0 0 5px rgba(0,0,0,.15), 0 30px 70px rgba(0,0,0,.42);
  animation: caseFileIn .5s ease-out both;
}
.teacher-class-mode .hero-card::before { display: none; }
.teacher-class-mode .hero-card::after { display: none; }
.teacher-class-mode .hero-card h1 {
  max-width: 780px;
  color: #f1dfb6;
  font-family: "Courier New", "Malgun Gothic", monospace;
  font-size: clamp(40px, 6.4vw, 78px);
  letter-spacing: -.075em;
  text-shadow: 0 3px #000, 0 0 24px rgba(210,171,87,.18);
}
.teacher-class-mode .hero-card .eyebrow,
.teacher-class-mode .case-label {
  margin: 0 0 9px;
  color: #c99b4b;
  font-family: "Courier New", monospace;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
}
.teacher-class-mode #heroText { position: relative; z-index: 1; max-width: 650px; color: #f2e4bf; font-family: "Courier New", "Malgun Gothic", monospace; text-shadow: 0 1px 2px rgba(0,0,0,.75); }
.teacher-class-mode .case-status-panel,
.teacher-class-mode #classScreen .panel {
  position: relative;
  border: 1px solid rgba(74,52,25,.62);
  border-radius: 7px 18px 9px 14px;
  background:
    linear-gradient(93deg, transparent 0 2%, rgba(88,58,22,.06) 2.2% 2.5%, transparent 2.7%),
    repeating-linear-gradient(0deg, rgba(75,50,21,.025) 0 1px, transparent 1px 4px),
    linear-gradient(145deg, var(--detective-paper-light), var(--detective-paper));
  box-shadow: inset 0 0 28px rgba(91,58,20,.16), 10px 18px 34px rgba(0,0,0,.34);
  backdrop-filter: none;
}
.teacher-class-mode .case-status-panel { padding: 30px 22px 22px; transform: rotate(.6deg); animation: caseFileIn .5s .08s ease-out both; }
.teacher-class-mode .confidential-stamp,
.teacher-game-mode .confidential-stamp {
  position: absolute;
  right: 17px;
  bottom: 14px;
  padding: 5px 9px 4px;
  border: 2px solid rgba(132, 34, 30, .58);
  color: rgba(132, 34, 30, .67);
  font: 900 12px/1 "Courier New", monospace;
  letter-spacing: .12em;
  pointer-events: none;
  filter: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.72' numOctaves='2' seed='7' result='t'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='t' scale='1.4'/%3E%3C/filter%3E%3C/svg%3E%23n");
  opacity: .82;
  transform: rotate(-7deg);
  mask-image: repeating-linear-gradient(104deg, #000 0 3px, rgba(0,0,0,.45) 4px, #000 7px 12px);
}
.teacher-class-mode .case-status-panel::after,
.teacher-class-mode .case-intake-panel::after {
  content: "";
  position: absolute;
  width: 62px;
  height: 16px;
  top: -7px;
  left: 50%;
  background: rgba(218,197,151,.68);
  border: 1px solid rgba(91,67,31,.2);
  transform: translateX(-50%) rotate(-2deg);
  box-shadow: 0 2px 4px rgba(0,0,0,.12);
}
.teacher-class-mode .case-status-panel .case-label,
.teacher-class-mode #classScreen .case-label { color: #664922; }
.teacher-class-mode .case-status-panel h2,
.teacher-class-mode #classScreen h2 { font-family: Rockwell, "Roboto Slab", Georgia, serif; color: #252018; letter-spacing: -.025em; }
.teacher-class-mode .case-status-panel .pill,
.teacher-class-mode #classScreen .pill { border: 1px solid rgba(86,49,26,.26); background: rgba(112,64,35,.1); color: #633d25; }
.teacher-class-mode .case-desk-grid { grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr); gap: 20px; align-items: start; }
.teacher-class-mode .case-intake-panel { transform: rotate(-.35deg); animation: caseFileIn .55s .14s ease-out both; }
.teacher-class-mode .case-archive-panel { transform: rotate(.2deg); animation: caseFileIn .55s .2s ease-out both; }
.teacher-class-mode #classScreen label { color: #55442a; font-family: "Courier New", "Malgun Gothic", monospace; }
.teacher-class-mode #classScreen input {
  border: 0;
  border-bottom: 2px solid rgba(74,52,25,.5);
  border-radius: 2px;
  background: rgba(248,234,196,.36);
  color: #211c14;
  font-family: "Courier New", "Malgun Gothic", monospace;
  box-shadow: inset 0 5px 15px rgba(89,59,24,.07);
}
.teacher-class-mode #classScreen input:focus { border-color: var(--detective-red); box-shadow: 0 3px rgba(143,47,43,.16); }
.teacher-class-mode #classScreen button:not(.danger),
.teacher-class-mode #navButtons button,
.teacher-class-mode #navButtons .guide-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b28a45;
  border-radius: 7px;
  background:
    radial-gradient(circle at 14% 22%, rgba(255,255,255,.12) 0 1px, transparent 2px),
    linear-gradient(145deg, #4b261e, #24120f 70%);
  color: #fff0c8;
  font-family: "Courier New", "Malgun Gothic", monospace;
  letter-spacing: .04em;
  text-shadow: 0 1px #2c1311;
  box-shadow: inset 0 0 0 2px #130b09, inset 0 0 0 3px rgba(221,183,105,.48), inset 0 1px 7px rgba(255,255,255,.1), 0 7px 12px rgba(0,0,0,.35);
}
.teacher-class-mode #classScreen button:not(.danger):hover,
.teacher-class-mode #navButtons button:hover,
.teacher-class-mode #navButtons .guide-tab:hover { transform: translateY(-1px) rotate(-.4deg); filter: brightness(1.06); }
.teacher-class-mode #navButtons .nav-tab.active {
  border-color: #f3d996;
  background: linear-gradient(145deg, #f6dfaa, #c9973d);
  color: #27190d;
  text-shadow: 0 1px rgba(255,255,255,.52);
  box-shadow: inset 0 1px rgba(255,255,255,.7), 0 0 0 2px rgba(238,205,126,.2), 0 0 18px rgba(242,199,102,.5);
  transform: translateY(-2px);
}
.teacher-class-mode .case-create-button {
  border: 2px double #601815;
  background: linear-gradient(145deg, #c9443c, #921f1c);
  color: #fff0cc;
  box-shadow: inset 0 1px rgba(255,255,255,.24), inset 0 -4px rgba(73,12,10,.34), 0 8px 16px rgba(82,24,18,.35);
}
.teacher-class-mode #navButtons .pill { border: 1px dashed rgba(207,171,92,.45); background: rgba(220,188,119,.08); color: #d5b66e; font-family: "Courier New", monospace; }
.teacher-class-mode .class-card-grid { gap: 14px; }
.teacher-class-mode .class-choice-card {
  position: relative;
  min-height: 112px;
  border: 1px solid rgba(70,48,22,.5);
  border-radius: 4px 14px 7px 9px;
  background:
    linear-gradient(90deg, rgba(72,44,18,.07) 1px, transparent 1px),
    linear-gradient(155deg, #e6cf9b, #c7a96d);
  background-size: 24px 100%, auto;
  box-shadow: inset 0 0 18px rgba(74,46,16,.12), 5px 7px 12px rgba(67,41,17,.18);
  transform: rotate(-.25deg);
}
.teacher-class-mode .class-choice-card:nth-child(even) { transform: rotate(.35deg); }
.teacher-class-mode .class-choice-card::before {
  content: "CASE";
  position: absolute;
  top: -12px;
  left: 13px;
  padding: 4px 12px 3px;
  border-radius: 5px 5px 0 0;
  background: #b89051;
  color: #3c2a16;
  font: 900 10px/1 "Courier New", monospace;
  letter-spacing: .14em;
}
.teacher-class-mode .class-choice-card:hover { border-color: var(--detective-red); background: linear-gradient(155deg, #edd9a9, #cfb276); transform: translateY(-3px) rotate(0); }
.teacher-class-mode .class-choice-card.selected { outline: 3px double rgba(143,47,43,.7); }
.teacher-class-mode .class-choice-card h3 { font-family: Rockwell, Georgia, serif; font-size: 21px; }
.teacher-class-mode .class-choice-card p { color: #5f4b2d; font-family: "Courier New", "Malgun Gothic", monospace; font-size: 12px; }
.teacher-class-mode .class-choice-card .danger { border: 2px solid rgba(110,37,33,.8); border-radius: 3px; background: transparent; color: #812a27; box-shadow: none; transform: rotate(-3deg); }
.teacher-class-mode .class-qr-box {
  position: relative;
  padding: 14px 14px 28px;
  border: 1px solid rgba(74,50,25,.45);
  border-radius: 2px;
  background: linear-gradient(145deg, #fff8df, #e8d29d);
  box-shadow: 5px 10px 0 rgba(14,10,7,.2), 0 18px 34px rgba(0,0,0,.46);
  transform: rotate(2deg);
}
.teacher-class-mode .class-qr-box::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: -15px;
  left: 50%;
  width: 18px;
  height: 42px;
  border: 3px solid #77746d;
  border-bottom: 0;
  border-radius: 11px 11px 3px 3px;
  box-shadow: inset 2px 0 #b9b5aa, 2px 3px 4px rgba(0,0,0,.3);
  transform: translateX(-50%) rotate(7deg);
}
.teacher-class-mode .class-qr-box::after {
  content: "STUDENT ACCESS";
  position: absolute;
  right: 8px;
  bottom: 7px;
  color: #6d4c2a;
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .08em;
}
.teacher-class-mode .class-qr-box img { border: 1px solid rgba(49,34,19,.22); border-radius: 0; background: white; filter: sepia(.14) contrast(1.18); }
.teacher-class-mode .class-qr-box span { color: #6d4c2a; font-family: "Courier New", monospace; }
.teacher-class-mode .class-qr-box .qr-zoom-btn { color: #6d4c2a; }

/* The data-entry desk continues the case-file visual system. */
body.teacher-entry-mode {
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 12%, rgba(197,157,80,.13), transparent 24rem),
    linear-gradient(rgba(180,149,91,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180,149,91,.05) 1px, transparent 1px),
    repeating-radial-gradient(ellipse at 40% 60%, rgba(255,255,255,.018) 0 1px, transparent 1px 5px),
    linear-gradient(120deg, #142433, #08131e 62%, #172633);
  background-size: auto, 32px 32px, 32px 32px, auto, auto;
}
.teacher-entry-mode .hero { margin-bottom: 22px; }
.teacher-entry-mode .hero-card { min-height: 250px; }
.teacher-entry-mode .case-status-panel { min-height: 250px; }
.teacher-entry-mode .teacher-entry-grid {
  grid-template-columns: minmax(250px, .72fr) minmax(390px, 1.35fr) minmax(280px, .88fr);
  column-gap: clamp(24px, 2.6vw, 38px);
  row-gap: 18px;
  align-items: stretch;
  padding-bottom: 96px;
}
.teacher-entry-mode .teacher-entry-grid > .panel {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 25px 20px 22px;
  overflow: visible;
  border: 1px solid rgba(70,48,22,.62);
  border-radius: 5px 15px 7px 12px;
  clip-path: polygon(0 .8%, 3% .1%, 7% .65%, 12% 0, 18% .55%, 25% .08%, 34% .7%, 43% .05%, 52% .5%, 61% 0, 69% .65%, 78% .08%, 87% .55%, 94% .05%, 100% .8%, 99.55% 12%, 100% 24%, 99.6% 37%, 100% 51%, 99.55% 64%, 100% 78%, 99.6% 90%, 100% 99.2%, 94% 99.65%, 87% 99.1%, 79% 100%, 70% 99.35%, 61% 100%, 52% 99.25%, 43% 100%, 34% 99.3%, 25% 100%, 17% 99.35%, 10% 100%, 4% 99.25%, 0 99.7%, .45% 88%, 0 75%, .5% 62%, 0 48%, .45% 34%, 0 20%);
  background:
    radial-gradient(ellipse at 12% 84%, rgba(92,48,20,.16), transparent 19%),
    radial-gradient(circle at 84% 15%, rgba(108,62,26,.13), transparent 8.5rem),
    repeating-linear-gradient(7deg, transparent 0 4px, rgba(77,49,20,.026) 5px, transparent 6px 11px),
    repeating-linear-gradient(94deg, rgba(255,247,213,.035) 0 1px, transparent 1px 7px),
    linear-gradient(145deg, #eddbad 0%, #d6bb80 52%, #c7a668 100%);
  color: #282117;
  box-shadow: inset 0 0 34px rgba(80,50,18,.23);
  filter: drop-shadow(7px 12px 11px rgba(0,0,0,.42));
  backdrop-filter: none;
}
.teacher-entry-mode .teacher-entry-grid > .panel::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 66px;
  height: 17px;
  border: 1px solid rgba(91,67,31,.2);
  background: rgba(221,202,158,.72);
  box-shadow: 0 2px 4px rgba(0,0,0,.12);
  transform: translateX(-50%) rotate(-2deg);
}
.teacher-entry-mode .teacher-entry-grid > .panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 22%, transparent 0 24px, rgba(95,51,21,.055) 25px 27px, transparent 29px),
    radial-gradient(ellipse at 75% 76%, rgba(91,48,18,.07), transparent 13%),
    repeating-linear-gradient(12deg, transparent 0 17px, rgba(72,42,17,.028) 18px, transparent 19px 31px);
  mix-blend-mode: multiply;
}
.teacher-entry-mode .teacher-entry-grid > .panel > * { position: relative; z-index: 1; }
.teacher-entry-mode .evidence-control-panel { padding-left: 43px; }
.teacher-entry-mode .evidence-topics-panel {
  z-index: 2;
  overflow: visible;
  clip-path: none;
  padding-bottom: 34px;
}
.teacher-entry-mode .teacher-entry-grid > .panel:nth-child(2) { transform: rotate(.18deg); }
.teacher-entry-mode .teacher-entry-grid > .panel:nth-child(3) { transform: rotate(-.18deg); }
.teacher-entry-mode .teacher-entry-grid h2 {
  margin-bottom: 16px;
  color: #282117;
  font-family: "Courier New", "Malgun Gothic", monospace;
  font-size: clamp(20px, 2vw, 27px);
  letter-spacing: -.045em;
  text-shadow: 0 1px rgba(255,255,255,.42);
}
.teacher-entry-mode .teacher-entry-grid .case-label { color: #765224; }
.teacher-entry-mode .compact-topic-form,
.teacher-entry-mode .topic-set-tools,
.teacher-entry-mode .teacher-entry-grid label,
.teacher-entry-mode .teacher-entry-grid input,
.teacher-entry-mode .teacher-entry-grid select,
.teacher-entry-mode .teacher-entry-grid button { font-family: "Courier New", "Malgun Gothic", monospace; }
.teacher-entry-mode .teacher-entry-grid label { color: #503b23; }
.teacher-entry-mode .teacher-entry-grid input,
.teacher-entry-mode .teacher-entry-grid select {
  border: 0;
  border-bottom: 2px solid rgba(75,51,25,.55);
  border-radius: 2px;
  background: rgba(249,235,199,.38);
  color: #231c13;
  box-shadow: inset 0 5px 13px rgba(77,48,17,.07);
}
.teacher-entry-mode .teacher-entry-grid input::placeholder { color: rgba(72,54,31,.68); }
.teacher-entry-mode .teacher-entry-grid input:focus,
.teacher-entry-mode .teacher-entry-grid select:focus { border-color: #922c27; box-shadow: 0 3px rgba(143,47,43,.18); }
.teacher-entry-mode .topic-set-tools { margin-top: 3px; border-top: 1px dashed rgba(77,49,21,.42); }
.teacher-entry-mode .evidence-add-button {
  border: 2px double #641915;
  border-radius: 4px;
  background: linear-gradient(145deg, #e25248, #aa2722 58%, #761713);
  color: #fff0cf;
  letter-spacing: .08em;
  text-shadow: 0 1px #3e0d0b;
  box-shadow: inset 0 1px rgba(255,255,255,.22), inset 0 -4px rgba(61,13,11,.3), 0 8px 15px rgba(87,27,20,.3);
}
.teacher-entry-mode .evidence-metal-button,
.teacher-entry-mode .start-game-small {
  border: 1px solid #5f451d;
  border-radius: 4px;
  background: linear-gradient(180deg, #d8b55f, #92702d 52%, #6c4d1c);
  color: #20170c;
  text-shadow: 0 1px rgba(255,244,194,.48);
  box-shadow: inset 0 2px rgba(255,255,255,.34), inset 0 -3px rgba(54,35,12,.32), 0 6px 11px rgba(52,34,15,.24);
}
.teacher-entry-mode .start-game-small {
  border-color: #d4ac58;
  background: linear-gradient(180deg, #edcc75, #b88b37 48%, #76501a);
  box-shadow: inset 0 2px rgba(255,255,255,.5), inset 0 -4px rgba(54,35,12,.38), 0 0 0 2px rgba(85,53,15,.22), 0 8px 17px rgba(53,31,10,.36);
}
.teacher-entry-mode .evidence-delete-button,
.teacher-entry-mode .teacher-topic-row button {
  border: 1px solid rgba(100,30,26,.72);
  border-radius: 3px;
  background: rgba(138,38,33,.08);
  color: #852722;
  box-shadow: none;
}
.teacher-entry-mode .teacher-topic-row {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 7px;
  padding: 15px 12px 11px;
  border: 1px solid rgba(71,48,22,.52);
  border-radius: 3px 9px 5px 6px;
  background:
    linear-gradient(90deg, rgba(77,46,18,.065) 1px, transparent 1px),
    linear-gradient(154deg, #e5cc93, #c3a263);
  background-size: 22px 100%, auto;
  color: #2c2114;
  box-shadow: inset 0 0 13px rgba(75,45,14,.12), 3px 5px 9px rgba(66,41,17,.17);
}
.teacher-entry-mode .teacher-topic-row::before {
  content: "CASE EVIDENCE";
  position: absolute;
  top: -10px;
  left: 11px;
  padding: 3px 9px;
  border: 1px solid rgba(74,49,20,.32);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: #b48a48;
  color: #342514;
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .09em;
}
.teacher-entry-mode .teacher-topic-row .tiny { color: #624c2d; }
.teacher-entry-mode .mini-select { min-width: 104px; border: 1px solid #6d5526; background: linear-gradient(#d9bc73, #9e7934); font-weight: 900; }
.teacher-entry-mode .roster-team {
  border: 1px solid rgba(75,48,21,.48);
  border-radius: 3px 10px 5px 7px;
  background: rgba(246,225,178,.35);
  box-shadow: inset 0 0 12px rgba(72,42,14,.08);
}
.teacher-entry-mode .roster-team summary { color: #4c351e; font-family: "Courier New", "Malgun Gothic", monospace; }
.teacher-entry-mode .roster-team summary::before,
.teacher-entry-mode .roster-team[open] summary::before {
  content: "";
  flex: 0 0 8px;
  width: 8px;
  height: 19px;
  border: 1px solid #634414;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(90deg, #72501b, #e4c36e 42%, #8c641f 82%);
  box-shadow: inset 0 -4px rgba(74,44,10,.45), 1px 2px 2px rgba(58,36,12,.25);
  transform: rotate(36deg);
}
.teacher-entry-mode .roster-chip {
  position: relative;
  overflow: hidden;
  padding: 9px 8px 9px 34px;
  border: 0;
  border-top: 1px dashed rgba(83,52,24,.34);
  border-radius: 0;
  background: transparent;
  color: #352719;
  font-family: "Courier New", "Malgun Gothic", monospace;
}
.teacher-entry-mode .roster-chip::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 20px;
  height: 10px;
  border-left: 2px solid #5b3a10;
  border-radius: 2px 7px 7px 2px;
  clip-path: polygon(0 9%, 67% 9%, 82% 20%, 100% 50%, 82% 80%, 67% 91%, 0 91%);
  background:
    linear-gradient(180deg, rgba(255,248,185,.82) 0 10%, transparent 28% 64%, rgba(63,35,8,.48) 88% 100%),
    linear-gradient(90deg, #694512 0 8%, #f0ce69 9% 15%, #8a5d18 16% 22%, #c79535 23% 65%, #f4d87b 66% 75%, #a27024 76% 86%, #5f3a0f 100%);
  box-shadow: inset 0 1px rgba(255,244,171,.72), inset 0 -1px rgba(57,32,7,.55);
  filter: drop-shadow(1px 1px 0 rgba(255,235,154,.18)) drop-shadow(1px 2px 1px rgba(47,27,8,.38));
  transform: translateY(-50%) rotate(-9deg);
}
.teacher-entry-mode .empty { border-color: rgba(74,49,22,.38); color: #6a5130; }

.teacher-entry-mode .desk-prop { position: absolute !important; z-index: 2 !important; display: block; pointer-events: none; }
.teacher-entry-mode .vintage-pen {
  left: 12px;
  top: 76px;
  width: 11px;
  height: 178px;
  border: 1px solid #5f4015;
  border-radius: 45% 45% 3px 3px;
  background: linear-gradient(90deg, #6d4915, #efd27b 28%, #a77928 64%, #513311);
  box-shadow: inset 2px 0 rgba(255,241,171,.38), 3px 5px 7px rgba(49,29,9,.35);
  transform: rotate(3deg);
}
.teacher-entry-mode .vintage-pen::before {
  content: "";
  position: absolute;
  left: -3px;
  top: -17px;
  width: 15px;
  height: 24px;
  clip-path: polygon(50% 0, 100% 62%, 72% 100%, 28% 100%, 0 62%);
  background: linear-gradient(90deg, #684612, #e7c76e 48%, #735018);
}
.teacher-entry-mode .vintage-pen::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: -15px;
  border: 4px solid transparent;
  border-top: 15px solid #7d571c;
}
.teacher-entry-mode .magnifier {
  right: 43px;
  bottom: -40px;
  width: 61px;
  height: 61px;
  border: 7px solid #9b7027;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 31% 23%, rgba(255,255,255,.84) 0 7%, rgba(255,255,255,.14) 8% 20%, transparent 21%),
    radial-gradient(circle at 43% 40%, rgba(187,220,216,.34), rgba(78,111,112,.17) 58%, rgba(24,35,35,.35) 100%);
  box-shadow:
    inset 0 0 0 2px #e1bf67,
    inset 0 0 0 4px rgba(67,42,12,.62),
    inset -5px -6px 10px rgba(18,28,28,.34),
    inset 5px 4px 8px rgba(240,255,246,.2),
    2px 3px 2px rgba(30,18,7,.34);
  filter: drop-shadow(5px 9px 7px rgba(0,0,0,.42)) drop-shadow(0 14px 12px rgba(0,0,0,.2));
  transform: rotate(-14deg);
}
.teacher-entry-mode .magnifier::before {
  content: "";
  position: absolute;
  inset: 7px 10px 24px 8px;
  border-top: 2px solid rgba(255,255,255,.72);
  border-radius: 50%;
  transform: rotate(-18deg);
}
.teacher-entry-mode .magnifier::after {
  content: "";
  position: absolute;
  right: -38px;
  bottom: -15px;
  width: 45px;
  height: 13px;
  border: 2px solid #3d260d;
  border-radius: 2px 9px 9px 2px;
  background:
    linear-gradient(180deg, rgba(255,222,137,.4), transparent 25% 65%, rgba(0,0,0,.3)),
    linear-gradient(90deg, #a27a32 0 8%, #4a2b13 9% 68%, #28140b 69% 83%, #875421 84%);
  box-shadow: inset 0 1px rgba(255,236,177,.24), 1px 3px 2px rgba(35,20,8,.35);
  transform: rotate(44deg);
  transform-origin: left center;
}
.teacher-entry-mode .skeleton-key {
  right: 151px;
  bottom: -22px;
  width: 83px;
  height: 10px;
  border: 1px solid #604213;
  border-radius: 5px;
  background:
    linear-gradient(180deg, #fff0a1 0 8%, #d5a845 18% 47%, #8a5c18 55% 78%, #51320e 100%),
    linear-gradient(90deg, transparent, rgba(255,255,255,.4));
  box-shadow: inset 0 1px rgba(255,246,177,.72), inset 0 -2px rgba(59,34,8,.45), 1px 2px 1px rgba(45,26,7,.32);
  filter: drop-shadow(5px 8px 5px rgba(0,0,0,.42)) drop-shadow(0 12px 10px rgba(0,0,0,.18));
  transform: rotate(9deg);
}
.teacher-entry-mode .skeleton-key::before {
  content: "";
  position: absolute;
  left: -29px;
  top: -13px;
  width: 29px;
  height: 29px;
  border: 6px double #ae8231;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 27%, rgba(255,238,147,.32), transparent 35%);
  box-shadow: inset 2px 2px 2px rgba(255,238,153,.32), inset -3px -3px 3px rgba(71,42,10,.36);
}
.teacher-entry-mode .skeleton-key::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: -12px;
  width: 20px;
  height: 14px;
  border-right: 6px solid #72501a;
  border-bottom: 6px solid #72501a;
  box-shadow: -12px 5px 0 -5px #8c6724, inset -1px -1px rgba(48,28,7,.32);
}

/* The game board uses the same leather desk and weathered case-file materials. */
body.teacher-game-mode {
  --detective-navy: #111923;
  --detective-navy-soft: #1d2935;
  --detective-paper: #d7bd85;
  --detective-paper-light: #ead8ad;
  --detective-ink: #272116;
  --detective-red: #9f2722;
  --detective-brass: #b5893d;
  color: var(--detective-ink);
  font-family: Georgia, "Times New Roman", "Malgun Gothic", serif;
  background:
    radial-gradient(ellipse at 50% -12%, rgba(81,106,127,.24), transparent 54%),
    radial-gradient(circle at 17% 76%, rgba(0,0,0,.4), transparent 32rem),
    repeating-radial-gradient(ellipse at 32% 28%, rgba(255,255,255,.018) 0 1px, transparent 1px 5px),
    linear-gradient(128deg, #142332 0%, #09131e 58%, #111e2a 100%);
  background-attachment: fixed;
}
body.teacher-game-mode::before {
  z-index: 0;
  opacity: .36;
  background-image:
    linear-gradient(rgba(175,197,211,.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(175,197,211,.09) 1px, transparent 1px),
    repeating-linear-gradient(97deg, transparent 0 13px, rgba(255,255,255,.025) 14px, transparent 16px 31px);
  background-size: 34px 34px, 34px 34px, 100% 100%;
  mask-image: radial-gradient(ellipse at center, #000 34%, rgba(0,0,0,.4) 78%, transparent 100%);
}
body.teacher-game-mode::after {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 12px;
  border: 1px solid rgba(193,154,82,.22);
  border-radius: 18px;
  pointer-events: none;
  box-shadow: inset 0 0 0 4px rgba(0,0,0,.22), inset 0 0 0 6px rgba(217,182,113,.07), inset 0 0 46px rgba(0,0,0,.62), 0 8px 25px rgba(0,0,0,.45);
}
.teacher-game-mode .wrap { position: relative; z-index: 1; width: min(1240px, calc(100% - 32px)); padding-top: 34px; padding-bottom: 112px; }
.teacher-game-mode .made-by {
  border: 1px solid #6f5427;
  border-radius: 4px;
  background: linear-gradient(#b08b45, #72501f);
  color: #17130c;
  font-family: "Courier New", monospace;
  letter-spacing: .08em;
  box-shadow: inset 0 1px rgba(255,255,255,.3), 0 8px 20px rgba(0,0,0,.35);
}
.teacher-game-mode .hero { grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 20px; }
.teacher-game-mode .hero-card {
  border: 1px solid rgba(201,168,99,.35);
  border-radius: 10px 24px 12px 18px;
  background: linear-gradient(96deg, transparent 0 5%, rgba(255,255,255,.035) 5.2% 5.6%, transparent 5.8%), linear-gradient(145deg, var(--detective-navy-soft), var(--detective-navy));
  color: #f2e4bf;
  box-shadow: inset 0 0 0 5px rgba(0,0,0,.15), 0 30px 70px rgba(0,0,0,.42);
}
.teacher-game-mode .hero-card::before,
.teacher-game-mode .hero-card::after { display: none; }
.teacher-game-mode .hero-card h1 {
  color: #f1dfb6;
  font-family: "Courier New", "Malgun Gothic", monospace;
  font-size: clamp(40px, 6.4vw, 78px);
  letter-spacing: -.075em;
  text-shadow: 0 3px #000, 0 0 24px rgba(210,171,87,.18);
}
.teacher-game-mode .hero-card .eyebrow,
.teacher-game-mode .case-label { color: #c99b4b; font-family: "Courier New", monospace; font-weight: 900; letter-spacing: .16em; }
.teacher-game-mode #heroText { position: relative; z-index: 1; color: #f2e4bf; font-family: "Courier New", "Malgun Gothic", monospace; text-shadow: 0 1px 2px rgba(0,0,0,.75); }
.teacher-game-mode .case-status-panel,
.teacher-game-mode .game-console > .panel {
  position: relative;
  overflow: visible;
  border: 1px solid rgba(74,52,25,.62);
  border-radius: 7px 18px 9px 14px;
  background:
    radial-gradient(circle at 84% 15%, rgba(108,62,26,.13), transparent 9rem),
    repeating-linear-gradient(7deg, transparent 0 4px, rgba(77,49,20,.026) 5px, transparent 6px 11px),
    repeating-linear-gradient(94deg, rgba(255,247,213,.035) 0 1px, transparent 1px 7px),
    linear-gradient(145deg, #ead8ad, #cfb477);
  color: #282117;
  box-shadow: inset 0 0 30px rgba(80,50,18,.2);
  filter: drop-shadow(8px 15px 13px rgba(0,0,0,.42));
  backdrop-filter: none;
}
.teacher-game-mode .game-console > .panel::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 17% 21%, transparent 0 25px, rgba(91,48,19,.055) 26px 28px, transparent 30px),
    radial-gradient(ellipse at 74% 79%, rgba(82,43,17,.065), transparent 15%),
    repeating-linear-gradient(13deg, transparent 0 18px, rgba(73,43,17,.026) 19px, transparent 20px 33px);
  mix-blend-mode: multiply;
}
.teacher-game-mode .game-console > .panel > * { position: relative; z-index: 1; }
.teacher-game-mode .case-status-panel { padding: 30px 22px 22px; transform: rotate(.6deg); }
.teacher-game-mode .case-status-panel .case-label { color: #664922; }
.teacher-game-mode .case-status-panel h2 { font-family: Rockwell, Georgia, serif; color: #252018; }
.teacher-game-mode .case-status-panel .pill { border: 1px solid rgba(86,49,26,.26); background: rgba(112,64,35,.1); color: #633d25; }
.teacher-game-mode .class-qr-box {
  position: relative;
  padding: 14px 14px 28px;
  border: 1px solid rgba(74,50,25,.45);
  border-radius: 2px;
  background: linear-gradient(145deg, #fff8df, #e8d29d);
  box-shadow: 5px 10px 0 rgba(14,10,7,.2), 0 18px 34px rgba(0,0,0,.46);
  transform: rotate(2deg);
}
.teacher-game-mode .class-qr-box::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: -15px;
  left: 50%;
  width: 18px;
  height: 42px;
  border: 3px solid #77746d;
  border-bottom: 0;
  border-radius: 11px 11px 3px 3px;
  box-shadow: inset 2px 0 #b9b5aa, 2px 3px 4px rgba(0,0,0,.3);
  transform: translateX(-50%) rotate(7deg);
}
.teacher-game-mode .class-qr-box::after { content: "STUDENT ACCESS"; position: absolute; right: 8px; bottom: 7px; color: #6d4c2a; font: 900 9px/1 "Courier New", monospace; letter-spacing: .08em; }
.teacher-game-mode .class-qr-box img { border: 1px solid rgba(49,34,19,.22); border-radius: 0; filter: sepia(.14) contrast(1.18); }
.teacher-game-mode .class-qr-box span,
.teacher-game-mode .class-qr-box .qr-zoom-btn { color: #6d4c2a; font-family: "Courier New", monospace; }
.teacher-game-mode #navButtons button,
.teacher-game-mode #navButtons .guide-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b28a45;
  border-radius: 7px;
  background: radial-gradient(circle at 14% 22%, rgba(255,255,255,.12) 0 1px, transparent 2px), linear-gradient(145deg, #4b261e, #24120f 70%);
  color: #fff0c8;
  font-family: "Courier New", "Malgun Gothic", monospace;
  text-shadow: 0 1px #2c1311;
  box-shadow: inset 0 0 0 2px #130b09, inset 0 0 0 3px rgba(221,183,105,.48), 0 7px 12px rgba(0,0,0,.35);
}
.teacher-class-mode #navButtons .guide-tab,
.teacher-game-mode #navButtons .guide-tab { padding: 12px 17px; text-decoration: none; }
.teacher-game-mode #navButtons .nav-tab.active {
  border-color: #ffe4a0;
  background: linear-gradient(145deg, #ffe7ad, #c99638);
  color: #27190d;
  text-shadow: 0 1px rgba(255,255,255,.62);
  box-shadow: inset 0 1px rgba(255,255,255,.8), 0 0 0 2px rgba(238,205,126,.3), 0 0 24px 5px rgba(242,199,102,.56);
  transform: translateY(-2px);
}
.teacher-game-mode #navButtons .pill { border: 1px dashed rgba(207,171,92,.45); background: rgba(220,188,119,.08); color: #d5b66e; font-family: "Courier New", monospace; }
.teacher-game-mode .game-console { grid-template-columns: minmax(0, 1fr) minmax(330px, 390px); column-gap: clamp(38px, 4.4vw, 58px); row-gap: 18px; align-items: stretch; padding: 0 104px 112px 0; }
.teacher-game-mode .game-main { min-height: 550px; place-items: center; padding: 58px 42px; isolation: isolate; }
.teacher-game-mode .mega-random {
  position: relative;
  z-index: 3;
  align-self: center;
  justify-self: center;
  margin: 0;
  width: min(540px, 88%);
  min-height: 244px;
  border: 14px solid #725524;
  border-radius: 50%;
  padding: 42px 58px;
  background:
    radial-gradient(ellipse at 42% 28%, rgba(255,225,174,.38) 0 5%, transparent 18%),
    repeating-radial-gradient(circle at 50% 54%, transparent 0 23px, rgba(74,14,11,.16) 24px 25px),
    radial-gradient(circle at 50% 42%, #d74e43 0 18%, #a92e27 48%, #711914 72%, #350c09 100%);
  color: #fff0c8;
  font: 900 clamp(35px, 5.4vw, 68px)/1.05 "Courier New", "Malgun Gothic", monospace;
  letter-spacing: -.07em;
  text-shadow: 0 3px #4c0d0a, 0 -1px rgba(255,255,255,.2);
  box-shadow:
    inset 0 0 0 3px #e2bd68,
    inset 0 0 0 9px #3f2a0e,
    inset 0 18px 18px rgba(255,255,255,.14),
    inset 0 -21px 24px rgba(35,7,5,.5),
    0 13px 0 #3e290f,
    0 19px 0 #1e1409,
    0 36px 40px rgba(26,15,5,.58);
  transform: none;
  transition: transform .1s ease, box-shadow .1s ease, filter .15s ease;
}
.teacher-game-mode .mega-random > span {
  display: block;
  white-space: nowrap;
  text-align: center;
}
.teacher-game-mode .mega-random > span + span { margin-top: .02em; }
.teacher-game-mode .mega-random::before {
  content: "CASE ROULETTE";
  position: absolute;
  left: 50%;
  bottom: 24px;
  color: rgba(255,222,177,.42);
  font: 900 11px/1 "Courier New", monospace;
  letter-spacing: .28em;
  transform: translateX(-50%);
}
.teacher-game-mode .mega-random:hover { filter: brightness(1.08) saturate(1.08); }
.teacher-game-mode .mega-random:active {
  transform: translateY(8px) scale(.985) rotate(-1deg);
  box-shadow: inset 0 0 0 3px #d7a94d, inset 0 0 0 9px #3f2a0e, inset 0 23px 25px rgba(40,7,5,.26), inset 0 -8px 15px rgba(255,255,255,.08), 0 4px 0 #332109, 0 8px 0 #1b1107, 0 15px 20px rgba(26,15,5,.45);
  animation: evidenceDial .38s ease-out;
}
.teacher-game-mode .mega-random:focus-visible { outline: 4px solid #fff0a7; outline-offset: 9px; box-shadow: inset 0 0 0 3px #e2bd68, inset 0 0 0 9px #3f2a0e, 0 13px 0 #3e290f, 0 19px 0 #1e1409, 0 0 0 15px rgba(218,176,86,.22), 0 36px 40px rgba(26,15,5,.58); }
.teacher-game-mode .game-side { padding: 30px 24px 35px; gap: 14px; z-index: 1; }
.teacher-game-mode .game-side h2 { font: 900 25px/1.15 "Courier New", "Malgun Gothic", monospace; color: #2c2114; }
.teacher-game-mode .game-side h2 span { display: block; margin-top: 5px; color: #785526; font-size: 11px; letter-spacing: .16em; }
.teacher-game-mode #scoreboard { gap: 10px; }
.teacher-game-mode #scoreboard .score-card.score-row {
  position: relative;
  min-height: 62px;
  grid-template-columns: minmax(0, 1fr) 72px;
  border: 2px solid #6e4c20;
  border-radius: 9px;
  padding: 11px 16px 11px 25px;
  background:
    radial-gradient(circle at 8px 8px, #e2c174 0 2px, #674719 3px, transparent 4px),
    radial-gradient(circle at calc(100% - 8px) calc(100% - 8px), #e2c174 0 2px, #674719 3px, transparent 4px),
    repeating-linear-gradient(98deg, rgba(255,255,255,.025) 0 2px, transparent 3px 7px),
    linear-gradient(145deg, #503025, #231612 70%);
  color: #f5e1b1;
  box-shadow: inset 0 0 0 3px rgba(19,10,8,.58), inset 0 1px 8px rgba(255,255,255,.08), inset 0 -7px 10px rgba(0,0,0,.25), 3px 6px 9px rgba(58,35,13,.26);
}
.teacher-game-mode #scoreboard .score-row b { overflow-wrap: anywhere; font: 900 17px/1.2 "Courier New", "Malgun Gothic", monospace; text-shadow: 0 1px #000; }
.teacher-game-mode #scoreboard .score-row span { min-width: 56px; padding: 7px 4px; border: 1px inset #b99142; border-radius: 5px; background: #c7a85f; color: #291b0c; font: 900 29px/1 Georgia, serif; text-shadow: 0 1px rgba(255,255,255,.45); box-shadow: inset 0 2px 4px rgba(68,41,10,.35); }
.teacher-game-mode #scoreboard .empty { border-color: rgba(83,55,24,.45); color: #674d2c; }
.teacher-game-mode #resetScoreBtn,
.teacher-game-mode #endGameBtn { width: 100%; border-radius: 7px; font-family: "Courier New", "Malgun Gothic", monospace; letter-spacing: .04em; }
.teacher-game-mode #resetScoreBtn {
  border: 2px solid #604315;
  background: linear-gradient(180deg, #f2d780, #b78934 52%, #705019);
  color: #271a0b;
  text-shadow: 0 1px rgba(255,248,199,.62);
  box-shadow: inset 0 2px rgba(255,255,255,.48), inset 0 -5px rgba(55,34,9,.38), 0 5px 0 #49320f, 0 9px 13px rgba(55,34,11,.3);
}
.teacher-game-mode #endGameBtn {
  border: 2px solid #651712;
  background: radial-gradient(ellipse at 35% 20%, rgba(255,221,190,.2), transparent 31%), linear-gradient(145deg, #c8483f, #8d211c 62%, #5b120f);
  color: #fff0ce;
  text-shadow: 0 2px #4a0c09;
  box-shadow: inset 0 0 0 3px rgba(67,12,9,.25), inset 0 2px rgba(255,255,255,.19), inset 0 -5px rgba(53,8,6,.4), 0 5px 0 #4f110d, 0 9px 13px rgba(55,17,11,.34);
}
.teacher-game-mode #resetScoreBtn:active,
.teacher-game-mode #endGameBtn:active { transform: translateY(4px); box-shadow: inset 0 3px 7px rgba(42,20,7,.35), 0 1px 0 #49320f, 0 4px 7px rgba(55,34,11,.24); }
.teacher-game-mode #resetScoreBtn:focus-visible,
.teacher-game-mode #endGameBtn:focus-visible { outline: 3px solid #fff0a7; outline-offset: 4px; }
.teacher-game-mode .status-details {
  border: 1px solid rgba(75,45,20,.68);
  border-radius: 7px 12px 7px 9px;
  padding: 0 10px 11px;
  background: linear-gradient(145deg, rgba(221,195,139,.68), rgba(177,139,77,.46));
  box-shadow: inset 0 0 13px rgba(72,42,14,.18), 3px 6px 9px rgba(61,36,13,.2);
}
.teacher-game-mode .status-details summary {
  position: relative;
  min-height: 52px;
  margin: -1px -11px 0;
  padding: 16px 46px 15px 34px;
  border: 1px solid #4a281c;
  border-radius: 7px 11px 6px 8px;
  background:
    radial-gradient(circle at 13px 13px, #f2d47d 0 2px, #76501b 3px, transparent 4px),
    radial-gradient(circle at calc(100% - 13px) calc(100% - 13px), #d6ae55 0 2px, #563514 3px, transparent 4px),
    repeating-linear-gradient(96deg, rgba(255,255,255,.035) 0 1px, transparent 2px 7px),
    linear-gradient(145deg, #63372b, #351d18 58%, #21120f);
  color: #ffeac0;
  font: 900 15px/1.3 "Courier New", "Malgun Gothic", monospace;
  text-shadow: 0 1px 1px #120907;
  box-shadow: inset 0 0 0 3px rgba(20,9,7,.45), inset 0 2px 4px rgba(255,255,255,.08), inset 0 -6px 8px rgba(0,0,0,.3), 0 5px 0 #25130f, 0 9px 13px rgba(46,24,12,.32);
  list-style: none;
  transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
}
.teacher-game-mode .status-details summary::-webkit-details-marker { display: none; }
.teacher-game-mode .status-details summary::before { content: ""; position: absolute; left: 14px; top: 50%; width: 10px; height: 10px; border: 1px solid #54350f; border-radius: 50%; background: radial-gradient(circle at 36% 30%, #fff0a8 0 14%, #be8f35 31%, #644315 72%); box-shadow: inset 0 -2px 2px rgba(53,31,8,.5), 1px 2px 2px rgba(14,7,4,.5); transform: translateY(-50%); }
.teacher-game-mode .status-details summary::after { content: "+"; position: absolute; right: 15px; top: 50%; color: #f2cf78; font-size: 25px; text-shadow: 0 1px #130807; transform: translateY(-50%); }
.teacher-game-mode .status-details summary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.teacher-game-mode .status-details[open] summary { margin-bottom: 10px; background: repeating-linear-gradient(96deg, rgba(255,255,255,.035) 0 1px, transparent 2px 7px), linear-gradient(145deg, #734034, #3d201b 58%, #271411); box-shadow: inset 0 0 0 3px rgba(20,9,7,.4), inset 0 2px 5px rgba(255,255,255,.08), inset 0 -4px 7px rgba(0,0,0,.28), 0 3px 0 #25130f, 0 6px 10px rgba(46,24,12,.27); transform: translateY(2px); }
.teacher-game-mode .status-details[open] summary::after { content: "−"; }
.teacher-game-mode .status-details summary:focus-visible { outline: 3px solid #fff0a7; outline-offset: 4px; border-radius: 7px; box-shadow: inset 0 0 0 3px rgba(20,9,7,.45), 0 5px 0 #25130f, 0 0 0 8px rgba(128,83,30,.25), 0 9px 13px rgba(46,24,12,.32); }
.teacher-game-mode .status-details .list-item { border-color: rgba(78,50,21,.3); color: #45321d; }
.teacher-game-mode .game-prop { position: absolute; z-index: 4; display: block; pointer-events: none; }
.teacher-game-mode .field-stopwatch {
  left: 28px;
  bottom: -84px;
  width: 79px;
  height: 79px;
  border: 8px double #a47a2d;
  border-radius: 50%;
  background: repeating-conic-gradient(from -2deg, #5b431d 0 1deg, transparent 1deg 15deg), radial-gradient(circle, #e5d19b 0 47%, #77561f 48% 53%, #b58a38 54%);
  box-shadow: inset 0 0 0 3px #3f2b0f, inset 0 0 13px rgba(46,31,13,.45), 3px 4px 2px rgba(38,22,8,.3);
  filter: drop-shadow(2px 4px 2px rgba(0,0,0,.36)) drop-shadow(8px 17px 12px rgba(0,0,0,.42));
  transform: rotate(-10deg);
}
.teacher-game-mode .field-stopwatch::before { content: ""; position: absolute; left: 50%; top: -24px; width: 26px; height: 18px; border: 5px solid #8d6724; border-radius: 8px 8px 2px 2px; background: #caa34c; transform: translateX(-50%); }
.teacher-game-mode .field-stopwatch::after { content: ""; position: absolute; left: 50%; top: 50%; width: 2px; height: 27px; background: #7e2923; box-shadow: 1px 0 rgba(255,255,255,.28); transform: translate(-50%,-92%) rotate(23deg); transform-origin: center bottom; }
.teacher-game-mode .fingerprint-file {
  right: 28px;
  bottom: -78px;
  width: 116px;
  height: 82px;
  border: 1px solid #67471e;
  background: linear-gradient(10deg, transparent 69%, rgba(92,52,21,.12) 70%), linear-gradient(145deg, #e3cd98, #b99757);
  box-shadow: inset 0 0 16px rgba(72,43,14,.14), 2px 4px 2px rgba(30,17,6,.3), 9px 18px 15px rgba(0,0,0,.34);
  transform: rotate(7deg);
}
.teacher-game-mode .fingerprint-file::before { content: ""; position: absolute; left: 17px; top: 13px; width: 47px; height: 55px; border-radius: 50%; background: repeating-radial-gradient(ellipse at 50% 58%, transparent 0 3px, rgba(104,39,32,.54) 4px 5px); opacity: .72; transform: rotate(-8deg); }
.teacher-game-mode .fingerprint-file::after { content: "PRINT / 07"; position: absolute; right: 8px; bottom: 8px; color: #714b28; font: 900 8px/1 "Courier New", monospace; letter-spacing: .08em; }
.teacher-game-mode .game-magnifier {
  right: -55px;
  bottom: -73px;
  width: 58px;
  height: 58px;
  border: 7px solid #9b7027;
  border-radius: 50%;
  background: radial-gradient(ellipse at 31% 23%, rgba(255,255,255,.84) 0 7%, transparent 20%), radial-gradient(circle at 43% 40%, rgba(187,220,216,.34), rgba(78,111,112,.17) 58%, rgba(24,35,35,.35));
  box-shadow: inset 0 0 0 2px #e1bf67, inset 0 0 0 4px rgba(67,42,12,.62), inset -5px -6px 10px rgba(18,28,28,.34);
  filter: drop-shadow(5px 10px 7px rgba(0,0,0,.5));
  transform: rotate(-20deg);
}
.teacher-game-mode .game-magnifier::after { content: ""; position: absolute; right: -37px; bottom: -14px; width: 44px; height: 13px; border: 2px solid #3d260d; border-radius: 2px 9px 9px 2px; background: linear-gradient(180deg, rgba(255,222,137,.4), transparent 25% 65%, rgba(0,0,0,.3)), linear-gradient(90deg, #a27a32 0 8%, #4a2b13 9% 70%, #28140b 71%); box-shadow: 1px 3px 2px rgba(35,20,8,.35); transform: rotate(44deg); transform-origin: left center; }

@keyframes evidenceDial { 0% { filter: brightness(1.1); } 45% { filter: brightness(.88) saturate(1.3); } 100% { filter: brightness(1); } }

@keyframes caseFileIn { from { opacity: 0; transform: translateY(18px) rotate(-1deg); } to { opacity: 1; } }

@keyframes resultPop { from { opacity: 0; transform: scale(.76) rotate(-1.5deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes shimmerSpin { to { transform: rotate(360deg); } }
@keyframes countPop { 0% { opacity: 0; transform: scale(.35) rotate(-12deg); } 28% { opacity: 1; transform: scale(1.14) rotate(4deg); } 100% { opacity: .88; transform: scale(.92); } }

@media (max-width: 780px) {
  .hero, .grid, .grid.three, .stat-grid { grid-template-columns: 1fr; }
  .class-card-grid { grid-template-columns: 1fr; }
  .hero-title-row { align-items: center; }
  .class-qr-box img { width: 82px; height: 82px; }
  .wrap { width: min(100% - 18px, 1180px); padding-top: 12px; }
  .hero-card, .panel { border-radius: 22px; padding: 16px; }
  .list-item { align-items: flex-start; flex-direction: column; }
  .student-class-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-hero, .inline-profile-form, .compact-topic-row, .compact-topic-list { grid-template-columns: 1fr; }
  .submit-actions { justify-content: stretch; }
  .submit-actions button { flex: 1; }
  .game-console { grid-template-columns: 1fr; }
  .student-game-grid { grid-template-columns: 1fr; }
  .student-game-mode .student-game-grid { grid-template-columns: 1fr; }
  .teacher-entry-grid { grid-template-columns: 1fr; }
  .teacher-topic-row { grid-template-columns: 1fr; }
  .prediction-bar { grid-template-columns: 1fr; }
  .student-game-mode .prediction-bar { grid-template-columns: 1fr; }
  .game-main { min-height: 300px; }
  .mega-random { min-height: 190px; }
  .roulette-controls { flex-direction: column; width: 100%; }
  .roulette-pause, .roulette-reveal { width: 100%; }
  .roulette-close { position: static; }
  .answer-hero { grid-template-columns: 1fr; }
  .made-by { top: 8px; right: 8px; }
  .teacher-class-mode .hero,
  .teacher-game-mode .hero,
  .teacher-class-mode .case-desk-grid { grid-template-columns: 1fr; }
  .teacher-class-mode .wrap,
  .teacher-game-mode .wrap { width: min(100% - 18px, 1240px); padding-top: 18px; }
  .teacher-class-mode .hero-card h1,
  .teacher-game-mode .hero-card h1 { font-size: clamp(38px, 12vw, 62px); }
  .teacher-class-mode .confidential-stamp { right: 13px; bottom: 11px; font-size: 10px; }
  .teacher-class-mode .class-qr-box,
  .teacher-game-mode .class-qr-box { padding: 10px 10px 24px; transform: rotate(1deg); }
  .teacher-class-mode .made-by,
  .teacher-game-mode .made-by { position: absolute; font-size: 9px; }
  .teacher-class-mode .case-status-panel,
  .teacher-game-mode .case-status-panel,
  .teacher-class-mode .case-intake-panel,
  .teacher-class-mode .case-archive-panel { transform: none; }
  .teacher-entry-mode .teacher-entry-grid { grid-template-columns: 1fr; }
  .teacher-entry-mode .teacher-entry-grid > .panel,
  .teacher-entry-mode .teacher-entry-grid > .panel:nth-child(2),
  .teacher-entry-mode .teacher-entry-grid > .panel:nth-child(3) { transform: none; }
  .teacher-entry-mode .evidence-control-panel { padding-left: 39px; }
  .teacher-entry-mode .teacher-entry-grid { row-gap: 18px; padding-bottom: 76px; }
  .teacher-entry-mode .evidence-topics-panel { margin-bottom: 82px; padding-bottom: 30px; }
  .teacher-entry-mode .vintage-pen { left: 10px; top: 68px; height: 148px; }
  .teacher-entry-mode .magnifier { right: 34px; bottom: -43px; transform: scale(.84) rotate(-14deg); transform-origin: center; }
  .teacher-entry-mode .skeleton-key { right: 137px; bottom: -21px; transform: scale(.84) rotate(9deg); transform-origin: right center; }
  .teacher-game-mode .game-console { grid-template-columns: 1fr; gap: 112px; padding: 0 0 96px; }
  .teacher-game-mode .game-main { min-height: 430px; padding: 78px 24px 55px; }
  .teacher-game-mode .mega-random { width: min(520px, 91%); min-height: 218px; padding: 38px 38px; }
  .teacher-game-mode .game-side { padding: 27px 20px 32px; }
  .teacher-game-mode .field-stopwatch { bottom: -82px; }
  .teacher-game-mode .fingerprint-file { right: 30px; bottom: -76px; }
  .teacher-game-mode .game-magnifier { left: auto; right: 27px; bottom: -72px; transform: scale(.85) rotate(-20deg); transform-origin: right center; }
}

@media (prefers-reduced-motion: reduce) {
  .teacher-class-mode .hero-card,
  .teacher-class-mode .case-status-panel,
  .teacher-game-mode .case-status-panel,
  .teacher-class-mode .case-intake-panel,
  .teacher-class-mode .case-archive-panel { animation: none; }
  .teacher-game-mode .mega-random,
  .teacher-game-mode .mega-random:active { animation: none; transition: none; }
}

@media (max-width: 460px) {
  .student-class-grid { grid-template-columns: 1fr; }
  .teacher-entry-mode .evidence-topics-panel { margin-bottom: 74px; }
  .teacher-entry-mode .magnifier { right: 22px; bottom: -40px; transform: scale(.72) rotate(-14deg); }
  .teacher-entry-mode .skeleton-key { right: 105px; bottom: -18px; transform: scale(.72) rotate(9deg); }
  .teacher-game-mode .wrap { padding-bottom: 84px; }
  .teacher-game-mode .game-console { gap: 91px; padding-bottom: 74px; }
  .teacher-game-mode .game-main { min-height: 350px; padding: 69px 14px 50px; }
  .teacher-game-mode .mega-random { width: 94%; min-height: 174px; border-width: 10px; padding: 31px 21px; font-size: clamp(30px, 10vw, 44px); box-shadow: inset 0 0 0 2px #e2bd68, inset 0 0 0 7px #3f2a0e, inset 0 13px 15px rgba(255,255,255,.14), inset 0 -16px 18px rgba(35,7,5,.5), 0 9px 0 #3e290f, 0 14px 0 #1e1409, 0 25px 28px rgba(26,15,5,.52); }
  .teacher-game-mode .field-stopwatch { left: 17px; bottom: -66px; transform: scale(.72) rotate(-10deg); transform-origin: left center; }
  .teacher-game-mode .fingerprint-file { right: 13px; bottom: -61px; transform: scale(.72) rotate(7deg); transform-origin: right center; }
  .teacher-game-mode .game-side h2 { font-size: 21px; }
  .teacher-game-mode #scoreboard .score-card.score-row { grid-template-columns: minmax(0, 1fr) 60px; padding-left: 18px; }
  .teacher-game-mode .game-magnifier { display: none; }
}

/* The topic draw uses a brass-trimmed field device with distinct spinning and selected states. */
.roulette-backdrop {
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(225, 184, 99, .2) 0 10%, rgba(17, 25, 34, .52) 38%, rgba(3, 6, 10, .94) 82%),
    repeating-radial-gradient(ellipse at center, transparent 0 7px, rgba(0, 0, 0, .08) 8px 9px),
    rgba(4, 8, 13, .88);
  backdrop-filter: blur(5px) saturate(.72);
}
.roulette-backdrop::before,
.roulette-backdrop::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.roulette-backdrop::before {
  z-index: 0;
  background: radial-gradient(ellipse at center, transparent 24%, rgba(0, 0, 0, .22) 58%, rgba(0, 0, 0, .72) 100%);
  box-shadow: inset 0 0 16vw 5vw rgba(0, 0, 0, .68);
}
.roulette-backdrop::after {
  z-index: 0;
  opacity: .22;
  background: repeating-linear-gradient(92deg, rgba(255,255,255,.025) 0 1px, transparent 2px 8px);
}
.roulette-backdrop .roulette-card {
  position: relative;
  z-index: 1;
  isolation: isolate;
  width: min(860px, 100%);
  min-height: 500px;
  grid-template-rows: auto auto minmax(170px, 1fr) auto auto;
  gap: 15px;
  overflow: hidden;
  border: 3px solid #b68a3d;
  border-radius: 22px;
  padding: 42px 54px 52px;
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.055) 0 1px, transparent 2px),
    repeating-linear-gradient(98deg, rgba(255,255,255,.018) 0 2px, transparent 3px 8px),
    linear-gradient(145deg, #202d3a 0%, #111923 54%, #0a1018 100%);
  color: #f4e3b8;
  box-shadow:
    inset 0 0 0 2px #090e14,
    inset 0 0 0 5px rgba(218, 179, 91, .35),
    inset 0 15px 28px rgba(255,255,255,.035),
    inset 0 -28px 45px rgba(0,0,0,.42),
    0 32px 90px rgba(0,0,0,.72),
    0 0 58px rgba(205, 158, 67, .14);
}
.roulette-backdrop .roulette-card::before {
  content: "";
  position: absolute;
  inset: 13px;
  z-index: -1;
  border: 1px solid rgba(226, 188, 105, .42);
  border-radius: 12px;
  background:
    radial-gradient(circle at 20% 24%, rgba(255,255,255,.025), transparent 25%),
    linear-gradient(115deg, transparent 0 44%, rgba(255,255,255,.025) 45%, transparent 46% 100%);
  box-shadow: inset 0 0 28px rgba(0,0,0,.46), 0 0 0 4px rgba(4,7,10,.42);
  pointer-events: none;
}
.roulette-backdrop .roulette-card::after {
  content: "CASE DEVICE · 042";
  position: absolute;
  left: 24px;
  bottom: 17px;
  color: rgba(211, 178, 102, .38);
  font: 700 9px/1 "Courier New", monospace;
  letter-spacing: .18em;
  pointer-events: none;
}
.roulette-backdrop .roulette-card > * { position: relative; z-index: 2; }
.roulette-backdrop .roulette-card .eyebrow {
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 9px 18px 8px;
  border: 1px solid #513610;
  border-radius: 4px;
  background:
    linear-gradient(105deg, transparent 0 18%, rgba(255,255,255,.22) 20%, transparent 23% 100%),
    linear-gradient(180deg, #e2c06d, #9a6d24 55%, #6a4615);
  color: #241708;
  font: 900 12px/1 "Courier New", monospace;
  letter-spacing: .2em;
  text-shadow: 0 1px rgba(255, 239, 177, .52);
  box-shadow: inset 0 1px rgba(255,255,255,.55), inset 0 -3px rgba(61,38,8,.28), 0 4px 8px rgba(0,0,0,.42);
}
.roulette-backdrop .roulette-card h2 {
  margin: 0;
  color: #e4d3aa;
  font: 900 clamp(20px, 3vw, 30px)/1.2 "Courier New", "Malgun Gothic", monospace;
  letter-spacing: .03em;
  text-shadow: 0 2px 3px #000;
}
.roulette-backdrop .roulette-name {
  isolation: isolate;
  width: min(680px, 94%);
  min-height: 174px;
  display: grid;
  place-items: center;
  margin: 1px auto 5px;
  overflow: hidden;
  border: 10px solid #6d4a19;
  border-radius: 13px;
  padding: 24px 32px;
  background:
    linear-gradient(112deg, rgba(255,255,255,.18) 0 7%, transparent 19% 67%, rgba(151,203,202,.08) 78%, transparent 90%),
    repeating-linear-gradient(0deg, rgba(189,224,218,.025) 0 1px, transparent 2px 5px),
    radial-gradient(ellipse at 50% 38%, #31484c 0%, #17282e 54%, #081116 100%);
  color: #f0d997;
  font: 900 clamp(52px, 10vw, 104px)/.95 Georgia, "Times New Roman", "Malgun Gothic", serif;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 0 #332308, 0 0 14px rgba(242, 205, 120, .3);
  box-shadow:
    inset 0 0 0 2px #d5aa50,
    inset 0 0 0 7px #1c1408,
    inset 0 14px 25px rgba(255,255,255,.08),
    inset 0 -20px 30px rgba(0,0,0,.62),
    0 7px 0 #2b1d0a,
    0 16px 28px rgba(0,0,0,.52);
}
.roulette-backdrop .roulette-name::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(255,255,255,.1), transparent 25% 72%, rgba(0,0,0,.26));
  pointer-events: none;
}
.roulette-backdrop .roulette-corner {
  position: absolute !important;
  top: 22px;
  width: 17px;
  height: 17px;
  border: 1px solid #4d310d;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff0a5 0 9%, #c49439 26%, #6b4515 68%, #2e1b08 100%);
  box-shadow: inset 0 -3px 4px rgba(34,19,4,.48), 0 3px 5px rgba(0,0,0,.5);
}
.roulette-backdrop .roulette-corner-left { left: 24px; }
.roulette-backdrop .roulette-corner-right { right: 24px; }
.roulette-backdrop.roulette-spinning .roulette-name {
  color: #f7e5ad;
  animation: rouletteFramePulse .72s ease-in-out infinite alternate, rouletteTextSmear .34s ease-in-out infinite alternate;
}
.roulette-backdrop.roulette-spinning .roulette-name::after {
  content: "";
  position: absolute;
  inset: 13% -24%;
  border-top: 1px solid rgba(249,222,148,.16);
  border-bottom: 1px solid rgba(249,222,148,.12);
  background:
    repeating-linear-gradient(0deg, transparent 0 8px, rgba(243,211,126,.055) 9px 11px, transparent 12px 18px),
    linear-gradient(90deg, transparent 4%, rgba(248,221,147,.04) 20%, rgba(248,221,147,.22) 48%, rgba(248,221,147,.04) 76%, transparent 96%);
  filter: blur(2px);
  mix-blend-mode: screen;
  animation: rouletteScan .42s linear infinite;
  pointer-events: none;
}
.roulette-backdrop.roulette-selected .roulette-name {
  color: #f4cf71;
  text-shadow: 0 2px 0 #49300a, 0 0 16px rgba(247, 199, 88, .43), 0 0 42px rgba(208, 153, 52, .2);
  box-shadow: inset 0 0 0 2px #e2bd68, inset 0 0 0 7px #1c1408, inset 0 14px 25px rgba(255,255,255,.08), inset 0 -20px 30px rgba(0,0,0,.62), 0 7px 0 #2b1d0a, 0 16px 28px rgba(0,0,0,.52), 0 0 34px rgba(211, 166, 69, .2);
}
.roulette-backdrop .roulette-controls {
  --roulette-control-height: 96px;
  width: min(760px, 100%);
  min-height: var(--roulette-control-height);
  display: grid;
  grid-template-columns: minmax(218px, 1.2fr) minmax(174px, .9fr) minmax(190px, 1fr);
  align-items: center;
  gap: 14px;
  margin: 9px auto 22px;
}
.roulette-backdrop .round-timer {
  position: relative;
  height: var(--roulette-control-height);
  min-width: 218px;
  display: grid;
  place-items: center;
  border: 8px solid #76531d;
  border-radius: 9px;
  padding: 20px 18px 10px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 2px 5px),
    linear-gradient(180deg, #172424, #090f11);
  color: #f0c963;
  font: 900 clamp(38px, 6vw, 67px)/1 "Courier New", monospace;
  letter-spacing: .08em;
  text-indent: .08em;
  text-shadow: 0 0 6px rgba(242,198,87,.7), 0 2px #332205;
  box-shadow: inset 0 0 0 2px #c89d43, inset 0 0 16px #000, 0 6px 0 #2e1e09, 0 13px 22px rgba(0,0,0,.48);
}
.roulette-backdrop .round-timer::before {
  content: "ROUND TIMER";
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  color: #927235;
  font: 900 8px/1 "Courier New", monospace;
  letter-spacing: .2em;
  text-shadow: none;
}
.roulette-backdrop .roulette-pause,
.roulette-backdrop .roulette-reveal {
  height: var(--roulette-control-height);
  min-width: 174px;
  border-radius: 7px;
  padding: 15px 22px;
  font: 900 18px/1.1 "Courier New", "Malgun Gothic", monospace;
  transition: transform .12s ease, filter .15s ease, box-shadow .12s ease;
}
.roulette-backdrop .roulette-pause {
  border: 2px solid #59400f;
  background: linear-gradient(180deg, #f2d47b 0%, #b78731 54%, #6f4c16 100%);
  color: #281a08;
  text-shadow: 0 1px rgba(255,247,197,.62);
  box-shadow: inset 0 2px rgba(255,255,255,.48), inset 0 -5px rgba(55,34,9,.38), 0 5px 0 #3f2a0c, 0 10px 17px rgba(0,0,0,.45);
}
.roulette-backdrop .roulette-reveal {
  border: 3px solid #761a14;
  background:
    radial-gradient(ellipse at 31% 16%, rgba(255,235,205,.32), transparent 27%),
    repeating-linear-gradient(96deg, rgba(255,255,255,.025) 0 1px, transparent 2px 7px),
    linear-gradient(145deg, #e45548, #a52620 57%, #5a110d);
  color: #fff6d9;
  font-size: 20px;
  letter-spacing: .06em;
  text-shadow: 0 2px #4c0b08, 0 0 8px rgba(255,224,184,.18);
  box-shadow: inset 0 0 0 3px rgba(69,12,8,.34), inset 0 3px rgba(255,255,255,.24), inset 0 -8px rgba(50,7,5,.48), 0 7px 0 #4b100c, 0 14px 24px rgba(0,0,0,.54), 0 0 28px rgba(207,56,43,.38);
}
.roulette-backdrop .roulette-pause:hover,
.roulette-backdrop .roulette-reveal:hover { filter: brightness(1.1); transform: translateY(-1px); }
.roulette-backdrop .roulette-pause:active,
.roulette-backdrop .roulette-reveal:active { transform: translateY(4px); box-shadow: inset 0 4px 8px rgba(42,20,7,.42), 0 2px 0 #3b260b, 0 5px 8px rgba(0,0,0,.35); }
.roulette-backdrop .roulette-pause:focus-visible,
.roulette-backdrop .roulette-reveal:focus-visible,
.roulette-backdrop .roulette-close:focus-visible { outline: 3px solid #ffe7a1; outline-offset: 4px; }
.roulette-backdrop .roulette-close {
  position: static;
  justify-self: center;
  min-width: 132px;
  margin: 0 auto;
  border: 2px solid #7e6128;
  border-radius: 7px;
  padding: 11px 20px;
  background:
    repeating-linear-gradient(96deg, rgba(255,255,255,.03) 0 1px, transparent 2px 7px),
    linear-gradient(180deg, #5b4131, #34211a 60%, #1d120f);
  color: #ead39d;
  font: 900 13px/1 "Courier New", "Malgun Gothic", monospace;
  letter-spacing: .08em;
  text-shadow: 0 1px #090504;
  box-shadow: inset 0 1px rgba(255,255,255,.13), inset 0 -4px rgba(0,0,0,.3), 0 4px 0 #15100a, 0 9px 14px rgba(0,0,0,.38);
}
.roulette-backdrop .roulette-close:hover { filter: brightness(1.12); transform: translateY(-1px); }
.roulette-backdrop .roulette-close:active { transform: translateY(3px); box-shadow: inset 0 3px 6px rgba(0,0,0,.4), 0 1px 0 #15100a, 0 4px 7px rgba(0,0,0,.32); }

@keyframes rouletteFramePulse {
  from { filter: brightness(.94); box-shadow: inset 0 0 0 2px #c89538, inset 0 0 0 7px #1c1408, inset 0 14px 25px rgba(255,255,255,.06), inset 0 -20px 30px rgba(0,0,0,.62), 0 7px 0 #2b1d0a, 0 16px 28px rgba(0,0,0,.52), 0 0 8px rgba(222,175,76,.16); }
  to { filter: brightness(1.08); box-shadow: inset 0 0 0 2px #efd07a, inset 0 0 0 7px #1c1408, inset 0 14px 25px rgba(255,255,255,.11), inset 0 -20px 30px rgba(0,0,0,.55), 0 7px 0 #2b1d0a, 0 16px 28px rgba(0,0,0,.52), 0 0 34px rgba(235,190,91,.48); }
}
@keyframes rouletteScan {
  from { transform: translateX(-34%); opacity: 0; }
  18%, 78% { opacity: 1; }
  to { transform: translateX(34%); opacity: 0; }
}
@keyframes rouletteTextSmear {
  from { text-shadow: -18px 0 12px rgba(241,205,118,.08), 0 2px 0 #332308, 0 0 14px rgba(242,205,120,.3), 18px 0 12px rgba(241,205,118,.12); }
  to { text-shadow: -34px 0 17px rgba(241,205,118,.2), 0 2px 0 #332308, 0 0 25px rgba(242,205,120,.48), 34px 0 17px rgba(241,205,118,.24); }
}

@media (max-width: 780px) {
  .roulette-backdrop { align-items: center; padding: 12px; }
  .roulette-backdrop .roulette-card { min-height: min(680px, calc(100vh - 24px)); padding: 35px 24px 38px; gap: 11px; }
  .roulette-backdrop .roulette-name { width: 100%; min-height: 145px; border-width: 8px; padding: 20px 18px; font-size: clamp(44px, 13vw, 78px); }
  .roulette-backdrop .roulette-controls { --roulette-control-height: 78px; grid-template-columns: 1fr; gap: 16px; margin-bottom: 16px; }
  .roulette-backdrop .round-timer { width: min(360px, 100%); min-width: 0; }
  .roulette-backdrop .roulette-pause,
  .roulette-backdrop .roulette-reveal { width: min(360px, 100%); }
  .roulette-backdrop .roulette-close { width: min(220px, 100%); margin: 8px auto 0; }
}

@media (max-width: 460px) {
  .roulette-backdrop .roulette-card { min-height: calc(100vh - 18px); border-width: 2px; border-radius: 16px; padding: 30px 16px 32px; }
  .roulette-backdrop .roulette-card .eyebrow { padding: 8px 11px 7px; font-size: 10px; letter-spacing: .13em; }
  .roulette-backdrop .roulette-card h2 { font-size: 19px; }
  .roulette-backdrop .roulette-name { min-height: 126px; border-width: 7px; border-radius: 10px; font-size: clamp(38px, 14vw, 62px); }
  .roulette-backdrop .round-timer { border-width: 6px; padding: 23px 16px 15px; font-size: clamp(36px, 14vw, 56px); }
  .roulette-backdrop .roulette-pause,
  .roulette-backdrop .roulette-reveal { padding: 14px 18px; font-size: 17px; }
  .roulette-backdrop .roulette-corner { top: 17px; width: 13px; height: 13px; }
  .roulette-backdrop .roulette-corner-left { left: 17px; }
  .roulette-backdrop .roulette-corner-right { right: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .roulette-backdrop.roulette-spinning .roulette-name,
  .roulette-backdrop.roulette-spinning .roulette-name::after { animation: none; }
  .roulette-backdrop .roulette-pause,
  .roulette-backdrop .roulette-reveal { transition: none; }
}

/* Answer reveal: a declassified case report laid into a dark leather evidence frame. */
.result-backdrop {
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 50% 43%, rgba(221, 181, 99, .2) 0 12%, rgba(19, 23, 27, .58) 43%, rgba(3, 5, 8, .95) 88%),
    rgba(4, 7, 11, .9);
  backdrop-filter: blur(6px) saturate(.7);
}
.result-backdrop::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(94deg, rgba(255,255,255,.015) 0 1px, transparent 2px 8px),
    radial-gradient(ellipse at center, transparent 28%, rgba(0,0,0,.24) 62%, rgba(0,0,0,.74) 100%);
  box-shadow: inset 0 0 15vw 5vw rgba(0,0,0,.64);
}
.result-backdrop .result-card {
  position: relative;
  isolation: isolate;
  width: min(900px, 100%);
  max-height: calc(100vh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 10px solid #342018;
  border-radius: 18px;
  padding: 42px 46px 34px;
  background:
    radial-gradient(ellipse at 15% 18%, rgba(91,50,20,.1), transparent 19%),
    radial-gradient(ellipse at 86% 74%, rgba(79,42,18,.09), transparent 21%),
    repeating-linear-gradient(9deg, transparent 0 17px, rgba(83,49,20,.027) 18px, transparent 19px 31px),
    linear-gradient(145deg, #ead7a8, #cfb477 55%, #b89558);
  color: #2b2115;
  box-shadow:
    inset 0 0 0 2px #bd9143,
    inset 0 0 0 5px #15100d,
    inset 0 0 36px rgba(75,43,16,.25),
    0 0 0 2px #a87b32,
    0 30px 90px rgba(0,0,0,.76),
    0 0 48px rgba(201,153,62,.13);
  animation: resultReportIn .38s cubic-bezier(.2, 1.15, .35, 1);
}
.result-backdrop .result-card::before {
  content: "";
  position: absolute;
  inset: 16px;
  z-index: -1;
  border: 1px solid rgba(79,48,20,.36);
  border-radius: 8px;
  background:
    linear-gradient(108deg, transparent 0 45%, rgba(255,255,255,.06) 46%, transparent 47%),
    radial-gradient(circle at 22% 32%, rgba(86,44,17,.055) 0 1px, transparent 2px);
  box-shadow: inset 0 0 22px rgba(76,43,15,.16), 0 0 0 4px rgba(54,31,13,.06);
  pointer-events: none;
  animation: none;
}
.result-backdrop .result-card::after {
  content: "RESOLVED / EVIDENCE VERIFIED";
  position: absolute;
  right: 30px;
  top: 22px;
  color: rgba(119,35,28,.52);
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .13em;
  transform: rotate(1deg);
  pointer-events: none;
}
.result-backdrop .result-card > * { position: relative; z-index: 1; }
.result-report-label {
  width: max-content;
  max-width: calc(100% - 170px);
  margin: 0 0 20px;
  border: 1px solid #4f350f;
  border-radius: 4px;
  padding: 9px 15px 8px;
  background:
    linear-gradient(105deg, transparent 0 15%, rgba(255,255,255,.25) 18%, transparent 22%),
    linear-gradient(180deg, #e1be69, #9c7028 58%, #694612);
  color: #241707;
  font: 900 11px/1 "Courier New", monospace;
  letter-spacing: .17em;
  text-shadow: 0 1px rgba(255,240,178,.5);
  box-shadow: inset 0 1px rgba(255,255,255,.52), inset 0 -3px rgba(55,34,7,.3), 0 4px 7px rgba(55,34,12,.28);
}
.result-backdrop .answer-summary {
  position: relative;
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
  border: 2px solid #74501c;
  border-radius: 7px;
  padding: 17px 22px 14px 56px;
  background:
    radial-gradient(circle at 14px 14px, #f0d27a 0 2px, #6a4615 3px, transparent 4px),
    radial-gradient(circle at calc(100% - 14px) calc(100% - 14px), #d2a84e 0 2px, #563610 3px, transparent 4px),
    repeating-linear-gradient(96deg, rgba(255,255,255,.035) 0 1px, transparent 2px 7px),
    linear-gradient(145deg, #4d3025, #241612 67%, #160d0b);
  color: #f6e3b5;
  box-shadow: inset 0 0 0 3px rgba(11,6,5,.5), inset 0 2px 7px rgba(255,255,255,.08), inset 0 -7px 11px rgba(0,0,0,.34), 0 6px 0 #382210, 0 12px 19px rgba(63,38,14,.32);
}
.result-backdrop .answer-summary::before {
  content: "CASE";
  position: absolute;
  left: 13px;
  top: 50%;
  color: #c89c49;
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .13em;
  transform: translateY(-50%) rotate(-90deg);
}
.result-backdrop .answer-summary b {
  color: #fff0c4;
  font: 900 clamp(29px, 5vw, 48px)/1.05 Georgia, "Malgun Gothic", serif;
  letter-spacing: -.035em;
  text-shadow: 0 2px #080504;
}
.result-backdrop .answer-meta-chip {
  flex: 0 0 auto;
  border: 1px solid #d0a655;
  border-radius: 5px;
  padding: 10px 13px;
  background: linear-gradient(180deg, #d8b666, #8d6120);
  color: #281908;
  font: 900 13px/1 "Courier New", "Malgun Gothic", monospace;
  text-shadow: 0 1px rgba(255,243,188,.5);
  box-shadow: inset 0 1px rgba(255,255,255,.45), inset 0 -3px rgba(47,28,6,.26);
}
.result-backdrop .answer-hero {
  grid-template-columns: .82fr 1.18fr;
  gap: 15px;
  margin: 14px 0 20px;
}
.result-backdrop .answer-hero > div {
  position: relative;
  min-height: 180px;
  display: grid;
  align-content: center;
  border: 9px solid #75521e;
  border-radius: 11px;
  padding: 30px 25px 24px;
  background:
    linear-gradient(115deg, rgba(255,255,255,.09), transparent 24% 72%, rgba(197,224,216,.025)),
    repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 2px 5px),
    radial-gradient(ellipse at 50% 38%, #243236, #10191c 62%, #070c0e);
  color: #f4deb0;
  box-shadow: inset 0 0 0 2px #d2a64e, inset 0 0 0 7px #1b1208, inset 0 15px 25px rgba(255,255,255,.055), inset 0 -22px 30px rgba(0,0,0,.58), 0 7px 0 #332207, 0 15px 24px rgba(61,37,12,.38);
}
.result-backdrop .answer-hero span {
  margin: 0 0 12px;
  color: #b99348;
  font: 900 11px/1 "Courier New", "Malgun Gothic", monospace;
  letter-spacing: .14em;
}
.result-backdrop .answer-hero strong,
.result-backdrop .answer-hero b {
  color: #f4d071;
  font-family: Georgia, "Times New Roman", "Malgun Gothic", serif;
  line-height: .93;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
  text-shadow: 0 2px #3b2707, 0 0 14px rgba(240,196,91,.27);
}
.result-backdrop .answer-hero strong { font-size: clamp(44px, 7vw, 74px); }
.result-backdrop .answer-hero b { font-size: clamp(52px, 9vw, 94px); }
.result-backdrop #resultBox > .empty,
.result-backdrop .ranking-guide {
  border: 1px solid rgba(92,56,24,.42);
  border-left: 6px solid #8d2c27;
  border-radius: 4px;
  padding: 15px 17px;
  background:
    repeating-linear-gradient(0deg, transparent 0 25px, rgba(81,50,22,.08) 26px 27px),
    rgba(244,225,180,.48);
  color: #4c3520;
  font: 900 14px/1.55 "Courier New", "Malgun Gothic", monospace;
  text-align: left;
  box-shadow: inset 0 0 11px rgba(80,46,15,.09), 2px 4px 7px rgba(64,39,15,.12);
}
.result-backdrop .answer-reason {
  position: relative;
  margin: 18px 0 8px;
  border-top: 1px dashed rgba(88,53,23,.5);
  border-bottom: 1px dashed rgba(88,53,23,.38);
  padding: 31px 18px 14px;
  color: #49351f;
  font: 800 14px/1.7 "Courier New", "Malgun Gothic", monospace;
}
.result-backdrop .answer-reason::before {
  content: "INVESTIGATION NOTE";
  position: absolute;
  top: 10px;
  left: 18px;
  color: #872d27;
  font: 900 10px/1 "Courier New", monospace;
  letter-spacing: .15em;
}
.result-backdrop .rank-list { gap: 12px; }
.result-backdrop .rank-card {
  border: 1px solid rgba(81,50,22,.42);
  border-radius: 6px;
  background: rgba(246,226,180,.55);
  color: #352718;
  box-shadow: inset 0 0 13px rgba(75,43,15,.08), 2px 4px 7px rgba(59,35,13,.13);
}
.result-backdrop .rank-first {
  border-color: #8d6527;
  background: linear-gradient(135deg, rgba(211,171,83,.42), rgba(249,229,180,.68));
}
.result-backdrop .rank-title b,
.result-backdrop .rank-first .rank-title b { color: #332317; font-family: "Courier New", "Malgun Gothic", monospace; }
.result-backdrop .rank-detail { color: #654a2b; font-family: "Courier New", "Malgun Gothic", monospace; }
.result-backdrop .award-points-btn {
  border: 2px solid #634713;
  border-radius: 7px;
  background: linear-gradient(180deg, #efd27b, #ae7b2c 58%, #684513);
  color: #291a08;
  font-family: "Courier New", "Malgun Gothic", monospace;
  box-shadow: inset 0 2px rgba(255,255,255,.42), inset 0 -5px rgba(52,31,7,.34), 0 5px 0 #49300e, 0 10px 15px rgba(63,38,13,.27);
}
.result-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(91,54,22,.28);
}
.result-backdrop .result-close {
  min-width: 148px;
  border: 3px double #6f1712;
  border-radius: 6px;
  padding: 13px 24px;
  background:
    radial-gradient(ellipse at 30% 16%, rgba(255,224,192,.23), transparent 28%),
    repeating-linear-gradient(96deg, rgba(255,255,255,.025) 0 1px, transparent 2px 7px),
    linear-gradient(145deg, #d34b40, #90221c 62%, #51100d);
  color: #fff0ce;
  font: 900 16px/1 "Courier New", "Malgun Gothic", monospace;
  letter-spacing: .08em;
  text-shadow: 0 2px #4b0b08;
  box-shadow: inset 0 0 0 2px rgba(69,12,8,.28), inset 0 2px rgba(255,255,255,.2), inset 0 -6px rgba(51,7,5,.42), 0 6px 0 #4a100c, 0 12px 20px rgba(70,24,14,.34);
}
.result-backdrop .result-close::after {
  content: " · APPROVED";
  color: rgba(255,225,184,.72);
  font-size: 9px;
}
.result-backdrop .result-close:hover { filter: brightness(1.1); transform: translateY(-1px); }
.result-backdrop .result-close:active { transform: translateY(4px); box-shadow: inset 0 4px 8px rgba(42,8,6,.4), 0 2px 0 #4a100c, 0 5px 8px rgba(70,24,14,.28); }
.result-backdrop .result-close:focus-visible,
.result-backdrop .award-points-btn:focus-visible { outline: 3px solid #fff0a7; outline-offset: 4px; }

@keyframes resultReportIn {
  from { opacity: 0; transform: translateY(22px) scale(.96) rotate(-.35deg); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 780px) {
  .result-backdrop { padding: 12px; }
  .result-backdrop .result-card { max-height: calc(100vh - 24px); border-width: 7px; padding: 34px 24px 27px; }
  .result-backdrop .result-card::after { display: none; }
  .result-report-label { max-width: 100%; margin-right: auto; font-size: 10px; letter-spacing: .11em; }
  .result-backdrop .answer-summary { align-items: flex-start; flex-direction: column; padding-left: 48px; }
  .result-backdrop .answer-hero { grid-template-columns: 1fr; }
  .result-backdrop .answer-hero > div { min-height: 145px; padding: 27px 19px 21px; }
  .result-backdrop .result-close { width: min(240px, 100%); }
}

@media (max-width: 460px) {
  .result-backdrop .result-card { border-width: 5px; border-radius: 12px; padding: 27px 15px 22px; }
  .result-backdrop .result-card::before { inset: 9px; }
  .result-report-label { padding: 8px 10px 7px; font-size: 9px; }
  .result-backdrop .answer-summary { min-height: 0; padding: 15px 14px 13px 43px; }
  .result-backdrop .answer-summary b { font-size: 31px; }
  .result-backdrop .answer-meta-chip { font-size: 11px; }
  .result-backdrop .answer-hero > div { min-height: 126px; border-width: 7px; }
  .result-backdrop .answer-hero strong { font-size: 43px; }
  .result-backdrop .answer-hero b { font-size: 51px; }
  .result-backdrop .answer-reason { padding-inline: 10px; }
  .result-modal-actions { justify-content: stretch; }
  .result-backdrop .result-close { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .result-backdrop .result-card { animation: none; }
}

/* Student tablet: the same leather desk and aged case-file system used by the teacher. */
body.student-detective-mode {
  --student-navy: #101923;
  --student-navy-soft: #1c2935;
  --student-paper: #d7bd84;
  --student-paper-light: #ead8ab;
  --student-ink: #2b2115;
  --student-red: #a52d27;
  --student-brass: #b3883b;
  min-height: 100vh;
  color: var(--student-ink);
  background:
    radial-gradient(ellipse at 18% 14%, rgba(255,255,255,.045), transparent 24%),
    radial-gradient(ellipse at 80% 82%, rgba(0,0,0,.24), transparent 36%),
    repeating-linear-gradient(96deg, rgba(255,255,255,.018) 0 1px, transparent 2px 8px),
    linear-gradient(145deg, #162330, #0d151e 58%, #080e15);
  background-attachment: fixed;
}
body.student-detective-mode::before {
  opacity: .33;
  background-image:
    linear-gradient(90deg, rgba(186,157,96,.19) 1px, transparent 1px),
    linear-gradient(rgba(186,157,96,.16) 1px, transparent 1px),
    repeating-linear-gradient(8deg, transparent 0 5px, rgba(255,255,255,.014) 6px, transparent 7px 12px);
  background-size: 34px 34px, 34px 34px, auto;
  mask-image: radial-gradient(ellipse at center, #000 34%, transparent 96%);
}
body.student-detective-mode::after {
  content: "";
  position: fixed;
  inset: 10px;
  z-index: -1;
  border: 1px solid rgba(183,143,63,.24);
  border-radius: 18px;
  box-shadow: inset 0 0 0 3px rgba(2,5,8,.38), inset 0 0 55px rgba(0,0,0,.48);
  pointer-events: none;
}
.student-detective-mode .student-wrap {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 34px));
  padding: 28px 0 90px;
}
.student-detective-mode .made-by {
  border: 1px solid rgba(184,143,62,.52);
  border-radius: 5px;
  background: linear-gradient(145deg, rgba(40,27,21,.94), rgba(16,12,10,.94));
  color: #d7b970;
  font: 900 10px/1 "Courier New", monospace;
  letter-spacing: .11em;
  box-shadow: inset 0 1px rgba(255,255,255,.06), 0 7px 18px rgba(0,0,0,.34);
  backdrop-filter: none;
}
.student-detective-mode .student-hero {
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  gap: 18px;
  margin-bottom: 20px;
}
.student-detective-mode .student-case-header {
  min-height: 238px;
  border: 2px solid #8b672b;
  border-radius: 14px;
  padding: 30px 32px 27px;
  background:
    radial-gradient(circle at 14% 20%, rgba(255,255,255,.055) 0 1px, transparent 2px),
    repeating-linear-gradient(96deg, rgba(255,255,255,.018) 0 2px, transparent 3px 8px),
    linear-gradient(145deg, #21303e, #111a25 62%, #090f17);
  color: #f0dfb6;
  box-shadow: inset 0 0 0 3px #080d13, inset 0 0 0 5px rgba(191,151,68,.36), inset 0 14px 22px rgba(255,255,255,.025), 0 18px 35px rgba(0,0,0,.42);
  backdrop-filter: none;
  overflow: hidden;
}
.student-detective-mode .student-case-header::before {
  content: "CASE FILE · STUDENT FIELD UNIT";
  position: absolute;
  right: 25px;
  top: 20px;
  color: rgba(211,181,112,.46);
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .13em;
}
.student-detective-mode .student-case-header::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px dashed rgba(203,165,82,.25);
  border-radius: 8px;
  background: none;
  pointer-events: none;
}
.student-detective-mode .student-case-header > * { position: relative; z-index: 1; }
.student-detective-mode .student-case-header .eyebrow {
  margin-bottom: 13px;
  color: #c9a85d;
  font: 900 11px/1 "Courier New", monospace;
  letter-spacing: .18em;
}
.student-detective-mode .student-case-header h1 {
  color: #f1e1bc;
  font-family: Rockwell, Georgia, "Malgun Gothic", serif;
  font-size: clamp(43px, 6vw, 70px);
  letter-spacing: -.045em;
  text-shadow: 0 3px #05080c, 2px 0 rgba(185,143,56,.24);
}
.student-detective-mode .student-case-header #heroText {
  max-width: 720px;
  margin: 20px 0 18px;
  color: #d8c9a9;
  font: 800 14px/1.6 "Courier New", "Malgun Gothic", monospace;
}
.student-detective-mode #navButtons { gap: 9px; }
.student-detective-mode #navButtons .student-nav-tab {
  min-width: 94px;
  border: 1px solid #9a7435;
  border-radius: 6px;
  padding: 11px 15px;
  background:
    repeating-linear-gradient(96deg, rgba(255,255,255,.025) 0 1px, transparent 2px 7px),
    linear-gradient(145deg, #4b2b22, #281713 67%, #180e0c);
  color: #f0dab0;
  font: 900 13px/1 "Courier New", "Malgun Gothic", monospace;
  text-shadow: 0 1px #0a0504;
  box-shadow: inset 0 0 0 2px rgba(12,6,5,.52), inset 0 1px rgba(255,255,255,.07), 0 5px 0 #160c09, 0 8px 12px rgba(0,0,0,.3);
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}
.student-detective-mode #navButtons .student-nav-tab:hover { filter: brightness(1.13); transform: translateY(-1px); }
.student-detective-mode #navButtons .student-nav-tab.active {
  border-color: #f2cf79;
  background:
    radial-gradient(ellipse at 31% 16%, rgba(255,235,205,.25), transparent 28%),
    linear-gradient(145deg, #cc473d, #92231d 61%, #55110e);
  color: #fff1cd;
  text-shadow: 0 2px #4c0b08;
  box-shadow: inset 0 0 0 2px rgba(73,13,9,.36), inset 0 2px rgba(255,255,255,.16), 0 5px 0 #4b100c, 0 0 22px rgba(220,169,72,.48), 0 11px 16px rgba(0,0,0,.38);
  transform: translateY(-2px);
}
.student-detective-mode #navButtons .student-nav-tab:focus-visible,
.student-detective-mode .choice-card:focus-visible,
.student-detective-mode .team-chip:focus-visible,
.student-detective-mode .create-team-stamp:focus-visible,
.student-detective-mode .student-entry-stamp:focus-visible,
.student-detective-mode .student-submit-stamp:focus-visible { outline: 3px solid #ffe7a1; outline-offset: 4px; }
.student-detective-mode .student-id-card {
  position: relative;
  min-height: 238px;
  border: 1px solid #725224;
  border-radius: 4px 12px 7px 5px;
  padding: 31px 23px 23px;
  background:
    radial-gradient(ellipse at 18% 24%, rgba(93,50,18,.08), transparent 22%),
    repeating-linear-gradient(8deg, transparent 0 17px, rgba(79,47,17,.025) 18px, transparent 19px 31px),
    linear-gradient(145deg, #ecd9ab, #d3b778 58%, #bc9859);
  color: var(--student-ink);
  box-shadow: inset 0 0 25px rgba(76,43,15,.2), 0 18px 34px rgba(0,0,0,.38);
  clip-path: polygon(0 2%, 4% 0, 10% 1%, 17% 0, 24% 1%, 33% 0, 42% 1%, 52% 0, 63% 1%, 74% 0, 83% 1%, 92% 0, 100% 2%, 99% 14%, 100% 27%, 99% 40%, 100% 55%, 99% 69%, 100% 82%, 99% 100%, 88% 99%, 77% 100%, 65% 99%, 52% 100%, 39% 99%, 27% 100%, 13% 99%, 0 100%, 1% 84%, 0 67%, 1% 49%, 0 31%);
}
.student-detective-mode .student-id-label {
  margin: 0 0 10px;
  color: #6e4c23;
  font: 900 10px/1 "Courier New", monospace;
  letter-spacing: .16em;
}
.student-detective-mode .student-id-card h2 {
  color: #2b2116;
  font-family: Rockwell, Georgia, "Malgun Gothic", serif;
}
.student-detective-mode #profileBox {
  display: grid;
  gap: 9px;
}
.student-detective-mode .student-id-tag {
  width: 100%;
  justify-content: center;
  border: 1px solid rgba(91,58,24,.42);
  border-radius: 5px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(248,229,185,.52), rgba(170,132,70,.25));
  color: #3d2c18;
  font: 900 15px/1.1 Georgia, "Malgun Gothic", serif;
  box-shadow: inset 0 2px 5px rgba(84,49,17,.16), 0 1px rgba(255,255,255,.42);
}
.student-detective-mode .student-step-card {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid #765523;
  border-radius: 5px 12px 7px 5px;
  padding: 30px 32px 34px;
  background:
    radial-gradient(ellipse at 12% 16%, rgba(83,43,16,.08), transparent 18%),
    radial-gradient(ellipse at 82% 76%, rgba(76,40,16,.065), transparent 20%),
    repeating-linear-gradient(9deg, transparent 0 18px, rgba(72,42,16,.026) 19px, transparent 20px 32px),
    linear-gradient(145deg, #ead7aa, #d5ba80 58%, #bd995b);
  box-shadow: inset 0 0 27px rgba(79,45,15,.2), 0 19px 37px rgba(0,0,0,.4);
  clip-path: polygon(0 2%, 3% 0, 9% 1%, 15% 0, 22% 1%, 30% 0, 39% 1%, 49% 0, 58% 1%, 68% 0, 77% 1%, 86% 0, 94% 1%, 100% 2%, 99% 17%, 100% 32%, 99% 49%, 100% 66%, 99% 83%, 100% 99%, 91% 100%, 82% 99%, 71% 100%, 59% 99%, 48% 100%, 35% 99%, 22% 100%, 11% 99%, 0 100%, 1% 82%, 0 63%, 1% 45%, 0 27%);
}
.student-detective-mode .student-step-card::before {
  content: "EVIDENCE FILE";
  position: absolute;
  right: 27px;
  top: 18px;
  color: rgba(105,66,28,.38);
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .14em;
}
.student-detective-mode .student-step-card h2 {
  color: #281f15;
  font-family: Rockwell, Georgia, "Malgun Gothic", serif;
  font-size: clamp(25px, 3vw, 34px);
  text-shadow: 0 1px rgba(255,247,215,.46);
}
.student-detective-mode .student-class-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  margin-top: 24px;
}
.student-detective-mode .choice-card {
  min-height: 128px;
  border: 3px solid #77541d;
  border-radius: 9px;
  padding: 23px 20px 18px;
  background:
    repeating-linear-gradient(96deg, rgba(255,255,255,.025) 0 1px, transparent 2px 7px),
    linear-gradient(145deg, #573329, #2c1915 67%, #190e0c);
  color: #f2ddb2;
  box-shadow: inset 0 0 0 2px #140b08, inset 0 2px rgba(255,255,255,.08), inset 0 -7px rgba(0,0,0,.3), 0 7px 0 #291909, 0 13px 20px rgba(58,34,12,.35);
}
.student-detective-mode .choice-card h3 {
  color: #ffe7ad;
  font: 900 23px/1.15 Georgia, "Malgun Gothic", serif;
  text-shadow: 0 2px #0b0605;
}
.student-detective-mode .choice-card p { color: #cbb990; font-family: "Courier New", "Malgun Gothic", monospace; }
.student-detective-mode .choice-card:hover { border-color: #d3ac5e; background: linear-gradient(145deg, #684034, #352019 67%, #1d110e); transform: translateY(-3px); }
.student-detective-mode .choice-card.selected { outline: 3px solid rgba(226,188,103,.55); background: linear-gradient(145deg, #744235, #3e211b 67%, #21120f); box-shadow: inset 0 0 0 2px #160b08, 0 7px 0 #291909, 0 0 24px rgba(225,182,91,.4), 0 14px 21px rgba(58,34,12,.38); }
.student-detective-mode .student-team-card .topic-head { align-items: center; }
.student-detective-mode .team-chip-grid { gap: 16px; margin-top: 29px; }
.student-detective-mode .team-chip {
  position: relative;
  min-width: 130px;
  min-height: 76px;
  border: 3px double #65440f;
  border-radius: 46% 46% 16px 16px;
  padding: 18px 25px 15px;
  background:
    radial-gradient(ellipse at 36% 24%, rgba(255,249,190,.58) 0 5%, transparent 18%),
    linear-gradient(145deg, #e6c56e, #a87928 56%, #67430f);
  color: #281908;
  font: 900 21px/1 Georgia, "Malgun Gothic", serif;
  text-shadow: 0 1px rgba(255,246,194,.55);
  box-shadow: inset 0 2px rgba(255,255,255,.45), inset 0 -7px rgba(56,35,6,.32), 0 6px 0 #4b310c, 0 12px 18px rgba(55,32,10,.34);
}
.student-detective-mode .team-chip::before {
  content: "FIELD UNIT";
  display: block;
  margin-bottom: 7px;
  color: rgba(45,27,5,.58);
  font: 900 8px/1 "Courier New", monospace;
  letter-spacing: .12em;
}
.student-detective-mode .team-chip:hover { filter: brightness(1.1); transform: translateY(-2px); }
.student-detective-mode .team-chip.selected { outline: 4px solid rgba(163,43,36,.3); background: radial-gradient(ellipse at 36% 24%, rgba(255,249,190,.62) 0 5%, transparent 18%), linear-gradient(145deg, #f0cf74, #bb8731 56%, #784b12); box-shadow: inset 0 2px rgba(255,255,255,.5), inset 0 -7px rgba(56,35,6,.32), 0 6px 0 #4b310c, 0 0 23px rgba(166,43,36,.43), 0 12px 18px rgba(55,32,10,.34); }
.student-detective-mode .create-team-stamp,
.student-detective-mode .student-entry-stamp,
.student-detective-mode .student-submit-stamp {
  border: 3px double #701812;
  border-radius: 7px;
  background:
    radial-gradient(ellipse at 31% 16%, rgba(255,226,196,.24), transparent 28%),
    repeating-linear-gradient(96deg, rgba(255,255,255,.025) 0 1px, transparent 2px 7px),
    linear-gradient(145deg, #d54b41, #94231d 61%, #56110e);
  color: #fff0cd;
  font-family: "Courier New", "Malgun Gothic", monospace;
  font-weight: 900;
  text-shadow: 0 2px #4c0b08;
  box-shadow: inset 0 0 0 2px rgba(70,12,8,.3), inset 0 2px rgba(255,255,255,.18), inset 0 -6px rgba(52,7,5,.42), 0 6px 0 #4b100c, 0 12px 18px rgba(65,24,13,.35);
}
.student-detective-mode .create-team-stamp:hover,
.student-detective-mode .student-entry-stamp:hover,
.student-detective-mode .student-submit-stamp:hover { filter: brightness(1.1); transform: translateY(-1px); }
.student-detective-mode .create-team-stamp:active,
.student-detective-mode .student-entry-stamp:active,
.student-detective-mode .student-submit-stamp:active { transform: translateY(4px); box-shadow: inset 0 4px 8px rgba(42,8,6,.4), 0 2px 0 #4b100c, 0 5px 8px rgba(65,24,13,.28); }
.student-detective-mode .student-profile-card { min-height: 310px; }
.student-detective-mode .inline-profile-form {
  grid-template-columns: 130px minmax(200px, 1fr) 170px;
  gap: 14px;
  margin-top: 38px;
}
.student-detective-mode .inline-profile-form input,
.student-detective-mode .compact-topic-row input {
  border: 2px solid #86632d;
  border-radius: 7px;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(91,57,24,.07) 24px 25px),
    linear-gradient(180deg, #cbb078, #ecd8a9 30%, #e2ca96);
  color: #2f2315;
  font: 900 17px/1.2 "Courier New", "Malgun Gothic", monospace;
  box-shadow: inset 0 4px 9px rgba(69,40,14,.26), inset 0 -1px rgba(255,255,255,.5), 0 1px #f7e7bd;
}
.student-detective-mode .inline-profile-form input { min-height: 58px; padding: 15px 17px; }
.student-detective-mode .inline-profile-form input::placeholder,
.student-detective-mode .compact-topic-row input::placeholder { color: #725635; opacity: .74; }
.student-detective-mode .inline-profile-form input:focus,
.student-detective-mode .compact-topic-row input:focus { border-color: #b02d26; box-shadow: inset 0 4px 9px rgba(69,40,14,.24), 0 0 0 4px rgba(160,45,38,.17); }
.student-detective-mode .student-entry-stamp { min-height: 58px; }
.student-detective-mode .student-activity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  gap: 18px;
  align-items: start;
}
.student-detective-mode .student-data-card,
.student-detective-mode .student-score-ledger { min-height: 410px; }
.student-detective-mode .student-data-card .topic-head { align-items: center; }
.student-detective-mode #submitState {
  border: 1px solid #77541f;
  border-radius: 5px;
  background: linear-gradient(180deg, #d8b668, #966b28);
  color: #2a1a08;
  font-family: "Courier New", "Malgun Gothic", monospace;
  box-shadow: inset 0 1px rgba(255,255,255,.4), inset 0 -3px rgba(48,29,6,.24);
}
.student-detective-mode .compact-topic-list {
  grid-template-columns: 1fr;
  gap: 11px;
  margin-top: 22px;
}
.student-detective-mode .compact-topic-row {
  grid-template-columns: minmax(110px, .75fr) minmax(130px, 1fr) minmax(50px, .35fr);
  min-height: 72px;
  border: 1px solid rgba(93,57,23,.45);
  border-radius: 7px;
  padding: 10px 13px;
  background: rgba(243,223,178,.42);
  box-shadow: inset 0 0 12px rgba(75,43,15,.09), 2px 3px 7px rgba(61,36,13,.1);
}
.student-detective-mode .compact-topic-row strong {
  color: #342617;
  font: 900 17px/1.2 Georgia, "Malgun Gothic", serif;
}
.student-detective-mode .compact-topic-row .tiny { color: #654b2d; font-family: "Courier New", "Malgun Gothic", monospace; }
.student-detective-mode .compact-topic-row input { min-height: 48px; padding: 11px 13px; text-align: right; }
.student-detective-mode .submit-actions { gap: 13px; margin-top: 22px; }
.student-detective-mode .student-submit-stamp { min-width: 180px; min-height: 58px; font-size: 17px; }
.student-detective-mode #editValuesBtn {
  min-height: 58px;
  border: 2px solid #634812;
  border-radius: 7px;
  background: linear-gradient(180deg, #e6c970, #aa7a2e 57%, #694713);
  color: #291a08;
  font-family: "Courier New", "Malgun Gothic", monospace;
  box-shadow: inset 0 2px rgba(255,255,255,.42), inset 0 -5px rgba(53,32,7,.33), 0 5px 0 #49310e, 0 10px 15px rgba(61,36,12,.25);
}
.student-detective-mode .student-score-ledger h2 span {
  display: block;
  margin-top: 5px;
  color: #785526;
  font: 900 10px/1 "Courier New", monospace;
  letter-spacing: .14em;
}
.student-detective-mode .student-score-ledger #scoreboard { gap: 10px; margin-top: 23px; }
.student-detective-mode .student-score-ledger .score-card.score-row {
  min-height: 65px;
  grid-template-columns: minmax(0, 1fr) 72px;
  border: 2px solid #704d20;
  border-radius: 8px;
  padding: 11px 13px 11px 21px;
  background:
    radial-gradient(circle at 8px 8px, #e2c174 0 2px, #674719 3px, transparent 4px),
    repeating-linear-gradient(98deg, rgba(255,255,255,.025) 0 2px, transparent 3px 7px),
    linear-gradient(145deg, #503025, #231612 70%);
  color: #f4dfae;
  box-shadow: inset 0 0 0 3px rgba(19,10,8,.58), inset 0 1px 8px rgba(255,255,255,.08), inset 0 -7px 10px rgba(0,0,0,.25), 3px 6px 9px rgba(58,35,13,.22);
}
.student-detective-mode .student-score-ledger .score-row b { font: 900 17px/1.2 "Courier New", "Malgun Gothic", monospace; text-shadow: 0 1px #000; }
.student-detective-mode .student-score-ledger .score-row span {
  min-width: 55px;
  border: 1px inset #b99142;
  border-radius: 5px;
  padding: 7px 4px;
  background: #c7a85f;
  color: #291b0c;
  font: 900 31px/1 "Courier New", monospace;
  text-shadow: 0 1px rgba(255,255,255,.45);
  box-shadow: inset 0 2px 4px rgba(68,41,10,.35);
}
.student-detective-mode .student-step-card .empty {
  border-color: rgba(93,57,23,.42);
  border-radius: 7px;
  background: rgba(241,220,171,.36);
  color: #654a2b;
  font-family: "Courier New", "Malgun Gothic", monospace;
}
.student-desk-props {
  position: fixed;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}
.student-desk-props .student-prop { position: absolute; display: block; pointer-events: none; }
.student-pencil {
  left: max(18px, calc(50% - 650px));
  top: 48%;
  width: 16px;
  height: 210px;
  border: 2px solid #63440f;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(90deg, #674313 0 10%, #d7ad48 12% 42%, #f2d477 44% 62%, #aa7523 65% 88%, #54340c 90%);
  box-shadow: inset 2px 0 rgba(255,255,255,.24), 5px 10px 8px rgba(0,0,0,.44);
  transform: rotate(14deg);
}
.student-pencil::before {
  content: "";
  position: absolute;
  left: -2px;
  top: -29px;
  width: 16px;
  height: 28px;
  background: linear-gradient(90deg, #bf9b64, #ead3a0 48%, #8b673b);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}
.student-pencil::after {
  content: "";
  position: absolute;
  left: 4px;
  top: -29px;
  width: 5px;
  height: 9px;
  background: #28231e;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}
.student-fingerprint {
  right: max(18px, calc(50% - 660px));
  bottom: 38px;
  width: 126px;
  height: 92px;
  border: 1px solid #705024;
  background: linear-gradient(145deg, #e5cf9a, #b89455);
  box-shadow: inset 0 0 15px rgba(73,42,14,.15), 5px 9px 4px rgba(0,0,0,.28), 12px 19px 17px rgba(0,0,0,.36);
  transform: rotate(8deg);
}
.student-fingerprint::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 13px;
  width: 54px;
  height: 62px;
  border-radius: 50%;
  background: repeating-radial-gradient(ellipse at 50% 58%, transparent 0 3px, rgba(103,39,31,.55) 4px 5px);
  opacity: .74;
  transform: rotate(-8deg);
}
.student-fingerprint::after {
  content: "PRINT / ID";
  position: absolute;
  right: 8px;
  bottom: 8px;
  color: #704b27;
  font: 900 8px/1 "Courier New", monospace;
  letter-spacing: .08em;
}
.student-brass-clip {
  right: max(22px, calc(50% - 630px));
  top: 36%;
  width: 24px;
  height: 67px;
  border: 4px solid #a67a2c;
  border-bottom-color: transparent;
  border-radius: 14px 14px 7px 7px;
  filter: drop-shadow(3px 6px 4px rgba(0,0,0,.4));
  transform: rotate(-11deg);
}
.student-brass-clip::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  width: 8px;
  height: 48px;
  border: 2px solid #e1bc61;
  border-bottom-color: transparent;
  border-radius: 7px 7px 4px 4px;
}

@media (max-width: 980px) {
  .student-detective-mode .student-hero { grid-template-columns: minmax(0, 1.25fr) minmax(245px, .75fr); }
  .student-detective-mode .student-class-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-detective-mode .student-activity-grid { grid-template-columns: minmax(0, 1fr) 280px; }
  .student-pencil { left: 5px; opacity: .75; }
  .student-fingerprint { right: 4px; opacity: .78; }
  .student-brass-clip { right: 5px; }
}

@media (max-width: 780px) {
  .student-detective-mode .student-wrap { width: min(100% - 18px, 740px); padding-top: 18px; }
  .student-detective-mode .student-hero,
  .student-detective-mode .student-activity-grid { grid-template-columns: 1fr; }
  .student-detective-mode .student-case-header { min-height: 0; padding: 27px 22px 23px; }
  .student-detective-mode .student-case-header::before { display: none; }
  .student-detective-mode .student-case-header h1 { font-size: clamp(39px, 10vw, 58px); }
  .student-detective-mode #navButtons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .student-detective-mode #navButtons .student-nav-tab { min-width: 0; padding-inline: 9px; }
  .student-detective-mode .student-id-card { min-height: 0; transform: none; }
  .student-detective-mode .student-step-card { min-height: 0; padding: 28px 21px 31px; }
  .student-detective-mode .student-class-grid { grid-template-columns: 1fr 1fr; }
  .student-detective-mode .student-team-card .topic-head { align-items: stretch; flex-direction: column; }
  .student-detective-mode .create-team-stamp { width: 100%; }
  .student-detective-mode .inline-profile-form { grid-template-columns: 1fr; margin-top: 25px; }
  .student-detective-mode .student-entry-stamp { width: 100%; }
  .student-detective-mode .student-data-card,
  .student-detective-mode .student-score-ledger { min-height: 0; }
  .student-desk-props { position: absolute; z-index: 1; min-height: 100%; }
  .student-pencil { left: 5px; top: 690px; height: 145px; transform: scale(.78) rotate(14deg); transform-origin: top left; opacity: .5; }
  .student-fingerprint { right: 8px; bottom: 13px; transform: scale(.76) rotate(8deg); transform-origin: right bottom; opacity: .64; }
  .student-brass-clip { right: 8px; top: 570px; transform: scale(.8) rotate(-11deg); opacity: .7; }
}

@media (max-width: 520px) {
  .student-detective-mode .student-wrap { padding-bottom: 60px; }
  .student-detective-mode #navButtons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-detective-mode .student-class-grid { grid-template-columns: 1fr; }
  .student-detective-mode .student-step-card h2 { font-size: 25px; }
  .student-detective-mode .team-chip-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-detective-mode .team-chip { width: 100%; min-width: 0; padding-inline: 13px; }
  .student-detective-mode .compact-topic-row { grid-template-columns: 1fr minmax(110px, .85fr); }
  .student-detective-mode .compact-topic-row .tiny { grid-column: 2; text-align: right; }
  .student-detective-mode .submit-actions { display: grid; grid-template-columns: 1fr; }
  .student-detective-mode .student-submit-stamp,
  .student-detective-mode #editValuesBtn { width: 100%; }
  .student-desk-props { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .student-detective-mode #navButtons .student-nav-tab,
  .student-detective-mode .choice-card,
  .student-detective-mode .team-chip,
  .student-detective-mode .create-team-stamp,
  .student-detective-mode .student-entry-stamp,
  .student-detective-mode .student-submit-stamp { transition: none; }
}

/* The entry dossier reveals teams in place; later screens must stay strictly hidden. */
.student-detective-mode .screen[hidden],
.student-detective-mode .student-team-section[hidden] { display: none !important; }
.student-detective-mode .student-entry-card { min-height: 390px; }
.student-detective-mode .student-step-guide {
  max-width: 720px;
  margin: -4px 0 25px;
  color: #654a2b;
  font: 800 13px/1.6 "Courier New", "Malgun Gothic", monospace;
}
.student-detective-mode .student-entry-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: #352617;
  font: 900 20px/1.2 "Courier New", "Malgun Gothic", monospace;
}
.student-detective-mode .student-entry-section-title span {
  display: inline-grid;
  width: 34px;
  height: 28px;
  place-items: center;
  border: 1px solid #65430f;
  border-radius: 4px;
  background: linear-gradient(180deg, #dfbd68, #926522);
  color: #281907;
  font-size: 11px;
  box-shadow: inset 0 1px rgba(255,255,255,.45), inset 0 -3px rgba(55,33,6,.26), 0 3px 5px rgba(65,38,12,.18);
}
.student-detective-mode .student-team-section {
  position: relative;
  margin-top: 34px;
  border-top: 2px dashed rgba(103,65,27,.42);
  padding-top: 30px;
}
.student-detective-mode .student-team-section::before {
  content: "NEXT EVIDENCE";
  position: absolute;
  top: -7px;
  right: 10px;
  padding: 0 8px;
  background: #d3b77c;
  color: rgba(92,56,22,.6);
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .12em;
}
.student-detective-mode .student-selected-class {
  margin: 3px 0 0 44px;
  color: #77552e;
  font: 800 12px/1.4 "Courier New", "Malgun Gothic", monospace;
}
.student-detective-mode .student-team-section .team-chip-grid { margin-top: 22px; }
.student-profile-backdrop {
  background:
    radial-gradient(ellipse at 50% 44%, rgba(219,179,94,.2), rgba(13,18,23,.65) 48%, rgba(2,4,7,.94) 100%),
    rgba(3,6,9,.88);
  backdrop-filter: blur(5px) saturate(.75);
}
.student-profile-backdrop .student-profile-modal {
  position: relative;
  isolation: isolate;
  width: min(680px, 100%);
  border: 9px solid #342018;
  border-radius: 16px;
  padding: 38px 38px 32px;
  background:
    radial-gradient(ellipse at 18% 18%, rgba(86,45,17,.08), transparent 22%),
    repeating-linear-gradient(9deg, transparent 0 18px, rgba(72,42,16,.026) 19px, transparent 20px 32px),
    linear-gradient(145deg, #ead7aa, #d1b477 58%, #b99455);
  color: #2b2115;
  box-shadow: inset 0 0 0 2px #bc9144, inset 0 0 0 5px #15100d, inset 0 0 28px rgba(73,41,14,.22), 0 28px 80px rgba(0,0,0,.72);
}
.student-profile-backdrop .student-profile-modal::before {
  content: "";
  position: absolute;
  inset: 14px;
  z-index: -1;
  border: 1px solid rgba(85,51,20,.34);
  border-radius: 7px;
  box-shadow: inset 0 0 18px rgba(72,41,14,.12);
}
.student-profile-backdrop .student-modal-label {
  width: max-content;
  margin: 0 0 15px;
  border: 1px solid #50350f;
  border-radius: 4px;
  padding: 8px 12px 7px;
  background: linear-gradient(180deg, #dfbd68, #946722);
  color: #251707;
  font: 900 10px/1 "Courier New", monospace;
  letter-spacing: .14em;
  box-shadow: inset 0 1px rgba(255,255,255,.48), inset 0 -3px rgba(54,32,6,.27), 0 4px 7px rgba(54,32,10,.2);
}
.student-profile-backdrop .student-profile-modal h2 {
  margin-bottom: 7px;
  color: #2c2115;
  font: 900 clamp(26px, 4vw, 37px)/1.15 Rockwell, Georgia, "Malgun Gothic", serif;
}
.student-profile-backdrop .student-modal-team {
  margin: 0 0 24px;
  color: #7b2b25;
  font: 900 14px/1.4 "Courier New", "Malgun Gothic", monospace;
}
.student-profile-backdrop .inline-profile-form {
  display: grid;
  grid-template-columns: 130px minmax(200px, 1fr);
  gap: 15px;
  margin: 0;
}
.student-profile-backdrop .inline-profile-form label {
  gap: 8px;
  color: #4c361e;
  font: 900 12px/1 "Courier New", "Malgun Gothic", monospace;
}
.student-profile-backdrop .inline-profile-form input {
  min-height: 58px;
  border: 2px solid #83602b;
  border-radius: 7px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #c8aa70, #ead4a3 34%, #dfc58f);
  color: #302315;
  font: 900 17px/1.2 "Courier New", "Malgun Gothic", monospace;
  box-shadow: inset 0 4px 9px rgba(67,39,13,.25), inset 0 -1px rgba(255,255,255,.48);
}
.student-profile-backdrop .student-profile-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 9px;
  border-top: 1px dashed rgba(89,54,22,.38);
  padding-top: 19px;
}
.student-profile-backdrop .student-profile-actions .secondary {
  min-width: 110px;
  border: 2px solid #735722;
  border-radius: 7px;
  background: linear-gradient(180deg, #5a4030, #2b1b16);
  color: #ead29c;
  font-family: "Courier New", "Malgun Gothic", monospace;
  box-shadow: inset 0 1px rgba(255,255,255,.09), 0 4px 0 #17100b, 0 8px 12px rgba(0,0,0,.23);
}
.student-profile-backdrop .student-entry-stamp { min-width: 150px; }

@media (max-width: 780px) {
  .student-detective-mode .student-entry-card { min-height: 0; }
  .student-detective-mode .student-team-section .topic-head { align-items: stretch; flex-direction: column; }
  .student-detective-mode .student-selected-class { margin-left: 0; }
  .student-profile-backdrop { padding: 12px; }
  .student-profile-backdrop .student-profile-modal { border-width: 7px; padding: 31px 23px 25px; }
}

@media (max-width: 520px) {
  .student-detective-mode .student-entry-section-title { font-size: 17px; }
  .student-profile-backdrop .inline-profile-form { grid-template-columns: 1fr; }
  .student-profile-backdrop .student-profile-actions { grid-column: auto; display: grid; grid-template-columns: 1fr 1fr; }
  .student-profile-backdrop .student-profile-actions button { min-width: 0; width: 100%; }
}

/* Student game waiting room: a sealed case file between the assignment panel and field ledgers. */
.student-detective-mode .student-waiting-envelope { display: none; }
.student-detective-mode.student-game-mode #gameStudentScreen {
  min-height: calc(100vh - 54px);
  grid-template-rows: auto auto auto;
  gap: 22px;
  align-content: start;
  padding: 4px 0 80px;
}
.student-detective-mode.student-game-mode .student-topic-banner {
  position: relative;
  isolation: isolate;
  min-height: 126px;
  overflow: hidden;
  border: 3px solid #9c7432;
  border-radius: 13px;
  padding: 37px 70px 29px;
  background:
    radial-gradient(circle at 22px 22px, #efd078 0 3px, #6b4715 4px 6px, transparent 7px),
    radial-gradient(circle at calc(100% - 22px) 22px, #efd078 0 3px, #6b4715 4px 6px, transparent 7px),
    radial-gradient(circle at 22px calc(100% - 22px), #c89b42 0 3px, #563510 4px 6px, transparent 7px),
    radial-gradient(circle at calc(100% - 22px) calc(100% - 22px), #c89b42 0 3px, #563510 4px 6px, transparent 7px),
    repeating-linear-gradient(96deg, rgba(255,255,255,.022) 0 1px, transparent 2px 8px),
    linear-gradient(145deg, #243442, #111b26 62%, #090f16);
  color: #e7cf95;
  font: 900 clamp(30px, 5vw, 52px)/1.1 "Courier New", "Malgun Gothic", monospace;
  letter-spacing: -.035em;
  text-shadow: 0 2px #030609, 0 0 15px rgba(225,184,93,.2);
  box-shadow: inset 0 0 0 3px #080d13, inset 0 0 0 6px rgba(191,151,68,.34), inset 0 16px 25px rgba(255,255,255,.025), inset 0 -20px 31px rgba(0,0,0,.4), 0 15px 30px rgba(0,0,0,.4);
}
.student-detective-mode.student-game-mode .student-topic-banner::before {
  content: "AWAITING CASE ASSIGNMENT";
  position: absolute;
  top: 15px;
  left: 50%;
  color: rgba(201,166,86,.55);
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .2em;
  transform: translateX(-50%);
  white-space: nowrap;
}
.student-detective-mode.student-game-mode .student-topic-banner::after {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: -1;
  border: 1px dashed rgba(211,174,89,.24);
  border-radius: 6px;
  pointer-events: none;
}
.student-detective-mode.student-waiting-mode .student-topic-banner {
  animation: studentWaitingGlow 2.3s ease-in-out infinite;
}
.student-detective-mode.student-waiting-mode .student-waiting-envelope {
  position: relative;
  isolation: isolate;
  width: min(470px, 68vw);
  height: 285px;
  display: grid;
  place-items: center;
  justify-self: center;
  margin: 28px auto 34px;
  border: 2px solid #735020;
  border-radius: 5px 8px 7px 5px;
  background:
    radial-gradient(ellipse at 22% 22%, rgba(91,49,18,.1), transparent 21%),
    repeating-linear-gradient(10deg, transparent 0 17px, rgba(78,45,16,.03) 18px, transparent 19px 31px),
    linear-gradient(154deg, #ead6a2, #c6a466 62%, #a98143);
  box-shadow: inset 0 0 28px rgba(70,39,13,.23), inset 0 -12px 24px rgba(80,47,17,.12), 7px 12px 4px rgba(0,0,0,.25), 20px 29px 30px rgba(0,0,0,.43);
  clip-path: polygon(0 2%, 7% 0, 15% 1%, 24% 0, 34% 1%, 45% 0, 56% 1%, 68% 0, 79% 1%, 90% 0, 100% 2%, 99% 18%, 100% 38%, 99% 58%, 100% 79%, 99% 99%, 88% 100%, 74% 99%, 61% 100%, 47% 99%, 33% 100%, 18% 99%, 0 100%, 1% 78%, 0 55%, 1% 31%);
  transform: rotate(-1.4deg);
}
.student-detective-mode.student-waiting-mode .student-waiting-envelope::before,
.student-detective-mode.student-waiting-mode .student-waiting-envelope::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.student-detective-mode.student-waiting-mode .student-waiting-envelope::before {
  background: linear-gradient(31deg, transparent 49.5%, rgba(100,68,31,.38) 50%, transparent 50.7%), linear-gradient(-31deg, transparent 49.5%, rgba(100,68,31,.38) 50%, transparent 50.7%);
  clip-path: polygon(0 0, 100% 0, 50% 69%);
}
.student-detective-mode.student-waiting-mode .student-waiting-envelope::after {
  inset: 12px;
  border: 1px dashed rgba(89,56,23,.36);
  border-radius: 3px;
}
.student-detective-mode .student-waiting-envelope strong {
  position: relative;
  z-index: 2;
  border: 7px double rgba(131,38,31,.77);
  padding: 15px 24px 11px;
  color: rgba(137,38,31,.8);
  font: 900 clamp(31px, 6vw, 55px)/1 "Courier New", monospace;
  letter-spacing: .04em;
  text-shadow: 1px 1px rgba(90,30,25,.12);
  box-shadow: inset 0 0 0 2px rgba(135,39,31,.12);
  mask-image: repeating-linear-gradient(102deg, #000 0 7px, rgba(0,0,0,.67) 8px, #000 11px);
  transform: rotate(-7deg);
}
.student-detective-mode .student-waiting-envelope small {
  position: absolute;
  left: 22px;
  bottom: 20px;
  color: #704e29;
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .13em;
}
.student-detective-mode .student-envelope-string {
  position: absolute;
  top: 34px;
  right: 40px;
  width: 42px;
  height: 42px;
  border: 6px double #815d27;
  border-radius: 50%;
  background: radial-gradient(circle, #ba9148 0 18%, #65441b 20% 28%, #d0aa5c 31% 42%, transparent 44%);
  box-shadow: 2px 4px 5px rgba(60,35,12,.25);
}
.student-detective-mode .student-envelope-string::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 34px;
  width: 2px;
  height: 123px;
  background: #6f4925;
  box-shadow: 1px 0 rgba(246,220,167,.22);
  transform: rotate(13deg);
  transform-origin: top;
}
.student-detective-mode.student-game-mode .student-game-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 355px);
  gap: 18px;
  align-items: stretch;
}
.student-detective-mode.student-game-mode .student-game-file {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid #765523;
  border-radius: 5px 11px 7px 5px;
  padding: 29px 30px 32px;
  background:
    radial-gradient(ellipse at 14% 17%, rgba(84,44,16,.085), transparent 20%),
    radial-gradient(ellipse at 82% 77%, rgba(74,39,15,.065), transparent 20%),
    repeating-linear-gradient(9deg, transparent 0 18px, rgba(72,42,16,.026) 19px, transparent 20px 32px),
    linear-gradient(145deg, #ead7aa, #d4b97e 58%, #bc985b);
  color: #2d2216;
  box-shadow: inset 0 0 26px rgba(76,43,15,.19), 0 18px 34px rgba(0,0,0,.38);
  clip-path: polygon(0 2%, 5% 0, 12% 1%, 20% 0, 29% 1%, 39% 0, 49% 1%, 60% 0, 71% 1%, 82% 0, 92% 1%, 100% 2%, 99% 22%, 100% 46%, 99% 69%, 100% 99%, 88% 100%, 74% 99%, 61% 100%, 47% 99%, 32% 100%, 17% 99%, 0 100%, 1% 77%, 0 54%, 1% 29%);
}
.student-detective-mode.student-game-mode .student-game-file::before {
  content: "FIELD REPORT";
  position: absolute;
  right: 25px;
  top: 18px;
  color: rgba(105,66,28,.4);
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .14em;
}
.student-detective-mode.student-game-mode .student-game-file h2 {
  color: #2b2014;
  font: 900 clamp(24px, 3vw, 32px)/1.15 Rockwell, Georgia, "Malgun Gothic", serif;
  text-shadow: 0 1px rgba(255,247,215,.5);
}
.student-detective-mode.student-game-mode .student-game-file h2 span {
  display: block;
  margin-top: 5px;
  color: #795627;
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .15em;
}
.student-detective-mode.student-game-mode .student-prediction-file #predictionBox > .empty {
  position: relative;
  margin-top: 30px;
  border: 1px solid rgba(92,56,23,.42);
  border-left: 6px solid #8b2b25;
  border-radius: 4px;
  padding: 43px 20px 20px;
  background:
    repeating-linear-gradient(0deg, transparent 0 25px, rgba(81,50,22,.08) 26px 27px),
    rgba(244,225,180,.47);
  color: #4e3820;
  font: 900 15px/1.65 "Courier New", "Malgun Gothic", monospace;
  text-align: left;
  box-shadow: inset 0 0 12px rgba(80,46,15,.09), 2px 4px 7px rgba(64,39,15,.12);
}
.student-detective-mode.student-game-mode .student-prediction-file #predictionBox > .empty::before {
  content: "INVESTIGATION NOTE";
  position: absolute;
  left: 20px;
  top: 16px;
  color: #882e27;
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .15em;
}
.student-detective-mode.student-game-mode .student-game-score-ledger #gameScoreboard { gap: 10px; margin-top: 24px; }
.student-detective-mode.student-game-mode .student-game-score-ledger .score-card.score-row {
  min-height: 66px;
  grid-template-columns: minmax(0, 1fr) 70px;
  border: 2px solid #704d20;
  border-radius: 8px;
  padding: 11px 13px 11px 22px;
  background:
    radial-gradient(circle at 8px 8px, #e2c174 0 2px, #674719 3px, transparent 4px),
    radial-gradient(circle at calc(100% - 8px) calc(100% - 8px), #d4ad58 0 2px, #563514 3px, transparent 4px),
    repeating-linear-gradient(98deg, rgba(255,255,255,.025) 0 2px, transparent 3px 7px),
    linear-gradient(145deg, #503025, #231612 70%);
  color: #f4dfae;
  box-shadow: inset 0 0 0 3px rgba(19,10,8,.58), inset 0 1px 8px rgba(255,255,255,.08), inset 0 -7px 10px rgba(0,0,0,.25), 3px 6px 9px rgba(58,35,13,.24);
}
.student-detective-mode.student-game-mode .student-game-score-ledger .score-row b {
  color: #f2ddb0;
  font: 900 17px/1.2 "Courier New", "Malgun Gothic", monospace;
  text-shadow: 0 1px #000;
}
.student-detective-mode.student-game-mode .student-game-score-ledger .score-row span {
  min-width: 55px;
  border: 1px inset #b99142;
  border-radius: 5px;
  padding: 7px 4px;
  background: linear-gradient(180deg, #d5bb72, #aa8a43);
  color: #241707;
  font: 900 32px/1 "Courier New", monospace;
  text-shadow: 0 1px rgba(255,255,255,.48);
  box-shadow: inset 0 3px 5px rgba(62,37,9,.34), 0 1px rgba(255,240,174,.32);
}
.student-detective-mode.student-game-mode .student-game-score-ledger .empty {
  border-color: rgba(93,57,23,.42);
  border-radius: 7px;
  background: rgba(241,220,171,.38);
  color: #654a2b;
  font-family: "Courier New", "Malgun Gothic", monospace;
}
.student-detective-mode.student-game-mode .student-pencil {
  left: max(8px, calc(50% - 650px));
  top: 45%;
  filter: drop-shadow(5px 11px 7px rgba(0,0,0,.45));
}
.student-detective-mode.student-game-mode .student-fingerprint {
  right: max(10px, calc(50% - 655px));
  bottom: 25px;
  filter: drop-shadow(7px 14px 10px rgba(0,0,0,.4));
}
.student-detective-mode.student-game-mode .student-brass-clip {
  right: max(13px, calc(50% - 630px));
  top: 61%;
  filter: drop-shadow(4px 8px 5px rgba(0,0,0,.44));
}

@keyframes studentWaitingGlow {
  0%, 100% { color: #d9c28b; filter: brightness(.9); box-shadow: inset 0 0 0 3px #080d13, inset 0 0 0 6px rgba(191,151,68,.3), inset 0 16px 25px rgba(255,255,255,.02), inset 0 -20px 31px rgba(0,0,0,.42), 0 15px 30px rgba(0,0,0,.4), 0 0 8px rgba(218,177,84,.08); }
  50% { color: #f2dda4; filter: brightness(1.08); box-shadow: inset 0 0 0 3px #080d13, inset 0 0 0 6px rgba(226,188,99,.44), inset 0 16px 25px rgba(255,255,255,.035), inset 0 -20px 31px rgba(0,0,0,.35), 0 15px 30px rgba(0,0,0,.4), 0 0 28px rgba(224,181,86,.3); }
}

@media (max-width: 780px) {
  .student-detective-mode.student-game-mode #gameStudentScreen { padding-bottom: 65px; }
  .student-detective-mode.student-game-mode .student-topic-banner { min-height: 112px; padding: 35px 35px 24px; }
  .student-detective-mode.student-waiting-mode .student-waiting-envelope { width: min(430px, 80vw); height: 245px; margin-block: 22px 28px; }
  .student-detective-mode.student-game-mode .student-game-grid { grid-template-columns: 1fr; gap: 16px; }
  .student-detective-mode.student-game-mode .student-game-file { min-height: 0; padding: 27px 23px 30px; }
  .student-detective-mode.student-game-mode .student-pencil { left: 4px; top: 49%; opacity: .56; }
  .student-detective-mode.student-game-mode .student-fingerprint { right: 5px; bottom: 13px; opacity: .68; }
  .student-detective-mode.student-game-mode .student-brass-clip { right: 4px; top: 72%; opacity: .68; }
}

@media (max-width: 520px) {
  .student-detective-mode.student-game-mode #gameStudentScreen { gap: 15px; }
  .student-detective-mode.student-game-mode .student-topic-banner { min-height: 98px; border-width: 2px; padding: 34px 18px 20px; font-size: clamp(24px, 8vw, 36px); }
  .student-detective-mode.student-waiting-mode .student-waiting-envelope { width: 88vw; height: 205px; margin-block: 14px 20px; }
  .student-detective-mode .student-waiting-envelope strong { border-width: 5px; padding: 12px 15px 9px; font-size: clamp(27px, 10vw, 42px); }
  .student-detective-mode .student-envelope-string { top: 24px; right: 26px; transform: scale(.8); transform-origin: top right; }
  .student-detective-mode.student-game-mode .student-game-file::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .student-detective-mode.student-waiting-mode .student-topic-banner { animation: none; }
}

/* Final student game polish: matching timer hardware and a self-contained case report. */
.student-detective-mode.student-game-mode .student-timer {
  position: relative;
  width: max-content;
  min-width: 230px;
  min-height: 100px;
  display: grid;
  place-items: center;
  margin: -5px auto 5px;
  border: 8px solid #76531d;
  border-radius: 9px;
  padding: 26px 24px 13px;
  background:
    radial-gradient(circle at 13px 13px, #f0d27a 0 2px, #654212 3px, transparent 4px),
    radial-gradient(circle at calc(100% - 13px) calc(100% - 13px), #c99c43 0 2px, #50300d 3px, transparent 4px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 2px 5px),
    linear-gradient(180deg, #172424, #080e10);
  color: #f0ca65;
  font: 900 clamp(42px, 7vw, 68px)/1 "Courier New", monospace;
  letter-spacing: .08em;
  text-indent: .08em;
  text-shadow: 0 0 7px rgba(242,198,87,.72), 0 2px #332205;
  box-shadow: inset 0 0 0 2px #c89d43, inset 0 0 17px #000, 0 6px 0 #2e1e09, 0 14px 24px rgba(0,0,0,.5);
}
.student-detective-mode.student-game-mode .student-timer::before {
  content: "ROUND TIMER";
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  color: #9e7b39;
  font: 900 8px/1 "Courier New", monospace;
  letter-spacing: .2em;
  text-align: center;
  text-indent: 0;
  text-shadow: none;
}
.student-detective-mode.student-game-mode .student-waiting-envelope {
  display: grid;
  opacity: .28;
  filter: saturate(.72);
  transform: scale(.78) rotate(-1.4deg);
  transition: opacity .25s ease, transform .25s ease, filter .25s ease;
}
.student-detective-mode.student-waiting-mode .student-waiting-envelope {
  opacity: 1;
  filter: none;
  transform: rotate(-1.4deg);
}
.student-result-backdrop {
  overflow-y: auto;
  padding-block: 20px;
}
.student-result-backdrop .result-card {
  max-height: none;
  overflow: hidden;
  scrollbar-width: none;
}
.student-result-backdrop .result-card::-webkit-scrollbar { display: none; }
.student-result-backdrop .result-card::after { content: "STUDENT COPY · CASE CLOSED"; }
.student-result-backdrop .answer-value {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: .18em;
  max-width: 100%;
  white-space: nowrap;
}
.student-result-backdrop .answer-value-number { line-height: .9; }
.student-result-backdrop .answer-value-unit {
  flex: 0 0 auto;
  color: #e8c765;
  font-size: .42em;
  line-height: 1;
  letter-spacing: .02em;
  text-transform: none;
}
.student-result-backdrop .result-modal-actions {
  justify-content: flex-end;
  margin-top: 24px;
}
.student-result-backdrop .student-result-close {
  min-width: 200px;
  border-color: #761812;
  background:
    radial-gradient(ellipse at 31% 16%, rgba(255,231,201,.26), transparent 29%),
    repeating-linear-gradient(96deg, rgba(255,255,255,.025) 0 1px, transparent 2px 7px),
    linear-gradient(145deg, #dc5045, #97241d 61%, #54100d);
  box-shadow: inset 0 0 0 2px rgba(69,12,8,.3), inset 0 2px rgba(255,255,255,.21), inset 0 -7px rgba(51,7,5,.44), 0 6px 0 #4a100c, 0 13px 21px rgba(68,22,13,.38), 0 0 22px rgba(180,46,36,.2);
}
.student-result-backdrop .student-result-close::after {
  content: " · CASE CLOSED";
  color: rgba(255,229,189,.78);
}

@media (max-width: 780px) {
  .student-detective-mode.student-game-mode .student-timer { min-width: 210px; min-height: 88px; border-width: 7px; padding: 24px 18px 12px; }
  .student-detective-mode.student-game-mode .student-waiting-envelope { transform: scale(.72) rotate(-1.4deg); margin-block: 4px 12px; }
  .student-detective-mode.student-waiting-mode .student-waiting-envelope { transform: rotate(-1.4deg); margin-block: 22px 28px; }
  .student-result-backdrop { align-items: start; }
  .student-result-backdrop .result-card { margin: auto; }
}

@media (max-width: 520px) {
  .student-detective-mode.student-game-mode .student-timer { min-width: 190px; min-height: 80px; border-width: 6px; font-size: clamp(38px, 13vw, 54px); }
  .student-detective-mode.student-game-mode .student-waiting-envelope { width: 88vw; height: 205px; transform: scale(.68) rotate(-1.4deg); margin-block: -8px 2px; }
  .student-detective-mode.student-waiting-mode .student-waiting-envelope { transform: rotate(-1.4deg); margin-block: 14px 20px; }
  .student-result-backdrop { padding: 9px; }
  .student-result-backdrop .result-card { width: 100%; }
  .student-result-backdrop .answer-value { gap: .12em; }
  .student-result-backdrop .answer-value-unit { font-size: .38em; }
  .student-result-backdrop .result-modal-actions { justify-content: stretch; }
  .student-result-backdrop .student-result-close { width: 100%; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .student-detective-mode.student-game-mode .student-waiting-envelope { transition: none; }
}

/* Two-stage student investigation: vote on the statistic before proposing a representative. */
.student-detective-mode.student-game-mode .student-prediction-file { min-height: 560px; }
.student-detective-mode.student-game-mode .prediction-step {
  position: relative;
  padding: 8px 2px 24px;
}
.student-detective-mode.student-game-mode .prediction-step-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 9px;
}
.student-detective-mode.student-game-mode .prediction-step-heading > span {
  flex: 0 0 auto;
  border: 1px solid #5d3e11;
  border-radius: 4px;
  padding: 7px 9px 6px;
  background: linear-gradient(180deg, #dfbd69, #946722);
  color: #281907;
  font: 900 9px/1 "Courier New", monospace;
  letter-spacing: .1em;
  text-shadow: 0 1px rgba(255,244,188,.48);
  box-shadow: inset 0 1px rgba(255,255,255,.48), inset 0 -3px rgba(54,32,6,.28), 0 3px 5px rgba(62,37,11,.18);
}
.student-detective-mode.student-game-mode .prediction-step-heading h3 {
  margin: 0;
  color: #332416;
  font: 900 clamp(18px, 2.5vw, 23px)/1.15 "Courier New", "Malgun Gothic", monospace;
  letter-spacing: -.035em;
}
.student-detective-mode.student-game-mode .prediction-step > p {
  margin: 0 0 15px;
  color: #594024;
  font: 800 13px/1.55 "Courier New", "Malgun Gothic", monospace;
}
.student-detective-mode.student-game-mode .representative-vote-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  margin: 17px 0 13px;
}
.student-detective-mode.student-game-mode .representative-vote-button {
  position: relative;
  min-height: 67px;
  overflow: hidden;
  border: 3px double #684812;
  border-radius: 7px;
  padding: 13px 8px 11px;
  background:
    radial-gradient(ellipse at 36% 20%, rgba(255,244,185,.5) 0 5%, transparent 20%),
    linear-gradient(145deg, #dfbf6d, #a97828 57%, #68440f);
  color: #2a1a08;
  font: 900 clamp(15px, 2.2vw, 20px)/1.1 Georgia, "Malgun Gothic", serif;
  text-shadow: 0 1px rgba(255,246,194,.58);
  box-shadow: inset 0 2px rgba(255,255,255,.44), inset 0 -7px rgba(56,35,6,.32), 0 5px 0 #4b310c, 0 10px 15px rgba(55,32,10,.29);
  transition: transform .13s ease, filter .13s ease, box-shadow .13s ease;
}
.student-detective-mode.student-game-mode .representative-vote-button::before {
  content: "STATISTIC";
  display: block;
  margin-bottom: 6px;
  color: rgba(48,29,6,.54);
  font: 900 7px/1 "Courier New", monospace;
  letter-spacing: .14em;
}
.student-detective-mode.student-game-mode .representative-vote-button:hover { filter: brightness(1.09); transform: translateY(-2px); }
.student-detective-mode.student-game-mode .representative-vote-button:active { transform: translateY(3px); box-shadow: inset 0 4px 8px rgba(58,35,7,.35), 0 2px 0 #4b310c, 0 5px 8px rgba(55,32,10,.24); }
.student-detective-mode.student-game-mode .representative-vote-button.selected {
  border-color: #f0cd77;
  background:
    radial-gradient(ellipse at 31% 16%, rgba(255,232,201,.28), transparent 29%),
    repeating-linear-gradient(96deg, rgba(255,255,255,.025) 0 1px, transparent 2px 7px),
    linear-gradient(145deg, #d84e43, #96241e 61%, #57120e);
  color: #fff0cb;
  text-shadow: 0 2px #4b0b08;
  box-shadow: inset 0 0 0 2px rgba(70,12,8,.34), inset 0 2px rgba(255,255,255,.18), inset 0 -7px rgba(52,7,5,.43), 0 5px 0 #4b100c, 0 0 22px rgba(222,179,83,.48), 0 11px 17px rgba(65,24,13,.34);
}
.student-detective-mode.student-game-mode .representative-vote-button.selected::before {
  content: "VOTED";
  color: rgba(255,226,182,.69);
}
.student-detective-mode.student-game-mode .representative-vote-button:focus-visible,
.student-detective-mode.student-game-mode .representative-proposal-stamp:focus-visible { outline: 3px solid #fff0a7; outline-offset: 4px; }
.student-detective-mode.student-game-mode .representative-vote-status {
  border: 1px solid rgba(91,56,22,.38);
  border-radius: 4px;
  padding: 11px 13px;
  background:
    repeating-linear-gradient(0deg, transparent 0 19px, rgba(83,50,20,.07) 20px 21px),
    rgba(244,225,180,.45);
  color: #564022 !important;
  font-size: 12px !important;
  box-shadow: inset 0 0 9px rgba(72,41,14,.08);
}
.student-detective-mode.student-game-mode .representative-vote-status b { color: #7d2b25; }
.student-detective-mode.student-game-mode .representative-student-step {
  margin-top: 3px;
  border-top: 2px dashed rgba(102,63,25,.46);
  padding-top: 25px;
}
.student-detective-mode.student-game-mode .representative-student-step::before {
  content: "NEXT INVESTIGATION";
  position: absolute;
  top: -6px;
  right: 7px;
  padding: 0 8px;
  background: #d3b77c;
  color: rgba(89,54,21,.55);
  font: 900 8px/1 "Courier New", monospace;
  letter-spacing: .13em;
}
.student-detective-mode.student-game-mode .representative-student-prompt b { color: #942a24; font-size: 1.08em; }
.student-detective-mode.student-game-mode .representative-student-step .prediction-card {
  border: 1px solid rgba(91,55,22,.42);
  border-radius: 6px;
  background: rgba(244,224,177,.42);
  box-shadow: inset 0 0 12px rgba(77,44,14,.1), 2px 4px 7px rgba(61,36,13,.11);
  outline: none;
}
.student-detective-mode.student-game-mode .representative-student-step .prediction-bar { gap: 12px; align-items: end; }
.student-detective-mode.student-game-mode .representative-student-step .prediction-bar label {
  color: #51391f;
  font: 900 12px/1.2 "Courier New", "Malgun Gothic", monospace;
}
.student-detective-mode.student-game-mode .representative-student-step .prediction-bar select {
  min-height: 51px;
  margin-top: 7px;
  border: 2px solid #7d5925;
  border-radius: 6px;
  background: linear-gradient(180deg, #c9aa70, #ead4a3 34%, #dfc58f);
  color: #302315;
  font: 900 15px/1.2 "Courier New", "Malgun Gothic", monospace;
  box-shadow: inset 0 4px 8px rgba(66,38,13,.24), inset 0 -1px rgba(255,255,255,.48);
}
.student-detective-mode.student-game-mode .representative-proposal-stamp {
  min-height: 51px;
  border: 3px double #701812;
  border-radius: 7px;
  padding-inline: 19px;
  background: radial-gradient(ellipse at 31% 16%, rgba(255,226,196,.24), transparent 28%), linear-gradient(145deg, #d54b41, #94231d 61%, #56110e);
  color: #fff0cd;
  font: 900 14px/1 "Courier New", "Malgun Gothic", monospace;
  text-shadow: 0 2px #4c0b08;
  box-shadow: inset 0 0 0 2px rgba(70,12,8,.3), inset 0 2px rgba(255,255,255,.18), inset 0 -6px rgba(52,7,5,.42), 0 5px 0 #4b100c, 0 10px 15px rgba(65,24,13,.31);
}

@media (max-width: 780px) {
  .student-detective-mode.student-game-mode .student-prediction-file { min-height: 0; }
  .student-detective-mode.student-game-mode .representative-vote-buttons { gap: 9px; }
}

@media (max-width: 520px) {
  .student-detective-mode.student-game-mode .representative-vote-buttons { grid-template-columns: 1fr; }
  .student-detective-mode.student-game-mode .representative-vote-button { min-height: 56px; }
  .student-detective-mode.student-game-mode .representative-vote-button::before { display: inline; margin-right: 8px; }
  .student-detective-mode.student-game-mode .representative-student-step::before { display: none; }
  .student-detective-mode.student-game-mode .representative-student-step .prediction-bar { grid-template-columns: 1fr; }
  .student-detective-mode.student-game-mode .representative-proposal-stamp { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .student-detective-mode.student-game-mode .representative-vote-button { transition: none; }
}

/* Dense evidence-entry desk for projector and tablet layouts. */
.student-detective-mode.student-activity-mode .student-case-header h1 {
  color: #d9b865;
  text-shadow: 0 1px rgba(255,244,189,.36), 0 3px #05080c, 0 0 18px rgba(195,154,73,.14);
}
.student-detective-mode.student-activity-mode .student-activity-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(285px, .55fr);
  gap: 22px;
  align-items: start;
  padding-bottom: 105px;
}
.student-detective-mode.student-activity-mode .student-data-card {
  min-height: 680px;
  overflow: visible;
  border-width: 2px;
  padding: 35px 38px 40px;
  background:
    radial-gradient(circle at 19px 19px, #efd078 0 3px, #684414 4px 6px, transparent 7px),
    radial-gradient(circle at calc(100% - 19px) 19px, #efd078 0 3px, #684414 4px 6px, transparent 7px),
    radial-gradient(circle at 19px calc(100% - 19px), #c89b42 0 3px, #52310e 4px 6px, transparent 7px),
    radial-gradient(circle at calc(100% - 19px) calc(100% - 19px), #c89b42 0 3px, #52310e 4px 6px, transparent 7px),
    radial-gradient(ellipse at 14% 13%, rgba(92,49,18,.1), transparent 21%),
    radial-gradient(ellipse at 85% 76%, rgba(80,42,16,.07), transparent 22%),
    repeating-linear-gradient(9deg, transparent 0 18px, rgba(72,42,16,.026) 19px, transparent 20px 32px),
    linear-gradient(145deg, #f0ddb0, #d8bd82 58%, #bd985a);
  box-shadow: inset 0 0 34px rgba(75,42,14,.22), 0 4px 0 rgba(55,33,12,.2), 0 24px 46px rgba(0,0,0,.43);
}
.student-detective-mode.student-activity-mode .student-data-card::before {
  content: "EVIDENCE DATA SHEET · FIELD COPY";
  top: 22px;
  right: 96px;
}
.student-detective-mode.student-activity-mode .student-data-card .topic-head {
  min-height: 54px;
  align-items: center;
  border-bottom: 2px solid rgba(91,56,22,.34);
  padding-bottom: 15px;
}
.student-detective-mode.student-activity-mode .student-data-card h2 {
  margin: 0;
  font-size: clamp(29px, 3.1vw, 40px);
}
.student-detective-mode.student-activity-mode #submitState {
  position: relative;
  flex: 0 0 auto;
  min-width: 82px;
  min-height: 58px;
  justify-content: center;
  border: 5px double #6f261e;
  border-radius: 46% 51% 45% 49%;
  padding: 9px 12px;
  background: radial-gradient(circle at 35% 27%, rgba(255,224,180,.2), transparent 23%), radial-gradient(circle, #ae4637, #77251f 70%);
  color: #f8dfb2;
  font: 900 11px/1.15 "Courier New", "Malgun Gothic", monospace;
  text-align: center;
  text-shadow: 0 1px #410c09;
  box-shadow: inset 0 0 0 2px rgba(68,12,8,.3), inset 0 -5px rgba(51,8,6,.28), 0 4px 0 #50140f, 0 8px 12px rgba(70,30,14,.27);
  transform: rotate(2deg);
}
.student-detective-mode.student-activity-mode .compact-topic-list { gap: 8px; margin-top: 18px; }
.student-detective-mode.student-activity-mode .compact-topic-row {
  grid-template-columns: minmax(190px, 1.12fr) minmax(160px, .88fr) minmax(54px, .26fr);
  min-height: 57px;
  border-color: rgba(92,57,23,.43);
  border-radius: 5px;
  padding: 7px 12px 7px 17px;
  background: linear-gradient(90deg, rgba(89,54,20,.05) 1px, transparent 1px) 0 0/38px 100%, rgba(244,225,180,.34);
  box-shadow: inset 0 0 10px rgba(75,42,14,.08), 1px 3px 5px rgba(61,36,13,.09);
}
.student-detective-mode.student-activity-mode .compact-topic-row strong {
  overflow-wrap: anywhere;
  font: 900 clamp(14px, 1.55vw, 18px)/1.2 Rockwell, Georgia, "Malgun Gothic", serif;
}
.student-detective-mode.student-activity-mode .compact-topic-row input {
  min-height: 42px;
  border-color: #85622d;
  border-radius: 5px;
  padding: 9px 12px;
  background: linear-gradient(180deg, #c3a36a, #efdaad 36%, #dec38e);
  font-size: 16px;
  box-shadow: inset 0 5px 9px rgba(65,37,12,.27), inset 0 -1px rgba(255,255,255,.48), 0 1px rgba(255,245,209,.45);
}
.student-detective-mode.student-activity-mode .compact-topic-row input:disabled {
  background: linear-gradient(180deg, #b59a6c, #d6c49b 38%, #c5ae7c);
  color: #51432f;
}
.student-detective-mode.student-activity-mode .compact-topic-row .tiny {
  color: #5d4529;
  font: 900 12px/1 "Courier New", "Malgun Gothic", monospace;
  text-align: center;
}
.student-detective-mode.student-activity-mode .submit-actions {
  justify-content: flex-end;
  border-top: 1px dashed rgba(91,55,22,.36);
  margin-top: 17px;
  padding-top: 18px;
}
.student-detective-mode.student-activity-mode .student-score-ledger {
  min-height: 305px;
  overflow: visible;
  border: 8px solid #3c2419;
  border-radius: 11px;
  padding: 30px 22px 27px;
  color: #f3dfb0;
  background:
    radial-gradient(circle at 13px 13px, #e8c96d 0 2px, #6b4714 3px, transparent 4px),
    radial-gradient(circle at calc(100% - 13px) calc(100% - 13px), #c99d43 0 2px, #4f300d 3px, transparent 4px),
    repeating-linear-gradient(92deg, rgba(255,255,255,.018) 0 2px, transparent 3px 9px),
    linear-gradient(145deg, #543226, #251613 66%, #160d0b);
  box-shadow: inset 0 0 0 2px #c29542, inset 0 0 0 5px #130b08, inset 0 10px 18px rgba(255,255,255,.035), inset 0 -16px 24px rgba(0,0,0,.3), 0 20px 38px rgba(0,0,0,.42);
  clip-path: none;
}
.student-detective-mode.student-activity-mode .student-score-ledger::before {
  content: "CLASSIFIED LEDGER";
  top: 17px;
  right: 18px;
  color: rgba(219,184,104,.39);
}
.student-detective-mode.student-activity-mode .student-score-ledger h2 { color: #f0dba8; text-shadow: 0 2px #080403; }
.student-detective-mode.student-activity-mode .student-score-ledger h2 span { color: #c49a49; }
.student-detective-mode.student-activity-mode .student-score-ledger #scoreboard { margin-top: 21px; }
.student-detective-mode.student-activity-mode .student-score-ledger .score-card.score-row {
  border-color: #8c6729;
  background:
    radial-gradient(circle at 8px 8px, #efd47e 0 2px, #6a4514 3px, transparent 4px),
    radial-gradient(circle at calc(100% - 8px) calc(100% - 8px), #d1aa54 0 2px, #52320f 3px, transparent 4px),
    repeating-linear-gradient(96deg, rgba(255,255,255,.025) 0 1px, transparent 2px 7px),
    linear-gradient(145deg, #40251e, #1b100d);
  color: #f5dfac;
  box-shadow: inset 0 0 0 3px #100806, inset 0 2px 7px rgba(255,255,255,.07), inset 0 -7px 9px rgba(0,0,0,.3), 0 5px 8px rgba(0,0,0,.25);
}
.student-detective-mode.student-activity-mode .student-score-ledger .score-row span {
  background: linear-gradient(180deg, #e0c477, #a7863e);
  color: #251707;
  font-size: 28px;
  letter-spacing: .06em;
}
.student-detective-mode.student-activity-mode .student-pencil {
  left: max(7px, calc(50% - 635px));
  top: 48%;
  height: 225px;
  opacity: 1;
  filter: drop-shadow(6px 13px 8px rgba(0,0,0,.48));
  transform: rotate(12deg);
}
.student-detective-mode.student-activity-mode .student-brass-clip {
  right: calc(50% - 288px);
  top: 53%;
  opacity: 1;
  filter: drop-shadow(5px 9px 5px rgba(0,0,0,.46));
  transform: rotate(-8deg);
}
.student-detective-mode.student-activity-mode .student-fingerprint {
  right: max(8px, calc(50% - 626px));
  bottom: 28px;
  opacity: 1;
  filter: drop-shadow(8px 16px 12px rgba(0,0,0,.43));
}
.student-detective-mode.student-activity-mode .student-fingerprint::after { content: "75089, 125"; }

@media (max-width: 980px) {
  .student-detective-mode.student-activity-mode .student-activity-grid { grid-template-columns: minmax(0, 1fr) 275px; }
  .student-detective-mode.student-activity-mode .compact-topic-row { grid-template-columns: minmax(135px, 1fr) minmax(125px, .8fr) 50px; }
  .student-detective-mode.student-activity-mode .student-brass-clip { right: 284px; }
}

@media (max-width: 780px) {
  .student-detective-mode.student-activity-mode .student-activity-grid { grid-template-columns: 1fr; padding-bottom: 82px; }
  .student-detective-mode.student-activity-mode .student-data-card { min-height: 0; padding: 31px 22px 34px; }
  .student-detective-mode.student-activity-mode .student-data-card::before { display: none; }
  .student-detective-mode.student-activity-mode .compact-topic-row { grid-template-columns: minmax(130px, 1fr) minmax(125px, .85fr) 52px; }
  .student-detective-mode.student-activity-mode .student-score-ledger { min-height: 0; }
  .student-detective-mode.student-activity-mode .student-pencil { left: 1px; top: 59%; transform: scale(.7) rotate(12deg); transform-origin: left center; opacity: .55; }
  .student-detective-mode.student-activity-mode .student-brass-clip { right: 3px; top: 49%; transform: scale(.78) rotate(-8deg); opacity: .7; }
  .student-detective-mode.student-activity-mode .student-fingerprint { right: 5px; bottom: 10px; transform: scale(.75) rotate(8deg); transform-origin: right bottom; opacity: .65; }
}

@media (max-width: 520px) {
  .student-detective-mode.student-activity-mode .student-data-card .topic-head { align-items: flex-start; }
  .student-detective-mode.student-activity-mode #submitState { min-width: 68px; min-height: 50px; font-size: 9px; }
  .student-detective-mode.student-activity-mode .compact-topic-row { grid-template-columns: 1fr minmax(105px, .72fr); padding-left: 12px; }
  .student-detective-mode.student-activity-mode .compact-topic-row .tiny { grid-column: 2; text-align: right; }
}

/* Final result hierarchy and compact student game flow. */
.result-backdrop .answer-hero {
  grid-template-columns: minmax(250px, .9fr) minmax(340px, 1.25fr);
}
.result-backdrop .answer-hero > div { justify-items: center; text-align: center; }
.result-backdrop .answer-hero b {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: center;
  overflow-wrap: normal;
  white-space: nowrap;
}
.result-backdrop .answer-value {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: .2em;
  max-width: 100%;
  white-space: nowrap;
  color: #ffc95c;
  font: 900 clamp(52px, 8vw, 94px)/.9 "Courier New", Georgia, serif;
  letter-spacing: -.07em;
  text-shadow: 0 2px #402806, 0 0 12px rgba(255,187,55,.48), 0 0 30px rgba(214,146,31,.18);
}
.result-backdrop .answer-value-number { line-height: .9; }
.result-backdrop .answer-value-unit {
  flex: 0 0 auto;
  margin: 0 0 .08em;
  color: #f4d889;
  font-size: .42em;
  line-height: 1;
  letter-spacing: 0;
}
.result-backdrop .rank-card { position: relative; min-height: 86px; padding: 18px 20px; }
.result-backdrop .rank-title { min-height: 44px; }
.result-backdrop .rank-title b { font-size: clamp(20px, 2.5vw, 30px); }
.result-backdrop .rank-detail {
  justify-content: flex-end;
  margin-top: 6px;
  color: #5e4325;
  font-size: 15px;
}
.result-backdrop .rank-first {
  border: 3px double #9b6c1d;
  padding-left: 74px;
  background:
    radial-gradient(circle at 33px 50%, #ffe69a 0 7px, #d3a33d 8px 15px, #6d4310 16px 18px, transparent 19px),
    linear-gradient(135deg, rgba(229,188,93,.67), rgba(255,238,190,.78));
  box-shadow: inset 0 0 0 2px rgba(255,247,204,.42), inset 0 0 20px rgba(117,72,17,.17), 0 7px 0 #6c4817, 0 14px 22px rgba(65,39,12,.28), 0 0 22px rgba(210,163,61,.2);
}
.result-backdrop .rank-first::before {
  content: "1";
  position: absolute;
  left: 19px;
  top: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 3px double #68410d;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe48b, #b77b21);
  color: #342005;
  font: 900 19px/1 Georgia, serif;
  text-shadow: 0 1px rgba(255,246,190,.6);
  box-shadow: inset 0 2px rgba(255,255,255,.48), inset 0 -4px rgba(73,42,5,.28), 0 4px 7px rgba(70,40,10,.3);
  transform: translateY(-50%);
}
.result-backdrop .ranking-guide { margin-bottom: 14px; }
.result-backdrop .award-points-btn {
  min-height: 68px;
  border: 4px double #5f3d0d;
  border-radius: 9px;
  background:
    radial-gradient(ellipse at 32% 16%, rgba(255,250,201,.56), transparent 27%),
    repeating-linear-gradient(96deg, rgba(255,255,255,.035) 0 1px, transparent 2px 7px),
    linear-gradient(180deg, #f3d47c, #b17d2c 57%, #654211);
  color: #281806;
  font: 900 20px/1 "Courier New", "Malgun Gothic", monospace;
  letter-spacing: .08em;
  text-shadow: 0 1px rgba(255,245,188,.7);
  box-shadow: inset 0 2px rgba(255,255,255,.5), inset 0 -8px rgba(55,32,5,.35), 0 7px 0 #49300d, 0 14px 22px rgba(63,37,11,.34), 0 0 22px rgba(189,139,39,.16);
}
.result-backdrop .award-points-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.result-backdrop .award-points-btn:active { transform: translateY(5px); box-shadow: inset 0 5px 9px rgba(63,36,7,.37), 0 2px 0 #49300d, 0 6px 9px rgba(63,37,11,.26); }
.result-backdrop .result-close {
  min-width: 214px;
  display: grid;
  gap: 5px;
  justify-items: center;
  padding: 12px 22px 11px;
}
.result-backdrop .result-close > span { font-size: 17px; }
.result-backdrop .result-close > small { color: rgba(255,226,184,.8); font: 900 8px/1 "Courier New", monospace; letter-spacing: .14em; }
.result-backdrop .result-close::after { content: none; }

.student-detective-mode.student-game-mode #gameStudentScreen {
  grid-template-rows: auto auto auto;
  gap: 10px;
  padding-top: 2px;
}
.student-detective-mode.student-game-mode .student-topic-banner { margin-bottom: 0; }
.student-detective-mode.student-game-mode .student-timer { margin: 2px auto 3px; }
.student-detective-mode.student-game-mode .student-game-grid { margin-top: 2px; }
.student-detective-mode .student-waiting-envelope { display: none !important; }

@media (max-width: 780px) {
  .result-backdrop .answer-hero { grid-template-columns: 1fr; }
  .result-backdrop .answer-value { font-size: clamp(48px, 14vw, 78px); }
  .result-backdrop .rank-first { padding-left: 64px; }
  .student-detective-mode.student-game-mode #gameStudentScreen { gap: 8px; }
}

@media (max-width: 520px) {
  .result-backdrop .answer-value { gap: .12em; font-size: clamp(43px, 15vw, 65px); }
  .result-backdrop .rank-card { padding: 14px 13px; }
  .result-backdrop .rank-first { padding-left: 57px; }
  .result-backdrop .rank-first::before { left: 13px; width: 29px; height: 29px; }
  .result-backdrop .result-close { min-width: 0; }
}
