/* ==========================================================================
   DUBAI RISE — style.css
   Luxury Arabian-modern UI: midnight blues, desert gold, geometric accents
   ========================================================================== */

:root {
  --gold: #e8c368;
  --gold-bright: #ffe19a;
  --gold-deep: #a9832f;
  --midnight: #070b18;
  --midnight-2: #0d1428;
  --midnight-3: #141d38;
  --ink: #f4ecd8;
  --ink-dim: rgba(244, 236, 216, 0.55);
  --teal: #37c3b8;
  --rose: #e86868;
  --font-display: 'Reem Kufi', 'Outfit', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-arabic: 'Amiri', serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--midnight);
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#app { position: fixed; inset: 0; overflow: hidden; }

#game-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

/* Gold frame vignette over everything */
.frame-vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 40;
  box-shadow:
    inset 0 0 120px rgba(4, 6, 14, 0.55),
    inset 0 0 0 1px rgba(232, 195, 104, 0.14);
}

/* ==========================================================================
   Screens
   ========================================================================== */

.screen {
  position: absolute; inset: 0;
  z-index: 50;
  display: none;
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
}
.screen.active { display: flex; opacity: 1; }
.screen.leaving { opacity: 0; }

.overlay-screen {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(7, 11, 24, 0.55) 0%, rgba(7, 11, 24, 0.88) 100%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  position: relative;
  overflow: hidden;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.22em;
  font-size: 15px;
  border: none;
  cursor: pointer;
  padding: 16px 42px;
  border-radius: 4px;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.25s ease, filter 0.2s ease;
}
.btn:active { transform: scale(0.96); }

.btn-gold {
  background: linear-gradient(160deg, var(--gold-bright) 0%, var(--gold) 42%, var(--gold-deep) 100%);
  color: #241a05;
  box-shadow:
    0 6px 30px rgba(232, 195, 104, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(232, 195, 104, 0.5), inset 0 1px 0 rgba(255,255,255,0.55);
  filter: brightness(1.06);
}
.btn-xl { padding: 20px 58px; font-size: 17px; }

.btn-shine {
  position: absolute; top: 0; left: -80%;
  width: 55%; height: 100%;
  background: linear-gradient(105deg, transparent 0%, rgba(255,255,255,0.55) 50%, transparent 100%);
  transform: skewX(-22deg);
  animation: shine 3.2s var(--ease-out) infinite;
  pointer-events: none;
}
@keyframes shine {
  0%, 55% { left: -80%; }
  75%, 100% { left: 140%; }
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(232, 195, 104, 0.35);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-bright); background: rgba(232,195,104,0.06); }

.btn-text {
  background: none; border: none; cursor: pointer;
  color: var(--ink-dim);
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 12px;
  transition: color 0.2s;
}
.btn-text:hover { color: var(--gold); }

.btn-icon {
  background: rgba(13, 20, 40, 0.6);
  border: 1px solid rgba(232, 195, 104, 0.25);
  color: var(--gold);
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 17px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}
.btn-icon:hover { border-color: var(--gold); background: rgba(232,195,104,0.12); transform: scale(1.06); }
.btn-icon.muted { color: var(--ink-dim); opacity: 0.7; }

.btn-toggle {
  background: none;
  border: 1px solid rgba(232,195,104,0.25);
  border-radius: 4px;
  color: var(--ink-dim);
  font-family: var(--font-display);
  letter-spacing: 0.18em;
  font-size: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-toggle span { color: var(--gold); margin-left: 6px; }
.btn-toggle.off span { color: var(--rose); }
.btn-toggle:hover { border-color: var(--gold); }

/* ==========================================================================
   Title screen
   ========================================================================== */

#screen-title {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(180deg, rgba(7,11,24,0) 0%, rgba(7,11,24,0.25) 70%, rgba(7,11,24,0.6) 100%);
}

.title-arabic {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -58%);
  font-family: var(--font-arabic);
  font-size: min(52vw, 480px);
  line-height: 1;
  color: rgba(232, 195, 104, 0.05);
  pointer-events: none;
  animation: arabicBreath 9s ease-in-out infinite;
}
@keyframes arabicBreath {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -58%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -58%) scale(1.03); }
}

.title-block { position: relative; z-index: 2; padding: 20px; }

