:root {
  --bg: #0b0f14;
  --bg2: #121821;
  --card: #161e29;
  --card2: #1d2733;
  --line: #26313f;
  --fg: #e8eef6;
  --mut: #8fa0b4;
  --acc: #35d07f;
  --acc2: #2bb0ff;
  --warn: #ffb547;
  --bad: #ff5d5d;
  --raise: #ef5350;
  --call: #4caf50;
  --fold: #33404e;
  --fourbet: #c56bf0;
  --r: 14px;
  --tab-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior-y: contain;
}
body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }

h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 21px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .07em; color: var(--mut); }
p { margin: 0 0 10px; }
a { color: var(--acc2); }

/* ------------------------------------------------------------- layout */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(180deg, rgba(11,15,20,.98), rgba(11,15,20,.86));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; letter-spacing: -.02em; font-size: 16px; }
.topbar .brand span { color: var(--acc); }
.topbar .spacer { flex: 1; }
.pill {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: var(--card2); color: var(--mut); border: 1px solid var(--line);
  white-space: nowrap;
}
.pill.good { color: var(--acc); border-color: #1e5c3c; }
.pill.bad { color: var(--bad); border-color: #5c2020; }

.view { padding: 14px 14px 24px; max-width: 780px; margin: 0 auto; }
.view > section { margin-bottom: 18px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(14,19,26,.97);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  appearance: none; border: 0; background: none; color: var(--mut);
  height: var(--tab-h); font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  cursor: pointer;
}
.tabbar button .ic { line-height: 0; }
.tabbar button .ic svg { width: 21px; height: 21px; display: block; fill: currentColor; }
.tabbar button.on { color: var(--acc); }

/* -------------------------------------------------------------- cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; margin-bottom: 12px;
}
.card.tight { padding: 10px 12px; }
.card h2 { font-size: 16px; }
.muted { color: var(--mut); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.sep { height: 1px; background: var(--line); margin: 12px 0; }

/* ------------------------------------------------------------ controls */
button.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card2);
  color: var(--fg); border-radius: 11px; padding: 11px 14px; font-size: 14px;
  font-weight: 600; cursor: pointer; min-height: 44px;
}
button.btn:active { transform: scale(.985); }
button.btn.primary { background: var(--acc); color: #04200f; border-color: transparent; }
button.btn.ghost { background: transparent; }
button.btn.wide { width: 100%; }
button.btn[disabled] { opacity: .45; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  appearance: none; border: 1px solid var(--line); background: var(--card2);
  color: var(--mut); border-radius: 999px; padding: 8px 12px; font-size: 13px;
  font-weight: 600; cursor: pointer; min-height: 38px;
}
.seg button.on { background: var(--acc); color: #04200f; border-color: transparent; }

label.field { display: block; margin: 10px 0; }
label.field .lab { display: flex; justify-content: space-between; font-size: 13px; color: var(--mut); margin-bottom: 6px; }
input[type=range] { width: 100%; accent-color: var(--acc); height: 34px; }
select {
  width: 100%; background: var(--card2); color: var(--fg); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px; font-size: 14px; min-height: 44px;
}
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; }
.switch .t { font-size: 14px; }
.switch .d { font-size: 12px; color: var(--mut); }
.toggle {
  width: 50px; height: 30px; border-radius: 999px; background: var(--fold);
  border: 1px solid var(--line); position: relative; flex: 0 0 auto; cursor: pointer;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--mut); transition: .16s;
}
.toggle.on { background: rgba(53,208,127,.25); border-color: var(--acc); }
.toggle.on::after { left: 23px; background: var(--acc); }

