/* ============================================================
   Vibe Casino™ — style.css
   "Dark, neon, and morally ambiguous. Like the casino itself."

   # Chad from UX designed this. Chad has taste.
   # Chad also designed the near-miss algorithm. Chad is complicated.
   ============================================================ */

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #080b0f;
  --surface:   #0f1318;
  --surface2:  #161c24;
  --border:    #1e2833;
  --green:     #00e87a;
  --green-dim: #00994f;
  --red:       #ff3355;
  --red-dim:   #99001f;
  --gold:      #ffd700;
  --gold-dim:  #997f00;
  --blue:      #4da6ff;
  --text:      #c8d4e0;
  --text-dim:  #6b7a8d;
  --text-muted:#3d4a57;
  --font:      'Courier New', 'Lucida Console', monospace;
  --radius:    6px;
  --glow-green: 0 0 12px rgba(0,232,122,0.4), 0 0 40px rgba(0,232,122,0.15);
  --glow-red:   0 0 12px rgba(255,51,85,0.5),  0 0 40px rgba(255,51,85,0.2);
  --glow-gold:  0 0 12px rgba(255,215,0,0.5),  0 0 40px rgba(255,215,0,0.2);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle scanline overlay. Because aesthetics matter even in ruin. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--gold); }

h1, h2, h3 { color: var(--gold); letter-spacing: 0.04em; }

pre { white-space: pre-wrap; word-break: break-word; }

/* ─── LAYOUT ─── */
.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* ─── NAVBAR ─── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(8,11,15,0.95);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.navbar-logo {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--gold);
  text-shadow: var(--glow-gold);
  letter-spacing: 0.08em;
}
.navbar-logo span { color: var(--green); }

.navbar-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  list-style: none;
}

.navbar-nav a {
  color: var(--text-dim);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.navbar-nav a:hover { color: var(--gold); text-decoration: none; }

/* Language switcher */
.lang-switcher { display: flex; align-items: center; gap: 0.3rem; }
.lang-btn {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: all 0.15s;
  letter-spacing: 0.05em;
}
.lang-btn:hover { color: var(--text); text-decoration: none; }
.lang-btn.active {
  color: var(--gold);
  border-color: rgba(255,215,0,0.3);
  background: rgba(255,215,0,0.06);
  text-decoration: none;
}

.balance-widget {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
  color: var(--green);
  text-shadow: var(--glow-green);
}
.balance-widget .label { color: var(--text-dim); font-size: 0.75rem; }

/* ─── FLASH MESSAGES ─── */
.flash-list {
  list-style: none;
  padding: 0.5rem 1.5rem;
}

.flash {
  padding: 0.7rem 1rem;
  margin: 0.4rem 0;
  border-left: 3px solid;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.88rem;
  background: var(--surface);
}

.flash.success { border-color: var(--green); color: var(--green); }
.flash.error   { border-color: var(--red);   color: var(--red); }
.flash.info    { border-color: var(--blue);   color: var(--blue); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  border: 1px solid;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  text-transform: uppercase;
  font-weight: bold;
}

.btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: #000;
  box-shadow: var(--glow-green);
}
.btn-primary:hover {
  background: #00ff88;
  box-shadow: 0 0 20px rgba(0,232,122,0.6), 0 0 60px rgba(0,232,122,0.3);
  transform: translateY(-1px);
  text-decoration: none;
  color: #000;
}

.btn-danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
  box-shadow: var(--glow-red);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
  font-size: 0.8rem;
}
.btn-ghost:hover { border-color: var(--text-dim); color: var(--text); text-decoration: none; }

.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #000;
  box-shadow: var(--glow-gold);
}
.btn-gold:hover {
  background: #ffe44d;
  box-shadow: 0 0 24px rgba(255,215,0,0.7);
  transform: translateY(-1px);
  text-decoration: none;
  color: #000;
}

.btn:disabled, .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── FORMS ─── */
.form-card {
  max-width: 440px;
  margin: 3rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
}

.form-card h1 {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
  text-align: center;
}

.form-card .subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.form-group { margin-bottom: 1.2rem; }

