/* =========================================================================
   ROYAL DYNASTY — game.css
   Every rule is scoped under .rdy- so this file can't leak into, or be
   leaked into by, the shared site stylesheet (/css/styles.css).
   No image assets — all 11 symbols are emoji/CSS glyphs.
   ========================================================================= */

:root {
  --rdy-red-deep: #1a0505;
  --rdy-red-mid: #2b0a0a;
  --rdy-red-lacquer: #3d0f0f;
  --rdy-black-panel: #150404;
  --rdy-black-panel-2: #200808;
  --rdy-gold: #e8b74a;
  --rdy-gold-bright: #ffd989;
  --rdy-crimson-glow: #ff4d5e;
  --rdy-crimson-bright: #ff8b7a;
  --rdy-ink: #f7ecdb;
  --rdy-ink-dim: #d9bfae;
  --rdy-ink-faint: #a9846f;
  --rdy-win-jade: #3ddc97;
  --rdy-danger: #ff5d6c;
  --rdy-line-glow: #ffd75e;
  --rdy-border: rgba(232, 183, 74, 0.28);
  --rdy-shadow: rgba(0, 0, 0, 0.6);

  --rdy-radius-sm: 8px;
  --rdy-radius-md: 14px;
  --rdy-radius-lg: 22px;

  --rdy-safe-top: env(safe-area-inset-top, 0px);
  --rdy-safe-bottom: env(safe-area-inset-bottom, 0px);
  --rdy-safe-left: env(safe-area-inset-left, 0px);
  --rdy-safe-right: env(safe-area-inset-right, 0px);

  --rdy-font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

/* Hide the shared site chrome while a hand is actually in progress. */
body:has(.rdy-root.is-playing) .rdy-site-header,
body:has(.rdy-root.is-playing) #footer {
  display: none;
}

.rdy-root {
  font-family: var(--rdy-font);
  color: var(--rdy-ink);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(232, 183, 74, 0.1), transparent 55%),
    linear-gradient(180deg, var(--rdy-red-deep) 0%, var(--rdy-red-mid) 55%, var(--rdy-black-panel) 100%);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  padding-left: var(--rdy-safe-left);
  padding-right: var(--rdy-safe-right);
  box-sizing: border-box;
}

.rdy-root * {
  box-sizing: border-box;
}

.rdy-screen {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(1.25rem + var(--rdy-safe-top)) 1rem calc(1.25rem + var(--rdy-safe-bottom));
}

.rdy-screen[hidden] {
  display: none !important;
}

/* -------------------------------------------------------------------------
   Ambient lantern glow flicker — pure CSS, no per-frame JS.
   ------------------------------------------------------------------------- */
.rdy-lantern-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 60% 40% at 30% 0%, rgba(255, 137, 122, 0.28), transparent 60%);
  opacity: 0;
  animation: rdy-flicker 7s infinite ease-in-out;
}

@keyframes rdy-flicker {
  0%, 91%, 100% { opacity: 0; }
  92% { opacity: 0.8; }
  92.6% { opacity: 0.15; }
  93.2% { opacity: 0.6; }
  94% { opacity: 0; }
  96% { opacity: 0.4; }
  96.4% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .rdy-lantern-bg { animation: none; opacity: 0.08; }
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.rdy-btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--rdy-radius-md);
  border: 1px solid var(--rdy-border);
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  background: var(--rdy-black-panel-2);
  color: var(--rdy-ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.rdy-btn:hover { filter: brightness(1.1); }
.rdy-btn:active { transform: scale(0.97); }

.rdy-btn--primary {
  background: linear-gradient(180deg, var(--rdy-gold-bright), var(--rdy-gold));
  color: #2a1a05;
  border-color: transparent;
  box-shadow: 0 6px 22px rgba(232, 183, 74, 0.35);
}

.rdy-btn--ghost {
  background: transparent;
  border-color: var(--rdy-border);
}

.rdy-btn--disabled,
.rdy-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.rdy-btn:disabled:active { transform: none; }

.rdy-btn--icon {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  font-size: 1.1rem;
  line-height: 1;
}

/* -------------------------------------------------------------------------
   Menu screen
   ------------------------------------------------------------------------- */
.rdy-screen--menu { justify-content: center; }

.rdy-menu-card {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--rdy-black-panel), var(--rdy-black-panel-2));
  border: 1px solid var(--rdy-border);
  border-radius: var(--rdy-radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 20px 60px var(--rdy-shadow);
}

