:root {
  color-scheme: light;
  --felt: #0f6a4f;
  --felt-light: #178464;
  --felt-dark: #094535;
  --ink: #202428;
  --muted: #687077;
  --paper: #fff9ed;
  --panel: #ffffff;
  --line: #d9d1c0;
  --gold: #d9a63a;
  --red: #aa2439;
  --plum: #4b253b;
  --charcoal: #28313b;
  --success: #157a52;
  --shadow: 0 18px 40px rgb(20 28 33 / 16%);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #efe7d5;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgb(255 252 244 / 90%), rgb(239 231 213 / 94%)),
    repeating-linear-gradient(90deg, #eee4cf 0 1px, transparent 1px 22px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

[hidden] {
  display: none !important;
}

.win-celebration {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow: hidden;
  pointer-events: none;
  isolation: isolate;
  animation: celebration-scene 5s ease both;
}

.celebration-particles {
  position: absolute;
  inset: 0;
}

.celebration-message {
  position: absolute;
  top: 47%;
  left: 50%;
  display: grid;
  min-width: 280px;
  gap: 3px;
  padding: 18px 30px 20px;
  transform: translate(-50%, -50%);
  border: 1px solid rgb(255 221 122 / 72%);
  border-radius: 8px;
  color: #fff;
  background: rgb(20 31 27 / 88%);
  box-shadow: 0 18px 50px rgb(0 0 0 / 30%), inset 0 0 26px rgb(244 197 66 / 12%);
  text-align: center;
  animation: celebration-message 5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.celebration-message span {
  color: #f4c542;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.celebration-message strong {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

.celebration-message b {
  color: #ffe9a4;
  font-size: 18px;
  line-height: 1.4;
}

.celebration-confetti {
  position: absolute;
  top: -9vh;
  left: var(--left);
  width: 8px;
  height: 20px;
  border-radius: 2px;
  background: var(--particle);
  box-shadow: 0 1px 2px rgb(0 0 0 / 18%);
  opacity: 0;
  animation: celebration-confetti-fall var(--duration) cubic-bezier(0.16, 0.7, 0.3, 1) var(--delay) both;
}

.celebration-money {
  position: absolute;
  top: 49%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  opacity: 0;
  animation: celebration-money-fly 2.6s cubic-bezier(0.12, 0.72, 0.25, 1) var(--delay) both;
}

.celebration-money.coin {
  width: 34px;
  height: 34px;
  border: 4px solid #b77b0f;
  border-radius: 50%;
  color: #7f5204;
  background: #ffd85f;
  box-shadow: inset 0 0 0 2px #fff0a8, 0 4px 10px rgb(69 41 0 / 28%);
}

.celebration-money.coin::before,
.celebration-money.note::before {
  content: "¥";
  font-size: 16px;
  font-style: normal;
  font-weight: 950;
}

.celebration-money.note {
  width: 54px;
  height: 29px;
  border: 3px solid #167049;
  border-radius: 4px;
  color: #0d5b3a;
  background: #a9e4b5;
  box-shadow: inset 0 0 0 2px #e4f8e6, 0 4px 10px rgb(12 64 40 / 22%);
}

.celebration-spark {
  position: absolute;
  top: var(--burst-y);
  left: var(--burst-x);
  width: 4px;
  height: 54px;
  border-radius: 999px;
  background: var(--spark);
  box-shadow: 0 0 10px var(--spark);
  opacity: 0;
  transform-origin: 50% 100%;
  animation: celebration-firework 1.45s ease-out var(--delay) both;
}

@keyframes celebration-scene {
  0% { background: rgb(0 0 0 / 0%); }
  9%, 82% { background: rgb(4 14 10 / 18%); }
  100% { background: rgb(0 0 0 / 0%); }
}

@keyframes celebration-message {
  0% { opacity: 0; transform: translate(-50%, -45%) scale(0.72); }
  10% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
  16%, 82% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(0.96); }
}

@keyframes celebration-confetti-fall {
  0% { opacity: 0; transform: translate3d(0, -6vh, 0) rotate(0deg); }
  10% { opacity: 1; }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--drift), 116vh, 0) rotate(var(--turn)); }
}

@keyframes celebration-money-fly {
  0% { opacity: 0; transform: translate3d(-50%, -50%, 0) scale(0.5) rotate(0deg); }
  11% { opacity: 1; }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(calc(-50% + var(--x)), calc(-50% + var(--y)), 0) scale(1.05) rotate(var(--turn)); }
}

@keyframes celebration-firework {
  0% { opacity: 0; transform: translate(-50%, -100%) rotate(var(--angle)) translateY(0) scaleY(0); }
  12% { opacity: 1; }
  58% { opacity: 1; transform: translate(-50%, -100%) rotate(var(--angle)) translateY(-64px) scaleY(1); }
  100% { opacity: 0; transform: translate(-50%, -100%) rotate(var(--angle)) translateY(-102px) scaleY(0.2); }
}

@media (prefers-reduced-motion: reduce) {
  .win-celebration,
  .celebration-message {
    animation: none;
  }

  .celebration-confetti,
  .celebration-money,
  .celebration-spark {
    display: none;
  }
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #eef1ee;
}

.license-shell[hidden],
.license-reminder[hidden],
[hidden] {
  display: none !important;
}

.license-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: #eef4ef;
}

.license-panel {
  width: min(520px, 100%);
  padding: 42px;
  border: 1px solid #d6e1d9;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 60px rgb(28 60 42 / 12%);
}

.license-panel textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  font: 600 14px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.license-reminder {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 40px));
  padding: 18px 20px;
  border: 1px solid #e6c979;
  border-radius: 10px;
  background: #fff9e6;
  color: #5b4712;
  box-shadow: 0 14px 34px rgb(70 50 10 / 18%);
}

.license-reminder .ghost-button {
  justify-self: start;
}

.auth-panel {
  width: min(440px, 100%);
  padding: 30px;
  border: 1px solid #cfd6d1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgb(29 43 36 / 14%);
}

.auth-brand {
  margin-bottom: 22px;
}

.auth-brand h1 {
  margin: 0;
  color: #1e2d27;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
}

.auth-brand > p:last-child {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 20px;
  border-bottom: 1px solid #d9dfdb;
}

.auth-tabs button {
  border-radius: 0;
  color: #5c6560;
  background: transparent;
}

.auth-tabs button.active {
  color: #0f6a4f;
  box-shadow: inset 0 -3px #0f6a4f;
}

.auth-form {
  display: grid;
  gap: 9px;
}

.auth-form label {
  margin-top: 4px;
  color: #3f4743;
  font-size: 14px;
  font-weight: 750;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid #bcc7c1;
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
}

.auth-form input:focus {
  border-color: #0f6a4f;
  outline: 3px solid rgb(15 106 79 / 13%);
}

.auth-form button[type="submit"] {
  margin-top: 11px;
}

.auth-feedback {
  min-height: 24px;
  margin-top: 13px;
  color: #436052;
  font-size: 14px;
  line-height: 1.5;
}

.auth-feedback[data-error="true"] {
  color: var(--red);
}

.auth-retry {
  width: 100%;
}

.account-session {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 5px 4px 12px;
  border: 1px solid #cfd6d1;
  border-radius: 8px;
  background: rgb(255 255 255 / 84%);
}

.account-session strong {
  max-width: 150px;
  overflow: hidden;
  color: #26322d;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-session span {
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
}

.account-session span[data-state="pending"] {
  color: #a54a27;
}

.account-session span[data-state="syncing"] {
  color: #75601a;
}

.account-session button {
  min-height: 34px;
  padding: 6px 10px;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
}

.left-rail,
.table-workspace,
.right-rail {
  display: contents;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.topbar h1,
.panel-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(22px, 6vw, 38px);
  line-height: 1.08;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar-actions,
.action-buttons,
.sizing-row {
  display: flex;
  gap: 8px;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

#controversial-training-button[aria-pressed="true"] {
  color: #fff;
  border-color: #256f5b;
  background: #256f5b;
}

.training-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin: 0 0 12px;
  padding: 11px 14px;
  border: 1px solid #b78f3f;
  border-radius: 6px;
  color: #f8f0de;
  background: #193b35;
}

