:root {
  --game-stage: #0b1714;
  --game-forest: #1d3a2f;
  --game-lake: #2a6f7a;
  --game-citrus: #f2b705;
  --game-ember: #e36f3c;
  --game-foam: #f7fbfd;
  --game-muted: rgba(247, 251, 253, 0.62);
  --game-glow-lake: rgba(42, 111, 122, 0.55);
  --game-glow-citrus: rgba(242, 183, 5, 0.45);
  --game-glow-ember: rgba(227, 111, 60, 0.5);
  --game-radius: 20px;
  --game-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --game-ease-spin: cubic-bezier(0.12, 0.85, 0.22, 1);
}

.game-ui {
  position: relative;
  min-height: 420px;
  padding: 1.25rem 1rem 1.5rem;
  color: var(--game-foam);
  font-family: var(--font-body, "Figtree", sans-serif);
  background: var(--game-stage);
  overflow: hidden;
}

.game-ui::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 60% at 50% 0%, rgba(42, 111, 122, 0.18), transparent 65%);
  z-index: 0;
}

.game-ui > * {
  position: relative;
  z-index: 1;
}

.game-ui-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.game-ui-thumb {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid rgba(247, 251, 253, 0.2);
  box-shadow: 0 0 18px var(--game-glow-lake);
  flex-shrink: 0;
}

.game-ui-title-block {
  flex: 1;
  min-width: 140px;
}

.game-ui-title {
  font-family: var(--font-display, "Bricolage Grotesque", sans-serif);
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.01em;
}

.game-ui-sub {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--game-muted);
}

.game-meter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(29, 58, 47, 0.85);
  border: 1px solid rgba(242, 183, 5, 0.35);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 0 20px rgba(242, 183, 5, 0.15);
}

.game-meter i {
  color: var(--game-citrus);
}

.game-meter-value {
  font-variant-numeric: tabular-nums;
  min-width: 3.5ch;
  text-align: right;
}

.game-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  margin-bottom: 1rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(42, 111, 122, 0.25);
  border: 1px solid rgba(247, 251, 253, 0.12);
  color: var(--game-muted);
}

.game-badge i {
  color: var(--game-lake);
  font-size: 0.7rem;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 1.1rem;
}

.game-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.25s var(--game-ease), box-shadow 0.25s var(--game-ease), opacity 0.2s, background 0.25s;
  color: var(--game-foam);
}

.game-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.game-btn:not(:disabled):hover {
  transform: translateY(-2px);
}

.game-btn:not(:disabled):active {
  transform: translateY(0);
}

.game-btn-primary {
  background: linear-gradient(135deg, var(--game-citrus) 0%, #d4a004 100%);
  color: #1a1200;
  box-shadow: 0 4px 24px var(--game-glow-citrus);
}

.game-btn-primary:not(:disabled):hover {
  box-shadow: 0 8px 32px var(--game-glow-citrus);
}

.game-btn-secondary {
  background: rgba(42, 111, 122, 0.45);
  border: 1px solid rgba(247, 251, 253, 0.18);
}

.game-btn-secondary:not(:disabled):hover {
  background: rgba(42, 111, 122, 0.65);
  box-shadow: 0 4px 20px var(--game-glow-lake);
}

.game-btn-accent {
  background: linear-gradient(135deg, var(--game-ember) 0%, #c85a2e 100%);
  box-shadow: 0 4px 20px var(--game-glow-ember);
}

.game-status {
  text-align: center;
  min-height: 1.5rem;
  margin-top: 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--game-citrus);
  transition: opacity 0.3s;
}

.game-status.is-neutral {
  color: var(--game-muted);
}

.game-status.is-highlight {
  animation: gamePulse 0.8s var(--game-ease);
}

@keyframes gamePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.92; }
}

