/* Table School 2026-11 redesign: app shell (tab bar, phone header) and the Learn / Practice /
   Look up / You tab pages. Built on the brand tokens in app.css; nothing here re-colours the tables.
   Rules: one gold action per screen, surfaces by tone not borders, body 16-17px, targets >= 44px. */
:root {
  --ts-surface: #142230;
  --ts-surface-2: #1B2B3A;
  --ts-hair: rgba(255, 255, 255, 0.07);
  --ts-text-2: #A9B6C1;
  --ts-text-3: #7D8B97;
  --ts-felt-hi: #237A58;
  --ts-felt-lo: #0E3B2A;
  --ts-rail: #3A2A1C;
  --ts-ok: #43C48A;
  --ts-radius: 18px;
  --ts-tab-h: 58px;
}

/* The hidden attribute always wins over a component's display rule. */
[hidden] { display: none !important; }

/* ---------- header: four destinations on wide screens ---------- */
.nav { order: 0 !important; flex-basis: auto !important; flex: 1; justify-content: center; }
.nav a { font-size: 15px; padding: 8px 14px; }
.hdr-back, .table-more { display: none; }
.app-header:not(.on-table) .table-tool { display: none; }
.more-sheet { gap: 6px; }
.more-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 10px 12px; border-radius: 14px; border: 0;
  background: var(--ts-surface-2); color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.more-row:hover { background: var(--panel-3); }
.more-row b { display: block; font-weight: 650; }
.more-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(201, 160, 74, 0.14); color: var(--gold-2); flex: none; }

/* ---------- tab bar (phones) ---------- */
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    background: rgba(12, 20, 28, 0.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--ts-hair);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; text-decoration: none;
    color: var(--ts-text-3); font: 600 11px/1.1 var(--font); letter-spacing: 0.01em; -webkit-tap-highlight-color: transparent; }
  .tabbar a.active { color: var(--gold-2); }
  .tabbar a:active { opacity: 0.7; }
  body.full-screen .tabbar, body.on-table .tabbar { display: none; }
  main { padding-bottom: calc(var(--ts-tab-h) + 24px + env(safe-area-inset-bottom, 0px)) !important; }
  body.full-screen main, body.on-table main { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important; }
  .toast-host { bottom: calc(var(--ts-tab-h) + 22px + env(safe-area-inset-bottom, 0px)); }

  /* The header exists only on the tables (back, bankroll, more). Everywhere else the page's own
     large title leads, like an iOS app. A fixed band keeps content out from under the status bar. */
  body:not(.on-table) .app-header { display: none; }
  body:not(.on-table) main { padding-top: calc(10px + env(safe-area-inset-top, 0px)) !important; }
  body::before { content: ""; position: fixed; left: 0; right: 0; top: 0; height: env(safe-area-inset-top, 0px); z-index: 55; background: var(--bg); }
  .app-header.on-table .brand, .app-header.on-table .nav, .app-header.on-table .table-tool { display: none !important; }
  .app-header.on-table .header-row { flex-wrap: nowrap; padding: 6px 10px; }
  .app-header.on-table .hdr-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 8px 0 2px; color: var(--gold-2);
    text-decoration: none; font-weight: 600; font-size: 16px; }
  .app-header.on-table .table-more { display: inline-flex; min-width: 44px; min-height: 44px; justify-content: center; }
}