.title-eyebrow {
  font-family: var(--font-arabic);
  color: var(--gold);
  font-size: clamp(18px, 3vw, 26px);
  opacity: 0;
  animation: riseIn 0.9s var(--ease-out) 0.15s forwards;
}

.title-main {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(56px, 12vw, 132px);
  line-height: 0.95;
  letter-spacing: 0.06em;
  margin: 10px 0 4px;
  background: linear-gradient(175deg, #fff6dd 0%, var(--gold-bright) 30%, var(--gold) 55%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 40px rgba(232, 195, 104, 0.35));
  opacity: 0;
  animation: riseIn 1s var(--ease-out) 0.3s forwards;
}
.title-rise {
  display: block;
  font-size: 0.42em;
  letter-spacing: 0.62em;
  margin-top: 2px;
  padding-left: 0.62em; /* balance tracking */
}

.title-sub {
  font-size: clamp(10px, 1.6vw, 14px);
  letter-spacing: 0.42em;
  color: var(--ink-dim);
  opacity: 0;
  animation: riseIn 1s var(--ease-out) 0.5s forwards;
}

.title-rule {
  display: flex; align-items: center; justify-content: center;
  gap: 14px;
  margin: 26px auto 20px;
  width: min(380px, 70vw);
  opacity: 0;
  animation: riseIn 1s var(--ease-out) 0.65s forwards;
}
.rule-line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(232,195,104,0.6)); }
.rule-line:last-child { background: linear-gradient(270deg, transparent, rgba(232,195,104,0.6)); }
.rule-star { color: var(--gold); font-size: 14px; animation: starTwinkle 2.4s ease-in-out infinite; }
@keyframes starTwinkle { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: 0.5; transform: scale(0.82) rotate(45deg);} }

.title-tag {
  max-width: 460px;
  margin: 0 auto 34px;
  font-weight: 300;
  font-size: clamp(14px, 2vw, 17px);
  line-height: 1.65;
  color: var(--ink-dim);
  opacity: 0;
  animation: riseIn 1s var(--ease-out) 0.8s forwards;
}

#btn-play { opacity: 0; animation: riseIn 0.9s var(--ease-out) 1s forwards; }

.title-hint {
  margin-top: 26px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(244, 236, 216, 0.4);
  opacity: 0;
  animation: riseIn 1s var(--ease-out) 1.25s forwards;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

.title-footer {
  position: absolute;
  bottom: 22px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 14px;
  z-index: 3;
  opacity: 0;
  animation: riseIn 1s var(--ease-out) 1.5s forwards;
}
.footer-note { font-size: 12px; color: rgba(244,236,216,0.35); letter-spacing: 0.08em; }

/* ==========================================================================
   Level select — the Journey
   ========================================================================== */

#screen-levels {
  flex-direction: column;
  background:
    radial-gradient(140% 90% at 50% -10%, rgba(20, 29, 56, 0.5) 0%, rgba(7, 11, 24, 0.92) 68%);
  backdrop-filter: blur(3px);
}

.levels-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 22px 8px;
}
.levels-heading { text-align: center; }
.levels-heading h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 4.5vw, 38px);
  letter-spacing: 0.28em;
  color: var(--gold);
  padding-left: 0.28em;
}
.levels-subtitle { font-size: 13px; color: var(--ink-dim); letter-spacing: 0.1em; margin-top: 2px; }

.journey-track {
  flex: 1;
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.2vw, 26px);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 20px clamp(20px, 6vw, 80px);
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.journey-track::-webkit-scrollbar { display: none; }

.level-card {
  position: relative;
  flex: 0 0 clamp(230px, 26vw, 300px);
  height: min(64vh, 420px);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: center;
  border: 1px solid rgba(232, 195, 104, 0.2);
  background: var(--midnight-2);
  transition: transform 0.35s var(--ease-spring), box-shadow 0.35s ease, border-color 0.3s ease;
  animation: cardIn 0.7s var(--ease-out) backwards;
}
.level-card:nth-child(1) { animation-delay: 0.05s; }
.level-card:nth-child(2) { animation-delay: 0.13s; }
.level-card:nth-child(3) { animation-delay: 0.21s; }
.level-card:nth-child(4) { animation-delay: 0.29s; }
.level-card:nth-child(5) { animation-delay: 0.37s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.level-card:not(.locked):hover {
  transform: translateY(-10px) scale(1.02);
  border-color: var(--gold);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 40px rgba(232,195,104,0.12);
}

.level-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.level-card .card-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,11,24,0.15) 0%, rgba(7,11,24,0) 35%, rgba(7,11,24,0.88) 100%);
}