/* ------------------------------------------------------------- matrix */
.matrix { display: grid; grid-template-columns: repeat(13, 1fr); gap: 2px; width: 100%; }
.cellwrap { position: relative; aspect-ratio: 1/1; border-radius: 3px; overflow: hidden; background: var(--fold); }
.cellwrap .bar { position: absolute; top: 0; bottom: 0; }
.cellwrap .lb {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.65);
  letter-spacing: -.02em;
}
.cellwrap.dim { opacity: .28; }
.cellwrap.sel { outline: 2px solid #fff; outline-offset: -2px; z-index: 2; }
@media (min-width: 460px) { .cellwrap .lb { font-size: 11px; } }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--mut); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ------------------------------------------------------------ trainer */
.table-felt {
  background: radial-gradient(circle at 50% 40%, #1c4c39 0%, #12321f 70%, #0e2618 100%);
  border: 1px solid #24503b; border-radius: 18px; padding: 14px 12px; position: relative;
}
.seatrow { display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.seat {
  font-size: 11px; font-weight: 700; padding: 5px 8px; border-radius: 8px;
  background: rgba(0,0,0,.32); color: #9fc3ae; border: 1px solid transparent; min-width: 40px; text-align: center;
}
.seat.hero { background: var(--acc); color: #04200f; }
.seat.vill { background: rgba(255,93,93,.22); color: #ffb0b0; border-color: #7a3535; }
.seat.dead { opacity: .35; }

.hand-cards { display: flex; gap: 8px; justify-content: center; margin: 6px 0 4px; }
.pcard {
  width: 58px; height: 82px; border-radius: 9px; background: #f7f9fb; color: #10151c;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; box-shadow: 0 3px 10px rgba(0,0,0,.4);
}
.pcard .r { font-size: 26px; line-height: 1; }
.pcard .s { font-size: 20px; line-height: 1.1; }
.pcard.red { color: #d32b2b; }
.pcard.sm { width: 42px; height: 60px; }
.pcard.sm .r { font-size: 19px; }
.pcard.sm .s { font-size: 15px; }
.board { display: flex; gap: 6px; justify-content: center; margin: 8px 0; }

.actions { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); margin-top: 12px; }
.actions.two { grid-template-columns: repeat(2, 1fr); }
.actions button {
  appearance: none; border: 0; border-radius: 13px; padding: 15px 6px; font-size: 15px;
  font-weight: 800; color: #fff; cursor: pointer; min-height: 56px; letter-spacing: .01em;
}
.actions button:active { transform: translateY(1px); }
.act-fold { background: #3a4653; }
.act-call { background: #2f9e52; }
.act-raise { background: #d94a46; }
.act-3bet { background: #d94a46; }
.act-4bet { background: #a24fd0; }
.act-check { background: #47576a; }
.act-bet33 { background: #2f7fd0; }
.act-bet75 { background: #d94a46; }

.fb { border-radius: 13px; padding: 12px; margin-top: 12px; border: 1px solid var(--line); background: var(--card2); }
.fb.ok { border-color: #1e6b42; background: rgba(53,208,127,.09); }
.fb.warn { border-color: #6b5320; background: rgba(255,181,71,.09); }
.fb.err { border-color: #6b2626; background: rgba(255,93,93,.09); }
.fb .hdr { display: flex; align-items: center; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }

.freqbar { display: flex; height: 26px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.freqbar div { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; min-width: 0; }

.bars { display: grid; gap: 7px; }
.barrow { display: grid; grid-template-columns: 96px 1fr 62px; gap: 8px; align-items: center; font-size: 12.5px; }
.barrow .track { background: var(--card2); border-radius: 6px; height: 15px; overflow: hidden; }
.barrow .fill { height: 100%; background: var(--acc); border-radius: 6px; }
.barrow .fill.bad { background: var(--bad); }
.barrow .fill.warn { background: var(--warn); }
.barrow .v { text-align: right; color: var(--mut); font-variant-numeric: tabular-nums; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 8px; }
.kpi { background: var(--card2); border: 1px solid var(--line); border-radius: 11px; padding: 10px; text-align: center; }
.kpi .v { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 11px; color: var(--mut); margin-top: 2px; }

.step { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step .n {
  flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--card2);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.step.done .n { background: var(--acc); color: #04200f; border-color: transparent; }
.step.now .n { border-color: var(--acc); color: var(--acc); }
.step .b { flex: 1; min-width: 0; }
.step .t { font-weight: 700; font-size: 14.5px; }
.step .d { font-size: 12.5px; color: var(--mut); margin: 3px 0 7px; }
.prog { height: 6px; background: var(--card2); border-radius: 4px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--acc); }

.list { display: grid; gap: 6px; }
.list .item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  background: var(--card2); border: 1px solid var(--line); border-radius: 11px;
  cursor: pointer; min-height: 48px;
}
.list .item .t { font-weight: 650; font-size: 14px; }
.list .item .s { font-size: 12px; color: var(--mut); }
.list .item .chev { color: var(--mut); }

.tagline { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); color: var(--mut); }
.tag.hi { color: var(--acc); border-color: #1e5c3c; }

.note { font-size: 13px; color: var(--mut); border-left: 3px solid var(--line); padding-left: 10px; }
ul.rules { margin: 6px 0; padding-left: 18px; }
ul.rules li { margin-bottom: 7px; font-size: 13.5px; }
.hl { color: var(--fg); font-weight: 650; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom));
  background: #eef4fb; color: #10151c; padding: 10px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 700; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.45);
}
