:root {
  --bg-deep: #140a08;
  --bg-mid: #3a1a12;
  --surface: rgba(32, 14, 10, 0.92);
  --surface-2: rgba(196, 74, 28, 0.38);
  --border: rgba(255, 120, 50, 0.32);
  --text: #fff5e8;
  --muted: #c9a88a;
  --accent: #f4b942;
  --accent-2: #ff5c2b;
  --radius: 22px;
  --card-glow: 0 18px 42px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(255, 120, 50, 0.12);
}

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

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 140, 60, 0.24), transparent 18%),
    radial-gradient(circle at 82% 10%, rgba(244, 185, 66, 0.18), transparent 18%),
    radial-gradient(1200px 520px at 50% -10%, rgba(255, 92, 43, 0.14), transparent 55%),
    linear-gradient(180deg, #5c1a0e 0%, #c43d1a 28%, 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.68;
  filter: blur(18px);
  animation: ember-drift 22s linear infinite;
}

body::before {
  top: 9vh;
  background:
    radial-gradient(closest-side, rgba(255, 140, 60, 0.26), transparent 72%) 12% 40% / 280px 110px no-repeat,
    radial-gradient(closest-side, rgba(244, 185, 66, 0.20), transparent 72%) 58% 25% / 360px 120px no-repeat,
    radial-gradient(closest-side, rgba(255, 92, 43, 0.18), 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, 200, 87, 0.18), transparent 72%) 30% 50% / 340px 120px no-repeat,
    radial-gradient(closest-side, rgba(255, 92, 43, 0.16), 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(255, 120, 50, 0.22);
  background: rgba(20, 10, 8, 0.94);
  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);
  text-decoration: none;
  font-weight: 700;
}

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

.game-title {
  flex: 1;
  margin: 0;
  font-size: 1.14rem;
  font-weight: 700;
  text-align: center;
  font-family: "Cinzel", 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(255, 92, 43, 0.18), rgba(244, 185, 66, 0.10));
  border-bottom: 1px solid rgba(255, 120, 50, 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(58, 26, 18, 0.96), rgba(20, 10, 8, 0.98)),
    linear-gradient(180deg, rgba(255, 140, 60, 0.04), transparent);
  border: 1px solid rgba(255, 120, 50, 0.24);
  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-2), var(--accent), 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: "DM Sans", system-ui, sans-serif;
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #ffe9a8, var(--accent) 38%, #c97810 100%);
  color: #2a0f08;
  width: 100%;
  box-shadow: 0 14px 28px rgba(255, 92, 43, 0.32);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(255, 92, 43, 0.4);
}

.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(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 120, 50, 0.16);
}

.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(244, 185, 66, 0.35);
  }
  50% {
    box-shadow: 0 0 30px 8px rgba(255, 92, 43, 0.28);
  }
}

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

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