:root {
  color-scheme: dark;
  --ink: #08111f;
  --panel: rgba(7, 17, 32, 0.88);
  --line: rgba(255, 255, 255, 0.14);
  --mint: #45f0b5;
  --gold: #ffd15c;
  --text: #f7fbff;
  --muted: #a9bbce;
}
* {
  box-sizing: border-box;
}
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  font-family: Inter, ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  color: var(--text);
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
}
#gameRoot,
#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}
#gameCanvas {
  touch-action: none;
}
.topbar {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 18px 10px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 12, 25, 0.62), transparent);
}
.brand,
.top-actions {
  pointer-events: auto;
}
.brand {
  display: flex;
  gap: 9px;
  align-items: center;
  color: white;
  text-decoration: none;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px #000;
}
.brand span {
  font-size: 27px;
}
.top-actions {
  display: flex;
  gap: 8px;
}
.icon-btn,
.pill-btn {
  border: 1px solid var(--line);
  background: rgba(5, 15, 30, 0.66);
  backdrop-filter: blur(12px);
  border-radius: 999px;
  min-width: 42px;
  height: 42px;
  cursor: pointer;
}
.speed-btn {
  min-width: 58px;
  padding: 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}
.pill-btn {
  padding: 0 16px;
  font-weight: 800;
}
.hud {
  position: fixed;
  z-index: 20;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  max-width: calc(100vw - 24px);
}
.hud-chip {
  min-width: 102px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(5, 15, 30, 0.68);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.hud-chip small {
  display: block;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.hud-chip strong {
  font-size: 16px;
}
.hud-chip.star strong {
  color: var(--gold);
}
.screen {
  position: fixed;
  z-index: 15;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 74px 16px 20px;
  background:
    radial-gradient(
      circle at 70% 20%,
      rgba(56, 189, 248, 0.18),
      transparent 35%
    ),
    linear-gradient(90deg, rgba(3, 10, 22, 0.84), rgba(3, 10, 22, 0.28));
}
.screen.visible {
  display: flex;
}
.hero-card,
.result-card {
  width: min(620px, 100%);
  max-height: calc(100dvh - 92px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: clamp(22px, 4vw, 38px);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.38);
}
.eyebrow {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--mint);
}
h1 {
  margin: 10px 0;
  font-size: clamp(48px, 10vw, 88px);
  line-height: 0.78;
  letter-spacing: -0.07em;
}
h1 span {
  color: var(--gold);
}
.hero-card > p {
  max-width: 520px;
  margin: 18px 0 22px;
  color: var(--muted);
  line-height: 1.55;
}
.selector-block {
  margin-top: 17px;
}
.selector-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 800;
}
.selector-title button {
  border: 0;
  background: none;
  color: var(--mint);
  cursor: pointer;
}
.muted {
  color: var(--muted);
  font-weight: 500;
}
.avatar-picker,
.scene-picker {
  display: grid;
  gap: 8px;
}
.avatar-picker {
  grid-template-columns: repeat(3, 1fr);
}
.scene-picker {
  grid-template-columns: repeat(3, 1fr);
}
.choice {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
  padding: 10px;
  cursor: pointer;
  text-align: center;
  transition:
    0.18s transform,
    0.18s border;
}
.choice:hover {
  transform: translateY(-2px);
}
.choice.active {
  border-color: var(--mint);
  box-shadow: 0 0 0 2px rgba(69, 240, 181, 0.15);
}
.choice.locked {
  opacity: 0.55;
}
.choice .emoji {
  display: block;
  font-size: 28px;
}
.choice strong {
  display: block;
  font-size: 11px;
  margin-top: 4px;
}
.choice small {
  color: var(--gold);
  font-size: 9px;
}
.start-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 20px;
  border: 0;
  border-radius: 16px;
  padding: 15px 20px;
  background: linear-gradient(135deg, var(--gold), #ff8b42);
  color: #16120a;
  font-weight: 1000;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(255, 164, 60, 0.25);
}
.start-btn kbd {
  border-radius: 6px;
  padding: 3px 7px;
  background: rgba(0, 0, 0, 0.14);
  font-size: 10px;
}
.controls-hint {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}
.result-card {
  text-align: center;
  max-width: 520px;
}
.result-raccoon {
  font-size: 70px;
}
.result-card h2 {
  font-size: 36px;
  margin: 8px 0 18px;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}
