/* ================================
   TournyPlay – polished UI styles
   ================================ */

/* ---- CSS Reset (lightweight) ---- */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ---- Theme ---- */
:root{
  --bg: #0b1220;         /* page background */
  --card: #0f172a;       /* panel/card base (SOLID for readability) */
  --card-soft:#131c33;
  --text: #e5ecff;
  --muted:#9fb0d1;
  --border:#1f2a44;
  --brand:#60a5fa;
  --warn-bg: rgba(245,158,11,.24);
  --warn-border: rgba(245,158,11,.65);
  --warn-text: #fffbe6;

  --primary:#1d4ed8;
  --primary-600:#1e40af;

  --green:#16a34a;
  --amber:#f59e0b;
  --indigo:#6366f1;
  --purple:#a855f7;
  --sky:#0ea5e9;
  --slate:#94a3b8;
  --danger:#ef4444;

  --shadow: 0 10px 25px rgba(2, 6, 23, 0.55), inset 0 1px 0 rgba(255,255,255,0.02);
  --radius: 16px;
  --radius-lg: 22px;
}

@media (prefers-color-scheme: light){
  :root{
    --bg:#f4f7ff;
    --card:#ffffff;
    --card-soft:#f7f9ff;
    --text:#0b1220;
    --muted:#5c6b8a;
    --border:#e6ecff;
    --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    --warn-bg: rgba(245,158,11,.18);
    --warn-border: rgba(245,158,11,.55);
    --warn-text: #7a4a00;
  }
}

/* ---- Global background (image + dark overlay + soft glows) ---- */
html, body {
  height: 100%;
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.45;

  background:
    linear-gradient(rgba(0,0,0,.45), rgba(0,0,0,.45)),
    url('./bg.jpg') center center / cover fixed no-repeat,
    radial-gradient(1200px 1200px at 10% -10%, rgba(99,102,241,0.10), transparent 50%),
    radial-gradient(900px 900px at 100% 0%,  rgba(14,165,233,0.12), transparent 40%),
    var(--bg);
}

/* ---- Layout ---- */
.wrap{
  max-width: 1100px;
  margin: 28px auto 80px;
  padding: 0 20px;
}

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  background: var(--card);
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: sticky;
  top: 16px;
  z-index: 800; /* header below chat & modal */
}

.brand{ display:flex; gap:14px; align-items:center; }
.logo{
  width: 48px; height: 48px;
  display:grid; place-items:center;
  background: radial-gradient(100% 100% at 50% 0%, rgba(99,102,241,.25), rgba(99,102,241,0) 60%), var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
}
h1{ font-size: 20px; margin: 0 0 2px; letter-spacing: 0.2px; }
.sub{ font-size:12px; color:var(--muted); margin-top:-2px; }

.topbar .right{ display:flex; align-items:center; gap:10px; }

/* ---- Generic UI ---- */
button{
  border: 1px solid transparent;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.0)), var(--primary);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  box-shadow: 0 6px 14px rgba(29,78,216,.25);
}
button:hover{ transform: translateY(-1px); }
button:active{ transform: translateY(0); }
button.secondary{
  background: var(--card-soft);
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}
button.danger{
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.0)), var(--danger);
  box-shadow: 0 6px 14px rgba(239,68,68,.25);
}
button.full{ width: 100%; }

