:root {
  --bg: #12151d; --panel: #191d28; --panel2: #202533; --line: #2c3243; --text: #e6e9f2; --muted: #8a92a6;
  --accent: #4fa3ff; --accent2: #2f7fe0; --danger: #e05656; --ok: #3fb37f; --cell: #262c3a; --cell-text: #6f778b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
h2 { margin: 0 0 8px; font-size: 20px; } h3 { margin: 0 0 12px; } h4 { margin: 14px 0 6px; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.muted { color: var(--muted); } .small { font-size: 12px; } .pad { padding: 12px; } .err { color: var(--danger); } .grow { flex: 1; }
.loading, .empty { padding: 40px; text-align: center; color: var(--muted); }

.top { display: flex; align-items: center; gap: 24px; height: 52px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 17px; }
.logo img { width: 26px; height: 26px; }
.tabs { display: flex; gap: 4px; }
.tabs a { color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.tabs a.on, .tabs a:hover { color: var(--text); background: var(--panel2); }
.who { margin-left: auto; color: var(--muted); display: flex; gap: 10px; align-items: center; }

.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; font: inherit; }
.btn:hover { border-color: #3d4560; } .btn.primary { background: var(--accent2); border-color: var(--accent2); color: #fff; } .btn.primary:hover { background: var(--accent); }
.btn.danger { color: #fff; background: #8c2f2f; border-color: #8c2f2f; } .btn.sm { padding: 4px 9px; font-size: 12px; } .btn.big { padding: 12px 22px; font-size: 16px; } .btn.wide { width: 100%; }
.btn.pulse { box-shadow: 0 0 0 2px #ffd36a; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px 0; font: inherit; }
.ibtn { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 5px 8px; cursor: pointer; font: inherit; }
.ibtn.sm { padding: 1px 6px; font-size: 11px; } .ibtn:disabled { opacity: .35; cursor: default; }
.inp { background: #0f121a; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; }
.inp:focus { outline: none; border-color: var(--accent); } .inp.wide { width: 100%; margin-bottom: 8px; } .inp.num { width: 70px; } .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; margin: 6px 0; } .row.end { justify-content: flex-end; margin-top: 14px; }
.dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex: none; }
.chip { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 16px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.chip.on { background: var(--accent2); border-color: var(--accent2); }

.auth { max-width: 340px; margin: 60px auto; background: var(--panel); padding: 24px; border-radius: 14px; border: 1px solid var(--line); text-align: center; }

.layout { display: flex; height: calc(100vh - 52px); }
.side { width: 290px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.side-tools { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.side > .link { align-self: flex-start; margin: 4px 10px; }
.tree, .tr-list { overflow: auto; flex: 1; padding: 4px 0 20px; }
.tree.pick { max-height: 50vh; border: 1px solid var(--line); border-radius: 8px; }
.tnode { display: flex; align-items: center; gap: 6px; padding: 5px 8px; cursor: pointer; border-left: 3px solid transparent; user-select: none; }
.tnode:hover { background: var(--panel2); } .tnode.sel { background: #24304a; border-left-color: var(--accent); } .tnode.drop { outline: 1px dashed var(--accent); }
.tw { width: 12px; color: var(--muted); font-size: 11px; flex: none; }
.ti { width: 16px; height: 16px; flex: none; border-radius: 3px; }
.ti.folder { background: linear-gradient(#e8b54a, #c8922d); clip-path: polygon(0 15%, 40% 15%, 50% 30%, 100% 30%, 100% 100%, 0 100%); }
.ti.range { background: repeating-linear-gradient(90deg, #4fa3ff 0 3px, transparent 3px 5px), repeating-linear-gradient(0deg, #4fa3ff 0 3px, transparent 3px 5px); opacity: .8; }
.ti.train { background: var(--ok); border-radius: 50%; }
.tn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmenu { visibility: hidden; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 0 4px; }
.tnode:hover .tmenu, .tnode.sel .tmenu { visibility: visible; }
.tchk { margin: 0; }
.menu { position: fixed; z-index: 30; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; min-width: 200px; box-shadow: 0 8px 24px #0008; }
.menu button { background: none; border: 0; color: var(--text); text-align: left; padding: 8px 10px; cursor: pointer; border-radius: 6px; font: inherit; }
.menu button:hover { background: var(--line); } .menu .danger { color: #ff8a8a; }

.work { flex: 1; overflow: auto; padding: 16px 20px; }
.ed-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.inp.title { font-size: 17px; font-weight: 600; min-width: 220px; }
.ed-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ed-body { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.ed-grid { flex: none; }
.ed-panel { width: 330px; flex: none; }
.under { display: flex; gap: 14px; margin: 6px 0; }

.grid { display: grid; grid-template-columns: repeat(13, 44px); grid-auto-rows: 40px; gap: 2px; user-select: none; touch-action: none; }
.grid.small { grid-template-columns: repeat(13, 26px); grid-auto-rows: 24px; gap: 1px; }
.cell { background-color: var(--cell); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--cell-text); cursor: pointer; position: relative; }
.grid.small .cell { font-size: 9px; border-radius: 2px; }
.cell.on { color: #fff; text-shadow: 0 1px 2px #0009; font-weight: 600; }
.cell.mark { outline: 3px solid #ffd36a; z-index: 1; }
.cell span { pointer-events: none; }

.legend { margin-top: 10px; min-width: 300px; }
.lg-row { display: grid; grid-template-columns: 16px 1fr 60px 70px; gap: 8px; align-items: center; padding: 3px 0; }
.lg-row i { width: 14px; height: 14px; border-radius: 3px; } .lg-row.total { grid-template-columns: 1fr 60px 70px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.lg-row span { text-align: right; color: var(--muted); }
.tip { position: fixed; z-index: 40; background: #0b0d13; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; pointer-events: none; font-size: 12px; line-height: 1.6; }
.tip i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }

.strength { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.strength input { width: 100%; }
.act { display: flex; align-items: center; gap: 6px; margin: 5px 0; }
.act input[type=color] { width: 30px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; }
.act .aname { flex: 1; min-width: 0; padding: 5px 8px; }
.act .swatch { width: 30px; height: 22px; border-radius: 4px; background: var(--cell); flex: none; }
.act .mname { flex: 1; font-size: 13px; }
.erase { display: block; margin: 10px 0 0; }
.groups { display: flex; flex-wrap: wrap; gap: 6px; }
.note { resize: vertical; }
.note-view { white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); padding: 10px; border-radius: 8px; margin-top: 10px; max-width: 360px; }

.view-one { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.vt { font-size: 17px; }
.cmp { display: flex; gap: 18px; flex-wrap: wrap; }
.cmp-item h4 { text-transform: none; font-size: 13px; color: var(--text); }
.cmp .legend { min-width: 0; font-size: 12px; }
.share { padding: 20px; }

.modal { position: fixed; inset: 0; background: #000a; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(520px, 100%); max-height: 90vh; overflow: auto; }
.fold-list { display: flex; flex-direction: column; max-height: 50vh; overflow: auto; }
.fold-pick { background: none; border: 0; color: var(--text); text-align: left; padding: 7px 10px; cursor: pointer; border-radius: 6px; font: inherit; }
.fold-pick:hover { background: var(--panel2); }
.exp { margin-bottom: 10px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #233; border: 1px solid var(--ok); padding: 10px 16px; border-radius: 10px; z-index: 50; }
.toast.bad { border-color: var(--danger); background: #311; }

.tr-setup { max-width: 640px; }
.opt { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.opt > span { width: 100%; color: var(--muted); }
.play { max-width: 760px; }
.play-top { display: flex; gap: 20px; align-items: center; color: var(--muted); margin-bottom: 12px; }
.play-top .btn { margin-left: auto; }
.table { background: radial-gradient(ellipse at center, #1f6b47 0%, #154a33 70%, #0f3626 100%); border: 8px solid #4a3220; border-radius: 120px; padding: 28px; text-align: center; min-height: 230px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.situ { color: #d8f0e2; } .situ b { font-size: 18px; color: #fff; }
.cards { display: flex; gap: 10px; }
.card { width: 64px; height: 90px; background: #fff; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 4px 10px #0006; color: #111; }
.card b { font-size: 26px; line-height: 1; } .card i { font-style: normal; font-size: 26px; }
.card.s-h, .card.s-d { color: #d22; }
.hand-name { color: #d8f0e2; font-weight: 600; }
.answers { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.ans { flex: 1; min-width: 120px; padding: 14px; border-radius: 10px; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 25%, var(--panel)); color: #fff; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.ans:hover:not(:disabled) { background: var(--c); } .ans:disabled { opacity: .55; cursor: default; }
.res { padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; } .res.ok { background: #1c3b2c; } .res.bad { background: #3b1c1c; }
.pill { display: inline-block; border-left: 4px solid var(--c); padding: 1px 8px; margin: 2px; background: var(--panel2); border-radius: 4px; }
.mini { margin: 10px 0 14px; }
.big-num { font-size: 32px; font-weight: 700; }

/* ---- v2: menus, subranges, coverage, poker table, trainer, settings ---- */
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.menu button:disabled { opacity: .4; cursor: default; }
.modal-box.wide { width: min(760px, 100%); }
.ti.sub { background: repeating-linear-gradient(90deg, #9b7bff 0 3px, transparent 3px 5px), repeating-linear-gradient(0deg, #9b7bff 0 3px, transparent 3px 5px); opacity: .85; transform: scale(.85); }
.sub-note { margin: -6px 0 10px; }
.round-box { background: #4a3d12; border: 1px solid #b8932c; color: #ffe7a0; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.wrap { flex-wrap: wrap; } .lbl { width: 64px; color: var(--muted); }
.chip.on, .btn.on { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.grid.mid { grid-template-columns: repeat(13, 34px); grid-auto-rows: 28px; gap: 2px; }
.grid.mid .cell { font-size: 10px; }
.grid.cover .cell { background: #3a4a66; color: #fff; }
.grid.cover .cell.dim { background: var(--cell); color: var(--cell-text); }
.cell.dim { opacity: .35; }
/* wrong cell after a check: red frame + red corner, the hand label stays readable */
.cell.miss { box-shadow: inset 0 0 0 2px #ff3b3b; }
.cell.miss::after { content: ''; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 9px 9px 0; border-color: transparent #ff3b3b transparent transparent; pointer-events: none; }
.play.wide { max-width: none; }
.cmp2 { display: flex; gap: 24px; flex-wrap: wrap; margin: 12px 0 6px; }
.cmp2 > div { flex: none; }
.cmp2 h4 { margin: 0 0 6px; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 12px; font-size: 13px; }
.cmp-legend span { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 520px) { .cmp2 .grid.mid { grid-template-columns: repeat(13, minmax(0, 1fr)); width: calc(100vw - 40px); } }

.ts { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; }
.ts-left { flex: none; display: flex; flex-direction: column; gap: 10px; }
.ts-right { flex: 1; min-width: 330px; max-width: 520px; }
.tbtn { display: flex; gap: 14px; align-items: center; text-align: left; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px 16px; cursor: pointer; font: inherit; width: 100%; max-width: 580px; margin: 4px 0; }
.tbtn:hover { border-color: var(--accent); } .tbtn small { color: var(--muted); }
.tico { font-size: 26px; width: 36px; text-align: center; }
table.seats { border-collapse: collapse; width: 100%; margin-top: 8px; font-size: 13px; }
table.seats th { color: var(--muted); font-weight: 500; text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.seats td { padding: 4px 6px; border-bottom: 1px solid #222838; }
.spin { display: inline-flex; align-items: center; gap: 2px; }
.spin button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; width: 20px; }
.inp.num.sm { width: 64px; padding: 3px 6px; text-align: center; }
.dbtn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #e5a43a; color: #2a1b00; font-weight: 700; font-size: 11px; }
.dbtn.sm { width: 16px; height: 16px; font-size: 10px; }

.ptable { position: relative; width: 560px; max-width: 100%; aspect-ratio: 16 / 9; margin: 20px auto 10px; }
.ptable.small { width: 380px; margin-top: 30px; }
.ptable .felt { position: absolute; inset: 10% 6%; border-radius: 999px; background: radial-gradient(ellipse at center, #2b3346 0%, #232a3a 70%, #1c2230 100%); border: 6px solid #3a4152; box-shadow: inset 0 0 30px #0007; }
.ptable.ok .felt { border-color: var(--ok); box-shadow: 0 0 18px #3fb37f88, inset 0 0 30px #0007; }
.ptable.bad .felt { border-color: var(--danger); box-shadow: 0 0 18px #e0565b88, inset 0 0 30px #0007; }
.pot { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #c9cfdd; font-weight: 600; text-align: center; }
.pot small { color: var(--muted); font-weight: 400; }
.seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.seat .plate { background: #10131b; border: 1px solid #3a4152; border-radius: 8px; padding: 2px 10px; text-align: center; min-width: 58px; line-height: 1.2; }
.seat .plate b { display: block; font-size: 12px; } .seat .plate span { font-size: 12px; color: #e8c06a; } .seat .plate em { display: block; font-size: 10px; color: #ff9a9a; font-style: normal; }
.seat.hero .plate { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.seat.out { opacity: .4; }
.seat .dbtn { position: absolute; right: -14px; top: 18px; }
.backs { display: flex; gap: 2px; } .backs i { width: 16px; height: 22px; border-radius: 3px; background: linear-gradient(135deg, #d39b2b, #a8731b); border: 1px solid #6d4a10; }
.hcards { display: flex; gap: 4px; margin-bottom: 2px; }
.hcards .card { width: 46px; height: 64px; } .hcards .card b { font-size: 20px; } .hcards .card i { font-size: 18px; }
.bet { position: absolute; transform: translate(-50%, -50%); background: #10131b; color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 12px; border: 1px solid #555d70; }
.bet::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9aa3b6; margin-right: 4px; }
.ptable.small .seat .plate { min-width: 46px; padding: 1px 6px; } .ptable.small .plate b, .ptable.small .plate span { font-size: 10px; }
.ptable.small .backs i { width: 11px; height: 15px; }
.situ-line { margin: 4px 0; color: var(--muted); } .situ-line b { color: var(--text); }
.rng { background: #2b2350; color: #d9ceff; padding: 2px 10px; border-radius: 10px; }
.rng-box { margin-top: 8px; color: var(--muted); } .rng-box b { color: var(--text); font-size: 18px; }
.vtable { margin-top: 6px; }
.lg-row.exp { grid-template-columns: 16px 1fr 60px 90px 60px; } .lg-row.total:has(+ .lg-row.exp) { grid-template-columns: 1fr 60px 90px 60px; }
.lg-row.total span { white-space: nowrap; }
.tabs2 { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 10px 0 14px; }
.tabs2 button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 12px; cursor: pointer; font: inherit; }
.tabs2 button.on { color: var(--text); border-bottom-color: var(--accent); }
.content-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.grid.heat .cell span { display: flex; flex-direction: column; align-items: center; line-height: 1; } .grid.heat .cell small { font-size: 9px; opacity: .8; }
.link.danger { color: #ff8a8a; }
.settings { max-width: 720px; } .settings input[type=color] { width: 36px; height: 30px; border: 0; background: none; padding: 0; cursor: pointer; }
.side-tools .chip { padding: 4px 10px; }

@media (max-width: 900px) {
  .ptable { width: 100%; } .ts-right { min-width: 0; }
  .top { gap: 10px; padding: 0 10px; } .logo span, .who #whoName { display: none; }
  .layout { flex-direction: column; height: auto; }
  .side { width: 100%; max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .work { padding: 12px; }
  .grid { grid-template-columns: repeat(13, minmax(0, 1fr)); grid-auto-rows: 26px; width: 100%; }
  .ed-grid, .ed-panel { width: 100%; }
  .cell { font-size: 9px; }
  .table { border-radius: 40px; }
}
