:root {
  color-scheme: dark;
  --bg: #07132a;
  --panel: #0f234b;
  --panel-strong: #172f59;
  --accent: #4a82ff;
  --accent-soft: #5c8bff;
  --text: #e9f2ff;
  --subtext: #a9c3ff;
  --border: rgba(115, 150, 255, 0.15);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.30);
  --bg-glow-1: rgba(255, 69, 69, 0.16);
  --bg-glow-2: rgba(80, 8, 8, 0.32);
  --bg-main-top: #110909;
  --bg-main-bottom: #050505;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-main-top) 0%, var(--bg-main-bottom) 100%);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}

body[data-difficulty="trainee"] {
  --accent: #ff6b6b;
  --subtext: #d8b1b1;
  --bg-glow-1: rgba(255, 69, 69, 0.16);
  --bg-glow-2: rgba(80, 8, 8, 0.32);
  --bg-main-top: #110909;
  --bg-main-bottom: #050505;
}

body[data-difficulty="detective"] {
  --accent: #ff6b6b;
  --subtext: #d8b1b1;
  --bg-glow-1: rgba(255, 69, 69, 0.16);
  --bg-glow-2: rgba(80, 8, 8, 0.32);
  --bg-main-top: #110909;
  --bg-main-bottom: #050505;
}

body[data-difficulty="pro"] {
  --accent: #ff6b6b;
  --subtext: #d8b1b1;
  --bg-glow-1: rgba(255, 69, 69, 0.16);
  --bg-glow-2: rgba(80, 8, 8, 0.32);
  --bg-main-top: #110909;
  --bg-main-bottom: #050505;
}

.background-digits {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background-image: linear-gradient(rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.62)), url('detective_bg.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  animation: start-bg-drift 28s ease-in-out infinite alternate;
}

.background-digits::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image: linear-gradient(rgba(255, 70, 70, 0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 70, 70, 0.16) 1px, transparent 1px);
  background-size: 52px 52px;
  animation: start-grid-move 30s linear infinite;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
}

.background-digits::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 22%, rgba(0, 0, 0, 0.6) 100%);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

body.is-app-fullscreen,
html:fullscreen body,
html:-webkit-full-screen body,
html:-ms-fullscreen body,
body:fullscreen,
body:-webkit-full-screen,
body:-ms-fullscreen {
  display: block;
  padding: 0;
  overflow: hidden;
}

.app-shell {
  width: 100%;
  max-width: none;
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(8, 8, 8, 0.88), rgba(27, 4, 4, 0.7));
  border: 1px solid rgba(255, 65, 65, 0.28);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

body.is-app-fullscreen .app-shell,
html:fullscreen .app-shell,
html:-webkit-full-screen .app-shell,
html:-ms-fullscreen .app-shell,
body:fullscreen .app-shell,
body:-webkit-full-screen .app-shell,
body:-ms-fullscreen .app-shell {
  width: 100vw;
  min-height: 100vh;
  padding: 0;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

body.is-app-fullscreen .app-header,
body.is-app-fullscreen .game-panel,
html:fullscreen .app-header,
html:fullscreen .game-panel,
html:-webkit-full-screen .app-header,
html:-webkit-full-screen .game-panel,
html:-ms-fullscreen .app-header,
html:-ms-fullscreen .game-panel,
body:fullscreen .app-header,
body:fullscreen .game-panel,
body:-webkit-full-screen .app-header,
body:-webkit-full-screen .game-panel,
body:-ms-fullscreen .app-header,
body:-ms-fullscreen .game-panel {
  width: 100%;
}

body.is-app-fullscreen .app-header,
html:fullscreen .app-header,
html:-webkit-full-screen .app-header,
html:-ms-fullscreen .app-header,
body:fullscreen .app-header,
body:-webkit-full-screen .app-header,
body:-ms-fullscreen .app-header {
  padding: 18px 24px 0;
}

body.is-app-fullscreen .game-panel,
html:fullscreen .game-panel,
html:-webkit-full-screen .game-panel,
html:-ms-fullscreen .game-panel,
body:fullscreen .game-panel,
body:-webkit-full-screen .game-panel,
body:-ms-fullscreen .game-panel {
  padding: 0 24px 24px;
}

.start-modal {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  place-items: center;
  padding: clamp(8px, 1.8vh, 20px) clamp(8px, 1.4vw, 18px);
  background: #050505;
  overflow: hidden;
}

.start-bg-image {
  position: absolute;
  inset: -4%;
  background-image: linear-gradient(rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0.62)), url('detective_bg.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  animation: start-bg-drift 22s ease-in-out infinite alternate;
  will-change: transform, background-position;
}

.start-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 22%, rgba(0, 0, 0, 0.58) 100%);
  pointer-events: none;
}

.start-grid {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image: linear-gradient(rgba(255, 70, 70, 0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 70, 70, 0.16) 1px, transparent 1px);
  background-size: 52px 52px;
  animation: start-grid-move 30s linear infinite;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
}

.start-scanline {
  position: absolute;
  left: 0;
  right: 0;
  top: -16%;
  height: 18%;
  background: linear-gradient(to bottom, transparent, rgba(255, 35, 35, 0.03), rgba(255, 35, 35, 0.18), rgba(255, 35, 35, 0.03), transparent);
  filter: blur(1px);
  animation: start-scan 7.5s linear infinite;
  mix-blend-mode: screen;
  pointer-events: none;
}

.start-hex {
  position: absolute;
  width: 140px;
  height: 140px;
  left: 6%;
  top: 9%;
  border: 1px solid rgba(255, 64, 64, 0.25);
  clip-path: polygon(25% 6.7%, 75% 6.7%, 100% 50%, 75% 93.3%, 25% 93.3%, 0 50%);
  animation: start-spin 30s linear infinite;
  box-shadow: 0 0 26px rgba(255, 0, 0, 0.08);
}

.start-hex::before,
.start-hex::after {
  content: '';
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 64, 64, 0.22);
  clip-path: inherit;
}

.start-hex::after {
  inset: 38px;
}

.start-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ff5a5a;
  box-shadow: 0 0 10px #ff2525;
  opacity: 0.28;
  animation: start-float-up linear infinite;
}

.start-p1 {
  left: 12%;
  bottom: -10px;
  animation-duration: 14s;
}

.start-p2 {
  left: 24%;
  bottom: -30px;
  animation-duration: 18s;
  animation-delay: -8s;
}

.start-p3 {
  left: 72%;
  bottom: -20px;
  animation-duration: 16s;
  animation-delay: -4s;
}

.start-p4 {
  left: 86%;
  bottom: -30px;
  animation-duration: 21s;
  animation-delay: -11s;
}

.start-p5 {
  left: 55%;
  bottom: -25px;
  animation-duration: 19s;
  animation-delay: -6s;
}

.start-modal__panel {
  width: min(1040px, 100%);
  max-height: calc(100svh - 16px);
  overflow: hidden;
  padding: clamp(14px, 2.2vh, 28px) clamp(12px, 2vw, 24px);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(8, 8, 8, 0.84), rgba(27, 4, 4, 0.74));
  border: 1px solid rgba(255, 65, 65, 0.38);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 28px 80px rgba(0, 0, 0, 0.58), inset 0 0 44px rgba(255, 0, 0, 0.05);
  text-align: center;
  animation: start-panel-pulse 4s ease-in-out infinite;
}

.start-eyebrow {
  text-align: center;
  color: #ff5959;
  letter-spacing: 0.22em;
  font-size: 0.68rem;
  margin-bottom: 8px;
}

.start-modal__title {
  margin: 0 0 6px;
  font-size: 2.15rem;
  color: #f4f4f4;
}

.start-modal__text {
  margin: 0 0 20px;
  color: #b8b8b8;
  line-height: 1.7;
}

