:root {
  --bottom-nav-height: 72px;
  --bg-dark: #0d0d0d;
  --panel-dark: #181818;
  --panel-deep: #0f0f0e;
  --cork: #754b2b;
  --cork-dark: #472b1b;
  --paper: #d8c6a2;
  --paper-light: #efe2c2;
  --yellow: #e6a927;
  --yellow-light: #f3c65c;
  --red: #a92c23;
  --green: #5e8c3d;
  --gold: #c69b4b;
  --text-dark: #201a13;
  --text-light: #f5ead5;
  --muted: #bba98b;
  --shadow: rgba(0, 0, 0, 0.58);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Impact, "Arial Narrow", "Franklin Gothic Condensed", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--text-light);
  background:
    radial-gradient(circle at 50% 0, rgba(215, 169, 85, 0.22), transparent 360px),
    linear-gradient(135deg, #060707, #18120f 54%, #050505);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

#game-app {
  width: min(100vw, 430px);
  height: 100dvh;
  max-height: 932px;
  overflow: hidden;
  position: relative;
  margin: auto;
  background:
    radial-gradient(circle at 50% 5%, rgba(240, 193, 103, 0.23), transparent 250px),
    radial-gradient(circle at 30% 38%, rgba(112, 72, 42, 0.24), transparent 270px),
    linear-gradient(#111311, #070707 60%, #14100d);
  box-shadow: 0 0 0 1px rgba(198, 155, 75, 0.28), 0 24px 70px rgba(0,0,0,0.8);
}

#game-app::before,
#game-app::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

#game-app::before {
  background: radial-gradient(circle at center, transparent 58%, rgba(0,0,0,0.72));
}

#game-app::after {
  opacity: 0.35;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 50% 0, rgba(255, 222, 143, 0.12), transparent 280px);
}

#screen-container {
  position: relative;
  z-index: 2;
  height: calc(100% - var(--bottom-nav-height) - var(--safe-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  padding: calc(10px + var(--safe-top)) 10px 12px;
  scrollbar-width: none;
}

#screen-container::-webkit-scrollbar {
  width: 0;
  height: 0;
}

#bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid;
  background: linear-gradient(rgba(28, 23, 18, 0.98), rgba(12, 10, 9, 0.98));
  box-shadow: inset 0 1px 0 rgba(229, 184, 95, 0.25), 0 -10px 22px rgba(0,0,0,0.45);
}

#bottom-nav.home {
  grid-template-columns: repeat(3, 1fr);
}

#bottom-nav.case {
  grid-template-columns: repeat(4, 1fr);
}

#bottom-nav.hidden {
  display: none;
}

.screen {
  min-height: 100%;
  animation: screenIn 180ms ease-out;
}

.hud {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.case-hud {
  height: 56px;
  padding: 6px 7px;
  border-radius: 8px;
  background: rgba(17, 15, 13, 0.94);
  box-shadow: inset 0 0 0 1px rgba(198,155,75,0.25), 0 8px 16px rgba(0,0,0,0.45);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--text-light);
  background: linear-gradient(#493b2a, #1d1813);
  box-shadow: inset 0 0 0 2px rgba(239, 210, 158, 0.24), 0 5px 12px rgba(0,0,0,0.55);
  display: grid;
  place-items: center;
  font-size: 0;
}

.icon-btn::before {
  content: attr(data-icon);
  font-size: 24px;
  line-height: 1;
}

.back-btn::before {
  content: "";
  width: 14px;
  height: 14px;
  border-left: 4px solid currentColor;
  border-bottom: 4px solid currentColor;
  transform: rotate(45deg);
  margin-left: 5px;
}

.settings-icon::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 5px dotted #eadabc;
  box-shadow: inset 0 0 0 4px #eadabc;
}

.energy {
  min-height: 36px;
  padding: 5px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 20px;
  background: rgba(12, 11, 10, 0.88);
  box-shadow: inset 0 0 0 1px rgba(198,155,75,0.32), 0 6px 14px rgba(0,0,0,0.52);
  font-size: 20px;
}

.bolt,
.hint-icon,
.timer-icon,
.note-icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  position: relative;
  flex: 0 0 auto;
}

.bolt {
  background: var(--yellow-light);
  clip-path: polygon(45% 0, 100% 0, 66% 43%, 98% 43%, 36% 100%, 49% 55%, 14% 55%);
}

.plus {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(#78bd34, #3f8a21);
  color: white;
  font-size: 24px;
}

.timer,
.hints {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 18px;
  background: rgba(10, 9, 8, 0.9);
  box-shadow: inset 0 0 0 1px rgba(198,155,75,0.24);
  font-size: clamp(15px, 4vw, 18px);
}

.timer {
  color: #ff4a36;
}

.timer.danger {
  animation: dangerPulse 700ms ease-in-out infinite;
}

.timer-icon {
  border: 3px solid currentColor;
  border-radius: 50%;
}

.timer-icon::before,
.timer-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3px;
  width: 2px;
  height: 7px;
  background: currentColor;
  transform-origin: bottom;
}

.timer-icon::after {
  transform: rotate(92deg);
  top: 8px;
  height: 6px;
}

.hint-icon {
  border-radius: 50% 50% 44% 44%;
  background: var(--yellow-light);
}

.hint-icon::after {
  content: "";
  position: absolute;
  left: 6px;
  bottom: -3px;
  width: 8px;
  height: 5px;
  background: #b47516;
}

.case-title {
  flex: 1;
  min-width: 0;
}

.case-title small {
  display: block;
  color: var(--gold);
  font-size: 10px;
}

.case-title strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
}

.home-logo {
  height: 232px;
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.85));
}

.lamp {
  position: absolute;
  top: -16px;
  left: 50%;
  width: 120px;
  height: 62px;
  transform: translateX(-50%);
  border-radius: 0 0 66px 66px;
  background: linear-gradient(#243432 0 45%, #07100f 46%);
  box-shadow: 0 28px 72px rgba(230, 169, 39, 0.22);
}

.lamp::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 48px;
  height: 20px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #f3d28b;
  animation: lampGlow 3s ease-in-out infinite;
}

.title-stack {
  margin-top: 42px;
}

.premium-logo-art {
  width: min(360px, 96%);
  height: clamp(132px, 20dvh, 174px);
  margin-top: 36px;
  background: url("./premium-logo.png") center / contain no-repeat;
  filter:
    drop-shadow(0 10px 12px rgba(0,0,0,0.86))
    drop-shadow(0 0 18px rgba(226,160,57,0.16));
}

.title-stack .word {
  display: block;
  font-size: clamp(42px, 14.2vw, 62px);
  line-height: 0.82;
  color: #f3eee2;
  text-transform: uppercase;
}

.title-stack .logic {
  color: #cf251c;
  font-size: clamp(50px, 17vw, 78px);
  text-shadow: 0 4px 0 #4c100c;
}

.fingerprint {
  display: inline-grid;
  width: 0.7em;
  height: 0.7em;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 16%, #14100d 17% 22%, transparent 23% 29%, #14100d 30% 35%, transparent 36% 43%, #14100d 44% 49%, transparent 50%),
    #c8231b;
  vertical-align: -0.02em;
}

.mag {
  display: inline-block;
  width: 0.76em;
  height: 0.76em;
  margin-left: 6px;
  border: 7px solid #e9dfc9;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle at 35% 28%, rgba(255,255,255,0.9), #303633 45%, #111 74%);
  vertical-align: -0.08em;
}

.mag::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 9px;
  right: -31px;
  bottom: -14px;
  border-radius: 10px;
  background: linear-gradient(90deg, #e6dfce, #2b2926 42%, #111);
  transform: rotate(42deg);
}

.tagline {
  display: inline-block;
  margin-top: -6px;
  padding: 5px 13px 4px;
  color: #18120d;
  background: linear-gradient(#ead8aa, #b9985e);
  transform: rotate(-2deg);
  font-size: clamp(14px, 4vw, 18px);
  box-shadow: 0 5px 10px rgba(0,0,0,0.52);
}

.cork-board {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 15%, rgba(255,255,255,0.08), transparent 1px),
    radial-gradient(circle at 70% 38%, rgba(0,0,0,0.14), transparent 1px),
    repeating-linear-gradient(38deg, rgba(255,255,255,0.025) 0 2px, transparent 2px 6px),
    linear-gradient(135deg, var(--cork), var(--cork-dark));
  border: 3px solid #25170f;
  box-shadow: inset 0 0 0 2px rgba(229, 174, 88, 0.14), 0 12px 28px rgba(0,0,0,0.62);
}

.home-board {
  height: 260px;
  margin-top: 0;
}

.paper,
.photo,
.clue,
.suspect-card,
.brief-card,
.notebook,
.accuse-panel,
.result-card,
.modal-paper {
  color: var(--text-dark);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.24), transparent 36%),
    repeating-linear-gradient(0deg, rgba(66,45,24,0.035) 0 1px, transparent 1px 5px),
    linear-gradient(var(--paper-light), var(--paper));
  box-shadow: 0 6px 10px rgba(0,0,0,0.48), inset 0 0 0 1px rgba(255,255,255,0.34);
}

.paper {
  position: absolute;
  width: 94px;
  min-height: 68px;
  padding: 8px 7px;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 10px;
}

.paper b {
  display: block;
  color: #842219;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: 13px;
  margin-bottom: 3px;
}

.pin {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ff8c64, #c83224 48%, #6c1711);
  box-shadow: 0 2px 5px rgba(0,0,0,0.65);
  z-index: 5;
}

.photo {
  position: absolute;
  padding: 6px;
  text-align: center;
  font-size: 11px;
}

.victim-photo {
  left: 50%;
  top: 12px;
  width: 118px;
  transform: translateX(-50%) rotate(1deg);
}

.placeholder-img,
.portrait,
.victim-portrait,
.clue-img,
.mini-img {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 45% 24%, rgba(255,255,255,0.2), transparent 18%),
    linear-gradient(145deg, #41362d, #151515);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14);
}

.placeholder-img {
  height: 76px;
}

.victim-portrait {
  height: 76px;
  background-image: url("./premium-suspect-portraits.png");
  background-size: 205% 205%;
  background-position: 99% 0%;
  background-repeat: no-repeat;
  filter: saturate(0.9) contrast(1.08) brightness(0.88);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.16),
    inset 0 -24px 34px rgba(0,0,0,0.34);
}

.victim-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(110deg, transparent 0 44%, rgba(185, 34, 27, 0.72) 45% 47%, transparent 48%),
    linear-gradient(16deg, transparent 0 58%, rgba(185, 34, 27, 0.68) 59% 61%, transparent 62%),
    radial-gradient(circle at 50% 20%, transparent, rgba(0,0,0,0.18) 68%);
}

.person::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 60%;
  height: 74%;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 50% 18%, #171515 0 18%, transparent 19%),
    radial-gradient(ellipse at 50% 100%, #171515 0 52%, transparent 53%);
}

.victim-photo .person,
.brief-photo.person,
.crime-scene-photo {
  background:
    linear-gradient(rgba(15, 12, 10, 0.2), rgba(4, 4, 4, 0.52)),
    radial-gradient(ellipse at 52% 66%, rgba(13, 12, 10, 0.88) 0 18%, transparent 19%),
    linear-gradient(108deg, transparent 0 42%, rgba(180, 30, 24, 0.78) 43% 45%, transparent 46%),
    linear-gradient(15deg, transparent 0 56%, rgba(180, 30, 24, 0.76) 57% 59%, transparent 60%),
    url("./premium-board-bg.png") center 40% / 220% auto no-repeat,
    linear-gradient(145deg, #34271c, #0b0a09);
}

.victim-photo .person::before,
.brief-photo.person::before {
  display: none;
}

.crime-scene-photo {
  position: relative;
  height: 76px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14);
}