.training-banner[hidden] {
  display: none;
}

.training-banner > div {
  min-width: 0;
}

.training-banner strong,
.training-banner span {
  display: block;
  overflow-wrap: anywhere;
}

.training-banner > div > strong {
  font-size: 15px;
  line-height: 1.35;
}

.training-banner > div > span {
  margin-top: 2px;
  color: #bfd8cf;
  font-size: 12px;
  line-height: 1.4;
}

.training-banner .eyebrow {
  color: #e9c66d;
}

.training-banner-focus {
  padding-left: 14px;
  border-left: 1px solid rgb(233 198 109 / 42%);
}

.training-banner-focus span {
  color: #e9c66d;
  font-size: 11px;
  font-weight: 800;
}

.training-banner-focus strong {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.4;
}

.training-banner .ghost-button {
  color: #f8f0de;
  border-color: #8ab5a7;
  background: #235247;
}

.replay-panel {
  display: flex;
  min-height: 280px;
  flex-direction: column;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 10px 26px rgb(39 49 58 / 8%);
  overflow: hidden;
}

.replay-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.replay-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.replay-heading > span {
  padding: 5px 8px;
  border: 1px solid #c9d8d0;
  border-radius: 6px;
  color: var(--success);
  background: #edf7f0;
  font-size: 12px;
  font-weight: 850;
}

.replay-list {
  display: grid;
  min-height: 0;
  gap: 7px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.replay-empty {
  margin: 0;
  padding: 18px 12px;
  border: 1px dashed #c9bfa9;
  border-radius: 6px;
  color: var(--muted);
  background: #fbf7ee;
  font-size: 13px;
  line-height: 1.55;
}

.replay-item {
  display: grid;
  width: 100%;
  min-height: 70px;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid #ddd2bd;
  border-radius: 6px;
  color: var(--ink);
  background: #fbf7ee;
  text-align: left;
}

.replay-item:hover,
.replay-item.active {
  border-color: var(--success);
  background: #edf7f0;
  box-shadow: inset 3px 0 var(--success);
}

.replay-item-top {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.replay-item-top strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replay-cards {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
}

.replay-card {
  display: grid;
  width: 30px;
  height: 26px;
  place-items: center;
  border: 1px solid #d6d0c5;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.replay-card.red {
  color: #c52338;
}

.replay-card.black {
  color: #15191c;
}

.replay-item-result {
  color: #465048;
  font-size: 12px;
  font-weight: 800;
}

.replay-item-result[data-result="win"] {
  color: var(--success);
}

.replay-item-result[data-result="loss"] {
  color: var(--red);
}

.replay-item small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.grade-stat-row {
  display: grid;
  grid-template-columns: 42px 1fr 44px 36px;
  align-items: center;
  gap: 8px;
  color: #30363d;
  font-size: 12px;
  font-weight: 850;
}

.grade-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfca;
}

.grade-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--success));
}

.grade-stat-row em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.daily-score-panel {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 10px 26px rgb(39 49 58 / 8%);
}

.daily-score-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.daily-score-heading h2 {
  font-size: 18px;
}

.daily-date-controls {
  display: grid;
  grid-template-columns: 34px minmax(130px, 1fr) 34px;
  gap: 5px;
}

.daily-date-controls button {
  min-width: 34px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: #f8efd9;
  color: var(--charcoal);
  font-size: 24px;
  line-height: 1;
}

.daily-date-controls input {
  min-width: 0;
  min-height: 38px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.daily-score-overview {
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px;
  border-block: 1px solid var(--line);
}

.daily-score-overview span,
.daily-score-overview small,
.daily-query-metrics span,
.daily-query-metrics small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.daily-score-overview strong {
  display: inline-block;
  margin-right: 5px;
  color: var(--success);
  font-size: 38px;
  line-height: 1;
}

.daily-score-overview p {
  margin: 0;
  color: #3b4147;
  font-size: 12px;
  line-height: 1.5;
}

.daily-query-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 10px 0;
}

.daily-query-metrics > div {
  min-width: 0;
  padding: 7px;
  border-radius: 6px;
  background: #f7f0e2;
}

.daily-query-metrics strong {
  display: block;
  margin-top: 3px;
  color: var(--charcoal);
  font-size: 15px;
  line-height: 1.1;
}

.daily-query-metrics small {
  margin-top: 3px;
}

.daily-score-grades {
  display: grid;
  gap: 5px;
}

.daily-trend-summary {
  margin-top: 10px;
  color: #3b4147;
  font-size: 12px;
  font-weight: 750;
}

.daily-trend-list {
  display: grid;
  gap: 4px;
  margin-top: 7px;
}

.daily-trend-row {
  display: grid;
  grid-template-columns: 52px 1fr 30px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.daily-trend-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfca;
}

.daily-trend-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
}

.primary-button {
  color: #fff;
  background: var(--success);
  box-shadow: 0 7px 16px rgb(21 122 82 / 20%);
}

.ghost-button {
  color: var(--ink);
  background: #f8efd9;
  border: 1px solid var(--line);
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(27 36 34 / 48%);
}

.modal-shell[hidden] {
  display: none;
}

.modal-panel {
  width: min(720px, 100%);
  max-height: min(860px, 92vh);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  box-shadow: 0 24px 70px rgb(19 26 25 / 28%);
}

.modal-panel .panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-panel h2 {
  margin: 0;
  color: var(--charcoal);
  font-size: 24px;
}

.icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--charcoal);
  background: #f8efd9;
  font-size: 24px;
  line-height: 1;
}

.modal-panel > label,
.modal-panel form > label {
  display: block;
  margin: 12px 0 6px;
  color: var(--charcoal);
  font-size: 13px;
  font-weight: 850;
}

.modal-panel select,
.modal-panel input[type="text"],
.modal-panel input[type="number"],
.modal-panel input:not([type]),
.modal-panel textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

.modal-note {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.training-setup-modal {
  width: min(560px, 100%);
}

.training-setup-preview {
  display: grid;
  gap: 3px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #c8b377;
  border-radius: 6px;
  background: #f4f7f2;
}

.training-setup-preview strong {
  color: #174d3f;
  font-size: 14px;
}

.training-setup-preview span {
  color: #50645e;
  font-size: 12px;
  line-height: 1.45;
}

.scenario-review {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #ba9a54;
  border-radius: 6px;
  background: #f4f7f2;
}

.scenario-review span,
.scenario-review strong {
  display: block;
}

.scenario-review span {
  color: #667a73;
  font-size: 11px;
  font-weight: 800;
}

.scenario-review strong {
  margin-top: 3px;
  color: #174d3f;
  font-size: 14px;
}

.scenario-review p {
  margin: 5px 0 0;
  color: #33433e;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .training-banner {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .training-banner-focus {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 8px 0 0;
    border-top: 1px solid rgb(233 198 109 / 42%);
    border-left: 0;
  }
}

.role-assignment-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 6px;
}

.role-assignment-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1.65fr) minmax(84px, 0.7fr);
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e7dfcf;
  border-radius: 6px;
  background: #faf6ec;
}

.role-assignment-row > span,
.role-assignment-row label > span {
  display: block;
  color: var(--charcoal);
  font-size: 13px;
  font-weight: 900;
}

.role-assignment-row .role-assignment-label {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.role-assignment-row label {
  min-width: 0;
}

.role-assignment-row select {
  min-height: 34px;
  padding: 5px 7px;
}

.role-library {
  display: grid;
  gap: 6px;
  max-height: 330px;
  margin-bottom: 14px;
  overflow: auto;
}

.role-library-group {
  border: 1px solid #e7dfcf;
  border-radius: 7px;
  background: #fffdf8;
}

.role-library-group > summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  cursor: pointer;
  color: var(--charcoal);
  font-size: 14px;
  font-weight: 900;
}

