:root {
  --ink: #f4f7ed;
  --night: #07121b;
  --night-soft: #0d2029;
  --panel: rgba(9, 24, 32, 0.86);
  --panel-solid: #0d2029;
  --line: rgba(203, 231, 214, 0.2);
  --muted: #a9bdb7;
  --mint: #79f2b4;
  --mint-dark: #1e9c68;
  --yellow: #ffd95a;
  --coral: #ff725e;
  --sky: #72d9e9;
  --danger: #ff5f66;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--night);
}

body {
  position: fixed;
  inset: 0;
  -webkit-text-size-adjust: 100%;
}

body,
button {
  font-family:
    Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  color: inherit;
}

button,
canvas {
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
canvas:focus-visible,
a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 11px 15px;
  color: var(--night);
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  background: var(--yellow);
  border-radius: 10px;
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.game-shell {
  position: relative;
  isolation: isolate;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 10%, #143b46 0, #081822 42%, #050c12 100%);
}

#game-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
  touch-action: none;
}

.sky-grain,
.vignette,
.damage-flash,
.speed-lines {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.sky-grain {
  opacity: 0.16;
  background-image:
    linear-gradient(115deg, transparent 48%, rgba(255, 255, 255, 0.06) 49%, transparent 50%),
    radial-gradient(circle, rgba(255, 255, 255, 0.5) 0 1px, transparent 1.2px);
  background-size: 34px 34px, 71px 71px;
  mix-blend-mode: soft-light;
}

.vignette {
  z-index: 3;
  box-shadow: inset 0 0 170px 42px rgba(0, 0, 0, 0.42);
}

.damage-flash {
  z-index: 18;
  opacity: 0;
  background: radial-gradient(circle, transparent 18%, rgba(255, 44, 64, 0.58) 130%);
}

.damage-flash.is-active {
  animation: damage-pulse 480ms ease-out;
}

.speed-lines {
  z-index: 4;
  opacity: 0;
  background: repeating-conic-gradient(
    from 0deg at 50% 55%,
    transparent 0deg 7deg,
    rgba(255, 255, 255, 0.12) 7.2deg 7.8deg
  );
  mask-image: radial-gradient(circle, transparent 0 18%, #000 70%);
  transition: opacity 120ms ease;
}

.speed-lines.is-active {
  opacity: 0.55;
  animation: speed-spin 750ms linear infinite;
}

.topbar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 86px;
  padding: 18px clamp(20px, 3vw, 46px);
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(4, 12, 18, 0.64), transparent);
}

.brand-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-self: start;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  grid-template-columns: repeat(3, 5px);
  gap: 3px;
  place-content: center;
  background: var(--yellow);
  border: 2px solid rgba(0, 0, 0, 0.45);
  border-radius: 14px 14px 17px 11px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.34);
  transform: rotate(-3deg);
}

.brand-mark::after {
  position: absolute;
  top: -6px;
  left: 7px;
  width: 28px;
  height: 9px;
  content: "";
  border: 3px solid #f2f1d5;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
}

.brand-mark span {
  display: block;
  width: 5px;
  height: 18px;
  background: #203733;
  border-radius: 6px;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 16px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.brand-lockup small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.16em;
}

.mission-chip {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-self: center;
  min-height: 39px;
  padding: 8px 16px;
  color: #d7e9e2;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: rgba(8, 23, 30, 0.68);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(14px);
}

.mission-dot {
  width: 7px;
  height: 7px;
  background: var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--mint);
}

.sound-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-self: end;
  min-height: 38px;
  padding: 8px 13px;
  color: #d8e6e0;
  font-size: 11px;
  font-weight: 800;
  pointer-events: auto;
  cursor: pointer;
  background: rgba(8, 23, 30, 0.62);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(14px);
}

.sound-button:hover {
  border-color: rgba(121, 242, 180, 0.55);
}

.hud {
  position: absolute;
  top: 102px;
  left: clamp(20px, 3vw, 46px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 156px;
  pointer-events: none;
}

.hud-card {
  min-height: 76px;
  padding: 12px 14px;
  background: rgba(7, 20, 27, 0.79);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(16px);
}

.hud-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.timer-card strong {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 27px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.timer-card.is-urgent strong {
  color: var(--danger);
  animation: urgent-beat 700ms ease-in-out infinite;
}

.timer-bar {
  display: block;
  height: 3px;
  margin-top: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 99px;
}

.timer-bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--mint);
  border-radius: inherit;
  transform-origin: left;
}

.collect-value {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ingredient-mini {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  color: #222b24;
  font-size: 15px;
  background: var(--yellow);
  border-radius: 8px;
  box-shadow: 0 0 18px rgba(255, 217, 90, 0.38);
  transform: rotate(45deg);
}

.ingredient-mini::first-letter {
  transform: rotate(-45deg);
}

.collect-value strong {
  font-size: 26px;
  font-weight: 950;
}

.collect-value small {
  margin-left: 3px;
  color: var(--muted);
  font-size: 12px;
}

.hearts {
  display: flex;
  gap: 7px;
  color: var(--coral);
  font-size: 21px;
  filter: drop-shadow(0 0 8px rgba(255, 114, 94, 0.4));
}

.hearts span.is-lost {
  color: rgba(169, 189, 183, 0.22);
  filter: none;
  transform: scale(0.82);
}

.minimap-panel {
  position: absolute;
  right: clamp(20px, 3vw, 46px);
  bottom: 76px;
  z-index: 15;
  width: 190px;
  padding: 10px;
  background: rgba(7, 20, 27, 0.79);
  border: 1px solid var(--line);
  border-radius: 17px;
  backdrop-filter: blur(16px);
}

.minimap-title {
  display: flex;
  justify-content: space-between;
  padding: 0 3px 7px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

#minimap {
  display: block;
  width: 168px;
  height: 168px;
  border: 1px solid rgba(205, 232, 216, 0.12);
  border-radius: 10px;
}

.toast {
  position: absolute;
  top: 100px;
  left: 50%;
  z-index: 30;
  display: flex;
  gap: 13px;
  align-items: center;
  min-width: 276px;
  padding: 12px 16px;
  background: rgba(11, 31, 39, 0.93);
  border: 1px solid rgba(121, 242, 180, 0.4);
  border-radius: 15px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  animation: toast-in 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
  backdrop-filter: blur(18px);
}

.toast-icon {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--night);
  background: var(--yellow);
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(255, 217, 90, 0.25);
}

