
/* ═══════════════════════════════════════════════════════════
   S.A.F COIN GAME — STANDALONE BASE STYLES
   Mirrors the relevant sections of the main site's CSS so
   coin.js / coin-multi-ui.js class names all resolve correctly.
════════════════════════════════════════════════════════════ */
:root {
  --gold:              #c9a84c;
  --gold-bright:       #e8c46a;
  --gold-pale:         #f0d98a;
  --gold-dim:          rgba(156,45,71,0.14);
  --gold-glow:         rgba(156,45,71,0.07);
  --gold-border:       rgba(156,45,71,0.22);
  --gold-border-strong:rgba(156,45,71,0.50);
  --maroon:            #7a1e30;
  --maroon-dark:       #3d0f18;
  --crimson:           #d63447;
  --bg:                #050305;
  --bg2:               #0a070a;
  --surface:           rgba(16,11,16,0.94);
  --surface2:          rgba(26,19,26,0.80);
  --surface3:          rgba(36,27,36,0.60);
  --text:              #ede8da;
  --text-m:            #b5ad9d;
  --text-dim:          #6e6660;
  --green:             #4ade80;
  --red:               #ef4444;
  --blue:              #60a5fa;
  --amber:             #f59e0b;

  --font-title:   'Cinzel', serif;
  --font-display: 'Cormorant Garamond', serif;
  --font-body:    'DM Sans', sans-serif;

  --safe-top:   env(safe-area-inset-top, 0px);
  --safe-bot:   env(safe-area-inset-bottom, 0px);

  --radius:    16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --ease:         cubic-bezier(.22,1,.36,1);
  --ease-spring:  cubic-bezier(.34,1.56,.64,1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Page wrapper ─────────────────────────────────────── */
#site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────── */
#site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gold-dim);
  background: linear-gradient(135deg, rgba(5,3,5,0.98), rgba(10,7,10,0.98));
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.header-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--gold-border);
}

.header-brand-text .brand-primary {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 2px;
}

.header-brand-text .brand-secondary {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-back-link {
  font-family: var(--font-title);
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 0.5px;
  padding: 6px 14px;
  border: 1px solid rgba(156,45,71,0.15);
  border-radius: 20px;
  transition: all 0.2s;
}

.header-back-link:hover {
  color: var(--gold);
  border-color: var(--gold-border);
  background: rgba(156,45,71,0.05);
}

/* ── Auth strip ───────────────────────────────────────── */
#auth-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(10,7,10,0.6);
  border-bottom: 1px solid rgba(156,45,71,0.08);
  font-size: 12px;
  color: var(--text-dim);
  gap: 12px;
  flex-wrap: wrap;
}

.auth-strip-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.3s;
}

.auth-dot.online { background: var(--green); box-shadow: 0 0 6px rgba(74,222,128,0.5); }

/* hidden span that coin-multi-ui.js reads for the player display name */
#account-name {
  display: none;
}

/* ── Main scroll area ─────────────────────────────────── */
#main-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Games page — matches id="games" coin-multi-ui.js expects ── */
#games {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.page-eyebrow {
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.page-hero {
  margin-bottom: 36px;
}

.page-hero h1 {
  font-family: var(--font-title);
  font-size: 32px;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.page-hero p {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-m);
  font-style: italic;
}

/* ── Section labels ───────────────────────────────────── */
.section-label {
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gold-dim);
}

/* ── Game lobby card ──────────────────────────────────── */
.game-lobby-card {
  background: linear-gradient(145deg, var(--surface) 0%, rgba(12,5,8,0.6) 100%);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(156,45,71,0.1);
}

.game-lobby-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--maroon), var(--gold), var(--gold-bright), var(--gold));
  box-shadow: 0 2px 12px rgba(156,45,71,0.4);
}

.game-lobby-card::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(156,45,71,0.03) 0%, transparent 70%);
  pointer-events: none;
}

.game-lobby-desc {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text-m);
  font-style: italic;
  margin-bottom: 22px;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

