
:root{
  --bg:#06111b;
  --panel:#0a1b2a;
  --panel2:#0d2234;
  --line:#24445d;
  --text:#f4f7fb;
  --muted:#8fa7ba;
  --blue:#1688ff;
  --green:#3f942e;
  --red:#d93025;
  --gold:#f4b41a;
  --sidebar:250px;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:var(--bg);color:var(--text);font-family:Inter,Segoe UI,Arial,sans-serif}
button,input,select{font:inherit}
button{touch-action:manipulation}
.app-shell{display:grid;grid-template-columns:var(--sidebar) 1fr;min-height:100vh}
.sidebar{
  border-right:1px solid var(--line);
  background:linear-gradient(180deg,#071625 0%,#06111b 100%);
  padding:12px 12px 16px;
  position:sticky;top:0;height:100vh;overflow:auto
}
.logo-wrap{display:flex;justify-content:center;align-items:center;padding:3px 0 10px;border-bottom:1px solid var(--line)}
.logo-wrap img{width:100%;max-height:245px;object-fit:contain;border-radius:14px}
.sidebar h3{font-size:14px;margin:17px 4px 9px;color:#d9e7f3;letter-spacing:.04em}
.player-list{display:grid;gap:8px}
.player-side{
  width:100%;display:flex;align-items:center;gap:10px;background:#0a1c2c;border:1px solid #24445d;
  color:white;border-radius:9px;padding:11px 12px;text-align:left;cursor:pointer
}
.player-side .num{width:28px;height:28px;border:1px solid var(--blue);border-radius:7px;display:grid;place-items:center;color:#58b0ff;font-weight:700}
.player-side .arrow{margin-left:auto;color:#9ab2c6}
.side-note{margin-top:18px;padding:15px 10px;border-top:1px solid var(--line);text-align:center;color:#d4dfeb;line-height:1.65;font-size:13px}
.main{padding:10px 12px 18px;min-width:0}
.top-tabs{display:flex;gap:5px;align-items:stretch;overflow-x:auto;padding-bottom:6px}
.round-tab,.summary-tab{
  flex:0 0 50px;background:#081521;color:#fff;border:1px solid #29465d;border-radius:8px;
  padding:11px 7px;font-weight:700;cursor:pointer
}
.round-tab.active,.summary-tab.active{background:#0b5ec8;border-color:#1688ff}
.summary-tab{flex-basis:112px;margin-left:6px}
.round-header{
  display:grid;grid-template-columns:auto minmax(280px,1fr) auto;gap:16px;align-items:center;
  background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:13px 16px;margin-bottom:8px
}
.round-title{font-size:22px;font-weight:800;color:#25a2ff;white-space:nowrap}
.opponent-box{display:flex;align-items:center;gap:8px}
.opponent-box label{color:#d1dfeb;font-size:12px;white-space:nowrap}
.opponent-box input{
  width:100%;background:#f5f5f5;border:0;border-radius:6px;padding:10px 12px;color:#111;font-weight:700;font-size:18px
}
.date-box{color:#dce8f1;font-size:13px;white-space:nowrap}
.status-pill{background:#3b7f25;color:#fff;border-radius:6px;padding:9px 15px;font-weight:800;white-space:nowrap}
.section{
  background:var(--panel);border:1px solid var(--line);border-radius:10px;margin-bottom:8px;overflow:hidden
}
.section-title{padding:11px 14px 4px;color:#27a6ff;font-size:20px;font-weight:800}
.section-title small{font-size:13px;font-weight:500;margin-left:7px;color:#54b7ff}
.match-table{width:100%;border-collapse:collapse;table-layout:fixed}
.match-table th{font-size:11px;font-weight:700;color:#c8d7e4;padding:6px 6px;text-align:center}
.match-table td{padding:4px 6px;text-align:center}
.match-table tr + tr td{border-top:1px solid rgba(45,72,94,.28)}
.slot{width:44px}
.ours1{width:210px}.ours2{width:210px}
.vs{width:40px}.opp1{width:220px}.opp2{width:220px}
.leg{width:85px}.point{width:70px}
.match-id{display:grid;place-items:center;background:#081927;border:1px solid #087dcc;border-radius:6px;height:42px;color:#33aaff;font-weight:800}
.our-select,.opp-input{
  width:100%;height:42px;border-radius:6px;padding:0 11px;border:1px solid #cfd7dd;background:#f4f4f4;color:#111
}
.our-select{font-weight:600}
.opp-input{font-style:italic}
.vs-cell{font-weight:800;color:#e8f0f6}
.leg-btn{
  width:100%;height:42px;border-radius:6px;border:1px solid #31506a;background:#152534;color:#cbd8e2;
  font-size:18px;font-weight:900;cursor:pointer
}
.leg-btn.w{background:var(--green);border-color:#4ba33a;color:#fff}
.leg-btn.l{background:var(--red);border-color:#e64337;color:#fff}
.point-box{
  height:42px;border:1px solid #29465d;border-radius:6px;display:grid;place-items:center;font-size:21px;font-weight:900
}
.point-box.win{color:#61b84b}.point-box.loss{color:#ef3c30}
.section-total{
  display:flex;justify-content:flex-end;gap:12px;align-items:center;padding:6px 30px 10px;color:#20a3ff;font-weight:800
}
.section-total strong{font-size:28px;color:#57a936}
.round-footer{
  display:grid;grid-template-columns:1fr auto 1fr auto;align-items:center;gap:18px;background:var(--panel);border:1px solid var(--line);
  border-radius:10px;padding:12px 18px;margin-bottom:8px
}
.score-team{text-align:center}
.score-team .label{font-weight:900;color:#24a4ff;font-size:17px}
.score-team.opponent .label{color:#fff}
.big-score{font-size:58px;line-height:1;font-weight:900;color:#57a936}
.score-team.opponent .big-score{color:#ef382b}
.result-card{text-align:center;padding:0 25px;border-left:1px solid var(--line);border-right:1px solid var(--line)}
.result-card .result{font-size:23px;font-weight:900;color:#57a936}
.result-card .sub{font-size:13px;color:#dce6ee;margin-top:5px}
.save-btn{
  background:#0866d9;border:1px solid #188dff;color:white;border-radius:8px;padding:18px 24px;font-weight:900;font-size:18px;cursor:pointer
}
.bye-btn{
  background:#082138;border:1px solid #1688ff;color:#57b6ff;border-radius:7px;padding:9px 12px;font-weight:800;cursor:pointer
}
.legend{
  display:flex;align-items:center;justify-content:center;gap:16px;background:var(--panel);border:1px solid var(--line);
  border-radius:10px;padding:10px 16px;color:#dbe5ed;font-size:13px
}
.key{display:inline-flex;align-items:center;gap:7px}
.key-chip{width:40px;height:35px;display:grid;place-items:center;border-radius:5px;font-weight:900}
.key-chip.w{background:var(--green)}.key-chip.l{background:var(--red)}.key-chip.n{background:#172534;border:1px solid #31506a}
.summary{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:16px}
.summary h2{margin:0 0 12px;color:#29a7ff}
.summary-table{width:100%;border-collapse:collapse}
.summary-table th,.summary-table td{padding:9px;border-bottom:1px solid #1f4058;text-align:left}
.win-text{color:#62b84e;font-weight:800}.loss-text{color:#ef4538;font-weight:800}.bye-text{color:#f4b41a;font-weight:800}
.modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.72);display:grid;place-items:center;z-index:50;padding:18px}
.modal{width:min(560px,95vw);background:#0a1a29;border:1px solid #3b607d;border-radius:14px;padding:20px;box-shadow:0 20px 70px rgba(0,0,0,.5)}
.modal h2{margin:0 0 16px}
.stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.stat-btn{height:72px;border-radius:50%;border:0;color:white;font-weight:900;font-size:17px;cursor:pointer}
.stat-btn.s180{background:#6a2f9e}.stat-btn.s171{background:#3b8f2d}.stat-btn.spoo{background:#d37a00}.stat-btn.sbnb{background:#1268c7}
.modal-stat-values{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;text-align:center;margin-top:8px;color:#cbd9e5}
.high-row{display:flex;align-items:center;justify-content:center;gap:10px;margin:20px 0}
.high-row input{width:120px;padding:12px;text-align:center;font-size:24px;border-radius:7px;border:0}
.modal-actions{display:flex;gap:10px;justify-content:flex-end}
.modal-actions button{padding:11px 18px;border-radius:7px;border:1px solid #31506a;background:#102538;color:#fff;font-weight:800;cursor:pointer}
.modal-actions .primary{background:#0866d9;border-color:#1688ff}
.toast{position:fixed;right:20px;bottom:20px;background:#173a20;border:1px solid #4b9f55;color:white;border-radius:8px;padding:12px 16px;z-index:80}
@media (max-width:1150px){
  :root{--sidebar:205px}
  .round-header{grid-template-columns:auto 1fr auto}
  .status-pill{display:none}
  .match-table{min-width:900px}.section{overflow-x:auto}
  .main{padding-right:8px}
}
@media (orientation:portrait){
  .app-shell{grid-template-columns:1fr}
  .sidebar{position:relative;height:auto;display:none}
}

/* v0.3 player stat modal */
.stat-edit-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
  margin:12px 0 20px;
}
.stat-edit-card{
  background:#0d2234;
  border:1px solid #29465d;
  border-radius:10px;
  padding:13px;
}
.stat-label{
  text-align:center;
  font-weight:900;
  color:#e7f0f7;
  margin-bottom:10px;
  font-size:16px;
}
.stat-controls{
  display:grid;
  grid-template-columns:58px 1fr 58px;
  gap:10px;
  align-items:center;
}
.stat-count{
  min-height:56px;
  display:grid;
  place-items:center;
  background:#071522;
  border:1px solid #31506a;
  border-radius:8px;
  font-size:30px;
  font-weight:900;
}
.stat-change{
  height:56px;
  border-radius:9px;
  border:1px solid #31506a;
  color:#fff;
  font-size:30px;
  font-weight:900;
  cursor:pointer;
}
.stat-change.minus{background:#8b2d24}
.stat-change.minus:disabled{opacity:.3;cursor:not-allowed}
.stat-change.plus.purple{background:#6a2f9e}
.stat-change.plus.green{background:#3b8f2d}
.stat-change.plus.orange{background:#d37a00}
.stat-change.plus.blue{background:#1268c7}
