:root {
  --bg-top: #ffb168;
  --bg-bottom: #ff5e73;
  --panel: rgba(34, 17, 29, 0.82);
  --panel-strong: rgba(63, 22, 40, 0.94);
  --panel-border: rgba(255, 243, 198, 0.34);
  --text-main: #fff6e9;
  --text-dim: #f5d5c0;
  --accent: #7bf2d7;
  --accent-warm: #ffd451;
  --accent-hot: #ff8e6f;
  --danger: #ff496c;
  --shadow: rgba(49, 12, 31, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(255, 240, 173, 0.48), transparent 38%),
    radial-gradient(circle at bottom, rgba(82, 228, 197, 0.16), transparent 45%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text-main);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body {
  overflow: hidden;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: crosshair;
}

body.playing #game {
  cursor: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(54, 17, 34, 0.08), rgba(54, 17, 34, 0.78)),
    repeating-linear-gradient(
      125deg,
      rgba(255, 255, 255, 0.02) 0 16px,
      rgba(255, 255, 255, 0) 16px 44px
    ),
    radial-gradient(circle at top, rgba(255, 247, 176, 0.24), transparent 36%),
    linear-gradient(135deg, rgba(111, 242, 215, 0.08), rgba(255, 212, 81, 0.08));
}

.overlay[hidden] {
  display: none;
}

.overlay-card {
  position: relative;
  width: min(920px, 100%);
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--panel-border);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(79, 28, 49, 0.98), rgba(34, 10, 24, 0.92)),
    radial-gradient(circle at top right, rgba(255, 212, 81, 0.14), transparent 30%),
    rgba(34, 10, 24, 0.92);
  box-shadow:
    0 28px 70px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.overlay-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 14% 20%, rgba(123, 242, 215, 0.12), transparent 22%),
    radial-gradient(circle at 86% 84%, rgba(255, 142, 111, 0.14), transparent 26%);
  pointer-events: none;
}

.overlay-card::after {
  content: "";
  position: absolute;
  right: -58px;
  top: 42px;
  width: 190px;
  height: 58px;
  transform: rotate(16deg);
  background: linear-gradient(135deg, rgba(255, 212, 81, 0.95), rgba(255, 248, 218, 0.95));
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.overlay-topline,
.overlay-grid {
  position: relative;
  z-index: 1;
}

.overlay-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.92rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.overlay-stamp {
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 212, 81, 0.14);
  color: #fff1c3;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.overlay-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(240px, 0.95fr);
  gap: clamp(18px, 3vw, 30px);
  align-items: start;
}

#overlay-title {
  margin: 0 0 14px;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.3rem, 6vw, 5rem);
  line-height: 0.88;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  max-width: 12ch;
  text-wrap: balance;
}

.overlay-copy {
  margin: 0;
  color: var(--text-dim);
  font-size: clamp(1rem, 2vw, 1.14rem);
  line-height: 1.7;
  max-width: 52ch;
}

.overlay-actions {
  margin-top: 26px;
}

.overlay-actions button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  min-width: 180px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #371425;
  background:
    linear-gradient(135deg, var(--accent-warm), #fff3c8);
  box-shadow:
    0 10px 30px rgba(255, 212, 81, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.overlay-actions button:hover:not(:disabled),
.overlay-actions button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 12px 34px rgba(255, 212, 81, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.overlay-actions button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

.overlay-actions button:disabled {
  opacity: 0.58;
  cursor: progress;
}

.overlay-controls {
  margin: 20px 0 0;
  color: #f0c8a8;
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 54ch;
}

.overlay-side {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(255, 244, 206, 0.16);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(18, 7, 16, 0.26);
}

.side-label {
  margin: 0;
  color: #fff1c3;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.overlay-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.overlay-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(123, 242, 215, 0.1);
  border: 1px solid rgba(123, 242, 215, 0.18);
  color: #eafff7;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.overlay-facts {
  display: grid;
  gap: 12px;
}

.overlay-fact {
  display: grid;
  gap: 4px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.overlay-fact strong {
  color: #fff3cf;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.overlay-fact span {
  color: #f3d5bc;
  font-size: 0.95rem;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .overlay {
    padding: 16px;
  }

  .overlay-card {
    border-radius: 22px;
  }

  .overlay-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .overlay-grid {
    grid-template-columns: 1fr;
  }

  #overlay-title {
    max-width: none;
  }

  .overlay-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .overlay-actions button {
    transition: none;
  }

  .overlay-card::after {
    display: none;
  }
}