.game-ui--revontuli .aurora-bg {
  position: absolute;
  inset: -20% -10%;
  z-index: 0;
  opacity: 0.55;
  background:
    linear-gradient(105deg, transparent 30%, rgba(61, 200, 160, 0.12) 45%, transparent 60%),
    linear-gradient(75deg, transparent 25%, rgba(42, 111, 122, 0.2) 40%, rgba(242, 183, 5, 0.08) 55%, transparent 70%),
    linear-gradient(165deg, transparent 35%, rgba(227, 111, 60, 0.1) 50%, transparent 65%);
  animation: auroraShift 8s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes auroraShift {
  0% { transform: translateX(-3%) skewY(-2deg); filter: hue-rotate(0deg); }
  100% { transform: translateX(3%) skewY(2deg); filter: hue-rotate(15deg); }
}

.reels-machine {
  max-width: 420px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  border-radius: var(--game-radius);
  background: linear-gradient(180deg, rgba(29, 58, 47, 0.9) 0%, rgba(11, 23, 20, 0.95) 100%);
  border: 2px solid rgba(42, 111, 122, 0.4);
  box-shadow:
    inset 0 0 40px rgba(42, 111, 122, 0.12),
    0 0 30px rgba(42, 111, 122, 0.15);
}

.reels-row {
  display: flex;
  gap: 0.55rem;
  justify-content: center;
}

.reel {
  flex: 1;
  max-width: 110px;
}

.reel-window {
  position: relative;
  height: 100px;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(11, 23, 20, 0.85);
  border: 2px solid rgba(247, 251, 253, 0.12);
  box-shadow: inset 0 4px 16px rgba(0, 0, 0, 0.45);
}

.reel-window::before,
.reel-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 28%;
  z-index: 2;
  pointer-events: none;
}

.reel-window::before {
  top: 0;
  background: linear-gradient(180deg, rgba(11, 23, 20, 0.85), transparent);
}

.reel-window::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(11, 23, 20, 0.85), transparent);
}

.reel-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.reel-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  font-size: 2.4rem;
  color: var(--game-foam);
  text-shadow: 0 0 16px rgba(247, 251, 253, 0.35);
}

.reel-symbol.sym-snowflake { color: #b8e4f0; text-shadow: 0 0 20px rgba(184, 228, 240, 0.6); }
.reel-symbol.sym-pine { color: #5cb88a; text-shadow: 0 0 20px rgba(92, 184, 138, 0.5); }
.reel-symbol.sym-wave { color: #4db8c9; text-shadow: 0 0 20px rgba(77, 184, 201, 0.55); }
.reel-symbol.sym-aurora { color: #a8e6cf; text-shadow: 0 0 24px rgba(168, 230, 207, 0.6); }
.reel-symbol.sym-star { color: var(--game-citrus); text-shadow: 0 0 24px var(--game-glow-citrus); }

.reels-machine.is-match {
  animation: reelMatchGlow 1.2s var(--game-ease);
  border-color: var(--game-citrus);
  box-shadow:
    inset 0 0 40px rgba(242, 183, 5, 0.15),
    0 0 40px var(--game-glow-citrus);
}

@keyframes reelMatchGlow {
  0%, 100% { box-shadow: inset 0 0 40px rgba(242, 183, 5, 0.1), 0 0 24px var(--game-glow-citrus); }
  50% { box-shadow: inset 0 0 50px rgba(242, 183, 5, 0.25), 0 0 48px var(--game-glow-citrus); }
}

.reel.is-spinning .reel-strip {
  transition: transform 0.08s linear;
}

.reel.is-stopping .reel-strip {
  transition: transform 0.55s var(--game-ease-spin);
}

.card-table {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1rem 1.25rem;
  border-radius: var(--game-radius);
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(61, 139, 110, 0.15), transparent),
    linear-gradient(165deg, #1a4a38 0%, var(--game-forest) 45%, #153028 100%);
  border: 3px solid rgba(42, 111, 122, 0.5);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.35),
    0 8px 32px rgba(0, 0, 0, 0.4);
}

.card-table::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: calc(var(--game-radius) - 4px);
  border: 1px dashed rgba(247, 251, 253, 0.08);
  pointer-events: none;
}

.card-table {
  position: relative;
}

.card-zone {
  margin-bottom: 1.25rem;
}

.card-zone-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--game-muted);
  margin-bottom: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-zone-label i {
  color: var(--game-lake);
}

.card-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 110px;
  align-items: flex-start;
}

.card-total {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--game-citrus);
}

.card-total.is-hidden {
  visibility: hidden;
}

.playing-card {
  width: 72px;
  height: 100px;
  perspective: 600px;
  flex-shrink: 0;
}

.playing-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s var(--game-ease);
}

.playing-card.is-flipped .playing-card-inner {
  transform: rotateY(180deg);
}

.playing-card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.playing-card-front {
  background: linear-gradient(145deg, #fff 0%, #eef5f8 100%);
  color: var(--game-stage);
  border: 1px solid rgba(19, 32, 25, 0.12);
}

.playing-card-front.is-red {
  color: #c0392b;
}

.playing-card-rank {
  font-size: 1.25rem;
  line-height: 1;
}

.playing-card-suit {
  font-size: 1.5rem;
  margin-top: 0.15rem;
}

.playing-card-back {
  background: linear-gradient(135deg, var(--game-lake) 0%, var(--game-forest) 100%);
  border: 2px solid rgba(247, 251, 253, 0.2);
  transform: rotateY(180deg);
}

.playing-card-back i {
  font-size: 1.6rem;
  color: rgba(247, 251, 253, 0.5);
}

.wheel-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 520px;
  margin: 0 auto;
}