.role-library-group > summary span,
.role-library-group > p {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.role-library-group > p {
  margin: 0;
  padding: 0 11px 8px;
  line-height: 1.45;
}

.role-library-group > div {
  display: grid;
  gap: 5px;
  padding: 0 7px 7px;
}

.role-lock {
  display: inline-flex;
  min-width: 48px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 4px 7px;
  border-radius: 5px;
  color: #716754;
  background: #eee6d8;
  font-size: 11px;
  font-weight: 850;
}

.role-library-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid #e7dfcf;
  border-radius: 6px;
  background: #faf6ec;
}

.role-library-row strong,
.role-library-row small {
  display: block;
}

.role-library-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.role-library-row > div:last-child {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.role-library-row button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.role-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-top: 12px;
}

.role-range {
  display: grid;
  gap: 5px;
}

.role-range > span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--charcoal);
  font-size: 12px;
}

.role-range output {
  color: var(--success);
  font-weight: 900;
}

.role-range input[type="range"] {
  width: 100%;
  accent-color: var(--success);
}

.role-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--charcoal);
  font-size: 12px;
  font-weight: 750;
}

.role-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--success);
}

.advanced-role-details {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8f3e8;
}

.advanced-role-details summary {
  cursor: pointer;
  color: var(--charcoal);
  font-size: 13px;
  font-weight: 900;
}

.auth-feedback[data-error="true"] {
  color: var(--red);
}

.danger-button {
  color: #fff;
  background: var(--red);
}

.allin-button {
  color: #fff;
  background: var(--plum);
}

.status-strip {
  position: absolute;
  top: 102px;
  left: 50%;
  z-index: 3;
  display: flex;
  gap: 14px;
  transform: translateX(-50%);
  width: auto;
}

.status-strip > div,
.hero-panel,
.review-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 10px 26px rgb(39 49 58 / 8%);
}

.status-strip > div {
  position: static;
  width: clamp(78px, 14vw, 108px);
  min-width: 0;
  padding: 8px 10px;
  background: rgb(255 249 237 / 94%);
  text-align: center;
}

.status-strip span,
.hero-stack span,
.seat-meta,
.review-meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-strip strong,
.hero-stack strong {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  line-height: 1;
}

.table-panel {
  margin-bottom: 12px;
}

.bad-history-panel {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 255 255 / 90%);
  box-shadow: 0 10px 26px rgb(39 49 58 / 8%);
}

.bad-history-list {
  display: grid;
  max-height: 360px;
  gap: 8px;
  overflow: auto;
}

.empty-history {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.bad-hand-item {
  border: 1px solid #e2c6c1;
  border-radius: 8px;
  background: #fff8f4;
}

.bad-hand-item summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--red);
  font-weight: 900;
}

.bad-hand-item summary strong {
  color: #fff;
  background: var(--red);
  border-radius: 999px;
  padding: 4px 8px;
}

.bad-hand-body {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.bad-hand-body p {
  margin: 0;
}

.bad-review-line {
  margin-top: 6px;
  padding: 7px;
  border-radius: 8px;
  background: #fff;
}

.bad-review-line span {
  display: block;
  margin-bottom: 4px;
  color: var(--plum);
  font-weight: 900;
}

.bad-action-list {
  display: grid;
  max-height: 180px;
  gap: 5px;
  margin: 6px 0 0;
  overflow: auto;
  padding-left: 18px;
}

.table-felt {
  position: relative;
  min-height: 410px;
  overflow: hidden;
  border: 8px solid #5a2f23;
  border-radius: 34px;
  background:
    radial-gradient(circle at center, rgb(255 255 255 / 12%), transparent 45%),
    linear-gradient(140deg, var(--felt-light), var(--felt-dark));
  box-shadow: var(--shadow), inset 0 0 0 5px rgb(244 207 114 / 52%);
}

.community {
  position: absolute;
  top: 42%;
  left: 50%;
  z-index: 2;
  display: flex;
  width: min(360px, 76vw);
  min-height: 76px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transform: translate(-50%, -50%);
}

.pot-badge {
  position: absolute;
  top: calc(42% + 58px);
  left: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  color: #2b2110;
  background: #f6d36b;
  box-shadow: 0 6px 15px rgb(0 0 0 / 18%);
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 800;
}

.seat-grid {
  position: absolute;
  inset: 0;
}

.seat {
  position: absolute;
  z-index: 4;
  width: clamp(112px, 24vw, 148px);
  min-height: 104px;
  padding: 8px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 8px;
  color: #fff;
  background: rgb(9 28 24 / 74%);
  box-shadow: 0 10px 24px rgb(0 0 0 / 18%);
}

.seat-note-button {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 3;
  display: grid;
  width: 25px;
  min-width: 25px;
  height: 25px;
  min-height: 25px;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 44%);
  border-radius: 5px;
  color: #fff;
  background: rgb(22 29 33 / 46%);
  box-shadow: 0 3px 8px rgb(0 0 0 / 14%);
  font-size: 15px;
  line-height: 1;
}

.seat-note-button:hover,
.seat-note-button:focus-visible {
  color: #27352f;
  background: #fff4cc;
}

.seat-note-button.has-note::after {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 7px;
  height: 7px;
  border: 1px solid rgb(255 255 255 / 85%);
  border-radius: 50%;
  background: #f6d36b;
  content: "";
}

.seat-note-modal {
  width: min(520px, 100%);
}

.seat-note-modal textarea {
  min-height: 150px;
  resize: vertical;
  font-size: 15px;
  line-height: 1.65;
}

.position-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  min-width: 42px;
  padding: 4px 7px;
  border: 1px solid rgb(255 255 255 / 48%);
  border-radius: 5px;
  color: #fff;
  background: rgb(22 29 33 / 70%);
  box-shadow: 0 3px 8px rgb(0 0 0 / 22%);
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 2px rgb(0 0 0 / 35%);
}