.card-content {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 18px 16px;
  z-index: 2;
}
.card-era {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--gold);
}
.card-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(19px, 2.4vw, 24px);
  letter-spacing: 0.08em;
  margin: 3px 0 2px;
}
.card-desc { font-size: 12.5px; color: var(--ink-dim); line-height: 1.45; font-weight: 300; }
.card-stars { margin-top: 10px; font-size: 15px; letter-spacing: 5px; color: rgba(244,236,216,0.25); }
.card-stars .earned { color: var(--gold); text-shadow: 0 0 12px rgba(232,195,104,0.7); }
.card-best { font-size: 11px; color: var(--ink-dim); margin-top: 3px; letter-spacing: 0.08em; }

.card-num {
  position: absolute; top: 12px; left: 16px;
  font-family: var(--font-display);
  font-size: 15px; letter-spacing: 0.2em;
  color: rgba(244,236,216,0.75);
  z-index: 2;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.level-card.locked { cursor: not-allowed; filter: saturate(0.25) brightness(0.6); }
.card-lock {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  z-index: 3;
  background: rgba(7, 11, 24, 0.35);
}
.card-lock .lock-icon { font-size: 34px; opacity: 0.9; filter: grayscale(0.4); }
.card-lock .lock-note {
  position: absolute; bottom: 84px;
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-dim);
}

.levels-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 26px max(16px, env(safe-area-inset-bottom));
}
.total-stars {
  font-family: var(--font-display);
  color: var(--gold);
  letter-spacing: 0.2em;
  font-size: 15px;
}

/* ==========================================================================
   Level intro card
   ========================================================================== */

#screen-intro {
  align-items: center; justify-content: center;
  background: radial-gradient(110% 100% at 50% 0%, rgba(7,11,24,0.5), rgba(7,11,24,0.9));
  backdrop-filter: blur(5px);
}

.intro-card {
  text-align: center;
  max-width: 520px;
  padding: 40px 34px;
  border: 1px solid rgba(232, 195, 104, 0.3);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(20, 29, 56, 0.75), rgba(7, 11, 24, 0.85));
  box-shadow: 0 40px 100px rgba(0,0,0,0.6);
  position: relative;
  animation: introCard 0.6s var(--ease-spring) backwards;
  margin: 20px;
}
@keyframes introCard {
  from { opacity: 0; transform: scale(0.88) translateY(30px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.intro-card::before, .intro-card::after {
  content: '✦';
  position: absolute;
  color: var(--gold);
  font-size: 13px;
  top: 12px;
}
.intro-card::before { left: 16px; }
.intro-card::after { right: 16px; }

.intro-era {
  font-family: var(--font-display);
  font-size: 15px; letter-spacing: 0.5em;
  color: var(--gold);
  padding-left: 0.5em;
}
.intro-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 6vw, 44px);
  letter-spacing: 0.1em;
  margin: 8px 0 0;
}
.intro-arabic {
  font-family: var(--font-arabic);
  font-size: 22px;
  color: rgba(232,195,104,0.75);
  margin-bottom: 16px;
}
.intro-story {
  font-weight: 300;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-dim);
  margin-bottom: 18px;
}
.intro-tip {
  font-size: 13px;
  color: var(--teal);
  letter-spacing: 0.06em;
  border: 1px dashed rgba(55, 195, 184, 0.4);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(55, 195, 184, 0.06);
}
.intro-goal {
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-bottom: 26px;
}

/* ==========================================================================
   HUD
   ========================================================================== */

.hud { pointer-events: none; flex-direction: column; justify-content: space-between; }
.hud > * { pointer-events: auto; }

.hud-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) 18px 0;
}

.hud-left { display: flex; align-items: center; gap: 12px; min-width: 130px; }