.start-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .start-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.start-level-button {
  position: relative;
  width: 100%;
  min-height: 280px;
  padding: 18px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(17, 17, 17, 0.78), rgba(5, 5, 5, 0.9));
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.start-level-button::before {
  content: '';
  position: absolute;
  inset: -45% -10%;
  background: linear-gradient(110deg, transparent 38%, rgba(255, 70, 70, 0.12) 49%, transparent 60%);
  transform: translateX(-85%);
  animation: start-card-sweep 6s linear infinite;
}

.start-level-button:nth-child(2)::before {
  animation-delay: 2s;
}

.start-level-button:nth-child(3)::before {
  animation-delay: 4s;
}

.start-level-button::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 73, 73, 0.6), transparent);
  opacity: 0.28;
}

.start-level-button:hover {
  transform: translateY(-6px);
  border-color: #ff4545;
  box-shadow: 0 0 0 1px rgba(255, 49, 49, 0.18), 0 0 30px rgba(255, 30, 30, 0.24), inset 0 0 30px rgba(255, 0, 0, 0.07);
  background: linear-gradient(180deg, rgba(54, 8, 8, 0.84), rgba(10, 6, 6, 0.94));
}

.start-level-button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.start-level-button.is-active {
  transform: translateY(-6px);
  border-color: #ff4545;
  box-shadow: 0 0 0 1px rgba(255, 49, 49, 0.18), 0 0 30px rgba(255, 30, 30, 0.24), inset 0 0 30px rgba(255, 0, 0, 0.07);
  background: linear-gradient(180deg, rgba(54, 8, 8, 0.84), rgba(10, 6, 6, 0.94));
}

.start-level-button:hover::before,
.start-level-button.is-active::before {
  opacity: 1;
}

.level-card-title {
  font-size: clamp(1.1rem, 1.6vw, 1.65rem);
  font-weight: 750;
  line-height: 1.15;
  max-width: 172px;
  position: relative;
  z-index: 1;
}

.level-card-meta {
  font-size: 0.78rem;
  color: #9f9f9f;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

.case-no {
  align-self: flex-start;
  font: 700 12px ui-monospace, monospace;
  letter-spacing: 0.2em;
  color: #d85b5b;
  position: relative;
  z-index: 1;
}

.level-index {
  font: 800 clamp(54px, 6vw, 82px) ui-monospace, monospace;
  line-height: 1;
  color: rgba(255, 255, 255, 0.1);
  text-shadow: 0 0 24px rgba(255, 0, 0, 0.16);
  position: relative;
  z-index: 1;
}

.start-level-button.is-active .level-index {
  color: rgba(255, 70, 70, 0.24);
}

.level-name {
  display: block;
}

.level-meta {
  display: block;
}

.select-mark {
  position: absolute;
  right: 13px;
  top: 13px;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.03);
}

.start-level-button.is-active .select-mark {
  background: #ff4545;
  border-color: #ff4545;
  box-shadow: 0 0 12px #ff4545, 0 0 0 4px rgba(255, 50, 50, 0.13);
  animation: start-blink 1.5s ease-in-out infinite;
}

.start-level-button--trainee {
  border-color: rgba(255, 255, 255, 0.2);
}

.start-level-button--detective {
  border-color: rgba(255, 255, 255, 0.2);
}

.start-level-button--pro {
  border-color: rgba(255, 255, 255, 0.2);
}

.difficulty-description {
  margin-bottom: 10px;
  color: #ff9c9c;
  font: 700 0.94rem ui-monospace, monospace;
  letter-spacing: 0.08em;
}

.start-mission-wrap {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.start-mission-button {
  width: min(430px, 100%);
  border: 1px solid #ff5a5a;
  color: #fff;
  background: linear-gradient(90deg, #5e0909, #b32020, #5e0909);
  background-size: 200% 100%;
  padding: 14px 28px;
  border-radius: 10px;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(255, 20, 20, 0.26);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-position 0.2s ease;
  animation: start-button-glow 2.8s ease-in-out infinite;
}

.start-mission-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 34px rgba(255, 20, 20, 0.4);
  background-position: 100% 0;
}

.start-mission-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.start-status {
  text-align: center;
  margin-top: 6px;
  color: #c45757;
  font: 11px ui-monospace, monospace;
  letter-spacing: 0.12em;
}

.start-counter {
  font-size: clamp(2.6rem, 7.5vw, 4.9rem);
  color: #f4f4f4;
  margin-top: 0;
  margin-bottom: 0;
  min-height: 0;
  line-height: 1;
}

.start-counter:empty {
  display: none;
}

.start-counter:not(:empty) {
  margin-top: 8px;
  min-height: 1.2em;
}

@keyframes start-bg-drift {
  0% {
    transform: scale(1.03) translate3d(-0.8%, -0.4%, 0);
  }
  100% {
    transform: scale(1.09) translate3d(0.8%, 0.6%, 0);
  }
}

@keyframes start-scan {
  0% {
    transform: translateY(-20vh);
  }
  100% {
    transform: translateY(130vh);
  }
}

@keyframes start-grid-move {
  to {
    background-position: 52px 52px;
  }
}

@keyframes start-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes start-float-up {
  0% {
    transform: translateY(0) scale(0.7);
    opacity: 0;
  }
  10% {
    opacity: 0.28;
  }
  100% {
    transform: translateY(-115vh) scale(1.5);
    opacity: 0;
  }
}

@keyframes start-panel-pulse {
  50% {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 28px 80px rgba(0, 0, 0, 0.58), inset 0 0 54px rgba(255, 0, 0, 0.08);
  }
}

@keyframes start-card-sweep {
  0%,
  68% {
    transform: translateX(-85%);
  }
  100% {
    transform: translateX(85%);
  }
}

@keyframes start-blink {
  50% {
    opacity: 0.45;
  }
}

@keyframes start-button-glow {
  50% {
    box-shadow: 0 0 34px rgba(255, 20, 20, 0.4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .start-bg-image,
  .start-grid,
  .start-scanline,
  .start-hex,
  .start-particle,
  .start-modal__panel,
  .start-level-button::before,
  .start-level-button.is-active .select-mark,
  .start-mission-button {
    animation: none !important;
  }
}

@media (max-width: 900px) {
  .start-level-button {
    min-height: 250px;
  }
}

@media (max-width: 700px) {
  body {
    overflow: hidden;
  }

  .start-modal__panel {
    padding: 22px 16px;
  }

  .start-actions {
    gap: 8px;
  }

  .start-level-button {
    min-height: 220px;
    border-radius: 14px;
    padding: 14px 8px;
  }

  .start-level-button:hover,
  .start-level-button.is-active {
    transform: translateY(-3px);
  }

  .level-card-title {
    font-size: 1rem;
    max-width: 100px;
  }

  .level-card-meta {
    font-size: 0.66rem;
  }

  .case-no {
    font-size: 9px;
  }

  .level-index {
    font-size: 44px;
  }

  .start-mission-button {
    font-size: 1rem;
    padding: 12px 18px;
  }

  .start-hex {
    width: 90px;
    height: 90px;
  }
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 22px;
  border: 1px solid #ff5a5a;
  border-radius: 18px;
  background: linear-gradient(90deg, #5e0909, #b32020, #5e0909);
  background-size: 200% 100%;
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-position 180ms ease;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 34px rgba(255, 20, 20, 0.4);
  background-position: 100% 0;
}

/* Ensure modal overlays allow interaction on their panels */
.start-modal,
.congrats-modal {
  pointer-events: auto !important;
}

.start-modal.hidden,
.congrats-modal.hidden {
  display: none !important;
}

.congrats-modal {
  position: fixed;
  inset: 0;
  z-index: 9999 !important;
  display: grid;
  place-items: center;
  background: rgba(5, 2, 2, 0.9);
  backdrop-filter: blur(8px);
}

.congrats-panel,
.start-modal__panel {
  position: relative;
  z-index: 10000;
}

.primary-button,
.ghost-button {
  pointer-events: auto !important;
}

.congrats-panel {
  width: min(520px, 100%);
  padding: 36px 30px;
  border-radius: 28px;
  border: 1px solid rgba(255, 65, 65, 0.4);
  background: linear-gradient(135deg, rgba(8, 8, 8, 0.88), rgba(27, 4, 4, 0.74));
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 28px 70px rgba(0, 0, 0, 0.55), inset 0 0 44px rgba(255, 0, 0, 0.06);
  position: relative;
  z-index: 10000;
}

.safe-lock {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(20, 9, 9, 1), rgba(38, 12, 12, 1));
  border: 2px solid rgba(255, 69, 69, 0.34);
  box-shadow: inset 0 0 28px rgba(255, 69, 69, 0.14);
}

.safe-door {
  position: absolute;
  inset: 20px;
  border-radius: 18px;
  background: radial-gradient(circle at top left, rgba(255, 69, 69, 0.2), rgba(18, 8, 8, 1));
  border: 1px solid rgba(255, 69, 69, 0.22);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.3);
}

.safe-dial {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), rgba(255, 80, 80, 0.18));
  border: 4px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.08);
  animation: dial-spin 3s ease-in-out infinite;
}