label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color 0.2s;
  outline: none;
}

input:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(0,232,122,0.1);
}

textarea { resize: vertical; min-height: 90px; }

.form-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.disclaimer {
  margin-top: 1.5rem;
  padding: 0.8rem;
  background: rgba(255,215,0,0.04);
  border: 1px solid rgba(255,215,0,0.15);
  border-radius: var(--radius);
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── LANDING PAGE ─── */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 85vh;
  text-align: center;
  padding: 2rem;
}

.casino-ascii {
  font-size: clamp(0.4rem, 1.2vw, 0.7rem);
  line-height: 1.2;
  color: var(--gold);
  text-shadow: var(--glow-gold);
  margin-bottom: 1.5rem;
  white-space: pre;
}

.landing-tagline {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  letter-spacing: 0.08em;
}

.landing-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.landing-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.marquee-wrap {
  width: 100%;
  max-width: 700px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  margin: 2rem 0;
  background: var(--surface);
}

.marquee-inner {
  display: inline-block;
  white-space: nowrap;
  animation: marquee 30s linear infinite;
  color: var(--text-dim);
  font-size: 0.8rem;
}

@keyframes marquee {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

.stats-bar {
  display: flex;
  gap: 3rem;
  margin: 1.5rem 0;
  justify-content: center;
}

.stat-item { text-align: center; }
.stat-value { font-size: 1.5rem; color: var(--gold); display: block; }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

/* ─── GAME PAGE ─── */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  margin-top: 2rem;
}

@media (max-width: 750px) {
  .game-layout { grid-template-columns: 1fr; }
}

/* ─── SLOT MACHINE ─── */
.slot-machine-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}

.machine-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.slot-machine {
  display: inline-flex;
  gap: 1rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  position: relative;
  /* The neon glow. For ambiance. For hope. For marketing. */
  box-shadow: 0 0 0 1px rgba(255,215,0,0.05),
              inset 0 0 60px rgba(0,0,0,0.5);
}

/* The center "payline" indicator. Very important. Completely cosmetic. */
.slot-machine::before,
.slot-machine::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  pointer-events: none;
}
.slot-machine::before { background: rgba(255,215,0,0.15); }

.reel-container {
  width: 100px;
  height: 100px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  position: relative;
}

/* Fade top/bottom of each reel window. Depth illusion. */
.reel-container::before,
.reel-container::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 25px;
  z-index: 2;
  pointer-events: none;
}
.reel-container::before { top: 0; background: linear-gradient(to bottom, var(--surface2), transparent); }
.reel-container::after  { bottom: 0; background: linear-gradient(to top, var(--surface2), transparent); }

.reel-strip {
  display: flex;
  flex-direction: column;
  /* Will be animated by JS via CSS classes */
  transition: none;
}

.reel-symbol {
  width: 100px;
  height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 2rem;
  line-height: 1;
}

.reel-symbol .sym-name {
  font-size: 0.55rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  text-align: center;
  letter-spacing: 0.03em;
}

/* The near-miss glow: when 2 jackpot symbols show, the third reel border pulses gold */
.reel-container.near-miss-last {
  border-color: var(--gold);
  box-shadow: var(--glow-gold);
  animation: near-miss-pulse 0.6s ease 3;
}

@keyframes near-miss-pulse {
  0%   { box-shadow: var(--glow-gold); }
  50%  { box-shadow: 0 0 30px rgba(255,215,0,0.8), 0 0 80px rgba(255,215,0,0.4); }
  100% { box-shadow: var(--glow-gold); }
}

