@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Barlow:wght@300;400;500;600&display=swap');

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

:root {
  --black: #0a0a0a;
  --bg: #111;
  --surface: #1a1a1a;
  --surface2: #222;
  --surface3: #2a2a2a;
  --olive: #4a5c2a;
  --olive-light: #6b7f45;
  --olive-bright: #8fa64e;
  --red: #c0392b;
  --red-light: #e74c3c;
  --gold: #c9a227;
  --silver: #9b9b9b;
  --bronze: #cd7f32;
  --text: #e8e4d8;
  --text-muted: #888;
  --text-dim: #555;
  --border: #333;
  --border-light: #444;
}

html, body {
  height: 100%;
  background: var(--black);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-weight: 400;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display { font-family: 'Bebas Neue', sans-serif; letter-spacing: 0.05em; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--black);
  position: relative;
  overflow-x: hidden;
}

/* ── AUTH ── */
.auth-screen {
  min-height: 100dvh;
  background: linear-gradient(160deg, #0a0a0a 0%, #1a1f0f 50%, #0a0a0a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.auth-logo { font-family: 'Bebas Neue', sans-serif; font-size: 3.5rem; letter-spacing: 0.1em; color: var(--olive-bright); text-align: center; line-height: 1; margin-bottom: 0.25rem; }
.auth-sub { font-size: 0.75rem; letter-spacing: 0.3em; color: var(--text-muted); text-transform: uppercase; text-align: center; margin-bottom: 3rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2rem; width: 100%; max-width: 360px; }
.auth-btn { width: 100%; padding: 15px; border: none; border-radius: 10px; font-family: 'Barlow', sans-serif; font-size: 1rem; font-weight: 600; cursor: pointer; letter-spacing: 0.05em; transition: all 0.2s; text-transform: uppercase; }
.btn-primary { background: var(--olive); color: #fff; margin-bottom: 0.75rem; }
.btn-primary:hover, .btn-primary:active { background: var(--olive-light); transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border-light); }
.btn-secondary:hover, .btn-secondary:active { background: var(--surface2); }
.divider { text-align: center; color: var(--text-dim); font-size: 0.8rem; margin: 1.25rem 0; position: relative; }
.divider::before, .divider::after { content: ''; position: absolute; top: 50%; width: 42%; height: 1px; background: var(--border); }
.divider::before { left: 0; } .divider::after { right: 0; }
.biometric-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 13px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; color: var(--text-muted); font-family: 'Barlow', sans-serif; font-size: 0.9rem; cursor: pointer; transition: all 0.2s; }
.biometric-btn:hover { border-color: var(--olive-light); color: var(--olive-bright); }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.88); z-index: 100; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal { background: var(--surface); border: 1px solid var(--border-light); border-radius: 18px 18px 0 0; width: 100%; max-width: 480px; max-height: 92dvh; overflow-y: auto; padding: 1.75rem 1.5rem 2rem; animation: slide-up 0.28s cubic-bezier(0.32,0.72,0,1); }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 36px; height: 4px; background: var(--border-light); border-radius: 2px; margin: 0 auto 1.5rem; }
.modal-title { font-family: 'Bebas Neue', sans-serif; font-size: 1.7rem; color: var(--olive-bright); margin-bottom: 1.25rem; letter-spacing: 0.05em; }
.form-group { margin-bottom: 1rem; }
.form-label { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.4rem; display: block; }
.form-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--text); font-family: 'Barlow', sans-serif; font-size: 1rem; outline: none; transition: border-color 0.2s; -webkit-appearance: none; }
.form-input:focus { border-color: var(--olive-bright); }
.form-input::placeholder { color: var(--text-dim); }
select.form-input { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.btn-sm { padding: 12px 20px; border-radius: 10px; font-family: 'Barlow', sans-serif; font-size: 0.9rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.18s; letter-spacing: 0.03em; }
.btn-olive { background: var(--olive); color: #fff; flex: 1; }
.btn-olive:hover, .btn-olive:active { background: var(--olive-light); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover, .btn-ghost:active { color: var(--text); border-color: var(--border-light); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-light); }

/* ── BOTTOM NAV ── */
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: rgba(12,12,12,0.97); border-top: 1px solid var(--border); display: flex; z-index: 50; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding-bottom: env(safe-area-inset-bottom); }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 10px 0 12px; cursor: pointer; transition: color 0.2s; color: var(--text-dim); gap: 4px; user-select: none; }
.nav-item.active { color: var(--olive-bright); }
.nav-item svg { width: 24px; height: 24px; }
.nav-label { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 500; }