.crime-scene-photo::before {
  content: "";
  position: absolute;
  inset: 10px 18px;
  opacity: 0.9;
  background:
    linear-gradient(120deg, transparent 0 48%, rgba(188, 34, 28, 0.82) 49% 51%, transparent 52%),
    linear-gradient(24deg, transparent 0 54%, rgba(188, 34, 28, 0.74) 55% 57%, transparent 58%),
    linear-gradient(-18deg, transparent 0 46%, rgba(188, 34, 28, 0.7) 47% 49%, transparent 50%);
}

.crime-scene-photo::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 9px;
  width: 36px;
  height: 48px;
  transform: translateX(-50%);
  border-radius: 50% 50% 18% 18%;
  background:
    radial-gradient(circle at 50% 18%, #040404 0 18%, transparent 19%),
    radial-gradient(ellipse at 50% 92%, #050505 0 54%, transparent 55%);
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.7));
}

.victim-photo strong {
  display: none;
}

.victim-note {
  left: 9px;
  top: 35px;
  transform: rotate(-2deg);
}

.scene-note {
  right: 9px;
  top: 42px;
  transform: rotate(2deg);
}

.string-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.string-layer line {
  stroke: #b51f19;
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.8));
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawLine 550ms ease-out forwards;
}

.home-clues {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 116px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  z-index: 3;
}

.clue {
  position: relative;
  min-height: 70px;
  padding: 4px;
  text-align: center;
  font-family: "Trebuchet MS", Arial, sans-serif;
  border-radius: 3px;
}

.clue .mini-img {
  height: 31px;
  margin-bottom: 3px;
}

.css-icon {
  position: relative;
  display: grid;
  place-items: center;
}

.css-icon::before,
.css-icon::after {
  content: "";
  position: absolute;
}

.icon-watch::before {
  width: 22px;
  height: 22px;
  border: 3px solid #e8d8b8;
  border-radius: 50%;
}

.icon-watch::after {
  width: 2px;
  height: 10px;
  background: #e8d8b8;
  transform: rotate(50deg);
}

.icon-cup::before {
  width: 23px;
  height: 16px;
  border: 3px solid #e8d8b8;
  border-radius: 0 0 10px 10px;
  top: 8px;
}

.icon-cup::after {
  width: 10px;
  height: 10px;
  border: 3px solid #e8d8b8;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  right: 10px;
  top: 11px;
}

.icon-foot::before {
  width: 12px;
  height: 23px;
  border-radius: 50% 50% 42% 42%;
  background: #e8d8b8;
  transform: rotate(-20deg);
  left: 19px;
}

.icon-foot::after {
  width: 12px;
  height: 23px;
  border-radius: 50% 50% 42% 42%;
  background: #e8d8b8;
  transform: rotate(18deg);
  right: 18px;
  top: 13px;
}

.icon-camera::before {
  width: 32px;
  height: 17px;
  background: #e8d8b8;
  clip-path: polygon(0 18%, 78% 0, 100% 18%, 100% 82%, 78% 100%, 0 82%);
}

.icon-camera::after {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #151515;
}

.icon-phone::before {
  width: 21px;
  height: 34px;
  border-radius: 5px;
  border: 3px solid #e8d8b8;
}

.icon-phone::after {
  width: 8px;
  height: 2px;
  background: #e8d8b8;
  bottom: 6px;
}

.clue strong {
  display: block;
  font-size: 9px;
  line-height: 1.05;
}

.clue span {
  display: block;
  margin-top: 1px;
  font-size: 8px;
  line-height: 1.05;
}

.lying {
  position: absolute;
  left: 50%;
  top: 184px;
  width: 88px;
  padding: 7px 4px;
  text-align: center;
  color: #18120e;
  background: #ead89d;
  transform: translateX(-50%) rotate(4deg);
  font-family: "Comic Sans MS", "Trebuchet MS", cursive;
  font-size: 13px;
  box-shadow: 0 5px 8px rgba(0,0,0,0.45);
  z-index: 4;
}

.lying b {
  color: var(--red);
  text-decoration: underline;
}

.home-suspects {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 7px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  z-index: 3;
}

.suspect-card {
  position: relative;
  min-width: 0;
  padding: 4px;
  border-radius: 4px;
  text-align: center;
  transition: transform 120ms ease;
}

.portrait {
  height: 48px;
  border-radius: 3px 3px 0 0;
}

.portrait.large {
  height: 150px;
}

.portrait::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 58%;
  height: 78%;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 50% 18%, #d39b70 0 14%, transparent 15%),
    radial-gradient(ellipse at 50% 100%, rgba(18,17,15,0.95) 0 54%, transparent 55%);
}

