:root {
  --sky-dark: #0a1628;
  --sky-navy: #0f1d3d;
  --gold: #d4a843;
  --gold-bright: #f0c94a;
  --gold-dim: #8b6914;
  --muted: #5a7090;
  --text: #dbe6f5;
  --panel-h: 88px;
  --storm: 0; /* 0..1 intensidad del clima, la actualiza el JS */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--sky-dark); }
body { font-family: Inter, system-ui, sans-serif; color: var(--text); -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }

.game-root { position: relative; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; user-select: none; }
.game-canvas { position: absolute; inset: 0 0 var(--panel-h) 0; width: 100%; height: calc(100% - var(--panel-h)); cursor: pointer; display: block; }

/* ---------- Clima ---------- */
.weather-layer { position: absolute; inset: 0 0 var(--panel-h) 0; pointer-events: none; z-index: 5; overflow: hidden; }
.storm-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(3, 8, 20, 0.85) 100%);
  opacity: var(--storm);
  transition: opacity 0.6s;
}
.lightning-flash { position: absolute; inset: 0; background: #e8f0ff; opacity: 0; }
.lightning-flash.on { animation: flash 0.45s ease-out; }
@keyframes flash { 0% { opacity: 0.85; } 20% { opacity: 0.15; } 35% { opacity: 0.6; } 100% { opacity: 0; } }

/* ---------- Tipografía / etiquetas ---------- */
.hud-label { display: block; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; }
.font-display, .brand-title, .multiplier-value, .countdown-num, .result-title, .result-mult, .result-amount, .premium-btn, #balance-value, #bet-input { font-family: Orbitron, monospace; }

/* ---------- Glass ---------- */
.glass, .multiplier-hud, .result-card, .help-card, .bet-panel, .balance-box, .ghost-btn {
  background: rgba(10, 22, 40, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(212, 168, 67, 0.18);
}

/* ---------- HUD superior ---------- */
.hud-top { position: absolute; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: flex-start; justify-content: space-between; padding: 14px 20px; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold), var(--gold-bright)); color: var(--sky-dark); font-size: 18px; box-shadow: 0 4px 18px rgba(212, 168, 67, 0.35); }
.brand-title { font-size: 18px; letter-spacing: 0.12em; color: var(--gold-bright); text-shadow: 0 0 18px rgba(240, 201, 74, 0.35); }

