:root {
  color-scheme: dark;
  --bg: #05060d;
  --panel: #111521;
  --panel-strong: #1a2030;
  --text: #f4f6fb;
  --muted: #abb3c4;
  --accent: #f4c95d;
  --accent-strong: #ffdf7d;
  --line: rgba(255, 255, 255, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(244, 201, 93, 0.18), transparent 22rem),
    linear-gradient(145deg, #05060d 0%, #111827 52%, #111017 100%);
}

button {
  border: 0;
  border-radius: 8px;
  color: #17140b;
  background: var(--accent);
  font: inherit;
  font-weight: 800;
  padding: 0.85rem 1.05rem;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(244, 201, 93, 0.22);
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.secondary-button,
.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
  box-shadow: none;
}

.secondary-button:hover,
.ghost-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.game-shell {
  width: min(1120px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
  display: grid;
  grid-template-rows: auto minmax(240px, 1fr) auto;
  gap: 16px;
}

.topbar,
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.label,
.scoreboard span,
.controls {
  color: var(--muted);
  font-size: 0.88rem;
}

.label {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.6vw, 2.25rem);
  line-height: 1.05;
}

.hud-stats {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.scoreboard {
  min-width: 112px;
  padding: 10px 14px;
  display: grid;
  justify-items: end;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 21, 33, 0.72);
}

.currency-board strong {
  color: #64e8ff;
}

.shield-board strong {
  color: #8af3ff;
  font-size: 1.2rem;
}

.combo-board strong {
  color: #b7ff7a;
  font-size: 1.25rem;
}

.scoreboard strong {
  display: block;
  color: var(--accent-strong);
  font-size: 2rem;
  line-height: 1;
  transform-origin: center;
}

.scoreboard.lives-board strong {
  color: #ff5d9e;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
}

.canvas-wrap {
  position: relative;
  min-height: 280px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 280px;
  aspect-ratio: 16 / 9;
  touch-action: manipulation;
}

.game-actions {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.game-actions[hidden] {
  display: none;
}

.game-actions button {
  min-width: 70px;
  padding: 0.55rem 0.72rem;
  font-size: 0.88rem;
  background: rgba(5, 6, 13, 0.72);
  backdrop-filter: blur(6px);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: rgba(5, 6, 13, 0.42);
}

.overlay[hidden] {
  display: none;
}

.menu-panel {
  width: min(640px, calc(100vw - 58px));
  max-height: min(86vh, 500px);
  overflow: auto;
  padding: 22px;
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 21, 33, 0.78);
  backdrop-filter: blur(8px);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

.menu-panel[hidden] {
  display: none;
}

.menu-panel h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.15rem, 2.4vw, 1.75rem);
  line-height: 1.04;
  font-weight: 800;
}

.selected-skin {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}

.selected-skin img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.selected-effect {
  grid-template-columns: 84px 1fr;
  border-color: rgba(255, 160, 90, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 149, 56, 0.12), rgba(255, 255, 255, 0.05)),
    rgba(255, 255, 255, 0.06);
}

.selected-background {
  grid-template-columns: 84px 1fr;
  border-color: rgba(125, 247, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(84, 216, 255, 0.14), rgba(255, 255, 255, 0.05)),
    rgba(255, 255, 255, 0.06);
}

.selected-skin span,
.wallet span,
.skin-card span,
.run-summary,
.shop-message {
  color: var(--muted);
  font-size: 0.88rem;
}

.selected-skin strong,
.wallet strong {
  display: block;
  color: var(--text);
  font-size: 1.05rem;
}

.menu-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.effect-shop-spotlight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 160, 90, 0.42);
  border-radius: 8px;
  background:
    radial-gradient(circle at right center, rgba(255, 216, 90, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(242, 90, 36, 0.18), rgba(17, 21, 33, 0.88) 62%);
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(255, 216, 90, 0.08);
}

.effect-shop-spotlight strong {
  display: block;
  font-size: 1.15rem;
  color: #fff4c5;
}

.effect-shop-spotlight small {
  display: block;
  margin-top: 4px;
  color: #ffdcb0;
  font-size: 0.82rem;
}

