:root {
  --bg: #f3f3ec;
  --ink: #27372e;
  --line: #d8ded1;
}
.top {
  background: #fafaf5;
  border-color: #daddd2;
}
.top-inner,
.wrap {
  max-width: 1456px;
}
.top-inner {
  height: 62px;
  gap: clamp(28px, 4.6vw, 65px);
}
.top nav {
  gap: 23px;
}
.top-actions {
  margin-left: auto;
  display: flex;
  gap: 22px;
  align-items: center;
}
.top-actions .help-link {
  margin-left: 0;
}
.top-new {
  min-height: 35px;
  padding: 7px 13px;
}
.wrap.is-table {
  padding-top: 14px;
  padding-bottom: 18px;
}
.room {
  min-width: 0;
}
.replay-strip {
  margin-bottom: 8px;
}
.user-wall {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  background: #fcfcf7;
  border: 1px solid #d8ded2;
  border-radius: 13px;
  box-shadow: 0 2px 5px #294d3410;
}
.wall-summary {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 35px);
  padding: 15px 22px;
}
.wall-icon {
  width: 37px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #386049;
  background: #e8eddf;
  border: 1px solid #d9e2ce;
  border-radius: 10px;
}
.wall-icon svg {
  width: 23px;
  height: 23px;
}
.wall-label {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: none;
}
.wall-label h2 {
  font-size: 17px;
  letter-spacing: -0.6px;
  line-height: 1.4;
}
.wall-label div > span {
  font-size: 12px;
  color: #657363;
}
.wall-picks {
  display: flex;
  gap: clamp(12px, 2.9vw, 43px);
  align-items: center;
  flex: 1;
}
.wall-pick {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 2px 3px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.wall-pick:hover {
  background: #e9efdf;
}
.wall-face {
  width: 25px;
  height: 32px;
  background: var(--mj-surface);
  border: 1px solid var(--mj-rim);
  border-radius: 3px;
  box-shadow: 0 2px 0 var(--mj-edge-color);
  flex-shrink: 0;
}
.wall-pick > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: flex-start;
}
.wall-pick strong {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.wall-pick small {
  font-size: 13px;
  font-weight: 600;
  color: #347151;
}
.wall-expand {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  color: #405d49;
  border: 1px solid #d8dfd3;
  border-radius: 6px;
  white-space: nowrap;
  min-height: 32px;
  font-size: 13px;
}
.wall-expand:hover,
.odds-tabs button:hover {
  background: #e6eddf;
}
.wall-expand span {
  font-size: 17px;
  line-height: 0.5;
}
.wall-empty {
  font-size: 13px;
  color: #637467;
}
#wall-grid {
  border-top: 1px solid #e1e5da;
  margin: 0 21px;
  padding: 13px 0 16px;
}
.odds-grid-head,
.trend-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.odds-grid-head h3,
.seat-section h3 {
  font-size: 15px;
  font-weight: 650;
  margin: 0;
}
.odds-tabs {
  display: flex;
  gap: 2px;
  background: #f0f2e9;
  border: 1px solid #dce2d5;
  border-radius: 6px;
  padding: 2px;
}
.odds-tabs button {
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 12px;
  color: #607060;
}
.odds-tabs button[aria-pressed="true"] {
  background: #fff;
  color: #1d513a;
  box-shadow: 0 1px 3px #23362422;
}
.odds-tabs button:disabled {
  color: #a9b3a6;
}
.odds-grid {
  display: grid;
  grid-template-columns: 22px repeat(9, minmax(0, 1fr));
  gap: 4px;
  align-items: center;
}
.grid-rank,
.grid-suit {
  font-size: 12px;
  text-align: center;
  color: #5d6c5d;
}
.grid-suit {
  font-family: "Songti SC", serif;
  font-size: 16px;
  font-weight: 700;
}
.suit-0 {
  color: #954c42;
}
.suit-1 {
  color: #45707f;
}
.suit-2 {
  color: #527a4c;
}
.odds-cell {
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--cell-ink);
  background: var(--cell-bg);
  min-height: 29px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 3px 1px;
}
.odds-cell:hover {
  filter: brightness(0.93);
}
.odds-cell[aria-pressed="true"] {
  border-color: #245e43;
}
.odds-detail {
  color: #617263;
  font-size: 13px;
  line-height: 1.65;
  margin: 11px 0 0;
}
.odds-detail strong,
.odds-detail b {
  color: #254e36;
}
dialog[data-kind="trend"],
dialog[data-kind="seat"] {
  width: min(585px, calc(100% - 24px));
}
dialog[data-kind="seat"] .dialog-content {
  padding: 22px 24px;
}
.seat-section {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid #e3e7dc;
}
.seat-section h3 {
  margin: 0 0 9px;
}
.seat-section p,
.trend-intro p,
.trend-foot {
  font-size: 12px;
  line-height: 1.65;
  color: #637263;
  margin: 7px 0;
}
.odds-hand {
  display: flex;
  gap: 3px;
  margin: 10px 0;
}
.odds-hand span {
  border: 1px solid var(--mj-rim);
  background: var(--mj-surface);
  box-shadow: 0 2px 0 var(--mj-edge-color);
  width: calc((100% - 41px) / 14);
  max-width: 31px;
  aspect-ratio: 0.76;
  display: block;
  border-radius: 3px;
}
.odds-bar-row {
  display: grid;
  grid-template-columns: 65px 1fr 48px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #4d6255;
  margin: 5px 0;
}
.odds-bar-row > i {
  height: 4px;
  border-radius: 3px;
  background: #edf0e7;
}
.odds-bar-row b {
  display: block;
  background: #6f9478;
  height: 4px;
  border-radius: 3px;
}
.odds-bar-row strong {
  text-align: right;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}
