:root {
  --bg0: #0b0f17;
  --bg1: #0f1726;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.10);
  --stroke: rgba(255, 255, 255, 0.16);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --brand: #ffb703;
  --brand2: #fb5607;
  --good: #2a9d8f;
  --bad: #e63946;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 20% 10%, rgba(251, 86, 7, 0.22), transparent 60%),
    radial-gradient(900px 500px at 85% 35%, rgba(255, 183, 3, 0.18), transparent 60%),
    radial-gradient(900px 700px at 40% 95%, rgba(42, 157, 143, 0.18), transparent 55%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke);
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(10px);
}

.back {
  text-decoration: none;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}
.back:hover { background: rgba(255,255,255,0.07); }

.title { flex: 1; min-width: 0; }
.kicker {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.topbar h1 {
  margin: 2px 0 0 0;
  font-size: 20px;
}

.top-actions { display: flex; gap: 10px; }
button {
  font: inherit;
  color: var(--text);
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.05);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
}
button:hover { background: rgba(255,255,255,0.09); }
button.primary {
  border-color: rgba(255, 183, 3, 0.55);
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.95), rgba(251, 86, 7, 0.85));
  color: rgba(10, 10, 10, 0.92);
  font-weight: 700;
}

.main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  padding: 16px;
  align-items: start;
}

.stage {
  position: relative;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.03);
  box-shadow: var(--shadow);
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.hud {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(600px 300px at 50% 40%, rgba(0,0,0,0.60), rgba(0,0,0,0.30));
}

.hud-card {
  width: min(520px, 100%);
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: rgba(18, 22, 33, 0.82);
  box-shadow: 0 30px 90px rgba(0,0,0,0.65);
  padding: 18px;
  text-align: center;
}
.hud-title { font-size: 22px; font-weight: 800; }
.hud-sub { margin-top: 6px; color: var(--muted); }
.hud-actions { margin-top: 14px; display: flex; justify-content: center; gap: 10px; }
.hud-tip { margin-top: 14px; color: var(--muted); font-size: 13px; }

.panel {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-block {
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  padding: 14px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  padding: 12px;
}
.stat .label { color: var(--muted); font-size: 12px; letter-spacing: 0.05em; }
.stat .value { margin-top: 4px; font-size: 22px; font-weight: 800; }

.panel h2 { margin: 0 0 10px 0; font-size: 14px; color: rgba(255,255,255,0.86); letter-spacing: 0.03em; }

.kbd { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
.key {
  display: inline-block;
  padding: 3px 8px;
  margin-right: 6px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.90);
  font-size: 12px;
}

.footer {
  padding: 10px 16px 16px 16px;
  color: var(--muted);
  font-size: 13px;
}

.muted { color: var(--muted); margin: 0; line-height: 1.5; }

@media (max-width: 980px) {
  .main { grid-template-columns: 1fr; }
  .panel { position: static; }
}
