/* Range Ledger.
   Deliberately single-theme: this is used in a dim cardroom, at night, one-handed,
   with a dealer waiting. Everything is sized for a thumb and painted for low light.
   No web fonts, because the network is not assumed to exist. */

:root {
  --bg:        #0E1014;
  --surface:   #171A20;
  --surface-2: #212630;
  --surface-3: #2A303B;
  --line:      #2E343F;
  --line-soft: #232830;

  --text:      #E9EBEF;
  --muted:     #98A1AF;
  --faint:     #6B7482;

  --brass:     #D9A05B;
  --brass-dim: #8A6533;
  --good:      #4FB58A;
  --bad:       #E8697C;
  --claret:    #C8394F;

  --suit-s:    #E9EBEF;
  --suit-h:    #E8697C;
  --suit-d:    #5BA8E8;
  --suit-c:    #4FB58A;

  --r:   10px;
  --r-s: 7px;
  --tap: 48px;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  color-scheme: dark;
}

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

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior-y: contain;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
button:disabled { opacity: .34; cursor: default; }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

h1, h2, h3, p { margin: 0; }

.app { min-height: 100%; }

/* ---------------------------------------------------------------- chrome */

.screen { display: flex; flex-direction: column; min-height: 100dvh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: calc(var(--safe-top) + 10px) 12px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -.01em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  flex: none;
}
.icon-btn:active { background: var(--surface-2); }

.screen-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 12px calc(24px + var(--safe-bottom));
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

/* Anything pinned to the bottom has to be cleared, or the last control on the
   page sits underneath it and cannot be tapped. The tab bar is a known height;
   the action dock is measured at runtime because its content varies. */
.screen.has-nav  .screen-body { padding-bottom: calc(80px + var(--safe-bottom)); }
.screen.has-dock .screen-body { padding-bottom: calc(var(--dock-h, 150px) + 34px + var(--safe-bottom)); }

.action-dock {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg) 93%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.action-dock:empty { display: none; }
.action-dock > * { max-width: 560px; margin: 0 auto; }
.action-dock .panel { background: transparent; border: none; padding: 0; gap: 10px; }

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 6px 6px calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line-soft);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: var(--r-s);
  color: var(--faint);
}
.tab.active { color: var(--brass); }
.tab-icon { display: block; width: 21px; height: 21px; }
.tab-icon svg { display: block; width: 100%; height: 100%; }
.tab-label { font-size: .68rem; letter-spacing: .02em; }

/* ---------------------------------------------------------------- layout */

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.grow { flex: 1; min-width: 0; }

.section-head {
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 4px;
}

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.good  { color: var(--good); }
.bad   { color: var(--bad); }

/* ---------------------------------------------------------------- buttons */

.btn {
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: var(--r);
  font-weight: 600;
  font-size: .95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  transition: transform .06s ease, background .12s ease;
}
.btn:active:not(:disabled) { transform: scale(.985); }

.btn.primary { background: var(--brass); color: #221803; border-color: var(--brass); }
.btn.ghost   { background: transparent; }
.btn.danger  { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.block   { width: 100%; }
.btn.big     { min-height: 58px; font-size: 1.05rem; }
.btn.tiny    { min-height: 34px; padding: 0 10px; font-size: .8rem; border-radius: var(--r-s); }

.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------------------------------------------------------------- cards & lists */

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 14px;
}

.panel-title { font-size: .95rem; font-weight: 650; }
.panel-sub {
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}

.list { display: flex; flex-direction: column; gap: 6px; }

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
}
.list-row:active { background: var(--surface-2); }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.list-main strong { font-size: .95rem; font-weight: 620; }
.list-main .muted { font-size: .8rem; }
.list-value { font-weight: 680; font-size: 1rem; font-variant-numeric: tabular-nums; flex: none; }