/* ── PAGE SHELL ── */
.page-header { padding: 3.5rem 1.25rem 1rem; background: linear-gradient(180deg, rgba(26,31,15,0.85) 0%, transparent 100%); }
.page-title { font-family: 'Bebas Neue', sans-serif; font-size: 2.2rem; color: var(--olive-bright); letter-spacing: 0.08em; }
.page-subtitle { font-size: 0.75rem; color: var(--text-muted); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 3px; }
.page-content { padding: 0 1.25rem 6rem; }

/* ── WELCOME ── */
.rule-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; }
.rule-card h3 { font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--olive-bright); margin-bottom: 0.75rem; font-weight: 600; }
.rule-item { font-size: 0.875rem; color: var(--text-muted); padding: 0.45rem 0; border-bottom: 1px solid var(--border); line-height: 1.55; }
.rule-item:last-child { border-bottom: none; padding-bottom: 0; }
.rule-item strong { color: var(--text); font-weight: 600; }
.blind-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.blind-table th { background: var(--surface2); color: var(--olive-bright); padding: 8px 10px; text-align: left; font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
.blind-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.blind-table tr:hover td { background: var(--surface2); color: var(--text); }
.break-row td { background: rgba(74,92,42,0.12); color: var(--olive-light); font-size: 0.72rem; text-align: center; font-style: italic; }
.payout-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.payout-table th { background: var(--surface2); color: var(--olive-bright); padding: 8px 8px; font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.payout-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); color: var(--text-muted); text-align: center; }
.payout-table tbody tr:first-child td { color: var(--gold); font-weight: 600; }