.portrait.elena { background: linear-gradient(145deg, #5f2b33, #171514); }
.portrait.marcus { background: linear-gradient(145deg, #493426, #151515); }
.portrait.victor { background: linear-gradient(145deg, #243f4b, #12181a); }
.portrait.samuel { background: linear-gradient(145deg, #554734, #151515); }

.portrait.elena::before {
  background:
    radial-gradient(ellipse at 50% 17%, #2d1714 0 23%, transparent 24%),
    radial-gradient(circle at 50% 24%, #d39b70 0 13%, transparent 14%),
    radial-gradient(ellipse at 50% 100%, #7a211f 0 54%, transparent 55%);
}

.suspect-card h4 {
  margin: 4px 0 0;
  font-size: 10px;
  line-height: 1.05;
}

.suspect-card p {
  margin: 1px 0 0;
  font: 8px/1.1 "Trebuchet MS", Arial, sans-serif;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  font-size: 8px;
  color: #45392c;
}

.status-badge::before {
  content: "?";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #f5ead5;
  background: #4d463a;
}

.suspect-card.suspicious {
  box-shadow: 0 0 0 2px #d74132, 0 6px 10px rgba(0,0,0,0.5);
}

.suspect-card.clear {
  box-shadow: 0 0 0 2px #75a84c, 0 6px 10px rgba(0,0,0,0.5);
}

.suspect-card.suspicious .status-badge::before {
  content: "!";
  background: var(--red);
}

.suspect-card.clear .status-badge::before {
  content: "✓";
  background: var(--green);
}

.play-wrap {
  margin-top: 9px;
}

.yellow-btn {
  width: 100%;
  min-height: 62px;
  border-radius: 9px;
  color: #281b0a;
  text-transform: uppercase;
  background: linear-gradient(#f3cf58, #d8941e);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25), inset 0 -4px 0 rgba(105,65,14,0.28), 0 8px 18px rgba(0,0,0,0.52);
  position: relative;
  overflow: hidden;
}

.yellow-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: translateX(-120%) skewX(-18deg);
  animation: shine 4s ease-in-out infinite;
}

.yellow-btn strong {
  display: block;
  font-size: clamp(24px, 8vw, 34px);
  line-height: 1;
}

.yellow-btn span {
  display: block;
  font-size: 13px;
}

.yellow-btn:disabled {
  filter: grayscale(0.8) brightness(0.75);
  cursor: not-allowed;
}

.mode-row {
  height: 90px;
  margin-top: 9px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mode-card {
  border-radius: 8px;
  color: var(--text-light);
  text-align: left;
  padding: 9px 8px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.06), 0 8px 14px rgba(0,0,0,0.45);
  position: relative;
}

.mode-card strong {
  display: block;
  margin-top: 26px;
  font-size: clamp(12px, 3.7vw, 16px);
}

.mode-card span {
  display: block;
  font: 10px/1.1 "Trebuchet MS", Arial, sans-serif;
  color: #ddceb0;
}

.mode-card.blue { background: linear-gradient(135deg, #244c58, #14292d); }
.mode-card.purple { background: linear-gradient(135deg, #513759, #26192b); }
.mode-card.navy { background: linear-gradient(135deg, #263e5b, #131d2a); }

.mode-card::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 9px;
  width: 28px;
  height: 22px;
  border-radius: 3px;
  background: linear-gradient(#c9a15a, #8f622a);
  box-shadow: 6px -4px 0 rgba(255,255,255,0.13);
}

.nav-btn {
  min-width: 0;
  color: #c6a867;
  background: transparent;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  position: relative;
}

.nav-btn.active {
  color: #f6d777;
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 28px;
  height: 3px;
  border-radius: 4px;
  background: var(--yellow);
}

.nav-icon {
  width: 28px;
  height: 24px;
  display: block;
  position: relative;
}

.nav-icon.folder::before {
  content: "";
  position: absolute;
  inset: 6px 2px 2px;
  border-radius: 3px;
  background: currentColor;
}

.nav-icon.folder::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 3px;
  width: 12px;
  height: 7px;
  border-radius: 2px 2px 0 0;
  background: currentColor;
}

.nav-icon.detective::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: currentColor;
}

.nav-icon.detective::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 0;
  width: 26px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.nav-icon.cart::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 6px;
  width: 20px;
  height: 12px;
  border: 3px solid currentColor;
  border-top: 0;
}

.nav-icon.cart::after {
  content: "";
  position: absolute;
  left: 7px;
  bottom: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 12px 0 0 currentColor;
}

.nav-icon.search::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 2px;
  width: 15px;
  height: 15px;
  border: 4px solid currentColor;
  border-radius: 50%;
}

.nav-icon.search::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 12px;
  height: 4px;
  border-radius: 4px;
  background: currentColor;
  transform: rotate(42deg);
}

.nav-icon.people::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: -9px 4px 0 -1px currentColor, 9px 4px 0 -1px currentColor;
}

.nav-icon.people::after {
  content: "";
  position: absolute;
  left: 5px;
  bottom: 2px;
  width: 18px;
  height: 11px;
  border-radius: 10px 10px 2px 2px;
  background: currentColor;
}

.nav-icon.notes::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 18px;
  height: 20px;
  border: 3px solid currentColor;
}

.nav-icon.notes::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 8px;
  width: 10px;
  height: 3px;
  background: currentColor;
  box-shadow: 0 6px 0 currentColor;
}

.nav-icon.gavel::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 19px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-28deg);
}

.nav-icon.gavel::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 9px;
  width: 5px;
  height: 16px;
  background: currentColor;
  transform: rotate(-28deg);
}

.nav-btn span:last-child {
  font-size: 11px;
}

/* Premium bottom-nav icons */
.nav-icon {
  filter: drop-shadow(0 3px 3px rgba(0,0,0,0.55));
}

.nav-icon.folder::before {
  left: 2px;
  top: 8px;
  width: 24px;
  height: 16px;
  inset: auto;
  border-radius: 4px 4px 5px 5px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.16), transparent 42%),
    linear-gradient(#d7b66d, #8f682d);
  box-shadow:
    inset 0 0 0 1px rgba(255,232,169,0.2),
    0 2px 0 rgba(75,45,16,0.5);
}

.nav-icon.folder::after {
  left: 4px;
  top: 4px;
  width: 15px;
  height: 8px;
  border-radius: 4px 4px 1px 1px;
  background:
    linear-gradient(#ecd18a, #a77b38);
  box-shadow:
    9px 8px 0 -4px rgba(255,236,176,0.48),
    inset 0 1px 0 rgba(255,255,255,0.22);
}

.nav-icon.detective::before {
  left: 7px;
  top: 10px;
  width: 14px;
  height: 12px;
  border-radius: 50% 50% 46% 46%;
  background:
    radial-gradient(circle at 50% 8%, rgba(255,239,178,0.38), transparent 34%),
    linear-gradient(#d5b363, #8e6429);
  box-shadow:
    inset 0 -3px 0 rgba(74,45,18,0.34),
    0 2px 0 rgba(0,0,0,0.35);
}

.nav-icon.detective::after {
  left: 2px;
  top: 3px;
  width: 24px;
  height: 12px;
  border-radius: 50% 50% 44% 44%;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.2), transparent 44%),
    linear-gradient(#e5c77b, #9b6d2f);
  box-shadow:
    0 5px 0 -2px #7c5626,
    inset 0 -2px 0 rgba(68,42,17,0.34);
}

.nav-icon.cart::before {
  left: 5px;
  top: 4px;
  width: 18px;
  height: 17px;
  border: 0;
  border-radius: 2px 2px 5px 5px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.14), transparent 35%),
    linear-gradient(#d6b263, #8c642c);
  box-shadow:
    inset 0 0 0 2px rgba(255,232,169,0.12),
    inset 0 5px 0 rgba(36,25,14,0.32),
    0 2px 0 rgba(0,0,0,0.38);
  clip-path: polygon(8% 28%, 92% 28%, 84% 100%, 16% 100%);
}

.nav-icon.cart::after {
  left: 8px;
  top: 0;
  width: 12px;
  height: 10px;
  border-radius: 9px 9px 0 0;
  background: transparent;
  border: 3px solid currentColor;
  border-bottom: 0;
  box-shadow: none;
  opacity: 0.95;
}

.brief-card,
.notebook,
.accuse-panel,
.result-card {
  min-height: calc(100% - 68px);
  padding: 16px;
  border-radius: 8px;
  overflow: hidden;
}

.brief-card h1,
.notebook h1,
.accuse-panel h1,
.modal-paper h2 {
  margin: 0;
  font-size: clamp(25px, 8vw, 36px);
  line-height: 0.95;
}

.label {
  margin: 13px 0 5px;
  color: #842219;
  font-size: 14px;
  text-transform: uppercase;
}

p,
li {
  font: 14px/1.35 "Trebuchet MS", Arial, sans-serif;
}

.brief-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
}

.brief-photo {
  height: 150px;
  border: 7px solid var(--paper-light);
}

.investigation-board {
  height: calc(100% - 64px);
  min-height: 650px;
  margin-top: 8px;
}

.board-inner {
  position: relative;
  height: 100%;
}

.board-top {
  position: relative;
  height: 60%;
  min-height: 378px;
}

.main-clues {
  position: absolute;
  left: 7px;
  right: 7px;
  top: 166px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  z-index: 3;
}

.main-clues .clue {
  min-height: 92px;
}

.main-clues .mini-img {
  height: 45px;
}

.badge {
  position: absolute;
  right: -5px;
  top: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  z-index: 6;
}

.clue.collected {
  box-shadow: 0 0 0 2px #74a84d, 0 6px 10px rgba(0,0,0,0.48);
}

.suspect-area {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 7px;
  height: 38%;
  min-height: 230px;
  padding: 24px 6px 7px;
  background: rgba(8, 10, 10, 0.84);
  box-shadow: inset 0 0 0 1px rgba(198,155,75,0.16);
}

.strip-title {
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--gold);
  font-size: 13px;
}

.suspect-grid {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.suspect-grid .suspect-card {
  display: flex;
  flex-direction: column;
}

.suspect-grid .portrait {
  height: 68px;
}

.suspect-grid .status-badge {
  margin-top: auto;
}

#modal-root {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

#modal-root.active {
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,0.62);
}

.modal-paper {
  width: min(100%, 360px);
  max-height: min(88dvh, 780px);
  overflow-y: auto;
  border-radius: 8px;
  padding: 18px;
  position: relative;
  animation: modalIn 180ms ease-out;
}

.close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  color: var(--text-dark);
  background: transparent;
  font-size: 28px;
}

.clue-detail-img {
  height: 185px;
  margin: 12px 0;
  border: 6px solid #2d241b;
}

.logic-box {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 11px;
  padding: 12px;
  margin: 12px 0;
  background: rgba(255,255,255,0.25);
  border-top: 1px solid rgba(70,49,28,0.25);
  border-bottom: 1px solid rgba(70,49,28,0.25);
}

.dossier {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  margin-top: 12px;
}

.status-actions,
.result-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.status-btn {
  min-height: 50px;
  border-radius: 6px;
  color: white;
  font-size: 12px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 5px 8px rgba(0,0,0,0.35);
}

.status-btn.red { background: linear-gradient(#ba3b2d, #7f2119); }
.status-btn.yellow { background: linear-gradient(#e3b23f, #a66e18); color: #24180b; }
.status-btn.green { background: linear-gradient(#6fa34c, #426b2c); }

.note-entry,
.timeline-entry {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(55,38,24,0.22);
  font: 13px/1.25 "Trebuchet MS", Arial, sans-serif;
}

.note-entry button {
  text-align: left;
  color: var(--text-dark);
  background: transparent;
  padding: 0;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin: 8px 0 14px;
}

.choice-grid.evidence {
  grid-template-columns: repeat(5, 1fr);
}

.choice {
  position: relative;
  min-height: 75px;
  padding: 5px;
  border-radius: 5px;
  color: var(--text-dark);
  background: linear-gradient(#e9dabe, #c4b293);
  box-shadow: inset 0 0 0 1px rgba(90,61,34,0.28), 0 4px 7px rgba(0,0,0,0.35);
  font: 10px/1.1 "Trebuchet MS", Arial, sans-serif;
}

.choice.motive {
  min-height: 42px;
  font-size: 12px;
}

.choice.selected {
  box-shadow: inset 0 0 0 3px #79b454, 0 0 12px rgba(94,140,61,0.55);
  transform: scale(1.02);
}

.choice.selected::after {
  content: "✓";
  position: absolute;
  right: -5px;
  top: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green);
}

.choice .mini-img {
  height: 43px;
  margin-bottom: 3px;
}

.result-card {
  min-height: calc(100% - 10px);
  color: var(--text-light);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.06), transparent 38%),
    linear-gradient(#28241e, #11100e);
  box-shadow: inset 0 0 0 1px rgba(198,155,75,0.25), 0 10px 25px rgba(0,0,0,0.68);
}

.result-banner {
  display: inline-block;
  padding: 9px 18px;
  margin-bottom: 10px;
  color: white;
  font-size: 28px;
  background: linear-gradient(90deg, #5f8f3c, #3f6427);
  clip-path: polygon(0 0, 92% 0, 100% 50%, 92% 100%, 0 100%);
}

.result-banner.bad {
  background: linear-gradient(90deg, #a92c23, #651611);
}

.guilty-card {
  position: relative;
  float: right;
  width: 126px;
  margin: 0 0 10px 10px;
  padding: 6px;
  background: #2b2824;
  box-shadow: 0 6px 12px rgba(0,0,0,0.55);
}

.stamp {
  position: absolute;
  left: 11px;
  bottom: 26px;
  transform: rotate(-10deg);
  border: 4px solid #e53d2f;
  color: #e53d2f;
  padding: 2px 7px;
  font-size: 22px;
  background: rgba(20,8,7,0.5);
}

.reward-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
  padding: 12px 0;
  border-top: 1px solid rgba(198,155,75,0.28);
  border-bottom: 1px solid rgba(198,155,75,0.28);
}

.reward-row div {
  color: var(--yellow-light);
  font-size: 18px;
}

.result-actions {
  grid-template-columns: 1fr 1fr;
}

.secondary-btn {
  min-height: 50px;
  border-radius: 6px;
  background: linear-gradient(#d8c9aa, #a99877);
  color: #2b2116;
  text-transform: uppercase;
  box-shadow: 0 6px 10px rgba(0,0,0,0.45);
}

.settings-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(60,42,28,0.22);
  font: 14px/1.25 "Trebuchet MS", Arial, sans-serif;
}

.toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 160px;
  padding: 3px;
  border-radius: 18px;
  background: rgba(36,27,18,0.25);
}

.toggle button {
  min-height: 34px;
  border-radius: 16px;
  color: var(--text-dark);
  background: transparent;
  font-size: 12px;
}

.toggle button.active {
  background: var(--yellow);
}

#toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--bottom-nav-height) + 14px + var(--safe-bottom));
  z-index: 40;
  max-width: calc(100% - 42px);
  min-width: 210px;
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--text-light);
  text-align: center;
  background: rgba(20, 18, 15, 0.95);
  box-shadow: inset 0 0 0 1px rgba(198,155,75,0.28), 0 8px 18px rgba(0,0,0,0.5);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.empty-state {
  padding: 14px;
  margin: 10px 0;
  background: rgba(255,255,255,0.2);
  font: 13px/1.3 "Trebuchet MS", Arial, sans-serif;
}

button:active {
  transform: translateY(1px) scale(0.985);
}

@media (min-width: 700px) {
  body {
    padding: 22px;
  }

  #game-app {
    height: min(100dvh - 44px, 932px);
    border-radius: 22px;
  }
}

@media (max-width: 370px) {
  #screen-container {
    padding-left: 8px;
    padding-right: 8px;
  }

  .home-logo {
    height: 220px;
  }

  .home-board {
    height: 252px;
  }

  .mode-row {
    gap: 6px;
  }

  .choice-grid,
  .choice-grid.evidence {
    gap: 5px;
  }
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

@keyframes lampGlow {
  0%, 100% { opacity: 0.84; box-shadow: 0 0 20px rgba(244,204,122,0.58); }
  50% { opacity: 1; box-shadow: 0 0 42px rgba(244,204,122,0.9); }
}

@keyframes shine {
  0%, 55% { transform: translateX(-120%) skewX(-18deg); }
  78%, 100% { transform: translateX(120%) skewX(-18deg); }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes dangerPulse {
  0%, 100% { color: #ff4a36; transform: scale(1); }
  50% { color: #fff; transform: scale(1.05); }
}

/* Polished game-layer overrides */
body {
  font-family: Impact, "Arial Narrow", "Noto Sans Khmer", "Khmer UI", Arial, sans-serif;
}

#game-app.shake {
  animation: screenShake 260ms ease-out;
}

.home-logo {
  height: clamp(202px, 27dvh, 248px);
}

.home-board {
  height: clamp(238px, 31dvh, 278px);
}

.mode-row {
  height: clamp(82px, 11dvh, 94px);
}

.cork-board {
  background:
    radial-gradient(circle at 10% 15%, rgba(255,255,255,0.08), transparent 1px),
    radial-gradient(circle at 70% 38%, rgba(0,0,0,0.14), transparent 1px),
    radial-gradient(circle at 22% 72%, rgba(255,255,255,0.06), transparent 1px),
    repeating-linear-gradient(38deg, rgba(255,255,255,0.025) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(105deg, rgba(0,0,0,0.035) 0 1px, transparent 1px 5px),
    linear-gradient(135deg, var(--cork), var(--cork-dark));
}

.cork-board::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 35% 35%, rgba(255,255,255,0.05), transparent 2px),
    radial-gradient(circle at 68% 40%, rgba(0,0,0,0.12), transparent 2px),
    radial-gradient(circle at 85% 80%, rgba(255,255,255,0.04), transparent 2px);
  background-size: 23px 31px, 37px 29px, 41px 43px;
  opacity: 0.65;
  pointer-events: none;
}

.paper,
.clue,
.modal-paper,
.brief-card,
.notebook,
.accuse-panel {
  position: relative;
}

.paper::after,
.clue::after,
.modal-paper::after,
.brief-card::after,
.notebook::after,
.accuse-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background:
    radial-gradient(circle at 15% 20%, rgba(84,54,27,0.18), transparent 2px),
    radial-gradient(circle at 70% 74%, rgba(84,54,27,0.12), transparent 2px),
    repeating-linear-gradient(0deg, transparent 0 7px, rgba(76,48,23,0.06) 7px 8px);
  pointer-events: none;
  mix-blend-mode: multiply;
}

.pin::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 10px;
  width: 3px;
  height: 8px;
  background: rgba(60, 20, 15, 0.45);
  transform: rotate(18deg);
  filter: blur(0.3px);
}

.photo {
  border: 1px solid rgba(72,47,28,0.2);
}

.photo::before {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: 2;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.26), inset 0 -18px 28px rgba(0,0,0,0.18);
}

.tape {
  position: absolute;
  left: 50%;
  top: -8px;
  width: 48px;
  height: 16px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(231,211,165,0.55);
  box-shadow: 0 2px 5px rgba(0,0,0,0.25);
  z-index: 6;
}

.clue {
  transform: rotate(var(--tilt, 0deg));
}

.clue:nth-child(1) { --tilt: -3deg; }
.clue:nth-child(2) { --tilt: 2deg; }
.clue:nth-child(3) { --tilt: -1deg; }
.clue:nth-child(4) { --tilt: 3deg; }
.clue:nth-child(5) { --tilt: -2deg; }

.main-clues .clue:nth-child(2) { margin-top: 8px; }
.main-clues .clue:nth-child(4) { margin-top: 7px; }
.main-clues .clue:nth-child(5) { margin-top: -4px; }

.clue.collected .pin {
  animation: pinBounce 360ms ease-out;
}

.mode-card {
  overflow: hidden;
}

.mode-card::after {
  content: "";
  position: absolute;
  inset: auto 8px 8px 8px;
  height: 3px;
  border-radius: 4px;
  background: rgba(230,169,39,0.55);
}

.string-layer.proof line {
  stroke: #d52a21;
  stroke-width: 3.5;
  filter: drop-shadow(0 0 5px rgba(213,42,33,0.55)) drop-shadow(0 1px 1px rgba(0,0,0,0.8));
}

.modal-paper {
  border: 1px solid rgba(91,61,34,0.28);
}

.modal-paper::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(77,51,28,0.18);
  pointer-events: none;
}

.case-file {
  width: 100%;
  min-height: 76px;
  margin: 8px 0;
  padding: 12px;
  border-radius: 6px;
  text-align: left;
  color: var(--text-dark);
  background: linear-gradient(135deg, #eadbbb, #bda985);
  box-shadow: 0 6px 12px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.3);
  display: grid;
  gap: 3px;
}

.case-file strong {
  font-size: 17px;
}

.case-file span,
.case-file small {
  font: 12px/1.2 "Trebuchet MS", "Noto Sans Khmer", Arial, sans-serif;
}

.case-file.locked {
  filter: grayscale(0.85) brightness(0.72);
}

.logic-board {
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  max-height: calc(100dvh - var(--bottom-nav-height) - 16px);
}

.logic-columns {
  display: grid;
  gap: 6px;
}

.logic-board h1 {
  font-size: clamp(22px, 6.5vw, 30px);
}

.logic-board p {
  margin: 4px 0 7px;
  font-size: 12px;
}

.logic-board .label {
  margin: 7px 0 4px;
  font-size: 12px;
}

.logic-choice {
  width: 100%;
  margin: 3px 0;
  padding: 7px 9px;
  min-height: 42px;
  border-radius: 5px;
  text-align: left;
  color: var(--text-dark);
  background: rgba(255,255,255,0.28);
  box-shadow: inset 0 0 0 1px rgba(80,54,31,0.2);
}

.logic-choice strong,
.logic-choice span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logic-choice strong {
  font-size: 12px;
  line-height: 1.12;
}

.logic-choice span {
  margin-top: 2px;
  font: 10px/1.18 "Trebuchet MS", "Noto Sans Khmer", Arial, sans-serif;
}

.logic-choice.selected {
  box-shadow: inset 0 0 0 3px #77aa4c, 0 0 12px rgba(94,140,61,0.38);
  background: rgba(242,207,88,0.32);
}

.logic-actions {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 8px;
  margin: 8px 0;
}

.logic-actions .yellow-btn {
  min-height: 52px;
}

.logic-actions .yellow-btn strong {
  font-size: clamp(17px, 4.8vw, 22px);
}

.success {
  background: rgba(94,140,61,0.25);
}

.locked-banner {
  margin: 8px 0 12px;
  padding: 10px;
  border-radius: 5px;
  background: rgba(169,44,35,0.15);
  color: #7f2119;
  box-shadow: inset 0 0 0 1px rgba(169,44,35,0.25);
  text-align: center;
}

.wrong-paper {
  animation: modalIn 180ms ease-out, screenShake 240ms ease-out;
}

.success-paper {
  box-shadow: 0 0 0 2px rgba(94,140,61,0.45), 0 18px 40px rgba(0,0,0,0.65), inset 0 0 0 1px rgba(255,255,255,0.34);
}

.scrap {
  position: absolute;
  width: 72px;
  height: 48px;
  opacity: 0.34;
  background:
    repeating-linear-gradient(0deg, rgba(31,24,17,0.24) 0 1px, transparent 1px 7px),
    linear-gradient(#d7c39c, #a99470);
  box-shadow: 0 5px 10px rgba(0,0,0,0.36);
  z-index: 0;
}

.scrap-a {
  left: -16px;
  bottom: 34px;
  transform: rotate(-14deg);
}

.scrap-b {
  right: -22px;
  top: 22px;
  transform: rotate(12deg);
}

.fingerprint-sm {
  position: absolute;
  right: 32px;
  bottom: 126px;
  width: 42px;
  height: 42px;
  opacity: 0.18;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 16%, #1b130e 17% 22%, transparent 23% 29%, #1b130e 30% 35%, transparent 36% 43%, #1b130e 44% 49%, transparent 50%);
  z-index: 1;
}

.dust {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.28) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(230,169,39,0.16) 0 1px, transparent 1.5px);
  background-size: 86px 113px, 127px 91px;
  opacity: 0.16;
  animation: dustFloat 18s linear infinite;
}