/* ── Mode row ─────────────────────────────────────────── */
.game-mode-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.game-mode-btn {
  flex: 1;
  min-width: 130px;
  background: linear-gradient(145deg, rgba(12,5,8,0.95) 0%, rgba(8,4,6,0.9) 100%);
  border: 1.5px solid rgba(156,45,71,0.25);
  border-radius: 12px;
  padding: 18px 20px;
  cursor: pointer;
  color: var(--text-m);
  transition: all 0.25s var(--ease-spring);
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.game-mode-btn:hover {
  border-color: rgba(156,45,71,0.7);
  background: linear-gradient(145deg, rgba(156,45,71,0.12) 0%, rgba(156,45,71,0.06) 100%);
  color: var(--gold-bright);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(156,45,71,0.2);
}

.game-mode-btn.active {
  border-color: var(--gold);
  background: linear-gradient(145deg, rgba(156,45,71,0.18) 0%, rgba(156,45,71,0.08) 100%);
  color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(156,45,71,0.3), 0 8px 24px rgba(156,45,71,0.25);
}

.gmb-title {
  font-family: var(--font-title);
  font-size: 15px;
  letter-spacing: 1.2px;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--gold);
}

.game-mode-btn:hover .gmb-title,
.game-mode-btn.active .gmb-title {
  color: var(--gold-bright);
}

.gmb-sub {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-style: italic;
  letter-spacing: 0.3px;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.btn-gold {
  background: linear-gradient(135deg, #b8922a, #c9a84c, #e8c46a, #c9a84c);
  background-size: 200% 200%;
  color: #0a0608;
  box-shadow: 0 4px 16px rgba(156,45,71,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(156,45,71,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
  background-position: 100% 0;
}

.btn-gold:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gold-border);
  color: var(--text-m);
}

.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(156,45,71,0.06);
}

/* ── Game info card ───────────────────────────────────── */
.game-info-card {
  background: linear-gradient(145deg, var(--surface) 0%, rgba(12,5,8,0.6) 100%);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(156,45,71,0.1);
}

.game-info-section { margin-bottom: 20px; position: relative; z-index: 1; }
.game-info-section:last-child { margin-bottom: 0; }

.game-info-section h3 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.game-info-section p {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-m);
  line-height: 1.6;
  margin: 0;
}

.game-info-section ul { list-style: none; padding: 0; margin: 0; }

.game-info-section li {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-m);
  line-height: 1.6;
  padding: 6px 0 6px 16px;
  position: relative;
}

.game-info-section li::before {
  content: '◆';
  position: absolute;
  left: 0; top: 8px;
  color: var(--gold);
  font-size: 8px;
}

.game-info-section strong { color: var(--gold); font-weight: 600; }

/* ── Leaderboard tables ───────────────────────────────── */
.coin-lb-wrap {
  background: linear-gradient(145deg, var(--surface) 0%, rgba(12,5,8,0.5) 100%);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  margin-bottom: 8px;
}

.coin-lb-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.coin-lb-table th {
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.3) 100%);
  padding: 14px 16px;
  text-align: left;
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 2px solid rgba(156,45,71,0.25);
  font-weight: 700;
}

.coin-lb-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(156,45,71,0.08);
  color: var(--text);
  font-family: var(--font-display);
}

.coin-lb-table tbody tr:last-child td { border-bottom: 0; }
.coin-lb-table tbody tr:hover td { background: rgba(156,45,71,0.06); transition: background 0.2s; }
.coin-lb-empty { text-align: center; padding: 32px !important; color: var(--text-dim); font-style: italic; font-size: 14px; }
.coin-lb-top td { color: var(--gold-bright); font-family: var(--font-title); background: rgba(156,45,71,0.08); }
.coin-lb-rank { font-family: var(--font-title); font-size: 13px; color: var(--text-dim); font-weight: 600; }
.coin-lb-name { font-family: var(--font-title); font-size: 14px; font-weight: 500; color: var(--text); }
.coin-lb-wins { font-family: var(--font-title); font-size: 16px; font-weight: 700; color: var(--gold); text-shadow: 0 0 10px rgba(156,45,71,0.3); }
.coin-lb-games { color: var(--text-dim); font-size: 13px; font-family: var(--font-display); }
.coin-lb-winrate { font-family: var(--font-title); font-size: 14px; color: var(--gold-bright); text-align: right; font-weight: 600; }
.coin-lb-elims { font-family: var(--font-title); font-size: 14px; color: var(--text-m); text-align: right; font-weight: 500; }