.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  overflow: hidden;
}
.stat { display: flex; flex-direction: column; gap: 2px; padding: 11px 12px; background: var(--surface); }
.stat-label { font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.stat-value { font-size: 1.05rem; font-weight: 680; font-variant-numeric: tabular-nums; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  overflow: hidden;
}
.meta-cell { display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; background: var(--surface); }
.meta-label { font-size: .66rem; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.meta-value { font-size: .92rem; font-weight: 620; font-variant-numeric: tabular-nums; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  overflow: hidden;
}
.stat-cell { display: flex; flex-direction: column; gap: 2px; padding: 12px; background: var(--surface); }
.stat-hint { font-size: .68rem; color: var(--faint); line-height: 1.3; }

.sample-note { font-size: .78rem; padding: 8px 11px; border-radius: var(--r-s); border: 1px solid var(--line); color: var(--muted); }
.sample-note.thin { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 32%, transparent); }
.sample-note.warn { color: var(--brass); border-color: color-mix(in srgb, var(--brass) 32%, transparent); }
.sample-note.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 32%, transparent); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}

/* ---------------------------------------------------------------- live session card */

.live-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: var(--r);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brass) 13%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--brass) 34%, transparent);
}
.live-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 20%, transparent);
  flex: none;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .45; } }
.live-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.live-copy .muted { font-size: .8rem; }
.live-go { color: var(--brass); font-size: 1.5rem; line-height: 1; }

.session-head { display: flex; align-items: center; gap: 10px; }
.session-head-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.session-head-main .muted { font-size: .8rem; }
.session-swing { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- fields */

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: .74rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.field-label.small { text-transform: none; letter-spacing: 0; font-size: .8rem; }

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 13px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 1rem;
}
.input:focus { border-color: var(--brass-dim); outline: none; }
textarea.input { min-height: 0; resize: vertical; line-height: 1.5; }
.big-number { font-size: 1.6rem; font-weight: 680; font-variant-numeric: tabular-nums; text-align: center; }

.chip-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; }
.chip-row.tiny .tag { font-size: .66rem; }

.chip {
  flex: none;
  min-height: 40px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .87rem;
  font-weight: 560;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.chip.active { background: color-mix(in srgb, var(--brass) 20%, var(--surface-2)); border-color: var(--brass); color: var(--text); }
.chip.add { border-style: dashed; color: var(--brass); }
.chip.allin { border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--muted);
}

/* ---------------------------------------------------------------- felt */

.felt-wrap { display: flex; justify-content: center; }
.felt {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 1 / .92;
}

.felt-oval {
  position: absolute;
  inset: 16% 14%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #1E3A31, #14251F 70%);
  border: 2px solid #2C4A3E;
  display: grid;
  place-items: center;
}
.felt-label { font-size: .74rem; letter-spacing: .1em; color: #5C7D6E; font-weight: 600; }

.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 78px;
  min-height: 56px;
  padding: 5px 4px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  text-align: center;
}
.seat.vacant { background: transparent; border-style: dashed; border-color: var(--line); opacity: .6; }
.seat.hero { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 15%, var(--surface-2)); }
.seat.has-btn { box-shadow: 0 0 0 1px var(--claret); }

.seat-no { position: absolute; top: 2px; left: 5px; font-size: .58rem; color: var(--faint); }
.seat-name {
  font-size: .74rem; font-weight: 620; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 6px;
}
.seat-stack { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.seat-pos { font-size: .58rem; letter-spacing: .06em; color: var(--faint); text-transform: uppercase; }
.btn-disc {
  position: absolute; top: -6px; right: -6px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--claret); color: #fff;
  font-size: .64rem; font-weight: 800;
  display: grid; place-items: center;
}

/* ---------------------------------------------------------------- cards */

.card-chip {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  min-width: 34px;
  padding: 5px 6px;
  border-radius: 5px;
  background: #F2F3F5;
  border: 1px solid #C9CDD4;
  font-weight: 750;
  font-size: .95rem;
  line-height: 1;
  color: #14171C;
}
.card-chip i { font-style: normal; font-size: .88em; }
.card-chip.sm { min-width: 26px; padding: 3px 4px; font-size: .78rem; border-radius: 4px; }
.card-chip.lg { min-width: 44px; padding: 8px 8px; font-size: 1.25rem; border-radius: 7px; }