.nav-icon.logic::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 22px;
  height: 17px;
  border: 3px solid currentColor;
  border-radius: 4px;
}

.nav-icon.logic::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 9px;
  width: 12px;
  height: 3px;
  background: currentColor;
  box-shadow: 0 6px 0 currentColor;
}

.investigation-board > .board-inner {
  position: absolute;
  inset: 0;
  height: auto;
}

.investigation-board .suspect-area {
  z-index: 5;
}

.investigation-board .main-clues {
  z-index: 4;
}

.investigation-board .paper,
.home-board .paper {
  position: absolute;
}

.investigation-board .clue > *,
.investigation-board .suspect-card > *,
.logic-choice > *,
.case-file > * {
  pointer-events: none;
}

/* Final visual QA polish */
#game-app::after {
  opacity: 0.22;
}

.home-logo {
  height: clamp(194px, 25dvh, 232px);
}

.home-board {
  height: clamp(258px, 33dvh, 292px);
  background:
    linear-gradient(rgba(34,20,12,0.08), rgba(34,20,12,0.28)),
    url("./premium-board-bg.png") center 32% / cover no-repeat;
  box-shadow:
    inset 0 0 0 2px rgba(229,174,88,0.14),
    inset 0 16px 32px rgba(255,210,128,0.08),
    inset 0 -28px 42px rgba(23,12,6,0.34),
    0 14px 28px rgba(0,0,0,0.7);
}

.home-clues .clue {
  min-height: 82px;
}

.home-suspects .suspect-card {
  box-shadow: 0 4px 9px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(255,255,255,0.16);
}

.investigation-board {
  background:
    radial-gradient(circle at 50% 0, rgba(255,209,123,0.12), transparent 180px),
    linear-gradient(rgba(26,17,11,0.06), rgba(26,17,11,0.2)),
    url("./premium-board-bg.png") center / cover no-repeat,
    radial-gradient(circle at 16% 26%, rgba(255,255,255,0.07), transparent 2px),
    radial-gradient(circle at 72% 60%, rgba(0,0,0,0.18), transparent 2px),
    repeating-linear-gradient(32deg, rgba(255,255,255,0.022) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(106deg, rgba(0,0,0,0.04) 0 1px, transparent 1px 6px),
    linear-gradient(135deg, #815332, #4d2e1d);
}

.investigation-board .main-clues {
  top: 204px;
  gap: 6px;
}

.investigation-board .main-clues .clue {
  min-height: 96px;
  box-shadow: 0 9px 12px rgba(0,0,0,0.52), inset 0 0 0 1px rgba(255,255,255,0.2);
}

.investigation-board .main-clues .mini-img {
  height: 48px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255,236,190,0.2), transparent 36%),
    linear-gradient(145deg, #31261d, #14110e);
}

.investigation-board .lying {
  top: 292px;
  z-index: 6;
}

.investigation-board .suspect-area {
  min-height: 214px;
  height: 33%;
  bottom: 8px;
  padding: 24px 7px 8px;
  background:
    linear-gradient(rgba(14,16,16,0.88), rgba(7,8,8,0.92)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 8px);
  box-shadow:
    inset 0 0 0 1px rgba(198,155,75,0.22),
    0 -10px 22px rgba(0,0,0,0.35);
}

.investigation-board .suspect-grid {
  gap: 7px;
}

.investigation-board .suspect-card {
  padding: 5px 4px 6px;
  box-shadow: 0 7px 11px rgba(0,0,0,0.62), inset 0 0 0 1px rgba(255,255,255,0.17);
}

.investigation-board .suspect-grid .portrait {
  height: 78px;
}

.investigation-board .suspect-grid .status-badge {
  margin-top: 8px;
}

.portrait {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16), inset 0 -18px 24px rgba(0,0,0,0.32);
  background-image: url("./premium-suspect-portraits.png");
  background-size: 200% 200%;
  background-repeat: no-repeat;
  background-color: #171514;
}

.portrait::before,
.portrait::after {
  display: none;
}

.portrait.elena {
  background-position: 0% 0%;
}

.portrait.marcus {
  background-position: 100% 0%;
}

.portrait.victor {
  background-position: 0% 100%;
}

.portrait.samuel {
  background-position: 100% 100%;
}

.placeholder-img.person {
  background:
    radial-gradient(circle at 50% 32%, rgba(238,203,150,0.26), transparent 17%),
    linear-gradient(145deg, rgba(0,0,0,0.22), rgba(0,0,0,0.72)),
    url("./premium-board-bg.png") center 24% / 190% auto no-repeat;
}