/* ── Game result stats box ────────────────────────────── */
.coin-result-stats {
  background: rgba(156,45,71,0.05);
  border: 1px solid rgba(156,45,71,0.18);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.crs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-dim);
}

.crs-row b {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(156,45,71,0.25);
}

/* ── Coin game overlay ────────────────────────────────── */
#coin-game-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: #07040a;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

#coin-game-overlay.active { display: flex; }
#coin-game-canvas { display: block; max-width: 100%; max-height: 100vh; }

.coin-game-close-btn {
  position: absolute; top: 16px; right: 16px;
  background: rgba(12,8,12,0.92);
  border: 1px solid rgba(156,45,71,0.35);
  color: var(--gold);
  width: 42px; height: 42px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s;
}

.coin-game-close-btn:hover {
  background: rgba(156,45,71,0.15);
  border-color: var(--gold);
}

#coin-result-panel {
  position: absolute; bottom: 40px; left: 50%;
  transform: translateX(-50%);
  background: rgba(8,5,8,0.97);
  border: 1px solid rgba(156,45,71,0.45);
  border-radius: 18px;
  padding: 28px 36px;
  text-align: center;
  display: none;
  min-width: 270px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.7);
}

#coin-result-panel.active { display: block; animation: pageIn 0.4s var(--ease-spring); }

@keyframes pageIn {
  from { opacity: 0; transform: translateX(-50%) scale(0.94) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

.coin-result-msg {
  font-family: var(--font-title);
  font-size: 22px;
  color: var(--gold-bright);
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.coin-result-sub {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 20px;
}

.coin-result-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Page footer ──────────────────────────────────────── */
.page-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  padding: 28px 0 12px;
  border-top: 1px solid var(--gold-dim);
  margin-top: 40px;
  font-family: var(--font-display);
}

.page-footer span { color: var(--gold); }

/* ── Toast notification ───────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(12,8,12,0.97);
  border: 1px solid var(--gold-border);
  border-radius: 12px;
  padding: 12px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
  backdrop-filter: blur(12px);
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Sign-in modal ────────────────────────────────────── */
#signin-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#signin-modal.active { display: flex; }

.signin-box {
  background: linear-gradient(145deg, rgba(18,10,28,0.99), rgba(8,4,14,0.99));
  border: 1px solid var(--gold-border-strong);
  border-radius: 20px;
  padding: 36px 32px;
  max-width: 360px;
  width: 100%;
  position: relative;
}

.signin-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-bright);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.signin-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
  font-style: italic;
}

.signin-field {
  margin-bottom: 14px;
}

.signin-label {
  display: block;
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.signin-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.signin-input:focus { border-color: var(--gold); }

.signin-error {
  font-size: 12px;
  color: var(--red);
  min-height: 18px;
  margin-bottom: 14px;
}

.signin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.signin-close {
  position: absolute;
  top: 16px; right: 16px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.2s;
}

.signin-close:hover { color: var(--gold); }

/* ── Mobile tweaks ────────────────────────────────────── */
@media (max-width: 520px) {
  #games { padding: 24px 16px 80px; }
  .page-hero h1 { font-size: 26px; }
  .game-lobby-card { padding: 22px 20px; }
  .game-mode-btn { min-width: 110px; padding: 14px 14px; }
  .gmb-title { font-size: 13px; }
  .coin-result-stats { grid-template-columns: 1fr; gap: 8px; }
  .game-info-card { padding: 20px 18px; }
}
  