:root {
  --bg: #0f1419; --panel: #182129; --panel2: #1f2b35; --line: #2c3a46;
  --text: #e8eef2; --muted: #8fa1ae; --accent: #00c853; --accent2: #00a344;
  --red: #ff5252; --blue: #448aff; --purple: #b388ff; --gold: #ffc400;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: var(--accent); }
header.top { background: linear-gradient(90deg, #004d26, #00813d); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
header.top h1 { font-size: 18px; margin: 0; }
header.top nav a { color: #fff; text-decoration: none; margin-left: 14px; opacity: .85; font-size: 14px; }
main { max-width: 980px; margin: 0 auto; padding: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: inherit; }
textarea { min-height: 170px; resize: vertical; }
input[type=color] { padding: 2px; height: 40px; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
button { font: inherit; border: 0; border-radius: 10px; padding: 12px 16px; cursor: pointer; background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
button:hover { filter: brightness(1.15); }
button:disabled { opacity: .35; cursor: not-allowed; }
button.primary { background: var(--accent); color: #002b14; font-weight: 700; border: 0; }
button.danger { background: #3a1d22; color: var(--red); border-color: #5a2a31; }
button.sel { outline: 3px solid var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.b { font-weight: 700; }

/* Score header */
.scorehead { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.scorehead .team { font-size: 15px; color: var(--muted); }
.scorehead .big { font-size: 40px; font-weight: 800; }
.scorehead .ov { font-size: 18px; color: var(--muted); margin-left: 6px; }
.info { color: var(--gold); font-weight: 600; margin-top: 6px; }

/* Tables */
table.card { width: 100%; border-collapse: collapse; margin: 6px 0; }
table.card th { text-align: right; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
table.card th:first-child { text-align: left; }
table.card td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.card td.num { text-align: right; width: 48px; }
table.card tr.active td { background: rgba(0, 200, 83, .08); }
table.card tr.total td, table.card tr.sub td { background: var(--panel2); }
.pname { font-weight: 600; }
.howout { font-size: 12px; color: var(--muted); }

/* Ball chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-width: 32px; height: 32px; padding: 0 6px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; background: var(--panel2); border: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.chip.four { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.six { background: var(--purple); border-color: var(--purple); color: #1a0040; }
.chip.w { background: var(--red); border-color: var(--red); color: #fff; }
.chip.ex { color: var(--gold); }
.chip.dot { color: var(--muted); }

/* Scoring pad */
.pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pad button { font-size: 22px; font-weight: 800; padding: 18px 0; }
.pad button.four { background: #13306b; border-color: var(--blue); }
.pad button.six { background: #34195e; border-color: var(--purple); }
.pad button.wkt { background: #5a1a22; border-color: var(--red); color: #fff; }
.pad button.ext { font-size: 16px; color: var(--gold); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.prompt { background: #2b2410; border: 1px solid #6b5300; border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.prompt h3 { margin: 0 0 6px; color: var(--gold); font-size: 15px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal.open { display: flex; }
.modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; width: 100%; max-width: 440px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { padding: 8px 12px; font-size: 14px; }

/* Tabs */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: var(--muted); padding: 10px 14px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.dot-live { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--red); margin-right: 6px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; padding: 10px 16px; border-radius: 10px; display: none; z-index: 20; }
code.url { background: var(--panel2); padding: 4px 8px; border-radius: 6px; user-select: all; word-break: break-all; }

/* Match cards and lists */
.mcard { display: block; text-decoration: none; color: inherit; transition: border-color .15s; }
.mcard:hover { border-color: var(--accent); }
.mc-top { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.mc-title { font-weight: 700; margin-bottom: 8px; }
.mc-team { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.mc-team .sw { width: 10px; height: 22px; border-radius: 3px; }
.mc-team .nm { flex: 1; font-weight: 600; }
.mc-team .sc { font-weight: 800; font-size: 18px; }
.mc-foot { color: var(--gold); font-weight: 600; font-size: 14px; margin-top: 6px; }
.badge { font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 3px 8px; border-radius: 6px; background: var(--panel2); color: var(--muted); display: inline-flex; align-items: center; }
.badge.live { background: #3a1d22; color: var(--red); }
.badge.up { color: var(--blue); }
.badge.air { background: var(--gold); color: #2b2100; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.cards .panel { margin-bottom: 0; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.hero h2 { margin: 0; font-size: 22px; }
a.button { display: inline-block; text-decoration: none; padding: 12px 16px; border-radius: 10px; background: var(--accent); color: #002b14; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table.card td.l, table.card th.l { text-align: left; }
@media (max-width: 600px) { header.top { flex-wrap: wrap; } header.top nav a { margin: 0 12px 0 0; } }