@keyframes dial-spin {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  50% { transform: translate(-50%, -50%) rotate(140deg); }
}

.congrats-title {
  margin: 0 0 12px;
  color: #ffd4d4;
  font-size: 2.1rem;
  font-weight: 900;
}

.congrats-text {
  margin: 0 0 24px;
  color: #d8b1b1;
  line-height: 1.7;
}

.start-modal.hidden {
  display: none;
}

.app-shell {
  width: 100%;
  max-width: none;
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(8, 8, 8, 0.88), rgba(27, 4, 4, 0.7));
  border: 1px solid rgba(255, 65, 65, 0.28);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 69, 69, 0.2), rgba(120, 18, 18, 0.28));
  overflow: hidden;
}

.brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.9rem, 2.5vw, 2.4rem);
  letter-spacing: -0.04em;
}

.brand p {
  margin: 4px 0 0;
  color: #c8a0a0;
  font-size: 0.98rem;
}

.game-panel {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 24px;
}

.puzzle-card,
.status-card {
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(15, 10, 10, 0.95), rgba(22, 8, 8, 0.95));
  border: 1px solid rgba(255, 65, 65, 0.2);
  padding: 26px;
}

.puzzle-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 24px;
}

.puzzle-card__title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ff6b6b;
}

.puzzle-card__content {
  display: grid;
  gap: 20px;
  line-height: 1.8;
  color: #e6d1d1;
}

.case-story {
  padding: 18px 20px;
  border-left: 3px solid #ff6b6b;
  border-radius: 14px;
  background: rgba(255, 69, 69, 0.08);
  color: #ff8f8f;
  font-size: 1.52rem;
  font-weight: 600;
  line-height: 1.58;
}

.puzzle-hint {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 69, 69, 0.08);
  border: 1px solid rgba(255, 69, 69, 0.22);
}

.puzzle-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
}

.puzzle-actions input {
  width: 100%;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 24, 48, 0.82);
  color: var(--text);
  font-size: 1rem;
}

.puzzle-actions input::placeholder {
  color: rgba(233, 242, 255, 0.55);
}

.puzzle-actions button {
  padding: 0 24px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #4a82ff, #2b5eff);
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.puzzle-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(74, 130, 255, 0.22);
}

.game-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 8px;
}

.question-step {
  font-size: 1.32rem;
  color: #f4f4f4;
}

.timer-shell {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 1.32rem;
  color: #d6b0b0;
}

.timer-value {
  font-weight: 900;
  font-size: 4.6rem;
  line-height: 1;
  color: #ff6b6b;
}

.question-text {
  font-size: 1.62rem;
  line-height: 1.52;
  color: #ff8f8f;
}

.puzzle-hint {
  font-size: 1.42rem;
  line-height: 1.52;
  color: #ff8f8f;
}

.question-text::before,
.puzzle-hint::before,
.case-story::before {
  display: block;
  margin-bottom: 6px;
  color: #ff6b6b;
  font-size: 0.72em;
  font-weight: 800;
}

.question-text::before {
  content: 'คำถาม :';
}

.puzzle-hint::before {
  content: 'คำใบ้ :';
}

.case-story::before {
  content: 'เหตุการณ์ :';
}

.timer-value.warning {
  color: #ff8b8b;
}

.ghost-button {
  width: 100%;
  margin-top: 16px;
  padding: 14px 20px;
  border: 1px solid rgba(255, 90, 90, 0.32);
  border-radius: 16px;
  background: rgba(70, 12, 12, 0.25);
  color: #ffe7e7;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease, visibility 160ms ease, transform 160ms ease;
}

.ghost-button.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.status-card {
  display: grid;
  gap: 18px;
}

.status-card__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(13, 33, 66, 0.8);
  border: 1px solid rgba(115, 150, 255, 0.12);
}

.status-card__item span {
  font-size: 0.95rem;
  color: var(--subtext);
}

.status-card__item strong {
  font-size: 1.2rem;
}

@media (max-width: 860px) {
  .game-panel {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 561px) and (max-width: 1024px) {
  body {
    padding: 12px;
  }

  .app-shell {
    padding: 18px;
  }

  .puzzle-card {
    gap: 14px;
    padding: 18px;
  }

  .question-step,
  .timer-shell {
    font-size: 1.04rem;
  }

  .timer-value {
    font-size: 3.2rem;
  }

  .case-story {
    font-size: 1.16rem;
    line-height: 1.58;
    padding: 14px 16px;
  }

  .question-text {
    font-size: 1.22rem;
    line-height: 1.5;
  }

  .puzzle-hint {
    font-size: 1.14rem;
    line-height: 1.5;
    padding: 14px 16px;
  }

  .answer-grid {
    gap: 10px;
  }

  .answer-button {
    padding: 11px 14px;
    font-size: 1rem;
    line-height: 1.3;
  }

  .result-text {
    font-size: 1rem;
    min-height: 44px;
  }
}

@media (min-width: 768px) and (max-width: 1180px) and (max-height: 900px) {
  body {
    padding: 8px;
  }

  .app-shell {
    padding: 14px;
  }

  .app-header {
    margin-bottom: 14px;
  }

  .brand {
    gap: 12px;
  }

  .brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }

  .brand h1 {
    font-size: 2rem;
  }

  .brand p {
    font-size: 0.88rem;
  }

  .game-panel {
    gap: 14px;
  }

  .puzzle-card {
    padding: 16px;
    gap: 12px;
  }

  .game-meta {
    padding: 8px 0 2px;
  }

  .timer-value {
    font-size: 2.9rem;
  }

  .question-text,
  .case-story,
  .puzzle-hint {
    line-height: 1.42;
  }

  .question-text::before,
  .puzzle-hint::before,
  .case-story::before {
    margin-bottom: 4px;
  }

  .answer-button {
    font-size: 0.95rem;
    padding: 10px 12px;
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 rgba(255, 65, 65, 0);
  }
  50% {
    box-shadow: 0 0 32px rgba(255, 65, 65, 0.35);
  }
}

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

.answer-button {
  position: relative;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(25, 14, 14, 0.9), rgba(12, 8, 8, 0.96));
  color: #fff2f2;
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1.36;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
  overflow: hidden;
}

.answer-button::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(circle at top left, rgba(255, 69, 69, 0.2), transparent 34%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.answer-button:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 69, 69, 0.45);
  box-shadow: 0 0 18px rgba(255, 65, 65, 0.2);
}

