:root {
  color-scheme: dark;
  --bg-1: #07111d;
  --bg-2: #11192b;
  --panel: rgba(12, 20, 35, 0.82);
  --panel-border: rgba(255, 255, 255, 0.14);
  --text: #f3f7ff;
  --muted: #b0bfd8;
  --accent: #f4d06f;
  --accent-strong: #ffca3a;
  --danger: #ff7676;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 202, 58, 0.16), transparent 26%),
    radial-gradient(circle at 80% 12%, rgba(105, 163, 255, 0.18), transparent 30%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.app-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.stage {
  position: relative;
  width: min(1280px, 100%);
  aspect-ratio: 16 / 9;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  box-shadow: var(--shadow);
}

.hud {
  position: absolute;
  inset: 16px 16px auto 16px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(14px);
}

.hud > div {
  min-width: 84px;
}

.label {
  margin: 0 0 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.value {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.value-small {
  font-size: 1.02rem;
  line-height: 1.35;
  padding-top: 3px;
}

.hud-actions {
  display: flex;
  gap: 10px;
}

.button {
  appearance: none;
  border: 1px solid rgba(244, 208, 111, 0.28);
  background: linear-gradient(180deg, rgba(244, 208, 111, 0.24), rgba(255, 202, 58, 0.12));
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: rgba(244, 208, 111, 0.52);
  filter: brightness(1.05);
}

.button:active {
  transform: translateY(0);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.win-modal {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(4, 10, 18, 0.52);
  backdrop-filter: blur(10px);
}

.win-card {
  width: min(520px, calc(100% - 32px));
  padding: 28px 30px 26px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(17, 27, 42, 0.96), rgba(8, 14, 24, 0.92));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.win-eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 800;
  font-size: 0.8rem;
}

.win-card h1 {
  margin: 0 0 10px;
  font-size: 2rem;
}

.win-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.hidden {
  display: none;
}

.overlay {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 2;
  max-width: 520px;
  padding: 18px 20px;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(8, 17, 29, 0.82), rgba(8, 17, 29, 0.46));
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.overlay h1 {
  margin: 0 0 8px;
  font-size: 1.55rem;
}

.overlay p {
  margin: 0 0 8px;
  line-height: 1.55;
  color: var(--muted);
}

.overlay .hint {
  margin-bottom: 0;
  color: var(--accent);
  font-weight: 700;
}

kbd {
  display: inline-block;
  padding: 0.08rem 0.42rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 0.9em;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}

@media (max-width: 900px) {
  .stage {
    aspect-ratio: auto;
    min-height: 84vh;
  }

  .hud {
    flex-wrap: wrap;
  }

  .overlay {
    max-width: none;
    right: 16px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px;
  }

  .hud {
    inset: 12px 12px auto 12px;
  }

  .overlay {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}
