/* poolean web — Arena visual system ported to responsive web.
   Mobile-first; desktop (>=920px) gets a sidebar + multi-column layouts. */

:root {
  --blue: #0b63d6;
  --blue-deep: #0a4da8;
  --blue-tint: #eaf1fd;
  --blue-tint2: #d7e6fb;

  --gold: #f4b41a;
  --gold-deep: #b7820b;
  --gold-tint: #fcf1d2;
  --on-gold: #3a2b05;
  --on-gold-deep: #2a2003;
  --gold-text: #7a560a;

  --silver: #c4cbd4;
  --silver2: #9aa3ae;

  --ink: #15191f;
  --ink2: #576070;
  --ink3: #8b93a1;
  --header-top: #1b2330;

  --bg: #f3f5f9;
  --surface: #ffffff;
  --line: #e6eaf0;
  --track: #edf0f5;

  --up: #1e9d5b;
  --up-tint: #e2f4ea;
  --down: #e1543c;
  --down-tint: #fbeae6;
  --flat: #9aa3ae;

  --disp: "Saira Condensed", system-ui, sans-serif;
  --ui: "Hanken Grotesk", system-ui, sans-serif;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-xxl: 22px;

  --sidebar-w: 248px;
  --maxw: 1120px;
  --shadow-card: 0 4px 18px rgba(21, 25, 31, 0.07);
  --shadow-pop: 0 12px 40px rgba(21, 25, 31, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--ui);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--gold-tint); }

