:root {
  --ink: #0e141c;
  --fog: #d7e0ea;
  --steel: #3db8ff;
  --ember: #ff8a3d;
  --moss: #b7f547;
  --gold: #c9a227;
  --panel: rgba(20, 28, 38, 0.88);
  --font: "Space Grotesk", "Segoe UI", sans-serif;
  --display: "Bebas Neue", Impact, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--fog);
  background:
    radial-gradient(ellipse 70% 50% at 20% -10%, rgba(61,184,255,.18), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(255,138,61,.12), transparent 50%),
    #0e141c;
  line-height: 1.4;
}

.app { min-height: 100%; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: var(--panel);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  font-family: var(--display);
  letter-spacing: .12em;
  font-size: 1.35rem;
  text-decoration: none;
  color: var(--fog);
}
.brand span { color: var(--steel); margin-left: .25rem; }
.top-actions { margin-left: auto; display: flex; gap: .4rem; }

.btn {
  appearance: none; border: 0;
  background: var(--steel); color: #0e141c;
  font: inherit; font-weight: 700;
  padding: .55rem 1rem; border-radius: 999px; cursor: pointer;
}
.btn-ghost {
  background: transparent; color: var(--fog);
  border: 1px solid rgba(255,255,255,.18);
}
.btn-ember { background: var(--ember); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }

.screen { display: none; flex: 1; padding: 1.1rem 1rem 1.5rem; width: min(520px, 100%); margin: 0 auto; }
.screen.active { display: block; }
#screen-play.active { display: flex; flex-direction: column; width: min(460px, 100%); }

.hero-title {
  font-family: var(--display);
  font-size: clamp(2.4rem, 10vw, 3.4rem);
  letter-spacing: .06em;
  margin: .2rem 0;
  line-height: 1;
}
.lede { color: rgba(215,224,234,.75); margin-bottom: 1.2rem; max-width: 28rem; }

.setup-grid { display: grid; gap: .75rem; margin-bottom: 1rem; }
.panel {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: .9rem 1rem;
}
.panel h3 {
  margin: 0 0 .55rem;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(215,224,234,.55);
}
.choices { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  border: 1px solid rgba(255,255,255,.14);
  background: transparent;
  color: var(--fog);
  padding: .4rem .75rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.chip.on { background: var(--steel); color: #0e141c; border-color: var(--steel); }

.rules { margin: 0; padding-left: 1.1rem; color: rgba(215,224,234,.7); font-size: .9rem; }
.rules li { margin: .2rem 0; }
.keys { font-size: .82rem; color: rgba(215,224,234,.55); margin-top: .6rem; }

.hud {
  display: flex; flex-wrap: wrap; gap: .5rem 1rem;
  align-items: center;
  margin-bottom: .6rem;
  font-size: .9rem;
}
.hud strong { color: var(--moss); }
.hud-msg { flex: 1 1 100%; opacity: .8; font-size: .82rem; }

.stage {
  position: relative;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
#game { display: block; width: 100%; height: auto; touch-action: none; background: #1a2230; }

.touch {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .45rem;
  margin-top: .75rem;
}
.touch button {
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: var(--fog);
  font: inherit;
  font-weight: 800;
  font-size: 1.1rem;
  touch-action: none;
  user-select: none;
}
.touch button:active,
.touch button.pressed { background: rgba(61,184,255,.35); }
.touch-p2 { margin-top: .4rem; opacity: .85; }
.touch-p2 button { background: rgba(255,138,61,.15); }

.overlay {
  position: fixed; inset: 0;
  background: rgba(8,12,18,.78);
  display: none; align-items: center; justify-content: center;
  padding: 1rem; z-index: 40;
}
.overlay.show { display: flex; }
.modal {
  background: #172231;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 1.4rem;
  width: min(380px, 100%);
  text-align: center;
}
.modal h2 { font-family: var(--display); letter-spacing: .06em; font-size: 2rem; margin: 0 0 .4rem; }
.modal p { color: rgba(215,224,234,.7); }

@media (min-width: 700px) {
  .touch { max-width: 390px; margin-left: auto; margin-right: auto; }
}