.placeholder-img.person::before {
  background:
    radial-gradient(circle at 50% 18%, #0b0a09 0 18%, transparent 19%),
    radial-gradient(ellipse at 50% 100%, #0b0a09 0 52%, transparent 53%);
}

.portrait.legacy-face::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 28%;
  width: 24%;
  height: 18%;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 42%, #251a14 0 9%, transparent 10%),
    radial-gradient(circle at 68% 42%, #251a14 0 9%, transparent 10%),
    linear-gradient(#dba77c, #b7744e);
  opacity: 0.78;
}

.modal-backdrop {
  background:
    radial-gradient(circle at 50% 18%, rgba(242,194,95,0.14), transparent 260px),
    rgba(0,0,0,0.68);
}

.modal-paper {
  width: min(94vw, 352px);
  padding: 17px;
  background:
    radial-gradient(circle at 25% 18%, rgba(255,255,255,0.24), transparent 120px),
    repeating-linear-gradient(0deg, rgba(87,58,31,0.05) 0 1px, transparent 1px 8px),
    linear-gradient(135deg, #efe1bf, #cbb48a);
  box-shadow:
    0 24px 48px rgba(0,0,0,0.75),
    0 0 0 1px rgba(78,48,25,0.45),
    inset 0 0 0 1px rgba(255,255,255,0.34);
}

.modal-paper h2 {
  font-size: clamp(27px, 8vw, 34px);
}

.clue-detail-img {
  height: 164px;
  border: 6px solid #2a2118;
  background:
    radial-gradient(circle at 52% 40%, rgba(255,238,195,0.22), transparent 38%),
    linear-gradient(145deg, #33271e, #15110e);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16), 0 8px 16px rgba(0,0,0,0.34);
}

.clue-detail-img.icon-cup::before {
  width: 74px;
  height: 48px;
  top: 55px;
  left: 112px;
  border-width: 6px;
}

.clue-detail-img.icon-cup::after {
  width: 32px;
  height: 30px;
  right: 86px;
  top: 63px;
  border-width: 6px;
}

.clue-detail-img.icon-camera::before {
  width: 120px;
  height: 62px;
}

.clue-detail-img.icon-camera::after {
  width: 30px;
  height: 30px;
}

.clue-detail-img.icon-watch::before {
  width: 70px;
  height: 70px;
  border-width: 7px;
}

.clue-detail-img.icon-watch::after {
  height: 34px;
  width: 5px;
}

.dossier .portrait.large {
  height: 148px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 8px 16px rgba(0,0,0,0.28);
}

.logic-board {
  background:
    radial-gradient(circle at 15% 0, rgba(255,255,255,0.22), transparent 150px),
    repeating-linear-gradient(0deg, rgba(84,56,30,0.055) 0 1px, transparent 1px 8px),
    linear-gradient(135deg, #eee0bd, #c5ad82);
  box-shadow:
    0 16px 32px rgba(0,0,0,0.62),
    inset 0 0 0 1px rgba(255,255,255,0.34);
  scrollbar-width: thin;
  scrollbar-color: rgba(78,49,28,0.45) transparent;
}

.logic-choice {
  background:
    linear-gradient(135deg, rgba(255,248,221,0.66), rgba(211,190,150,0.5));
  box-shadow: 0 3px 6px rgba(84,54,27,0.16), inset 0 0 0 1px rgba(80,54,31,0.2);
}

.yellow-btn {
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.24),
    inset 0 -5px 0 rgba(110,67,11,0.34),
    0 9px 0 rgba(78,45,8,0.48),
    0 17px 24px rgba(0,0,0,0.42);
}

#toast {
  bottom: calc(var(--bottom-nav-height) + 14px + var(--safe-bottom));
}

.investigation-board::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: 356px;
  height: 102px;
  opacity: 0.28;
  pointer-events: none;
  background:
    linear-gradient(8deg, transparent 0 42%, rgba(224,202,157,0.55) 43% 63%, transparent 64%),
    radial-gradient(circle at 12% 74%, rgba(28,18,13,0.24) 0 18px, transparent 19px),
    radial-gradient(circle at 86% 36%, rgba(28,18,13,0.18) 0 22px, transparent 23px),
    repeating-linear-gradient(0deg, rgba(26,18,12,0.22) 0 1px, transparent 1px 9px);
}

.investigation-board .fingerprint-sm {
  right: 28px;
  bottom: 252px;
  width: 58px;
  height: 58px;
  opacity: 0.15;
}

.mini-img.css-icon,
.clue-detail-img.css-icon {
  background-image: url("./premium-evidence-sheet.png");
  background-repeat: no-repeat;
  background-color: #15110e;
}

.mini-img.css-icon::before,
.mini-img.css-icon::after,
.clue-detail-img.css-icon::before,
.clue-detail-img.css-icon::after {
  display: none;
}

.icon-watch { background-position: 0% 0%; }
.icon-cup { background-position: 50% 0%; }
.icon-foot { background-position: 100% 0%; }
.icon-camera { background-position: 0% 100%; }
.icon-phone { background-position: 50% 100%; }

.mini-img.css-icon {
  background-size: 300% 200%;
}

.clue-detail-img.css-icon {
  background-size: 300% 200%;
}

.clue-detail-img.icon-phone::before {
  width: 76px;
  height: 118px;
  border-width: 8px;
}

.clue-detail-img.icon-phone::after {
  width: 30px;
  height: 5px;
  bottom: 28px;
}

.clue-detail-img.icon-foot::before,
.clue-detail-img.icon-foot::after {
  width: 42px;
  height: 78px;
}

.clue-detail-img.icon-foot::before {
  left: 106px;
}

.clue-detail-img.icon-foot::after {
  right: 104px;
  top: 52px;
}

.logic-board {
  position: relative;
}

.logic-board::before {
  content: "";
  position: absolute;
  inset: 54px 18px 128px;
  opacity: 0.26;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 30%, rgba(169,44,35,0.55) 31% 33%, transparent 34% 63%, rgba(169,44,35,0.5) 64% 66%, transparent 67%),
    radial-gradient(circle at 31% 22%, #a92c23 0 4px, transparent 5px),
    radial-gradient(circle at 65% 45%, #a92c23 0 4px, transparent 5px);
}

.logic-header {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: -12px -12px 8px;
  padding: 12px 12px 8px;
  background:
    linear-gradient(rgba(237,222,185,0.95), rgba(225,205,162,0.88));
  box-shadow: 0 8px 12px rgba(79,53,29,0.12);
}

.logic-column {
  position: relative;
  padding: 6px 6px 8px;
  border-radius: 6px;
  background: rgba(103,72,39,0.08);
  box-shadow: inset 0 0 0 1px rgba(84,56,30,0.09);
}

.logic-column .label {
  position: sticky;
  top: 62px;
  z-index: 2;
  padding: 2px 0;
  background: rgba(229,210,169,0.92);
}

.logic-choice {
  position: relative;
  transform: rotate(-0.5deg);
}

.logic-choice:nth-child(even) {
  transform: rotate(0.45deg);
}

.logic-choice::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  width: 12px;
  height: 12px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8e68, #a92c23 58%, #56110e);
  box-shadow: 0 2px 4px rgba(0,0,0,0.45);
}

.result-card {
  min-height: auto;
  margin-top: 10px;
  padding: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 70% 6%, rgba(239,190,88,0.14), transparent 160px),
    linear-gradient(135deg, rgba(255,255,255,0.06), transparent 38%),
    linear-gradient(#29251f, #11100e);
}

.result-top {
  display: grid;
  grid-template-columns: 1fr 126px;
  gap: 12px;
  align-items: start;
}

.result-top > div:first-child {
  min-width: 0;
}

.result-top p {
  margin: 6px 0 0;
  color: #e8d6b3;
}

.result-banner {
  margin-bottom: 4px;
  font-size: 25px;
  box-shadow: 0 8px 14px rgba(0,0,0,0.28);
}

.guilty-card {
  float: none;
  width: 126px;
  margin: 0;
  transform: rotate(1deg);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.06), transparent 40%),
    #292620;
}

.guilty-card .portrait.large {
  height: 134px;
}

.guilty-card p {
  margin: 5px 0 0;
  font-size: 11px;
  text-align: center;
}

.stamp {
  left: 5px;
  right: 5px;
  bottom: 36px;
  text-align: center;
  font-size: 24px;
  animation: stampIn 360ms cubic-bezier(.2, 1.35, .35, 1);
}

.reward-row {
  margin: 12px 0;
  padding: 11px 0;
  background: rgba(0,0,0,0.16);
}

.solution-paper {
  padding: 10px 11px;
  margin: 8px 0 12px;
  color: #f5ead5;
  background:
    linear-gradient(90deg, rgba(198,155,75,0.13), transparent),
    rgba(255,255,255,0.035);
  border-left: 3px solid var(--yellow);
  box-shadow: inset 0 0 0 1px rgba(198,155,75,0.12);
}

.solution-paper .label {
  margin-top: 0;
  color: var(--yellow);
}

@keyframes stampIn {
  0% { opacity: 0; transform: rotate(-10deg) scale(1.8); }
  70% { opacity: 1; transform: rotate(-10deg) scale(0.92); }
  100% { opacity: 1; transform: rotate(-10deg) scale(1); }
}

/* Premium raster asset overrides */
.portrait.elena,
.portrait.marcus,
.portrait.victor,
.portrait.samuel {
  background-image: url("./premium-suspect-portraits.png") !important;
  background-size: 200% 200% !important;
  background-repeat: no-repeat !important;
}

.portrait.elena { background-position: 0% 0% !important; }
.portrait.marcus { background-position: 100% 0% !important; }
.portrait.victor { background-position: 0% 100% !important; }
.portrait.samuel { background-position: 100% 100% !important; }

.portrait.elena::before,
.portrait.elena::after,
.portrait.marcus::before,
.portrait.marcus::after,
.portrait.victor::before,
.portrait.victor::after,
.portrait.samuel::before,
.portrait.samuel::after {
  display: none !important;
}

.mini-img.css-icon,
.clue-detail-img.css-icon {
  background-image: url("./premium-evidence-sheet.png") !important;
  background-size: 300% 200% !important;
  background-repeat: no-repeat !important;
}

.mini-img.css-icon::before,
.mini-img.css-icon::after,
.clue-detail-img.css-icon::before,
.clue-detail-img.css-icon::after {
  display: none !important;
}

.icon-watch { background-position: 0% 0% !important; }
.icon-cup { background-position: 50% 0% !important; }
.icon-foot { background-position: 100% 0% !important; }
.icon-camera { background-position: 0% 100% !important; }
.icon-phone { background-position: 50% 100% !important; }

.home-logo {
  height: clamp(202px, 26dvh, 238px);
}

.premium-logo-art + .tagline {
  position: relative;
  z-index: 2;
}

.home-suspects .portrait,
.investigation-board .suspect-grid .portrait,
.choice .portrait {
  background-size: 220% 220% !important;
  filter: saturate(1.08) contrast(1.06) brightness(1.08);
}

.home-suspects .portrait.elena,
.investigation-board .portrait.elena,
.choice .portrait.elena { background-position: 4% 2% !important; }

.home-suspects .portrait.marcus,
.investigation-board .portrait.marcus,
.choice .portrait.marcus { background-position: 96% 2% !important; }

.home-suspects .portrait.victor,
.investigation-board .portrait.victor,
.choice .portrait.victor { background-position: 4% 96% !important; }

.home-suspects .portrait.samuel,
.investigation-board .portrait.samuel,
.choice .portrait.samuel { background-position: 96% 96% !important; }

.dossier .portrait.large,
.guilty-card .portrait.large {
  background-size: 205% 205% !important;
}

.dossier .portrait.large.marcus,
.guilty-card .portrait.large.marcus {
  background-position: 99% 0% !important;
}

.mini-img.css-icon {
  filter: saturate(1.08) contrast(1.1) brightness(1.12);
}

.clue-detail-img.css-icon {
  filter: saturate(1.05) contrast(1.06) brightness(1.06);
}

.result-top {
  grid-template-columns: 1fr 148px;
}

.guilty-card {
  width: 148px;
}

.guilty-card .portrait.large {
  height: 160px;
}

.stamp {
  bottom: 44px;
  font-size: 27px;
  border-width: 5px;
}

.result-card {
  box-shadow:
    inset 0 0 0 1px rgba(198,155,75,0.28),
    0 18px 42px rgba(0,0,0,0.76),
    0 0 42px rgba(214,161,64,0.08);
}

/* Final premium motion and spacing */
.home-logo {
  height: clamp(188px, 24dvh, 222px);
}

.premium-logo-art {
  height: clamp(118px, 18dvh, 156px);
  margin-top: 34px;
  animation: logoReveal 520ms ease-out both;
}

.premium-logo-art + .tagline {
  margin-top: -12px;
}

.clue,
.suspect-card,
.choice,
.logic-choice,
.case-file,
.mode-card {
  will-change: transform;
}

.clue:hover,
.suspect-card:hover,
.choice:hover,
.logic-choice:hover,
.case-file:hover,
.mode-card:hover {
  transform: translateY(-2px) rotate(var(--tilt, 0deg));
  filter: brightness(1.05);
}

.choice.selected,
.logic-choice.selected {
  animation: selectedPulse 1.45s ease-in-out infinite;
}

.string-layer line {
  stroke-dasharray: 460;
  animation: stringSettle 900ms ease-out both;
}

.string-layer.proof line {
  animation: stringSettle 900ms ease-out both, proofPulse 1.8s ease-in-out infinite;
}

.modal-paper {
  animation: modalIn 180ms ease-out, paperImpact 240ms ease-out;
}

.reward-badges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 10px;
}

