:root {
  --phoenix-hall: #240718;
  --phoenix-glass: #3a091c;
  --phoenix-glass-light: #561124;
  --phoenix-plate: #633217;
  --phoenix-ruby: #b91734;
  --phoenix-ember: #ec761e;
  --phoenix-gold: #f3cb49;
  --phoenix-glow: #cf548b;
  --phoenix-veil: #160512eb;
  --phoenix-ember-air: #f388285c;
  --phoenix-star-light: #ffe7b8;
  --phoenix-go-light: #79ed8d;
  --phoenix-go: #28a34b;
  --phoenix-go-deep: #124b28;
}
.app.phoenix {
  --reel-frame: url("../art/kits/phoenix/frame.webp");
  --phoenix-rows: var(--reel-rows, 3);
  --cell: calc((min(100vw, 520px) - 90px) / 5);
  --phoenix-cell-height: min(var(--cell), calc((var(--cabinet-height) - var(--safe-top) - var(--safe-bottom) - 410px) / var(--phoenix-rows)));
}
.app.phoenix::before {
  background: radial-gradient(ellipse at 50% 24%, var(--phoenix-ember-air), transparent 62%), linear-gradient(var(--phoenix-hall), var(--phoenix-glass) 52%, var(--bg-deep));
}
.phoenix .grid { background: linear-gradient(180deg, var(--phoenix-glass), var(--bg-deep)); }
.phoenix .grid.phoenix-expand { animation: phoenix-grid-expand 520ms cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes phoenix-grid-expand { 0% { transform: scaleY(0.86); transform-origin: bottom center; filter: brightness(1.3); } 55% { transform: scaleY(1.03); transform-origin: bottom center; filter: brightness(1.16); } 100% { transform: scaleY(1); transform-origin: bottom center; filter: brightness(1); } }
.phoenix .reel { height: calc(var(--phoenix-cell-height) * var(--phoenix-rows)); background: linear-gradient(var(--phoenix-glass), var(--phoenix-glass-light) 50%, var(--phoenix-glass)); transition: height 280ms cubic-bezier(0.22, 0.85, 0.3, 1); }
.phoenix .cell { height: var(--phoenix-cell-height); }
.phoenix .cell.letter { font-size: calc(var(--phoenix-cell-height) * 0.7); }
.phoenix .sym-img { max-height: calc(var(--phoenix-cell-height) * 0.9); }
.app.phoenix .win-plate { max-width: calc(100% + 36px); letter-spacing: 0.05em; }
.app.phoenix[data-phoenix-rows="4"] .grid { box-shadow: 0 0 14px rgba(236, 118, 30, 0.45), inset 0 0 12px rgba(243, 203, 73, 0.18); }
.app.phoenix[data-phoenix-rows="5"] .grid { box-shadow: 0 0 20px rgba(236, 118, 30, 0.62), inset 0 0 16px rgba(243, 203, 73, 0.28); }
.app.phoenix[data-phoenix-rows="6"] .grid { box-shadow: 0 0 26px rgba(243, 203, 73, 0.78), 0 0 14px rgba(185, 23, 52, 0.65), inset 0 0 20px rgba(255, 224, 112, 0.34); }
.app.phoenix[data-phoenix-rows="5"] .phoenix-gold-tag, .app.phoenix[data-phoenix-rows="5"] .phoenix-gong-tag,
.app.phoenix[data-phoenix-rows="6"] .phoenix-gold-tag, .app.phoenix[data-phoenix-rows="6"] .phoenix-gong-tag { padding: 0 3px; line-height: 1; bottom: 1px; }
.phoenix .cell.is-gold::before {
  border-color: var(--phoenix-gold);
  background: radial-gradient(ellipse at 50% 35%, rgba(255, 212, 82, 0.5), transparent 76%), linear-gradient(145deg, #683b07, #2b1204);
  box-shadow: inset 0 0 0 1px #ffdf72, inset 0 0 10px rgba(255, 200, 56, 0.45);
}
.phoenix .cell.is-gold.gold-wash { animation: phoenix-gold-wash 620ms ease-out; }
@keyframes phoenix-gold-wash { 0% { filter: brightness(1); } 35% { filter: brightness(1.65) saturate(1.45); transform: scale(1.06); } 100% { filter: brightness(1); transform: scale(1); } }
.phoenix .cell.is-regular .sym-img { filter: saturate(0.55) brightness(0.86); }
.phoenix .cell.is-gold .sym-img { filter: saturate(1.2) brightness(1.08) drop-shadow(0 0 4px rgba(255, 212, 82, 0.65)); }
.phoenix-gold-tag, .phoenix-gong-tag {
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); padding: 0 5px; border-radius: 4px;
  font-family: var(--display); font-size: 11px; line-height: 1.05; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; pointer-events: none;
}
.phoenix-gold-tag { background: linear-gradient(180deg, #ffe98a, #c78112); border: 1px solid var(--gold-deep); color: var(--gold-deep); }
.phoenix-gong-tag { background: linear-gradient(180deg, var(--phoenix-ruby), #520918); border: 1px solid var(--gold); color: var(--text); text-shadow: 0 1px 0 #000; }
.phoenix-sign {
  flex: 1; min-height: 138px; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch;
  gap: 4px; position: relative; margin: 5px 0 22px; container: phoenix-sign / size;
}
.phoenix-sign[hidden] { display: none; }
.phoenix-scene {
  position: absolute; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; border-radius: var(--radius);
  background: var(--phoenix-hall); mask-image: linear-gradient(#000 82%, transparent); -webkit-mask-image: linear-gradient(#000 82%, transparent);
}
.phoenix-depth { position: absolute; inset: calc(var(--parallax-bleed) * -1); }
.phoenix-scene-art { position: absolute; inset: calc(var(--parallax-bleed) - var(--parallax-reach)); background: center / cover no-repeat; }
.phoenix-scene-far { background-image: url("../art/kits/phoenix/scene.webp"); }
.phoenix-scene-mid { background-image: url("../art/scene-layers/phoenix/mid.webp"); }
.phoenix-scene-frame { background-image: url("../art/scene-layers/phoenix/frame.webp"); }
.phoenix-scene-glow {
  position: absolute; width: 112%; height: 68%; top: -8%; left: -18%;
  background: radial-gradient(ellipse, var(--phoenix-ember-air), transparent 68%); opacity: 0.65; animation: phoenix-ember-air 13s ease-in-out infinite alternate;
}
.phoenix-sign.free .phoenix-scene-glow {
  opacity: 0.92;
  background: radial-gradient(ellipse, rgba(243, 203, 73, 0.54), rgba(185, 23, 52, 0.3) 54%, transparent 74%);
}
.phoenix-sign.free .phoenix-ember { opacity: 0.9; }
.phoenix-sign.free .phoenix-title { filter: drop-shadow(0 0 8px rgba(243, 203, 73, 0.75)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85)); }
.phoenix-sign.free .phoenix-status {
  border-color: var(--phoenix-gold);
  background: linear-gradient(180deg, #8b1c2a, #3a0815);
  color: var(--gold-light);
  box-shadow: 0 0 10px rgba(243, 203, 73, 0.45);
}
.app.phoenix[data-phoenix-gold="5"] .phoenix-scene-glow { opacity: 0.82; }
.phoenix-scene-stars {
  position: absolute; inset: 0 0 48%; opacity: 0.55; animation: phoenix-star-air 8s ease-in-out infinite alternate;
  background:
    radial-gradient(circle at 18% 26%, var(--phoenix-star-light) 0 1px, transparent 1.7px),
    radial-gradient(circle at 74% 16%, var(--phoenix-star-light) 0 0.9px, transparent 1.5px),
    radial-gradient(circle at 86% 42%, var(--phoenix-star-light) 0 1.1px, transparent 1.8px),
    radial-gradient(circle at 32% 14%, var(--phoenix-star-light) 0 0.8px, transparent 1.4px);
}
.phoenix-ember {
  --loop-tile: url("../art/scene-loops/phoenix-ember-tile.webp");
  --loop-tile-w: 192px; --loop-tile-h: 64px; --loop-period: 20s;
  --loop-mask: linear-gradient(transparent 34%, #000 48%, #000 72%, transparent 88%);
  opacity: 0.58;
}
@keyframes phoenix-ember-air { from { transform: translateX(-3%) rotate(-3deg); opacity: 0.45; } to { transform: translateX(14%) rotate(4deg); opacity: 0.8; } }
@keyframes phoenix-star-air { from { opacity: 0.3; } to { opacity: 0.72; } }
body.scene-motion-paused .phoenix-scene-glow, body.scene-motion-paused .phoenix-scene-stars,
.phoenix-sign[hidden] .phoenix-scene-glow, .phoenix-sign[hidden] .phoenix-scene-stars { animation-play-state: paused; }
.phoenix-title {
  font-family: var(--display); font-size: 20px; line-height: 1.05; letter-spacing: 0.05em; text-align: center; text-transform: uppercase;
  background: var(--gold-bevel); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 var(--gold-deep)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85));
}
.phoenix-jackpots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.phoenix-jackpot {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0;
  padding: 10px 4px; border-radius: 6px; border: 2px solid var(--gold);
  background: linear-gradient(180deg, var(--phoenix-glass-light), var(--phoenix-hall));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 2px 6px rgba(0, 0, 0, 0.5); transition: opacity 180ms ease;
}
.phoenix-jackpot.grand { border-color: var(--jp-grand); }
.phoenix-jackpot.major { border-color: var(--jp-major); }
.phoenix-jackpot.minor { border-color: var(--jp-minor); }
.phoenix-jackpot.mini { border-color: var(--jp-mini); }
.phoenix-jackpot.locked { opacity: 0.58; filter: grayscale(0.35); }
.phoenix-jackpot.flare { animation: phoenix-flare 650ms ease-out; }
.phoenix-jackpot.unlock-burst { animation: phoenix-unlock-burst 680ms cubic-bezier(0.2, 0.88, 0.3, 1); }
@keyframes phoenix-flare { 0%, 100% { scale: 1; } 40% { scale: 1.08; } }
@keyframes phoenix-unlock-burst {
  0% { transform: scale(0.94); box-shadow: 0 0 0 0 rgba(255, 224, 112, 0.85); }
  45% { transform: scale(1.09); box-shadow: 0 0 18px 4px rgba(255, 224, 112, 0.82); filter: brightness(1.35); }
  100% { transform: scale(1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 2px 6px rgba(0, 0, 0, 0.5); filter: brightness(1); }
}
.phoenix-jackpot-name { font-family: var(--display); font-size: 12px; line-height: 1; letter-spacing: 0.04em; text-shadow: var(--jp-outline); display: inline-flex; align-items: center; justify-content: center; flex-wrap: nowrap; max-width: 100%; }
.phoenix-jackpot.grand .phoenix-jackpot-name { color: var(--jp-grand); }
.phoenix-jackpot.major .phoenix-jackpot-name { color: var(--jp-major); }
.phoenix-jackpot.minor .phoenix-jackpot-name { color: var(--jp-minor); }
.phoenix-jackpot.mini .phoenix-jackpot-name { color: var(--jp-mini); }
.phoenix-jackpot-value {
  max-width: 100%; overflow: hidden; font-family: var(--display); font-size: var(--type-readout); line-height: 1.08;
  font-variant-numeric: tabular-nums; color: var(--gold-light); text-shadow: 0 1px 0 #000; white-space: nowrap;
}
.phoenix-jackpot.grand .phoenix-jackpot-value { font-size: var(--type-lead); }
.phoenix-jackpot-lock { font-family: var(--display); font-size: 11px; line-height: 1; letter-spacing: 0.04em; color: var(--text); text-shadow: 0 1px 0 #000; }
.phoenix-jackpot-lock:empty { display: none; }
.phoenix-pot {
  position: relative; align-self: center; width: 68px; height: 58px; display: flex; align-items: center; justify-content: center; transition: transform 220ms ease;
}
@container phoenix-sign (max-height: 225px) { .phoenix-pot { width: 50px; height: 42px; } .phoenix-jackpot { padding: 7px 4px; } }
.phoenix-pot-img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.7)); }
.phoenix-pot.stage-1 { transform: scale(1.04); }
.phoenix-pot.stage-2 { transform: scale(1.09); }
.phoenix-pot.stage-3 { transform: scale(1.14); }
.phoenix-pot.rattle { animation: phoenix-pot-rattle 420ms ease-in-out; }
.phoenix-pot.near-snap { animation: phoenix-pot-near-snap 520ms ease-in-out; }
.phoenix-pot.snap { animation: phoenix-pot-snap 620ms ease-out; }
@keyframes phoenix-pot-rattle { 0%, 100% { rotate: 0deg; } 25% { rotate: -7deg; } 50% { rotate: 7deg; } 75% { rotate: -4deg; } }
@keyframes phoenix-pot-near-snap { 0%, 100% { transform: scale(1.09) rotate(0deg); } 30% { transform: scale(1.19) rotate(-6deg); } 60% { transform: scale(1.15) rotate(5deg); } 80% { transform: scale(1.06) rotate(-2deg); } }
@keyframes phoenix-pot-snap { 0% { scale: 1; } 45% { scale: 1.24; } 75% { scale: 0.92; } 100% { scale: 1.08; } }
.phoenix-gold-bar {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 4px 8px; border-radius: 8px;
  border: 2px solid var(--gold); background: linear-gradient(180deg, var(--phoenix-plate), var(--phoenix-hall));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 2px 0 var(--gold-deep); color: var(--gold-light); font-family: var(--display); cursor: pointer;
}
.app.phoenix[data-phoenix-gold="3"] .phoenix-gold-bar { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 10px rgba(236, 118, 30, 0.42), 0 2px 0 var(--gold-deep); }
.app.phoenix[data-phoenix-gold="4"] .phoenix-gold-bar { border-color: var(--phoenix-gold); box-shadow: inset 0 1px 0 rgba(255, 240, 170, 0.32), 0 0 14px rgba(243, 203, 73, 0.54), 0 2px 0 var(--gold-deep); }
.app.phoenix[data-phoenix-gold="5"] .phoenix-gold-bar {
  border-color: #fff2a8; background: linear-gradient(180deg, #8f5012, #43180b);
  box-shadow: inset 0 1px 0 rgba(255, 245, 190, 0.45), 0 0 18px rgba(243, 203, 73, 0.72), 0 2px 0 var(--gold-deep);
}
.phoenix-gold-bar.gold-step { animation: phoenix-gold-step 520ms ease-out; }
@keyframes phoenix-gold-step { 0% { filter: brightness(1); } 40% { filter: brightness(1.5); transform: scale(1.04); } 100% { filter: brightness(1); transform: scale(1); } }
.phoenix-gold-bar:disabled { opacity: 0.72; cursor: default; }
.phoenix-gold-count { flex: none; font-family: var(--display); font-size: 13px; line-height: 1; letter-spacing: 0.05em; color: var(--gold-light); text-shadow: 0 1px 0 #000; white-space: nowrap; }
.phoenix-gold-icons { display: flex; align-items: center; gap: 3px; }
.phoenix-gold-pip {
  width: 24px; height: 24px; border-radius: 5px; border: 1px solid var(--gold-deep); background: linear-gradient(180deg, #2d101d, #13040c);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.phoenix-gold-pip.on { border-color: var(--phoenix-gold); background: linear-gradient(180deg, #754409, #361704); box-shadow: inset 0 0 5px rgba(255, 214, 72, 0.55); }
.phoenix-gold-pip.gold-pop { animation: phoenix-gold-pop 480ms cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes phoenix-gold-pop { 0% { transform: scale(0.75); filter: brightness(1.8); } 55% { transform: scale(1.22); filter: brightness(1.35); } 100% { transform: scale(1); filter: brightness(1); } }
.phoenix-gold-pip.off { opacity: 0.36; filter: grayscale(0.7); }
.phoenix-gold-pip-img { width: 20px; height: 20px; object-fit: contain; }
.phoenix-status {
  padding: 2px 8px; border-radius: 6px; border: 1px solid var(--gold-deep); background: linear-gradient(180deg, var(--phoenix-glass), var(--bg-deep));
  font-family: var(--display); font-size: 12px; line-height: 1.15; letter-spacing: 0.04em; text-align: center;
  color: var(--text); text-shadow: 0 1px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0;
}
@media (orientation: portrait) and (max-height: 700px) {
  html:not(.landscape) .phoenix-sign:not([hidden]) {
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-auto-rows: max-content; align-content: end; align-items: center;
  }
  .phoenix-sign > :is(.phoenix-jackpots, .phoenix-title, .phoenix-status) { grid-column: 1 / -1; }
}
.phoenix-spark {
  position: fixed; width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle, #fff8d6 0 32%, var(--phoenix-gold) 55%, transparent 100%); pointer-events: none; z-index: 40;
}
.phoenix-ways-pop { color: var(--gold-light); text-shadow: 0 2px 0 #000, 0 0 14px rgba(243, 203, 73, 0.85); }
@media (prefers-reduced-motion: reduce) {
  .phoenix .reel { transition: none; }
  .phoenix .grid.phoenix-expand, .phoenix .cell.is-gold.gold-wash, .phoenix-gold-bar.gold-step,
  .phoenix-gold-pip.gold-pop, .phoenix-jackpot.unlock-burst, .phoenix-pot.near-snap { animation: none; }
}
