:root {
  --bg-deep: #130a31;
  --bg-mid: #2d1e67;
  --surface: rgba(31, 21, 82, 0.84);
  --surface-2: rgba(60, 46, 126, 0.62);
  --border: rgba(136, 214, 255, 0.30);
  --text: #f7f4ff;
  --muted: #cad7ff;
  --accent: #f6c65b;
  --accent-2: #7ddcff;
  --radius: 22px;
  --card-glow: 0 18px 42px rgba(6, 3, 20, 0.42), 0 0 0 1px rgba(136, 214, 255, 0.10);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Lato", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 232, 177, 0.22), transparent 18%),
    radial-gradient(circle at 82% 10%, rgba(125, 220, 255, 0.18), transparent 18%),
    radial-gradient(1200px 520px at 50% -10%, rgba(255, 255, 255, 0.14), transparent 55%),
    linear-gradient(180deg, #5f8cd6 0%, #41318f 32%, var(--bg-mid) 62%, var(--bg-deep) 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  left: -10vw;
  right: -10vw;
  height: 36vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.72;
  filter: blur(18px);
  animation: drift-clouds 22s linear infinite;
}

body::before {
  top: 9vh;
  background:
    radial-gradient(closest-side, rgba(255, 255, 255, 0.26), transparent 72%) 12% 40% / 280px 110px no-repeat,
    radial-gradient(closest-side, rgba(223, 238, 255, 0.18), transparent 72%) 58% 25% / 360px 120px no-repeat,
    radial-gradient(closest-side, rgba(255, 247, 217, 0.20), transparent 72%) 86% 58% / 260px 100px no-repeat;
}

body::after {
  top: 42vh;
  animation-duration: 28s;
  animation-direction: reverse;
  background:
    radial-gradient(closest-side, rgba(255, 255, 255, 0.20), transparent 72%) 30% 50% / 340px 120px no-repeat,
    radial-gradient(closest-side, rgba(125, 220, 255, 0.14), transparent 72%) 72% 36% / 300px 100px no-repeat;
}

.game-top,
.game-notice,
.game-main {
  position: relative;
  z-index: 1;
}

.game-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(136, 214, 255, 0.18);
  background: rgba(16, 10, 45, 0.84);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
}

.game-top::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-2) 35%, var(--accent) 62%, transparent);
}

.back {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 700;
}

.back:hover {
  color: var(--accent);
}

.game-title {
  flex: 1;
  margin: 0;
  font-size: 1.14rem;
  font-weight: 700;
  text-align: center;
  font-family: "Playfair Display", Georgia, serif;
  letter-spacing: 0.02em;
}

.game-notice {
  margin: 0;
  padding: 12px 20px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text);
  text-align: center;
  background: linear-gradient(90deg, rgba(246, 198, 91, 0.18), rgba(125, 220, 255, 0.10));
  border-bottom: 1px solid rgba(136, 214, 255, 0.22);
}

.game-notice strong {
  color: var(--accent);
  font-weight: 700;
}

.game-main {
  max-width: 520px;
  margin: 0 auto;
  padding: 28px 20px 44px;
}

.panel {
  position: relative;
  padding: 30px 24px 24px;
  border-radius: calc(var(--radius) + 4px);
  background:
    linear-gradient(160deg, rgba(33, 22, 87, 0.92), rgba(18, 12, 48, 0.95)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  border: 1px solid rgba(136, 214, 255, 0.22);
  box-shadow: var(--card-glow);
  margin-bottom: 16px;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0.9;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  font-family: "Lato", system-ui, sans-serif;
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #ffe39e, var(--accent) 38%, #cc8f2f 100%);
  color: #281c00;
  width: 100%;
  box-shadow: 0 14px 28px rgba(246, 198, 91, 0.28);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(246, 198, 91, 0.34);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.stat-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.95rem;
  color: var(--muted);
}

.stat-line strong {
  color: var(--accent);
  font-size: 1.1rem;
}

.stat-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--muted);
}

.stat-grid-2 > div {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(136, 214, 255, 0.12);
}

.stat-grid-2 strong {
  color: var(--accent);
  display: block;
  font-size: 1rem;
  margin-top: 4px;
}

@media (max-width: 380px) {
  .stat-grid-2 {
    grid-template-columns: 1fr;
  }
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  width: 100%;
  margin-top: 10px;
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

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

.btn-row .btn-primary {
  flex: 1;
  min-width: 120px;
}

@keyframes pulse-win {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(246, 198, 91, 0.35);
  }
  50% {
    box-shadow: 0 0 30px 8px rgba(125, 220, 255, 0.22);
  }
}

@keyframes drift-clouds {
  from {
    transform: translateX(-3%);
  }
  to {
    transform: translateX(3%);
  }
}

.win-pulse {
  animation: pulse-win 0.95s ease-in-out 2;
}
