:root {
  color-scheme: dark;
  --ink: #10130f;
  --panel: #181d18;
  --paper: #eee9db;
  --acid: #d8ff3e;
  --coral: #ff654f;
  --cyan: #34d9ff;
  --muted: #8f978c;
  --line: rgba(238, 233, 219, 0.18);
  font-family: "Bahnschrift", "DIN Alternate", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--paper);
  background:
    radial-gradient(circle at 50% -20%, rgba(216, 255, 62, 0.12), transparent 36rem),
    repeating-linear-gradient(90deg, transparent 0 44px, rgba(238, 233, 219, 0.025) 44px 45px),
    #080a08;
  touch-action: none;
}

button { font: inherit; }

.noise {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
}

.machine-header,
.machine-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: uppercase;
}

.machine-header { min-height: 48px; }

.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-lockup p,
.brand-lockup strong { display: block; margin: 0; line-height: 1; }
.brand-lockup p { color: var(--muted); font-size: 8px; letter-spacing: 0.25em; margin-bottom: 5px; }
.brand-lockup strong { font-size: 14px; letter-spacing: 0.15em; }

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--acid);
  font-weight: 900;
  font-size: 22px;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 76% 100%, 0 100%);
}

.icon-button,
.pause-button {
  border: 1px solid var(--line);
  color: var(--paper);
  background: rgba(16, 19, 15, 0.72);
  cursor: pointer;
}

.icon-button {
  width: 52px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 9px;
  letter-spacing: 0.15em;
}

.icon-button i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 12px var(--acid);
}

.icon-button[aria-pressed="true"] i { background: var(--coral); box-shadow: none; }

.game-stage {
  position: relative;
  width: 100%;
  align-self: center;
  overflow: hidden;
  border: 1px solid rgba(238, 233, 219, 0.24);
  background: var(--panel);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.45), inset 0 0 0 4px rgba(0, 0, 0, 0.22);
  isolation: isolate;
}

.game-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border: 6px solid transparent;
  border-image: repeating-linear-gradient(135deg, transparent 0 12px, rgba(216, 255, 62, 0.24) 12px 18px) 6;
  opacity: 0.5;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 390 / 620;
  outline: none;
  cursor: crosshair;
  touch-action: none;
}

.hud {
  position: absolute;
  inset: 12px 12px auto;
  z-index: 4;
  pointer-events: none;
}

.hud-topline,
.hud-bottomline {
  display: grid;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(10, 12, 10, 0.82);
  backdrop-filter: blur(9px);
}

.hud-topline { grid-template-columns: 1fr auto 42px; min-height: 50px; }
.hud-bottomline { grid-template-columns: 60px 1fr 60px; margin-top: 6px; padding: 6px 9px; }
.target-readout { display: flex; align-items: center; gap: 8px; padding-left: 10px; }
.target-dot { width: 16px; height: 16px; background: var(--acid); box-shadow: 0 0 14px currentColor; transform: rotate(45deg); }
.target-readout small,
.target-readout strong { display: block; line-height: 1.05; }
.hud small { color: var(--muted); font-size: 7px; letter-spacing: 0.14em; }
.target-readout strong { margin-top: 4px; font-size: 12px; }
.level-readout { padding: 0 12px; text-align: center; border-left: 1px solid var(--line); }
.level-readout small, .level-readout strong { display: block; }
.level-readout strong { font-size: 18px; line-height: 1; }
.pause-button { width: 42px; height: 50px; border-block: 0; border-right: 0; pointer-events: auto; font-size: 16px; }

.readout small,
.readout strong { display: block; }
.readout strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.readout-right { text-align: right; }
.energy-block { padding: 0 10px; }
.energy-block > div:first-child { display: flex; justify-content: space-between; }
.energy-block span { color: var(--acid); font-size: 8px; }
.energy-track { height: 5px; margin-top: 5px; overflow: hidden; background: rgba(238, 233, 219, 0.12); }
.energy-track i { display: block; width: 100%; height: 100%; background: var(--acid); transform-origin: left; box-shadow: 0 0 14px var(--acid); }

.panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 28px 30px;
  background: linear-gradient(180deg, rgba(16, 19, 15, 0.5), rgba(16, 19, 15, 0.97) 42%);
}

.serial-tag,
.eyebrow {
  align-self: flex-start;
  margin: 0 0 16px;
  padding: 6px 8px;
  color: var(--ink);
  background: var(--acid);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.18em;
  transform: rotate(-1.5deg);
}

.title-stack { display: flex; flex-direction: column; margin-bottom: 12px; font-size: clamp(50px, 15vw, 68px); font-weight: 900; letter-spacing: -0.08em; line-height: 0.82; }
.title-stack .outline { color: transparent; -webkit-text-stroke: 1.5px var(--paper); transform: translateX(18px); }
.tagline { margin: 7px 0 24px; color: var(--muted); font-size: 13px; letter-spacing: 0.12em; }