.answer-button:hover::before {
  opacity: 1;
}

.answer-button.disabled {
  cursor: default;
  opacity: 0.65;
}

.answer-button.selected {
  transform: translateY(-2px);
}

.answer-button.correct {
  border-color: #67d98f;
  background: linear-gradient(135deg, rgba(58, 145, 86, 0.2), rgba(15, 35, 18, 0.96));
}

.answer-button.wrong {
  border-color: #ff5e5e;
  background: linear-gradient(135deg, rgba(255, 74, 74, 0.2), rgba(42, 11, 11, 0.96));
}

.result-text {
  padding: 18px;
  border-radius: 18px;
  background: rgba(38, 16, 16, 0.88);
  color: #e6c2c2;
  min-height: 56px;
  display: grid;
  place-items: center;
  font-size: 1.24rem;
  line-height: 1.42;
  font-weight: 600;
  border: 1px solid transparent;
  transition: border-color 180ms ease, color 180ms ease;
}

.result-text.success {
  color: #c7f3d8;
  border-color: rgba(90, 217, 143, 0.3);
}

.result-text.error {
  color: #ffd0d0;
  border-color: rgba(255, 94, 94, 0.3);
}

.pulse {
  animation: pulse-glow 0.6s ease;
}

@media (max-width: 860px) {
  .game-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 20px;
  }

  .answer-grid {
    grid-template-columns: 1fr;
  }

  .puzzle-card__title {
    font-size: 1.35rem;
  }

  .question-step,
  .timer-shell {
    font-size: 1.12rem;
  }

  .timer-value {
    font-size: 3.8rem;
  }

  .question-text {
    font-size: 1.34rem;
  }

  .case-story {
    font-size: 1.28rem;
    padding: 15px 16px;
  }

  .puzzle-hint {
    font-size: 1.24rem;
  }

  .answer-button {
    font-size: 1.14rem;
  }

  .result-text {
    font-size: 1.08rem;
  }
}

/* Index-detective theme overrides for live start modal */
.start-modal .start-modal__panel {
  width: min(1180px, 100%);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(13, 13, 13, 0.85), rgba(24, 4, 4, 0.67));
}

.start-modal .start-modal__title {
  font-size: clamp(1.5rem, 3.2vw, 3rem);
  line-height: 1;
}

.start-modal .start-modal__text {
  margin: 8px 0 14px;
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
}

.start-modal .start-actions {
  gap: clamp(12px, 2vw, 22px);
}

.start-modal .start-level-button {
  --level-accent: #ff5757;
  --level-accent-soft: rgba(255, 87, 87, 0.42);
  min-height: clamp(240px, 46vh, 500px);
  padding: 0;
  border-radius: 22px;
  text-align: left;
  background: #101010;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 28px rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.start-modal .start-level-button.is-active,
.start-modal .start-level-button:hover {
  transform: translateY(-10px);
  border-color: var(--level-accent);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.54), 0 0 34px var(--level-accent-soft), inset 0 0 40px color-mix(in srgb, var(--level-accent) 15%, transparent);
}

.start-modal .start-level-button::before {
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.96) 2%, rgba(0, 0, 0, 0.38) 42%, transparent 68%), linear-gradient(135deg, color-mix(in srgb, var(--level-accent) 15%, transparent), transparent 45%);
  transform: none;
}

.start-modal .start-level-button::after {
  left: 0;
  right: 0;
  top: -35%;
  height: 24%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--level-accent) 78%, transparent), transparent);
  opacity: 0;
}

.start-modal .start-level-button:hover::after,
.start-modal .start-level-button.is-active::after {
  opacity: 0.45;
  animation: cardScan 2.4s linear infinite;
}

.level-portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 34%;
  filter: saturate(0.88) contrast(1.07);
  transition: transform 0.45s ease, filter 0.45s ease;
}

.start-level-button:hover .level-portrait,
.start-level-button.is-active .level-portrait {
  transform: scale(1.035);
  filter: saturate(1.05) contrast(1.08);
}

.start-modal .select-mark {
  z-index: 6;
}

.start-modal .level-index {
  z-index: 6;
  top: 18px;
  left: 20px;
  position: absolute;
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  color: color-mix(in srgb, var(--level-accent) 60%, transparent);
}

.difficulty-tag {
  position: absolute;
  z-index: 6;
  top: 20px;
  left: 18px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--level-accent) 58%, transparent);
  border-radius: 999px;
  color: var(--level-accent);
  background: rgba(0, 0, 0, 0.58);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.level-card-body {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26px 22px 22px;
}

.start-modal .level-card-title {
  max-width: none;
  font-size: clamp(1.35rem, 2.2vw, 2.2rem);
  text-transform: uppercase;
  color: var(--level-accent);
}

.level-thai {
  display: block;
  margin-top: 5px;
  color: #ffffff;
  font-size: 1rem;
}

.start-modal .level-card-meta {
  display: block;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid color-mix(in srgb, var(--level-accent) 36%, transparent);
  color: #d8d8d8;
  font-size: 0.95rem;
}

.start-modal .start-level-button--trainee {
  --level-accent: #87d65d;
  --level-accent-soft: rgba(135, 214, 93, 0.42);
}

.start-modal .start-level-button--trainee .level-portrait {
  object-position: center 32%;
}

.start-modal .start-level-button--detective {
  --level-accent: #f0c65a;
  --level-accent-soft: rgba(240, 198, 90, 0.42);
}

.start-modal .start-level-button--detective .level-portrait {
  object-position: center 34%;
}

.start-modal .start-level-button--pro {
  --level-accent: #ff5757;
  --level-accent-soft: rgba(255, 87, 87, 0.42);
}

.start-modal .start-level-button--pro .level-portrait {
  object-position: center 30%;
}

.start-modal .start-level-button.is-active .select-mark {
  background: var(--level-accent);
  border-color: var(--level-accent);
  box-shadow: 0 0 12px var(--level-accent), 0 0 0 4px color-mix(in srgb, var(--level-accent) 26%, transparent);
}

.selection-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 12px 0 8px;
  color: #c8c8c8;
}

.selection-line strong {
  color: #ffffff;
}

.start-modal .difficulty-description {
  margin-bottom: 12px;
}

@keyframes cardScan {
  to {
    transform: translateY(590%);
  }
}

@media (max-width: 760px) {
  .level-screen {
    padding: 14px 14px 18px;
  }

  .start-modal .start-level-button {
    min-height: clamp(205px, 36vh, 330px);
    border-radius: 14px;
  }

  .start-modal .level-card-body {
    padding: 12px 8px 10px;
  }

  .start-modal .level-card-title {
    font-size: clamp(0.88rem, 3.2vw, 1.22rem);
  }

  .level-thai {
    font-size: 0.78rem;
  }

  .start-modal .level-card-meta {
    font-size: 0.65rem;
    margin-top: 8px;
    padding-top: 8px;
  }

  .difficulty-tag {
    top: 12px;
    left: 8px;
    padding: 4px 6px;
    font-size: 0.58rem;
  }

  .selection-line {
    gap: 8px;
    margin: 8px 0 6px;
    font-size: 0.82rem;
  }

  .start-modal .start-modal__text {
    margin-bottom: 10px;
  }
}

@media (max-height: 760px) {
  .level-screen {
    padding-top: 14px;
    padding-bottom: 16px;
  }

  .start-modal .start-level-button {
    min-height: clamp(170px, 32vh, 290px);
  }

  .start-modal .start-modal__text {
    margin: 6px 0 8px;
  }

  .selection-line {
    margin: 8px 0 6px;
  }

  .start-modal .difficulty-description,
  .start-status {
    font-size: 0.78rem;
  }
}

.start-screen {
  transition: opacity 0.55s ease, transform 0.55s ease, filter 0.55s ease, visibility 0.55s;
}

