:root {
  color-scheme: dark;
  --bg: #0e1712;
  --panel: #15231a;
  --panel-raised: #1b2b21;
  --panel-soft: #1b291f;
  --line: #293a2d;
  --muted: #9baa9d;
  --text: #f3f5ef;
  --green: #c5f36c;
  --green-dark: #182318;
  --orange: #f5a66b;
  --red: #fb8178;
  --radius: 18px;
  font-family: "DM Sans", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .brand-name, .stat-value, .player-price, .score { font-family: "Space Grotesk", sans-serif; }
.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: #172117; background: var(--green); border-radius: 14px; font: 700 22px "Space Grotesk", sans-serif; }
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 480px); }
.auth-intro { padding: clamp(32px, 8vw, 110px); display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(ellipse at 75% 35%, #263b25 0, transparent 38%), linear-gradient(145deg, #16271b, #0e1712 75%); }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -.5px; }
.eyebrow { color: var(--green); text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: 1.7px; }
.auth-hero { max-width: 570px; }
.auth-hero h1 { font-size: clamp(42px, 6vw, 76px); line-height: .99; letter-spacing: -4px; margin: 18px 0; }
.auth-hero h1 em { color: var(--green); font-style: normal; }
.auth-hero p { color: #adbcaf; max-width: 400px; line-height: 1.7; }
.auth-foot { color: #708174; font-size: 12px; }
.auth-box-wrap { display: grid; place-items: center; padding: 32px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { font-size: 28px; letter-spacing: -1px; margin-bottom: 8px; }
.auth-box .muted { margin-bottom: 24px; }
.auth-tabs { display: flex; padding: 4px; background: #101b14; border-radius: 12px; margin: 22px 0; }
.auth-tabs button { flex: 1; background: transparent; border: 0; color: var(--muted); padding: 10px; border-radius: 9px; }
.auth-tabs button.active { background: var(--panel-raised); color: var(--text); }
.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field label, .field-label { color: #bec9bf; font-size: 12px; font-weight: 600; }
.field input, .field select, .input { min-width: 0; background: #101b14; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px 13px; outline: none; }
.field input:focus, .field select:focus, .input:focus { border-color: #9fc451; box-shadow: 0 0 0 3px #c5f36c16; }
.field input::placeholder { color: #607064; }
.hint { color: var(--muted); font-size: 11px; line-height: 1.55; }
.button { border: 1px solid transparent; border-radius: 10px; background: var(--green); color: #172117; padding: 11px 15px; font-weight: 700; transition: transform .16s ease, filter .16s ease; }
.button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.button-wide { width: 100%; margin-top: 8px; }
.button-secondary { color: var(--text); background: var(--panel-raised); border-color: var(--line); }
.button-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button-danger { color: #ffc2bd; background: #38201d; border-color: #56302a; }
.setup-card { background: #1d2b1d; border: 1px solid #425238; border-radius: 12px; padding: 15px; margin: 0 0 18px; }
.setup-card strong { display: block; color: var(--green); font-size: 13px; margin-bottom: 5px; }
.setup-card p { color: #aab8a7; font-size: 12px; line-height: 1.5; margin: 0; }
.muted { color: var(--muted); }
.error-text { color: var(--red); font-size: 13px; line-height: 1.5; margin: 12px 0 0; }
.app-layout { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 25px 16px; border-right: 1px solid #213027; display: flex; flex-direction: column; background: #111b15; }
.sidebar .brand-lockup { padding: 0 10px 28px; }
.nav-caption { padding: 0 11px; margin: 17px 0 8px; color: #69786c; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 700; }
.nav-list { display: grid; gap: 4px; }
.nav-button { display: flex; align-items: center; gap: 11px; width: 100%; color: #98a99c; border: 0; border-radius: 10px; padding: 11px; text-align: left; background: transparent; font-size: 13px; }
.nav-button:hover { color: var(--text); background: #19271e; }
.nav-button.active { color: var(--green); background: #263322; }
.nav-icon { width: 17px; text-align: center; font-size: 15px; }
.sidebar-bottom { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid #25342a; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 2px 14px; }
.user-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: #283924; font-weight: 700; }
.user-chip strong { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.user-chip small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.logout-button { color: #94a396; background: transparent; border: 0; padding: 8px 2px; font-size: 12px; }
.main-area { min-width: 0; padding: 26px clamp(18px, 4vw, 52px) 60px; max-width: 1500px; width: 100%; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 34px; }
.topbar h1 { font-size: 24px; letter-spacing: -.7px; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 11px; }
.balance-pill { border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; color: var(--green); background: #152219; font-size: 12px; font-weight: 700; white-space: nowrap; }
.mobile-brand { display: none; }
.page-intro { display: flex; justify-content: space-between; align-items: end; gap: 15px; margin-bottom: 21px; }
.page-intro h2 { margin: 4px 0 5px; letter-spacing: -1px; font-size: 27px; }
.page-intro p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card, .panel, .fixture-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.stat-card { padding: 17px 18px; }
.stat-label { color: var(--muted); font-size: 11px; }
.stat-value { display: block; font-size: 25px; margin-top: 8px; letter-spacing: -.7px; }
.stat-note { color: #809185; font-size: 10px; margin-top: 4px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 28px 0 13px; }
.section-heading h3 { font-size: 16px; margin: 0; }
.text-button { padding: 0; color: var(--green); background: transparent; border: 0; font-size: 11px; font-weight: 700; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(250px, .75fr); gap: 14px; }
.panel { padding: 18px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-title h3 { font-size: 15px; margin: 0; }
.fixture-list, .player-list, .admin-list { display: grid; gap: 9px; }
.fixture-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 15px; background: #17251b; }
.fixture-meta { color: var(--muted); font-size: 10px; margin-bottom: 6px; }
.fixture-name { font-size: 13px; font-weight: 700; }
.fixture-score { font: 700 18px "Space Grotesk", sans-serif; white-space: nowrap; }
.fixture-score.pending { color: var(--green); font-size: 11px; font-family: "DM Sans", sans-serif; }
.fixture-sub { font-size: 10px; color: #849487; margin-top: 5px; }
.empty-state { color: var(--muted); text-align: center; padding: 26px 12px; line-height: 1.6; font-size: 13px; }
.player-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border-radius: 12px; background: #19271e; }
.player-main { display: flex; min-width: 0; align-items: center; gap: 11px; }
.player-photo { width: 40px; height: 40px; flex: 0 0 40px; object-fit: cover; border-radius: 12px; background: #30402f; }
.player-photo-fallback { display: grid; place-items: center; color: var(--green); font-weight: 700; }
.player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.player-position { color: var(--muted); font-size: 10px; margin-top: 4px; }
.player-side { display: flex; align-items: center; gap: 12px; }
.player-price { color: var(--green); font-size: 13px; font-weight: 700; white-space: nowrap; }
.player-rating { color: #f5c56b; font-size: 11px; white-space: nowrap; }
.market-toolbar { display: flex; gap: 10px; margin: 0 0 13px; }
.market-toolbar input, .market-toolbar select { min-width: 0; background: #101b14; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; outline: none; }
.market-toolbar input { flex: 1; }
.market-toolbar select { min-width: 145px; }
.mini-button { border-radius: 9px; border: 1px solid var(--line); padding: 8px 11px; color: var(--text); background: #24352a; font-size: 11px; font-weight: 700; white-space: nowrap; }
.mini-button.buy { color: #1a2517; border-color: var(--green); background: var(--green); }
.mini-button.sell { color: #ffc2bd; border-color: #58332c; background: #37211e; }
.mini-button:disabled { cursor: not-allowed; opacity: .45; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
.leader-table { width: 100%; border-collapse: collapse; min-width: 350px; }
.leader-table th, .leader-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid #29382e; }
.leader-table th { color: #849488; text-transform: uppercase; font-size: 9px; letter-spacing: 1px; }
.leader-table td { font-size: 12px; }
.leader-table tr:last-child td { border-bottom: 0; }
.leader-rank { color: var(--green); font-weight: 700; }
.formation-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 15px; }
.formation-choice { color: var(--muted); background: #101b14; border: 1px solid var(--line); border-radius: 9px; padding: 9px 13px; font-size: 12px; }
.formation-choice.active { color: var(--green); border-color: #7d9e48; background: #1d2b1c; }
.lineup-pitch { padding: 18px; border: 1px solid #436344; border-radius: 15px; background: linear-gradient(155deg, #1d3927, #173021); margin: 15px 0; }
.lineup-pitch p { color: #acc0aa; font-size: 11px; margin-bottom: 12px; }
.lineup-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.lineup-option { position: relative; min-width: 0; padding: 10px 8px; border: 1px solid #456046; border-radius: 10px; background: #193322; text-align: center; cursor: pointer; }
.lineup-option:has(input:checked) { border-color: var(--green); background: #2b442a; }
.lineup-option input { position: absolute; opacity: 0; }
.lineup-option .player-name { font-size: 10px; }
.lineup-option small { display: block; color: #a4b59f; font-size: 9px; margin-top: 4px; }
.captain-star { position: absolute; top: 4px; right: 6px; color: var(--green); font-size: 10px; }
.admin-grid { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: 15px; align-items: start; }
.admin-form { display: grid; gap: 11px; }
.admin-form .field { margin: 0; }
.admin-player-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px; border: 1px solid #29382e; border-radius: 11px; }
.admin-actions { display: flex; gap: 6px; }
.admin-actions .mini-button { padding: 7px 9px; }
.checklist { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 3px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 7px 2px; color: #d3ddd2; font-size: 11px; }
.check-item input { accent-color: var(--green); }
.result-edit { display: flex; align-items: center; gap: 5px; }
.result-edit input { width: 48px; color: var(--text); background: #101b14; border: 1px solid var(--line); border-radius: 7px; padding: 7px 5px; text-align: center; }
.result-edit span { color: var(--muted); font-size: 11px; }
.vote-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: #080e0ad9; backdrop-filter: blur(10px); }
.vote-modal { width: min(620px, 100%); max-height: min(90vh, 850px); overflow: auto; padding: clamp(20px, 4vw, 32px); background: #15231a; border: 1px solid #354735; border-radius: 20px; box-shadow: 0 25px 90px #0008; }
.vote-modal h2 { font-size: 26px; letter-spacing: -1px; margin: 8px 0; }
.vote-modal > p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.vote-player { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(120px, 1.4fr) 40px; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #2a392f; }
.vote-player:last-of-type { border-bottom: 0; }
.vote-player label { font-size: 12px; font-weight: 700; }
.vote-player small { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.vote-player input[type=range] { width: 100%; accent-color: var(--green); }
.vote-score { color: var(--green); text-align: right; font: 700 16px "Space Grotesk", sans-serif; }
.vote-submit { margin-top: 15px; }
.vote-progress { display: flex; align-items: center; gap: 8px; margin: 18px 0; }
.vote-progress span { height: 4px; flex: 1; border-radius: 5px; background: #304033; }
.vote-progress span.done { background: var(--green); }
.toast { position: fixed; z-index: 30; right: 22px; bottom: 22px; max-width: min(410px, calc(100vw - 32px)); padding: 13px 17px; border: 1px solid #455846; border-radius: 12px; color: var(--text); background: #1d2c21; box-shadow: 0 12px 35px #0005; font-size: 13px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #6a3c35; background: #32201d; }

@media (max-width: 860px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 10; inset: auto 0 0; width: auto; height: auto; padding: 6px 8px max(7px, env(safe-area-inset-bottom)); border: 0; border-top: 1px solid #2a392f; background: #111b15f5; backdrop-filter: blur(12px); }
  .sidebar .brand-lockup, .sidebar .nav-caption, .sidebar-bottom { display: none; }
  .nav-list { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
  .nav-list.admin-nav { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .nav-button { flex-direction: column; justify-content: center; gap: 3px; padding: 7px 2px; font-size: 9px; text-align: center; }
  .nav-icon { font-size: 15px; }
  .main-area { padding-bottom: 95px; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; }
  .mobile-brand .brand-mark { width: 30px; height: 30px; border-radius: 10px; font-size: 16px; }
  .mobile-brand .brand-name { font-size: 14px; }
  .topbar { margin-bottom: 25px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-intro { display: none; }
  .auth-box-wrap { min-height: 100vh; padding: 28px 22px; }
  .auth-box { max-width: 420px; }
  .main-area { padding: 17px 14px 95px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 19px; }
  .balance-pill { padding: 7px 9px; font-size: 10px; }
  .page-intro h2 { font-size: 24px; }
  .stats-grid { gap: 8px; }
  .stat-card { padding: 12px 10px; border-radius: 13px; }
  .stat-label { font-size: 9px; }
  .stat-value { font-size: 18px; }
  .stat-note { font-size: 9px; }
  .panel { padding: 13px; border-radius: 14px; }
  .fixture-card { padding: 12px; }
  .player-card { padding: 9px; gap: 7px; }
  .player-side { gap: 7px; }
  .player-photo { width: 34px; height: 34px; flex-basis: 34px; }
  .player-price { font-size: 11px; }
  .mini-button { padding: 7px 8px; font-size: 10px; }
  .market-toolbar select { min-width: 110px; }
  .lineup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vote-player { grid-template-columns: minmax(90px, 1fr) minmax(80px, 1.2fr) 32px; gap: 8px; }
  .vote-player label { font-size: 10px; }
  .nav-list.admin-nav { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