.card-chip.suit-s { color: #14171C; }
.card-chip.suit-h { color: #C42B3E; }
.card-chip.suit-d { color: #1E6FB8; }
.card-chip.suit-c { color: #1F7A56; }

.hero-cards, .board-cards, .showdown-cards { display: inline-flex; gap: 4px; align-items: center; }
.hand-class { font-size: .74rem; font-weight: 650; color: var(--muted); letter-spacing: .03em; }
.hand-class.big { font-size: .95rem; }

/* ---------------------------------------------------------------- picker */

.picker { display: flex; flex-direction: column; gap: 10px; }
.picker-slots { display: flex; gap: 8px; justify-content: center; }

.slot {
  width: 56px; height: 74px;
  border-radius: 8px;
  border: 2px dashed var(--line);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-weight: 750;
}
.slot.next { border-color: var(--brass); }
.slot.filled { border-style: solid; background: #F2F3F5; border-color: #C9CDD4; }
.slot b { font-size: 1.6rem; line-height: 1; }
.slot i { font-style: normal; font-size: 1.25rem; line-height: 1.1; }
.slot.filled.suit-s { color: #14171C; }
.slot.filled.suit-h { color: #C42B3E; }
.slot.filled.suit-d { color: #1E6FB8; }
.slot.filled.suit-c { color: #1F7A56; }
.slot-dash { color: var(--faint); font-size: 1.4rem; }

.picker-hint { text-align: center; font-size: .78rem; color: var(--faint); }

.rank-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.rank-btn {
  min-height: 46px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 1.05rem;
  font-weight: 700;
}
.rank-btn.active { background: var(--brass); color: #221803; border-color: var(--brass); }

.suit-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; opacity: .38; pointer-events: none; }
.suit-row.armed { opacity: 1; pointer-events: auto; }
.suit-btn {
  min-height: 54px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 1.7rem;
  line-height: 1;
}
.suit-btn.suit-s { color: var(--suit-s); }
.suit-btn.suit-h { color: var(--suit-h); }
.suit-btn.suit-d { color: var(--suit-d); }
.suit-btn.suit-c { color: var(--suit-c); }

/* ---------------------------------------------------------------- amount pad */

.pad { display: flex; flex-direction: column; gap: 10px; }
.pad-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.pad-display.invalid { border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.pad-value { font-size: 2rem; font-weight: 720; font-variant-numeric: tabular-nums; }
.pad-value.empty { color: var(--faint); }
.pad-bounds { font-size: .72rem; color: var(--faint); }
.pad-presets { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.pad-presets::-webkit-scrollbar { display: none; }
.pad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pad-key {
  min-height: 52px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 1.2rem;
  font-weight: 620;
}
.pad-key:active { background: var(--surface-3); }

/* ---------------------------------------------------------------- hand entry */

.hand-screen { gap: 10px; }
.hand-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.pot-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.pot-figure { display: flex; flex-direction: column; gap: 0; }
.pot-label { font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.pot-value { font-size: 1.3rem; font-weight: 720; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- mini felt */

.mini-felt-wrap { display: flex; justify-content: center; }
.mini-felt {
  position: relative;
  width: 100%;
  max-width: 392px;
  aspect-ratio: 1 / .70;
}

.mini-oval {
  position: absolute;
  inset: 19% 17%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 34%, #1E3A31, #13231D 72%);
  border: 1.5px solid #2C4A3E;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.mini-pot-label { font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; color: #5C7D6E; }
.mini-pot { font-size: 1.25rem; font-weight: 720; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1.1; }
.mini-board { display: inline-flex; gap: 3px; margin-top: 3px; }
.mini-street { font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: #5C7D6E; }

.mseat {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 66px;
  padding: 4px 3px 5px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
  line-height: 1.15;
}

.mseat-no {
  font-size: .95rem;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.mseat-pos { font-size: .54rem; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.mseat-name {
  font-size: .62rem;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mseat-bet {
  margin-top: 2px;
  font-size: .62rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brass);
}

/* State is carried by border and opacity, never by colour alone. */
.mseat.pending  { border-color: var(--line); }
.mseat.acted    { border-color: var(--line-soft); background: var(--surface); }
.mseat.clock {
  border-color: var(--brass);
  background: color-mix(in srgb, var(--brass) 20%, var(--surface-2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brass) 22%, transparent);
}
.mseat.clock .mseat-no { color: var(--brass); }
.mseat.fold     { opacity: .34; }
.mseat.autofold { opacity: .52; border-style: dashed; border-color: var(--brass-dim); }
.mseat.allin    { border-color: var(--claret); }
.mseat.allin .mseat-bet { color: var(--bad); }
.mseat.hero     { outline: 1px solid var(--brass-dim); outline-offset: 1px; }

.mseat-flag {
  position: absolute;
  top: -6px; left: -6px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--brass);
  color: #221803;
  font-size: .6rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.mseat-btn {
  position: absolute;
  top: -6px; right: -6px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--claret);
  color: #fff;
  font-size: .56rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.seat-badge {
  flex: none;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text);
  font-size: .78rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.seat-badge.sm { min-width: 21px; height: 21px; font-size: .7rem; }

.assumed-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px dashed var(--brass-dim);
  color: var(--brass);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.warn-note {
  font-size: .78rem;
  padding: 9px 11px;
  border-radius: var(--r-s);
  border: 1px solid color-mix(in srgb, var(--brass) 40%, transparent);
  color: var(--brass);
}

.log-item.assumed { border-bottom: 1px dashed var(--brass-dim); }

.clock { border-color: var(--line); }
.clock-head { display: flex; align-items: center; gap: 8px; }
.clock-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pos-pill {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
}
.pos-pill.sm { font-size: .62rem; padding: 2px 6px; }

.action-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 7px; }
.btn.act { min-height: 60px; font-size: 1rem; }
.btn.act.fold  { color: var(--muted); }
.btn.act.check { color: var(--text); }
.btn.act.call  { background: color-mix(in srgb, var(--good) 18%, var(--surface-2)); border-color: color-mix(in srgb, var(--good) 45%, transparent); color: var(--good); }
.btn.act.raise { background: color-mix(in srgb, var(--brass) 20%, var(--surface-2)); border-color: var(--brass); color: var(--brass); }

.skip { gap: 8px; }
.skip-list { display: flex; flex-direction: column; gap: 4px; }
.skip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}
.skip-row:active { background: var(--surface-3); }
.skip-name { flex: 1; min-width: 0; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skip-go { color: var(--faint); font-size: 1.15rem; }

.log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.log-street { display: flex; gap: 8px; align-items: baseline; }
.log-label {
  flex: none;
  width: 52px;
  font-size: .62rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
}
.log-items { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.log-item { font-size: .8rem; color: var(--text); }
.log-item.dim { color: var(--faint); }

.net-row { display: flex; align-items: center; justify-content: space-between; padding-top: 4px; border-top: 1px solid var(--line-soft); }
.net-row strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }

.hand-footer { margin-top: 4px; }

.showdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px dashed var(--line);
  text-align: left;
}
.showdown-row.filled { border-style: solid; border-color: var(--brass-dim); }
.showdown-name { font-size: .88rem; }

/* ---------------------------------------------------------------- hand list & review */

.hand-row .list-main { gap: 5px; }
.hand-row-cards { display: flex; align-items: center; gap: 6px; }
.hand-row-board { display: flex; align-items: center; gap: 4px; }

.review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-hero { display: flex; align-items: center; gap: 8px; }
.review-net { display: flex; flex-direction: column; align-items: flex-end; }
.review-net strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }

.review-street {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.review-street-head { display: flex; align-items: center; gap: 10px; }
.review-actions { display: flex; flex-direction: column; gap: 5px; }
.review-action { display: flex; align-items: center; gap: 8px; font-size: .87rem; }
.review-action.dim { color: var(--faint); }
.review-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-what { color: var(--muted); font-variant-numeric: tabular-nums; }

.shown-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 7px; }
.shown-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}
.shown-meta { font-size: .68rem; color: var(--faint); }

.hh-text {
  margin: 0;
  padding: 12px;
  border-radius: var(--r-s);
  background: var(--bg);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .72rem;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre;
  overflow-x: auto;
  max-height: 42vh;
}

/* ---------------------------------------------------------------- trainer */

.drill-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
}
.drill-card:active { background: var(--surface-2); }
.drill-num {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--brass) 22%, var(--surface-2));
  color: var(--brass);
  font-weight: 800;
  font-size: .9rem;
}
.drill-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.weak-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  min-height: 44px; padding: 8px 11px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}
.weak-emoji { font-size: 1.1rem; }
.weak-name { flex: 1; min-width: 0; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weak-rate { font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--muted); }

.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 7px; }
.type-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 12px 7px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  text-align: center;
}
.type-emoji { font-size: 1.4rem; line-height: 1.1; }
.type-name { font-size: .74rem; font-weight: 650; }
.type-alias { font-size: .64rem; color: var(--faint); }

.drill-head { display: flex; align-items: center; gap: 10px; }
.drill-head-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.drill-emoji { font-size: 1.8rem; }
.drill-score {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .72rem; color: var(--faint);
}
.drill-question { font-size: .95rem; font-weight: 600; }

.obs-list { display: flex; flex-direction: column; gap: 5px; }
.obs {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 13px;
  border-radius: var(--r-s);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  font-size: .87rem;
  line-height: 1.4;
}
.obs.speech { font-style: italic; color: var(--text); }
.obs.stat {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  color: var(--muted);
}
.obs.neutral { color: var(--faint); }
.obs.revealed { border-color: var(--brass-dim); background: color-mix(in srgb, var(--brass) 8%, var(--surface)); }
.obs-text { flex: 1; min-width: 0; }
.obs-flag {
  flex: none;
  font-size: .6rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brass);
}

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.choice {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 10px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-align: left;
  min-height: 62px;
}
.choice-emoji { font-size: 1.3rem; flex: none; }
.choice-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.choice-copy strong { font-size: .8rem; line-height: 1.2; }
.choice-copy .small { font-size: .66rem; }
.choice.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, var(--surface-2)); }
.choice.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, var(--surface-2)); }
.choice.faded { opacity: .4; }

.exploit-choice {
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; text-align: left;
  padding: 14px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.exploit-choice strong { font-size: .92rem; }
.exploit-choice .small { line-height: 1.45; }
.exploit-choice.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--surface-2)); }
.exploit-choice.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--surface-2)); }
.exploit-choice.faded { opacity: .42; }
.owner-tag {
  margin-top: 3px;
  font-size: .66rem; font-weight: 600; letter-spacing: .04em;
  color: var(--brass);
}