/* Win animation. Never actually fires in production. A prayer rendered in CSS. */
@keyframes win-flash {
  0%, 100% { border-color: var(--gold); box-shadow: var(--glow-gold); }
  50%       { border-color: #fff;       box-shadow: 0 0 50px rgba(255,255,255,0.8); }
}
.reel-container.win-flash {
  animation: win-flash 0.3s ease 6;
}

/* Spinning animation keyframes for the reel strips */
@keyframes reel-spin-a {
  0%   { transform: translateY(0px); }
  100% { transform: translateY(-2400px); }
}
@keyframes reel-spin-b {
  0%   { transform: translateY(0px); }
  100% { transform: translateY(-2400px); }
}
@keyframes reel-spin-c {
  0%   { transform: translateY(0px); }
  100% { transform: translateY(-2400px); }
}

.reel-strip.spinning-a {
  animation: reel-spin-a 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.reel-strip.spinning-b {
  animation: reel-spin-b 0.95s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  animation-delay: 0.15s;
}
.reel-strip.spinning-c {
  animation: reel-spin-c 1.1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  animation-delay: 0.3s;
}

/* ─── SPIN CONTROLS ─── */
.spin-controls {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#spin-btn {
  font-size: 1.2rem;
  padding: 1rem 3rem;
  letter-spacing: 0.15em;
  position: relative;
  overflow: hidden;
}

/* The shimmer effect on the spin button. Psychological. */
#spin-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: rgba(255,255,255,0.1);
  transform: skewX(-20deg);
  animation: btn-shimmer 3s ease-in-out infinite;
}

@keyframes btn-shimmer {
  0%   { left: -75%; }
  60%  { left: 125%; }
  100% { left: 125%; }
}

.bet-display {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ─── NEAR MISS MESSAGE ─── */
.near-miss-container {
  min-height: 2.5rem;
  margin-top: 1.5rem;
  padding: 0.8rem 1rem;
  background: rgba(255,215,0,0.04);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.85rem;
  color: var(--gold);
  line-height: 1.5;
  display: none;
}

.near-miss-container.visible { display: block; }

/* Typewriter cursor */
.near-miss-container::after {
  content: '▋';
  animation: cursor-blink 0.7s step-end infinite;
}
.near-miss-container.done::after { display: none; }

@keyframes cursor-blink {
  50% { opacity: 0; }
}

/* ─── GASLIGHT MESSAGE ─── */
.gaslight-container {
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  background: rgba(77,166,255,0.06);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.82rem;
  color: var(--blue);
  line-height: 1.5;
  display: none;
}
.gaslight-container.visible { display: block; }

/* ─── RESULT FLASH ─── */
.result-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 500;
}

.result-badge {
  padding: 1rem 2.5rem;
  border-radius: var(--radius);
  font-size: 1.8rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.15s ease;
}

.result-badge.show {
  opacity: 1;
  transform: scale(1);
}

.result-badge.loss {
  background: rgba(255,51,85,0.2);
  border: 2px solid var(--red);
  color: var(--red);
  box-shadow: var(--glow-red);
}

.result-badge.win {
  background: rgba(255,215,0,0.2);
  border: 2px solid var(--gold);
  color: var(--gold);
  box-shadow: var(--glow-gold);
}

/* ─── SIDEBAR / STATS ─── */
.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
}

.stat-card h3 {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.stat-row:last-child { border-bottom: none; }

.stat-row .key   { color: var(--text-dim); }
.stat-row .val   { color: var(--green); font-weight: bold; }
.stat-row .val.red { color: var(--red); }
.stat-row .val.gold { color: var(--gold); }

.sidebar-actions { display: flex; flex-direction: column; gap: 0.6rem; }

/* ─── WHALE BANNER ─── */
.whale-banner {
  display: none;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(0,30,60,0.8), rgba(0,60,30,0.8));
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--blue);
  animation: whale-glow 2s ease-in-out infinite;
}
.whale-banner.visible { display: block; }

@keyframes whale-glow {
  0%, 100% { box-shadow: 0 0 15px rgba(77,166,255,0.3); border-color: var(--blue); }
  50%       { box-shadow: 0 0 25px rgba(255,215,0,0.3); border-color: var(--gold); }
}

/* ─── SUPPORT PAGE ─── */
.support-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (max-width: 750px) { .support-layout { grid-template-columns: 1fr; } }

.support-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.support-card h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.ticket-type-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.ticket-btn {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.ticket-btn:hover { border-color: var(--green); color: var(--green); }
.ticket-btn.active { border-color: var(--gold); color: var(--gold); }

.response-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 500px;
  overflow-y: auto;
}

.ticket-history {
  margin-top: 2rem;
}