.effect-shop-button {
  flex: 0 0 auto;
  color: #17140b;
  background: linear-gradient(180deg, #ffd85a, #ff9f1c);
  box-shadow: 0 12px 28px rgba(242, 90, 36, 0.3);
}

.effect-shop-button:hover {
  background: linear-gradient(180deg, #ffe07a, #ffb243);
}

.daily-tasks-panel {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(125, 247, 255, 0.24);
  border-radius: 8px;
  background:
    radial-gradient(circle at left top, rgba(84, 216, 255, 0.12), transparent 32%),
    rgba(255, 255, 255, 0.05);
  text-align: left;
}

.daily-tasks-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.daily-tasks-header strong {
  display: block;
  color: #eefcff;
  font-size: 1rem;
}

.daily-tasks-header small {
  color: #9ef7ff;
  font-size: 0.8rem;
}

.daily-task-list {
  display: grid;
  gap: 10px;
}

.daily-task-item {
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(5, 6, 13, 0.28);
}

.daily-task-item.is-done {
  border-color: rgba(183, 255, 122, 0.42);
  background:
    linear-gradient(180deg, rgba(183, 255, 122, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(5, 6, 13, 0.32);
}

.daily-task-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.daily-task-top strong {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.2;
}

.daily-task-reward {
  flex: 0 0 auto;
  color: #64e8ff;
  font-size: 0.82rem;
  font-weight: 800;
}

.daily-task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.daily-task-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.daily-task-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #54d8ff, #9ef7ff);
}

.daily-task-item.is-done .daily-task-fill {
  background: linear-gradient(90deg, #b7ff7a, #f4ffbc);
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
}

.wallet {
  min-width: 104px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 6, 13, 0.36);
  text-align: right;
}

.wallet strong {
  color: #64e8ff;
}

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

.shop-tab {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  box-shadow: none;
}

.shop-tab:hover {
  background: rgba(255, 255, 255, 0.14);
}

.shop-tab.is-active {
  color: #17140b;
  background: var(--accent);
  border-color: rgba(244, 201, 93, 0.85);
}

.shop-tab-effects {
  border-color: rgba(255, 160, 90, 0.38);
  background:
    linear-gradient(180deg, rgba(242, 90, 36, 0.18), rgba(255, 255, 255, 0.06)),
    rgba(255, 255, 255, 0.08);
}

.shop-tab-effects:hover {
  background:
    linear-gradient(180deg, rgba(255, 130, 66, 0.28), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.12);
}

.shop-tab-effects.is-active {
  color: #17140b;
  background: linear-gradient(180deg, #ffd85a, #ff8a1c);
  border-color: rgba(255, 216, 90, 0.92);
  box-shadow: 0 12px 24px rgba(242, 90, 36, 0.22);
}

.shop-tab-impact {
  border-color: rgba(125, 247, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 0.18), rgba(255, 255, 255, 0.06)),
    rgba(255, 255, 255, 0.08);
}

.shop-tab-impact:hover {
  background:
    linear-gradient(180deg, rgba(125, 247, 255, 0.28), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.12);
}

.shop-tab-impact.is-active {
  color: #07131b;
  background: linear-gradient(180deg, #9ef7ff, #54d8ff);
  border-color: rgba(125, 247, 255, 0.92);
  box-shadow: 0 12px 24px rgba(84, 216, 255, 0.22);
}

.shop-tab-backgrounds {
  border-color: rgba(179, 255, 122, 0.34);
  background:
    linear-gradient(180deg, rgba(125, 247, 255, 0.14), rgba(255, 255, 255, 0.06)),
    rgba(255, 255, 255, 0.08);
}

.shop-tab-backgrounds:hover {
  background:
    linear-gradient(180deg, rgba(183, 255, 122, 0.22), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.12);
}

.shop-tab-backgrounds.is-active {
  color: #07131b;
  background: linear-gradient(180deg, #b7ff7a, #7df7ff);
  border-color: rgba(183, 255, 122, 0.92);
  box-shadow: 0 12px 24px rgba(125, 247, 255, 0.2);
}

.skin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.skin-card {
  min-height: 126px;
  padding: 10px;
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  box-shadow: none;
}

.skin-card:hover {
  background: rgba(255, 255, 255, 0.12);
}

.skin-card img {
  width: 60px;
  height: 60px;
  image-rendering: pixelated;
}

.skin-card strong {
  font-size: 0.88rem;
  line-height: 1.1;
}

.skin-rarity {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.skin-rarity-common {
  color: #e5eef7;
  background: rgba(148, 163, 184, 0.22);
}

.skin-rarity-uncommon {
  color: #dfffbf;
  background: rgba(183, 255, 122, 0.18);
}

.skin-rarity-rare {
  color: #c9f6ff;
  background: rgba(84, 216, 255, 0.18);
}

.skin-rarity-epic {
  color: #ffd6f8;
  background: rgba(255, 79, 216, 0.18);
}

.skin-rarity-legendary {
  color: #fff0b8;
  background: rgba(255, 216, 90, 0.2);
}

.skin-rarity-exotic {
  color: #ffd9c9;
  background: rgba(255, 122, 24, 0.22);
}

.skin-rarity-mythic {
  color: #ffe9f8;
  background: rgba(212, 106, 255, 0.24);
}

.skin-card .effect-preview {
  margin-top: 2px;
}

.skin-card.is-selected {
  border-color: rgba(244, 201, 93, 0.85);
  background: rgba(244, 201, 93, 0.14);
}

.skin-card.is-locked {
  color: var(--muted);
}

.effect-preview {
  --effect-core: #ffd85a;
  --effect-outer: #f25a24;
  --effect-smoke: rgba(60, 53, 49, 0.92);
  position: relative;
  width: 72px;
  height: 72px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.07), transparent 58%),
    linear-gradient(180deg, rgba(14, 16, 27, 0.96), rgba(11, 13, 22, 0.88));
}

.background-preview {
  width: 72px;
  height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, #0d1020, #1f1532);
}

.background-preview svg {
  display: block;
  width: 100%;
  height: 100%;
}

.effect-preview-main {
  width: 72px;
  height: 72px;
}

.effect-preview-large {
  width: 60px;
  height: 60px;
}

.effect-preview__ring,
.effect-preview__ring::after,
.effect-preview__core,
.effect-preview__pixel,
.effect-preview__smoke {
  position: absolute;
  display: block;
}

.effect-preview__ring {
  inset: 10px;
  border: 3px solid var(--effect-outer);
  border-radius: 999px;
  opacity: 0.8;
}

.effect-preview__ring::after {
  content: "";
  inset: -8px;
  border: 2px solid var(--effect-core);
  border-radius: inherit;
  opacity: 0.7;
}

.effect-preview__core {
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  background: var(--effect-core);
  box-shadow:
    0 0 0 4px var(--effect-outer),
    0 0 18px var(--effect-core);
  transform: translate(-50%, -50%) rotate(12deg);
}

.effect-preview__pixel {
  width: 9px;
  height: 9px;
  background: var(--effect-outer);
}

.effect-preview__pixel.is-a {
  top: 12px;
  left: 16px;
}

.effect-preview__pixel.is-b {
  right: 12px;
  top: 22px;
  background: var(--effect-core);
}

.effect-preview__pixel.is-c {
  right: 18px;
  bottom: 14px;
}

.effect-preview__smoke {
  left: 13px;
  bottom: 11px;
  width: 18px;
  height: 18px;
  background: var(--effect-smoke);
  opacity: 0.84;
  filter: blur(1px);
}

.shop-message {
  min-height: 1.2em;
  margin: 0;
}

.run-summary {
  margin: 0;
}

.controls {
  flex-wrap: wrap;
  padding-bottom: 8px;
}

@media (max-width: 640px) {
  .game-shell {
    width: min(100vw - 20px, 1120px);
    padding: 12px 0;
    gap: 10px;
  }

  .topbar {
    align-items: end;
  }

  .hud-stats {
    gap: 6px;
  }

  .scoreboard {
    min-width: 76px;
    padding: 8px 10px;
  }

  .scoreboard strong {
    font-size: 1.6rem;
  }

  .menu-panel {
    width: calc(100vw - 36px);
    padding: 16px;
  }

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

  .panel-heading {
    align-items: stretch;
  }

  .selected-effect {
    grid-template-columns: 72px 1fr;
  }

  .selected-background {
    grid-template-columns: 72px 1fr;
  }

  .effect-shop-spotlight {
    align-items: stretch;
    flex-direction: column;
  }

  .effect-shop-button {
    width: 100%;
  }

  .daily-tasks-header,
  .daily-task-top,
  .daily-task-meta {
    flex-direction: column;
    align-items: start;
  }
}