/* ---------- tab pages ---------- */
.ts-page { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.ts-title { display: grid; gap: 4px; padding-top: 6px; }
.ts-title h1 { margin: 0; font: 700 34px/1.05 var(--display); letter-spacing: 0.01em; }
.ts-title-sub { margin: 0; color: var(--ts-text-2); font-size: 16px; line-height: 1.45; }
.ts-sec { display: flex; flex-direction: column; gap: 10px; }
.ts-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 4px 2px 0; }
.ts-sec-head h2 { margin: 0; font: 650 19px/1.25 var(--font); }
.ts-sec-n { font: 500 13px var(--mono); color: var(--ts-text-3); margin-right: 8px; }
.ts-sec-aside { font-size: 13px; color: var(--ts-text-3); text-align: right; }
.ts-eyebrow { font: 650 12px/1.2 var(--font); letter-spacing: 0.09em; text-transform: uppercase; color: var(--ts-text-3); }
.ts-foot { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ts-text-3); }
.ts-empty { margin: 0; color: var(--ts-text-2); }
.ts-card { background: var(--ts-surface); border-radius: var(--ts-radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }

/* continue card */
.ts-cont { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 22px; text-decoration: none; color: #fff;
  background: radial-gradient(120% 90% at 85% 0%, var(--ts-felt-hi) 0%, var(--felt) 45%, var(--ts-felt-lo) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 12px 30px rgba(0, 0, 0, 0.35); }
.ts-cont .ts-eyebrow { color: rgba(255, 255, 255, 0.75); padding-right: 72px; }
.ts-cont-art { position: absolute; right: 16px; top: 14px; width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.18); color: rgba(235, 203, 133, 0.9); }
.ts-cont-title { font: 650 23px/1.2 var(--font); letter-spacing: -0.005em; padding-right: 72px; text-wrap: balance; }
.ts-cont-meta { font-size: 15px; line-height: 1.4; color: rgba(255, 255, 255, 0.78); }
.ts-bar { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.ts-bar > i { display: block; height: 100%; border-radius: 3px; background: var(--gold-2); }
.ts-cont-cta { width: 100%; justify-content: center; min-height: 54px; font-size: 17px; }
.ts-cont:active .ts-cont-cta { filter: brightness(0.95); }

/* game tiles */
.ts-games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ts-game { display: flex; flex-direction: column; gap: 4px; min-height: 132px; padding: 14px; border-radius: var(--ts-radius); background: var(--ts-surface);
  text-decoration: none; color: var(--text); }
.ts-game:hover { background: var(--ts-surface-2); }
.ts-game-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: auto; padding-bottom: 14px; }
.ts-game-name { font: 650 18px/1.2 var(--font); }
.ts-game-meta { font-size: 13.5px; line-height: 1.35; color: var(--ts-text-2); }
.ts-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--ts-surface-2); color: var(--gold-2); }
.ts-ring { display: inline-grid; flex: none; }
.ts-ring circle { fill: none; stroke-width: 4; }
.ts-ring .ts-ring-track { stroke: rgba(255, 255, 255, 0.1); }
.ts-ring .ts-ring-fill { stroke: var(--gold); stroke-linecap: round; }
.ts-ring text { font: 500 12px var(--mono); fill: var(--ts-text-2); }
.ts-ring .ts-ring-check { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* list rows */
.ts-list { background: var(--ts-surface); border-radius: var(--ts-radius); overflow: hidden; display: flex; flex-direction: column; }
.ts-row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px; padding: 11px 14px 11px 16px; border: 0; background: none;
  color: var(--text); text-decoration: none; text-align: left; font: inherit; cursor: pointer; }
.ts-row + .ts-row::before { content: ""; position: absolute; top: 0; right: 0; left: 64px; height: 1px; background: var(--ts-hair); }
.ts-row:hover { background: var(--ts-surface-2); }
.ts-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ts-row-main b { font-weight: 600; font-size: 16px; line-height: 1.3; }
.ts-row-sub { font-size: 13.5px; line-height: 1.35; color: var(--ts-text-2); }
.ts-chev { color: var(--ts-text-3); display: inline-flex; flex: none; }
.ts-row-feature .ts-ico { background: rgba(201, 160, 74, 0.16); }
.ts-step { width: 34px; height: 34px; border-radius: 17px; flex: none; display: grid; place-items: center; font: 500 14px var(--mono);
  background: var(--ts-surface-2); color: var(--ts-text-2); }
