:root {
  --bg: #1e1f22; --panel: #2b2d31; --panel2: #313338; --line: #3f4147;
  --text: #f2f3f5; --muted: #a0a4ab; --accent: #9d4dff; --accent2: #b47cff;
  --ok: #23a55a; --bad: #f23f43; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); } .error { color: var(--bad); min-height: 1.2em; margin: 4px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.login { width: 100%; max-width: 360px; display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, textarea, select { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; font: inherit; }
textarea { min-height: 140px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
button { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; font: inherit; cursor: pointer; }
button:hover { border-color: var(--accent2); }
button.primary { background: var(--accent); border-color: var(--accent); font-weight: 600; }
button.primary:hover { background: var(--accent2); }
button.danger { color: var(--bad); }
button.small { padding: 4px 10px; font-size: 13px; }

header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
.dot.on { background: var(--ok); }
nav { display: flex; gap: 4px; padding: 10px 20px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
nav button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 8px 12px; }
nav button.active { color: var(--text); border-bottom-color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.tab { display: none; } .tab.active { display: block; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }
.form { display: grid; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .row, .row3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.check input { width: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--line); padding: 4px 9px; border-radius: 999px; color: var(--text); cursor: pointer; }
.days input { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: none; border-radius: 0; }
.seg button.on { background: var(--accent); }

/* Discord-like preview */
.preview { background: var(--panel2); border-radius: var(--radius); padding: 16px; }
.preview .who { font-weight: 600; margin-bottom: 4px; } .preview .who span { background: #5865f2; font-size: 10px; padding: 1px 4px; border-radius: 3px; margin-left: 4px; vertical-align: middle; }
.preview .mention { background: rgba(88,101,242,.3); color: #c9cdfb; padding: 0 2px; border-radius: 3px; }
.embed { border-left: 4px solid var(--accent); background: var(--panel); border-radius: 4px; padding: 10px 14px; margin-top: 6px; max-width: 520px; }
.embed .author { font-size: 13px; font-weight: 600; }
.embed .title { font-weight: 700; margin: 2px 0 4px; }
.embed .desc { white-space: pre-wrap; font-size: 14px; }
.embed img { max-width: 100%; border-radius: 4px; margin-top: 8px; }
.embed .foot { font-size: 12px; color: var(--muted); margin-top: 8px; }

.list { display: grid; gap: 10px; }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.item .meta { font-size: 13px; color: var(--muted); }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); margin-right: 6px; }
.pill.ok { color: var(--ok); } .pill.bad { color: var(--bad); }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; }
a { color: var(--accent2); }
input[type=color] { height: 40px; padding: 3px; cursor: pointer; }
[hidden] { display: none !important; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.bar h2 { margin: 0; }
.form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form.inline input { flex: 1 1 220px; width: auto; } .form.inline select { width: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 26px; font-weight: 700; margin: 2px 0; }
.stat .s { font-size: 13px; color: var(--muted); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: var(--panel2); position: sticky; top: 0; font-weight: 600; }
tr.me td { background: rgba(157, 77, 255, .18); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.team { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.team h3 { margin: 0; font-size: 16px; }
.team .players { margin: 10px 0; }
.player { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: 14px; }
.addp { display: grid; grid-template-columns: repeat(6, 1fr) auto; gap: 6px; }
@media (max-width: 820px) { .addp { grid-template-columns: 1fr 1fr; } }
#settings .card { margin-bottom: 14px; }
.actions select { width: auto; } .bar .actions { flex-wrap: nowrap; }
.small { font-size: 12px; }
.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live { animation: none; } }
.pill.sheet { color: #7cc4ff; }
.player select { width: auto; padding: 3px 6px; font-size: 13px; }
.addp { grid-template-columns: repeat(7, 1fr) auto; }
.chartcard h3 { margin: 0 0 8px; font-size: 15px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .val { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart .hit { fill: transparent; cursor: default; }
.tip { position: absolute; pointer-events: none; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; z-index: 5; }
.tip.on { opacity: 1; }
#rcOut img { max-width: 360px; width: 100%; border-radius: 10px; margin-top: 10px; border: 1px solid var(--line); }
.form p { margin: 0; }
.zone { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 13px; border: 1px solid var(--line); }
.zone.finals { color: #5be38a; } .zone.semis { color: #f5c542; } .zone.out { color: #ff7b7b; }
.split { display: flex; gap: 2px; height: 18px; border-radius: 6px; overflow: hidden; margin: 6px 0; }
.split > div { height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.range { position: relative; height: 14px; min-width: 120px; }
.range .ln { position: absolute; top: 6px; height: 2px; background: var(--muted); opacity: .5; }
.range .dt { position: absolute; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: translateX(-50%); border: 2px solid var(--panel); }
@media (max-width: 640px) { .bar .actions { flex-wrap: wrap; } .bar { align-items: flex-start; } }
.form > * { min-width: 0; } .grid2 > * { min-width: 0; }
