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

/* ── Variables ───────────────────────────────────────── */
:root {
  --dark:    #1a1a2e;
  --gold:    #f0c040;
  --gold-lt: #faeeda;
  --green:   #1D9E75;
  --red:     #E24B4A;
  --purple:  #534AB7;
  --bg:      #f5f5f0;
  --surface: #ffffff;
  --border:  rgba(0,0,0,.10);
  --text:    #1a1a1a;
  --muted:   #6b6b6b;
  --radius:  12px;
  --shadow:  0 1px 4px rgba(0,0,0,.07);
}

/* ── Base ────────────────────────────────────────────── */
html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Layout ──────────────────────────────────────────── */
.page-wrap   { max-width: 430px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.page-body   { flex: 1; padding: 16px; }
.page-body.pt0 { padding-top: 0; }

/* ── Top Nav ─────────────────────────────────────────── */
.topnav {
  background: var(--dark);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav-logo { color: var(--gold); font-size: 18px; font-weight: 700; letter-spacing: .06em; }
.topnav-icons { display: flex; gap: 14px; }
.topnav-icons a { color: #aaa; font-size: 20px; line-height: 1; }
.topnav-icons a:hover { color: var(--gold); }

/* ── Bottom Nav ──────────────────────────────────────── */
.bottomnav {
  background: var(--dark);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 14px;
  position: sticky;
  bottom: 0;
  z-index: 100;
}
.bottomnav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #666;
  font-size: 10px;
  font-weight: 500;
}
.bottomnav a i { font-size: 22px; }
.bottomnav a.active, .bottomnav a:hover { color: var(--gold); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-block { display: flex; width: 100%; }
.btn-primary  { background: var(--dark);   color: var(--gold); }
.btn-gold     { background: var(--gold);   color: var(--dark); }
.btn-outline  { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-green    { background: var(--green);  color: #fff; }
.btn-red      { background: var(--red);    color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 8px; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
}
.card + .card { margin-top: 10px; }

/* ── Section label ───────────────────────────────────── */
.section-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin: 16px 0 8px;
}

/* ── Form fields ─────────────────────────────────────── */
.field        { margin-bottom: 12px; }
.field label  { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
.input {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--dark); }
.input.error  { border-color: var(--red); }

/* ── Badges ──────────────────────────────────────────── */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.badge-open    { background: #EAF3DE; color: #27500A; }
.badge-live    { background: #FCEBEB; color: #A32D2D; }
.badge-pending { background: #FAEEDA; color: #633806; }
.badge-done    { background: #EAF3DE; color: #27500A; }
.badge-cancel  { background: #f0f0f0; color: #666; }

/* ── Wallet strip ────────────────────────────────────── */
.wallet-strip {
  background: var(--dark);
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.wallet-strip .wbox { text-align: center; }
.wallet-strip .wbox .amt { color: var(--gold); font-size: 17px; font-weight: 700; }
.wallet-strip .wbox .lbl { color: #888; font-size: 11px; margin-top: 2px; }

/* ── Hero banner ─────────────────────────────────────── */
.hero-banner {
  background: var(--dark);
  padding: 18px 16px 14px;
}
.hero-banner .hi   { color: var(--gold); font-size: 20px; font-weight: 700; }
.hero-banner .sub  { color: #aaa; font-size: 12px; margin-top: 2px; }

/* ── Battle card ─────────────────────────────────────── */
.battle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.battle-card .mode   { font-size: 13px; font-weight: 600; }
.battle-card .by     { font-size: 11px; color: var(--muted); margin-top: 2px; }
.battle-card .prize  { font-size: 13px; font-weight: 700; color: var(--green); margin-top: 4px; }
.battle-card .fee    { background: var(--gold-lt); color: #633806; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }

/* ── Transaction row ─────────────────────────────────── */
.txn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.txn-row:last-child { border-bottom: none; }
.txn-row .t-type    { font-size: 13px; font-weight: 500; }
.txn-row .t-sub     { font-size: 11px; color: var(--muted); margin-top: 2px; }
.txn-row .t-amt-pos { color: var(--green); font-weight: 700; font-size: 14px; }
.txn-row .t-amt-neg { color: var(--red);   font-weight: 700; font-size: 14px; }

/* ── Grid helpers ────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* ── Stat mini ───────────────────────────────────────── */
.stat-box { background: #f5f5f0; border-radius: 10px; padding: 12px; }
.stat-box .n { font-size: 18px; font-weight: 700; }
.stat-box .l { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Upload zone ─────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.upload-zone i { font-size: 28px; margin-bottom: 8px; display: block; }

/* ── Alert boxes ─────────────────────────────────────── */
.alert { border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }
.alert-info    { background: #E6F1FB; color: #0C447C; }
.alert-warn    { background: #FAEEDA; color: #633806; }
.alert-success { background: #EAF3DE; color: #27500A; }
.alert-error   { background: #FCEBEB; color: #A32D2D; }

/* ── OTP input ───────────────────────────────────────── */
.otp-wrap { display: flex; gap: 8px; justify-content: center; margin: 16px 0; }
.otp-wrap input {
  width: 44px; height: 52px;
  text-align: center; font-size: 22px; font-weight: 700;
  border: 2px solid var(--border); border-radius: 10px;
}
.otp-wrap input:focus { border-color: var(--dark); outline: none; }

/* ── Room code display ───────────────────────────────── */
.room-code-box {
  background: var(--dark);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  margin-bottom: 14px;
}
.room-code-box .code { color: var(--gold); font-size: 32px; font-weight: 700; letter-spacing: .2em; }
.room-code-box .hint { color: #888; font-size: 11px; margin-top: 6px; }

/* ── Auth pages ──────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--dark);
}
.auth-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%;
  max-width: 400px;
}
.auth-logo { color: var(--gold); font-size: 26px; font-weight: 700; letter-spacing: .06em; text-align: center; margin-bottom: 4px; }
.auth-sub  { color: #aaa; font-size: 12px; text-align: center; margin-bottom: 24px; }

/* ── Divider ─────────────────────────────────────────── */
.divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Flash messages ──────────────────────────────────── */
.flash { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; font-weight: 500; }
.flash.success { background: #EAF3DE; color: #27500A; }
.flash.error   { background: #FCEBEB; color: #A32D2D; }

/* ── Spinner ─────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid #ddd;
  border-top-color: var(--dark);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ─────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-gold   { color: var(--gold); }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.fw-bold { font-weight: 700; }
.fs-12 { font-size: 12px; }