.rdy-menu-glyphs {
  font-size: 3rem;
  margin-bottom: 0.25rem;
  filter: drop-shadow(0 0 18px rgba(232, 183, 74, 0.55));
}

.rdy-title {
  font-size: 2.6rem;
  margin: 0;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, var(--rdy-gold-bright), var(--rdy-gold) 60%, #9a6b1e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(232, 183, 74, 0.25);
}

.rdy-tagline {
  color: var(--rdy-ink-dim);
  margin: 0.6rem 0 1.4rem;
  font-size: 0.98rem;
  font-style: italic;
}

.rdy-menu-jackpot {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(232, 183, 74, 0.08);
  border: 1px solid var(--rdy-border);
  border-radius: var(--rdy-radius-md);
  padding: 0.7rem 1rem;
  margin-bottom: 1.5rem;
}

.rdy-menu-jackpot-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rdy-ink-faint);
}

.rdy-menu-jackpot-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--rdy-gold-bright);
  font-variant-numeric: tabular-nums;
}

.rdy-menu-jackpot-unit {
  font-size: 0.78rem;
  color: var(--rdy-ink-faint);
}

.rdy-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.rdy-fineprint {
  margin-top: 1.4rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--rdy-ink-faint);
}

/* -------------------------------------------------------------------------
   Help / paytable screen
   ------------------------------------------------------------------------- */
.rdy-screen--help { align-items: stretch; padding-left: 0; padding-right: 0; }

.rdy-help-panel {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--rdy-black-panel);
  border: 1px solid var(--rdy-border);
  border-radius: var(--rdy-radius-lg);
  overflow: hidden;
}

.rdy-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--rdy-border);
  position: sticky;
  top: 0;
  background: var(--rdy-black-panel);
  z-index: 2;
}

.rdy-help-header h2 { margin: 0; font-size: 1.2rem; }

.rdy-help-body { padding: 1.25rem; }

.rdy-help-note {
  color: var(--rdy-ink-dim);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 0;
}

.rdy-paytable-wrap {
  overflow-x: auto;
  border-radius: var(--rdy-radius-md);
  border: 1px solid var(--rdy-border);
  margin: 1rem 0 1.5rem;
}

.rdy-paytable {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
  font-size: 0.88rem;
}

.rdy-paytable th, .rdy-paytable td {
  padding: 0.55rem 0.7rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.rdy-paytable th {
  color: var(--rdy-ink-faint);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.rdy-paytable td:first-child, .rdy-paytable th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--rdy-black-panel);
}

.rdy-paytable-glyph { font-size: 1.3rem; margin-right: 0.4rem; }
.rdy-paytable-name { color: var(--rdy-ink); font-weight: 600; }
.rdy-paytable-sub { display: block; color: var(--rdy-ink-faint); font-size: 0.72rem; font-weight: 400; }

.rdy-help-rules h3 {
  font-size: 0.98rem;
  margin: 1.1rem 0 0.35rem;
  color: var(--rdy-gold-bright);
}
.rdy-help-rules p {
  margin: 0 0 0.6rem;
  color: var(--rdy-ink-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* -------------------------------------------------------------------------
   Play screen
   ------------------------------------------------------------------------- */
.rdy-screen--play {
  position: relative;
  padding-top: calc(0.6rem + var(--rdy-safe-top));
  gap: 0.6rem;
}

.rdy-play-topbar {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.rdy-chip {
  background: var(--rdy-black-panel-2);
  border: 1px solid var(--rdy-border);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  min-width: 0;
}

.rdy-chip-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rdy-ink-faint);
}

.rdy-chip-value {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--rdy-gold-bright);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.rdy-chip--jackpot .rdy-chip-value { color: var(--rdy-crimson-bright); }

.rdy-status-strip {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--rdy-ink-faint);
  margin-bottom: 0.4rem;
}

.rdy-status-item strong { color: var(--rdy-ink); }

#freeSpinsIndicator strong, #bonusIndicator strong { color: var(--rdy-gold-bright); }

.rdy-reel-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  background: linear-gradient(180deg, var(--rdy-black-panel), var(--rdy-black-panel-2));
  border: 1px solid var(--rdy-border);
  border-radius: var(--rdy-radius-lg);
  padding: 0.6rem;
  box-shadow: 0 16px 50px var(--rdy-shadow), inset 0 0 40px rgba(255, 137, 122, 0.06);
  /* Sized to content — no flex-grow / min-height:0 / centering wrapper here.
     Inside a min-height:100vh screen column, "flex: 1 1 auto" plus centered
     content would stretch this card to fill leftover viewport height and
     leave big dead-space gaps above and below the (correctly sized) reel
     grid. Let it size to its content instead. */
}