.reward-badges span {
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 5px;
  border-radius: 5px;
  color: #f8e7bd;
  text-align: center;
  font-size: 11px;
  line-height: 1.05;
  text-transform: uppercase;
  background:
    radial-gradient(circle at 50% 0, rgba(255,226,150,0.2), transparent 60%),
    linear-gradient(#49391d, #1e1710);
  box-shadow:
    inset 0 0 0 1px rgba(230,169,39,0.32),
    0 5px 10px rgba(0,0,0,0.34);
}

.result-card {
  margin-top: 6px;
}

@keyframes logoReveal {
  0% { opacity: 0; transform: translateY(10px) scale(0.96); filter: blur(1px) drop-shadow(0 0 0 rgba(0,0,0,0)); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes selectedPulse {
  0%, 100% { box-shadow: inset 0 0 0 3px #77aa4c, 0 0 10px rgba(94,140,61,0.34); }
  50% { box-shadow: inset 0 0 0 3px #8fd460, 0 0 18px rgba(126,196,83,0.55); }
}

@keyframes stringSettle {
  0% { stroke-dashoffset: 460; opacity: 0.2; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

@keyframes proofPulse {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(213,42,33,0.45)); }
  50% { filter: drop-shadow(0 0 9px rgba(213,42,33,0.78)); }
}

@keyframes paperImpact {
  0% { transform: scale(0.985); }
  100% { transform: scale(1); }
}

@media (max-width: 370px) {
  .home-logo { height: 202px; }
  .home-board { height: 238px; }
  .home-clues { top: 108px; }
  .home-suspects .portrait { height: 42px; }
  .suspect-card h4 { font-size: 9px; }
  .mode-card strong { font-size: 12px; }
}

@media (max-height: 820px) {
  .home-logo {
    height: 166px;
  }

  .premium-logo-art {
    height: 102px;
    margin-top: 26px;
  }

  .premium-logo-art + .tagline {
    margin-top: -7px;
    font-size: 17px;
  }

  .home-board {
    height: 232px;
  }

  .home-clues {
    top: 126px;
  }

  .home-clues .clue {
    min-height: 76px;
  }

  .home-clues .mini-img {
    height: 36px;
  }

  .home-suspects {
    bottom: 4px;
  }

  .home-suspects .suspect-card {
    min-height: 74px;
  }

  .home-suspects .portrait {
    height: 42px;
  }

  .play-wrap {
    margin-top: 6px;
  }

  .mode-row {
    margin-top: 8px;
  }
}

@keyframes pinBounce {
  0% { transform: scale(1); }
  45% { transform: scale(1.32); }
  100% { transform: scale(1); }
}

@keyframes dustFloat {
  from { background-position: 0 0, 0 0; }
  to { background-position: 86px 113px, -127px 91px; }
}

@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* Premium upgrade pass: motion, ambience, and tactile feedback */
#game-app.screen-swap #screen-container > .screen {
  animation: premiumScreenIn 340ms cubic-bezier(0.18, 0.9, 0.22, 1) both;
}

#game-app[data-screen="home"].screen-swap .home-board {
  animation: boardRise 460ms cubic-bezier(0.2, 0.86, 0.25, 1) both;
}

#game-app[data-screen="home"].screen-swap .home-mode-grid .mode-card {
  animation: evidenceDeal 340ms cubic-bezier(0.2, 0.86, 0.25, 1) both;
}

#game-app[data-screen="home"].screen-swap .home-mode-grid .mode-card:nth-child(2) {
  animation-delay: 45ms;
}

#game-app[data-screen="home"].screen-swap .home-mode-grid .mode-card:nth-child(3) {
  animation-delay: 90ms;
}

#game-app[data-screen="investigation"].screen-swap .clue,
#game-app[data-screen="logic"].screen-swap .logic-choice,
#game-app[data-screen="accusation"].screen-swap .choice {
  animation: evidenceDeal 360ms cubic-bezier(0.2, 0.86, 0.25, 1) both;
}

#game-app[data-screen="investigation"].screen-swap .clue:nth-of-type(2),
#game-app[data-screen="logic"].screen-swap .logic-choice:nth-of-type(2),
#game-app[data-screen="accusation"].screen-swap .choice:nth-of-type(2) {
  animation-delay: 40ms;
}

#game-app[data-screen="investigation"].screen-swap .clue:nth-of-type(3),
#game-app[data-screen="logic"].screen-swap .logic-choice:nth-of-type(3),
#game-app[data-screen="accusation"].screen-swap .choice:nth-of-type(3) {
  animation-delay: 80ms;
}

#game-app[data-screen="investigation"].screen-swap .clue:nth-of-type(4),
#game-app[data-screen="logic"].screen-swap .logic-choice:nth-of-type(4),
#game-app[data-screen="accusation"].screen-swap .choice:nth-of-type(4) {
  animation-delay: 120ms;
}

#game-app[data-screen="investigation"].screen-swap .clue:nth-of-type(5),
#game-app[data-screen="logic"].screen-swap .logic-choice:nth-of-type(5),
#game-app[data-screen="accusation"].screen-swap .choice:nth-of-type(5) {
  animation-delay: 160ms;
}

#game-app[data-screen="correct"].screen-swap .result-card {
  animation: resultRise 420ms cubic-bezier(0.18, 0.9, 0.22, 1) both;
}

#game-app[data-screen="correct"] .reward-badges span {
  animation: badgePop 420ms cubic-bezier(0.2, 0.95, 0.2, 1) both;
}

#game-app[data-screen="correct"] .reward-badges span:nth-child(2) {
  animation-delay: 70ms;
}

#game-app[data-screen="correct"] .reward-badges span:nth-child(3) {
  animation-delay: 140ms;
}

#game-app[data-case-id="2"] #screen-container::before {
  background:
    radial-gradient(circle at 28% 14%, rgba(122, 153, 89, 0.14), transparent 36%),
    radial-gradient(circle at 72% 28%, rgba(227, 177, 78, 0.1), transparent 42%);
}

#game-app[data-case-id="2"] .investigation-board,
#game-app[data-case-id="2"] .logic-board,
#game-app[data-case-id="2"] .accuse-panel {
  box-shadow:
    inset 0 0 0 2px rgba(161, 179, 104, 0.15),
    inset 0 12px 36px rgba(118, 92, 41, 0.22),
    0 16px 42px rgba(0,0,0,0.7),
    0 0 38px rgba(109, 133, 72, 0.08);
}

#game-app[data-case-id="2"] .clue,
#game-app[data-case-id="2"] .suspect-card,
#game-app[data-case-id="2"] .modal-paper {
  filter: saturate(1.05) contrast(1.02);
}

#game-app[data-case-id="2"] .investigation-board {
  background:
    radial-gradient(circle at 52% 0, rgba(208, 228, 145, 0.16), transparent 170px),
    linear-gradient(rgba(31, 47, 30, 0.2), rgba(26, 17, 11, 0.18)),
    url("./premium-board-bg.png") center 30% / cover no-repeat,
    linear-gradient(#75502e, #3c2717);
}

#game-app[data-case-id="2"] .paper,
#game-app[data-case-id="2"] .clue,
#game-app[data-case-id="2"] .suspect-card {
  box-shadow:
    0 8px 14px rgba(0,0,0,0.32),
    inset 0 0 0 1px rgba(85, 72, 42, 0.22),
    0 0 18px rgba(124, 151, 74, 0.08);
}

#game-app[data-case-id="2"] .clue-glove-residue,
#game-app[data-case-id="2"] .clue-fertilizer-bag {
  box-shadow:
    0 10px 18px rgba(0,0,0,0.42),
    inset 0 0 0 2px rgba(126, 160, 79, 0.34),
    0 0 22px rgba(151, 190, 91, 0.14);
}

#game-app[data-case-id="2"] .string-layer line {
  stroke: rgba(188, 54, 40, 0.92);
  filter: drop-shadow(0 0 4px rgba(107, 133, 70, 0.3));
}

#game-app[data-case-id="2"] .result-banner {
  background: linear-gradient(90deg, #4f7434, #283c22);
}

#game-app[data-case-id="2"] .solution-paper {
  border-left-color: #9fc55d;
  background:
    linear-gradient(90deg, rgba(159, 197, 93, 0.15), transparent),
    rgba(255,255,255,0.035);
}

.yellow-btn,
.primary-accuse,
.clear-btn,
.status-btn,
.mode-card,
.nav-btn {
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.yellow-btn:active,
.primary-accuse:active,
.clear-btn:active,
.status-btn:active,
.mode-card:active,
.nav-btn:active {
  transform: translateY(2px) scale(0.985);
  filter: brightness(0.94);
}

.result-card::after,
.modal-paper::after {
  pointer-events: none;
}

.feedback-pop {
  animation: feedbackPop 360ms cubic-bezier(0.18, 0.92, 0.24, 1.18) both;
  z-index: 2;
}

.feedback-glow {
  animation: feedbackGlow 520ms cubic-bezier(0.18, 0.92, 0.24, 1.08) both;
  z-index: 2;
}

.choice.selected.feedback-pop,
.logic-choice.selected.feedback-pop {
  animation:
    feedbackPop 360ms cubic-bezier(0.18, 0.92, 0.24, 1.18) both,
    selectedPulse 1.45s ease-in-out 360ms infinite;
}

.clue.collected .badge {
  background: linear-gradient(#78b24c, #315f24);
  color: #fff6d7;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.2), 0 3px 8px rgba(0,0,0,0.38);
}

@keyframes premiumScreenIn {
  0% { opacity: 0; transform: translateY(10px) scale(0.992); filter: blur(1px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes boardRise {
  0% { opacity: 0; transform: translateY(16px) rotate(-0.5deg); }
  100% { opacity: 1; transform: translateY(0) rotate(0); }
}

@keyframes evidenceDeal {
  0% { opacity: 0; transform: translateY(13px) rotate(calc(var(--tilt, 0deg) - 1.5deg)); }
  100% { opacity: 1; transform: translateY(0) rotate(var(--tilt, 0deg)); }
}

@keyframes resultRise {
  0% { opacity: 0; transform: translateY(18px) scale(0.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes badgePop {
  0% { opacity: 0; transform: translateY(8px) scale(0.92); }
  70% { opacity: 1; transform: translateY(-1px) scale(1.035); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes feedbackPop {
  0% { transform: translateY(0) scale(1); filter: brightness(1); }
  45% { transform: translateY(-3px) scale(1.035); filter: brightness(1.16); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes feedbackGlow {
  0% { transform: rotate(var(--tilt, 0deg)) scale(1); filter: brightness(1); }
  42% {
    transform: rotate(var(--tilt, 0deg)) translateY(-3px) scale(1.035);
    filter: brightness(1.18);
    box-shadow:
      0 12px 20px rgba(0,0,0,0.42),
      inset 0 0 0 2px rgba(255,215,111,0.5),
      0 0 22px rgba(240,182,51,0.32);
  }
  100% { transform: rotate(var(--tilt, 0deg)) scale(1); filter: brightness(1); }
}

@media (prefers-reduced-motion: reduce) {
  #game-app.screen-swap #screen-container > .screen,
  #game-app[data-screen="home"].screen-swap .home-board,
  #game-app[data-screen="home"].screen-swap .home-mode-grid .mode-card,
  #game-app[data-screen="investigation"].screen-swap .clue,
  #game-app[data-screen="logic"].screen-swap .logic-choice,
  #game-app[data-screen="accusation"].screen-swap .choice,
  #game-app[data-screen="correct"].screen-swap .result-card,
  #game-app[data-screen="correct"] .reward-badges span,
  .feedback-pop,
  .feedback-glow,
  .choice.selected,
  .logic-choice.selected,
  .string-layer line,
  .string-layer.proof line,
  .modal-paper,
  .premium-logo-art {
    animation: none !important;
  }
}

/* Stable home layout override: prevents reload/short-viewport overlap */
#game-app[data-screen="home"] #screen-container {
  overflow-y: auto;
}

#game-app[data-screen="home"] .home-screen {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
}

#game-app[data-screen="home"] .hud {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 18px;
  height: 46px;
  z-index: 20;
}

#game-app[data-screen="home"] .home-logo {
  flex: 0 0 auto;
  height: 112px;
  margin-top: 2px;
  display: block;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.85));
}

#game-app[data-screen="home"] .lamp {
  top: -8px;
  width: 96px;
  height: 48px;
}

#game-app[data-screen="home"] .lamp::after {
  width: 38px;
  height: 15px;
  bottom: 6px;
}

#game-app[data-screen="home"] .premium-logo-art {
  width: min(340px, 76%);
  height: 90px;
  margin: 42px auto 0;
}

#game-app[data-screen="home"] .premium-logo-art + .tagline {
  display: block;
  width: fit-content;
  max-width: 78%;
  margin: -1px auto 0;
  font-size: 15px;
  white-space: nowrap;
}

#game-app[data-screen="home"] .home-board {
  flex: 0 0 auto;
  height: 344px;
  margin-top: 0;
  overflow: hidden;
}

#game-app[data-screen="home"] .victim-photo {
  top: 28px;
  width: 126px;
}