.how-to { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 22px; border-block: 1px solid var(--line); }
.how-to div { display: flex; gap: 7px; padding: 12px 6px; border-right: 1px solid var(--line); }
.how-to div:last-child { border-right: 0; }
.how-to b { color: var(--acid); font-size: 8px; }
.how-to span { font-size: 10px; line-height: 1.35; }

.primary-button {
  min-height: 54px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  color: var(--ink);
  background: var(--acid);
  font-weight: 900;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 6px 6px 0 rgba(238, 233, 219, 0.18);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.primary-button:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 rgba(238, 233, 219, 0.18); }
.primary-button:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 rgba(238, 233, 219, 0.18); }
.primary-button b { font-size: 22px; }
.control-hint { margin: 17px 0 0; color: var(--muted); text-align: center; font-size: 8px; letter-spacing: 0.08em; }

.data-actions { display: flex; justify-content: center; gap: 14px; margin-top: 11px; }
.data-actions button { min-height: 30px; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 8px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.pause-panel,
.result-panel { text-align: center; background: rgba(10, 12, 10, 0.95); }
.pause-panel h2,
.result-panel h2 { margin: 0; font-size: 34px; letter-spacing: -0.04em; }
.pause-panel p { color: var(--muted); }
.pause-panel .primary-button { margin-top: 28px; }
.text-button { min-height: 44px; margin-top: 8px; border: 0; color: var(--muted); background: transparent; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }

.result-stamp { position: absolute; top: 42px; right: 24px; color: var(--acid); border: 3px solid currentColor; padding: 6px 8px; font-size: 21px; font-weight: 900; transform: rotate(7deg); }
.result-score { margin: 24px 0 12px; padding: 14px; border-block: 1px solid var(--line); }
.result-score small,
.result-score strong { display: block; }
.result-score small { color: var(--muted); font-size: 8px; letter-spacing: 0.3em; }
.result-score strong { margin-top: 3px; color: var(--acid); font-size: 43px; line-height: 1; font-variant-numeric: tabular-nums; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 24px; }
.result-stats div { border-right: 1px solid var(--line); }
.result-stats div:last-child { border: 0; }
.result-stats small,
.result-stats strong { display: block; }
.result-stats small { color: var(--muted); font-size: 8px; }
.result-stats strong { margin-top: 6px; font-size: 15px; }

.reward-button,
.boost-button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(216, 255, 62, 0.7);
  color: var(--paper);
  background: rgba(216, 255, 62, 0.08);
  cursor: pointer;
}

.reward-button { width: 100%; min-height: 50px; margin-bottom: 10px; padding: 7px 12px; text-align: left; }
.reward-button i,
.boost-button i { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; color: var(--ink); background: var(--acid); font-style: normal; }
.reward-button span,
.boost-button span { font-size: 12px; font-weight: 800; line-height: 1.05; }
.reward-button small,
.boost-button small { display: block; margin-bottom: 4px; color: var(--acid); font-size: 7px; letter-spacing: 0.12em; }

.boost-button { position: absolute; z-index: 4; left: 18px; bottom: 20px; min-height: 44px; padding: 6px 10px 6px 7px; backdrop-filter: blur(8px); }

.ad-demo { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; padding: 28px; background: rgba(8, 10, 8, 0.92); }
.ad-demo-card { width: 100%; padding: 24px; border: 1px solid var(--line); background: #141914; box-shadow: 8px 8px 0 rgba(216, 255, 62, 0.16); }
.ad-demo-card p { margin: 5px 0 18px; color: var(--coral); font-size: 10px; letter-spacing: 0.08em; }
.ad-demo-card strong { display: block; font-size: 21px; }
.ad-demo-card > small { color: var(--muted); font-size: 8px; }
.ad-progress { height: 7px; margin: 18px 0 10px; overflow: hidden; background: rgba(238, 233, 219, 0.12); }
.ad-progress i { display: block; width: 100%; height: 100%; background: var(--acid); transform: scaleX(0); transform-origin: left; }

.combo-badge { position: absolute; z-index: 4; right: 18px; top: 132px; padding: 7px 10px; color: var(--ink); background: var(--paper); transform: rotate(3deg); pointer-events: none; }
.combo-badge small,
.combo-badge strong { display: block; line-height: 1; }
.combo-badge small { font-size: 7px; }
.combo-badge strong { font-size: 23px; }

.toast { position: absolute; z-index: 8; left: 50%; bottom: 22px; min-width: 190px; padding: 10px 14px; transform: translateX(-50%); text-align: center; color: var(--ink); background: var(--paper); font-size: 11px; font-weight: 800; box-shadow: 5px 5px 0 rgba(216, 255, 62, 0.5); }

.machine-footer { min-height: 18px; color: var(--muted); font-size: 7px; letter-spacing: 0.18em; }
.machine-footer span:first-child { display: flex; align-items: center; gap: 6px; }
.machine-footer i { width: 5px; height: 5px; border-radius: 50%; background: var(--coral); }

.is-hidden { display: none !important; }

@media (max-height: 720px) and (orientation: landscape) {
  .app-shell { width: min(390px, 64vh); padding-block: 4px; }
  .machine-header { min-height: 38px; }
  .machine-footer { display: none; }
}

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