:root {
  --bg: #f7f7f5; --panel: #ffffff; --ink: #1b1d1f; --muted: #5f6368; --line: #e2e2de;
  --a: #2f6fdf; --b: #d9822b; --ok: #2e7d4f; --warn: #b3261e; --chip: #eef0f2;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121314; --panel: #1c1e20; --ink: #e8e8e6; --muted: #a0a4a8; --line: #2e3134;
          --a: #6c9ef0; --b: #e6a35c; --ok: #6cc58f; --warn: #f28b82; --chip: #2a2d30; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.4; }
header { display: flex; align-items: center; gap: 20px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
header h1 { margin: 0; font-size: inherit; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand .mark { width: 30px; height: 24px; flex: none; }
.brand .bar-top { fill: var(--ink); }
.brand .words { display: flex; flex-direction: column; line-height: 1.05; }
.brand b { font-size: 17px; font-weight: 900; letter-spacing: .3px; }
.brand small { font-size: 11.5px; color: var(--muted); font-weight: 500; letter-spacing: .4px; }
header nav a { color: var(--muted); text-decoration: none; margin-right: 14px; font-size: 15px; }
header nav a.on { color: var(--ink); font-weight: 600; }
main { max-width: 1040px; margin: 0 auto; padding: 16px; }
.bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; background: var(--panel);
       border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.settings { display: block; }
.settings summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; font-size: 14px; }
.settings summary::-webkit-details-marker { display: none; }
.settings .sum { flex: 1; min-width: 0; color: var(--ink); font-weight: 600; }
.settings .edit { color: var(--a); font-weight: 600; flex: none; }
.settings details[open] .edit { visibility: hidden; }
.settings .controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-top: 10px; }
@media (min-width: 681px) { .settings summary { display: none; } .settings .controls { margin-top: 0; } }
.bar label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
select, input { font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
                border-radius: 7px; padding: 6px 8px; min-height: 36px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 680px) { .cols { grid-template-columns: 1fr; } }
.side { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-width: 0; }
.side h2 { font-size: 15px; margin: 0 0 8px; }
.side.a h2 { color: var(--a); } .side.b h2 { color: var(--b); }
.side input { width: 100%; }
ul.assets { list-style: none; margin: 10px 0 0; padding: 0; }
ul.assets li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
ul.assets .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.assets .sub { color: var(--muted); font-size: 12px; }
.val { font-variant-numeric: tabular-nums; font-weight: 600; }
.pill { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--chip); color: var(--muted); }
.pill.high { color: var(--ok); } .pill.low { color: var(--warn); }
button.x { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; min-height: 32px; }
@media (max-width: 680px) {
  .result { position: sticky; bottom: 8px; z-index: 2; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
  .cols { gap: 10px; margin-top: 10px; }
}
.result { margin-top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.verdict { font-size: 26px; font-weight: 700; margin: 0 0 10px; }
.meter { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--chip); }
.meter .a { background: var(--a); } .meter .b { background: var(--b); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.facts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stale { color: var(--warn); font-weight: 600; }
.empty { color: var(--muted); }
table { width: 100%; border-collapse: collapse; margin-top: 16px; background: var(--panel); border: 1px solid var(--line);
        border-radius: 10px; overflow: hidden; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
.tabs { display: flex; gap: 6px; }
.tabs button { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
               border-radius: 7px; padding: 6px 12px; cursor: pointer; min-height: 36px; }
.tabs button.on { color: var(--ink); border-color: var(--ink); }
.note { color: var(--muted); font-size: 13px; margin-top: 10px; }
@media (max-width: 520px) {
  header { flex-wrap: wrap; gap: 8px 16px; }
  header nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  header nav a { margin-right: 0; }
}
.credits { max-width: 1040px; margin: 8px auto 24px; padding: 0 16px; color: var(--muted); font-size: 12.5px; }
.credits a { color: var(--muted); }
.prose { max-width: 720px; }
.prose h2 { margin: 8px 0 12px; }
.prose h3 { font-size: 16px; margin: 22px 0 6px; }
.prose p, .prose li { font-size: 15px; line-height: 1.55; }
.prose a { color: var(--a); }

/* Highlight List (highlights.js) */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
th.hl-col, td.hl-col { width: 1%; padding-left: 4px; padding-right: 0; }
button.hl-star { border: 0; background: none; cursor: pointer; font-size: 18px; line-height: 1; color: var(--muted);
                 min-width: 32px; min-height: 32px; padding: 0; }
button.hl-star.on { color: #e0a100; }
.hl-tray { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--panel); border-top: 1px solid var(--line);
           box-shadow: 0 -6px 24px rgba(0, 0, 0, .12); padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); }
.hl-tray[hidden] { display: none; }
body.hl-has main { padding-bottom: 80px; }
.hl-bar { display: flex; gap: 10px; align-items: center; max-width: 1040px; margin: 0 auto; }
.hl-tray button { font: inherit; font-size: 14px; min-height: 36px; border-radius: 7px; cursor: pointer; }
.hl-open { flex: 1; text-align: left; border: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 6px 12px; }
.hl-open span { color: var(--a); float: right; }
.hl-copy, .hl-actions button { border: 1px solid var(--a); background: var(--a); color: #fff; padding: 6px 14px; font-weight: 600; }
.hl-actions button + button { background: var(--panel); color: var(--a); }
.hl-actions .hl-clear { border-color: var(--line); color: var(--warn); }
.hl-msg { max-width: 1040px; margin: 4px auto 0; font-size: 13px; color: var(--ok); min-height: 0; }
.hl-msg:empty { display: none; }
.hl-panel { max-width: 1040px; margin: 8px auto 0; max-height: 55vh; overflow-y: auto; }
.hl-list { margin: 0; padding-left: 28px; font-size: 14px; }
.hl-list li { padding: 3px 0; border-bottom: 1px solid var(--line); }
.hl-list .x { min-height: 24px; margin-left: 6px; vertical-align: middle; }
.hl-cols { border: 0; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.hl-cols legend { float: left; width: 100%; font-weight: 600; margin-bottom: 4px; padding: 0; }
.hl-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* My Rankings + Compare (mine.js) */
.sub.phone { display: none; font-size: 12px; color: var(--muted); }
#modes { margin-left: auto; }
@media (max-width: 680px) { #modes { margin-left: 0; } }
.mine-msg { margin: 8px 0 0; }
.mine-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.mine-bar button, .mine-empty button, .mine-bar .file, .mine-missing button {
  font: inherit; font-size: 14px; min-height: 36px; border-radius: 7px; cursor: pointer; padding: 6px 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.mine-bar .primary, .mine-empty .primary { background: var(--a); border-color: var(--a); color: #fff; font-weight: 600; }
.mine-bar .danger { color: var(--warn); }
.file { position: relative; overflow: hidden; display: inline-flex; align-items: center; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mine-empty { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-top: 16px;
              display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.mine-empty p { margin: 0; }
.mine-empty .file { color: var(--a); font-size: 14px; }
table.mine td { vertical-align: middle; }
table.mine td.drag { cursor: grab; color: var(--muted); font-size: 18px; touch-action: none; user-select: none; width: 1%; padding: 8px 6px; }
table.mine tr.dragging { opacity: .6; background: var(--chip); }
table.mine input.rank { width: 58px; min-height: 32px; text-align: right; padding: 4px 6px; }
table.mine input.note { width: 100%; min-width: 120px; min-height: 32px; font-size: 14px; padding: 4px 6px; }
table.mine tr.tier td { background: var(--chip); font-size: 13px; padding-top: 4px; padding-bottom: 4px; }
td.gap.up { color: var(--ok); font-weight: 600; } td.gap.down { color: var(--warn); font-weight: 600; }
.mine-h { font-size: 16px; margin: 22px 0 0; }
.mine-h .sub, .mine-missing .sub { font-weight: 400; color: var(--muted); font-size: 13px; }
.mine-missing { list-style: none; padding: 0; margin: 8px 0 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.mine-missing li { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: 1px solid var(--line); }
.mine-missing li:first-child { border-top: 0; }
.mine-missing button { margin-left: auto; min-height: 32px; padding: 4px 12px; }
.mine-missing button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 520px) {                 /* phones: keep rank, player, market and gap in view */
  table.mine-list tr:not(.tier) > :nth-child(4), table.mine-list tr:not(.tier) > :nth-child(5),
  table.mine-list tr:not(.tier) > :nth-child(8), table.mine-cmp tr > :nth-child(2), table.mine-cmp tr > :nth-child(3) { display: none; }
  .sub.phone { display: block; }
  table.mine td:nth-child(3) { white-space: normal; }
  table.mine th, table.mine td { padding-left: 6px; padding-right: 6px; }
  table.mine input.rank { width: 48px; }
}
.valmode { display: flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.valmode button { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
                  border-radius: 7px; padding: 6px 12px; cursor: pointer; min-height: 36px; }
.valmode button.on { color: var(--ink); border-color: var(--ink); font-weight: 600; }
.pill.mine { color: var(--a); }
.mine-import textarea { width: 100%; font: inherit; font-size: 14px; padding: 8px; border: 1px solid var(--line);
                        border-radius: 8px; background: var(--bg); color: var(--ink); }
.mine-import input.pick { min-width: 220px; }
.mine-import input.pick.ok { border-color: var(--ok); }
.brand .slash { color: #22c55e; font-weight: 900; }   /* NO / BS: the slash keeps it from reading as one word */
.settings .keeper-controls { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line, #d4d4d8); }
.assets .kcost { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted, #71717a); white-space: nowrap; }
.assets .kcost input { width: 5.4em; padding: 2px 4px; font: inherit; }
.keeper-note { margin-top: 8px; }

/* F17 import from Sleeper */
.import-row { align-items: end; }
.import-row .wide { flex: 1 1 18rem; }
.import-row .wide input { width: 100%; }
.import-row .import-msg { flex-basis: 100%; margin: 0; font-size: .85rem; color: var(--muted, #888); }
.import-row .import-msg:empty { display: none; }
.kprice-note { margin: .4rem 0 0; font-size: .85rem; color: var(--muted, #888); }
.kprice-note button { font: inherit; background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }
