:root {
  --bg: #0e1116;
  --panel: #171c26;
  --panel-2: #1f2734;
  --line: #2a3341;
  --text: #e8edf4;
  --muted: #93a1b5;
  --accent: #ffb020;
  --accent-2: #35c26b;
  --danger: #ff5a5f;
  --blue: #3d8bff;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(0,0,0,.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 90px;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }

header.app {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14,17,22,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
header.app .wrap { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: .2px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.tvlink { color: var(--muted); text-decoration: none; font-size: 13px; border: 1px solid var(--line); padding: 6px 10px; border-radius: 999px; }
.tvlink:hover { color: var(--text); }

nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: var(--panel); border-top: 1px solid var(--line);
}
nav.tabs button {
  flex: 1; background: none; border: none; color: var(--muted);
  padding: 12px 4px 16px; font-size: 12px; font-weight: 600; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
nav.tabs button .ic { font-size: 20px; }
nav.tabs button.active { color: var(--accent); }

h1 { font-size: 22px; margin: 6px 0 4px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
input, select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 12px; font-size: 16px; outline: none;
}
input:focus, select:focus { border-color: var(--blue); }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%2393a1b5' stroke-width='2' fill='none'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #1a1205; border: none; border-radius: 12px;
  padding: 14px 18px; font-size: 16px; font-weight: 700; cursor: pointer; width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: none; color: var(--muted); border: 1px solid var(--line); }
.btn.danger { background: none; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; margin-top: 10px; }

.team-row { display: grid; grid-template-columns: 26px 1fr 40%; gap: 8px; align-items: center; margin-bottom: 10px; }
.team-row .num { color: var(--muted); font-weight: 700; text-align: center; }

.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px; }
.pill.skip { background: rgba(255,90,95,.14); color: var(--danger); }
.pill.bye { background: rgba(61,139,255,.16); color: var(--blue); }
.pill.target { background: var(--panel-2); color: var(--muted); }
.pill.done { background: rgba(53,194,107,.16); color: var(--accent-2); }

.round { margin-bottom: 18px; }
.round-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.round-head .rname { font-size: 16px; font-weight: 800; }
.round-head .bye { font-size: 13px; color: var(--muted); }

.game { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.game .ev { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.game .ev .evname { font-weight: 700; }
.matchup { display: grid; grid-template-columns: 1fr 54px; gap: 10px; align-items: center; }
.matchup .side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.matchup .side .tn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.matchup .score { text-align: center; }
.matchup .score input { text-align: center; font-size: 20px; font-weight: 800; padding: 8px 4px; }
.matchup .winner .tn { color: var(--accent-2); }
.vs { text-align: center; color: var(--muted); font-size: 12px; margin: 6px 0; }

table.stand { width: 100%; border-collapse: collapse; }
table.stand th, table.stand td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
table.stand th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
table.stand td.num, table.stand th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.stand .rank { color: var(--muted); font-weight: 800; width: 24px; }
table.stand tr.top td { background: rgba(255,176,32,.06); }
table.stand .tname { font-weight: 700; }
.mov-pos { color: var(--accent-2); }
.mov-neg { color: var(--danger); }

.note { font-size: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.toast { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); background: var(--accent-2); color: #06210f; padding: 10px 16px; border-radius: 999px; font-weight: 700; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); color: #fff; }
.hidden { display: none !important; }
.center { text-align: center; }
.spacer { height: 8px; }
.legend { font-size: 12px; color: var(--muted); margin-top: 6px; }