.trend-intro {
  margin-top: 12px;
}
.trend-foot {
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.chart-segments {
  width: auto;
}
.score-row {
  margin: 12px 0;
}
.wrap:not(.is-table) .page-heading > .primary {
  display: none;
}
@media (max-width: 920px) {
  .wall-summary {
    padding: 12px 15px;
    gap: 15px;
  }
  .wall-picks {
    justify-content: space-between;
    gap: 4px;
  }
  .wall-icon {
    display: none;
  }
  .wall-pick {
    gap: 5px;
  }
}
@media (max-width: 650px) {
  .top-inner,
  .wrap {
    padding-left: 10px;
    padding-right: 10px;
  }
  .top-inner {
    height: 51px;
    gap: 14px;
  }
  .wordmark {
    display: none;
  }
  .top nav {
    gap: 12px;
  }
  .top-actions {
    gap: 5px;
  }
  .top-new {
    font-size: 12px;
    min-height: 30px;
    padding: 5px 8px;
  }
  .top-actions .help-link {
    padding: 7px;
  }
  .top-actions .help-link span {
    display: none;
  }
  .wrap.is-table {
    padding-top: 7px;
  }
  .user-wall {
    margin-top: 6px;
    border-radius: 9px;
  }
  .wall-summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px 12px;
  }
  .wall-label h2 {
    font-size: 15px;
  }
  .wall-label > div {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .wall-label div > span {
    font-size: 11px;
  }
  .wall-expand {
    grid-column: 2;
    grid-row: 1;
    padding: 3px 5px;
    min-height: 25px;
    font-size: 11px;
  }
  .wall-picks {
    grid-column: 1/-1;
    grid-row: 2;
  }
  .wall-pick {
    gap: 4px;
  }
  .wall-face {
    width: 20px;
    height: 27px;
  }
  .wall-pick strong,
  .wall-pick small {
    font-size: 11px;
  }
  .odds-grid {
    gap: 3px;
    grid-template-columns: 18px repeat(9, minmax(0, 1fr));
  }
  .odds-cell {
    font-size: 11px;
    min-height: 27px;
  }
  .odds-grid-head {
    flex-wrap: wrap;
    gap: 5px;
  }
  #wall-grid {
    margin: 0 10px;
  }
  .dialog-content,
  dialog[data-kind="seat"] .dialog-content {
    padding: 16px;
  }
  .seat-section {
    margin-top: 10px;
    padding-top: 9px;
  }
  .odds-hand {
    gap: 2px;
  }
  .trend-intro .chart-segments {
    margin: 0 !important;
  }
  .wrap:not(.is-table) .page-heading {
    padding-top: 18px;
  }
}
@media (max-width: 370px) {
  .top-inner {
    gap: 8px;
  }
  .top nav {
    gap: 6px;
  }
  .top-new {
    padding: 4px 6px;
  }
  .wall-summary {
    padding: 8px;
  }
  .wall-pick {
    padding: 0;
  }
  .wall-face {
    width: 17px;
  }
}
/* The navigation, players and wall occupy one continuous felt surface. */
body.game-room {
  --qt-ink: #fff9e9;
  --qt-dim: #c4d8cb;
  --qt-gold: #f2d399;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  background-color: #153f34;
  background-image:
    repeating-linear-gradient(31deg, #dbedca04 0 1px, transparent 1px 4px),
    repeating-linear-gradient(122deg, #071c1306 0 1px, transparent 1px 3px),
    radial-gradient(
      ellipse at 49% 37%,
      #316850fa 0%,
      #205540fa 49%,
      #143f33fa 81%,
      #10352dfc 100%
    ),
    url("assets/room.jpg");
  background-position: center;
  background-size: auto, auto, cover, cover;
  background-attachment: fixed;
}
.game-room .top {
  background: transparent;
  border: 0;
}
.game-room .brand {
  color: #f2f0dc;
}
.game-room .brand-mark {
  color: #eddbaf;
  background: #334c3c;
  box-shadow: inset 0 0 0 1px #77917a52;
}
.game-room .wordmark {
  color: #adb8a6;
  border-color: #566759;
}
.game-room .nav-item,
.game-room .help-link {
  color: #afc0b5;
}
.game-room .nav-item.active {
  color: #eddfb4;
  border-bottom-color: #c7ae75;
}
.game-room .nav-item:hover,
.game-room .help-link:hover {
  color: #faf3d9;
}
.game-room .top-new {
  background: #e6d7af;
  color: #26382b;
  border: 1px solid #e6d7af;
}
.game-room .top-new:hover {
  background: #f3e8c9;
}
.game-room .user-wall {
  background: linear-gradient(115deg, #283d32, #1e3229 64%, #263a30);
  color: #f3f0e0;
  border-color: #78927c52;
  box-shadow: 0 3px 12px #060d095c;
}
.game-room .wall-label div > span,
.game-room .wall-empty {
  color: #bdd0be;
}
.game-room .wall-icon {
  background: #354d3f;
  border-color: #647d65;
  color: #eee2bb;
}
.game-room .wall-pick small {
  color: #b8dec1;
}
.game-room .wall-pick:hover,
.game-room .wall-expand:hover {
  background: #3a5142;
}
.game-room .wall-expand {
  border-color: #617562;
  color: #e7e7d5;
}
.game-room #wall-grid {
  border-color: #59715d;
}
.game-room .user-wall .grid-rank,
.game-room .user-wall .odds-detail {
  color: #c2d1c4;
}
.game-room .user-wall .odds-detail strong,
.game-room .user-wall .odds-detail b {
  color: #e9e5cd;
}
.game-room .user-wall .suit-0 {
  color: #f1b2a3;
}
.game-room .user-wall .suit-1 {
  color: #abd4e3;
}
.game-room .user-wall .suit-2 {
  color: #b4d9ad;
}
.game-room .user-wall .odds-cell[aria-pressed="true"] {
  outline: 2px solid #e7c77d;
}
@media (max-width: 650px) {
  body.game-room {
    background-attachment: scroll;
  }
}
.variant-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 14px;
}
.variant-tabs button {
  padding: 11px 12px;
  border: 1px solid #cdd9cc;
  border-radius: 8px;
  text-align: left;
  color: #364c40;
  background: #fafbf7;
}
.variant-tabs button[aria-pressed="true"] {
  background: #e3eee3;
  box-shadow: inset 0 0 0 1px #387250;
  border-color: #387250;
  color: #16462e;
}
.variant-tabs strong,
.variant-tabs small {
  display: block;
}
.variant-tabs small {
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
  font-weight: 400;
}
.dialog-content .rule-source {
  font-size: 12px;
  line-height: 1.6;
}
.rule-source a,
.read-variant {
  color: #235d40;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.read-variant {
  font-size: 13px;
  margin-bottom: 8px;
  padding: 4px 0;
}

/* Keep the shell quieter than the table and give secondary screens the same rhythm. */
.top-inner {
  height: 54px;
}
.top nav {
  align-self: center;
  align-items: center;
  margin-left: auto;
  gap: 18px;
}
.top nav [hidden] {
  display: none;
}
.top .nav-item {
  min-height: 40px;
  border: 0;
  padding: 0 3px;
  font-size: 13px;
}
.top .top-new {
  min-height: 38px;
  border-radius: 6px;
  padding: 7px 13px;
  font-size: 13px;
}
.game-room .top-new {
  color: #f2e9cb;
  border-color: #667765;
  background: #23372d;
}
.game-room .top-new:hover {
  background: #34493b;
}
.top .brand {
  gap: 8px;
}
.top .brand strong {
  font-size: 21px;
}
.top .brand-mark {
  width: 30px;
  height: 30px;
}
.top .brand-mark svg {
  width: 26px;
}
.game-room .replay-strip {
  border: 1px solid #657961;
  background: #22372c;
  color: #eae8d4;
  border-radius: 8px;
  font-size: 13px;
  gap: 8px;
  padding: 5px 10px;
}
.game-room .replay-strip .round-link {
  color: #ecdcad;
  background: transparent;
  border: 0;
  min-height: 36px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.wrap:not(.is-table) {
  max-width: 980px;
}
.wrap:not(.is-table) .page-heading {
  padding: 38px 0 18px;
}
.wrap:not(.is-table) .page-heading h1 {
  font-size: 28px;
  letter-spacing: -0.03em;
}
.wrap:not(.is-table) .page-heading p {
  font-size: 13px;
}
.card.record-list {
  background: transparent;
  padding: 0;
  box-shadow: none;
  border: 0;
  border-top: 1px solid #bac7b7;
  border-radius: 0;
}
.record h3 {
  font-size: 15px;
  font-weight: 620;
}
.record .secondary {
  min-height: 38px;
  padding: 6px 12px;
  background: transparent;
}
dialog {
  color: #283b30;
  background: #fbfbf6;
  border-color: #ced6c9;
  border-radius: 13px;
}
dialog::backdrop {
  background: #09171091;
}
.dialog-head {
  margin-bottom: 12px;
}
.dialog-head h2 {
  letter-spacing: -0.035em;
  font-size: 22px;
}
.dialog-head .icon-btn {
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  margin: -4px -5px -4px 0;
}
.setup-field {
  margin-top: 16px;
}
.dialog-content .setup-field h3 {
  margin: 0;
  font-size: 14px;
}
.setup-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.read-variant {
  text-underline-offset: 4px;
  margin: 0;
  min-height: 36px;
}
.variant-tabs {
  margin: 7px 0 0;
}
.variant-cards button {
  min-width: 0;
}
.variant-tabs small {
  color: #526658;
}
.stage-control,
.variant-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: #eaf0e6;
  border-radius: 7px;
  margin-top: 8px;
}
.stage-control button,
.variant-switch button {
  flex: 1;
  min-height: 37px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #506254;
  background: transparent;
  text-align: center;
  font-size: 14px;
}
.stage-control button[aria-pressed="true"],
.variant-switch button[aria-pressed="true"] {
  color: #214a35;
  background: #fffffa;
  border-color: #c6d3c3;
  box-shadow: 0 1px 3px #23362612;
}
.dialog-content .setup-note,
.dialog-content .rule-summary {
  font-size: 13px;
  margin: 7px 0 12px;
}
.rule-section {
  border-top: 1px solid #d8e0d2;
}
.rule-section summary {
  padding: 12px 2px;
  min-height: 43px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 620;
}
.rule-section summary::marker {
  color: #667e6b;
}
.dialog-content .rule-section p {
  margin: 0 0 12px;
  line-height: 1.7;
}
.dialog-content .rule-source {
  border-top: 1px solid #d8e0d2;
  padding-top: 10px;
}
[data-kind="new"] .dialog-buttons {
  margin-top: 16px;
}
[data-kind="new"] .dialog-buttons .primary {
  min-height: 42px;
  width: 100%;
}
@media (max-width: 650px) {
  .top-inner {
    height: 46px;
  }
  .top nav {
    gap: 10px;
  }
  .top .top-new {
    min-height: 36px;
    padding: 6px 10px;
  }
  .top .nav-item {
    font-size: 12px;
  }
  .top .brand strong {
    font-size: 19px;
  }
  .wrap:not(.is-table) {
    padding-inline: 16px;
  }
  .wrap:not(.is-table) .page-heading {
    padding-top: 24px;
  }
  .record {
    gap: 9px;
  }
}

#session-tools:empty {
  display: none;
}
.game-room .top-inner {
  max-width: 1664px;
  width: 100%;
  min-height: 58px;
  height: auto;
  padding: 8px clamp(18px, 3.2vw, 64px);
  gap: clamp(12px, 2vw, 28px);
  position: relative;
}
.game-room .top-inner::after {
  content: "";
  position: absolute;
  inset: auto clamp(18px, 3.2vw, 64px) 0;
  height: 1px;
  background: linear-gradient(90deg, #c7d3af33, #c7d3af18 65%, #c7d3af33);
  pointer-events: none;
}
.game-room .top .brand-mark {
  color: #eadcae;
  background: transparent;
  width: 25px;
  box-shadow: none;
}
.game-room .top .brand strong {
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 23px;
  letter-spacing: 0.07em;
  font-weight: 700;
}
.game-room #session-tools {
  flex: 1;
  min-width: 0;
}
.game-room #session-tools .qt-round {
  font-size: 13px;
}
.game-room #session-tools .qt-round b {
  font-size: 15px;
}
.game-room #session-tools .qt-tools button,
.game-room .top .nav-item {
  min-height: 38px;
  font-size: 13px;
  color: #d5e2d4;
}
.game-room .top nav {
  flex: none;
  gap: 13px;
  padding-left: clamp(12px, 1.7vw, 25px);
  position: relative;
}
.game-room .top nav::before {
  content: "";
  position: absolute;
  left: 0;
  height: 16px;
  border-left: 1px solid #c9d3bc45;
}
.game-room .top .top-new {
  color: #f5eccf;
  background: #c3d5b50e;
  border-color: #d2d9bd58;
}
.game-room .top .top-new:hover {
  background: #c3d5b526;
}
.game-room .wrap.is-table {
  width: 100%;
  max-width: 1664px;
  flex: 1;
  padding: 0 clamp(14px, 2.2vw, 45px) max(10px, env(safe-area-inset-bottom));
}
.game-room .replay-strip {
  background: #122e24ad;
  margin: 8px auto 0;
  max-width: 640px;
}
@media (max-width: 690px) {
  .game-room .top-inner {
    display: grid;
    grid-template: "brand nav" auto "tools tools" auto / 1fr auto;
    gap: 0 12px;
    width: 100%;
    padding: 5px 12px 1px;
  }
  .game-room .top-inner::after {
    inset-inline: 12px;
  }
  .game-room .top .brand {
    grid-area: brand;
    width: fit-content;
    gap: 5px;
  }
  .game-room .top .brand strong {
    font-size: 21px;
  }
  .game-room .top nav {
    grid-area: nav;
    padding-left: 0;
    gap: 11px;
  }
  .game-room .top nav::before {
    display: none;
  }
  .game-room #session-tools {
    grid-area: tools;
  }
  .game-room #session-tools .qt-tools {
    gap: 0;
  }
  .game-room #session-tools .qt-rules,
  .game-room #session-tools .qt-tools button {
    min-height: 32px;
  }
  .game-room #session-tools .qt-tools button,
  .game-room #session-tools .qt-round {
    font-size: 12px;
  }
  .game-room .wrap.is-table {
    padding-inline: 4px;
  }
}