.level-screen {
  padding: 18px 28px 24px;
}

.start-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.035);
  filter: blur(12px);
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.intro-screen {
  position: relative;
}

.start-intro-emblem {
  position: relative;
  display: grid;
  width: 108px;
  height: 108px;
  place-items: center;
  margin: 0 auto 22px;
}

.start-intro-ring {
  position: absolute;
  border: 1px solid rgba(230, 66, 66, 0.58);
  border-radius: 24%;
}

.start-intro-ring.outer {
  inset: 4px;
  transform: rotate(45deg);
  animation: start-spin 16s linear infinite;
}

.start-intro-ring.inner {
  inset: 22px;
  transform: rotate(20deg);
  animation: start-spin-reverse 9s linear infinite;
}

.start-intro-core {
  position: relative;
  z-index: 2;
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(127, 15, 15, 0.52);
  box-shadow: 0 0 28px rgba(230, 66, 66, 0.42);
  font-size: 30px;
}

.start-intro-eyebrow {
  margin: 0 0 10px;
  color: #df6767;
  text-align: center;
  font: 17px/1.5 Consolas, monospace;
  letter-spacing: 0.22em;
}

.start-intro-title {
  margin: 0;
  text-align: center;
  font-size: clamp(3rem, 7vw, 5.6rem);
  line-height: 1;
  font-weight: 900;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.08);
}

.start-intro-code {
  margin: 12px 0 26px;
  color: #9f9696;
  text-align: center;
  font: 24px/1.5 Consolas, monospace;
  letter-spacing: 0.12em;
}

.start-intro-code strong {
  color: #e64242;
}

.start-intro-brief {
  margin-bottom: 20px;
  padding: 18px 20px;
  border-left: 3px solid #e64242;
  background: rgba(230, 66, 66, 0.055);
  text-align: left;
}

.start-intro-brief small {
  display: block;
  color: #d96868;
  font: 16px/1.4 Consolas, monospace;
  letter-spacing: 0.16em;
}

.start-intro-brief p {
  margin: 8px 0 0;
  color: #d8d0d0;
  font-size: 1.55rem;
  line-height: 1.75;
}

.start-system-list {
  display: grid;
  gap: 8px;
  margin: 0 0 24px;
}

.start-system-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: #a69d9d;
  font-size: 1.28rem;
}

.start-system-row b {
  font: 15px/1.4 Consolas, monospace;
  letter-spacing: 0.08em;
}

.start-system-row.ready b {
  color: #79c991;
}

.start-system-row.waiting b {
  color: #df7b7b;
  animation: start-blink 1.1s ease-in-out infinite;
}

.start-system-row.verified b {
  color: #fff;
  animation: none;
}

.start-access-button {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  width: min(580px, 100%);
  margin: 0 auto;
  padding: 16px 22px;
  overflow: hidden;
  border: 1px solid rgba(239, 75, 75, 0.9);
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, rgba(120, 10, 10, 0.95), rgba(48, 8, 8, 0.96));
  box-shadow: 0 0 34px rgba(230, 66, 66, 0.19), inset 0 0 26px rgba(255, 80, 80, 0.07);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.start-access-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 110, 110, 0.06) 45%, rgba(255, 110, 110, 0.2) 50%, rgba(255, 110, 110, 0.06) 55%, transparent 100%);
  transform: translateY(-120%);
  animation: start-fingerprint-scan 2.6s linear infinite;
  pointer-events: none;
}

.start-access-button::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.start-access-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 46px rgba(230, 66, 66, 0.34), inset 0 0 32px rgba(255, 80, 80, 0.11);
}

.start-access-button:disabled {
  cursor: wait;
  opacity: 0.86;
}

.start-fingerprint {
  position: relative;
  overflow: hidden;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #ffd0d0;
  font-size: 26px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 100, 100, 0.18), rgba(60, 8, 8, 0.95));
  box-shadow: inset 0 0 18px rgba(255, 120, 120, 0.16), 0 0 18px rgba(255, 60, 60, 0.18);
}

.start-fingerprint::before,
.start-fingerprint::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 210, 210, 0.18);
}

.start-fingerprint::after {
  inset: 17px;
  border-color: rgba(255, 210, 210, 0.14);
}

.start-access-copy {
  text-align: left;
  position: relative;
  z-index: 1;
}

.start-access-copy small {
  display: block;
  color: #f0a0a0;
  font-size: 1.12rem;
  letter-spacing: 0.04em;
}

.start-access-copy strong {
  display: block;
  margin-top: 2px;
  font-size: 2.15rem;
  line-height: 1.15;
}

.start-access-arrow {
  position: relative;
  z-index: 1;
  color: #ff9a9a;
  font-size: 34px;
  text-shadow: 0 0 16px rgba(255, 90, 90, 0.3);
}

.start-intro-status {
  min-height: 1.4em;
  margin: 16px 0 0;
  color: rgba(226, 118, 118, 0.8);
  text-align: center;
  font: 16px/1.5 Consolas, monospace;
  letter-spacing: 0.13em;
}

@media (max-width: 760px) {
  .start-intro-eyebrow {
    font-size: 0.82rem;
  }

  .start-intro-title {
    font-size: clamp(2.1rem, 9vw, 3.3rem);
  }

  .start-intro-code {
    font-size: 1.2rem;
  }

  .start-intro-brief p {
    font-size: 1.12rem;
  }

  .start-system-row {
    font-size: 1rem;
  }

  .start-system-row b {
    font-size: 0.82rem;
  }

  .start-access-copy small {
    font-size: 0.9rem;
  }

  .start-access-copy strong {
    font-size: 1.45rem;
  }

  .start-intro-status {
    font-size: 0.8rem;
  }
}

.start-unlock-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgba(3, 3, 4, 0.8);
  transition: opacity 0.35s ease, visibility 0.35s;
}

.start-unlock-overlay.show {
  opacity: 1;
  visibility: visible;
}

.start-unlock-box {
  width: min(620px, 100%);
  padding: 42px 30px;
  border: 1px solid rgba(230, 66, 66, 0.58);
  border-radius: 22px;
  color: #f6eeee;
  background: rgba(12, 7, 8, 0.95);
  text-align: center;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.7), 0 0 60px rgba(230, 66, 66, 0.13);
}

.start-unlock-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(230, 66, 66, 0.5);
  box-shadow: 0 0 32px rgba(230, 66, 66, 0.28);
  color: #ffd1d1;
  font-size: 34px;
}

.start-unlock-box p {
  margin: 0;
  color: #d27f7f;
  font: 12px/1.3 Consolas, monospace;
  letter-spacing: 0.13em;
}

.start-unlock-box h3 {
  margin: 10px 0 12px;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.start-unlock-line {
  width: min(340px, 88%);
  height: 1px;
  margin: 14px auto;
  background: linear-gradient(90deg, transparent, rgba(230, 66, 66, 0.85), transparent);
}

.start-unlock-box strong {
  color: #ffe5e5;
  font-size: 0.95rem;
}

@keyframes start-spin-reverse {
  to {
    transform: rotate(-360deg);
  }
}

@keyframes start-sweep {
  0%,
  55% {
    transform: translateX(-220%) skewX(-18deg);
  }
  100% {
    transform: translateX(620%) skewX(-18deg);
  }
}

@keyframes start-fingerprint-scan {
  0% {
    transform: translateY(-120%);
  }
  100% {
    transform: translateY(120%);
  }
}

/* detective_red_intro overrides: intro page only */
.start-modal__panel {
  width: min(1280px, 100%);
  padding: 0;
  overflow: hidden;
}

.intro-screen {
  position: relative;
  min-height: min(76vh, 760px);
  background: #080708;
}

.intro-screen .intro-art {
  position: absolute;
  inset: -2%;
  background: url("detective_red_intro/detective_red_intro/assets/intro-red.png") center/cover no-repeat;
  filter: saturate(1.12) contrast(1.04) brightness(0.78);
  transform: scale(1.04);
  animation: introDrift 16s ease-in-out infinite alternate;
}

.intro-screen .red-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 33% 52%, transparent 0 22%, rgba(100, 0, 0, 0.14) 44%, rgba(0, 0, 0, 0.88) 100%), linear-gradient(90deg, rgba(0, 0, 0, 0.15), transparent 45%, rgba(0, 0, 0, 0.36));
  pointer-events: none;
}