#game-app[data-screen="home"] .victim-photo .placeholder-img {
  height: 82px;
}

#game-app[data-screen="home"] .victim-note {
  top: 58px;
}

#game-app[data-screen="home"] .scene-note {
  top: 66px;
}

#game-app[data-screen="home"] .home-clues {
  top: 172px;
  padding: 0 8px;
  gap: 5px;
}

#game-app[data-screen="home"] .home-clues .clue {
  min-height: 82px;
}

#game-app[data-screen="home"] .home-clues .mini-img {
  height: 38px;
}

#game-app[data-screen="home"] .lying {
  top: 252px;
  z-index: 8;
}

#game-app[data-screen="home"] .home-suspects {
  bottom: 8px;
  padding: 0 8px;
  gap: 7px;
}

#game-app[data-screen="home"] .home-suspects .suspect-card {
  min-height: 98px;
}

#game-app[data-screen="home"] .home-suspects .portrait {
  height: 54px;
}

#game-app[data-screen="home"] .play-wrap {
  margin-top: 2px;
}

#game-app[data-screen="home"] .play-wrap .yellow-btn {
  min-height: 72px;
}

#game-app[data-screen="home"] .mode-row {
  margin-top: 5px;
  gap: 10px;
  height: 76px;
}

#game-app[data-screen="home"] .mode-card {
  min-height: 76px;
}

@media (max-height: 780px) {
  #game-app[data-screen="home"] .home-logo {
    height: 82px;
  }

  #game-app[data-screen="home"] .lamp {
    display: none;
  }

  #game-app[data-screen="home"] .premium-logo-art {
    height: 68px;
    margin-top: 4px;
  }

  #game-app[data-screen="home"] .premium-logo-art + .tagline {
    display: none;
  }

  #game-app[data-screen="home"] .home-board {
    height: 330px;
  }

  #game-app[data-screen="home"] .play-wrap .yellow-btn {
    min-height: 68px;
  }

  #game-app[data-screen="home"] .mode-card {
    min-height: 70px;
  }
}

/* Production polish: commercial mobile game finish */
#game-app {
  background:
    radial-gradient(circle at 50% -8%, rgba(242, 189, 83, 0.16), transparent 260px),
    linear-gradient(180deg, rgba(17,15,12,0.98), rgba(5,5,5,0.99));
}

#game-app[data-screen="briefing"] #screen-container,
#game-app[data-screen="caseSelect"] #screen-container,
#game-app[data-screen="settings"] #screen-container,
#game-app[data-screen="logic"] #screen-container,
#game-app[data-screen="notes"] #screen-container,
#game-app[data-screen="accusation"] #screen-container,
#game-app[data-screen="correct"] #screen-container,
#game-app[data-screen="incorrect"] #screen-container {
  padding-top: 8px;
}

.case-hud {
  border: 1px solid rgba(198,155,75,0.22);
  background:
    radial-gradient(circle at 50% 0, rgba(242,195,98,0.08), transparent 70%),
    linear-gradient(#181511, #090807);
}

.brief-card,
.notebook,
.accuse-panel,
.result-card,
.modal-paper {
  border: 1px solid rgba(75, 49, 28, 0.36);
}

.brief-card,
.notebook,
.accuse-panel {
  background:
    radial-gradient(circle at 18% 0, rgba(255,255,255,0.2), transparent 180px),
    repeating-linear-gradient(0deg, rgba(81,53,27,0.05) 0 1px, transparent 1px 7px),
    linear-gradient(135deg, #eadbbb, #c4af86);
  box-shadow:
    0 16px 34px rgba(0,0,0,0.64),
    inset 0 0 0 1px rgba(255,255,255,0.32);
}

.brief-card {
  max-height: calc(100dvh - var(--bottom-nav-height) - 86px);
  overflow-y: auto;
}

.brief-card h1,
.notebook h1,
.accuse-panel h1 {
  letter-spacing: 0;
  color: #1d1711;
}

.brief-photo.crime-scene-photo {
  height: 154px;
  border: 7px solid #efe2c2;
  transform: rotate(-1deg);
}

.yellow-btn {
  border: 1px solid rgba(95,59,12,0.34);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.22), transparent 30%),
    linear-gradient(#f6cf53, #d8921e);
  text-shadow: 0 1px 0 rgba(255,255,255,0.26);
}

.yellow-btn strong {
  letter-spacing: 0;
}

.secondary-btn,
.status-btn,
.case-file,
.choice,
.logic-choice,
.mode-card,
.nav-btn {
  letter-spacing: 0;
}

.clue,
.suspect-card,
.choice,
.logic-choice,
.case-file,
.mode-card {
  -webkit-tap-highlight-color: transparent;
}

.suspect-card h4,
.suspect-card p,
.choice,
.logic-choice span,
.note-entry,
.timeline-entry,
.modal-paper p,
.brief-card p {
  font-family: "Trebuchet MS", Arial, sans-serif;
}

.suspect-card h4,
.choice,
.mode-card strong,
.nav-btn span:last-child {
  overflow-wrap: anywhere;
}

.modal-backdrop {
  backdrop-filter: blur(2px);
}

.modal-paper {
  width: min(92vw, 358px);
}

.clue-detail-img {
  height: clamp(148px, 22dvh, 186px);
}

.choice-grid,
.choice-grid.evidence {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice {
  min-height: 86px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
}

.choice.motive {
  min-height: 44px;
}

.choice-grid.evidence .choice {
  min-height: 78px;
}

@media (min-width: 390px) {
  .choice-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .choice-grid.evidence {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  :root {
    --bottom-nav-height: 68px;
  }

  #screen-container {
    padding-left: 8px;
    padding-right: 8px;
  }

  #game-app[data-screen="home"] .home-board {
    height: 320px;
  }

  #game-app[data-screen="home"] .home-clues {
    top: 164px;
  }

  #game-app[data-screen="home"] .home-suspects .suspect-card {
    min-height: 90px;
  }

  #game-app[data-screen="home"] .home-suspects .portrait {
    height: 48px;
  }

  .case-title strong {
    font-size: 13px;
  }

  .brief-grid {
    grid-template-columns: 104px 1fr;
    gap: 10px;
  }

  .brief-photo.crime-scene-photo {
    height: 136px;
  }

  .modal-paper {
    padding: 15px;
  }
}

@media (min-width: 420px) and (min-height: 900px) {
  #game-app[data-screen="home"] .home-logo {
    height: 128px;
  }

  #game-app[data-screen="home"] .premium-logo-art {
    height: 104px;
  }

  #game-app[data-screen="home"] .home-board {
    height: 364px;
  }

  #game-app[data-screen="home"] .home-clues {
    top: 184px;
  }

  #game-app[data-screen="home"] .play-wrap .yellow-btn {
    min-height: 78px;
  }

  #game-app[data-screen="home"] .mode-card {
    min-height: 82px;
  }
}

/* First-play intro and level system */
#game-app[data-screen="intro"] #screen-container {
  height: 100%;
  padding: 18px 16px;
}

.intro-screen {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
}

.intro-hero {
  position: relative;
  min-height: 226px;
  display: grid;
  align-content: end;
  justify-items: center;
  text-align: center;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,0.82));
}

.intro-hero .lamp {
  top: -18px;
}

.intro-hero .premium-logo-art {
  width: min(360px, 94%);
  height: clamp(132px, 18dvh, 168px);
  margin-top: 42px;
}

.intro-hero p {
  margin: -6px 0 0;
  padding: 5px 12px;
  color: #1a130d;
  background: linear-gradient(#ead8aa, #b9985e);
  transform: rotate(-1deg);
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: 16px;
}

.intro-casefile,
.rank-strip {
  border-radius: 7px;
  background:
    radial-gradient(circle at 16% 0, rgba(255,255,255,0.16), transparent 140px),
    linear-gradient(135deg, rgba(238,220,178,0.94), rgba(161,133,86,0.92));
  box-shadow:
    0 12px 24px rgba(0,0,0,0.58),
    inset 0 0 0 1px rgba(255,255,255,0.28);
}

.intro-casefile {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 12px;
  padding: 12px;
  color: #201710;
}

.intro-casefile .victim-portrait {
  height: 104px;
  border: 6px solid #f1e1bc;
  transform: rotate(-1deg);
}

.intro-casefile small,
.rank-strip span,
.rank-strip b {
  color: #832018;
  font-family: Impact, "Arial Narrow", sans-serif;
  text-transform: uppercase;
}

.intro-casefile h1 {
  margin: 4px 0 12px;
  color: #211811;
  font-size: 28px;
  line-height: 0.95;
}

.rank-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(47, 34, 20, 0.24);
}

.rank-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f5ca45, #77aa4c);
}

.intro-steps {
  display: grid;
  gap: 8px;
}

.intro-steps div {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 7px;
  color: #f4e6c8;
  background: rgba(14, 12, 10, 0.76);
  box-shadow: inset 0 0 0 1px rgba(198,155,75,0.18);
}

.intro-steps .nav-icon {
  color: var(--gold);
}

.intro-steps p {
  margin: 0;
  font-size: 13px;
}

.intro-start {
  min-height: 70px;
}

.rank-strip {
  flex: 0 0 auto;
  min-height: 38px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: #211811;
}

.rank-strip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

#game-app[data-screen="home"] .rank-strip {
  margin-top: -2px;
}

#game-app[data-screen="home"] .victim-portrait {
  height: 82px;
}

.brief-photo.victim-portrait {
  height: 154px;
  border: 7px solid #efe2c2;
  transform: rotate(-1deg);
}

.victim-case-1 {
  background-position: 99% 0%;
}

.victim-case-2 {
  background-position: 0% 99%;
}

.victim-case-3 {
  background-position: 0% 0%;
}

.victim-case-4 {
  background-position: 99% 99%;
}

.victim-case-5 {
  background-position: 50% 99%;
}

.premium-hub {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.hub-title {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(83, 52, 24, 0.22);
}

.hub-title .nav-icon {
  width: 42px;
  height: 42px;
  color: #9b2a1d;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,0.28));
}

.hub-title small,
.stat-card small,
.profile-badge small,
.award-row span,
.award-row b {
  color: #8b241b;
  font-family: Impact, "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.hub-title h1 {
  margin: 1px 0 0;
  color: #221710;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 0.9;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat-card {
  min-height: 72px;
  padding: 10px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.26), transparent 42%),
    repeating-linear-gradient(0deg, rgba(57, 36, 17, 0.04) 0 1px, transparent 1px 5px),
    rgba(112, 82, 45, 0.12);
  box-shadow:
    inset 0 0 0 1px rgba(68, 42, 17, 0.2),
    0 5px 10px rgba(0,0,0,0.2);
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  color: #25180e;
  font-size: 25px;
  line-height: 1;
}

.case-awards {
  display: grid;
  gap: 8px;
}