.hearts { display: flex; gap: 5px; font-size: 20px; }
.heart {
  color: var(--rose);
  filter: drop-shadow(0 2px 6px rgba(232, 104, 104, 0.5));
  transition: transform 0.3s var(--ease-spring), opacity 0.3s, filter 0.3s;
}
.heart.lost { color: rgba(244,236,216,0.15); filter: none; transform: scale(0.8); }
.heart.pulse { animation: heartPulse 0.5s var(--ease-spring); }
@keyframes heartPulse { 0% { transform: scale(1); } 40% { transform: scale(1.6); } 100% { transform: scale(1); } }

.hud-powerup {
  display: flex; gap: 8px; align-items: center;
  font-size: 13px;
  color: var(--gold);
}
.pu-badge {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(232,195,104,0.45);
  background: rgba(13,20,40,0.65);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  animation: puIn 0.35s var(--ease-spring);
}
.pu-badge .pu-time { font-variant-numeric: tabular-nums; color: var(--ink); }
@keyframes puIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.hud-progress { flex: 1; max-width: 560px; margin: 4px auto 0; }
.progress-labels {
  display: flex; justify-content: space-between;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  margin-bottom: 6px;
}
#hud-distance { color: var(--gold); font-variant-numeric: tabular-nums; }

.progress-bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: rgba(244,236,216,0.12);
  border: 1px solid rgba(232,195,104,0.18);
}
.progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-bright));
  box-shadow: 0 0 12px rgba(232,195,104,0.55);
  transition: width 0.25s linear;
}
.progress-runner {
  position: absolute;
  top: 50%; left: 0%;
  transform: translate(-50%, -50%);
  font-size: 9px;
  color: var(--gold-bright);
  transition: left 0.25s linear;
  text-shadow: 0 0 8px rgba(232,195,104,0.9);
}

.hud-right { display: flex; align-items: center; gap: 14px; min-width: 130px; justify-content: flex-end; }

.hud-coins {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}
.coin-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-bright), var(--gold-deep));
  box-shadow: 0 0 10px rgba(232,195,104,0.7);
}
.hud-coins.bump .coin-dot { animation: coinBump 0.25s var(--ease-spring); }
@keyframes coinBump { 50% { transform: scale(1.45); } }

.hud-score {
  font-size: 13px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

/* Combo pill */
.combo-pill {
  position: absolute;
  top: 86px; right: 20px;
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(13,20,40,0.7);
  border: 1px solid var(--gold);
  box-shadow: 0 0 24px rgba(232,195,104,0.3);
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.3s var(--ease-spring);
  pointer-events: none;
}
.combo-pill.show { opacity: 1; transform: scale(1); }
.combo-pill.hot { animation: comboHot 0.6s ease-in-out infinite alternate; }
@keyframes comboHot { from { box-shadow: 0 0 18px rgba(232,195,104,0.3);} to { box-shadow: 0 0 34px rgba(232,195,104,0.75);} }
#combo-mult {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 700;
  color: var(--gold-bright);
}
.combo-label { font-size: 9px; letter-spacing: 0.3em; color: var(--ink-dim); }

/* Touch controls */
.touch-controls {
  display: none;
  justify-content: space-between;
  padding: 0 26px max(20px, env(safe-area-inset-bottom));
}
body.touch .touch-controls { display: flex; }
.touch-btn {
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 1.5px solid rgba(232,195,104,0.4);
  background: rgba(13, 20, 40, 0.45);
  color: var(--gold);
  font-size: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  backdrop-filter: blur(3px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.touch-btn span { font-size: 9px; letter-spacing: 0.24em; font-family: var(--font-display); }
.touch-btn:active { background: rgba(232,195,104,0.25); transform: scale(0.93); }

/* ==========================================================================
   Modals (pause / results / gameover)
   ========================================================================== */

.modal {
  width: min(440px, calc(100vw - 40px));
  padding: 36px 32px 28px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid rgba(232, 195, 104, 0.3);
  background: linear-gradient(180deg, rgba(20,29,56,0.92), rgba(7,11,24,0.95));
  box-shadow: 0 40px 120px rgba(0,0,0,0.7);
  animation: introCard 0.5s var(--ease-spring) backwards;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  scrollbar-width: none;
}
.modal::-webkit-scrollbar { display: none; }

.modal-title {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.24em;
  color: var(--ink);
  margin-bottom: 20px;
  padding-left: 0.24em;
}

.modal-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.modal-actions.row { flex-direction: row; justify-content: center; }
.modal-actions .btn { min-width: 150px; }

.modal-sound { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }

/* Results */
.results-kicker {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.44em;
  color: var(--teal);
  padding-left: 0.44em;
}
.results-kicker.fail { color: var(--rose); }

.results-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 5vw, 36px);
  letter-spacing: 0.12em;
  margin: 6px 0 10px;
  color: var(--gold-bright);
}