.rdy-reels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
  width: 100%;
  aspect-ratio: 5 / 3;
  max-height: 52vh;
}

.rdy-reel {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, rgba(61, 15, 15, 0.9), rgba(21, 4, 4, 0.95));
  border-radius: var(--rdy-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.rdy-reel--thud { animation: rdy-thud 0.18s ease-out; }
@keyframes rdy-thud {
  0% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

.rdy-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.rdy-cell {
  height: 0;
  flex: 0 0 auto;
  /* Padding-percentage resolves against the element's own WIDTH, not the
     strip's height — so to make each cell exactly 1/3 of a 5:3 reel frame
     (i.e. square, matching one column's width) this must be 100%, not
     33.3334%. Using the wrong value would render cells 3x too short. */
  padding-top: 100%; /* keeps cells square inside the flex strip */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rdy-cell .rdy-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.4rem, 6.4vw, 2.6rem);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.rdy-cell--wild .rdy-glyph { filter: drop-shadow(0 0 10px rgba(232, 183, 74, 0.8)); }

/* The Imperial Dragon (id 10) reads as visibly bigger and more gilded than
   the plain Emperor's Crown wild, even though both share the same imperial
   palette. */
.rdy-cell--top .rdy-glyph {
  font-size: clamp(1.6rem, 7.4vw, 3rem);
  filter: drop-shadow(0 0 16px rgba(255, 217, 137, 1)) drop-shadow(0 0 6px #fff) drop-shadow(0 0 2px #fff);
}

.rdy-cell--scatter .rdy-glyph { filter: drop-shadow(0 0 8px rgba(255, 137, 122, 0.85)); }

.rdy-cell--win::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  border: 2px solid var(--rdy-line-glow);
  box-shadow: 0 0 14px var(--rdy-line-glow), inset 0 0 10px rgba(255, 215, 94, 0.4);
  pointer-events: none;
}

.rdy-cell--win-pulse::after { animation: rdy-win-pulse 0.9s ease-in-out infinite; }
@keyframes rdy-win-pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.rdy-win-banner {
  position: absolute;
  left: 50%;
  top: 8%;
  transform: translateX(-50%);
  background: rgba(21, 4, 4, 0.9);
  border: 1px solid var(--rdy-gold);
  color: var(--rdy-gold-bright);
  font-weight: 800;
  font-size: clamp(1rem, 4vw, 1.5rem);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  box-shadow: 0 0 26px rgba(232, 183, 74, 0.5);
  z-index: 3;
  animation: rdy-banner-pop 0.35s ease-out;
  pointer-events: none;
}

@keyframes rdy-banner-pop {
  0% { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.9); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* -------------------------------------------------------------------------
   Controls
   ------------------------------------------------------------------------- */
.rdy-controls {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.5rem 0.6rem;
  margin-top: 0.6rem;
  align-items: end;
}

.rdy-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.rdy-control-group--total { grid-column: 1 / 3; flex-direction: row; align-items: baseline; gap: 0.5rem; }

.rdy-control-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rdy-ink-faint);
}

.rdy-select {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--rdy-black-panel-2);
  color: var(--rdy-ink);
  border: 1px solid var(--rdy-border);
  border-radius: var(--rdy-radius-sm);
  padding: 0.5rem 0.6rem;
}

.rdy-total-bet {
  font-weight: 800;
  color: var(--rdy-gold-bright);
  font-variant-numeric: tabular-nums;
}

.rdy-btn--spin {
  grid-column: 3;
  grid-row: 1 / 3;
  min-width: 108px;
  min-height: 64px;
  border-radius: var(--rdy-radius-lg);
  background: linear-gradient(180deg, var(--rdy-gold-bright), var(--rdy-gold));
  color: #291a06;
  border: none;
  box-shadow: 0 8px 26px rgba(232, 183, 74, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}

.rdy-spin-label { font-size: 1rem; letter-spacing: 0.06em; }
.rdy-spin-glyph { font-size: 1.3rem; }

.rdy-btn--spin.is-spinning .rdy-spin-glyph { animation: rdy-glyph-spin 0.6s linear infinite; }
@keyframes rdy-glyph-spin {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(180deg); }
}

@media (min-width: 720px) {
  .rdy-controls { grid-template-columns: 1fr 1fr 1fr auto; }
  .rdy-control-group--total { grid-column: 3; flex-direction: column; align-items: flex-start; }
  .rdy-btn--spin { grid-column: 4; }
}