.award-row,
.shop-item {
  width: 100%;
  display: grid;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 7px;
  color: #24170f;
  text-align: left;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.16), transparent),
    rgba(86, 59, 28, 0.14);
  box-shadow:
    inset 0 0 0 1px rgba(75, 46, 20, 0.18),
    0 5px 10px rgba(0,0,0,0.18);
}

.award-row {
  grid-template-columns: 54px 1fr auto;
  min-height: 54px;
  padding: 9px 10px;
}

.award-row.complete {
  background:
    linear-gradient(90deg, rgba(114, 157, 66, 0.26), transparent 70%),
    rgba(86, 59, 28, 0.14);
}

.award-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.profile-badge {
  display: grid;
  grid-template-columns: 86px 1fr;
  align-items: center;
  gap: 14px;
  padding: 13px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 20% 18%, rgba(255,255,255,0.24), transparent 100px),
    linear-gradient(135deg, rgba(68, 45, 22, 0.18), rgba(119, 86, 43, 0.1));
  box-shadow: inset 0 0 0 1px rgba(82, 51, 21, 0.2);
}

.badge-ring {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #f2d891 0 42%, #9a7034 43% 57%, #22170f 58%),
    linear-gradient(#f5c948, #9c6d24);
  box-shadow:
    inset 0 0 0 4px rgba(255,255,255,0.18),
    0 8px 14px rgba(0,0,0,0.32);
}

.badge-ring span {
  color: #20150e;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: 31px;
}

.profile-badge strong {
  display: block;
  margin: 3px 0 8px;
  color: #20150e;
  font-size: 18px;
}

.profile-badge p {
  margin: 7px 0 0;
  color: #604728;
  font-size: 12px;
}

.shop-item {
  grid-template-columns: 44px 1fr auto;
  min-height: 78px;
  padding: 10px;
}

.shop-token {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background:
    radial-gradient(circle at 32% 24%, rgba(255,255,255,0.3), transparent 30%),
    linear-gradient(135deg, #e7be55, #7b5424);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.2),
    0 6px 10px rgba(0,0,0,0.26);
}

.shop-item strong {
  color: #22170f;
  font-size: 15px;
}

.shop-item p {
  margin: 3px 0 0;
  color: #4c3924;
  font-size: 12px;
  line-height: 1.25;
}

.shop-item .secondary-btn {
  min-width: 60px;
  min-height: 36px;
  padding: 0 8px;
  font-size: 11px;
}

@media (max-height: 820px) {
  .intro-hero {
    min-height: 180px;
  }

  .intro-hero .premium-logo-art {
    height: 108px;
  }

  .intro-casefile {
    grid-template-columns: 82px 1fr;
  }

  .intro-casefile .victim-portrait {
    height: 92px;
  }

  .intro-steps div {
    padding: 8px 10px;
  }

  .rank-strip {
    min-height: 34px;
  }

  .premium-hub {
    gap: 9px;
    padding: 13px;
  }

  .stat-card {
    min-height: 62px;
  }

  .shop-item {
    min-height: 68px;
  }
}

/* Reference-matched bottom nav icons */
#bottom-nav.home .nav-btn {
  gap: 2px;
}

#bottom-nav.home .nav-btn span:last-child {
  font-size: 8px;
  letter-spacing: 0;
  text-transform: uppercase;
}

#bottom-nav.home .nav-icon {
  width: 30px;
  height: 27px;
  color: #c9a762;
  filter:
    drop-shadow(0 2px 2px rgba(0,0,0,0.72))
    drop-shadow(0 0 5px rgba(211,169,91,0.12));
}

#bottom-nav.home .nav-btn:first-child::after {
  content: "!";
  position: absolute;
  top: 10px;
  left: calc(50% + 8px);
  width: 12px;
  height: 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff7df;
  font: 9px/1 Impact, "Arial Narrow", sans-serif;
  background: linear-gradient(#e74734, #9e1d16);
  box-shadow:
    0 0 0 1px rgba(255,220,170,0.32),
    0 2px 4px rgba(0,0,0,0.58);
  z-index: 3;
}

#bottom-nav.home .nav-icon.folder::before {
  left: 7px;
  top: 3px;
  width: 16px;
  height: 18px;
  inset: auto;
  border-radius: 3px;
  clip-path: polygon(50% 0, 92% 12%, 92% 61%, 50% 100%, 8% 61%, 8% 12%);
  background:
    radial-gradient(circle at 50% 47%, transparent 0 4px, rgba(51,35,16,0.42) 4.5px 5.5px, transparent 6px),
    linear-gradient(180deg, rgba(255,242,181,0.32), transparent 42%),
    linear-gradient(#d4b46b, #8d642d);
  box-shadow:
    inset 0 0 0 2px rgba(55,37,17,0.46),
    inset 0 0 0 3px rgba(255,226,148,0.2),
    0 2px 0 rgba(0,0,0,0.45);
}

#bottom-nav.home .nav-icon.folder::after {
  content: "★";
  left: 8px;
  top: 5px;
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 0;
  color: #2b2113;
  font-size: 10px;
  line-height: 1;
  background: transparent;
  box-shadow: none;
  text-shadow: 0 1px 0 rgba(255,236,170,0.2);
}

#bottom-nav.home .nav-icon.detective::before {
  left: 8px;
  top: 10px;
  width: 14px;
  height: 13px;
  border-radius: 50% 50% 46% 46%;
  background:
    linear-gradient(90deg, transparent 0 17%, #2f2417 18% 39%, transparent 40% 60%, #2f2417 61% 82%, transparent 83%),
    radial-gradient(circle at 50% 95%, #2f2417 0 2px, transparent 2.5px),
    linear-gradient(#d6b162, #93672d);
  box-shadow:
    inset 0 -3px 0 rgba(60,39,17,0.36),
    0 2px 0 rgba(0,0,0,0.42);
}

#bottom-nav.home .nav-icon.detective::after {
  left: 4px;
  top: 3px;
  width: 22px;
  height: 11px;
  border-radius: 50% 50% 42% 42%;
  background:
    radial-gradient(ellipse at 50% 100%, #2d2115 0 18%, transparent 19%),
    linear-gradient(180deg, rgba(255,242,181,0.3), transparent 42%),
    linear-gradient(#e4c373, #9b6b2f);
  box-shadow:
    0 4px 0 -1px #7d5525,
    inset 0 -2px 0 rgba(61,39,16,0.35);
}

#bottom-nav.home .nav-icon.cart::before {
  left: 6px;
  top: 6px;
  width: 17px;
  height: 12px;
  border: 0;
  border-radius: 1px 1px 4px 4px;
  clip-path: polygon(0 0, 100% 0, 84% 74%, 18% 74%);
  background:
    repeating-linear-gradient(90deg, transparent 0 5px, rgba(53,36,17,0.35) 5px 7px),
    linear-gradient(180deg, rgba(255,239,177,0.22), transparent 38%),
    linear-gradient(#d1ad63, #91652b);
  box-shadow:
    inset 0 0 0 1px rgba(255,232,169,0.18),
    0 2px 0 rgba(0,0,0,0.42);
}

#bottom-nav.home .nav-icon.cart::after {
  left: 5px;
  top: 3px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 31% 86%, currentColor 0 2px, transparent 2.5px),
    radial-gradient(circle at 74% 86%, currentColor 0 2px, transparent 2.5px),
    linear-gradient(105deg, transparent 0 12%, currentColor 13% 20%, transparent 21%);
  box-shadow: none;
}

@media (max-height: 860px) {
  #game-app[data-screen="home"] .mode-row {
    height: 72px;
  }

  #game-app[data-screen="home"] .mode-card {
    min-height: 72px;
  }
}

/* Final premium navbar pass */
#bottom-nav.home {
  height: calc(76px + var(--safe-bottom));
  padding: 7px 10px calc(7px + var(--safe-bottom));
  column-gap: 6px;
  background:
    linear-gradient(180deg, rgba(48, 38, 26, 0.94), rgba(11, 9, 8, 0.98) 58%),
    radial-gradient(circle at 50% 0, rgba(242, 196, 89, 0.18), transparent 72%);
  box-shadow:
    inset 0 1px 0 rgba(255, 216, 134, 0.22),
    inset 0 12px 20px rgba(255, 216, 134, 0.035),
    0 -12px 26px rgba(0,0,0,0.58);
}

#bottom-nav.home .nav-btn {
  min-height: 62px;
  padding: 6px 4px 5px;
  gap: 4px;
  border: 0;
  border-radius: 10px;
  color: #a98d51;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 180ms cubic-bezier(0.2, 0.9, 0.2, 1),
    color 180ms ease,
    background 180ms ease,
    filter 180ms ease,
    box-shadow 180ms ease;
}

#bottom-nav.home .nav-btn::before {
  display: none;
}

#bottom-nav.home .nav-btn.active {
  color: #f0c66c;
  background:
    radial-gradient(circle at 50% 16%, rgba(246, 199, 102, 0.24), transparent 52%),
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(0,0,0,0.02));
  box-shadow:
    inset 0 0 0 1px rgba(238, 196, 106, 0.14),
    0 5px 12px rgba(0,0,0,0.18);
}

#bottom-nav.home .nav-btn:active {
  transform: translateY(1px) scale(0.965);
  filter: brightness(1.08);
}

#bottom-nav.home .nav-btn span:last-child {
  max-width: 100%;
  color: currentColor;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: clamp(9px, 2.35vw, 11px);
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(0,0,0,0.86),
    0 0 8px rgba(240, 198, 108, 0.16);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#bottom-nav.home .nav-icon {
  width: 34px;
  height: 32px;
  color: currentColor;
  opacity: 0.98;
  transform-origin: 50% 72%;
  filter:
    drop-shadow(0 2px 0 rgba(0,0,0,0.55))
    drop-shadow(0 0 7px rgba(239, 195, 104, 0.1));
  transition:
    transform 200ms cubic-bezier(0.2, 0.9, 0.2, 1),
    filter 180ms ease,
    opacity 180ms ease;
}

#bottom-nav.home .nav-btn.active .nav-icon {
  transform: translateY(-2px) scale(1.08);
  filter:
    drop-shadow(0 3px 0 rgba(0,0,0,0.45))
    drop-shadow(0 0 12px rgba(240, 198, 108, 0.42));
}

#bottom-nav.home .nav-btn:first-child::after {
  top: 5px;
  right: calc(50% - 24px);
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  font-family: Arial, sans-serif;
  font-size: 9px;
  line-height: 1;
  border: 1px solid rgba(255, 208, 153, 0.5);
  box-shadow:
    0 2px 5px rgba(0,0,0,0.5),
    0 0 8px rgba(221, 57, 34, 0.45);
}

#bottom-nav.home .nav-icon.folder::before {
  left: 6px;
  top: 5px;
  width: 22px;
  height: 24px;
  border-width: 2px;
}

#bottom-nav.home .nav-icon.folder::after {
  content: "\2605";
  left: 13px;
  top: 11px;
  font-size: 11px;
}

#bottom-nav.home .nav-icon.detective::before {
  left: 5px;
  top: 10px;
  width: 24px;
  height: 9px;
}

#bottom-nav.home .nav-icon.detective::after {
  left: 9px;
  top: 16px;
  width: 16px;
  height: 12px;
}

#bottom-nav.home .nav-icon.cart::before {
  left: 5px;
  top: 7px;
  width: 24px;
  height: 17px;
}

#bottom-nav.home .nav-icon.cart::after {
  left: 8px;
  top: 26px;
  width: 5px;
  height: 5px;
}

@media (max-width: 370px) {
  #bottom-nav.home {
    padding-left: 6px;
    padding-right: 6px;
    column-gap: 3px;
  }

  #bottom-nav.home .nav-btn span:last-child {
    font-size: 9px;
  }

  #bottom-nav.home .nav-icon {
    width: 32px;
    height: 30px;
  }
}