.ticket-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
}

.ticket-item .ticket-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.ticket-item .ticket-type {
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* ─── CASHOUT PAGE ─── */
.cashout-wrap {
  max-width: 600px;
  margin: 3rem auto;
}

.cashout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
}

.loss-amount {
  font-size: 2.5rem;
  color: var(--red);
  text-shadow: var(--glow-red);
  text-align: center;
  margin: 1rem 0;
}

.cashout-warning {
  background: rgba(255,51,85,0.06);
  border: 1px solid rgba(255,51,85,0.2);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--red);
}

.cashout-cta {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.one-more-spin-btn {
  font-size: 1.1rem;
  padding: 1.1rem;
  width: 100%;
  animation: cta-pulse 2s ease-in-out infinite;
}

@keyframes cta-pulse {
  0%, 100% { box-shadow: var(--glow-green); }
  50%       { box-shadow: 0 0 30px rgba(0,232,122,0.7), 0 0 80px rgba(0,232,122,0.3); }
}

.actual-cashout {
  font-size: 0.75rem;
  padding: 0.5rem;
  opacity: 0.5;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  background: none;
  border: none;
  font-family: var(--font);
  width: 100%;
  transition: opacity 0.2s;
}
.actual-cashout:hover { opacity: 1; color: var(--text-dim); }

/* ─── FAREWELL PAGE ─── */
.farewell-wrap {
  max-width: 640px;
  margin: 4rem auto;
  text-align: center;
}

.farewell-skull {
  font-size: 4rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 20px rgba(255,51,85,0.5));
}

.farewell-stats {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
  text-align: left;
}

.farewell-sign-off {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.8;
  margin: 1.5rem 0;
}

/* ─── RESPONSIBLE GAMBLING BAR ─── */
/* Required by law. Styled by people who are paid to minimize its impact. */
.rg-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15,19,24,0.98);
  border-top: 1px solid var(--border);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.rg-bar.visible { transform: translateY(0); }

.rg-bar a { color: var(--text-muted); text-decoration: underline; }

.rg-dismiss {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 1rem;
}

/* ─── MISC ─── */
.page-header {
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.page-header h1 { font-size: 1.4rem; }
.page-header p  { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.3rem; }

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Scrollbar: make it look like something from a 90s slot machine UI */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── FULLSCREEN WIN OVERLAY ────────────────────────────────────────────────
   The crown jewel. The party. The thing that happens 7% of the time.
   We spent 80% of the frontend time on this. It shows 7% of the time.
   Worth it.
   ─────────────────────────────────────────────────────────────────────────── */

#win-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#win-overlay.active {
  opacity: 1;
  pointer-events: all;
}

#confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#win-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 3rem 4rem;
  border-radius: 20px;
  border: 2px solid var(--gold);
  background: rgba(10, 11, 15, 0.85);
  backdrop-filter: blur(10px);
  box-shadow: var(--glow-gold), 0 0 80px rgba(255, 215, 0, 0.2);
  max-width: 500px;
  width: 90vw;
  animation: win-content-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes win-content-pop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

#win-emoji {
  font-size: 5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  animation: win-emoji-bounce 0.6s ease 0.2s both;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
}
@keyframes win-emoji-bounce {
  0%   { transform: scale(0) rotate(-20deg); }
  70%  { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

#win-tier-name {
  font-size: 2.2rem;
  font-weight: bold;
  color: var(--gold);
  text-shadow: var(--glow-gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  animation: win-glow-pulse 1.5s ease-in-out infinite;
}
@keyframes win-glow-pulse {
  0%, 100% { text-shadow: 0 0 10px rgba(255,215,0,0.5); }
  50%       { text-shadow: 0 0 30px rgba(255,215,0,1), 0 0 60px rgba(255,215,0,0.5); }
}

#win-amount {
  font-size: 3.5rem;
  font-weight: bold;
  color: var(--green);
  text-shadow: var(--glow-green);
  margin: 0.5rem 0;
  letter-spacing: -0.02em;
}

#win-subtitle {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 1rem 0 1.5rem;
  font-style: italic;
}