/* -------------------------------------------------------------------------
   Bonus pick overlay
   ------------------------------------------------------------------------- */
.rdy-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem calc(1rem + var(--rdy-safe-right)) calc(1rem + var(--rdy-safe-bottom)) calc(1rem + var(--rdy-safe-left));
  background: rgba(10, 2, 2, 0.85);
  backdrop-filter: blur(2px);
}

.rdy-overlay[hidden] {
  display: none;
}

.rdy-bonus-panel {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--rdy-black-panel), var(--rdy-red-lacquer));
  border: 1px solid var(--rdy-border);
  border-radius: var(--rdy-radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 20px 60px var(--rdy-shadow);
}

.rdy-bonus-title { margin: 0 0 0.2rem; color: var(--rdy-gold-bright); }
.rdy-bonus-sub { margin: 0 0 1rem; color: var(--rdy-ink-dim); font-size: 0.9rem; }

.rdy-bonus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.rdy-bonus-tile {
  aspect-ratio: 1;
  border-radius: var(--rdy-radius-md);
  border: 1px solid var(--rdy-border);
  background: radial-gradient(circle at 50% 30%, #4a1414, #200808);
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--rdy-ink);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.rdy-bonus-tile:hover:not(.is-revealed) { transform: translateY(-2px); filter: brightness(1.2); }
.rdy-bonus-tile:active:not(.is-revealed) { transform: scale(0.96); }

.rdy-bonus-tile.is-revealed {
  cursor: default;
  background: radial-gradient(circle at 50% 30%, #5a3d10, #291a06);
  border-color: var(--rdy-gold);
  flex-direction: column;
  font-size: 1rem;
  font-weight: 800;
  color: var(--rdy-gold-bright);
  animation: rdy-tile-reveal 0.35s ease-out;
}

.rdy-bonus-tile.is-dim { opacity: 0.35; cursor: default; }

@keyframes rdy-tile-reveal {
  0% { transform: scale(0.7) rotateY(90deg); }
  100% { transform: scale(1) rotateY(0); }
}

.rdy-bonus-total { color: var(--rdy-ink-dim); font-size: 0.95rem; }
.rdy-bonus-total strong { color: var(--rdy-gold-bright); }

/* -------------------------------------------------------------------------
   Jackpot overlay
   ------------------------------------------------------------------------- */
.rdy-overlay--jackpot { background: rgba(6, 1, 1, 0.94); }

.rdy-jackpot-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(255, 217, 137, 0.85), transparent 60%);
  animation: rdy-jackpot-flash 1.6s ease-in-out infinite;
}

@keyframes rdy-jackpot-flash {
  0%, 100% { opacity: 0; }
  4% { opacity: 1; }
  8% { opacity: 0.15; }
  12% { opacity: 0.85; }
  16% { opacity: 0; }
  55% { opacity: 0; }
  58% { opacity: 0.6; }
  61% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .rdy-jackpot-flash { animation: none; opacity: 0.15; }
}

.rdy-jackpot-panel {
  position: relative;
  text-align: center;
  z-index: 1;
}

.rdy-jackpot-glyph {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 30px rgba(255, 217, 137, 0.9));
}

.rdy-jackpot-title {
  font-size: clamp(1.8rem, 8vw, 3.1rem);
  margin: 0;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #fff, var(--rdy-gold-bright) 55%, var(--rdy-gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.rdy-jackpot-sub { color: var(--rdy-ink-dim); margin: 0.4rem 0; }

.rdy-jackpot-amount {
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  font-weight: 800;
  color: var(--rdy-gold-bright);
  margin: 0.6rem 0 1.4rem;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------
   Loading screen
   ------------------------------------------------------------------------- */
.rdy-screen--loading { justify-content: center; align-items: center; }
.rdy-loading-glyph { font-size: 3rem; animation: rdy-loading-pulse 1s ease-in-out infinite; }
.rdy-loading-text { color: var(--rdy-ink-dim); margin-top: 0.5rem; }
@keyframes rdy-loading-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.08); }
}


/* Shown while the reels turn waiting on the server's outcome (SMO mode only). Softened so
   the swap between symbols reads as motion rather than a flicker. */
.rdy-cell--blur, .rdy-cell--blur .rdy-glyph {
  filter: blur(2.5px);
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  .rdy-cell--blur, .rdy-cell--blur .rdy-glyph { filter: none; opacity: 0.8; }
}