.verdict {
  display: flex; flex-direction: column; gap: 10px;
  padding: 15px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface);
}
.verdict.good { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.verdict.bad  { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.verdict.good > strong { color: var(--good); }
.verdict.bad  > strong { color: var(--bad); }
.verdict-exploits { display: flex; flex-direction: column; gap: 9px; }

.exploit { display: flex; flex-direction: column; gap: 2px; }
.exploit strong { font-size: .87rem; }
.exploit .small { line-height: 1.45; }

.type-head { display: flex; align-items: flex-start; gap: 13px; }
.type-head-emoji { font-size: 2.4rem; line-height: 1; }

.quote { font-style: italic; font-size: .88rem; color: var(--text); }
.bullet { font-size: .87rem; color: var(--muted); padding-left: 13px; position: relative; line-height: 1.5; }
.bullet::before { content: '·'; position: absolute; left: 3px; color: var(--brass); font-weight: 800; }

@media (max-width: 380px) {
  .choice-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- sheet */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  transition: opacity .16s ease;
}
.sheet-backdrop.open { opacity: 1; }
.sheet-backdrop.closing { opacity: 0; }

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  transform: translateY(14px);
  transition: transform .18s ease;
}
.sheet-backdrop.open .sheet { transform: translateY(0); }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.sheet-head h2 { flex: 1; font-size: .95rem; font-weight: 650; }

.sheet-body {
  padding: 14px 14px calc(18px + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  z-index: 80;
  transform: translate(-50%, 12px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: .87rem;
  font-weight: 560;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { border-color: color-mix(in srgb, var(--brass) 55%, transparent); color: var(--brass); }

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (min-width: 480px) {
  .felt { max-width: 420px; }
  .seat { width: 86px; }
}