.result-grid div {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}
.result-grid small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
}
.result-grid strong {
  font-size: 22px;
}
.settlement {
  min-height: 20px;
  color: var(--gold);
  font-size: 12px;
}
.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.result-actions .start-btn {
  grid-column: 1/-1;
}
.secondary-btn {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  padding: 12px;
  cursor: pointer;
}
.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 5, 15, 0.78);
  backdrop-filter: blur(12px);
}
.modal-card {
  position: relative;
  width: min(600px, 100%);
  max-height: 88dvh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 28px;
  background: #0b1728;
  box-shadow: 0 30px 100px #000;
}
.modal-card h2 {
  margin: 7px 0 18px;
  font-size: 30px;
}
.close-btn {
  position: absolute;
  right: 16px;
  top: 12px;
  border: 0;
  background: none;
  font-size: 34px;
  cursor: pointer;
}
.login-hint {
  border-radius: 16px;
  background: rgba(255, 209, 92, 0.09);
  padding: 18px;
  line-height: 1.6;
  color: var(--muted);
}
.login-hint a {
  color: var(--gold);
}
.wallet-row {
  display: flex;
  justify-content: space-between;
  padding: 13px 15px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.06);
}
.avatar-shop {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 13px;
}
.shop-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: center;
}
.shop-card .avatar-face {
  font-size: 35px;
}
.shop-card strong,
.shop-card small {
  display: block;
}
.shop-card small {
  min-height: 28px;
  color: var(--muted);
  font-size: 10px;
}
.shop-card button {
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 10px;
  padding: 8px 4px;
  background: #1f78ff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.shop-card button.equipped {
  background: #1b825f;
}
.modal-tabs {
  display: flex;
  gap: 7px;
  margin-top: 18px;
}
.modal-tabs button {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px;
  background: transparent;
  cursor: pointer;
}
.modal-tabs button.active {
  background: rgba(69, 240, 181, 0.15);
  border-color: var(--mint);
}
.data-list {
  margin-top: 10px;
}
.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.data-row small {
  display: block;
  color: var(--muted);
}
.positive {
  color: var(--mint);
}
.negative {
  color: #ff778b;
}
.touch-controls {
  position: fixed;
  z-index: 25;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 9px;
}
.touch-controls button {
  width: 58px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(5, 15, 30, 0.64);
  font-size: 25px;
  backdrop-filter: blur(12px);
  touch-action: manipulation;
}
.hidden {
  display: none !important;
}
@media (max-width: 680px) {
  .topbar {
    padding-left: 10px;
    padding-right: 10px;
  }
  .brand strong {
    display: none;
  }
  .pill-btn {
    padding: 0 11px;
  }
  .hud {
    top: 68px;
    gap: 4px;
  }
  .hud-chip {
    min-width: 0;
    padding: 7px 8px;
  }
  .hud-chip small {
    font-size: 7px;
  }
  .hud-chip strong {
    font-size: 12px;
  }
  .hero-card {
    padding: 20px;
    border-radius: 24px;
  }
  .hero-card > p {
    font-size: 12px;
    margin: 12px 0;
  }
  .selector-block {
    margin-top: 12px;
  }
  .choice {
    padding: 7px;
  }
  .choice .emoji {
    font-size: 23px;
  }
  .controls-hint {
    display: none;
  }
  .touch-controls:not(.hidden) {
    display: flex;
  }
  .avatar-shop {
    grid-template-columns: repeat(3, 1fr);
  }
  .modal-card {
    padding: 22px 16px;
  }
  .screen {
    padding-top: 66px;
  }
}