.toast strong,
.toast span:not(.toast-icon) {
  display: block;
}

.toast strong {
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 900;
}

.toast div span {
  color: var(--muted);
  font-size: 10px;
}

.screen-panel {
  position: absolute;
  inset: 0;
  z-index: 12;
  background:
    linear-gradient(90deg, rgba(3, 12, 18, 0.95) 0%, rgba(5, 16, 22, 0.79) 44%, rgba(4, 14, 20, 0.28) 100%),
    radial-gradient(circle at 78% 42%, rgba(49, 124, 116, 0.16), transparent 34%);
}

.start-screen {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(470px, 0.9fr);
  gap: clamp(44px, 6vw, 104px);
  align-items: center;
  padding: 102px clamp(34px, 7vw, 120px) 56px;
}

.start-backdrop {
  position: absolute;
  top: 50%;
  right: -8vw;
  width: min(65vw, 960px);
  aspect-ratio: 1;
  border: 1px solid rgba(121, 242, 180, 0.07);
  border-radius: 50%;
  transform: translateY(-46%);
  pointer-events: none;
}

.orbit {
  position: absolute;
  border: 1px solid rgba(121, 242, 180, 0.08);
  border-radius: 50%;
}

.orbit::before {
  position: absolute;
  top: 8%;
  left: 16%;
  width: 7px;
  height: 7px;
  content: "";
  background: var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 18px var(--mint);
}

.orbit-one {
  inset: 15%;
  animation: orbit-spin 24s linear infinite;
}

.orbit-two {
  inset: 30%;
  animation: orbit-spin 16s linear infinite reverse;
}

.start-copy,
.briefing-card {
  position: relative;
  z-index: 2;
}

.eyebrow {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 15px;
  color: var(--mint);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow > span:first-child {
  width: 18px;
  height: 2px;
  background: currentColor;
}

.start-copy h1 {
  position: relative;
  width: max-content;
  max-width: 100%;
  margin: 0 0 24px;
  font-size: clamp(62px, 7.5vw, 112px);
  font-weight: 900;
  line-height: 0.91;
  letter-spacing: -0.052em;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.22), 0 15px 34px rgba(0, 0, 0, 0.32);
}

.title-line,
.title-accent-row {
  display: block;
}

.title-accent-row {
  display: flex;
  gap: clamp(10px, 1vw, 16px);
  align-items: flex-end;
}

.title-highlight {
  color: var(--yellow);
}

.start-copy h1 em {
  position: static;
  margin-bottom: 0.12em;
  padding: 6px 9px;
  color: var(--night);
  font-size: clamp(12px, 1.25vw, 16px);
  font-style: normal;
  letter-spacing: 0.02em;
  background: var(--mint);
  border-radius: 8px;
  transform: rotate(-7deg);
}

.game-intro {
  margin: 0 0 29px;
  color: #b7cac4;
  font-size: clamp(14px, 1.3vw, 17px);
  font-weight: 620;
  line-height: 1.7;
  letter-spacing: -0.03em;
}

.start-actions {
  display: flex;
  gap: 18px;
  align-items: center;
}

.play-button {
  display: inline-flex;
  gap: 13px;
  align-items: center;
  min-width: 194px;
  min-height: 62px;
  padding: 10px 20px 10px 12px;
  color: #122017;
  text-align: left;
  cursor: pointer;
  background: var(--yellow);
  border: 0;
  border-radius: 16px;
  box-shadow: 0 7px 0 #a88423, 0 16px 30px rgba(0, 0, 0, 0.25);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.play-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 0 #a88423, 0 20px 34px rgba(0, 0, 0, 0.3);
}

.play-button:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #a88423;
}

.play-arrow {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  padding-left: 2px;
  color: var(--ink);
  font-size: 13px;
  background: #17261c;
  border-radius: 12px;
}

.play-button strong,
.play-button small {
  display: block;
}

.play-button strong {
  font-size: 16px;
  font-weight: 950;
}

.play-button small {
  margin-top: 2px;
  color: rgba(18, 32, 23, 0.62);
  font-size: 9px;
  font-weight: 800;
}