.ts-step.done { background: rgba(67, 196, 138, 0.16); color: var(--ts-ok); }
.ts-step.now { background: var(--gold); color: #1C1505; }
.ts-step.quiz { background: rgba(201, 160, 74, 0.16); color: var(--gold-2); }

/* practice */
.ts-today { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 20px; text-decoration: none; color: var(--text);
  background: linear-gradient(135deg, #1F2A1E, #18231B 55%, var(--ts-surface)); box-shadow: inset 0 0 0 1px rgba(201, 160, 74, 0.2); }
.ts-today .ts-eyebrow { color: var(--gold-2); }
.ts-today-title { font: 650 20px/1.25 var(--font); }
.ts-today-sub { color: var(--ts-text-2); font-size: 15px; line-height: 1.45; }
.ts-today .btn { justify-content: center; }
.ts-tables { display: flex; flex-direction: column; gap: 10px; }
.ts-table { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 12px; min-height: 84px; border-radius: 20px; background: var(--ts-surface);
  text-decoration: none; color: var(--text); }
.ts-table:hover { background: var(--ts-surface-2); }
.ts-table b { font-size: 17px; }
.ts-felt-ico { width: 68px; height: 60px; border-radius: 14px; flex: none; display: grid; place-items: center; color: var(--gold-2);
  background: radial-gradient(120% 90% at 50% 0%, var(--ts-felt-hi), var(--felt) 60%, var(--ts-felt-lo)); box-shadow: inset 0 0 0 3px var(--ts-rail); }

/* look up */
.ts-search { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 12px; border-radius: 12px; background: var(--ts-surface-2); color: var(--ts-text-3); }
.ts-search:focus-within { box-shadow: 0 0 0 2px var(--gold-2); }
.ts-search input { flex: 1; min-width: 0; height: 44px; border: 0; background: none; color: var(--text); font: 450 17px var(--font); outline: none; }
.ts-search input::placeholder { color: var(--ts-text-3); }
.ts-browse { display: flex; flex-direction: column; gap: 14px; }
.ts-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 3px; border-radius: 12px; background: var(--ts-surface-2); }
.ts-seg button { min-height: 38px; border: 0; border-radius: 9px; background: none; color: var(--ts-text-2); font: 600 13.5px var(--font); cursor: pointer; padding: 0 4px; }
.ts-seg button[aria-pressed="true"] { background: var(--panel-3); color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
.ts-hits { display: flex; flex-direction: column; gap: 8px; }
.ts-hit { padding: 12px 14px; border-radius: 14px; background: var(--ts-surface); display: grid; gap: 3px; }
.ts-hit b { font-weight: 650; font-size: 16px; }
.ts-hit p { margin: 0; color: var(--ts-text-2); font-size: 15px; line-height: 1.45; }
.ts-hit-where { font: 650 11px/1.2 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-2); }
.ts-edge { background: var(--ts-surface); border-radius: var(--ts-radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.ts-edge-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: end; }
.ts-edge-name { font-size: 14.5px; line-height: 1.3; }
.ts-edge-name small { display: block; font-size: 12.5px; color: var(--ts-text-3); }
.ts-edge-val { font: 500 14px var(--mono); font-variant-numeric: tabular-nums; }
.ts-edge-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ts-edge-track i { display: block; height: 100%; border-radius: 3px; background: var(--gold); }
.ts-edge-row.zero .ts-edge-track i { background: var(--ts-ok); }
.ts-edge-row.high .ts-edge-track i { background: var(--red); }

/* you */
.ts-ready { flex-direction: row; align-items: center; gap: 14px; }
.ts-ready-text { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.ts-ready-text b { font-size: 17px; }
.ts-ready-text span { color: var(--ts-text-2); font-size: 14.5px; line-height: 1.4; }
.ts-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ts-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 11px; border-radius: 15px; background: var(--ts-surface-2);
  color: var(--ts-text-2); font: 600 13px var(--font); }
.ts-chip.known { background: rgba(67, 196, 138, 0.14); color: var(--ts-ok); }
.ts-chip.mixed { background: rgba(201, 160, 74, 0.14); color: var(--gold-2); }
.ts-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--ts-hair); border-radius: 16px; overflow: hidden; }
.ts-stats > div { background: var(--ts-surface); padding: 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ts-stats b { font: 650 22px/1.1 var(--font); font-variant-numeric: tabular-nums; }
.ts-stats span { font-size: 12.5px; line-height: 1.3; color: var(--ts-text-3); }
.ts-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; text-decoration: none; color: var(--ts-text-2); }
.ts-badge { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--ts-surface-2); color: var(--ts-text-3); }
.ts-badge.on { background: rgba(201, 160, 74, 0.16); color: var(--gold-2); }
.ts-badges-more { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 14px; color: var(--gold-2); min-height: 44px; }