.eyebrow {
  font-family: var(--ui);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink3);
}
.disp { font-family: var(--disp); font-weight: 800; letter-spacing: 0.01em; line-height: 0.98; }
.spin { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-screen { min-height: 100dvh; display: grid; place-items: center; }

/* ── avatars ── */
.av {
  border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-family: var(--disp); font-weight: 800; flex: none; overflow: hidden;
  background-size: cover; background-position: center;
}
.av span { transform: translateY(1px); }

/* ───────────────────────── sign in ───────────────────────── */
.auth {
  min-height: 100dvh;
  background: linear-gradient(155deg, var(--header-top) 0%, var(--ink) 70%);
  color: #fff;
  display: flex; flex-direction: column;
}
.auth-wrap { width: 100%; max-width: 460px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 26px 28px; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand { font-family: var(--disp); font-weight: 700; letter-spacing: 0.28em; font-size: 18px; color: var(--gold); }
.auth-hero { width: 150px; height: 150px; object-fit: contain; align-self: center; margin: 14px 0 6px; }
.auth h1 { font-family: var(--disp); font-weight: 800; font-size: 42px; line-height: 1.04; margin-top: 8px; }
.auth .lede { color: rgba(255, 255, 255, 0.62); font-weight: 500; font-size: 15px; line-height: 1.45; margin-top: 14px; }
.auth-form { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.field {
  height: 50px; border-radius: var(--r-md); border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06); padding: 0 14px; color: #fff; font-size: 16px; font-weight: 500;
}
.field::placeholder { color: rgba(255, 255, 255, 0.4); }
.field:focus { outline: none; border-color: var(--gold); background: rgba(255, 255, 255, 0.1); }
.btn-gold {
  height: 52px; border-radius: var(--r-md); background: var(--gold); color: var(--on-gold-deep);
  font-weight: 800; font-size: 16px; display: grid; place-items: center; transition: transform 0.06s, filter 0.15s;
}
.btn-gold:hover { filter: brightness(1.05); }
.btn-gold:active { transform: translateY(1px); }
.btn-gold[disabled] { opacity: 0.55; pointer-events: none; }
.auth-row { display: flex; justify-content: center; gap: 18px; margin-top: 16px; align-items: center; }
.link-muted { color: rgba(255, 255, 255, 0.55); font-weight: 600; font-size: 13.5px; }
.link-strong { color: rgba(255, 255, 255, 0.82); font-weight: 700; font-size: 13.5px; }
.auth .fine { color: rgba(255, 255, 255, 0.45); font-size: 12px; line-height: 1.5; text-align: center; margin-top: 18px; }
.auth .err { color: #ff9b9b; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.auth .ok { color: var(--gold); font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.pending-card { background: rgba(255, 255, 255, 0.08); border-radius: 16px; padding: 18px; }
.pending-card .eyebrow { color: var(--gold); }
.code-row { display: flex; gap: 10px; margin-top: 14px; }
.code-row .field { flex: 1; font-weight: 700; letter-spacing: 0.18em; }
.code-row .btn-gold { width: auto; padding: 0 22px; height: 50px; }

/* desktop sign-in: brand panel + form */
@media (min-width: 920px) {
  .auth { flex-direction: row; }
  .auth-wrap {
    max-width: var(--maxw); display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center;
    gap: 64px; padding: 48px; margin: auto; justify-content: initial;
  }
  .auth-left { display: flex; flex-direction: column; }
  .auth-hero { width: 200px; height: 200px; align-self: flex-start; margin: 0 0 18px; }
  .auth h1 { font-size: 66px; }
  .auth .lede { font-size: 17px; max-width: 30ch; }
  .auth-card { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: var(--r-xxl); padding: 32px; }
  .auth-form { margin-top: 0; }
}

/* ───────────────────────── app shell ───────────────────────── */
.shell { min-height: 100dvh; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--ink);
  color: #fff; padding: max(12px, env(safe-area-inset-top)) 18px 12px; display: flex; align-items: center; justify-content: space-between;
}
.topbar .brand { font-family: var(--disp); font-weight: 700; letter-spacing: 0.24em; font-size: 16px; color: var(--gold); }
.topbar .live { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; color: var(--gold); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 0 rgba(244, 180, 26, 0.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(244, 180, 26, 0.5); } 70% { box-shadow: 0 0 0 9px rgba(244, 180, 26, 0); } 100% { box-shadow: 0 0 0 0 rgba(244, 180, 26, 0); } }

.main { max-width: 680px; margin: 0 auto; padding: 18px 16px calc(86px + env(safe-area-inset-bottom)); }
.view-head { margin: 6px 2px 16px; }
.view-head h2 { font-family: var(--disp); font-weight: 800; font-size: 32px; line-height: 1; }
.view-head p { color: var(--ink2); font-size: 14px; margin-top: 6px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button { padding: 9px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink3); font-weight: 700; font-size: 10.5px; letter-spacing: 0.02em; }
.tabbar button.active { color: var(--blue); }
.tabbar .ic { width: 22px; height: 22px; display: grid; place-items: center; }
.tabbar svg { width: 21px; height: 21px; }

/* ── cards ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-card); }
.section-label { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; }
.section-label .eyebrow { color: var(--ink2); }

/* ── champion block ── */
.champion {
  position: relative; overflow: hidden; border-radius: var(--r-xxl); padding: 20px;
  background: linear-gradient(135deg, #1b2330 0%, #15191f 100%); color: #fff; box-shadow: var(--shadow-card);
}
.champion .glow { position: absolute; inset: -40% 40% auto -20%; height: 200px; background: radial-gradient(closest-side, rgba(244, 180, 26, 0.22), transparent); }
.champion .eyebrow { color: var(--gold); position: relative; }
.champ-main { display: flex; align-items: center; gap: 14px; margin-top: 12px; position: relative; }
.champ-main .av { width: 60px; height: 60px; font-size: 24px; box-shadow: 0 0 0 3px rgba(244, 180, 26, 0.9); }
.champ-main .nm { font-family: var(--disp); font-weight: 800; font-size: 34px; line-height: 1; }
.champ-main .sub { color: rgba(255, 255, 255, 0.6); font-size: 13px; font-weight: 600; margin-top: 3px; }
.crown-badge { margin-left: auto; font-size: 26px; }

/* ── board ── */
.board { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 11px 14px; box-shadow: var(--shadow-card);
}
.row .rank { font-family: var(--disp); font-weight: 800; font-size: 20px; color: var(--ink3); width: 26px; text-align: center; flex: none; }
.row.top .rank { color: var(--gold-deep); }
.row .av { width: 38px; height: 38px; font-size: 15px; }
.row .nm { font-weight: 700; font-size: 15.5px; flex: 1; }
.row .nm small { display: block; color: var(--ink3); font-weight: 600; font-size: 12px; margin-top: 1px; }
.move { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; font-size: 12.5px; padding: 3px 8px; border-radius: 999px; }
.move.up { color: var(--up); background: var(--up-tint); }
.move.down { color: var(--down); background: var(--down-tint); }
.move.flat { color: var(--flat); background: var(--track); }

/* ── stats ── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow-card); }
.stat-card .eyebrow { font-size: 10px; }
.stat-card .big { font-family: var(--disp); font-weight: 800; font-size: 26px; margin-top: 8px; display: flex; align-items: center; gap: 9px; }
.stat-card .big .av { width: 30px; height: 30px; font-size: 13px; }
.stat-card .meta { color: var(--ink2); font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.stat-wide { grid-column: 1 / -1; }
.standings { display: flex; flex-direction: column; }
.standings .sr { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-top: 1px solid var(--line); }
.standings .sr:first-child { border-top: none; }
.standings .sr .rk { font-family: var(--disp); font-weight: 800; color: var(--ink3); width: 22px; }
.standings .sr .av { width: 30px; height: 30px; font-size: 13px; }
.standings .sr .nm { flex: 1; font-weight: 700; font-size: 14.5px; }
.standings .sr .avg { color: var(--ink2); font-weight: 700; font-size: 13px; }

/* ── rules ── */
.rule { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-card); margin-bottom: 10px; }
.rule h3 { font-family: var(--disp); font-weight: 800; font-size: 21px; display: flex; align-items: baseline; gap: 10px; }
.rule h3 .n { color: var(--blue); }
.rule ul { list-style: none; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.rule li { position: relative; padding-left: 16px; color: var(--ink2); font-size: 14px; line-height: 1.45; }
.rule li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--silver2); }
.rule .sub { margin-top: 12px; }
.rule .sub h4 { font-weight: 800; font-size: 13px; letter-spacing: 0.02em; }
.rule .sub ul { margin-top: 5px; }

/* ── party ── */
.party-banner { border-radius: var(--r-xxl); padding: 20px; color: #fff; background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%); box-shadow: var(--shadow-card); }
.party-banner.idle { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.party-banner .eyebrow { color: rgba(255, 255, 255, 0.7); }
.party-banner.idle .eyebrow { color: var(--ink3); }
.party-banner h3 { font-family: var(--disp); font-weight: 800; font-size: 28px; margin-top: 8px; }
.party-banner .when { font-weight: 600; font-size: 14px; margin-top: 6px; opacity: 0.92; }
.btn-light { height: 46px; border-radius: var(--r-md); background: #fff; color: var(--ink); font-weight: 800; font-size: 15px; display: grid; place-items: center; margin-top: 14px; }
.btn-outline { height: 46px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 800; font-size: 15px; display: grid; place-items: center; }

.empty { text-align: center; color: var(--ink2); padding: 40px 20px; }
.empty .ic { font-size: 34px; }
.empty p { margin-top: 8px; font-weight: 600; }

.attendees { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px 5px 5px; font-weight: 700; font-size: 13px; }
.chip .av { width: 24px; height: 24px; font-size: 11px; }

/* ── you / profile ── */
.profile-head { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.profile-head .av { width: 64px; height: 64px; font-size: 26px; }
.profile-head .nm { font-family: var(--disp); font-weight: 800; font-size: 30px; }
.profile-head .role { color: var(--ink3); font-weight: 700; font-size: 13px; }
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card); margin-top: 16px; overflow: hidden; }
.list-card .li { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-top: 1px solid var(--line); font-weight: 600; }
.list-card .li:first-child { border-top: none; }
.list-card .li .v { color: var(--ink3); font-weight: 700; }
.list-card .li.tap:hover { background: var(--bg); cursor: pointer; }
.danger { color: var(--down); }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-weight: 700; font-size: 13.5px; box-shadow: var(--shadow-pop); z-index: 50; }

/* ── admin roster ── */
.adm-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.adm-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 11px 14px; box-shadow: var(--shadow-card); }
.adm-meta { flex: 1; min-width: 0; }
.adm-meta .nm { font-weight: 700; font-size: 15.5px; display: flex; align-items: center; gap: 7px; }
.adm-meta .sub { color: var(--ink3); font-size: 12.5px; font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-tag { font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gold-text); background: var(--gold-tint); padding: 1px 7px; border-radius: 999px; }
.adm-manage { flex: none; height: 36px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--bg); font-weight: 700; font-size: 13.5px; color: var(--ink); }
.adm-manage:hover { background: var(--blue-tint); border-color: var(--blue-tint2); color: var(--blue-deep); }