.results-stars { font-size: 34px; letter-spacing: 14px; padding-left: 14px; margin-bottom: 18px; }
.rstar { color: rgba(244,236,216,0.14); display: inline-block; transition: none; }
.rstar.big { font-size: 46px; vertical-align: -4px; }
.rstar.earned {
  color: var(--gold);
  text-shadow: 0 0 24px rgba(232,195,104,0.9);
  animation: starPop 0.5s var(--ease-spring) backwards;
}
@keyframes starPop {
  0% { transform: scale(0) rotate(-120deg); }
  70% { transform: scale(1.35) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}

.results-rows { margin: 4px 0 16px; }
.rrow {
  display: flex; justify-content: space-between;
  padding: 9px 6px;
  font-size: 14px;
  color: var(--ink-dim);
  border-bottom: 1px solid rgba(232,195,104,0.1);
}
.rrow b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.rrow.total { border-bottom: none; font-size: 16px; }
.rrow.total b { color: var(--gold-bright); font-family: var(--font-display); font-size: 20px; }
.rrow.best { border-bottom: none; padding-top: 0; font-size: 12px; }
.rrow.best b { color: var(--teal); }

.results-story {
  font-size: 13.5px;
  font-weight: 300;
  font-style: italic;
  line-height: 1.65;
  color: var(--ink-dim);
  margin-bottom: 18px;
}

.gameover-note { color: var(--ink-dim); font-weight: 300; margin: -8px 0 14px; font-size: 14px; }

/* ==========================================================================
   Finale
   ========================================================================== */

.finale { background: radial-gradient(100% 100% at 50% 20%, rgba(20,29,56,0.4), rgba(7,11,24,0.92)); }
.finale-inner { text-align: center; max-width: 560px; padding: 30px; position: relative; }
.finale-arabic {
  font-family: var(--font-arabic);
  font-size: 90px;
  color: var(--gold);
  text-shadow: 0 0 60px rgba(232,195,104,0.5);
  animation: arabicBreath 5s ease-in-out infinite;
  line-height: 1.1;
}
.finale-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 9vw, 68px);
  line-height: 1.05;
  letter-spacing: 0.1em;
  margin: 12px 0 18px;
  background: linear-gradient(175deg, #fff6dd, var(--gold), var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.finale-story { color: var(--ink-dim); font-weight: 300; line-height: 1.75; margin-bottom: 20px; }
.finale-stars {
  font-family: var(--font-display);
  color: var(--gold); font-size: 20px; letter-spacing: 0.24em;
  margin-bottom: 28px;
}

/* ==========================================================================
   Toast
   ========================================================================== */

.toast {
  position: absolute;
  left: 50%; bottom: 44px;
  transform: translateX(-50%) translateY(30px);
  background: rgba(13, 20, 40, 0.92);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-family: var(--font-display);
  letter-spacing: 0.14em;
  font-size: 14px;
  padding: 13px 26px;
  border-radius: 40px;
  opacity: 0;
  transition: all 0.45s var(--ease-spring);
  z-index: 80;
  pointer-events: none;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 30px rgba(232,195,104,0.2);
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-height: 520px), (max-width: 640px) {
  .hud-progress { max-width: none; }
  .progress-labels #hud-level-name { display: none; }
  .hud-left { min-width: 0; }
  .hud-right { min-width: 0; }
  .hud-score { display: none; }
  .combo-pill { top: 74px; right: 12px; padding: 6px 12px; }
  #combo-mult { font-size: 19px; }
  .modal { padding: 26px 20px 20px; }
  .modal-actions.row { flex-direction: column; }
  .modal-actions .btn { min-width: 0; width: 100%; }
  .title-hint { display: none; }
}