#win-close-btn {
  background: var(--gold);
  border: none;
  border-radius: var(--radius);
  color: #000;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  padding: 0.8rem 2.5rem;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--glow-gold);
}
#win-close-btn:hover {
  background: #ffe44d;
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(255,215,0,0.7);
}

/* Tier-specific colors */
#win-overlay.mini    #win-tier-name { color: var(--text-dim);   text-shadow: none; }
#win-overlay.small   #win-tier-name { color: var(--blue);       text-shadow: 0 0 15px rgba(77,166,255,0.5); }
#win-overlay.big     #win-tier-name { color: var(--green);      text-shadow: var(--glow-green); }
#win-overlay.huge    #win-overlay.huge #win-content { border-color: var(--red); box-shadow: var(--glow-red), 0 0 80px rgba(255,51,85,0.2); }
#win-overlay.jackpot #win-content   { border-color: var(--gold); animation: jackpot-border 1s ease-in-out infinite; }
@keyframes jackpot-border {
  0%, 100% { box-shadow: var(--glow-gold), 0 0 80px rgba(255,215,0,0.3); border-color: var(--gold); }
  50%       { box-shadow: 0 0 40px rgba(255,215,0,1), 0 0 120px rgba(255,215,0,0.5); border-color: #fff; }
}

/* ─── FLOATING SUPPORT CHAT ─────────────────────────────────────────────────
   The crown jewel of the UI. An illusion of help, rendered in CSS.
   Now available on every page. Like anxiety, but with a button.
   ─────────────────────────────────────────────────────────────────────────── */

#chat-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

/* The toggle bubble. Round. Green. Inviting. Lying. */
#chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green);
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  box-shadow: var(--glow-green), 0 4px 20px rgba(0,0,0,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  flex-shrink: 0;
}
#chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(0,232,122,0.7), 0 4px 30px rgba(0,0,0,0.5);
}
#chat-toggle:active { transform: scale(0.95); }

/* Notification badge — shows "!" when there's a new bot response */
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-red);
  animation: badge-pulse 1.5s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.2); }
}

/* The chat panel. Slides up from the button. */
.chat-panel {
  width: 360px;
  max-height: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,232,122,0.05);
  /* Hidden state */
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  transform-origin: bottom right;
}
.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

@media (max-width: 420px) {
  .chat-panel { width: calc(100vw - 2rem); }
  #chat-widget { right: 1rem; bottom: 1rem; }
}

/* Chat header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-title  { font-size: 0.9rem; color: var(--gold); font-weight: bold; }
.chat-status { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; display: flex; align-items: center; gap: 0.4rem; }

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: var(--glow-green);
  animation: status-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.chat-close-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-close-btn:hover { border-color: var(--red); color: var(--red); }

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-height: 160px;
  max-height: 260px;
}

.chat-msg { display: flex; flex-direction: column; }
.chat-msg.bot  { align-items: flex-start; }
.chat-msg.user { align-items: flex-end; }

.msg-bubble {
  max-width: 88%;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.bot  .msg-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 2px;
  color: var(--text);
}
.chat-msg.user .msg-bubble {
  background: rgba(0,232,122,0.08);
  border: 1px solid rgba(0,232,122,0.2);
  border-bottom-right-radius: 2px;
  color: var(--green);
}

.msg-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  padding: 0 0.2rem;
}

/* Typing indicator — shows while waiting for bot "response" (0.3s, it's instant, but theatre matters) */
.typing-indicator .msg-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0.7rem 1rem;
}
.typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* Input area */
.chat-input-area {
  padding: 0.8rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-quick-btns {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-quick-btn {
  width: 100%;
  padding: 0.55rem 0.8rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.chat-quick-btn:hover         { border-color: var(--green); color: var(--green); }
.chat-quick-btn.selected      { border-color: var(--gold);  color: var(--gold); background: rgba(255,215,0,0.05); }
.chat-quick-btn:disabled      { opacity: 0.4; cursor: not-allowed; }

#chat-angry-input {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  resize: vertical;
  min-height: 60px;
  outline: none;
}
#chat-angry-input:focus { border-color: var(--red); }