/* ── EVENTS ── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.tab { flex: 1; padding: 11px; text-align: center; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; color: var(--text-dim); border-bottom: 2px solid transparent; transition: all 0.2s; font-weight: 500; }
.tab.active { color: var(--olive-bright); border-bottom-color: var(--olive-bright); }
.event-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 1rem; overflow: hidden; cursor: pointer; transition: border-color 0.2s, transform 0.15s; }
.event-card:hover { border-color: var(--olive-light); }
.event-card:active { transform: scale(0.99); }
.event-img-placeholder { width: 100%; height: 88px; background: linear-gradient(135deg, var(--surface2), var(--surface3)); display: flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.event-body { padding: 1rem 1.1rem 1.1rem; }
.event-title { font-family: 'Bebas Neue', sans-serif; font-size: 1.25rem; color: var(--text); letter-spacing: 0.05em; margin-bottom: 0.3rem; }
.event-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.2rem; display: flex; align-items: center; gap: 6px; line-height: 1.4; }
.event-buyin { display: inline-block; background: rgba(74,92,42,0.22); color: var(--olive-bright); border: 1px solid rgba(74,92,42,0.4); border-radius: 20px; padding: 4px 12px; font-size: 0.75rem; font-weight: 600; margin-top: 0.5rem; }
.prize-pool-badge { background: rgba(201,162,39,0.13); color: var(--gold); border: 1px solid rgba(201,162,39,0.3); border-radius: 8px; padding: 5px 12px; font-size: 0.82rem; font-weight: 600; display: inline-block; margin-top: 0.5rem; }
.winner-list { padding: 0.6rem 1.1rem 0; display: flex; flex-direction: column; gap: 4px; }
.winner-item { font-size: 0.8rem; display: flex; align-items: center; gap: 7px; color: var(--text-muted); }
.create-btn { width: 100%; background: var(--olive); color: #fff; border: none; border-radius: 12px; padding: 13px; font-family: 'Barlow', sans-serif; font-size: 0.9rem; font-weight: 600; cursor: pointer; letter-spacing: 0.05em; margin-bottom: 1.25rem; display: flex; align-items: center; justify-content: center; gap: 7px; transition: all 0.2s; }
.create-btn:hover { background: var(--olive-light); }

/* ── DETAIL OVERLAY ── */
.detail-overlay { position: fixed; inset: 0; background: var(--black); z-index: 80; overflow-y: auto; max-width: 480px; left: 50%; transform: translateX(-50%); animation: fade-in 0.2s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.detail-header { padding: 3.5rem 1.25rem 1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; background: rgba(10,10,10,0.95); backdrop-filter: blur(10px); z-index: 10; }
.back-btn { background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; color: var(--text-muted); cursor: pointer; font-size: 0.82rem; display: flex; align-items: center; gap: 4px; transition: all 0.2s; white-space: nowrap; }
.back-btn:hover { color: var(--text); border-color: var(--border-light); }
.detail-content { padding: 1.25rem; padding-bottom: 3rem; }

/* ── DATE OPTIONS ── */
.date-option { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 0.75rem; cursor: pointer; transition: border-color 0.2s, background 0.2s; position: relative; }
.date-option:active { transform: scale(0.99); }
.date-option.selected-by-me { border-color: var(--olive-bright); background: rgba(74,92,42,0.08); }
.date-label { font-size: 0.92rem; color: var(--text); font-weight: 500; margin-bottom: 0.5rem; }
.date-voters { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 0.4rem; }
.voter-chip { background: rgba(74,92,42,0.2); color: var(--olive-bright); border-radius: 20px; padding: 3px 10px; font-size: 0.72rem; font-weight: 500; }
.winner-date { border-color: var(--olive-bright); background: rgba(74,92,42,0.1); }
.winner-badge { position: absolute; top: 10px; right: 10px; background: var(--olive); color: #fff; border-radius: 20px; padding: 3px 10px; font-size: 0.68rem; font-weight: 600; }

/* ── PLAYERS ── */
.player-row { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 10px; }
.player-rank { width: 26px; font-family: 'Bebas Neue', sans-serif; font-size: 1.1rem; color: var(--olive-bright); text-align: center; }
.player-name { flex: 1; font-size: 0.9rem; color: var(--text); }
.player-prize { font-size: 0.88rem; color: var(--gold); font-weight: 600; }
.rank-badge { background: var(--surface2); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-family: 'Bebas Neue', sans-serif; font-size: 0.9rem; color: var(--olive-bright); border: 1px solid var(--border); flex-shrink: 0; }
.finish-btn { background: transparent; border: 1px solid var(--border); border-radius: 7px; padding: 6px 11px; font-size: 0.75rem; color: var(--text-muted); cursor: pointer; transition: all 0.2s; font-family: 'Barlow', sans-serif; white-space: nowrap; }
.finish-btn:hover { border-color: var(--olive-light); color: var(--olive-bright); }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── PROFILE ── */
.profile-header { background: linear-gradient(135deg, var(--surface), rgba(74,92,42,0.18)); border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 1rem; }
.avatar { width: 58px; height: 58px; border-radius: 50%; background: var(--olive); display: flex; align-items: center; justify-content: center; font-family: 'Bebas Neue', sans-serif; font-size: 1.5rem; color: #fff; flex-shrink: 0; border: 2px solid var(--olive-bright); }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; text-align: center; }
.stat-value { font-family: 'Bebas Neue', sans-serif; font-size: 1.6rem; color: var(--olive-bright); letter-spacing: 0.05em; }
.stat-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-top: 3px; }
.section-label { font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; margin-top: 0.5rem; }
.admin-badge { background: rgba(192,57,43,0.18); color: var(--red-light); border: 1px solid rgba(192,57,43,0.3); border-radius: 20px; padding: 3px 12px; font-size: 0.7rem; font-weight: 600; display: inline-block; margin-top: 5px; }

/* ── FORM HELPERS ── */
.currency-wrapper { position: relative; }
.currency-wrapper::before { content: '$'; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.95rem; pointer-events: none; }
.currency-wrapper .form-input { padding-left: 26px; }
.date-time-row { display: flex; gap: 8px; align-items: center; margin-bottom: 0.75rem; }
.date-time-row .form-input { flex: 1; font-size: 0.88rem; }
.remove-dt { background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text-dim); cursor: pointer; font-size: 0.85rem; transition: all 0.2s; flex-shrink: 0; }
.remove-dt:hover { border-color: var(--red-light); color: var(--red-light); }
.add-dt { display: flex; align-items: center; gap: 6px; background: transparent; border: 1px dashed var(--border-light); border-radius: 10px; padding: 10px 16px; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; transition: all 0.2s; width: 100%; justify-content: center; font-family: 'Barlow', sans-serif; }
.add-dt:hover { border-color: var(--olive-bright); color: var(--olive-bright); }
.amount-inputs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 6px; }
.amount-inputs .form-input { font-size: 0.82rem; padding: 9px 10px; }
.amount-label { font-size: 0.62rem; color: var(--text-dim); text-align: center; margin-top: 3px; letter-spacing: 0.05em; }
.error-msg { color: var(--red-light); font-size: 0.8rem; margin-top: 0.35rem; }

/* ── TOAST ── */
.toast { position: fixed; bottom: calc(80px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--olive); color: #fff; padding: 11px 22px; border-radius: 10px; font-size: 0.875rem; font-weight: 600; z-index: 200; white-space: nowrap; animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards; pointer-events: none; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(-50%) translateY(12px); } }

/* ── INSTALL BANNER ── */
.install-banner { background: rgba(74,92,42,0.15); border: 1px solid rgba(74,92,42,0.3); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 12px; }
.install-banner p { font-size: 0.82rem; color: var(--text-muted); flex: 1; line-height: 1.4; }
.install-banner strong { color: var(--olive-bright); }
.install-btn { background: var(--olive); color: #fff; border: none; border-radius: 8px; padding: 8px 14px; font-family: 'Barlow', sans-serif; font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* ── SAFE AREAS ── */
.page-header { padding-top: calc(3rem + env(safe-area-inset-top)); }
.auth-screen { padding-top: calc(2rem + env(safe-area-inset-top)); }
