:root {
  --bg: #0b0f15; --bg2: #121822; --bg3: #19212d; --bg4: #212b39; --line: #263142; --line2: #334256;
  --tx: #e7edf4; --dim: #8d9aab; --dim2: #637084;
  --acc: #4c9aff; --good: #3fb950; --good-bg: #0f2a18; --bad: #f85149; --bad-bg: #2d1414;
  --warn: #d29922; --warn-bg: #2b220d; --gold: #e3b341; --me: #1f6feb; --me-bg: #0f1d33;
  --radius: 10px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--tx); font: 14px/1.4 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
.num, .mono { font-variant-numeric: tabular-nums; }
.dim { color: var(--dim); } .good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); } .gold { color: var(--gold); }
.small { font-size: 12px; color: var(--dim); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--dim); margin: 0 0 8px; font-weight: 600; }
h3 { margin: 0; font-size: 20px; }

/* ---------- header ---------- */
#top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand .logo { font-size: 26px; }
.brand .title { font-weight: 700; font-size: 16px; }
.brand .sub { font-size: 11px; color: var(--dim); }
.stats { display: flex; gap: 6px; flex-wrap: wrap; }
.stat { background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; min-width: 74px; text-align: center; }
.stat .v { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 9.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--dim); }
.stat.hi .v { color: var(--gold); }
.stat.me .v { color: var(--good); }
.tabs { display: flex; gap: 2px; padding: 0 12px; background: var(--bg2); border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: var(--hdr-h, 58px); z-index: 25; }
.tabs button { padding: 10px 14px; color: var(--dim); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--tx); border-bottom-color: var(--acc); }
.tabs .kbd { font-size: 10px; color: var(--dim2); margin-left: 4px; }
main { padding: 14px 16px 60px; max-width: 1500px; margin: 0 auto; }
.view { display: none; }
.view.on { display: block; }

/* ---------- draft layout ---------- */
.draft-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "block" "adv" "board"; }
.area-block { grid-area: block; } .area-adv { grid-area: adv; } .area-board { grid-area: board; min-width: 0; }
@media (min-width: 1080px) {
  .draft-grid { grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "block adv" "board adv"; align-items: start; }
  .area-adv { position: sticky; top: calc(var(--hdr-h, 58px) + 52px); max-height: calc(100vh - var(--hdr-h, 58px) - 64px); overflow-y: auto; grid-row: 1 / span 2; }
}
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.card:last-child { margin-bottom: 0; }