input{
  background: var(--card-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  outline: none;
  width: 100%;
}
input:focus{ border-color: var(--brand); box-shadow: 0 0 0 3px rgba(96,165,250,.25); }

/* ---- Chips / Pills ---- */
.chip{
  border: 1px solid var(--border);
  background: var(--card-soft);
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
}
.chip.active{
  background: linear-gradient(180deg, rgba(96,165,250,.18), rgba(96,165,250,.06));
  border-color: rgba(96,165,250,.55);
  box-shadow: 0 4px 14px rgba(96,165,250,.28) inset;
}
.stake{ display:flex; flex-wrap: wrap; gap: 8px; align-items:center; }

.pill{
  font-size: 12px; font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-soft);
}
.pill.sky{ background: rgba(14,165,233,.15); border-color: rgba(14,165,233,.35); color:#cff0ff; }
.pill.green{ background: rgba(22,163,74,.18); border-color: rgba(22,163,74,.45); }
.pill.amber{ background: rgba(245,158,11,.18); border-color: rgba(245,158,11,.45); }
.pill.indigo{ background: rgba(99,102,241,.18); border-color: rgba(99,102,241,.45); }
.pill.purple{ background: rgba(168,85,247,.18); border-color: rgba(168,85,247,.45); }
.pill.slate{ background: rgba(148,163,184,.18); border-color: rgba(148,163,184,.45); }

/* ---- Helpers ---- */
.row{ display:flex; align-items:center; }
.space{ justify-content: space-between; }
.gap{ gap: 10px; }
.pad{ padding: 12px; }
.padtop{ padding-top: 12px; }
.borderb{ border-bottom: 1px solid var(--border); }
.borderT{ border-top: 1px solid var(--border); }
.small{ font-size: 13px; }
.xsmall{ font-size: 12px; }
.bold{ font-weight: 700; }
.muted{ color: var(--muted); }

/* ---- Cards / Panels (SOLID) ---- */
.panel{
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card.soft{
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0)) , var(--card);
  border-radius: 14px;
  border: 1px dashed var(--border);
  padding: 12px;
}
.title{ font-weight: 800; letter-spacing:.2px; }

/* ---- Optional glass utility (use sparingly) ---- */
.glass { background: rgba(255,255,255,0.08); backdrop-filter: blur(8px); }

/* ---- Grid layouts ---- */
.grid{
  display: grid;
  gap: 14px;
  grid-template-columns: repeat( auto-fill, minmax(290px, 1fr) );
  margin-top: 12px;
}
.grid2{
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0,1fr));
}
@media (max-width: 860px){
  .grid2{ grid-template-columns: 1fr; }
}

/* ---- Tabs ---- */
.tabs{ margin-top: 16px; }
.tabbar{ display:flex; gap: 8px; flex-wrap: wrap; }
.tab{
  background: var(--card);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 700;
}
.tab.active{
  color: var(--text);
  border-color: rgba(96,165,250,.55);
  box-shadow: 0 6px 14px rgba(96,165,250,.18) inset;
}

/* ---- Empty state ---- */
.empty{
  color: var(--muted);
  text-align:center;
  padding: 28px 14px;
  border:1px dashed var(--border);
  border-radius: 12px;
}

/* ---- Warning bar ---- */
.warn{
  margin: 16px 0;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--warn-bg), rgba(245,158,11,.06));
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(245,158,11,.15) inset;
}
.warn .bold{
  color: var(--warn-text);
  text-shadow: 0 1px 0 rgba(0,0,0,.15);
}

/* ---- Balance badge ---- */
.badge.balance{
  display:flex; flex-direction:column;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-soft);
  min-width: 170px;
}
.badge .b1{ font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing:.8px; }
.balanceRow{ display:flex; gap: 12px; margin-top: 6px; }
.balanceItem .lbl{ font-size: 11px; color: var(--muted); }
.balanceItem .val{ font-weight: 800; margin-top: 2px; }

/* ---- Room progress ---- */
.progress{ height: 6px; background: rgba(148,163,184,.25); }
.progress .bar{ height: 100%; background: linear-gradient(90deg, var(--indigo), var(--sky)); }

/* ---- Scoreboard ---- */
.scoreboard{
  display:grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items:center;
  border:1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--card);
}
.sb-team{ display:flex; align-items:center; gap: 10px; }
.sb-team.right{ justify-self:end; }
.sb-avatar{
  width: 36px; height: 36px; border-radius: 50%;
  display:grid; place-items:center; background: var(--card-soft); border: 1px solid var(--border);
  font-weight: 800;
}
.sb-name{ font-weight: 700; }
.sb-efu{ font-size: 12px; color: var(--muted); margin-top: 2px; }

.sb-mid{ min-width: 180px; }
.sb-scoreBox{
  min-width: 64px; text-align:center; padding: 6px 10px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--card-soft);
  font-weight: 800; font-size: 20px;
}
.sb-scoreBox.green{ outline: 2px solid rgba(22,163,74,.35); }
.sb-scoreBox.red{ outline: 2px solid rgba(239,68,68,.35); }

.sb-scoreInput{
  width: 100%; text-align:center; border:0; background:transparent; color:var(--text);
  font-weight: 800; font-size: 20px; outline: none;
  -moz-appearance: textfield;
}
.sb-scoreInput::-webkit-outer-spin-button,
.sb-scoreInput::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }

.sb-swords{ width: 28px; height: 28px; opacity: .9; }

/* ---- Screenshot ---- */
.sb-shot{
  margin-top: 12px;
  border-radius: 12px;
  border:1px solid var(--border);
}

/* ---- Modal (TOP LAYER) ---- */
.modal{
  position: fixed; inset: 0;
  display:grid; place-items:center;
  background: rgba(2,6,23,.55);
  backdrop-filter: blur(4px);
  padding: 22px;
  z-index: 1000; /* ABOVE chat & header */
}
.modalCard{
  width: min(920px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
}

/* ---- Chat Dock (below modal) ---- */
.chatDock{
  position: fixed; right: 18px; bottom: 18px; width: min(420px, calc(100% - 36px));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 900;
}
.chatDockHeader{
  display:flex; justify-content:space-between; align-items:center;
  padding: 10px 12px; border-bottom:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0));
  font-weight: 700;
}
.chatDockBody{
  max-height: 40vh; overflow:auto; padding: 10px 12px; display:flex; flex-direction:column; gap: 8px;
}
.chatline{ font-size: 13px; }
.chatDockInput{
  display:flex; gap: 8px; padding: 10px 12px; border-top:1px solid var(--border);
}

/* ---- FAB ---- */
.fab{
  position: fixed; right: 18px; bottom: 18px;
  z-index: 850;
}

/* ---- Badges ---- */
.badgeTiny{
  display:inline-grid; place-items:center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--danger);
  color:#fff; font-size: 11px; font-weight: 800;
  border-radius: 999px; margin-left: 6px;
}
.badgeDot{
  display:inline-block; width: 10px; height: 10px; background: var(--danger);
  border-radius: 999px; margin-left: 8px; vertical-align: middle;
}

/* ---- Lists ---- */
.olist{ margin: 8px 0 0 18px; }
.olist li{ margin: 6px 0; }
.list{ margin: 8px 0 0 16px; }
.list li{ margin: 6px 0; }
.section-header{ font-weight: 800; }

/* ---- Toast ---- */
.toast{
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: rgba(15,23,42,.9);
  border: 1px solid var(--border);
  color:#fff; padding: 10px 14px; border-radius: 12px;
  box-shadow: var(--shadow); z-index: 1100;
}

/* ---- Auth ---- */
.authWrap{
  min-height: 100vh; display:grid; place-items:center; padding: 28px;
}
.authCard{
  width: min(520px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.authBrand{
  display:flex; align-items:center; gap: 12px; margin-bottom: 12px;
}
.card.auth{ padding: 12px; display:grid; gap: 10px; }
.card.auth .hint{ color: var(--muted); font-size: 13px; }
.card.auth .chk{ display:flex; align-items:center; gap:8px; font-size: 13px; color: var(--muted); }

/* ---- Inputs in stacked forms ---- */
.col{ display:grid; gap: 10px; }

/* ---- Copy button ---- */
.copyBtn.success{
  background: var(--green);
  box-shadow: 0 6px 14px rgba(22,163,74,.25);
}

/* ---- Utilities ---- */
.right{ display:flex; align-items:center; gap: 10px; }

/* Started button appearance (disabled) */
button.btn.started {
  background: #93c5fd;
  color: #1e3a8a;
  cursor: not-allowed;
}
/* Wallet – transactions */
.txList { display:grid; gap:10px; }
.txRow  {
  display:grid;
  grid-template-columns: 1fr auto auto;
  gap:10px;
  align-items:center;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:12px;
  background: var(--card);
}

/* Make modal form inputs a bit narrower when placed inline */
.modalCard input[type="number"] { max-width: 160px; }