/* ── modal ── */
.modal-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(21, 25, 31, 0.5); backdrop-filter: blur(3px); display: grid; place-items: end center; padding: 0; }
.modal { background: var(--surface); width: 100%; max-width: 460px; border-radius: var(--r-xxl) var(--r-xxl) 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-pop); animation: sheet-up 0.22s ease; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-head { display: flex; align-items: center; gap: 12px; padding-bottom: 8px; }
.modal-head .mt { font-family: var(--disp); font-weight: 800; font-size: 22px; }
.modal-head .ms { color: var(--ink3); font-weight: 600; font-size: 12.5px; }
.modal-x { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; background: var(--bg); color: var(--ink2); font-size: 14px; }
.modal-sec { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 8px; }
.modal-sec .eyebrow { color: var(--ink2); }
.modal-note { color: var(--ink2); font-size: 13px; line-height: 1.45; margin-top: 6px; }
.merge-row { display: flex; gap: 10px; margin-top: 12px; }
.msel { flex: 1; height: 46px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); padding: 0 12px; font-family: var(--ui); font-weight: 600; font-size: 15px; color: var(--ink); }
.merge-row .btn-gold { width: auto; height: 46px; padding: 0 20px; }
.btn-danger { width: 100%; height: 46px; margin-top: 12px; border-radius: var(--r-md); background: var(--down-tint); color: var(--down); font-weight: 800; font-size: 15px; }
.btn-danger:hover { background: var(--down); color: #fff; }
.btn-danger[disabled] { opacity: 0.55; pointer-events: none; }
.modal-err { color: var(--down); font-weight: 600; font-size: 13px; margin-top: 12px; }

/* ─────────────────── desktop ─────────────────── */
@media (min-width: 920px) {
  .shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
  .topbar { display: none; }
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh;
    background: var(--ink); color: #fff; padding: 26px 16px; border-right: 1px solid rgba(255, 255, 255, 0.06);
  }
  .sidebar .brand { font-family: var(--disp); font-weight: 700; letter-spacing: 0.24em; font-size: 20px; color: var(--gold); padding: 4px 12px 22px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .sidebar .nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-md); color: rgba(255, 255, 255, 0.62); font-weight: 700; font-size: 15px; }
  .sidebar .nav-item svg { width: 20px; height: 20px; }
  .sidebar .nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
  .sidebar .nav-item.active { background: rgba(244, 180, 26, 0.14); color: var(--gold); }
  .sidebar .nav-item .badge { margin-left: auto; background: var(--gold); color: var(--on-gold-deep); font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }
  .sidebar .acct { display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); margin-top: 8px; }
  .sidebar .acct .av { width: 36px; height: 36px; font-size: 15px; }
  .sidebar .acct .nm { font-weight: 700; font-size: 14px; }
  .sidebar .acct .ro { color: var(--ink3); font-size: 12px; font-weight: 600; }
  .sidebar .acct button { margin-left: auto; color: var(--ink3); font-size: 18px; }

  .main { max-width: var(--maxw); padding: 36px 40px 56px; }
  .view-head h2 { font-size: 40px; }

  /* board: two columns */
  .board-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; align-items: start; }
  .board-grid .side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 36px; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .rules-grid { columns: 2; column-gap: 14px; }
  .rules-grid .rule { break-inside: avoid; }
  .toast { bottom: 32px; }
  .modal-overlay { place-items: center; padding: 24px; }
  .modal { border-radius: var(--r-xxl); animation: pop-in 0.16s ease; }
  @keyframes pop-in { from { transform: scale(0.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }
}
@media (max-width: 919px) {
  .board-grid { display: block; }
  .board-grid .side { margin-bottom: 8px; }
  .desktop-only { display: none; }
}
