:root {
  --bg: #080b13;
  --bg-alt: #0e1320;
  --surface: #151c2b;
  --raised: #1e2739;
  --border: #2b3650;
  --text: #f6f8fd;
  --muted: #9faac4;
  --dim: #68738e;
  --accent: #ffc53d;
  --accent-text: #1a1406;
  --good: #2f8cff;
  --bad: #ff7a1a;
  --danger: #ff4d5e;
  --success: #3ddc84;
  --coin: #ffd447;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -200px, #16203a 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font:
    16px/1.55 system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
}

header.top .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0.5px;
}

header.top .brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

header.top nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 18px;
  font-weight: 600;
}

header.top nav a:hover {
  color: var(--text);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 24px 0 48px;
}

.hero h1 {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  margin: 0 0 14px;
  letter-spacing: -1px;
}

.hero h1 span {
  color: var(--accent);
}

.hero p.lede {
  color: var(--muted);
  font-size: 18px;
  margin: 0 0 24px;
}

.hero .logo {
  width: min(100%, 460px);
  height: auto;
  margin-bottom: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--raised);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  font-size: 16px;
}

.btn.primary {
  background: linear-gradient(180deg, #ffd86a 0%, var(--accent) 60%, #e3a71f 100%);
  color: var(--accent-text);
  border-color: #f0b93a;
  box-shadow: 0 6px 24px rgba(255, 197, 61, 0.35);
}

.btn.ghost {
  background: transparent;
}

.btn[aria-disabled='true'] {
  opacity: 0.55;
  cursor: default;
}

/* ---------------------------------------------------------------- game frame */
.frame-wrap {
  display: flex;
  justify-content: center;
}

#frame {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 9 / 16;
  border-radius: 28px;
  overflow: hidden;
  background: #d3e6f4;
  border: 6px solid #1b2234;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  touch-action: none;
  user-select: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-weight: 900;
}

.hud .bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.hud .bar .cell {
  background: rgba(8, 11, 19, 0.55);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 15px;
  line-height: 1.2;
}

.hud .bar small {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 700;
}

#hud-multiplier {
  color: var(--accent);
  margin-left: 6px;
}

#hud-coins {
  color: var(--coin);
}

#boss {
  position: absolute;
  top: 62px;
  left: 14px;
  right: 14px;
  background: rgba(8, 11, 19, 0.55);
  border-radius: 10px;
  padding: 6px 10px 8px;
  color: #fff;
  font-size: 12px;
  letter-spacing: 1px;
}

#boss .track {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  margin-top: 4px;
  overflow: hidden;
}

#boss-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff4d5e, #ff7a1a);
  transition: width 0.1s linear;
}

#banner {
  position: absolute;
  top: 34%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 30px;
  letter-spacing: 2px;
  color: #fff;
  text-shadow:
    0 3px 0 rgba(8, 11, 19, 0.9),
    0 0 24px rgba(0, 0, 0, 0.6);
  animation: bannerIn 0.25s ease-out;
}

#banner[data-tone='danger'] {
  color: var(--danger);
}

#banner[data-tone='good'] {
  color: var(--success);
}

@keyframes bannerIn {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#btn-airstrike {
  position: absolute;
  right: 12px;
  bottom: 14px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(8, 11, 19, 0.6);
  color: var(--accent);
  font-size: 24px;
  pointer-events: auto;
  display: none;
}

#frame.playing #btn-airstrike {
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px;
  text-align: center;
  background: rgba(5, 7, 12, 0.78);
  color: var(--text);
  pointer-events: auto;
}

.overlay[hidden] {
  display: none;
}

.overlay h2 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.5px;
}

.overlay p {
  margin: 0;
  color: var(--muted);
}

.overlay .stats {
  width: 100%;
  max-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
}

.overlay .stats .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.overlay .stats .row span {
  color: var(--muted);
}

.countdown {
  font-size: 52px;
  color: var(--accent);
  line-height: 1;
}

.hint {
  color: var(--dim);
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
}

/* ---------------------------------------------------------------- sections */
section.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 24px 0 48px;
}

section.features article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}

section.features h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

section.features p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 40px;
  color: var(--dim);
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  justify-content: space-between;
}

footer a {
  color: var(--muted);
  text-decoration: none;
  margin-right: 18px;
}

/* ---------------------------------------------------------------- documents */
.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 20px 60px;
}

.doc h1 {
  font-size: 36px;
  letter-spacing: -0.5px;
  margin: 10px 0 6px;
}

.doc h2 {
  font-size: 22px;
  margin: 34px 0 10px;
}

.doc h3 {
  font-size: 18px;
  margin: 24px 0 8px;
}

.doc p,
.doc li {
  color: #d5dbe8;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 12px 0 18px;
}

.doc th,
.doc td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.doc th {
  background: var(--surface);
}

.doc hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.doc code {
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.92em;
}

.doc .meta {
  color: var(--muted);
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 8px;
  }
  header.top nav a {
    margin-left: 12px;
  }
}