.wheel-arena {
  position: relative;
  width: min(280px, 78vw);
  height: min(280px, 78vw);
}

.wheel-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 22px solid var(--game-citrus);
  filter: drop-shadow(0 0 8px var(--game-glow-citrus));
}

.wheel-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px solid rgba(42, 111, 122, 0.6);
  box-shadow:
    0 0 30px var(--game-glow-lake),
    inset 0 0 20px rgba(42, 111, 122, 0.2);
  pointer-events: none;
  z-index: 3;
}

.wheel-disk {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transition: transform 4.5s var(--game-ease-spin);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
  position: relative;
}

.wheel-labels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wheel-disk.is-spinning {
  transition: transform 4.5s cubic-bezier(0.15, 0.82, 0.18, 1);
}

.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--game-forest), var(--game-stage));
  border: 3px solid var(--game-citrus);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(242, 183, 5, 0.3);
}

.wheel-center i {
  color: var(--game-citrus);
  font-size: 1rem;
}

.wheel-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: visible;
}

.wheel-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--game-citrus);
  opacity: 0;
  animation: particleBurst 0.9s var(--game-ease) forwards;
}

@keyframes particleBurst {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--px), var(--py)) scale(0); }
}

.wheel-selection {
  width: 100%;
}

.wheel-selection-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--game-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
  text-align: center;
}

.wheel-color-zones {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.wheel-zone-btn {
  flex: 1;
  min-width: 90px;
  max-width: 140px;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(29, 58, 47, 0.6);
  color: var(--game-foam);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.wheel-zone-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.wheel-zone-btn.is-selected {
  border-color: var(--game-citrus);
  box-shadow: 0 0 16px var(--game-glow-citrus);
}

.wheel-zone-btn[data-zone="jarvi"] .zone-dot { background: var(--game-lake); }
.wheel-zone-btn[data-zone="meta"] .zone-dot { background: #3d8b6e; }
.wheel-zone-btn[data-zone="tuli"] .zone-dot { background: var(--game-ember); }

.zone-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.wheel-numbers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  max-width: 360px;
  margin: 0 auto;
}

.wheel-num-btn {
  aspect-ratio: 1;
  border: 1px solid rgba(247, 251, 253, 0.15);
  border-radius: 8px;
  background: rgba(11, 23, 20, 0.7);
  color: var(--game-foam);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.wheel-num-btn:hover:not(:disabled) {
  background: rgba(42, 111, 122, 0.35);
}

.wheel-num-btn.is-selected {
  border-color: var(--game-citrus);
  background: rgba(242, 183, 5, 0.2);
  box-shadow: 0 0 12px var(--game-glow-citrus);
}

.wheel-num-btn[data-color="forest"] { border-left: 3px solid var(--game-forest); }
.wheel-num-btn[data-color="lake"] { border-left: 3px solid var(--game-lake); }
.wheel-num-btn[data-color="ember"] { border-left: 3px solid var(--game-ember); }

.wheel-result-glow {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  box-shadow: 0 0 60px var(--game-glow-citrus);
}

.wheel-result-glow.is-active {
  opacity: 1;
  animation: wheelResultPulse 1.5s ease-in-out infinite alternate;
}

@keyframes wheelResultPulse {
  0% { box-shadow: 0 0 40px var(--game-glow-citrus); }
  100% { box-shadow: 0 0 70px var(--game-glow-lake); }
}

@media (min-width: 480px) {
  .game-ui {
    padding: 1.5rem 1.5rem 1.75rem;
  }

  .game-ui-title {
    font-size: 1.3rem;
  }

  .reel-window {
    height: 110px;
  }

  .reel-symbol {
    height: 110px;
    font-size: 2.6rem;
  }

  .playing-card {
    width: 80px;
    height: 112px;
  }

  .wheel-arena {
    width: min(320px, 72vw);
    height: min(320px, 72vw);
  }
}

@media (max-width: 380px) {
  .game-ui-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .game-meter {
    width: 100%;
    justify-content: center;
  }

  .wheel-numbers {
    grid-template-columns: repeat(5, 1fr);
  }

  .game-btn {
    flex: 1;
    min-width: calc(50% - 0.3rem);
  }
}
