:root {
  --bg: #0b1220;
  --card: #111a2e;
  --line: #1e2a44;
  --text: #e6edf7;
  --muted: #8a97ad;
  --accent: #4c9aff;
  --good: #3ecf8e;
  --bad: #ff6b6b;
  --warn: #f5b74e;
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* `hidden` must win over component display rules (.tabs is a grid) */
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.4; }
header.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .3px; }
.conn { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.on .dot { background: var(--good); box-shadow: 0 0 6px var(--good); }
.conn.warn .dot { background: var(--warn); }
main { padding: 12px; display: grid; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
h2 { font-size: 15px; margin: 0 0 8px; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 14px 0 6px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0; }
button {
  background: #1b2742; color: var(--text); border: 1px solid var(--line); border-radius: 7px;
  padding: 7px 12px; font: inherit; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #06101f; font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
.checks { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 4px; }
.checks li::before { content: "○"; margin-right: 8px; color: var(--muted); }
.checks li.ok::before { content: "✓"; color: var(--good); }
.checks li.bad::before { content: "!"; color: var(--warn); font-weight: 700; }

.portrait { width: 64px; height: 36px; border-radius: 4px; object-fit: cover; background: #0a0f1a; }
.me { display: flex; gap: 10px; align-items: center; }
.win { margin-top: 10px; }
.bar { height: 8px; background: #2a1720; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar > div { height: 100%; width: 50%; background: linear-gradient(90deg, var(--accent), var(--good)); transition: width .4s; }

.enemies { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.enemy { display: grid; gap: 3px; justify-items: center; text-align: center; cursor: pointer; border-radius: 6px; padding: 4px 2px; }
.enemy:hover { background: #18233c; }
.enemy img { width: 100%; max-width: 72px; aspect-ratio: 16 / 9; border-radius: 4px; object-fit: cover; background: #0a0f1a; }
.enemy .unknown { width: 100%; max-width: 72px; aspect-ratio: 16 / 9; border-radius: 4px; border: 1px dashed var(--warn); display: grid; place-items: center; color: var(--warn); }
.enemy .nm { font-size: 11px; line-height: 1.15; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: #1b2742; }
.badge.good { color: var(--good); }
.badge.bad { color: var(--bad); }

.items { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.items li { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: center; }
.items img { width: 44px; height: 32px; border-radius: 4px; object-fit: cover; background: #0a0f1a; }
.items .cost { color: #f2c94c; font-size: 12px; }
.items .sbar { height: 4px; background: #1b2742; border-radius: 2px; margin-top: 3px; }
.items .sbar > div { height: 100%; background: var(--accent); border-radius: 2px; }
.skills { display: flex; gap: 8px; }
.skills img { width: 40px; height: 40px; border-radius: 6px; background: #0a0f1a; }
.skills .talent { height: 40px; padding: 0 10px; display: grid; place-items: center; border-radius: 6px; border: 1px solid #6b5520; color: #f2c94c; font-size: 12px; }

.qrRow { display: flex; gap: 12px; align-items: center; }
.qr { width: 148px; height: 148px; flex: none; background: #fff; border-radius: 8px; padding: 6px; transition: opacity .2s; }
.qr.dim { opacity: .15; }
.qr svg { width: 100%; height: 100%; display: block; }

/* account: header chips, sign-in methods, form, devices */
.chip { padding: 5px 10px; border-radius: 999px; font-size: 12px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.primary { background: var(--accent); border-color: var(--accent); color: #06101f; font-weight: 600; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: #0b1220; border: 1px solid var(--line); border-radius: 9px; padding: 3px; margin: 10px 0 12px; }
.seg button { border: 0; background: none; padding: 7px 4px; border-radius: 6px; color: var(--muted); }
.seg button.on { background: #1b2742; color: var(--text); font-weight: 600; }
.field { display: grid; gap: 4px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.field input { padding: 10px; border-radius: 7px; border: 1px solid var(--line); background: #0b1220; color: var(--text); font: inherit; font-size: 15px; }
.field input:focus { outline: none; border-color: var(--accent); }
.links a { color: var(--accent); text-decoration: none; }
a.btnlink { display: block; text-align: center; padding: 11px; border-radius: 7px; text-decoration: none; font-weight: 600; margin-top: 10px; }
a.btnlink.primary { background: var(--accent); color: #06101f; }
.tag.soon { color: var(--muted); background: #1b2742; }
/* update required (client_outdated) / update available */
.updateScreen { position: fixed; inset: 0; z-index: 10; background: rgba(6, 10, 20, .92); display: grid; place-items: center; padding: 20px; }
.updateScreen .card { max-width: 380px; }
.updateBanner { display: block; width: 100%; border: 0; border-radius: 0; background: #1f3a66; color: var(--text); padding: 8px 14px; font-size: 13px; text-align: center; }
/* web app on a large screen: phone-width column, centred */
body.web main, body.web footer { max-width: 560px; margin-left: auto; margin-right: auto; }
body.web .tabs { max-width: 560px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.err { color: var(--bad); min-height: 0; }
.warn { color: var(--warn); }
.devices { list-style: none; padding: 0; margin: 0 0 6px; border: 1px solid var(--line); border-radius: 8px; }
.devices li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border-top: 1px solid var(--line); }
.devices li:first-child { border-top: 0; }
.devices .dv { min-width: 0; }
.devices .dv div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; font-weight: 700; color: var(--good); background: rgba(62, 207, 142, .12); padding: 1px 5px; border-radius: 4px; }
.phoneLink { color: var(--muted); }
.phoneLink.on { color: var(--good); }
.pcPick { margin: 2px 0 8px; }
.pcPick select { flex: 1; min-width: 0; padding: 6px; border-radius: 6px; border: 1px solid var(--line); background: #0b1220; color: var(--text); font: inherit; }
#liveNote { cursor: pointer; }
.approveCard { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; background: #0b1220; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; }
.row.two button { padding: 10px; }

/* phone: bottom tabs, no desktop-only cards */
body.phone main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
body.phone footer { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
body.phone:not([data-tab="live"]) .tab-live,
body.phone:not([data-tab="draft"]) .tab-draft,
body.phone:not([data-tab="tiers"]) .tab-tiers,
body.phone:not([data-tab="me"]) .tab-me { display: none; }
header.top { padding-top: calc(10px + env(safe-area-inset-top)); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-template-columns: repeat(4, 1fr);
  background: #0d1526; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { background: none; border: 0; border-radius: 0; padding: 8px 0 10px; display: grid; gap: 2px; justify-items: center; color: var(--muted); font-size: 12px; min-height: 56px; }
.tabs button .ti { font-size: 18px; line-height: 1; }
.tabs button.on { color: var(--accent); }
button.wide { width: 100%; padding: 11px; margin: 4px 0 8px; }
button.link { background: none; border: 0; color: var(--accent); padding: 6px 0; margin-top: 8px; }
.pairManual input, .search {
  flex: 1; min-width: 0; padding: 9px; border-radius: 7px; border: 1px solid var(--line); background: #0b1220; color: var(--text); font: inherit;
}
.search { width: 100%; margin-bottom: 8px; }
.picks { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.picks li { display: grid; grid-template-columns: auto 56px 1fr auto auto; gap: 8px; align-items: center; padding: 5px 4px; border-radius: 6px; }
#draftPicks li { grid-template-columns: 56px 1fr auto; cursor: pointer; }
#draftPicks li:hover { background: #18233c; }
.picks img { width: 56px; aspect-ratio: 16 / 9; border-radius: 4px; object-fit: cover; background: #0a0f1a; }
.picks .rk { color: var(--muted); font-size: 12px; min-width: 22px; text-align: right; }
.picks .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picks .sub { color: var(--muted); font-size: 11px; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 4px 0 14px; }
footer a { color: var(--accent); text-decoration: none; }

dialog { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; width: min(420px, 92vw); max-height: 80vh; }
dialog::backdrop { background: rgba(0,0,0,.6); }
#pickerSearch { width: 100%; padding: 8px; border-radius: 6px; border: 1px solid var(--line); background: #0b1220; color: var(--text); font: inherit; margin-bottom: 8px; }
.pickerGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-height: 52vh; overflow: auto; margin-bottom: 8px; }
.pickerGrid button { padding: 3px; display: grid; gap: 2px; font-size: 11px; }
.pickerGrid img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 3px; }
