/* =============================================================
   Mauro Caimi — Trading Desk · Telegram Mini App
   Palette: navy #0a1d3a + yellow #FFD700 (Tradingon brand)
   Fonts: Space Grotesk (headings) + JetBrains Mono (numbers)
   ============================================================= */

:root {
  color-scheme: dark;
  --bg-0: #050a1a;
  --bg-1: #0a1328;
  --bg-2: #0e1a35;
  --bg-3: #152648;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 215, 0, 0.08);
  --border-strong: rgba(255, 215, 0, 0.18);

  --text: #ffffff;
  --text-dim: #9ab0c9;
  --text-mute: #5c6e8c;

  --yellow: #ffd700;
  --yellow-bright: #ffe34a;
  --yellow-dim: #d9a900;
  --yellow-glow: rgba(255, 215, 0, 0.3);

  --green: #10b981;
  --red: #ef4444;
  --red-bright: #f87171;
  --red-glow: rgba(239, 68, 68, 0.3);
  --blue: #3b82f6;
  --cyan: #06b6d4;
  --orange: #f59e0b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-yellow: 0 8px 24px rgba(255, 215, 0, 0.35);
  --shadow-red: 0 8px 24px rgba(239, 68, 68, 0.3);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-0);
  color: var(--text);
  overflow-x: hidden;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(ellipse at top right, rgba(255, 215, 0, 0.1) 0%, transparent 45%),
    radial-gradient(ellipse at bottom left, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
  min-height: 100vh;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 24px 20px 40px;
  max-width: 480px;
  margin: 0 auto;
  animation: fadeIn 0.35s ease-out;
}

.screen.active { display: block; }

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

@supports (padding-top: env(safe-area-inset-top)) {
  .screen {
    padding-top: calc(24px + env(safe-area-inset-top));
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
}

/* =============================================================
   HOME
   ============================================================= */

.hero { text-align: center; margin-bottom: 20px; padding-top: 12px; }

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.15em;
  color: var(--yellow);
  background: var(--yellow-glow);
  border: 1px solid var(--yellow-dim);
  border-radius: 100px;
  margin-bottom: 18px;
}

.hero-title { margin: 0; display: flex; flex-direction: column; gap: 4px; align-items: center; }

.brand-mono {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0.08em;
  color: #fff;
}

.hero-sub {
  position: relative;
  display: inline-block;
  padding: 6px 12px;
  margin-top: 8px;
  background: var(--yellow);
  color: #0a0e1a;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.15em;
  border-radius: 6px;
  box-shadow: 0 4px 20px var(--yellow-glow);
}

.hero-tag {
  font-size: 14px; line-height: 1.5; color: var(--text-dim);
  margin: 18px auto 0; max-width: 320px;
}

.hero-tag b { color: var(--yellow); font-weight: 700; }