/* Position colors move from the warm button through the cooler blinds. */
.seat.position-btn { background: #c9404d; border-color: #ffd1d4; }
.seat.position-co { background: #b65b43; }
.seat.position-hj { background: #b7773d; }
.seat.position-mp { background: #9c8840; }
.seat.position-lj { background: #6f8752; }
.seat.position-utgplus1 { background: #3f8474; }
.seat.position-utg { background: #3f7086; }
.seat.position-bb { background: #4b627f; }
.seat.position-sb { background: #59657b; }
.seat.position-unknown { background: #53656a; }

.seat.position-btn,
.seat.position-co,
.seat.position-hj,
.seat.position-mp,
.seat.position-lj,
.seat.position-utgplus1,
.seat.position-utg,
.seat.position-bb,
.seat.position-sb,
.seat.position-unknown {
  color: #fff;
}

.seat.position-btn .seat-action,
.seat.position-co .seat-action,
.seat.position-hj .seat-action,
.seat.position-mp .seat-action,
.seat.position-lj .seat-action,
.seat.position-utgplus1 .seat-action,
.seat.position-utg .seat-action,
.seat.position-bb .seat-action,
.seat.position-sb .seat-action,
.seat.position-unknown .seat-action {
  color: #fff1c7;
}

.seat.hero.position-btn {
  color: #fff;
  background: #c9404d;
  border-color: #ffd1d4;
}

.seat.hero {
  background: rgb(255 249 237 / 95%);
  color: var(--ink);
  border-color: #f4cf72;
}

.seat.folded {
  opacity: 0.55;
}

.seat.eliminated {
  color: #938c80;
  background: rgb(35 37 39 / 50%);
}

.seat-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 26px;
  padding-right: 48px;
  padding-left: 32px;
  font-size: 13px;
  font-weight: 850;
}

.dealer-chip {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #221908;
  background: #fff3c3;
  font-size: 12px;
  font-weight: 900;
}

.seat-stack {
  margin-top: 5px;
  font-size: 16px;
  font-weight: 900;
}

.seat-action {
  min-height: 19px;
  margin-top: 4px;
  color: #f8d778;
  font-size: 12px;
  font-weight: 800;
}

.seat-showdown {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.seat-hole-cards {
  display: flex;
  gap: 4px;
}

.mini-card {
  display: inline-grid;
  min-width: 30px;
  height: 22px;
  place-items: center;
  border: 1px solid #d8cbb4;
  border-radius: 5px;
  background: #fffdf7;
  color: #202428;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 4px 8px rgb(0 0 0 / 16%);
}

.mini-card.red {
  color: #d31332;
  border-color: #d31332;
}

.mini-card.black {
  color: #050505;
  border-color: #202428;
}

.seat-hand-rank {
  color: #fff3c3;
  font-size: 11px;
  font-weight: 900;
}

.seat.hero .seat-hand-rank {
  color: var(--plum);
}

.seat.hero .seat-action {
  color: var(--red);
}

/* Keep the position palette visible even when the hero seat uses the legacy
   light-card treatment. */
.seat.hero.position-btn,
.seat.hero.position-co,
.seat.hero.position-hj,
.seat.hero.position-mp,
.seat.hero.position-lj,
.seat.hero.position-utgplus1,
.seat.hero.position-utg,
.seat.hero.position-bb,
.seat.hero.position-sb,
.seat.hero.position-unknown {
  color: #fff;
}

.seat.hero.position-btn { background: #c9404d; border-color: #ffd1d4; }
.seat.hero.position-co { background: #b65b43; }
.seat.hero.position-hj { background: #b7773d; }
.seat.hero.position-mp { background: #9c8840; }
.seat.hero.position-lj { background: #6f8752; }
.seat.hero.position-utgplus1 { background: #3f8474; }
.seat.hero.position-utg { background: #3f7086; }
.seat.hero.position-bb { background: #4b627f; }
.seat.hero.position-sb { background: #59657b; }
.seat.hero.position-unknown { background: #53656a; }

.seat.position-btn .seat-action,
.seat.position-co .seat-action,
.seat.position-hj .seat-action,
.seat.position-mp .seat-action,
.seat.position-lj .seat-action,
.seat.position-utgplus1 .seat-action,
.seat.position-utg .seat-action,
.seat.position-bb .seat-action,
.seat.position-sb .seat-action,
.seat.position-unknown .seat-action,
.seat.hero.position-btn .seat-hand-rank,
.seat.hero.position-co .seat-hand-rank,
.seat.hero.position-hj .seat-hand-rank,
.seat.hero.position-mp .seat-hand-rank,
.seat.hero.position-lj .seat-hand-rank,
.seat.hero.position-utgplus1 .seat-hand-rank,
.seat.hero.position-utg .seat-hand-rank,
.seat.hero.position-bb .seat-hand-rank,
.seat.hero.position-sb .seat-hand-rank,
.seat.hero.position-unknown .seat-hand-rank {
  color: #fff1c7;
}

.seat-0 { left: 50%; bottom: 10px; transform: translateX(-50%); }
.seat-1 { left: 8px; bottom: 58px; }
.seat-2 { left: 8px; top: 42%; transform: translateY(-50%); }
.seat-3 { left: 13%; top: 14px; }
.seat-4 { left: 50%; top: 8px; transform: translateX(-50%); }
.seat-5 { right: 13%; top: 14px; }
.seat-6 { right: 8px; top: 42%; transform: translateY(-50%); }
.seat-7 { right: 8px; bottom: 58px; }
.seat-8 { right: 24%; bottom: 134px; transform: translateX(50%); }

.card,
.card-back {
  display: grid;
  width: 48px;
  height: 68px;
  place-items: center;
  border-radius: 7px;
  box-shadow: 0 7px 14px rgb(0 0 0 / 18%);
  font-size: 18px;
  font-weight: 900;
}

.card {
  border: 1px solid #d8cbb4;
  background: #fffdf7;
}

.card.red {
  color: #d31332;
}

.card.black {
  color: #050505;
}

.card-back {
  color: #fff9ed;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 18%) 25%, transparent 25% 50%, rgb(255 255 255 / 18%) 50% 75%, transparent 75%),
    #8f1d32;
  background-size: 14px 14px;
}

.hero-panel {
  display: grid;
  position: sticky;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 20;
  isolation: isolate;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px;
  backdrop-filter: blur(10px);
}

.hero-cards {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-control-row {
  align-items: stretch;
}

.hero-hand-group {
  display: flex;
  min-width: 240px;
  align-items: center;
  gap: 10px;
}

.cards-row {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 8px;
}

.hero-stack {
  min-width: 86px;
  padding: 10px;
  border-radius: 8px;
  background: #f4eddf;
  text-align: right;
}

.action-copy {
  min-height: 36px;
  padding: 8px 10px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #fff5df;
  color: #3c3020;
  font-weight: 750;
}

.rebuy-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #d9b45b;
  border-radius: 8px;
  background: #fff8e8;
}

.rebuy-panel[hidden] {
  display: none;
}

.rebuy-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.rebuy-buttons button {
  min-height: 38px;
  padding: 8px 10px;
}

.sizing-panel {
  display: grid;
  gap: 7px;
}

.sizing-panel label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--success);
}

input[type="number"] {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  font-weight: 800;
}

.sizing-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.sizing-row button {
  min-width: 0;
  padding: 0 4px;
  color: var(--charcoal);
  background: #efe3ca;
  font-size: 12px;
}

.action-buttons {
  display: grid;
  position: relative;
  z-index: 2;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  flex: 1;
  min-width: min(100%, 360px);
  align-self: center;
  pointer-events: auto;
}

.action-area {
  display: grid;
  min-width: min(100%, 360px);
  flex: 1;
  align-self: center;
  gap: 5px;
}

.action-area-heading {
  display: flex;
  min-height: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.action-area .action-buttons {
  width: 100%;
  min-width: 0;
  flex: none;
}

.hand-result {
  display: inline-flex;
  min-width: 78px;
  justify-content: center;
  padding: 5px 9px;
  border: 1px solid rgb(21 122 82 / 42%);
  border-radius: 6px;
  color: var(--success);
  background: #edf7f0;
  font-size: 13px;
  font-weight: 950;
  line-height: 1.1;
}

.hand-result[data-result="loss"] {
  color: var(--red);
  border-color: rgb(170 36 57 / 38%);
  background: #fff0ef;
}

.hand-result[data-result="even"] {
  color: var(--muted);
  border-color: var(--line);
  background: #f3f0e8;
}

.action-buttons button,
.topbar-actions button {
  padding: 0 12px;
}

.action-buttons button {
  touch-action: manipulation;
  pointer-events: auto;
  min-width: 0;
}

.seat-grid[data-seat-count="5"] .seat-0 { left: 50%; bottom: 10px; transform: translateX(-50%); }
.seat-grid[data-seat-count="2"] .seat-0 { left: 50%; bottom: 10px; transform: translateX(-50%); }
.seat-grid[data-seat-count="2"] .seat-1 { left: 50%; top: 14px; bottom: auto; transform: translateX(-50%); }
.seat-grid[data-seat-count="5"] .seat-1 { left: 8%; bottom: 62px; }
.seat-grid[data-seat-count="5"] .seat-2 { left: 10%; top: 14px; transform: none; }
.seat-grid[data-seat-count="5"] .seat-3 { right: 10%; top: 14px; left: auto; }
.seat-grid[data-seat-count="5"] .seat-4 { right: 8%; bottom: 62px; left: auto; top: auto; transform: none; }

.seat-grid[data-seat-count="6"] .seat-0 { left: 50%; bottom: 10px; transform: translateX(-50%); }
.seat-grid[data-seat-count="6"] .seat-1 { left: 7%; bottom: 62px; }
.seat-grid[data-seat-count="6"] .seat-2 { left: 7%; top: 35%; transform: translateY(-50%); }
.seat-grid[data-seat-count="6"] .seat-3 { left: 50%; top: 10px; transform: translateX(-50%); }
.seat-grid[data-seat-count="6"] .seat-4 { right: 7%; top: 35%; left: auto; transform: translateY(-50%); }
.seat-grid[data-seat-count="6"] .seat-5 { right: 7%; bottom: 62px; left: auto; top: auto; }

.seat-grid[data-seat-count="7"] .seat-0 { left: 50%; bottom: 10px; transform: translateX(-50%); }
.seat-grid[data-seat-count="7"] .seat-1 { left: 6%; bottom: 62px; }
.seat-grid[data-seat-count="7"] .seat-2 { left: 7%; top: 35%; transform: translateY(-50%); }
.seat-grid[data-seat-count="7"] .seat-3 { left: 22%; top: 10px; }
.seat-grid[data-seat-count="7"] .seat-4 { right: 22%; top: 10px; left: auto; }
.seat-grid[data-seat-count="7"] .seat-5 { right: 7%; top: 35%; left: auto; transform: translateY(-50%); }
.seat-grid[data-seat-count="7"] .seat-6 { right: 6%; bottom: 62px; left: auto; top: auto; }

.insight-layout {
  display: grid;
  gap: 12px;
}

.review-panel {
  min-width: 0;
  padding: 14px;
}

.panel-heading {
  margin-bottom: 10px;
}

.panel-heading h2 {
  font-size: 20px;
}

.street-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 12px;
}

.street-tabs button {
  min-width: 0;
  min-height: 40px;
  color: var(--charcoal);
  background: #efe3ca;
  border: 1px solid var(--line);
  font-size: 13px;
}

.street-tabs button.active {
  color: #fff;
  background: var(--success);
  border-color: var(--success);
}

.review-content {
  display: grid;
  gap: 10px;
}

.review-card {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffcf6;
}

.replay-review-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #8ab49f;
  border-radius: 6px;
  color: #164d39;
  background: #e8f5ed;
}

.replay-review-banner span {
  color: #48685b;
  font-size: 12px;
  font-weight: 700;
}

.replay-action-card ol {
  display: grid;
  gap: 6px;
  margin: 9px 0 0;
  padding-left: 24px;
}

.replay-action-card li {
  padding-left: 3px;
  color: #3e4742;
  font-size: 14px;
  line-height: 1.45;
}

.street-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.street-coach-summary,
.street-empty {
  padding: 12px;
  border: 1px solid #bda55e;
  border-radius: 8px;
  background: #fff4d5;
}

.street-coach-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.street-coach-summary strong {
  color: var(--plum);
  font-size: 22px;
}

.street-coach-card {
  border-color: #e0c16b;
}

.review-verdict {
  margin: 0 0 8px;
  color: var(--charcoal);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.5;
}

.review-action-line {
  margin: 0 0 10px;
  padding: 9px 11px;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  color: var(--charcoal);
  background: #fff3cf;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
}

.review-action-line strong {
  color: var(--plum);
}

.coach-summary-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 22px;
  color: #403b34;
  font-size: 16px;
  line-height: 1.5;
}

.coach-summary-list li {
  padding-left: 2px;
}

.review-confidence {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.review-pending {
  border-style: dashed;
  background: #fffaf0;
}

.grade-pill {
  display: inline-flex;
  min-width: 58px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--plum);
  font-size: 14px;
  font-weight: 900;
}

.grade-pill[data-grade="差"] {
  background: #aa2439;
}

.grade-pill[data-grade="较差"] {
  background: #9b5a1f;
}

.grade-pill[data-grade="良"] {
  background: #376b71;
}

.grade-pill[data-grade="优秀"] {
  background: #157a52;
}

.grade-pill[data-grade="完美"] {
  background: #4b253b;
}

.review-score-inline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
}

.ev-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 5px 10px;
  box-sizing: border-box;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.ev-positive {
  color: #11613d;
  background: #c8f2d9;
}

.ev-negative {
  color: #8d1f2d;
  background: #ffd2d2;
}

.ev-neutral {
  color: #59615d;
  background: #e8ece8;
}

.review-card strong {
  color: var(--success);
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--charcoal);
  font-weight: 900;
}

@media (min-width: 780px) {
  .app-shell {
    padding: 20px;
  }

  .table-felt {
    min-height: 520px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .insight-layout {
    grid-template-columns: 1.05fr 0.95fr;
  }

  .card,
  .card-back {
    width: 58px;
    height: 80px;
    font-size: 20px;
  }

  .seat {
    padding: 10px;
  }
}

@media (min-width: 1280px) {
  .app-shell {
    width: min(1080px, calc(100% - 320px));
    margin-left: 300px;
    margin-right: 20px;
  }

  .bad-history-panel {
    position: fixed;
    top: 92px;
    left: 16px;
    z-index: 30;
    width: 264px;
    max-height: calc(100vh - 112px);
    margin: 0;
    overflow: hidden;
  }

  .bad-history-list {
    max-height: calc(100vh - 190px);
  }
}

@media (min-width: 1600px) {
  .app-shell {
    width: min(1000px, calc(100% - 660px));
    margin-left: 300px;
    margin-right: 340px;
  }

  .daily-score-panel {
    position: static;
    width: auto;
    max-height: none;
    margin: 0 0 12px;
    overflow: visible;
  }

  .daily-score-heading {
    display: flex;
  }

  .daily-date-controls {
    margin-top: 0;
  }

  .daily-query-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1650px) and (min-height: 900px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    display: grid;
    width: 100%;
    height: 100vh;
    grid-template-columns: clamp(280px, 18vw, 320px) minmax(0, 1fr) clamp(380px, 23vw, 460px);
    gap: 14px;
    margin: 0;
    padding: 16px;
    overflow: hidden;
  }

  .left-rail,
  .table-workspace,
  .right-rail {
    display: grid;
    min-width: 0;
    min-height: 0;
  }

  .left-rail {
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    overflow: hidden;
  }

  .table-workspace {
    grid-template-rows: 58px minmax(0, 1fr) 190px;
    gap: 12px;
  }

  .app-shell.controversial-training-active .table-workspace {
    grid-template-rows: 58px auto minmax(0, 1fr) 190px;
  }

  .right-rail {
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .topbar {
    min-width: 0;
    min-height: 0;
    margin: 0;
  }

  .topbar h1 {
    font-size: 29px;
  }

  .topbar .eyebrow {
    margin-bottom: 2px;
  }

  .topbar-actions {
    flex-wrap: nowrap;
  }

  .topbar-actions button {
    min-height: 42px;
    padding-inline: 18px;
  }

  .table-panel {
    min-width: 0;
    min-height: 0;
    margin: 0;
  }

  .table-felt {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-width: 10px;
    border-radius: 46px;
  }

  .status-strip {
    inset: 0;
    width: auto;
    transform: none;
    pointer-events: none;
  }

  .status-strip > div {
    position: absolute;
    width: 112px;
    padding: 10px 12px;
  }

  .status-strip > div:nth-child(1) {
    top: calc(50% - 74px);
    left: 190px;
  }

  .status-strip > div:nth-child(2) {
    top: calc(50% + 10px);
    left: 190px;
  }

  .status-strip > div:nth-child(3) {
    top: calc(50% - 74px);
    right: 190px;
  }

  .status-strip > div:nth-child(4) {
    top: calc(50% + 10px);
    right: 190px;
  }

  .community {
    top: 48%;
    width: 520px;
    min-height: 92px;
    gap: 10px;
  }

  .pot-badge {
    top: calc(48% + 72px);
    padding: 8px 16px;
    font-size: 15px;
  }

  .card,
  .card-back {
    width: 64px;
    height: 88px;
    font-size: 22px;
  }

  .seat {
    width: 158px;
    min-height: 86px;
    padding: 11px;
  }

  .seat-name {
    font-size: 14px;
  }

  .seat-stack {
    font-size: 18px;
  }

  .seat-0 { bottom: 18px; }
  .seat-1 { left: 24px; bottom: 112px; }
  .seat-2 { left: 24px; top: 45%; }
  .seat-3 { left: 17%; top: 24px; }
  .seat-4 { top: 18px; }
  .seat-5 { right: 17%; top: 24px; }
  .seat-6 { right: 24px; top: 45%; }
  .seat-7 { right: 24px; bottom: 112px; }
  .seat-8 { right: 22%; bottom: 178px; }

  .hero-panel {
    position: relative;
    bottom: auto;
    min-width: 0;
    min-height: 0;
    gap: 6px;
    margin: 0;
    padding: 8px 10px;
    overflow: hidden;
  }

  .hero-control-row {
    min-height: 76px;
  }

  .hero-hand-group {
    min-width: 300px;
  }

  .cards-row {
    min-height: 68px;
  }

  .hero-panel .card,
  .hero-panel .card-back {
    width: 50px;
    height: 68px;
    font-size: 18px;
  }

  .action-buttons {
    min-width: 620px;
    max-width: 760px;
  }

  .action-buttons button {
    min-height: 48px;
    font-size: 16px;
  }

  .action-copy {
    min-height: 32px;
    padding: 6px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sizing-panel {
    grid-template-columns: 126px minmax(220px, 1fr) minmax(360px, 0.9fr) 128px;
    align-items: center;
    gap: 10px;
  }

  .sizing-row button,
  .sizing-panel input[type="number"] {
    min-height: 38px;
  }

  .rebuy-panel {
    position: absolute;
    inset: 6px;
    z-index: 5;
  }

  .daily-score-panel {
    position: static;
    width: auto;
    max-height: none;
    margin: 0;
  }

  .replay-panel {
    gap: 8px;
    min-height: 0;
    margin: 0;
    padding: 12px;
    overflow: hidden;
  }

  .right-rail .coach-panel {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    padding: 16px;
    overflow: hidden;
  }

  .right-rail .coach-panel .panel-heading {
    flex: 0 0 auto;
    margin-bottom: 10px;
  }

  .right-rail .coach-panel .panel-heading h2 {
    font-size: 26px;
  }

  .right-rail .coach-panel .eyebrow,
  .right-rail .coach-panel .review-meta {
    font-size: 15px;
  }

  .right-rail .coach-panel .street-tabs {
    position: sticky;
    top: 0;
    z-index: 2;
    flex: 0 0 auto;
    margin-bottom: 10px;
    background: #fff;
  }

  .right-rail .coach-panel .street-tabs button {
    min-height: 46px;
    font-size: 17px;
  }

  .right-rail .coach-panel .review-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-right: 5px;
    font-size: 18px;
    line-height: 1.58;
    scrollbar-gutter: stable;
  }

  .right-rail .coach-panel .review-verdict,
  .right-rail .coach-panel .coach-summary-list,
  .right-rail .coach-panel .review-confidence,
  .right-rail .coach-panel .review-action-line {
    font-size: 18px;
    line-height: 1.55;
  }

  .right-rail .coach-panel .street-coach-summary strong {
    font-size: 25px;
  }

  .daily-score-panel {
    display: grid;
    grid-template-columns: 220px 220px 240px 280px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px 10px;
    min-height: 0;
    padding: 10px;
    overflow: hidden;
  }

  .daily-score-heading {
    display: flex;
    grid-column: 1;
    grid-row: 1 / 3;
    align-content: start;
    flex-direction: column;
    justify-content: flex-start;
    margin: 0;
  }

  .daily-date-controls {
    grid-template-columns: 32px minmax(118px, 1fr) 32px;
    margin-top: 9px;
  }

  .daily-score-overview {
    grid-column: 2;
    grid-row: 1 / 3;
    grid-template-columns: 76px minmax(0, 1fr);
    align-content: center;
    gap: 8px;
    margin: 0;
    padding: 8px 10px;
    border-block: 0;
    border-left: 1px solid var(--line);
  }

  .daily-query-metrics {
    grid-column: 3;
    grid-row: 1 / 3;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: center;
    padding: 0;
  }

  .daily-score-grades {
    grid-column: 4;
    grid-row: 1 / 3;
    align-content: center;
  }

  .daily-trend-summary {
    grid-column: 5;
    grid-row: 1;
    margin-top: 0;
  }

  .daily-trend-list {
    grid-column: 5;
    grid-row: 2;
    min-height: 0;
    margin-top: 0;
    overflow: auto;
  }

  .left-rail .daily-score-panel {
    display: block;
    height: auto;
    min-height: 0;
    padding: 14px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .left-rail .daily-score-heading {
    display: block;
    margin-bottom: 10px;
  }

  .left-rail .daily-date-controls {
    margin-top: 10px;
  }

  .left-rail .daily-score-overview {
    grid-template-columns: 92px minmax(0, 1fr);
    margin-top: 10px;
    padding: 10px 0;
    border-block: 1px solid var(--line);
    border-left: 0;
  }

  .left-rail .daily-query-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 0;
  }

  .left-rail .daily-score-grades,
  .left-rail .daily-trend-list {
    overflow: visible;
  }

  .left-rail .replay-panel {
    min-height: 0;
    margin: 0;
    padding: 10px;
  }

  .left-rail .replay-list {
    flex: 1 1 auto;
  }

}

@media (min-width: 1650px) and (max-width: 2199px) and (min-height: 900px) {
  .seat-8 {
    right: 29%;
    bottom: 24px;
  }

  .status-strip {
    top: 160px;
    right: 0;
    bottom: auto;
    left: 0;
    height: auto;
    justify-content: center;
    gap: 8px;
  }

  .status-strip > div {
    position: static;
    width: 108px;
    padding: 8px 10px;
  }

}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    width: 124px;
  }

  .topbar-actions button {
    width: 100%;
  }

  .replay-panel {
    min-height: 260px;
  }

  .daily-score-heading {
    display: block;
  }

  .daily-date-controls {
    margin-top: 9px;
  }

  .daily-score-overview {
    grid-template-columns: 92px 1fr;
  }

  .daily-query-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grade-stat-row {
    grid-template-columns: 38px 1fr 40px 30px;
    gap: 6px;
  }

  .status-strip {
    right: auto;
    left: 9px;
    flex-wrap: wrap;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    top: 84px;
    width: calc(100% - 18px);
    gap: 6px;
    z-index: 1;
  }

  .status-strip > div {
    position: static;
    min-width: 64px;
    padding: 6px 8px;
  }

  .status-strip strong {
    font-size: 15px;
  }

  .table-felt {
    min-height: 365px;
    border-width: 6px;
    border-radius: 26px;
  }

  .community {
    top: 39%;
    gap: 4px;
  }

  .pot-badge {
    top: calc(39% + 50px);
  }

  .seat {
    width: 86px;
    min-height: 66px;
    padding: 7px;
  }

  .seat-name {
    font-size: 12px;
  }

  .seat-stack {
    font-size: 14px;
  }

  .seat-action {
    font-size: 11px;
  }

  .mini-card {
    min-width: 26px;
    height: 20px;
    font-size: 10px;
  }

  .seat-3 { left: 10%; }
  .seat-5 { right: 10%; }
  .seat-8 { right: 25%; bottom: 116px; transform: translateX(50%); }

  .card,
  .card-back {
    width: 40px;
    height: 58px;
    border-radius: 6px;
    font-size: 15px;
  }

  .hero-cards {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .hero-hand-group {
    width: 100%;
    justify-content: space-between;
  }

  .rebuy-panel {
    grid-template-columns: 1fr;
  }

  .rebuy-buttons {
    justify-content: stretch;
  }

  .rebuy-buttons button {
    flex: 1 1 92px;
  }

  .sizing-row,
  .action-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .action-buttons {
    width: 100%;
  }
}

/* Live-edition 3:4 broadcast workspace. Normal desktop layout is unchanged. */
.live-mode-button {
  color: #fff;
  background: #9e3943;
}

.live-insight-actions,
.live-overlay-close {
  display: none;
}

html.live-mode-page,
body.live-mode-page {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1512;
}

.app-shell.live-mode {
  position: relative;
  display: block;
  width: min(75vh, 100vw);
  max-width: none;
  height: min(100vh, 133.333vw);
  aspect-ratio: 3 / 4;
  margin: 0 auto;
  padding: 14px;
  overflow: hidden;
  color: #eef5f1;
  background: #101f1b;
  box-shadow: 0 24px 70px rgb(0 0 0 / 42%);
}

.app-shell.live-mode .table-workspace {
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 58px minmax(0, 1fr) 252px;
  gap: 9px;
}

.app-shell.live-mode .topbar {
  min-width: 0;
  min-height: 0;
  margin: 0;
  color: #f3f8f5;
}

.app-shell.live-mode .topbar h1 {
  color: #f3f8f5;
  font-size: 22px;
}

.app-shell.live-mode .topbar .eyebrow {
  color: #a7beb2;
}

.app-shell.live-mode .topbar-actions {
  flex-wrap: nowrap;
}

.app-shell.live-mode .topbar-actions > *:not(.live-mode-button) {
  display: none !important;
}

.app-shell.live-mode .live-mode-button {
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid rgb(255 172 178 / 42%);
  border-radius: 999px;
}

.app-shell.live-mode .table-panel {
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.app-shell.live-mode .table-felt {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: visible;
  border-width: 9px;
  border-color: #082e25;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #216049 0%, #15503d 55%, #103b30 100%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 13%), inset 0 0 52px rgb(0 0 0 / 28%);
}

.app-shell.live-mode .table-felt::after {
  position: absolute;
  inset: 12%;
  border: 1px solid rgb(221 239 228 / 16%);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.app-shell.live-mode .community {
  top: 56%;
  width: min(52%, 420px);
  min-height: 68px;
  gap: 6px;
}

.app-shell.live-mode .community .card,
.app-shell.live-mode .community .card-back {
  width: clamp(38px, 8.2%, 58px);
  height: clamp(54px, 8vh, 80px);
  font-size: 18px;
}

.app-shell.live-mode .pot-badge {
  top: calc(56% + 72px);
  padding: 5px 10px;
  font-size: 12px;
}

.app-shell.live-mode .status-strip {
  top: 40%;
  right: auto;
  bottom: auto;
  left: 50%;
  display: grid;
  width: min(62%, 460px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  transform: translate(-50%, -50%);
}

.app-shell.live-mode .status-strip > div {
  width: auto;
  padding: 5px 4px;
  border-color: rgb(255 255 255 / 14%);
  color: #f5faf7;
  background: rgb(5 25 19 / 72%);
  box-shadow: none;
}

.app-shell.live-mode .status-strip span {
  color: #a8c0b4;
  font-size: 9px;
}

.app-shell.live-mode .status-strip strong {
  margin-top: 2px;
  font-size: 12px;
}

.app-shell.live-mode .status-strip > div {
  min-height: 47px;
  padding: 7px 4px;
}

.app-shell.live-mode .seat {
  isolation: isolate;
  width: clamp(116px, 18%, 168px);
  min-height: 94px;
  height: 94px;
  max-height: 94px;
  padding: 10px 11px 9px;
  border-color: rgb(255 255 255 / 18%);
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(155deg, rgb(22 62 49 / 96%), rgb(7 29 23 / 96%));
  box-shadow: 0 8px 20px rgb(0 0 0 / 28%), inset 0 1px 0 rgb(255 255 255 / 7%);
}

.app-shell.live-mode .seat.hero {
  color: #fff;
  border-color: #e4b86a;
  background: #4b4025;
}

.app-shell.live-mode .seat-name {
  min-height: 22px;
  min-width: 0;
  padding-right: 46px;
  padding-left: 0;
  font-size: 14px;
}

.app-shell.live-mode .seat-name > span,
.app-shell.live-mode .seat-meta,
.app-shell.live-mode .seat-stack,
.app-shell.live-mode .seat-action,
.app-shell.live-mode .seat-hand-rank {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell.live-mode .seat-meta {
  margin-top: 2px;
  color: #adc3b8;
  font-size: 10px;
}

.app-shell.live-mode .seat-stack {
  margin-top: 4px;
  font-size: 18px;
}

.app-shell.live-mode .seat-action {
  min-height: 19px;
  margin-top: 4px;
  font-size: 12px;
}

.app-shell.live-mode .position-badge {
  top: 8px;
  right: 8px;
  z-index: 8;
  min-width: 42px;
  min-height: 26px;
  padding: 5px 7px;
  border-color: rgb(255 255 255 / 34%);
  border-radius: 5px;
  background: rgb(10 38 30 / 88%);
  box-shadow: 0 3px 8px rgb(0 0 0 / 20%);
  font-size: 11px;
}

.app-shell.live-mode .seat.position-btn .position-badge {
  color: #fff;
  border-color: #ffb1b7;
  background: #d54751;
}

.app-shell.live-mode .seat-note-button {
  top: auto;
  bottom: -11px;
  left: 50%;
  z-index: -1;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  border-radius: 50%;
  color: #d8e6df;
  background: #163d32;
  transform: translateX(-50%);
}

.app-shell.live-mode .seat-name {
  align-items: flex-start;
  padding-top: 1px;
}

.app-shell.live-mode .seat-note-button.has-note {
  color: #302615;
  border-color: #f0cd83;
  background: #e4b86a;
}

.app-shell.live-mode .seat-showdown {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  margin-top: 7px;
}

.app-shell.live-mode .seat-hand-rank {
  font-size: 12px;
  text-align: right;
}

.app-shell.live-mode .mini-card {
  min-width: 34px;
  height: 28px;
  border-radius: 6px;
  font-size: 14px;
}

/* Postflop seat cards need a little more breathing room for action and
   showdown details. The compact preflop layout keeps the center open. */
.app-shell.live-mode .table-felt[data-street="flop"] .seat,
.app-shell.live-mode .table-felt[data-street="turn"] .seat,
.app-shell.live-mode .table-felt[data-street="river"] .seat {
  min-height: 140px;
  height: 140px;
  max-height: 140px;
  padding-bottom: 11px;
}

.app-shell.live-mode .table-felt[data-street="turn"] .seat,
.app-shell.live-mode .table-felt[data-street="river"] .seat {
  min-height: 148px;
  height: 148px;
  max-height: 148px;
}

.app-shell.live-mode .table-felt[data-street="flop"] .seat-showdown,
.app-shell.live-mode .table-felt[data-street="turn"] .seat-showdown,
.app-shell.live-mode .table-felt[data-street="river"] .seat-showdown {
  padding-top: 2px;
  border-top: 1px solid rgb(255 255 255 / 13%);
}

.app-shell.live-mode .seat-grid[data-seat-count="9"] .seat-0 { left: 50%; bottom: 1%; transform: translateX(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="9"] .seat-1 { left: 2%; bottom: 5%; }
.app-shell.live-mode .seat-grid[data-seat-count="9"] .seat-2 { left: 1%; top: 48%; transform: translateY(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="9"] .seat-3 { left: 1%; top: 5%; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="9"] .seat-4 { left: 20%; top: 0; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="9"] .seat-5 { right: 20%; top: 0; left: auto; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="9"] .seat-6 { right: 1%; top: 5%; left: auto; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="9"] .seat-7 { right: 1%; top: 48%; left: auto; transform: translateY(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="9"] .seat-8 { right: 2%; bottom: 5%; left: auto; top: auto; transform: none; }

.app-shell.live-mode .seat-grid[data-seat-count="8"] .seat-0 { left: 50%; bottom: 1%; transform: translateX(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="8"] .seat-1 { left: 2%; bottom: 5%; }
.app-shell.live-mode .seat-grid[data-seat-count="8"] .seat-2 { left: 1%; top: 48%; transform: translateY(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="8"] .seat-3 { left: 2%; top: 5%; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="8"] .seat-4 { left: 50%; top: 0; transform: translateX(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="8"] .seat-5 { right: 2%; top: 5%; left: auto; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="8"] .seat-6 { right: 1%; top: 48%; left: auto; transform: translateY(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="8"] .seat-7 { right: 2%; bottom: 5%; left: auto; top: auto; transform: none; }

.app-shell.live-mode .seat-grid[data-seat-count="7"] .seat-0 { left: 50%; bottom: 1%; transform: translateX(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="7"] .seat-1 { left: 2%; bottom: 5%; }
.app-shell.live-mode .seat-grid[data-seat-count="7"] .seat-2 { left: 1%; top: 48%; transform: translateY(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="7"] .seat-3 { left: 15%; top: 1%; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="7"] .seat-4 { right: 15%; top: 1%; left: auto; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="7"] .seat-5 { right: 1%; top: 48%; left: auto; transform: translateY(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="7"] .seat-6 { right: 2%; bottom: 5%; left: auto; top: auto; transform: none; }

.app-shell.live-mode .seat-grid[data-seat-count="6"] .seat-0 { left: 50%; bottom: 1%; transform: translateX(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="6"] .seat-1 { left: 1%; bottom: 12%; }
.app-shell.live-mode .seat-grid[data-seat-count="6"] .seat-2 { left: 5%; top: 15%; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="6"] .seat-3 { left: 50%; top: 0; transform: translateX(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="6"] .seat-4 { right: 5%; top: 15%; left: auto; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="6"] .seat-5 { right: 1%; bottom: 12%; left: auto; top: auto; transform: none; }

.app-shell.live-mode .seat-grid[data-seat-count="5"] .seat-0 { left: 50%; bottom: 1%; transform: translateX(-50%); }
.app-shell.live-mode .seat-grid[data-seat-count="5"] .seat-1 { left: 1%; top: 42%; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="5"] .seat-2 { left: 14%; top: 7%; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="5"] .seat-3 { right: 14%; top: 7%; left: auto; transform: none; }
.app-shell.live-mode .seat-grid[data-seat-count="5"] .seat-4 { right: 1%; top: 42%; left: auto; transform: none; }

/* Position tabs are inset into every card, so a taller postflop card does not
   change their visual anchor or make them collide with a neighboring seat. */
.app-shell.live-mode .seat.position-btn .position-badge {
  border-color: #ffb1b7;
  background: #d54751;
}

.app-shell.live-mode .hero-panel {
  position: relative;
  bottom: auto;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(72px, auto) 52px 58px;
  gap: 7px;
  margin: 0;
  padding: 8px;
  overflow: hidden;
  border-color: rgb(255 255 255 / 13%);
  color: #eef5f1;
  background: rgb(10 29 23 / 96%);
  box-shadow: none;
  backdrop-filter: none;
}

.app-shell.live-mode .hero-control-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(170px, 0.85fr) minmax(0, 2.6fr);
  gap: 8px;
}

.app-shell.live-mode .action-area {
  min-width: 0;
  align-self: stretch;
  gap: 4px;
}

.app-shell.live-mode .action-area-heading {
  min-height: 18px;
  color: #9fb8ab;
  font-size: 10px;
}

.app-shell.live-mode .hand-result {
  min-width: 76px;
  padding: 5px 8px;
  color: #7fe0a3;
  border-color: rgb(119 209 155 / 58%);
  background: rgb(15 79 51 / 72%);
  font-size: 13px;
}

.app-shell.live-mode .hand-result[data-result="loss"] {
  color: #ff9ca5;
  border-color: rgb(255 156 165 / 58%);
  background: rgb(112 38 53 / 78%);
}

.app-shell.live-mode .hand-result[data-result="even"] {
  color: #c0ccc5;
  border-color: rgb(255 255 255 / 18%);
  background: rgb(40 57 51 / 78%);
}

.app-shell.live-mode .hero-hand-group {
  min-width: 0;
  gap: 8px;
}

.app-shell.live-mode .hero-hand-group .eyebrow,
.app-shell.live-mode .hero-stack span {
  color: #9fb8ab;
}

.app-shell.live-mode .hero-stack {
  min-width: 74px;
  padding: 7px;
  color: #f6faf7;
  background: #17362d;
}

.app-shell.live-mode .hero-panel .card,
.app-shell.live-mode .hero-panel .card-back {
  width: 42px;
  height: 58px;
  font-size: 16px;
}

.app-shell.live-mode .action-buttons {
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.app-shell.live-mode .action-buttons button {
  min-width: 0;
  min-height: 46px;
  padding: 5px 3px;
  overflow: hidden;
  border-radius: 7px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell.live-mode .action-copy {
  display: none;
}

.app-shell.live-mode .sizing-panel {
  display: grid;
  grid-template-columns: 80px minmax(90px, 1fr) minmax(220px, 2fr) 88px;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 8px;
  background: #122d25;
}

.app-shell.live-mode .sizing-panel label {
  color: #acc2b7;
  font-size: 11px;
}

.app-shell.live-mode .sizing-row {
  gap: 5px;
}

.app-shell.live-mode .sizing-row button,
.app-shell.live-mode .sizing-panel input[type="number"] {
  min-height: 36px;
  color: #e9f2ed;
  border-color: rgb(255 255 255 / 14%);
  background: #23483c;
  font-size: 11px;
}

.app-shell.live-mode .sizing-panel input[type="number"] {
  padding: 5px 7px;
}

.app-shell.live-mode .live-insight-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.app-shell.live-mode .live-insight-actions button {
  min-width: 0;
  min-height: 52px;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 8px;
  color: #eef7f2;
  background: #255948;
}

.app-shell.live-mode .live-insight-actions .live-replay-button {
  border-color: rgb(228 184 106 / 55%);
  background: #876a30;
}

.app-shell.live-mode .live-insight-actions small,
.app-shell.live-mode .live-insight-actions span {
  display: block;
}

.app-shell.live-mode .live-insight-actions small {
  margin-bottom: 3px;
  color: rgb(255 255 255 / 72%);
  font-size: 10px;
}

.app-shell.live-mode .live-insight-actions span {
  font-size: 15px;
}

.app-shell.live-mode .rebuy-panel:not([hidden]) {
  position: absolute;
  inset: 8px;
  z-index: 25;
}

.app-shell.live-mode .left-rail,
.app-shell.live-mode .right-rail {
  display: none !important;
}

.app-shell.live-mode.live-replay-open .left-rail,
.app-shell.live-mode.live-coach-open .right-rail {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: block !important;
  min-width: 0;
  min-height: 0;
  padding: 58px 18px 18px;
  overflow: auto;
  color: var(--ink);
  background: #f7f5ee;
}

.app-shell.live-mode .live-overlay-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 84;
  display: grid;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  color: #fff;
  background: #263c34;
  font-size: 24px;
  line-height: 1;
}

.app-shell.live-mode .daily-score-panel,
.app-shell.live-mode .replay-panel,
.app-shell.live-mode .coach-panel {
  position: static;
  width: 100%;
  max-height: none;
  margin: 0 0 12px;
  overflow: visible;
}

.app-shell.live-mode .daily-score-panel h2,
.app-shell.live-mode .replay-panel h2,
.app-shell.live-mode .coach-panel h2 {
  font-size: 26px;
}

.app-shell.live-mode .daily-score-panel,
.app-shell.live-mode .replay-panel,
.app-shell.live-mode .coach-panel,
.app-shell.live-mode .review-content,
.app-shell.live-mode .review-verdict,
.app-shell.live-mode .review-action-line,
.app-shell.live-mode .coach-summary-list,
.app-shell.live-mode .review-confidence {
  font-size: 17px;
  line-height: 1.58;
}

.app-shell.live-mode.live-coach-open .right-rail {
  overflow: hidden;
}

.app-shell.live-mode.live-coach-open .coach-panel {
  display: flex;
  height: 100%;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
}

.app-shell.live-mode.live-coach-open .review-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 5px;
}

@media (max-height: 900px) {
  .app-shell.live-mode {
    padding: 10px;
  }

  .app-shell.live-mode .table-workspace {
    grid-template-rows: 50px minmax(0, 1fr) 226px;
    gap: 7px;
  }

  .app-shell.live-mode .topbar h1 {
    font-size: 18px;
  }

  .app-shell.live-mode .hero-panel {
    grid-template-rows: minmax(66px, auto) 47px 52px;
    gap: 5px;
    padding: 6px;
  }

  .app-shell.live-mode .action-buttons button {
    min-height: 42px;
    font-size: 12px;
  }
}