dialog[data-kind="records"] {
  width: min(550px, calc(100% - 24px));
}
.dialog-content .record-caption {
  font-size: 13px;
  margin: 0 0 12px;
}
.dialog-content .record-list {
  padding: 0;
  border-top: 1px solid #ced7c7;
}
.dialog-content .record h3,
.dialog-content .record p {
  margin: 0;
}
.dialog-content .record p {
  font-size: 12px;
  margin-top: 3px;
}
dialog:is(
    [data-kind="records"],
    [data-kind="seat"],
    [data-kind="rivers"],
    [data-kind="trend"]
  )::backdrop {
  background: #06191269;
  backdrop-filter: none;
}

.game-room dialog:is([data-kind="new"],[data-kind="rules"],[data-kind="new-rules"]) {
  width: min(590px, calc(100% - 24px));
}
.variant-switch button { min-width: 0; }
.replay-strip [data-regional-nav] {
  color: inherit; border: 0; background: transparent; min-height: 36px; padding: 0 6px;
}
.replay-strip [data-regional-nav]:disabled { opacity: .4; }
@media (max-width: 560px) {
  .variant-switch { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .variant-cards button { padding: 9px; }
  .variant-cards small { line-height: 1.4; }
}
.record .record-resume {
  color: #235d40; font-size: 13px; min-height: 38px; background: transparent; padding-inline: 5px;
}
.score-remaining {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: #486353;
  font-variant-numeric: tabular-nums;
}

.game-room .top .friends-link {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  text-decoration: none;
  font-weight: 600;
}
@media (max-width: 420px) {
  .game-room .top nav { gap: 7px; padding-left: 0; }
}
@media (max-width: 370px) {
  .game-room .top nav .nav-item { padding-inline: 2px; font-size: 12px; }
  .game-room .top nav .top-new { padding-inline: 5px; }
}