/* Rank card */
.rank-card {
  padding: 16px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 215, 0, 0.02));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.rank-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--yellow), transparent);
}
.rank-top { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 10px; }
.rank-label { font-size: 10px; letter-spacing: 0.12em; color: var(--text-mute); font-weight: 700; }
.rank-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px; font-weight: 700; color: var(--yellow);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.rank-xp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px; font-weight: 700;
  color: var(--text);
}
.rank-bar { height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.rank-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--yellow-dim), var(--yellow-bright));
  border-radius: 3px;
  transition: width 0.6s ease;
  box-shadow: 0 0 12px var(--yellow-glow);
}
.rank-next { font-size: 11px; color: var(--text-mute); margin-top: 6px; font-family: 'JetBrains Mono', monospace; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-card {
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.stat-label {
  font-size: 10px; font-weight: 700; color: var(--text-mute);
  letter-spacing: 0.1em; margin-bottom: 4px;
}
.stat-value {
  font-size: 22px; font-weight: 700;
  color: var(--yellow);
  font-family: 'JetBrains Mono', monospace;
}

/* Achievements */
.ach-showcase {
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 20px;
}
.ach-title {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.ach-counter { color: var(--yellow); font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.ach-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ach-chip {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  opacity: 0.25;
  transition: all 0.3s;
}
.ach-chip.unlocked {
  opacity: 1;
  background: rgba(255, 215, 0, 0.12);
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
}

/* Buttons */
.btn-primary {
  width: 100%; padding: 18px 20px;
  background: linear-gradient(135deg, var(--yellow) 0%, var(--yellow-dim) 100%);
  color: #0a0e1a; border: none; border-radius: var(--radius-md);
  font-family: inherit; font-size: 16px; font-weight: 800;
  letter-spacing: 0.12em;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 12px;
  box-shadow: var(--shadow-yellow);
  transition: transform 0.15s ease;
  position: relative; overflow: hidden;
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--yellow-bright) 0%, var(--yellow) 100%);
  opacity: 0; transition: opacity 0.2s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:hover::before { opacity: 1; }
.btn-primary > * { position: relative; z-index: 1; }
.btn-arrow { font-size: 18px; }

.btn-ghost {
  width: 100%; margin-top: 10px; padding: 14px;
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.btn-ghost:active { background: var(--surface-hover); }

.credits {
  text-align: center; font-size: 11px; color: var(--text-mute);
  margin-top: 20px; letter-spacing: 0.08em;
  font-family: 'JetBrains Mono', monospace;
}

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

.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

.hud-lives { display: flex; gap: 2px; font-size: 18px; }
.hud-lives .shield {
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.5));
  transition: all 0.3s;
  color: var(--yellow);
}
.hud-lives .shield.lost {
  filter: grayscale(1);
  opacity: 0.25;
  transform: scale(0.85);
}

.hud-timer {
  position: relative; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
}
.timer-ring { transform: rotate(-90deg); display: block; }
.timer-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 4; }
.timer-progress {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 125.66;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
  filter: drop-shadow(0 0 4px var(--yellow-glow));
}
.timer-progress.warn { stroke: var(--orange); filter: drop-shadow(0 0 4px rgba(245,158,11,0.5)); }
.timer-progress.danger { stroke: var(--red); filter: drop-shadow(0 0 6px var(--red-glow)); animation: pulseRed 0.5s ease infinite alternate; }
@keyframes pulseRed { from { opacity: 1; } to { opacity: 0.55; } }

.timer-num {
  position: absolute;
  font-size: 15px; font-weight: 700; color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}

.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.hud-streak {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.5);
  border-radius: 100px;
  font-size: 12px; font-weight: 800;
  color: var(--cyan);
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s;
}
.hud-streak.hot {
  background: rgba(255, 215, 0, 0.2);
  border-color: var(--yellow);
  color: var(--yellow);
  animation: boltPulse 1s ease infinite;
}
@keyframes boltPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--yellow-glow); transform: scale(1); }
  50% { box-shadow: 0 0 0 6px transparent; transform: scale(1.04); }
}
.bolt { font-size: 12px; }

.hud-score {
  font-size: 15px; font-weight: 700;
  color: var(--yellow);
  font-family: 'JetBrains Mono', monospace;
}

/* Level row */
.level-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.level-pill {
  padding: 6px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 100px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.mult-pill {
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  border-radius: 100px;
  font-size: 13px; font-weight: 800;
  color: #0a0e1a;
  box-shadow: var(--shadow-yellow);
  font-family: 'JetBrains Mono', monospace;
  animation: multPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes multPop {
  from { transform: scale(0) rotate(-10deg); }
  to { transform: scale(1) rotate(0); }
}

.progress-bar { height: 4px; background: var(--surface); border-radius: 2px; overflow: hidden; margin-bottom: 18px; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--yellow-dim), var(--yellow-bright));
  border-radius: 2px; transition: width 0.5s ease;
  box-shadow: 0 0 10px var(--yellow-glow);
}