.best-record {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.progress-summary {
  display: grid;
  width: min(100%, 420px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: -8px 0 22px;
}

.progress-summary > span {
  min-width: 0;
  padding: 11px 13px;
  background: rgba(6, 22, 29, 0.64);
  border: 1px solid rgba(203, 231, 214, 0.14);
  border-radius: 12px;
  backdrop-filter: blur(12px);
}

.progress-summary strong,
.progress-summary small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-summary strong {
  color: var(--mint);
  font-size: 13px;
  font-weight: 900;
}

.progress-summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.briefing-card {
  width: min(100%, 560px);
  justify-self: end;
  padding: clamp(22px, 3vw, 34px);
  background: linear-gradient(145deg, rgba(17, 41, 49, 0.94), rgba(8, 25, 32, 0.92));
  border: 1px solid rgba(187, 229, 210, 0.2);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.briefing-card::before {
  position: absolute;
  inset: 9px;
  pointer-events: none;
  content: "";
  border: 1px dashed rgba(187, 229, 210, 0.09);
  border-radius: 17px;
}

.stage-selector {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 16px;
}

.stage-option {
  position: relative;
  min-width: 0;
  min-height: 66px;
  padding: 9px 6px 8px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  background: rgba(3, 15, 21, 0.54);
  border: 1px solid rgba(203, 231, 214, 0.12);
  border-radius: 13px;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.stage-option:hover {
  border-color: rgba(121, 242, 180, 0.42);
  transform: translateY(-1px);
}

.stage-option.is-selected {
  color: var(--ink);
  background: linear-gradient(145deg, rgba(41, 105, 85, 0.66), rgba(16, 53, 50, 0.72));
  border-color: rgba(121, 242, 180, 0.72);
  box-shadow: inset 0 0 0 1px rgba(121, 242, 180, 0.1), 0 8px 20px rgba(0, 0, 0, 0.18);
}

.stage-option > span,
.stage-option > strong,
.stage-option > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-option > span {
  color: var(--mint);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.stage-option > strong {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 900;
}

.stage-option > small {
  margin-top: 3px;
  color: var(--yellow);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.random-stage-option.is-selected {
  background: linear-gradient(145deg, rgba(99, 72, 145, 0.76), rgba(38, 35, 76, 0.78));
  border-color: rgba(196, 170, 255, 0.78);
}

.random-seed-panel {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: -4px 0 16px;
  padding: 10px 12px;
  background: rgba(15, 17, 40, 0.7);
  border: 1px solid rgba(196, 170, 255, 0.28);
  border-radius: 13px;
}

.random-seed-panel label span,
.random-seed-panel label small {
  display: block;
}

.random-seed-panel label span {
  font-size: 10px;
  font-weight: 900;
}

.random-seed-panel label small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.random-seed-panel > div {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.random-seed-panel input {
  width: 92px;
  height: 36px;
  padding: 0 9px;
  color: var(--yellow);
  font: 900 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(3, 9, 17, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.random-seed-panel input:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255, 217, 90, 0.12);
}

.random-seed-panel button {
  min-width: 52px;
  height: 36px;
  padding: 0 9px;
  color: #211b08;
  font-size: 9px;
  font-weight: 900;
  cursor: pointer;
  background: var(--yellow);
  border: 0;
  border-radius: 9px;
}

.briefing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.briefing-head span {
  color: var(--mint);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.15em;
}

.briefing-head strong {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.mission-steps {
  display: grid;
  grid-template-columns: 1fr 28px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 23px;
}

.mission-step {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
}

.step-number {
  position: absolute;
  top: -3px;
  left: -2px;
  z-index: 2;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  color: var(--night);
  font-size: 7px;
  font-weight: 950;
  background: var(--mint);
  border-radius: 50%;
}

.step-visual {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  font-size: 17px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.ingredient-visual {
  color: var(--yellow);
  text-shadow: 0 0 14px rgba(255, 217, 90, 0.6);
}

.truck-visual {
  color: var(--mint);
  text-shadow: 0 0 14px rgba(121, 242, 180, 0.6);
}

.mission-step p,
.mission-step strong,
.mission-step small {
  display: block;
  margin: 0;
}

.mission-step strong {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.mission-step small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.mission-line {
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 8px);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.control-item {
  display: flex;
  min-width: 0;
  min-height: 75px;
  flex-direction: column;
  gap: 9px;
  align-items: center;
  justify-content: center;
  padding: 9px 5px;
  text-align: center;
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(203, 231, 214, 0.1);
  border-radius: 12px;
}

kbd {
  display: inline-grid;
  min-width: 21px;
  min-height: 20px;
  place-items: center;
  padding: 2px 5px;
  color: #d8e5de;
  font-family: inherit;
  font-size: 9px;
  font-weight: 900;
  background: #182d34;
  border: 1px solid rgba(222, 242, 231, 0.24);
  border-bottom: 3px solid rgba(0, 0, 0, 0.46);
  border-radius: 5px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.arrow-keys {
  display: grid;
  grid-template:
    ". up ." 22px
    "left down right" 22px
    / repeat(3, 22px);
  gap: 3px;
}

.arrow-keys kbd:nth-child(1) { grid-area: up; }
.arrow-keys kbd:nth-child(2) { grid-area: left; }
.arrow-keys kbd:nth-child(3) { grid-area: down; }
.arrow-keys kbd:nth-child(4) { grid-area: right; }

.wide-key {
  min-width: 58px;
}

.shift-key {
  min-width: 48px;
}

.camera-keys {
  display: flex;
  gap: 4px;
}

.control-item .camera-keys + span small kbd {
  min-width: 16px;
  min-height: 16px;
  padding: 0 3px;
  font-size: 7px;
  border-bottom-width: 2px;
}

.control-item strong,
.control-item small {
  display: block;
}

.control-item strong {
  font-size: 12px;
  font-weight: 900;
}

.control-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.keyboard-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.start-footer {
  position: absolute;
  bottom: 24px;
  left: 50%;
  z-index: 2;
  margin: 0;
  color: rgba(187, 205, 199, 0.42);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.18em;
  transform: translateX(-50%);
}

.countdown-screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
  background: rgba(2, 10, 15, 0.44);
  backdrop-filter: blur(3px);
}

.countdown-screen p {
  margin: 0 0 -8px;
  color: var(--mint);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.countdown-screen strong {
  font-size: clamp(120px, 19vw, 250px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.08em;
  text-shadow: 0 16px 70px rgba(0, 0, 0, 0.45);
  animation: count-pop 850ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.compact-panel {
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 12, 18, 0.72);
  backdrop-filter: blur(12px);
}

.modal-card {
  width: min(100%, 470px);
  max-height: calc(var(--app-height, 100dvh) - 48px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 38px;
  text-align: center;
  background: linear-gradient(145deg, #112b34, #091a22);
  border: 1px solid rgba(196, 231, 214, 0.22);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.modal-card .eyebrow {
  justify-content: center;
}

.modal-card h2 {
  margin: 0 0 11px;
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 950;
  line-height: 1.05;
  letter-spacing: -0.065em;
}

.modal-card > p:not(.eyebrow) {
  margin: 0 0 25px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
  line-height: 1.6;
}

.primary-action,
.secondary-action,
.text-action {
  width: 100%;
  cursor: pointer;
}

.primary-action {
  min-height: 56px;
  padding: 12px 18px;
  color: #102018;
  font-size: 14px;
  font-weight: 950;
  background: var(--yellow);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 6px 0 #9e7d20;
}

.primary-action:hover {
  filter: brightness(1.06);
}

.primary-action:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #9e7d20;
}

.primary-action kbd {
  margin-left: 6px;
  color: #102018;
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.14);
  border-bottom-color: rgba(0, 0, 0, 0.23);
  box-shadow: none;
}

.secondary-action {
  min-height: 46px;
  margin-top: 10px;
  padding: 10px 16px;
  color: var(--mint);
  font-size: 12px;
  font-weight: 900;
  background: rgba(121, 242, 180, 0.08);
  border: 1px solid rgba(121, 242, 180, 0.35);
  border-radius: 13px;
}

.secondary-action:hover {
  background: rgba(121, 242, 180, 0.14);
}

.camera-setting {
  margin: -8px 0 22px;
  padding: 13px 14px;
  text-align: left;
  background: rgba(2, 13, 19, 0.48);
  border: 1px solid rgba(203, 231, 214, 0.13);
  border-radius: 14px;
}

.camera-setting label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  font-size: 11px;
  font-weight: 900;
}

.camera-setting label strong {
  color: var(--mint);
}

.camera-setting input {
  width: 100%;
  accent-color: var(--mint);
}

.camera-setting > small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
}

.text-action {
  margin-top: 15px;
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  background: transparent;
  border: 0;
}

.text-action:hover {
  color: var(--ink);
}

.result-card {
  position: relative;
}

.modal-card > p.result-stage {
  margin: -14px 0 13px;
  color: var(--mint);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.result-card::before,
.result-card::after {
  position: absolute;
  width: 180px;
  height: 180px;
  pointer-events: none;
  content: "";
  border: 1px solid rgba(121, 242, 180, 0.08);
  border-radius: 50%;
}

.result-card::before {
  top: -110px;
  left: -70px;
}

.result-card::after {
  right: -80px;
  bottom: -120px;
}

.result-badge {
  position: relative;
  z-index: 1;
  display: grid;
  width: 70px;
  height: 70px;
  margin: 0 auto 18px;
  place-items: center;
  color: #172318;
  font-size: 33px;
  background: var(--yellow);
  border: 6px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 34px rgba(255, 217, 90, 0.27);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 25px 0;
}

.result-stats > div {
  padding: 12px 5px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(203, 231, 214, 0.11);
  border-radius: 12px;
}

.result-stats small,
.result-stats strong {
  display: block;
}

.result-challenges {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 13px 0 9px;
}

.result-challenges span {
  padding: 5px 9px;
  color: rgba(216, 229, 222, 0.42);
  font-size: 8px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.result-challenges span.is-earned {
  color: #142119;
  background: var(--mint);
  border-color: var(--mint);
}

.modal-card > p.result-next {
  margin: 0 0 16px;
  color: var(--yellow);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.45;
}

.result-stats small {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 850;
}

.result-stats strong {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 950;
}

.controls-strip {
  position: absolute;
  bottom: 19px;
  left: 50%;
  z-index: 15;
  display: flex;
  gap: 17px;
  align-items: center;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  background: rgba(6, 19, 25, 0.62);
  border: 1px solid rgba(203, 231, 214, 0.12);
  border-radius: 11px;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.controls-strip span {
  display: flex;
  gap: 5px;
  align-items: center;
  white-space: nowrap;
}

.controls-strip kbd {
  min-height: 17px;
  border-bottom-width: 2px;
}

.webgl-error {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 100;
  width: min(calc(100% - 40px), 500px);
  margin: 0;
  padding: 22px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
  background: #331b20;
  border: 1px solid var(--danger);
  border-radius: 16px;
  transform: translate(-50%, -50%);
}

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

@keyframes count-pop {
  0% { opacity: 0; transform: scale(1.65); }
  30% { opacity: 1; }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -18px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes urgent-beat {
  50% { transform: scale(1.05); }
}

@keyframes damage-pulse {
  0% { opacity: 0.95; }
  100% { opacity: 0; }
}

@keyframes speed-spin {
  to { transform: rotate(6deg) scale(1.04); }
}

@media (max-width: 1050px) {
  .start-screen {
    grid-template-columns: minmax(330px, 0.85fr) minmax(340px, 0.7fr);
    gap: 42px;
    padding-right: 46px;
    padding-left: 46px;
  }

  .start-copy h1 {
    font-size: clamp(64px, 9vw, 96px);
  }

  .mission-step {
    grid-template-columns: 35px 1fr;
  }

  .step-visual {
    width: 35px;
    height: 35px;
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .mission-chip {
    display: none;
  }

  .start-screen {
    display: block;
    overflow-y: auto;
    padding: 104px 28px 64px;
  }

  .start-copy,
  .briefing-card {
    width: min(100%, 540px);
    margin-right: auto;
    margin-left: auto;
  }

  .start-copy {
    margin-bottom: 42px;
  }

  .start-copy h1 {
    font-size: clamp(62px, 17vw, 105px);
  }

  .briefing-card {
    justify-self: auto;
  }

  .minimap-panel {
    transform: scale(0.82);
    transform-origin: right bottom;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 72px;
    padding: 14px 16px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-lockup strong {
    font-size: 14px;
  }

  .sound-label {
    display: none;
  }

  .sound-button {
    min-width: 38px;
    justify-content: center;
    padding: 7px;
  }

  .start-screen {
    padding: 88px 18px 60px;
  }

  .start-copy h1 em {
    right: -38px;
    font-size: 12px;
  }

  .game-intro br {
    display: none;
  }

  .start-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .briefing-card {
    padding: 21px 17px;
  }

  .mission-steps {
    grid-template-columns: 1fr;
  }

  .mission-line {
    display: none;
  }

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

  .control-item {
    min-height: 62px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 9px 16px;
    text-align: left;
  }

  .control-item > div:first-child,
  .control-item > kbd:first-child {
    width: 78px;
    flex: 0 0 78px;
  }

  .wasd {
    justify-content: center;
  }

  .hud {
    top: 82px;
    left: 12px;
    width: 126px;
  }

  .hud-card {
    min-height: 62px;
    padding: 9px 11px;
  }

  .timer-card strong,
  .collect-value strong {
    font-size: 21px;
  }

  .minimap-panel {
    display: none !important;
  }

  .controls-strip {
    gap: 8px;
    bottom: 10px;
  }

  .controls-strip span:nth-child(n + 3) {
    display: none;
  }

  .modal-card {
    padding: 30px 21px;
  }

  .result-stats {
    gap: 5px;
  }
}

@media (max-height: 650px) and (min-width: 821px) {
  .start-screen {
    padding-top: 78px;
    padding-bottom: 30px;
  }

  .start-copy h1 {
    font-size: 74px;
  }

  .game-intro {
    margin-bottom: 18px;
  }

  .briefing-card {
    padding: 20px 25px;
  }

  .briefing-head,
  .mission-steps {
    margin-bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .speed-lines {
    display: none;
  }
}

/* Adaptive input and mobile game shell */

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-self: end;
  pointer-events: auto;
}

.camera-button {
  display: inline-grid;
  min-width: 46px;
  height: 46px;
  place-content: center;
  padding: 4px 7px;
  color: var(--ink);
  cursor: pointer;
  background: rgba(8, 23, 30, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(14px);
}

.camera-button > span,
.camera-button > small {
  display: block;
}

.camera-button > span {
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.camera-button > small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
}

.camera-button:hover {
  border-color: rgba(121, 242, 180, 0.55);
}

.sound-button svg {
  width: 20px;
  height: 20px;
  overflow: visible;
  fill: currentColor;
}

.sound-button .sound-wave {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.sound-button.is-muted .sound-wave {
  opacity: 0.18;
}

.pause-touch-button {
  display: none;
  width: 46px;
  height: 46px;
  gap: 5px;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  background: rgba(8, 23, 30, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(14px);
}

.pause-touch-button span {
  width: 4px;
  height: 16px;
  background: var(--ink);
  border-radius: 4px;
}

.objective-compass {
  position: absolute;
  top: 104px;
  left: 50%;
  z-index: 17;
  display: none;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 7px 14px 7px 8px;
  pointer-events: none;
  background: rgba(5, 20, 27, 0.84);
  border: 1px solid rgba(121, 242, 180, 0.28);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

.compass-arrow {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #122219;
  font-size: 21px;
  font-weight: 950;
  background: var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(121, 242, 180, 0.25);
  transition: transform 180ms ease-out;
}

.objective-compass small,
.objective-compass strong {
  display: block;
  white-space: nowrap;
}

.objective-compass small {
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 850;
}

.objective-compass strong {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 950;
}

.coach {
  position: absolute;
  bottom: 88px;
  left: 50%;
  z-index: 24;
  display: flex;
  gap: 11px;
  align-items: center;
  max-width: min(420px, calc(100% - 40px));
  padding: 11px 16px 11px 12px;
  pointer-events: none;
  background: rgba(9, 27, 34, 0.94);
  border: 1px solid rgba(255, 217, 90, 0.34);
  border-radius: 15px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  transform: translateX(-50%);
  animation: toast-in 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
  backdrop-filter: blur(18px);
}

.coach-pulse {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  background: var(--yellow);
  border-radius: 50%;
  box-shadow: 0 0 0 7px rgba(255, 217, 90, 0.09), 0 0 20px rgba(255, 217, 90, 0.5);
  animation: coach-beat 1.6s ease-in-out infinite;
}

.coach p,
.coach strong,
.coach p span {
  display: block;
  margin: 0;
}

.coach strong {
  margin-bottom: 2px;
  font-size: 12px;
  font-weight: 950;
}

.coach p span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.touch-control-guide,
.touch-note,
.touch-controls {
  display: none;
}

.touch-control-guide {
  gap: 9px;
}

.touch-guide-item {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(203, 231, 214, 0.11);
  border-radius: 13px;
}

.touch-guide-item > span:last-child,
.touch-guide-item strong,
.touch-guide-item small {
  display: block;
}

.touch-guide-item strong {
  margin-bottom: 3px;
  font-size: 12px;
  font-weight: 900;
}

.touch-guide-item small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.touch-guide-stick {
  position: relative;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  background: rgba(121, 242, 180, 0.06);
  border: 1px solid rgba(121, 242, 180, 0.32);
  border-radius: 50%;
  box-shadow: inset 0 0 18px rgba(121, 242, 180, 0.07);
}

.touch-guide-stick i {
  position: absolute;
  top: 7px;
  left: 15px;
  width: 23px;
  height: 23px;
  background: var(--mint);
  border-radius: 50%;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.28);
}

.touch-guide-actions {
  display: flex;
  width: 52px;
  flex: 0 0 auto;
  align-items: flex-end;
  justify-content: space-between;
}

.touch-guide-actions i {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  color: #102018;
  font-size: 13px;
  font-style: normal;
  font-weight: 950;
  background: var(--yellow);
  border-radius: 50%;
}

.touch-guide-actions i:first-child {
  width: 38px;
  height: 38px;
  margin-right: -9px;
  background: var(--mint);
}

.touch-controls {
  position: absolute;
  right: max(20px, calc(env(safe-area-inset-right) + 20px));
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 16px));
  left: max(20px, calc(env(safe-area-inset-left) + 20px));
  z-index: 28;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.joystick-zone {
  position: relative;
  display: flex;
  width: 148px;
  height: 148px;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  outline: none;
  touch-action: none;
}

.joystick-zone > small {
  position: absolute;
  bottom: -1px;
  left: 50%;
  color: rgba(224, 239, 230, 0.68);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  transform: translateX(-50%);
}

.joystick-ring {
  position: relative;
  display: block;
  width: 124px;
  height: 124px;
  background:
    radial-gradient(circle, rgba(121, 242, 180, 0.08) 0 32%, transparent 33%),
    repeating-conic-gradient(from 0deg, rgba(213, 239, 225, 0.1) 0 2deg, transparent 2deg 45deg),
    rgba(7, 23, 30, 0.52);
  border: 1.5px solid rgba(191, 230, 210, 0.23);
  border-radius: 50%;
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.22), 0 14px 32px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
}

.joystick-ring::before,
.joystick-ring::after {
  position: absolute;
  top: 50%;
  left: 50%;
  pointer-events: none;
  content: "";
  background: rgba(218, 240, 228, 0.12);
  transform: translate(-50%, -50%);
}

.joystick-ring::before {
  width: 1px;
  height: 88%;
}

.joystick-ring::after {
  width: 88%;
  height: 1px;
}

.joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  background: linear-gradient(145deg, #a2ffd0, #4dca91);
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), inset 0 2px 8px rgba(255, 255, 255, 0.28);
  transform: translate(-50%, -50%);
  will-change: transform;
}

.joystick-knob i {
  width: 15px;
  height: 15px;
  background: rgba(13, 54, 39, 0.32);
  border-radius: 50%;
}

.joystick-zone.is-active .joystick-ring {
  border-color: rgba(121, 242, 180, 0.62);
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.18), 0 0 30px rgba(121, 242, 180, 0.18);
}

.touch-actions {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  pointer-events: none;
}

.touch-action-button {
  display: grid;
  width: 74px;
  height: 74px;
  place-content: center;
  padding: 0;
  pointer-events: auto;
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.31);
  border-radius: 50%;
  box-shadow: 0 9px 0 rgba(0, 0, 0, 0.27), 0 18px 34px rgba(0, 0, 0, 0.24);
  transition: transform 90ms ease, box-shadow 90ms ease, filter 90ms ease;
  touch-action: none;
}

.touch-action-button > span,
.touch-action-button > small {
  display: block;
}

.touch-action-button > span {
  font-size: 25px;
  font-weight: 950;
  line-height: 0.9;
}

.touch-action-button > small {
  margin-top: 4px;
  font-size: 9px;
  font-weight: 950;
}

.jump-action {
  width: 88px;
  height: 88px;
  color: #102118;
  background: linear-gradient(145deg, #a3ffd2, #53d494);
}

.dash-action {
  color: #271d07;
  background: linear-gradient(145deg, #ffe98e, #ffc745);
}

.touch-action-button.is-active,
.touch-action-button:active {
  filter: brightness(1.1);
  transform: translateY(6px) scale(0.96);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28), 0 8px 18px rgba(0, 0, 0, 0.2);
}

@keyframes coach-beat {
  50% { transform: scale(1.18); }
}

html.touch-device .desktop-control-guide,
html.touch-device .desktop-note,
html.touch-device .controls-strip {
  display: none !important;
}

html.touch-device .touch-control-guide {
  display: grid;
}

html.touch-device .touch-note {
  display: inline;
}

html.touch-device .start-screen {
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

html.touch-device .pause-touch-button:not([hidden]) {
  display: inline-flex;
}

html.touch-device .touch-controls:not([hidden]) {
  display: flex;
}

html.touch-device .objective-compass:not([hidden]) {
  display: flex;
}

html.touch-device .minimap-panel {
  display: none !important;
}

@media (hover: none), (pointer: coarse) {
  button:hover {
    filter: none;
  }
}

@media (max-width: 900px), (pointer: coarse) {
  html.touch-device .game-shell {
    height: var(--app-height, 100dvh);
  }

  html.touch-device .topbar {
    min-height: calc(66px + env(safe-area-inset-top));
    padding:
      calc(10px + env(safe-area-inset-top))
      max(12px, calc(env(safe-area-inset-right) + 10px))
      9px
      max(12px, calc(env(safe-area-inset-left) + 10px));
  }

  html.touch-device .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px 12px 14px 10px;
  }

  html.touch-device .brand-lockup {
    gap: 9px;
  }

  html.touch-device .brand-lockup strong {
    font-size: 13px;
  }

  html.touch-device .brand-lockup small {
    font-size: 7px;
  }

  html.touch-device .sound-button {
    min-width: 46px;
    min-height: 46px;
    justify-content: center;
    padding: 0;
    border-radius: 14px;
  }

  html.touch-device .sound-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  html.touch-device .hud {
    top: calc(72px + env(safe-area-inset-top));
    right: max(10px, calc(env(safe-area-inset-right) + 8px));
    left: max(10px, calc(env(safe-area-inset-left) + 8px));
    display: grid;
    width: auto;
    grid-template-columns: 1.2fr 1fr 0.82fr;
    gap: 6px;
  }

  html.touch-device .hud-card {
    min-width: 0;
    min-height: 58px;
    padding: 8px 10px;
    border-radius: 13px;
    backdrop-filter: blur(10px);
  }

  html.touch-device .hud-label {
    margin-bottom: 4px;
    overflow: hidden;
    font-size: 8px;
    letter-spacing: 0.06em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.touch-device .timer-card strong,
  html.touch-device .collect-value strong {
    font-size: 20px;
  }

  html.touch-device .timer-bar {
    margin-top: 4px;
  }

  html.touch-device .ingredient-mini {
    width: 23px;
    height: 23px;
    font-size: 11px;
  }

  html.touch-device .collect-value {
    gap: 7px;
  }

  html.touch-device .hearts {
    gap: 3px;
    font-size: 17px;
  }

  html.touch-device .objective-compass {
    top: calc(139px + env(safe-area-inset-top));
    min-height: 43px;
    padding: 5px 12px 5px 6px;
  }

  html.touch-device .compass-arrow {
    width: 31px;
    height: 31px;
    font-size: 18px;
  }

  html.touch-device .toast {
    top: calc(188px + env(safe-area-inset-top));
    width: calc(100% - max(28px, env(safe-area-inset-left)) - max(28px, env(safe-area-inset-right)));
    min-width: 0;
    max-width: 340px;
  }

  html.touch-device .coach {
    bottom: calc(174px + env(safe-area-inset-bottom));
    max-width: calc(100% - 44px);
  }

  html.touch-device .vignette {
    box-shadow: inset 0 0 100px 22px rgba(0, 0, 0, 0.32);
  }

  html.touch-device .sky-grain {
    opacity: 0.09;
  }

  html.touch-device .start-screen {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    padding:
      calc(84px + env(safe-area-inset-top))
      max(18px, calc(env(safe-area-inset-right) + 14px))
      calc(34px + env(safe-area-inset-bottom))
      max(18px, calc(env(safe-area-inset-left) + 14px));
  }

  html.touch-device .start-copy,
  html.touch-device .briefing-card {
    width: min(100%, 520px);
    margin-right: auto;
    margin-left: auto;
  }

  html.touch-device .start-copy {
    margin-bottom: 28px;
  }

  html.touch-device .start-copy h1 {
    font-size: clamp(62px, 20vw, 88px);
  }

  html.touch-device .game-intro {
    margin-bottom: 20px;
    font-size: 14px;
  }

  html.touch-device .start-actions {
    width: 100%;
    gap: 13px;
    align-items: stretch;
  }

  html.touch-device .play-button {
    width: 100%;
    min-height: 62px;
  }

  html.touch-device .best-record {
    padding-left: 3px;
  }

  html.touch-device .briefing-card {
    padding: 20px 17px;
  }

  html.touch-device .briefing-head {
    margin-bottom: 15px;
  }

  html.touch-device .mission-steps {
    margin-bottom: 15px;
  }

  html.touch-device .keyboard-note {
    margin-top: 13px;
  }

  html.touch-device .start-footer {
    display: none;
  }

  html.touch-device .compact-panel {
    padding:
      calc(16px + env(safe-area-inset-top))
      max(16px, calc(env(safe-area-inset-right) + 12px))
      calc(16px + env(safe-area-inset-bottom))
      max(16px, calc(env(safe-area-inset-left) + 12px));
  }

  html.touch-device .modal-card {
    max-height: calc(var(--app-height, 100dvh) - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  html.touch-device .text-action {
    min-height: 44px;
  }
}

@media (max-width: 390px) {
  html.touch-device .brand-lockup small {
    display: none;
  }

  html.touch-device .brand-lockup strong {
    font-size: 12px;
  }

  html.touch-device .topbar-actions {
    gap: 5px;
  }

  html.touch-device .pause-touch-button,
  html.touch-device .sound-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  html.touch-device .hud-card {
    padding-right: 7px;
    padding-left: 7px;
  }

  html.touch-device .heart-card .hud-label {
    text-align: center;
  }

  html.touch-device .hearts {
    justify-content: center;
  }

  html.touch-device .joystick-zone {
    width: 136px;
    height: 136px;
  }

  html.touch-device .joystick-ring {
    width: 114px;
    height: 114px;
  }

  html.touch-device .touch-actions {
    gap: 8px;
  }

  html.touch-device .touch-action-button {
    width: 66px;
    height: 66px;
  }

  html.touch-device .jump-action {
    width: 80px;
    height: 80px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  html.touch-device .topbar {
    min-height: calc(52px + env(safe-area-inset-top));
    padding-top: calc(5px + env(safe-area-inset-top));
    padding-bottom: 5px;
  }

  html.touch-device .brand-mark {
    width: 34px;
    height: 34px;
  }

  html.touch-device .brand-lockup small,
  html.touch-device .sound-label {
    display: none;
  }

  html.touch-device .pause-touch-button,
  html.touch-device .sound-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  html.touch-device .hud {
    top: calc(57px + env(safe-area-inset-top));
    right: auto;
    width: 286px;
    grid-template-columns: 1.1fr 0.9fr 0.8fr;
  }

  html.touch-device .hud-card {
    min-height: 51px;
    padding: 6px 8px;
  }

  html.touch-device .hud-label {
    margin-bottom: 1px;
    font-size: 7px;
  }

  html.touch-device .timer-card strong,
  html.touch-device .collect-value strong {
    font-size: 17px;
  }

  html.touch-device .ingredient-mini {
    width: 20px;
    height: 20px;
  }

  html.touch-device .hearts {
    font-size: 15px;
  }

  html.touch-device .objective-compass {
    top: calc(58px + env(safe-area-inset-top));
    right: max(16px, calc(env(safe-area-inset-right) + 14px));
    left: auto;
    max-width: 180px;
    transform: none;
  }

  html.touch-device .toast {
    top: calc(110px + env(safe-area-inset-top));
  }

  html.touch-device .coach {
    bottom: calc(116px + env(safe-area-inset-bottom));
  }

  html.touch-device .touch-controls {
    right: max(16px, calc(env(safe-area-inset-right) + 14px));
    bottom: max(7px, calc(env(safe-area-inset-bottom) + 6px));
    left: max(16px, calc(env(safe-area-inset-left) + 14px));
  }

  html.touch-device .joystick-zone {
    width: 112px;
    height: 112px;
  }

  html.touch-device .joystick-ring {
    width: 96px;
    height: 96px;
  }

  html.touch-device .joystick-knob {
    width: 46px;
    height: 46px;
  }

  html.touch-device .joystick-zone > small {
    display: none;
  }

  html.touch-device .touch-action-button {
    width: 60px;
    height: 60px;
  }

  html.touch-device .jump-action {
    width: 72px;
    height: 72px;
  }

  html.touch-device .start-screen {
    display: grid;
    grid-template-columns: minmax(230px, 0.78fr) minmax(350px, 1.22fr);
    gap: 22px;
    align-items: start;
    padding:
      calc(56px + env(safe-area-inset-top))
      max(22px, calc(env(safe-area-inset-right) + 18px))
      calc(12px + env(safe-area-inset-bottom))
      max(22px, calc(env(safe-area-inset-left) + 18px));
  }

  html.touch-device .start-copy {
    margin: 0;
  }

  html.touch-device .start-copy h1 {
    margin-bottom: 13px;
    font-size: clamp(46px, 10.8vw, 70px);
  }

  html.touch-device .game-intro {
    margin-bottom: 12px;
    font-size: 11px;
    line-height: 1.45;
  }

  html.touch-device .game-intro br {
    display: none;
  }

  html.touch-device .play-button {
    min-height: 52px;
  }

  html.touch-device .best-record {
    display: none;
  }

  html.touch-device .briefing-card {
    padding: 13px 15px;
  }

  html.touch-device .briefing-head {
    margin-bottom: 9px;
    padding-bottom: 8px;
  }

  html.touch-device .mission-steps {
    grid-template-columns: 1fr 18px 1fr;
    margin-bottom: 9px;
  }

  html.touch-device .mission-line {
    display: block;
  }

  html.touch-device .step-visual {
    width: 34px;
    height: 34px;
  }

  html.touch-device .touch-control-guide {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  html.touch-device .touch-guide-item {
    min-height: 55px;
    padding: 7px 8px;
  }

  html.touch-device .touch-guide-stick {
    width: 37px;
    height: 37px;
  }

  html.touch-device .touch-guide-stick i {
    top: 5px;
    left: 12px;
    width: 19px;
    height: 19px;
  }

  html.touch-device .touch-guide-item small,
  html.touch-device .keyboard-note {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 760px) {
  html.touch-device .start-screen {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    padding:
      calc(58px + env(safe-area-inset-top))
      max(18px, calc(env(safe-area-inset-right) + 14px))
      calc(18px + env(safe-area-inset-bottom))
      max(18px, calc(env(safe-area-inset-left) + 14px));
  }

  html.touch-device .start-copy,
  html.touch-device .briefing-card {
    width: min(100%, 520px);
    margin-right: auto;
    margin-left: auto;
  }

  html.touch-device .start-copy {
    margin-bottom: 22px;
  }
}

/* Multi-stage and camera refinement */

@media (max-width: 1120px) and (min-width: 821px) {
  .start-screen {
    grid-template-columns: minmax(0, 0.72fr) minmax(400px, 1fr);
    gap: 34px;
    padding-right: 38px;
    padding-left: 38px;
  }

  .start-copy h1 {
    font-size: clamp(60px, 8.2vw, 88px);
  }

  .briefing-card {
    padding: 22px;
  }
}

@media (max-width: 820px) {
  .start-screen {
    overflow-x: hidden;
  }

  .start-backdrop {
    right: 0;
  }

  .start-footer {
    display: none;
  }

  .progress-summary {
    width: min(100%, 540px);
  }

  .stage-selector {
    grid-template-columns: repeat(4, minmax(72px, 1fr));
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .stage-selector::-webkit-scrollbar {
    display: none;
  }

  .stage-option {
    min-height: 64px;
  }
}

@media (max-width: 560px) {
  .start-copy h1 {
    margin-bottom: 18px;
    font-size: clamp(58px, 18vw, 82px);
  }

  .start-copy h1 em {
    margin-bottom: 0.18em;
    font-size: 11px;
  }

  .progress-summary {
    margin-bottom: 16px;
  }

  .progress-summary > span {
    padding: 9px 10px;
  }

  .stage-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .stage-option {
    min-height: 58px;
  }

  .random-seed-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .random-seed-panel > div {
    width: 100%;
  }

  .random-seed-panel input {
    width: auto;
    flex: 1;
  }

  .arrow-keys {
    width: 78px;
  }

  .result-card {
    padding: 28px 18px;
  }

  .result-challenges {
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  html.touch-device .camera-button,
  html.touch-device .pause-touch-button,
  html.touch-device .sound-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    border-radius: 12px;
  }

  html.touch-device .topbar-actions {
    gap: 4px;
  }

  html.touch-device .camera-button > small {
    font-size: 6px;
  }
}

@media (max-width: 350px) {
  html.touch-device .brand-lockup > div {
    display: none;
  }
}