.intro-screen .scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(255, 255, 255, 0.025) 4px);
  animation: scanMove 8s linear infinite;
}

.intro-screen .dust {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.5px);
  background-size: 71px 71px;
  animation: dustMove 18s linear infinite;
}

.intro-screen .intro-ui {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.intro-screen .start-fullscreen-button {
  position: absolute;
  top: 4%;
  right: 4.5%;
  z-index: 4;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(10, 8, 8, 0.7);
  color: #fff2f2;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(255, 0, 0, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.intro-screen .start-fullscreen-button:hover {
  transform: translateY(-1px) scale(1.04);
  border-color: rgba(255, 80, 80, 0.62);
  background: rgba(35, 10, 10, 0.82);
  box-shadow: 0 0 22px rgba(255, 45, 45, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.intro-screen .start-fullscreen-button.is-active {
  color: #ff7070;
  border-color: rgba(255, 80, 80, 0.5);
}

.intro-screen .start-fullscreen-button:focus-visible {
  outline: 2px solid #ff7070;
  outline-offset: 2px;
}

.intro-screen .top-status {
  position: absolute;
  top: 4.2%;
  left: 5%;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d8cbc0;
  font-family: "Chakra Petch", sans-serif;
  font-size: clamp(10px, 0.82vw, 14px);
  letter-spacing: 0.16em;
  text-shadow: 0 2px 8px #000;
}

.intro-screen .top-status strong {
  margin-left: 12px;
  color: #fff;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  padding-left: 18px;
}

.intro-screen .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff2f35;
  box-shadow: 0 0 14px #ff2f35;
  animation: pulse 1.5s ease-in-out infinite;
}

.intro-screen .vault-hotspot {
  position: absolute;
  left: 17.2%;
  top: 42.5%;
  width: 20%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
}

.intro-screen .dial-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 73, 73, 0.24);
  box-shadow: 0 0 24px rgba(255, 0, 0, 0.12);
}

.intro-screen .ring-a {
  animation: spin 18s linear infinite;
}

.intro-screen .ring-b {
  inset: 12%;
  border-style: dashed;
  animation: spinReverse 12s linear infinite;
}

.intro-screen .dial-glint {
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.28), transparent 19%);
  animation: pulse 2.6s ease-in-out infinite;
}

.intro-screen .mission-panel {
  position: absolute;
  right: 6.5%;
  top: 8.2%;
  width: min(36vw, 570px);
  padding: 18px 20px;
  border-left: 3px solid #d41218;
  background: linear-gradient(90deg, rgba(8, 6, 6, 0.78), rgba(8, 6, 6, 0.15));
  backdrop-filter: blur(3px);
  text-shadow: 0 2px 12px #000;
}

.intro-screen .eyebrow {
  margin: 0 0 7px;
  color: #ff5d61;
  font-family: "Chakra Petch", sans-serif;
  font-size: clamp(10px, 0.9vw, 15px);
  font-weight: 700;
  letter-spacing: 0.18em;
}

.intro-screen .mission-panel h1 {
  margin: 0;
  font-size: clamp(31px, 3.1vw, 58px);
  line-height: 1.06;
}

.intro-screen .mission-panel > p:not(.eyebrow) {
  margin: 10px 0 16px;
  color: #e8ded7;
  font-size: clamp(12px, 1vw, 17px);
  line-height: 1.65;
}

.intro-screen .mission-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.intro-screen .mission-meta span {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.38);
  font-size: clamp(10px, 0.8vw, 13px);
}

.intro-screen .mission-meta b {
  color: #ff4146;
  margin-right: 4px;
}

.intro-screen .intro-system-shell {
  position: absolute;
  right: 9.2%;
  bottom: 9%;
  width: min(48vw, 640px);
}

.intro-screen .start-system-list {
  display: grid;
  gap: 0;
  margin: 0 0 18px;
}

.intro-screen .start-system-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #cfc1b6;
  font-size: clamp(13px, 0.95vw, 16px);
}

.intro-screen .start-system-row b {
  font: clamp(11px, 0.82vw, 14px)/1.3 "Chakra Petch", sans-serif;
  letter-spacing: 0.12em;
}

.intro-screen .start-system-row.ready b {
  color: #79c991;
}

.intro-screen .start-system-row.waiting b {
  color: #df7b7b;
  animation: blink 1.1s ease-in-out infinite;
}

.intro-screen .start-system-row.verified b {
  color: #fff;
  animation: none;
}

.intro-screen .start-investigation {
  position: relative;
  width: min(31vw, 470px);
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 12px 24px;
  color: white;
  border: 1px solid #ff6d70;
  border-radius: 7px;
  cursor: pointer;
  background: linear-gradient(180deg, #e42a30, #900008 55%, #5a0004);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 22px rgba(255, 0, 0, 0.45), 0 14px 35px rgba(0, 0, 0, 0.55);
  text-shadow: 0 2px 3px #480000;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.intro-screen .start-investigation::before {
  display: none;
}

.intro-screen .start-investigation::after {
  content: "";
  position: absolute;
  inset: -30% auto -30% -20%;
  width: 18%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  transform: skewX(-18deg);
  animation: buttonSweep 3.2s ease-in-out infinite;
}

.intro-screen .start-investigation:hover {
  transform: translateY(-3px) scale(1.015);
  filter: brightness(1.15);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.45), 0 0 38px rgba(255, 0, 0, 0.65), 0 17px 38px rgba(0, 0, 0, 0.62);
}

.intro-screen .btn-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffb5b7;
  box-shadow: 0 0 15px #fff, 0 0 28px #ff3035;
  animation: pulse 1.3s ease-in-out infinite;
  flex: 0 0 auto;
}

.intro-screen .btn-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}

.intro-screen .btn-copy small {
  font-family: "Chakra Petch", sans-serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  opacity: 0.78;
  color: #f0d5d5;
}

.intro-screen .btn-copy strong {
  font-size: clamp(23px, 2vw, 35px);
}

.intro-screen .btn-arrow {
  margin-left: auto;
  font-size: 44px;
  line-height: 1;
}

.intro-screen .intro-hint {
  margin: 10px 0 0;
  color: #d1c5bc;
  font-size: clamp(10px, 0.8vw, 13px);
  text-shadow: 0 2px 7px #000;
  text-align: center;
}

.unlock-sequence {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.78);
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
  backdrop-filter: blur(5px);
}

.unlock-sequence.show {
  opacity: 1;
  visibility: visible;
}

.unlock-card {
  text-align: center;
  width: min(86vw, 430px);
  padding: 34px;
  border: 1px solid rgba(255, 65, 65, 0.48);
  background: linear-gradient(180deg, rgba(34, 4, 5, 0.95), rgba(8, 8, 9, 0.96));
  box-shadow: 0 0 55px rgba(255, 0, 0, 0.32);
}

.unlock-icon {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  margin: 0 auto 15px;
  border: 2px solid #ff464b;
  border-radius: 50%;
  font-size: 34px;
  color: #ff464b;
  box-shadow: 0 0 25px rgba(255, 0, 0, 0.5);
}

.unlock-card p {
  margin: 0;
  color: #ff555a;
  font-family: "Chakra Petch", sans-serif;
  letter-spacing: 0.24em;
}