/* Question card */
.question-card {
  padding: 22px 20px;
  background: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  margin-bottom: 18px; box-shadow: var(--shadow-soft);
  position: relative; overflow: hidden;
  animation: slideIn 0.4s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.question-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--yellow), transparent);
}
.question-number {
  font-size: 10px; font-weight: 700; color: var(--yellow);
  letter-spacing: 0.15em; margin-bottom: 10px;
  font-family: 'JetBrains Mono', monospace;
}
.question-text { font-size: 18px; font-weight: 600; line-height: 1.4; color: var(--text); text-wrap: balance; }

/* Answers */
.answers { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.answer {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  color: var(--text); font-family: inherit; font-size: 15px; font-weight: 500;
  text-align: left; cursor: pointer; transition: all 0.2s; width: 100%; min-width: 0;
  animation: ansIn 0.4s ease backwards;
}
.answer:nth-child(1) { animation-delay: 0.05s; }
.answer:nth-child(2) { animation-delay: 0.1s; }
.answer:nth-child(3) { animation-delay: 0.15s; }
.answer:nth-child(4) { animation-delay: 0.2s; }
@keyframes ansIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
.answer:not(:disabled):active { transform: scale(0.98); }
.answer:not(:disabled):hover { background: var(--surface-hover); border-color: var(--yellow-dim); }
.answer-letter {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: var(--yellow); font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
}
.answer-text { flex: 1; line-height: 1.3; min-width: 0; }
.answer.correct {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--green);
  color: var(--green);
  animation: pulseGreen 0.6s ease;
}
.answer.correct .answer-letter { background: var(--green); border-color: var(--green); color: #052e16; }
.answer.wrong {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--red);
  color: var(--red);
  animation: shake 0.4s ease;
}
.answer.wrong .answer-letter { background: var(--red); border-color: var(--red); color: #fff; }
.answer.hidden-5050 { opacity: 0.25; pointer-events: none; }
.answer:disabled { cursor: default; }

@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Lifelines */
.lifelines { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.lifeline {
  padding: 10px 4px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  font-family: inherit; color: var(--text); cursor: pointer; transition: all 0.2s;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.lifeline:not(:disabled):active { transform: scale(0.96); }
.lifeline:not(:disabled):hover { border-color: var(--yellow); background: var(--yellow-glow); }
.ll-icon { font-size: 15px; font-weight: 800; color: var(--yellow); font-family: 'JetBrains Mono', monospace; }
.ll-label { font-size: 9px; font-weight: 600; color: var(--text-dim); letter-spacing: 0.05em; }
.lifeline.used { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.lifeline.used .ll-icon { color: var(--text-mute); text-decoration: line-through; }

.btn-quit {
  width: 100%; padding: 10px; background: transparent;
  color: var(--text-mute);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.btn-quit:hover { color: var(--yellow); border-color: var(--yellow-dim); }

/* =============================================================
   RESULT
   ============================================================= */

#screen-result {
  text-align: center;
  display: none; flex-direction: column; justify-content: center;
  min-height: 100vh;
  padding-top: calc(40px + env(safe-area-inset-top));
  position: relative;
}
#screen-result.active { display: flex; }

.confetti-canvas {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
}

.result-icon { font-size: 76px; margin-bottom: 8px; animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes popIn { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.result-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px; font-weight: 700; margin: 8px 0 4px;
  color: var(--yellow);
  text-wrap: balance;
  letter-spacing: 0.02em;
}
.result-sub { font-size: 14px; color: var(--text-dim); margin: 0 0 12px; }
.result-prize {
  font-size: 52px; font-weight: 700; color: var(--yellow);
  margin-bottom: 14px; letter-spacing: -0.02em;
  text-shadow: 0 0 40px var(--yellow-glow);
  font-family: 'JetBrains Mono', monospace;
  animation: scoreCount 0.8s ease;
}
@keyframes scoreCount {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.rank-badge {
  display: inline-block;
  margin: 0 auto 20px;
  padding: 6px 16px;
  background: var(--yellow);
  color: #0a0e1a;
  border-radius: 6px;
  font-size: 12px; font-weight: 800;
  letter-spacing: 0.12em;
  box-shadow: 0 4px 16px var(--yellow-glow);
}

.result-stats {
  padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 14px; text-align: left;
  position: relative; z-index: 2;
}
.rs-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.rs-row-last { border-bottom: none; }
.rs-label { font-size: 13px; color: var(--text-dim); }
.rs-value { font-size: 14px; font-weight: 700; color: var(--text); font-family: 'JetBrains Mono', monospace; }

.result-ach {
  padding: 14px 16px; background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: var(--radius-md); margin-bottom: 14px; text-align: left;
  position: relative; z-index: 2;
}
.result-ach-title {
  font-size: 11px; font-weight: 800; color: var(--yellow);
  letter-spacing: 0.12em; margin-bottom: 8px;
}
.result-ach-list { display: flex; flex-direction: column; gap: 6px; }
.result-ach-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text);
}
.result-ach-item .ach-ic { font-size: 18px; }

.disclaimer {
  font-size: 10px; color: var(--text-mute);
  margin-top: 16px; line-height: 1.4; max-width: 300px; margin-left: auto; margin-right: auto;
}

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.82); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  animation: fadeIn 0.2s;
}
.modal-box {
  max-width: 440px; width: 100%; max-height: 90vh; overflow-y: auto;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px 22px; position: relative;
  box-shadow: var(--shadow-soft);
  -webkit-overflow-scrolling: touch;
}
.modal-close {
  position: sticky; top: 0; float: right;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--border-strong);
  color: var(--text); font-size: 18px; font-weight: 700;
  cursor: pointer; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  margin-top: -6px; margin-right: -6px;
}
.modal-close:active { transform: scale(0.92); }
.modal-box h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px; margin: 0 0 16px; color: var(--yellow);
  letter-spacing: 0.02em;
}
.modal-section { margin-bottom: 14px; }
.modal-h { font-size: 13px; font-weight: 800; color: var(--yellow-bright); margin-bottom: 4px; letter-spacing: 0.04em; }
.modal-section p { font-size: 14px; line-height: 1.5; color: var(--text-dim); margin: 0; }
.modal-section b { color: var(--text); }