.multiplier-hud { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); min-width: 190px; padding: 8px 22px 10px; border-radius: 16px; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.05); }
.multiplier-value { display: block; font-size: 38px; font-weight: 900; line-height: 1.05; color: var(--gold-bright); text-shadow: 0 0 24px rgba(240, 201, 74, 0.45); transition: transform 0.15s; }
.multiplier-value.bump { animation: bump 0.35s ease-out; }
.multiplier-value.hit { animation: hit 0.4s ease-out; color: #ff7a5c; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes hit { 0% { transform: translateX(0); } 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } 100% { transform: translateX(0); } }
.live-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; letter-spacing: 0.15em; color: #4ade80; font-weight: 700; margin-top: 2px; }
.live-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px #4ade80; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.weather-badge { display: block; margin-top: 4px; font-size: 10px; font-weight: 600; letter-spacing: 0.08em; color: #9fb6d6; }
.weather-badge.rain { color: #7cc4ff; }
.weather-badge.storm { color: #ff9f7a; animation: pulse 1s infinite; }

.hud-actions { display: flex; gap: 8px; }
.ghost-btn { padding: 9px 14px; border-radius: 12px; color: #9fb6d6; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; transition: color 0.2s, border-color 0.2s, transform 0.1s; }
.ghost-btn:hover { color: var(--gold-bright); border-color: rgba(212, 168, 67, 0.45); }
.ghost-btn:active { transform: scale(0.96); }
.icon-btn { width: 40px; padding: 0; display: grid; place-items: center; font-size: 14px; }

.fly-hint.strong { color: var(--gold-bright); font-size: 12px; background: rgba(10, 22, 40, 0.7); padding: 8px 16px; border-radius: 999px; border: 1px solid rgba(212, 168, 67, 0.35); animation: pulse 1s infinite; }
.fly-hint { position: absolute; left: 50%; bottom: calc(var(--panel-h) + 22px); transform: translateX(-50%); z-index: 10; color: rgba(90, 112, 144, 0.75); font-size: 11px; letter-spacing: 0.12em; font-weight: 600; animation: pulse 2s infinite; pointer-events: none; }
.wind-msg { position: absolute; left: 50%; top: 170px; transform: translateX(-50%); z-index: 10; padding: 6px 16px; border-radius: 999px; background: rgba(255, 120, 80, 0.12); border: 1px solid rgba(255, 120, 80, 0.35); color: #ffb08f; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; pointer-events: none; animation: pulse 1.2s infinite; }

/* ---------- Barra de tiempo de vuelo ---------- */
.flight-timer { position: absolute; left: 50%; top: 104px; transform: translateX(-50%); z-index: 12; width: min(420px, 78vw); padding: 8px 12px 10px; border-radius: 14px; background: rgba(10, 22, 40, 0.6); border: 1px solid rgba(212, 168, 67, 0.16); backdrop-filter: blur(8px); pointer-events: none; }
.flight-timer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.flight-timer-text { font-family: Orbitron, monospace; font-weight: 900; font-size: 14px; color: var(--gold-bright); min-width: 48px; text-align: right; }
.flight-timer-track { position: relative; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.5); }
.flight-timer-fill { height: 100%; width: 100%; border-radius: 999px; background: linear-gradient(90deg, #8b6914, var(--gold), var(--gold-bright)); box-shadow: 0 0 12px rgba(240, 201, 74, 0.55); transition: width 0.1s linear, background 0.4s; }
.flight-timer-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.25); }
.flight-timer.warn .flight-timer-fill { background: linear-gradient(90deg, #b45309, #f59e0b, #fbbf24); box-shadow: 0 0 12px rgba(251, 191, 36, 0.6); }
.flight-timer.warn .flight-timer-text { color: #fbbf24; }
.flight-timer.danger .flight-timer-fill { background: linear-gradient(90deg, #7f1d1d, #ef4444, #ff7a5c); box-shadow: 0 0 14px rgba(255, 90, 60, 0.7); }
.flight-timer.danger .flight-timer-text { color: #ff7a5c; animation: pulse 0.5s infinite; }
.flight-timer.danger { border-color: rgba(255, 90, 60, 0.45); }

/* ---------- Cuenta regresiva ---------- */
.countdown { position: absolute; inset: 0 0 var(--panel-h) 0; z-index: 25; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; pointer-events: none; background: radial-gradient(circle at center, rgba(10, 22, 40, 0.35), transparent 60%); }
.countdown-label { color: var(--gold); font-size: 12px; letter-spacing: 0.35em; font-weight: 700; }
.countdown-num { font-size: 148px; font-weight: 900; line-height: 1; color: var(--gold-bright); text-shadow: 0 0 40px rgba(240, 201, 74, 0.6), 0 0 90px rgba(240, 201, 74, 0.3); animation: cdpop 1s ease-out; }
.countdown-num.go { font-size: 96px; color: #4ade80; text-shadow: 0 0 40px rgba(74, 222, 128, 0.7); }
@keyframes cdpop { 0% { transform: scale(1.6); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.92); opacity: 0.9; } }
.countdown-sub { color: var(--muted); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; }

/* ---------- Floaters ---------- */
.float-layer { position: absolute; inset: 0; pointer-events: none; z-index: 15; }
.floater { position: absolute; transform: translate(-50%, -50%); font-family: Orbitron, monospace; font-weight: 900; font-size: 18px; animation: floatUp 0.9s ease-out forwards; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.floater.gain { color: var(--gold-bright); }
.floater.loss { color: #ff6b4a; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -160%) scale(1); } }

/* ---------- Resultado ---------- */
.result-overlay { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(2, 6, 16, 0.55); backdrop-filter: blur(3px); animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.result-card { width: 290px; padding: 28px 24px 24px; border-radius: 22px; text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); animation: cardIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes cardIn { from { transform: translateY(24px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.result-icon { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; background: rgba(59, 130, 246, 0.18); border: 1px solid rgba(96, 165, 250, 0.35); }
.result-card.win .result-icon { background: rgba(34, 197, 94, 0.18); border-color: rgba(74, 222, 128, 0.45); }
.result-title { font-size: 20px; font-weight: 900; color: #7cc4ff; margin-bottom: 4px; }
.result-card.win .result-title { color: #4ade80; }
.result-sub { color: var(--muted); font-size: 12px; margin-bottom: 18px; }
.result-stat { margin-bottom: 12px; }
.result-mult { display: block; font-size: 32px; font-weight: 900; color: var(--gold-bright); text-shadow: 0 0 20px rgba(240, 201, 74, 0.4); }
.result-amount-box { padding: 12px; border-radius: 14px; margin-bottom: 18px; border: 1px solid rgba(96, 165, 250, 0.3); background: rgba(59, 130, 246, 0.1); }
.result-amount-box.win { border-color: rgba(74, 222, 128, 0.4); background: rgba(34, 197, 94, 0.1); }
.result-amount { display: block; font-size: 26px; font-weight: 900; color: #7cc4ff; }
.result-amount-box.win .result-amount { color: #4ade80; }

/* ---------- Ayuda ---------- */
.help-overlay { position: absolute; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }
.help-card { width: 100%; max-width: 700px; max-height: 88vh; overflow-y: auto; padding: 26px; border-radius: 22px; }
.help-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.help-kicker { color: var(--gold); font-size: 10px; letter-spacing: 0.25em; text-transform: uppercase; font-weight: 700; margin-bottom: 6px; }
.help-title { font-family: Orbitron, monospace; font-size: 24px; color: var(--gold-bright); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.help-item { padding: 14px; border-radius: 14px; background: rgba(7, 17, 31, 0.7); border: 1px solid rgba(212, 168, 67, 0.1); color: #8da3bd; font-size: 13px; line-height: 1.55; }
.help-item h3 { color: var(--gold-bright); font-size: 13px; margin-bottom: 4px; }
.help-item strong { color: var(--gold-bright); }
.help-note { margin-top: 16px; padding: 14px; border-radius: 14px; border: 1px solid rgba(212, 168, 67, 0.2); background: linear-gradient(90deg, rgba(212, 168, 67, 0.1), rgba(10, 22, 40, 0.3)); color: #b8c7d8; font-size: 13px; line-height: 1.55; }
.help-note strong { color: var(--gold-bright); }

/* ---------- Botones ---------- */
.premium-btn { height: 42px; padding: 0 26px; border: none; border-radius: 14px; font-size: 14px; font-weight: 900; letter-spacing: 0.06em; cursor: pointer; transition: transform 0.12s, filter 0.2s, box-shadow 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.premium-btn.gold { color: var(--sky-dark); background: linear-gradient(90deg, var(--gold), var(--gold-bright)); box-shadow: 0 8px 26px rgba(212, 168, 67, 0.3); }
.premium-btn.blue { color: #fff; background: linear-gradient(90deg, #2563eb, #3b82f6); box-shadow: 0 8px 26px rgba(59, 130, 246, 0.35); }
.premium-btn.disabled, .premium-btn:disabled { filter: grayscale(0.6) brightness(0.7); cursor: not-allowed; box-shadow: none; }
.premium-btn:not(:disabled):hover { filter: brightness(1.08); transform: translateY(-1px); }
.premium-btn:not(:disabled):active { transform: scale(0.97); }
.premium-btn.wide { width: 100%; margin-top: 20px; }
.premium-btn.pulse { animation: glow 1.4s infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 8px 26px rgba(212, 168, 67, 0.3); } 50% { box-shadow: 0 8px 40px rgba(240, 201, 74, 0.65); } }

/* ---------- Panel de apuestas ---------- */
.bet-panel { position: absolute; left: 0; right: 0; bottom: 0; height: var(--panel-h); z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 18px; border-left: 0; border-right: 0; border-bottom: 0; border-top: 1px solid rgba(212, 168, 67, 0.18); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.45); }
.panel-divider { width: 1px; height: 46px; background: linear-gradient(to bottom, transparent, rgba(212, 168, 67, 0.3), transparent); flex-shrink: 0; }
.bet-group { flex: 1; max-width: 230px; }
.bet-input-wrap { position: relative; margin-top: 3px; }
.bet-currency { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--gold); font-weight: 800; font-size: 14px; pointer-events: none; }
#bet-input { width: 100%; height: 34px; padding: 0 30px 0 26px; border-radius: 10px; border: 1px solid rgba(212, 168, 67, 0.28); background: rgba(10, 22, 40, 0.85); color: #fff; font-size: 15px; font-weight: 700; outline: none; -moz-appearance: textfield; appearance: textfield; }
#bet-input::-webkit-inner-spin-button, #bet-input::-webkit-outer-spin-button { -webkit-appearance: none; }
#bet-input:focus { border-color: rgba(212, 168, 67, 0.6); }
#bet-input:disabled { opacity: 0.45; }
.bet-steppers { position: absolute; right: 4px; top: 3px; bottom: 3px; display: flex; flex-direction: column; }
.bet-steppers button { flex: 1; width: 22px; border: none; background: transparent; color: var(--muted); font-size: 8px; cursor: pointer; }
.bet-steppers button:hover { color: var(--gold-bright); }
.quick-bets { display: flex; gap: 4px; margin-top: 5px; }
.quick-bets button { flex: 1; height: 20px; border-radius: 6px; border: 1px solid rgba(212, 168, 67, 0.12); background: rgba(26, 48, 96, 0.45); color: #8da3bd; font-size: 10px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.quick-bets button.active { background: linear-gradient(90deg, var(--gold), var(--gold-bright)); color: var(--sky-dark); border-color: transparent; }
.quick-bets button:disabled { opacity: 0.4; cursor: not-allowed; }
.action-group { display: flex; gap: 10px; }
.balance-group { min-width: 120px; text-align: right; }
.balance-box { display: inline-block; margin-top: 3px; padding: 6px 14px; border-radius: 10px; }
#balance-value { color: var(--gold-bright); font-size: 16px; font-weight: 800; }
#balance-value.flash-win { animation: winflash 0.9s ease-out; }
@keyframes winflash { 0% { color: #4ade80; transform: scale(1.15); } 100% { color: var(--gold-bright); transform: scale(1); } }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  :root { --panel-h: 132px; }
  .bet-panel { flex-wrap: wrap; justify-content: center; gap: 8px; padding: 8px 12px; }
  .bet-group { max-width: none; flex: 1 1 100%; display: grid; grid-template-columns: 130px 1fr; column-gap: 8px; align-items: center; }
  .bet-group .hud-label { grid-column: 1 / -1; }
  .quick-bets { margin-top: 0; }
  .panel-divider { display: none; }
  .action-group { order: 3; }
  .balance-group { order: 2; text-align: left; }
  .brand-title { display: none; }
  .ghost-btn:not(.icon-btn) { padding: 9px 10px; font-size: 10px; }
  .multiplier-hud { min-width: 150px; padding: 6px 14px 8px; }
  .multiplier-value { font-size: 28px; }
  .countdown-num { font-size: 104px; }
}

@media (max-width: 720px) {
  .hud-top { padding: 10px 12px; }
  .multiplier-hud { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); min-width: 150px; }
  .wind-msg { top: 205px; }
  .flight-timer { top: 142px; }
  .hud-actions .ghost-btn:not(.icon-btn) { font-size: 9px; letter-spacing: 0.06em; padding: 9px 8px; }
}

.floater.gain-green { color: #4ade80; text-shadow: 0 0 14px rgba(74, 222, 128, 0.8), 0 2px 8px rgba(0,0,0,0.6); }

/* ---------- Toast / resultado verificable ---------- */
.toast { position: absolute; left: 50%; bottom: calc(var(--panel-h) + 60px); transform: translateX(-50%); z-index: 60; padding: 10px 18px; border-radius: 12px; font-size: 12px; font-weight: 600; background: rgba(120, 20, 20, 0.85); border: 1px solid rgba(255, 90, 60, 0.5); color: #ffd6cc; backdrop-filter: blur(8px); animation: fadeIn 0.25s; max-width: 90vw; text-align: center; }
.toast.info { background: rgba(10, 40, 80, 0.85); border-color: rgba(96, 165, 250, 0.5); color: #dbeafe; }
.fair-box { position: absolute; right: 20px; top: 62px; z-index: 12; padding: 6px 10px; border-radius: 10px; background: rgba(10, 22, 40, 0.55); border: 1px solid rgba(212, 168, 67, 0.12); font-size: 9px; color: #7a90a8; display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.fair-box .hud-label { font-size: 8px; }
.fair-line b { font-family: ui-monospace, monospace; color: #9fb6d6; font-weight: 600; }
@media (max-width: 720px) { .fair-box { display: none; } }