.unlock-card h3 {
  margin: 9px 0 20px;
  font-size: 28px;
}

.loading-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.loading-track span {
  display: block;
  height: 100%;
  width: 0;
  background: #ff3338;
  box-shadow: 0 0 12px #ff3338;
}

.unlock-sequence.show .loading-track span {
  animation: load 1.25s ease forwards;
}

@keyframes introDrift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.085) translate3d(-0.6%, 0.4%, 0); }
}

@keyframes scanMove {
  to { background-position: 0 80px; }
}

@keyframes dustMove {
  to { background-position: 90px -120px; }
}

@keyframes pulse {
  50% { opacity: 0.45; transform: scale(0.88); }
}

@keyframes buttonSweep {
  0%, 60% { left: -25%; }
  100% { left: 125%; }
}

@keyframes load {
  to { width: 100%; }
}

@media (max-width: 900px) {
  .intro-screen {
    min-height: min(82vh, 860px);
  }

  .intro-screen .mission-panel {
    right: 5%;
    top: 8%;
    width: 52vw;
  }

  .intro-screen .intro-system-shell {
    right: 6%;
    width: 44vw;
    bottom: 12%;
  }

  .intro-screen .start-investigation {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .intro-screen .intro-art {
    background-position: 43% center;
    filter: brightness(0.52) saturate(1.15);
  }

  .intro-screen .start-fullscreen-button {
    top: 3.4%;
    right: 3.8%;
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .intro-screen .mission-panel {
    left: 6%;
    right: 6%;
    top: 7%;
    width: auto;
    background: rgba(5, 5, 6, 0.7);
  }

  .intro-screen .mission-panel h1 {
    font-size: 38px;
  }

  .intro-screen .vault-hotspot {
    left: 19%;
    top: 46%;
    width: 35%;
  }

  .intro-screen .intro-system-shell {
    left: 7%;
    right: 7%;
    bottom: 9%;
    width: auto;
  }

  .intro-screen .top-status {
    left: 6%;
    top: 2.5%;
  }

  .intro-screen .top-status strong {
    display: none;
  }

  .intro-screen .start-investigation {
    min-height: 72px;
  }
}

/* Game mobile fit overrides */
@media (max-width: 860px) {
  body {
    padding: 14px;
  }

  .app-shell {
    padding: 20px;
    border-radius: 20px;
  }

  .app-header {
    margin-bottom: 18px;
  }

  .brand {
    gap: 12px;
  }

  .brand-icon {
    width: 52px;
    height: 52px;
  }

  .brand h1 {
    font-size: clamp(1.45rem, 6vw, 2rem);
  }

  .brand p {
    font-size: 0.9rem;
  }

  .puzzle-card {
    gap: 16px;
    padding: 18px;
  }

  .puzzle-card__content {
    gap: 14px;
  }

  .game-meta {
    gap: 10px;
    padding-top: 10px;
  }

  .timer-value {
    font-size: clamp(2.5rem, 11vw, 3.35rem);
  }

  .question-text {
    font-size: clamp(1.02rem, 3.8vw, 1.2rem);
    line-height: 1.42;
  }

  .case-story {
    font-size: clamp(1rem, 3.8vw, 1.18rem);
    line-height: 1.45;
    padding: 14px 15px;
  }

  .puzzle-hint {
    font-size: clamp(0.96rem, 3.4vw, 1.08rem);
    line-height: 1.42;
    padding: 14px;
  }

  .answer-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .answer-button {
    padding: 14px 15px;
    font-size: clamp(0.96rem, 3.6vw, 1.06rem);
    line-height: 1.32;
  }

  .result-text {
    min-height: 0;
    padding: 14px;
    font-size: 0.98rem;
    line-height: 1.45;
  }

  .congrats-panel {
    width: min(92vw, 520px);
    padding: 24px 16px;
  }

  .congrats-title {
    font-size: clamp(1.45rem, 6.2vw, 1.95rem);
  }

  .congrats-text {
    font-size: 0.96rem;
    line-height: 1.55;
    margin-bottom: 16px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .app-shell {
    padding: 14px;
    border-radius: 16px;
  }

  .app-header {
    margin-bottom: 14px;
  }

  .brand {
    align-items: flex-start;
    gap: 10px;
  }

  .brand p {
    margin-top: 2px;
  }

  .game-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 4px 0 0;
  }

  .question-step {
    font-size: 0.88rem;
    line-height: 1.3;
  }

  .timer-shell {
    width: auto;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 4px;
    font-size: 0.9rem;
  }

  .timer-label {
    font-size: 0.8rem;
  }

  .timer-value {
    font-size: clamp(2.2rem, 13vw, 3rem);
    line-height: 0.95;
  }

  .game-panel {
    gap: 14px;
  }

  .puzzle-card {
    gap: 12px;
    padding: 12px;
  }

  .puzzle-card__content {
    gap: 10px;
  }

  .case-story {
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 12px;
    border-radius: 12px;
  }

  .question-text {
    font-size: 1rem;
    line-height: 1.45;
  }

  .puzzle-hint {
    font-size: 0.92rem;
    line-height: 1.45;
    padding: 12px;
    border-radius: 12px;
  }

  .answer-grid {
    gap: 10px;
  }

  .answer-button {
    padding: 12px 13px;
    font-size: 0.98rem;
    border-radius: 13px;
    line-height: 1.4;
  }

  .result-text {
    padding: 12px;
    font-size: 0.92rem;
    line-height: 1.4;
  }

  .ghost-button,
  .primary-button {
    font-size: 0.95rem;
    padding: 12px 14px;
  }

  .start-modal {
    padding: 6px;
  }

  .start-modal__panel {
    max-height: calc(100svh - 8px);
    border-radius: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .start-screen {
    min-height: 100%;
  }

  .level-screen {
    padding: 12px 10px 14px;
    overflow-y: auto;
  }

  .start-modal .start-modal__title {
    font-size: clamp(1.3rem, 6.8vw, 1.85rem);
    line-height: 1.15;
  }

  .start-modal .start-modal__text {
    font-size: 0.9rem;
    margin: 6px 0 8px;
  }

  .selection-line {
    font-size: 0.78rem;
    row-gap: 4px;
  }

  .start-modal .difficulty-description {
    font-size: 0.8rem;
    margin-bottom: 8px;
  }

  .start-mission-button {
    font-size: 1.05rem;
    padding: 12px 16px;
  }

  .intro-screen .mission-panel {
    position: relative;
    inset: auto;
    width: auto;
    margin: 48px 10px 10px;
    padding: 14px 13px;
  }

  .intro-screen .mission-panel h1 {
    font-size: clamp(1.8rem, 9.2vw, 2.45rem);
  }

  .intro-screen .mission-panel > p:not(.eyebrow) {
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .intro-screen .mission-meta span {
    font-size: 0.66rem;
    padding: 4px 6px;
  }

  .intro-screen .intro-system-shell {
    position: relative;
    inset: auto;
    width: auto;
    margin: 8px 10px 10px;
  }

  .intro-screen .start-system-row {
    font-size: 0.78rem;
    gap: 8px;
    padding: 7px 0;
  }

  .intro-screen .start-system-row b {
    font-size: 0.68rem;
  }

  .intro-screen .start-investigation {
    min-height: 62px;
    padding: 10px 12px;
    gap: 10px;
  }

  .intro-screen .btn-copy small {
    font-size: 0.5rem;
    letter-spacing: 0.14em;
  }

  .intro-screen .btn-copy strong {
    font-size: clamp(1.2rem, 6vw, 1.45rem);
  }

  .intro-screen .btn-arrow {
    font-size: 26px;
  }

  .intro-screen .intro-hint {
    margin-top: 7px;
    font-size: 0.6rem;
    line-height: 1.3;
  }

  .intro-screen .intro-ui {
    position: relative;
    inset: auto;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-bottom: 10px;
  }

  .intro-screen .vault-hotspot {
    display: none;
  }

  .intro-screen .top-status {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 56px;
  }

  .intro-screen .start-fullscreen-button {
    top: 10px;
    right: 10px;
  }

  .intro-screen .start-system-list {
    margin-bottom: 10px;
  }

  .intro-screen .start-investigation {
    width: 100%;
  }

  .start-modal .start-level-button {
    min-height: 175px;
  }
}

@media (max-width: 420px) {
  .brand h1 {
    font-size: 1.25rem;
    letter-spacing: -0.01em;
  }

  .brand p {
    font-size: 0.78rem;
  }

  .puzzle-card {
    padding: 10px;
    border-radius: 16px;
  }

  .timer-value {
    font-size: clamp(2rem, 12vw, 2.5rem);
  }

  .question-step,
  .timer-shell {
    font-size: 0.82rem;
  }

  .answer-button {
    border-radius: 14px;
    padding: 11px 12px;
    font-size: 0.94rem;
  }

  .game-panel {
    gap: 10px;
  }

  .case-story,
  .puzzle-hint {
    padding: 10px;
  }

  .congrats-panel {
    padding: 18px 12px;
    border-radius: 14px;
  }

  .safe-lock {
    transform: scale(0.9);
    transform-origin: center top;
  }

  .intro-screen .top-status {
    font-size: 0.5rem;
    gap: 6px;
  }

  .start-modal .start-level-button {
    min-height: 162px;
    padding: 10px 8px;
  }

  .intro-screen .start-fullscreen-button {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
}

@media (max-height: 700px) and (max-width: 900px) {
  .intro-screen .mission-panel {
    top: 5%;
  }

  .intro-screen .intro-system-shell {
    bottom: 4%;
  }

  .intro-screen .start-investigation {
    min-height: 56px;
  }

  .start-modal .start-level-button {
    min-height: clamp(150px, 28vh, 230px);
  }

  .start-counter {
    font-size: clamp(2rem, 9vw, 3.2rem);
  }
}

@media (min-width: 901px) and (max-width: 1180px) and (max-height: 900px) {
  .start-modal {
    padding: 4px 6px;
  }

  .start-modal__panel {
    width: 100%;
    max-height: calc(100svh - 8px);
    border-radius: 16px;
  }

  .intro-screen {
    min-height: calc(100svh - 8px);
  }

  .intro-screen .top-status {
    top: 2.4%;
    left: 3.2%;
    font-size: clamp(9px, 0.72vw, 12px);
    gap: 8px;
  }

  .intro-screen .top-status strong {
    margin-left: 8px;
    padding-left: 10px;
  }

  .intro-screen .start-fullscreen-button {
    top: 2.2%;
    right: 3%;
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .intro-screen .mission-panel {
    right: 4.5%;
    top: 6.4%;
    width: min(40vw, 470px);
    padding: 13px 14px;
  }

  .intro-screen .mission-panel h1 {
    font-size: clamp(27px, 2.8vw, 40px);
  }

  .intro-screen .mission-panel > p:not(.eyebrow) {
    margin: 7px 0 10px;
    line-height: 1.45;
  }

  .intro-screen .mission-meta {
    gap: 8px;
  }

  .intro-screen .mission-meta span {
    padding: 4px 7px;
    font-size: clamp(9px, 0.78vw, 12px);
  }

  .intro-screen .intro-system-shell {
    right: 4.8%;
    bottom: 5.4%;
    width: min(42vw, 520px);
  }

  .intro-screen .start-system-list {
    margin: 0 0 10px;
  }

  .intro-screen .start-system-row {
    padding: 8px 0;
    font-size: clamp(11px, 0.84vw, 14px);
  }

  .intro-screen .start-system-row b {
    font-size: clamp(10px, 0.75vw, 12px);
  }

  .intro-screen .start-investigation {
    width: 100%;
    min-height: 62px;
    padding: 8px 14px;
    gap: 12px;
  }

  .intro-screen .btn-copy strong {
    font-size: clamp(18px, 1.55vw, 26px);
  }

  .intro-screen .btn-arrow {
    font-size: 34px;
  }

  .intro-screen .intro-hint {
    margin-top: 6px;
    font-size: clamp(9px, 0.7vw, 11px);
  }

  .app-shell {
    min-height: calc(100svh - 16px);
  }

  .app-header {
    margin-bottom: 16px;
  }

  .game-panel {
    gap: 14px;
  }

  .puzzle-card {
    padding: 16px;
    gap: 12px;
  }

  .puzzle-card__content {
    gap: 10px;
  }

  .game-meta {
    padding: 6px 0 0;
  }

  .answer-grid {
    gap: 10px;
  }

  .answer-button {
    font-size: 0.94rem;
    line-height: 1.3;
    padding: 9px 11px;
  }
}

@media (min-width: 700px) and (max-width: 1024px) and (orientation: portrait) {
  .start-modal {
    padding: 6px;
    place-items: start center;
  }

  .start-modal__panel {
    max-height: calc(100svh - 12px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
  }

  .level-screen {
    padding: 14px 14px 18px;
  }

  .start-modal .start-modal__title {
    font-size: clamp(1.45rem, 4.2vw, 2rem);
  }

  .start-modal .start-modal__text {
    margin: 6px 0 10px;
    font-size: 0.9rem;
  }

  .start-modal .start-actions {
    gap: 10px;
  }

  .start-modal .start-level-button {
    min-height: clamp(150px, 22vh, 215px);
    border-radius: 14px;
  }

  .start-modal .start-level-button.is-active,
  .start-modal .start-level-button:hover {
    transform: translateY(-3px);
  }

  .difficulty-tag {
    top: 10px;
    left: 10px;
    padding: 4px 7px;
    font-size: 0.58rem;
  }

  .start-modal .level-card-body {
    padding: 10px 11px 10px;
  }

  .start-modal .level-card-title {
    font-size: clamp(1rem, 3vw, 1.35rem);
  }

  .level-thai {
    margin-top: 2px;
    font-size: 0.88rem;
  }

  .start-modal .level-card-meta {
    margin-top: 8px;
    padding-top: 7px;
    font-size: 0.8rem;
    line-height: 1.28;
  }

  .selection-line {
    margin: 10px 0 6px;
    gap: 8px;
    font-size: 0.92rem;
  }

  .start-modal .difficulty-description,
  .start-status {
    font-size: 0.86rem;
  }
}

@media (orientation: portrait) and (max-width: 1024px) {
  body {
    align-items: flex-start;
    min-height: 100dvh;
    height: 100dvh;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .app-shell {
    height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    max-height: calc(100svh - 16px);
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .game-panel {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .start-modal {
    padding: 6px;
    place-items: start center;
  }

  .start-modal__panel {
    max-height: calc(100dvh - 12px);
    max-height: calc(100svh - 12px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .level-screen {
    overflow-y: auto;
  }
}

@media (min-width: 700px) and (max-width: 1024px) and (orientation: landscape) and (max-height: 900px) {
  .start-modal {
    padding: 4px 6px;
    place-items: start center;
  }

  .start-modal__panel {
    width: 100%;
    min-height: calc(100svh - 8px);
    max-height: calc(100svh - 8px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
  }

  .intro-screen {
    min-height: calc(100svh - 8px);
  }

  .intro-screen .intro-system-shell {
    bottom: 4%;
  }

  .intro-screen .start-investigation {
    min-height: 58px;
    padding: 8px 12px;
  }

  .intro-screen .mission-panel > p:not(.eyebrow),
  .intro-screen .start-system-row,
  .intro-screen .intro-hint {
    line-height: 1.3;
  }
}