/* Popups */
.ach-popup {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top));
  left: 50%; transform: translateX(-50%) translateY(-120%);
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--yellow), var(--yellow-dim));
  border-radius: 100px;
  display: flex; align-items: center; gap: 12px;
  color: #0a0e1a;
  box-shadow: 0 10px 30px var(--yellow-glow);
  z-index: 300; opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  max-width: 320px;
}
.ach-popup.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.ach-pop-icon { font-size: 28px; line-height: 1; }
.ach-pop-sub { font-size: 9px; font-weight: 800; letter-spacing: 0.12em; opacity: 0.75; }
.ach-pop-title { font-size: 14px; font-weight: 800; }

.score-pop {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: 48px; font-weight: 800;
  color: var(--green);
  text-shadow: 0 0 20px rgba(16, 185, 129, 0.7);
  opacity: 0; pointer-events: none;
  z-index: 250;
  font-family: 'JetBrains Mono', monospace;
}
.score-pop.show {
  animation: scoreFloat 1.2s ease forwards;
}
@keyframes scoreFloat {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.9); }
}

.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%) translateY(100px);
  padding: 12px 20px; background: var(--bg-3);
  border: 1px solid var(--yellow-dim); border-radius: 100px;
  font-size: 13px; font-weight: 600; color: var(--yellow);
  box-shadow: var(--shadow-soft); opacity: 0;
  transition: all 0.3s ease; z-index: 100; pointer-events: none;
  max-width: 280px; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

.confetti-piece {
  position: absolute;
  width: 8px; height: 14px;
  opacity: 0;
  animation: confettiFall 2.5s linear forwards;
}
@keyframes confettiFall {
  0% { opacity: 1; transform: translateY(-20vh) rotate(0deg); }
  100% { opacity: 0; transform: translateY(100vh) rotate(720deg); }
}

:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
