:root {
  color-scheme: dark;
  --bg: #0d0f14;
  --bg2: #141821;
  --panel: #181d28;
  --panel2: #212839;
  --line: #2a3246;
  --text: #e8ebf2;
  --muted: #8d95aa;
  --accent: #f0b429;
  --accent-ink: #1b1400;
  --blue: #5b8cff;
  --danger: #ff5d6c;
  --ok: #3ecf8e;
  --b0: #5ec8ff;
  --b1: #ffd54f;
  --b2: #ff6b6b;
  --b3: #c792ea;
  --b4: #3ecf8e;
  --b5: #ff9f43;
  --r: 12px;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--blue); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
code { font-family: var(--mono); background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
svg { width: 18px; height: 18px; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- shell */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(13, 15, 20, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: .3px; }
.brand img { width: 28px; height: 28px; }
.brand b { color: var(--accent); }
.char-switch {
  margin-left: auto; display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; color: var(--text); cursor: pointer; font: inherit;
}
.char-switch:hover { border-color: var(--accent); }
.cs-text { display: flex; flex-direction: column; text-align: left; line-height: 1.1; }
.cs-text small { color: var(--muted); font-size: 11px; }
.cs-caret { color: var(--muted); }

.tabs { display: flex; gap: 4px; padding: 8px 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 600; font-size: 14px; }
.tab:hover { color: var(--text); background: var(--panel); }
.tab.on { color: var(--text); background: var(--panel2); }
.tab.on svg { color: var(--accent); }
.tab.soon { opacity: .6; }

main { max-width: 1120px; margin: 0 auto; padding: 18px 16px 48px; }

@media (max-width: 720px) {
  .tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; justify-content: space-around; gap: 0;
    padding: 6px 2px calc(6px + env(safe-area-inset-bottom)); background: var(--bg2); border-top: 1px solid var(--line); border-bottom: 0;
  }
  .tab { flex: 1; min-width: 0; flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 10.5px; border-radius: 10px; }
  .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .tab.on { background: none; color: var(--accent); }
  main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .cs-text small { display: none; }
}

/* ---------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #3a4560; background: var(--panel2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.icon-btn { width: 36px; height: 36px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; }
.icon-btn:hover { color: var(--text); border-color: #3a4560; }
.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-width: 0;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip:focus-visible, .card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; width: 100%; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: auto; }
input[type="range"] { padding: 0; accent-color: var(--accent); border: 0; background: none; }

.view-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.intro { margin: -6px 0 14px; font-size: 14px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.toolbar input[type="search"] { flex: 1; }
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.chip-row { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip-label { font-size: 12px; color: var(--muted); width: 66px; flex: none; text-transform: uppercase; letter-spacing: .5px; }
.chip {
  flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

@media (max-width: 720px) {
  .toolbar { flex-wrap: wrap; }
  .toolbar input[type="search"] { flex-basis: 100%; }
  .toolbar select { flex: 1; }
  .view-head .btn span { display: none; }
  .view-head .btn { padding: 9px 11px; }
  .chip-label { width: auto; }
}

/* ---------- cards */
.group { margin-bottom: 22px; }
.group h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.count { font-size: 12px; background: var(--panel2); color: var(--text); padding: 1px 8px; border-radius: 999px; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); }
.cards.strats { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.card { display: flex; gap: 12px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; min-width: 0; transition: border-color .15s, transform .15s; }
.card:hover { border-color: #3d4864; transform: translateY(-1px); }
.card-media { width: 64px; height: 64px; flex: none; border-radius: 10px; background: var(--panel2); overflow: hidden; display: grid; place-items: center; }
.card-media img { width: 100%; height: 100%; object-fit: contain; }
.initials { font-weight: 800; color: var(--muted); font-size: 18px; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.card-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.card-head h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dmg { font-family: var(--mono); font-weight: 800; color: var(--accent); font-size: 15px; }

.card.strat { flex-direction: column; padding: 0; overflow: hidden; gap: 0; }
.card.strat .card-body { padding: 12px; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--panel2); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-ph { color: var(--muted); font-size: 26px; }
.thumb-ph svg { width: 32px; height: 32px; }
.thumb .vbadge { position: absolute; left: 8px; bottom: 8px; }
.vcount { position: absolute; right: 8px; bottom: 8px; font-size: 12px; background: rgba(0, 0, 0, .7); padding: 2px 7px; border-radius: 6px; }
.excerpt { margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--panel2); color: #c8cfe0; white-space: nowrap; }
.badge.sit-mid { background: #1d3150; color: #9cc3ff; }
.badge.sit-carry { background: #2a2650; color: #b9b0ff; }
.badge.sit-nearcorner { background: #3b2a1c; color: #ffc48a; }
.badge.sit-corner { background: #4a1f27; color: #ff9aa8; }
.badge.sit-any { background: #1f3a33; color: #8de0c4; }
.badge.st-learning { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.badge.st-training { background: #1f3550; color: #9cc3ff; }
.badge.st-match { background: #1c3a2c; color: var(--ok); }
.badge.vid { background: #3a1f2e; color: #ff9fcf; }
.badge.vs { background: #3a2a1a; color: #ffc48a; }
.badge.soon { background: #3b3220; color: var(--accent); }
.badge.meter.zero { color: var(--ok); }
.meter-bar { width: 38px; height: 6px; border-radius: 3px; background: #0c0f16; overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: linear-gradient(90deg, #4f8cff, #b16cff); }
.diff { font-size: 9px; letter-spacing: 1px; color: var(--accent); }
.diff .off { color: #3a4258; }
.tag { font-size: 12px; color: var(--blue); }
.vbadge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: #000; color: #fff; flex: none; }
.vbadge.k-youtube { background: #c4302b; }
.vbadge.k-twitch { background: #6441a5; }
.vbadge.k-file, .vbadge.k-direct { background: #2c6e49; }

/* ---------- notation */
.notation { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 3px; font-family: var(--mono); font-size: 13px; }
.n-move, .n-word { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 6px; background: var(--bg2); border: 1px solid var(--line); line-height: 1.5; }
.n-pre, .n-suf { color: var(--muted); }
.n-mot { color: var(--text); }
.n-mot.arrows { font-family: system-ui, sans-serif; letter-spacing: -1px; margin-right: 2px; }
.charge { border-bottom: 2px solid var(--muted); }
.n-btn { font-weight: 800; }
.b0 { color: var(--b0); } .b1 { color: var(--b1); } .b2 { color: var(--b2); } .b3 { color: var(--b3); } .b4 { color: var(--b4); } .b5 { color: var(--b5); }
.n-word { color: #cbbcff; background: #221d33; border-color: #352c52; }
.n-super { color: var(--accent-ink); background: linear-gradient(135deg, #ffd66b, #f0a429); border-color: #f0b429; font-weight: 800; }
.n-sep { color: var(--muted); font-weight: 700; padding: 0 1px; }
.n-link { color: var(--blue); }
.n-follow { color: var(--b3); }
.notation.big { font-size: 17px; gap: 8px 5px; margin-bottom: 10px; }
.notation.big .n-move, .notation.big .n-word { padding: 4px 10px; border-radius: 8px; }

/* ---------- Dustloop moves */
.has-move { border-bottom: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); }
[data-act="move-focus"] { cursor: pointer; }
[data-act="move-focus"]:hover { border-color: var(--accent); }
.mv-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 10px; scroll-snap-type: x proximity; }
.mv-strip:empty { display: none; }
.mv { flex: none; width: 168px; scroll-snap-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, box-shadow .15s; }
.mv.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.mv.missing { justify-content: center; opacity: .6; border-style: dashed; }
.mv-img { height: 110px; border-radius: 8px; background: radial-gradient(circle at 50% 60%, #252c3d, #11141b); display: grid; place-items: center; overflow: hidden; }
.mv-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.mv-head { display: flex; flex-direction: column; line-height: 1.25; }
.mv-head b { font-family: var(--mono); color: var(--accent); }
.mv-head span { font-size: 12px; color: var(--muted); }
.mv-fd { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; margin: 0; font-size: 12px; }
.mv-fd dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
.mv-fd dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }
.palette { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--panel); }
.palette summary { cursor: pointer; font-weight: 700; }
.palette h4 { margin: 12px 0 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.pal { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer; font-family: var(--mono); font-size: 12px; font-weight: 700; min-width: 0; }
.pal:hover { border-color: var(--accent); }
.pal:active { background: var(--panel2); }
.pal img, .pal-ph { width: 100%; height: 52px; object-fit: contain; }
.pal span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- account & community */
.auth { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.auth input { width: 100%; }
.src-tabs { margin: -4px 0 14px; }
.badge.author { background: #23324f; color: #9cc3ff; }
.share-toggle { justify-content: flex-start; font-size: 14px; color: var(--text); padding: 8px 10px; border: 1px dashed var(--line); border-radius: 10px; }
.err { color: #ff8f9b; }

/* ---------- suggested combos (editor) */
.suggest details { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 12px; padding: 10px 12px; background: color-mix(in srgb, var(--accent) 5%, var(--panel)); }
.suggest summary { cursor: pointer; font-weight: 700; }
.suggest h4 { margin: 12px 0 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.suggest input[type="search"] { width: 100%; margin: 6px 0; }
.sug-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; }
.sug { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.sug .grow { display: flex; flex-direction: column; gap: 6px; }
.sug .notation { font-size: 12px; }
.sug-label { align-self: flex-start; background: var(--accent); color: var(--accent-ink); }
.sug-title { font-size: 13px; }

/* ---------- frame data */
.seg-tabs { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.seg-tabs button { padding: 7px 14px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.seg-tabs button.on { background: var(--panel2); color: var(--text); }
.smart { display: flex; gap: 8px; }
.smart input { flex: 1; font-size: 16px; padding: 12px 14px; border-radius: 12px; }
.smart-msg { min-height: 1.4em; margin: 8px 2px 12px; color: var(--muted); }
.smart-msg b { color: var(--text); }
.fd-pickers { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.fd-pickers input[type="search"] { flex: 1; min-width: 160px; }
.picker { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.picker:hover { border-color: var(--accent); }
.picker .avatar.lg { width: 48px; height: 48px; }
.picker-text { display: flex; flex-direction: column; line-height: 1.2; }
.picker-text small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.vs { font-weight: 900; color: var(--accent); font-style: italic; }
.fd-layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
.fd-moves { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; margin: 0; }
.fd-moves input { width: 100%; margin-bottom: 4px; }
.fd-moves h4 { margin: 12px 0 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.pal.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg2)); }
.pal em { font-style: normal; font-size: 11px; font-weight: 700; }
.adv-plus { color: #7fb2ff; }
.adv-even { color: var(--muted); }
.adv-minus { color: #ffd166; }
.adv-punish { color: #ff7b88; }
.img-ph { display: block; background: var(--panel2); border-radius: 8px; }
.fd-move { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 12px; }
.fd-move h2 small { font-size: 14px; font-weight: 500; }
.fd-move .facts { margin: 10px 0 0; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.mv-img.big { width: 180px; height: 150px; flex: none; }
.mv-img.big .img-ph { width: 100%; height: 100%; }
.verdict { border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; border: 1px solid; }
.verdict b { font-size: 18px; }
.verdict p { margin: 4px 0 0; color: #d3d8e4; }
.tone-good { background: #12301f; border-color: #2f7a52; }
.tone-good b { color: #6ee7a8; }
.tone-mid { background: #2e2814; border-color: #7a6a2f; }
.tone-mid b { color: #ffd166; }
.tone-bad { background: #34161b; border-color: #8a3340; }
.tone-bad b { color: #ff8f9b; }
#fdResult h3 { margin: 18px 0 8px; }
#fdResult h4 { margin: 10px 0 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.pun-list { display: flex; flex-direction: column; gap: 8px; }
.pun { display: flex; gap: 12px; align-items: center; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.pun-img { width: 72px; height: 56px; object-fit: contain; flex: none; border-radius: 8px; background: radial-gradient(circle at 50% 60%, #252c3d, #11141b); }
.pun .badges { margin-top: 4px; }
.badge.good { background: #163525; color: #6ee7a8; }
.opts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 10px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--muted); }
.opt span { color: #c8cfe0; font-size: 14px; }
.opt-good { border-left-color: var(--ok); }
.opt-mid { border-left-color: #ffd166; }
.opt-bad { border-left-color: var(--danger); }
.caveat { margin-top: 16px; }
.legend span { font-weight: 700; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.fdt { width: 100%; border-collapse: collapse; font-size: 13px; }
.fdt th { position: sticky; top: 0; background: var(--panel2); text-align: left; padding: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); white-space: nowrap; }
.fdt td { padding: 6px 8px; border-top: 1px solid var(--line); font-family: var(--mono); vertical-align: middle; min-width: 60px; }
.fdt td:nth-child(2) { min-width: 140px; font-family: inherit; }
.fdt td small { display: block; color: var(--muted); }
.fdt tbody tr { cursor: pointer; }
.fdt tbody tr:hover { background: var(--panel); }
.fdt-img { width: 64px; height: 48px; object-fit: contain; display: block; }
.pick.mine { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
#pkQ { width: 100%; margin-bottom: 12px; }

@media (max-width: 860px) {
  .fd-layout { grid-template-columns: 1fr; }
  .fd-moves { position: static; max-height: 380px; }
}
@media (max-width: 720px) {
  .smart { flex-wrap: wrap; }
  .smart input { flex-basis: 100%; }
  .smart .btn { flex: 1; }
  .fd-move { flex-direction: column; align-items: stretch; }
  .fd-move .facts { grid-template-columns: 1fr 1fr; }
  .mv-img.big { width: 100%; }
  .pun { flex-wrap: wrap; }
  .view-head .seg-tabs { width: 100%; }
  .seg-tabs button { flex: 1; }
}

/* ---------- replays */
.tab .l-short { display: none; }
.rp-status { display: flex; align-items: center; gap: 8px; min-height: 22px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.rp-status .err { color: #ff8f9b; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.rp-chars .char-pick { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 18px; }
.rp-chars .pick { padding: 8px 4px; gap: 3px; font-size: 13px; }
.rp-chars .pick .avatar.lg { width: 52px; height: 52px; }
.rp-chars .pick small { font-size: 11px; }
.rp-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.rp-title { font-size: 14px; font-weight: 500; line-height: 1.35; }
.rp-title b { font-weight: 700; color: #c8cfe0; }
.rp-title i { color: var(--accent); font-weight: 800; }
.rp-me b { color: var(--accent); }
.center { text-align: center; margin-top: 16px; }

@media (max-width: 720px) {
  .tab .l-long { display: none; }
  .tab .l-short { display: block; }
}

/* ---------- start.gg stats & tournaments */
.sg-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sg-id a { text-decoration: none; }
.sg-id .avatar.lg { border-radius: 50%; object-fit: cover; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.tile-k { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.tile-v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel h2 small { font-size: 12px; font-weight: 500; }
.panel h3 { margin: 16px 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.panel > input[type="search"] { width: 100%; margin-bottom: 8px; }
.rows { display: flex; flex-direction: column; }
.rows.panel { padding: 6px 16px; }
.row-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font: inherit; text-align: left; width: 100%; }
.row-item:last-child { border-bottom: 0; }
button.row-item { cursor: pointer; border-radius: 8px; }
button.row-item:hover { background: var(--panel2); }
.ri-name { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.ri-name b, .ri-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-bar { display: flex; align-items: center; gap: 8px; width: 210px; flex: none; }
.ri-actions { display: flex; gap: 4px; justify-content: flex-end; min-width: 76px; flex: none; }
.ri-actions .btn { padding: 6px 8px; }
.wl { display: flex; width: 90px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--bg2); gap: 2px; flex: none; }
.wl i { display: block; height: 100%; }
.wl .w { background: #3ecf8e; border-radius: 4px 0 0 4px; }
.wl .l { background: #e5606e; border-radius: 0 4px 4px 0; }
.wl-txt { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; }
.place { display: flex; flex-direction: column; align-items: flex-end; flex: none; font-variant-numeric: tabular-nums; }
.place b { color: var(--accent); }
.set-list { display: flex; flex-direction: column; gap: 6px; }
.set-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.set-row .grow { display: flex; flex-direction: column; min-width: 0; }
.set-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-res { width: 26px; height: 26px; flex: none; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.set-res.win { background: #163525; color: #6ee7a8; }
.set-res.loss { background: #3a1a20; color: #ff8f9b; }
.set-chars { display: flex; gap: 2px; }
.set-score { font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.section-title { margin: 6px 0 12px; display: flex; gap: 8px; align-items: baseline; }
.section-title small { font-size: 13px; font-weight: 500; }
.tourneys { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; margin-bottom: 24px; }
.tourney { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.t-banner { position: relative; height: 96px; background: var(--panel2) center / cover; }
.t-banner img { position: absolute; left: 12px; bottom: -22px; width: 56px; height: 56px; border-radius: 12px; border: 3px solid var(--panel); background: var(--panel); object-fit: cover; }
.t-when { position: absolute; right: 10px; top: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(0, 0, 0, .7); font-size: 12px; font-weight: 700; }
.t-when.hot { background: var(--accent); color: var(--accent-ink); }
.t-body { padding: 28px 14px 14px; }
.t-body h3 a { color: var(--text); text-decoration: none; }
.t-body h3 a:hover { text-decoration: underline; }
.t-body p { margin: 4px 0 10px; }
.t-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.t-events li { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; background: var(--bg2); }
.t-events a { font-weight: 700; color: var(--text); text-decoration: none; }
.t-events .row { justify-content: space-between; gap: 6px; }
.badge.st-pending { background: #3b2f12; color: #ffd166; }
.t-warn { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: #2e2814; border: 1px solid #7a6a2f; color: #ffe2a0; }
.t-unwatch { position: absolute; left: 10px; top: 10px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; cursor: pointer; }
.watch-form { margin: -8px 0 6px; }
.watch-form input { font-size: 15px; padding: 10px 12px; }
.merge { margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.merge .row select { flex: 1; min-width: 0; }
.tag-pill { display: inline-flex; gap: 6px; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--panel2); }
#sgTour { flex: 1; min-width: 0; max-width: 520px; }
.dq-note { margin-top: 10px; }
.dq-note summary { cursor: pointer; }
.dq-note ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }

@media (max-width: 720px) {
  .ri-bar { width: auto; }
  .wl { width: 54px; }
  .row-item { gap: 8px; }
  .ri-actions { min-width: 0; }
  .ri-actions .btn { padding: 5px 6px; }
  .wl-txt .muted { display: none; }
  .tile-v { font-size: 22px; }
}

/* ---------- dialog */
dialog#modal {
  padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--bg2); color: var(--text);
  width: min(720px, calc(100% - 32px)); max-height: calc(100% - 32px); box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
dialog#modal.wide { width: min(860px, calc(100% - 32px)); }
dialog#modal.narrow { width: min(520px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(4, 6, 10, .72); backdrop-filter: blur(3px); }
.dlg { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.ed { display: contents; }
.dlg-head { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dlg-head h2 small { font-size: 13px; margin-left: 6px; }
.dlg-body { padding: 16px; overflow: auto; flex: 1; }
.dlg-body h3 { margin: 18px 0 10px; }
.dlg-foot { display: flex; gap: 8px; align-items: center; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  dialog#modal, dialog#modal.wide, dialog#modal.narrow { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border: 0; border-radius: 0; }
  .dlg { height: 100dvh; max-height: 100dvh; }
  .dlg-head { padding-top: max(14px, env(safe-area-inset-top)); }
}

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px 16px; margin: 14px 0; }
.facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.facts dd { margin: 0; }
.notes { white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 12px 0; overflow-wrap: anywhere; }
.videos { display: grid; gap: 14px; }
.video { border-radius: 12px; overflow: hidden; }
.video video, .frame iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; border-radius: 12px; }
.video video { max-height: 70vh; }
.tweet { display: flex; justify-content: center; }
.tweet .twitter-tweet { margin: 0 !important; }
.video-cap { font-size: 13px; color: var(--muted); padding: 6px 2px 0; }
.video-loading, .video-err, .video-link { padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.video-err { color: #ffb0b8; }
.vctl { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 0 0; }
.vctl-group { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.vctl button { background: var(--panel); color: var(--muted); border: 0; border-right: 1px solid var(--line); padding: 5px 10px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.vctl button:last-child { border-right: 0; }
.vctl button.on, .vctl button:hover { color: var(--text); background: var(--panel2); }
.vctl-loop { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }

/* ---------- form */
.form { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: max-content; gap: 14px; align-content: start; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.full { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: 12px; }
.meter-input { display: flex; align-items: center; gap: 10px; }
.meter-input input { flex: 1; }
.meter-input output { font-family: var(--mono); font-weight: 700; width: 52px; text-align: right; }
.quick { display: flex; gap: 6px; }
.keypad { display: flex; flex-direction: column; gap: 6px; margin-top: -6px; }
.kp-row { display: flex; gap: 5px; flex-wrap: wrap; }
.kp-row button { min-width: 38px; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-family: var(--mono); font-size: 13px; font-weight: 700; cursor: pointer; }
.kp-row button:hover { border-color: var(--accent); }
.kp-row button:active { background: var(--panel2); }
.preview { min-height: 40px; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; }
.img-edit { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.vid-list { display: flex; flex-direction: column; gap: 8px; }
.vid-item { display: flex; gap: 8px; align-items: center; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.vid-src { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.vid-label { width: 40%; padding: 6px 9px; font-size: 13px; }
.vid-add { display: flex; gap: 8px; }
.vid-add input { flex: 1; }

@media (max-width: 720px) {
  .form { grid-template-columns: 1fr; }
  .vid-item { flex-wrap: wrap; }
  .vid-label { width: 100%; order: 3; }
  .vid-add { flex-wrap: wrap; }
  .vid-add input { flex-basis: 100%; }
  .vid-add .btn { flex: 1; }
}

/* ---------- characters */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--panel2); flex: none; display: inline-grid; place-items: center; }
.avatar.sm { width: 32px; height: 32px; }
.avatar.lg { width: 64px; height: 64px; border-radius: 14px; object-fit: contain; }
.avatar.initials { font-size: 13px; }
.avatar.lg.initials { font-size: 18px; }
.char-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.pick.on, .pick:hover { border-color: var(--accent); }
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin: 12px 0; }
.char-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); text-align: center; }
.char-tile.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.tile-sprite { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 14px; }
.tile-sprite:hover .avatar { outline: 2px solid var(--accent); }
.tile-name { font-weight: 700; font-size: 14px; }
.mine-toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); cursor: pointer; }
#charQ { width: 100%; }

/* ---------- panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.panel h2 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.panel h2 select { font-size: 14px; padding: 5px 8px; }
.panel p { margin: 6px 0 10px; }
.panel input:not([type="radio"]):not([type="checkbox"]) { flex: 1; }
.row.wrap input { min-width: 140px; }
.seg { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.seg label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.plain { list-style: none; padding: 0; margin: 0 0 12px; }
.plain li { padding: 4px 0; }
.soon-panel { border-style: dashed; }
.soon-panel ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.soon-panel li { margin: 4px 0; }

.empty { text-align: center; padding: 48px 16px; border: 1px dashed var(--line); border-radius: var(--r); }
.empty p { color: var(--muted); margin: 8px 0 18px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 100;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; transition: .2s; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 720px) { #toast { bottom: calc(84px + env(safe-area-inset-bottom)); } }