/* ---------- search / block ---------- */
.searchwrap { position: relative; }
#q { width: 100%; padding: 13px 14px; font-size: 17px; background: var(--bg3); border: 1px solid var(--line2); border-radius: var(--radius); outline: none; }
#q:focus { border-color: var(--acc); box-shadow: 0 0 0 3px #4c9aff22; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--bg3); border: 1px solid var(--line2); border-radius: var(--radius); overflow: hidden; box-shadow: 0 12px 30px #0008; }
.sugg:empty { display: none; }
.sugg .it { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.sugg .it:last-child { border-bottom: 0; }
.sugg .it.sel, .sugg .it:hover { background: var(--bg4); }
.sugg .it .nm { flex: 1; min-width: 0; }
.sugg .it.taken { opacity: .5; }
#block { margin-top: 10px; }
.block-empty { padding: 18px; text-align: center; color: var(--dim); border: 1px dashed var(--line2); border-radius: var(--radius); }
.block-empty b { color: var(--tx); }
.blockcard { background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--radius); padding: 14px; }
.blockcard .head { display: flex; align-items: flex-start; gap: 12px; }
.blockcard .head .meta { color: var(--dim); font-size: 12.5px; margin-top: 2px; }
.blockcard .head .x { margin-left: auto; color: var(--dim); font-size: 20px; line-height: 1; padding: 2px 6px; }
.note { margin-top: 8px; padding: 7px 10px; background: var(--bg3); border-left: 3px solid var(--warn); border-radius: 4px; font-size: 12.5px; }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 10px; }
.nums .cell { background: var(--bg3); border-radius: 8px; padding: 7px 8px; text-align: center; }
.nums .cell .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.nums .cell .k { font-size: 10px; text-transform: uppercase; color: var(--dim); letter-spacing: .4px; }
.nums .cell.key { background: var(--me-bg); outline: 1px solid var(--me); }
.nums .cell.key .v { color: var(--gold); }
.verdict { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-weight: 700; font-size: 16px; }
.verdict .sub { font-weight: 400; font-size: 12.5px; opacity: .9; }
.v-BID { background: var(--good-bg); color: var(--good); border: 1px solid #23863655; }
.v-ENFORCE { background: var(--warn-bg); color: var(--warn); border: 1px solid #d2992255; }
.v-PASS, .v-CANT, .v-FULL, .v-TAKEN { background: var(--bad-bg); color: #ff8b84; border: 1px solid #f8514955; }
.why { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12.5px; }
.why li { padding: 2px 0 2px 18px; position: relative; }
.why li::before { position: absolute; left: 2px; }
.why li.pro::before { content: '✓'; color: var(--good); }
.why li.con::before { content: '!'; color: var(--warn); font-weight: 700; left: 5px; }
.rivals { font-size: 12.5px; margin-top: 8px; color: var(--dim); }
.rivals b { color: var(--tx); font-weight: 600; }
.alts { margin-top: 8px; }
.sale { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.teamchips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 5px; margin: 6px 0 10px; }
.teamchips button { text-align: left; padding: 6px 8px; border-radius: 7px; background: var(--bg3); border: 1px solid var(--line); font-size: 12.5px; line-height: 1.25; min-width: 0; }
.teamchips button .tn { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.teamchips button .tm { display: block; font-size: 10.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.teamchips button.mine { border-color: var(--me); }
.teamchips button.sel { background: var(--me); border-color: var(--me); color: #fff; }
.teamchips button.sel .tm { color: #dce8ff; }
.teamchips button:disabled { opacity: .35; cursor: not-allowed; }
.pricerow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pricerow input { width: 96px; padding: 9px 10px; font-size: 18px; font-weight: 700; text-align: center; background: var(--bg3); border: 1px solid var(--line2); border-radius: 8px; outline: none; }
.pricerow input:focus { border-color: var(--acc); }
.btn { padding: 8px 12px; border-radius: 8px; background: var(--bg3); border: 1px solid var(--line2); font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--bg4); }
.btn.primary { background: var(--good); border-color: var(--good); color: #04120a; font-weight: 700; }
.btn.primary.over { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger { color: var(--bad); border-color: #f8514966; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.go { margin-left: auto; padding: 10px 18px; font-size: 15px; }
.salewarn { font-size: 12.5px; color: var(--bad); margin-top: 6px; min-height: 1em; }

/* ---------- badges ---------- */
.badge { display: inline-block; font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 6px; margin-left: 4px; vertical-align: 2px; letter-spacing: .2px; }
.b-val { background: #123a1e; color: var(--good); } .b-pay { background: #173a5e; color: #7cc0ff; } .b-risk { background: #4a1d1d; color: var(--bad); }
.b-inj { background: #46350f; color: var(--warn); } .b-punt { background: #173a5e; color: var(--acc); }
.b-cat { background: #2a2342; color: #b9a6ff; } .b-me { background: var(--me); color: #fff; }

/* ---------- board ---------- */
.board-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.board-tools input { flex: 1 1 180px; padding: 8px 10px; background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; outline: none; }
.seg { display: inline-flex; background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { padding: 6px 10px; font-size: 12.5px; color: var(--dim); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--me); color: #fff; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .4px; padding: 7px 6px; border-bottom: 1px solid var(--line2); position: sticky; top: calc(var(--hdr-h, 58px) + 41px); background: var(--bg); z-index: 2; white-space: nowrap; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sorted { color: var(--tx); }
.tbl td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.c, .tbl th.c { text-align: center; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--bg2); }
.tbl tr.taken td { opacity: .45; }
.tbl tr.taken.mine td { opacity: .8; background: var(--me-bg); }
.tbl tr.onblock td { background: var(--me-bg); }
.tbl .pn { font-weight: 600; }
.tbl .ps { font-size: 11px; color: var(--dim); }
.tbl .edge-pos { color: var(--good); font-weight: 600; } .tbl .edge-neg { color: var(--dim2); }
.verdict-tag { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; }
.vt-BID { background: var(--good-bg); color: var(--good); } .vt-ENFORCE { background: var(--warn-bg); color: var(--warn); }
.vt-PASS, .vt-CANT, .vt-FULL { background: var(--bg3); color: var(--dim2); }
@media (max-width: 720px) { .hide-sm { display: none; } .nums { grid-template-columns: repeat(2, 1fr); } main { padding: 10px 10px 60px; } }

/* ---------- advisor ---------- */
.adv .headline { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.alert { padding: 7px 10px; border-radius: 7px; font-size: 12.5px; margin-bottom: 6px; border-left: 3px solid; }
.alert.good { background: var(--good-bg); border-color: var(--good); }
.alert.warn { background: var(--warn-bg); border-color: var(--warn); }
.alert.info { background: var(--bg3); border-color: var(--acc); }
.alist .row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.alist .row:last-child { border-bottom: 0; }
.alist .row:hover .nm { color: var(--acc); }
.alist .row .nm { flex: 1; min-width: 0; font-weight: 600; }
.alist .row .nm .s { display: block; font-weight: 400; font-size: 11.5px; color: var(--dim); }
.alist .row .pr { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.alist .row .pr .s { display: block; font-size: 11px; color: var(--dim); }
.needchips { display: flex; flex-wrap: wrap; gap: 4px; }
.needchip { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--bg4); }
.needchip.done { opacity: .35; text-decoration: line-through; }
.kv { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.kv b { font-variant-numeric: tabular-nums; }
.money .row { display: grid; grid-template-columns: minmax(0, 1fr) 48px 48px 38px; gap: 6px; padding: 4px 0; font-size: 12.5px; border-bottom: 1px solid var(--line); align-items: center; }
.money .row.hd { font-size: 10px; text-transform: uppercase; color: var(--dim); }
.money .row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.money .row.me { color: var(--gold); font-weight: 600; }
.money .row.done { opacity: .4; }
.money .row span:not(.t) { text-align: right; font-variant-numeric: tabular-nums; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { display: inline; }
details.card > summary::after { content: '▾'; float: right; color: var(--dim); }
details.card:not([open]) > summary::after { content: '▸'; }

/* ---------- teams / mine ---------- */
.teamtbl tr.me td { background: var(--me-bg); }
.teamtbl tr.me td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.slotgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.slot { display: flex; gap: 8px; align-items: center; background: var(--bg3); border-radius: 7px; padding: 6px 8px; font-size: 13px; }
.slot .sl { width: 40px; font-size: 11px; font-weight: 700; color: var(--dim); }
.slot .sp { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot.empty .sp { color: var(--dim2); }
.slot.bench .sl { color: var(--dim2); }
.bar { height: 7px; background: var(--bg4); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), var(--warn)); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.puntbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.puntbtns button { padding: 7px 12px; border-radius: 8px; background: var(--bg3); border: 1px solid var(--line); }
.puntbtns button.sel { background: var(--me); border-color: var(--me); color: #fff; font-weight: 600; }
.rosterx { padding: 8px 6px 14px; }

/* ---------- log / settings ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
textarea.io { width: 100%; height: 140px; background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: 11px ui-monospace, Menlo, monospace; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 12.5px; color: var(--dim); }
.form input[type=text], .form input[type=number], select { padding: 8px 10px; background: var(--bg3); border: 1px solid var(--line2); border-radius: 8px; outline: none; color: var(--tx); }
.teamedit { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 6px; align-items: center; margin-bottom: 5px; }
.teamedit input[type=text] { width: 100%; }
.teamedit .rad { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--dim); }

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; z-index: 80; background: #000a; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal .box { background: var(--bg2); border: 1px solid var(--line2); border-radius: 14px; padding: 16px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; background: var(--bg4); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; box-shadow: 0 10px 30px #0009; max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }
.toast button { color: var(--acc); font-weight: 600; }
.teamtbl th { position: static; }
@media (max-width: 720px) {
  #board { overflow-x: auto; }
  #board .tbl th { position: static; }
  .stat { min-width: 64px; padding: 3px 8px; }
  .stat .v { font-size: 15px; }
}

.srcline { margin-top: 8px; font-size: 11.5px; color: var(--dim); }
.srcline b { color: var(--tx); font-weight: 600; }