/* Tablets (761-860px): the old phone rules hid the nav; with no tab bar there, keep it. */
@media (max-width: 860px) {
  .app-header.on-table .table-more { display: inline-flex; min-width: 44px; min-height: 44px; justify-content: center; }
}
@media (min-width: 761px) {
  .nav { display: flex !important; }
  .ts-page { padding-top: 8px; }
  .ts-games { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .ts-cont, .ts-game, .ts-row { transition: none; } }

/* ---------- game hub ---------- */
.ts-back { display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; min-height: 44px; margin: -6px 0 -10px -6px; padding: 0 8px 0 2px;
  color: var(--gold-2); text-decoration: none; font-weight: 600; font-size: 16px; }
.ts-hub-head { display: flex; align-items: center; gap: 14px; }
.ts-hub-title { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ts-hub-title h1 { margin: 0; font: 700 34px/1.05 var(--display); letter-spacing: 0.01em; }
.ts-hub-ico { width: 60px; height: 60px; border-radius: 16px; }
.ts-hub-cta { width: 100%; justify-content: center; min-height: 54px; font-size: 16.5px; text-align: center; }
.ts-btn-tonal { background: var(--ts-surface-2); border-color: transparent; justify-content: center; }
.ts-deep { background: var(--ts-surface); border-radius: var(--ts-radius); overflow: hidden; }
.ts-deep > summary { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 11px 14px 11px 16px; cursor: pointer; list-style: none; }
.ts-deep > summary::-webkit-details-marker { display: none; }
.ts-deep > summary > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ts-deep > summary b { font: 650 19px/1.25 var(--font); }
.ts-deep[open] > summary .ts-chev svg { transform: rotate(90deg); }
.ts-deep .ts-chev svg { transition: transform 0.2s; }
.ts-deep .ts-list { border-radius: 0; border-top: 1px solid var(--ts-hair); }

/* ---------- tables on phones: the felt first, settings after it (2026-11 redesign) ----------
   Pure re-ordering with CSS: nothing in the table logic changes. The page head's title stays
   on top; its tool row, the variant panels and the status cards move below the table. */
@media (max-width: 760px) {
  .bj-page, #view:has(> .split-main.cr-layout), #view:has(> .split-main.rl-main) { display: flex; flex-direction: column; }
  .bj-page > .page-head, #view:has(> .split-main.cr-layout) > .page-head, #view:has(> .split-main.rl-main) > .page-head { display: contents; }
  .bj-page > *, #view:has(> .split-main.cr-layout) > *, #view:has(> .split-main.rl-main) > * { order: 5; }
  .bj-page > .page-head > div:first-child, #view:has(> .split-main.cr-layout) > .page-head > div:first-child,
  #view:has(> .split-main.rl-main) > .page-head > div:first-child { order: 0; margin-bottom: 12px; }
  .bj-page > .bj-challenge { order: 1; }
  .bj-page > .split-main, #view:has(> .split-main.cr-layout) > .split-main, #view:has(> .split-main.rl-main) > .split-main { order: 2; }
  .bj-page > .page-head > .bj-head-tools, #view:has(> .split-main.cr-layout) > .page-head > .row, #view:has(> .split-main.rl-main) > .page-head > .row { order: 3; margin: 14px 0 4px; }
  .bj-edge-note { display: none; }
  /* craps: the felt, then the roll bar, then the come-out / on-the-table status */
  .cr-layout > .stack { display: flex; flex-direction: column; }
  .cr-layout > .stack > .cr-felt { order: 0; }
  .cr-layout > .stack > .cr-controls { order: 1; }
  .cr-layout > .stack > .cr-status { order: 2; }
  .cr-layout > .stack > * { order: 3; }
  .cr-layout > .stack > .cr-felt { order: 0; } .cr-layout > .stack > .cr-controls { order: 1; } .cr-layout > .stack > .cr-status { order: 2; }
}

/* ---------- lessons (2026-11 redesign) ---------- */
.lc-table { display: grid; gap: 10px; padding: 14px 12px; border-radius: 18px; color: #fff;
  background: radial-gradient(130% 80% at 50% 0%, var(--ts-felt-hi), var(--felt) 55%, var(--ts-felt-lo)); box-shadow: inset 0 0 0 4px var(--ts-rail); }
.lc-table-row { display: flex; align-items: center; gap: 12px; }
.lc-table-who { width: 92px; flex: none; font: 650 11px/1.2 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255, 255, 255, 0.75); }
.lc-table-rule { font: 600 10.5px/1.3 var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(235, 203, 133, 0.85); text-align: center;
  padding: 5px 0; border-top: 1px solid rgba(255, 255, 255, 0.16); border-bottom: 1px solid rgba(255, 255, 255, 0.16); }
.lc-card-back { background: repeating-linear-gradient(45deg, #7E1F22 0 5px, #8F2A2C 5px 10px) !important; box-shadow: inset 0 0 0 3px #FBF9F3, 0 2px 6px rgba(0, 0, 0, 0.3); }
.lc-card-step > .lc-table, .lc-card-step > .lc-hand { margin-bottom: 4px; }
.lc-play { display: grid; gap: 10px; margin-bottom: 4px; }
.lc-play-story { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--ts-surface-2); }
.lc-play-story p { margin: 0; font-size: 15px; line-height: 1.5; }
.lc-hitstand { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; }
.lc-hitstand .quiz-opt { min-height: 60px; justify-content: center; font-size: 18px; font-weight: 650; }
.lc-score.lc-score-done { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 40px; color: #1C1505;
  background: radial-gradient(circle at 35% 30%, var(--gold-2), var(--gold) 60%, #A9813A); box-shadow: 0 10px 30px rgba(201, 160, 74, 0.25); }
.lc-practised { display: grid; gap: 8px; justify-items: center; margin-top: 4px; }
.lc-practised .ts-chips { justify-content: center; }

/* ---------- type (2026-11 redesign, stage 6): iOS-like sizes on reading screens ----------
   Lessons read at 17px; nothing that carries information is under 13px. Tables keep their
   tested sizes (checked at 130% text zoom). */
small, .small { font-size: 13px; }
.lc-card-step h2 { font-size: 22px; line-height: 1.25; }
.lc-card-step p, .lc-card-step .lc-bullets li { font-size: 17px; line-height: 1.5; }
.lc-q .quiz-q { font-size: 19px; line-height: 1.35; font-weight: 600; }
.lc-q .quiz-opt { font-size: 16.5px; min-height: 52px; }
.lc-q .callout { font-size: 16px; line-height: 1.5; }
.lc-top .lc-back, .lc-back { font-size: 16px; min-height: 44px; display: inline-flex; align-items: center; }
.bj-rail-text, .bac-rail-text { font-size: 11.5px; }
