/* Honver's Guide: additions on top of styles.css. The chapters use the playbook's book grid; this file
   holds the masthead, the What's new list, the scoreboard, the guide's tables and its turn cards. */

/* ------------------------------------------------------------------ masthead and What's new */

.guide-masthead {
  display: grid;
  grid-template-columns: minmax(0, 700px) minmax(0, 1fr);
  column-gap: 72px;
  align-items: start;
  padding-top: 88px;
}

.guide-masthead-text {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.guide-eyebrow {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 14px;
}

.guide-masthead h1 {
  font-size: clamp(44px, 5vw, 70px);
  letter-spacing: -0.02em;
  line-height: 0.98;
  text-wrap: balance;
}

.guide-masthead .standfirst {
  font-size: 22px;
  line-height: 1.52;
  text-wrap: pretty;
}

.guide-masthead-text > p:not(.standfirst):not(.guide-eyebrow) {
  color: var(--ink-2);
  text-wrap: pretty;
}

.guide-news {
  padding: 26px 28px 10px;
  border: 1px solid var(--hair);
  background: var(--plate);
  box-shadow: 0 18px 40px -30px rgba(30, 26, 20, 0.35);
}

.guide-news h2 {
  padding-bottom: 14px;
  font-size: 30px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.05;
}

.guide-news ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-news li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  column-gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--hair);
}

.guide-news-date {
  padding-top: 3px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
}

.guide-news li p {
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.5;
}

.guide-news li.is-latest .guide-news-date {
  color: var(--ink);
}

.guide-news li.is-latest p {
  color: var(--ink);
  font-size: 17px;
}

.guide-news .new-tag,
.guide-news-tag {
  margin-right: 6px;
  vertical-align: 2px;
}

.guide-news-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 2px;
  background: var(--highlight);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ scoreboard */

.scoreboard-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13.5px;
}

.scoreboard-key span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.scoreboard-key span::before {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--verm-mark);
  content: "";
}

.scoreboard-key .key-luckyj::before {
  background: var(--jade-mark);
}

.section > .guide-metrics {
  grid-column: 2 / 4;
}

.guide-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}

.guide-metrics .metric {
  gap: 10px;
  padding: 22px 22px 24px 0;
  border-top: 1px solid var(--hair);
}

.guide-metrics .metric:nth-child(-n + 3) {
  border-top: 0;
}

.guide-metrics .metric span {
  order: -1;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}

.guide-metrics .metric b {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 44px;
}

.guide-metrics .metric b::before {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--verm-mark);
  content: "";
}

.guide-metrics .metric small {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
}

.guide-metrics .metric small::before {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--jade-mark);
  content: "";
}

/* ------------------------------------------------------------------ chapter list */

.guide-chapters > .contents-list {
  grid-column: 2 / 4;
  margin-top: 30px;
}

.guide-chapters-note {
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
}

.guide-chapter-list .contents-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
}

/* ------------------------------------------------------------------ reading the tables */

.guide-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
}

.guide-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.guide-legend .swatch {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 2px;
  background: var(--verm-felt);
  color: var(--felt-deep);
  font-size: 12.5px;
  font-style: normal;
  font-weight: 700;
}

.guide-legend .swatch.better {
  background: var(--jade-felt);
}

.guide-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
}

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

.safety-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-style: normal;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  vertical-align: 1px;
}

.safety-chip.safe {
  background: var(--jade-soft);
  color: var(--jade);
}

.safety-chip.mostly {
  background: #e9e6d4;
  color: #4a5a26;
}

.safety-chip.live {
  background: var(--highlight);
  color: #5e4610;
}

.safety-chip.danger {
  background: var(--verm-soft);
  color: var(--verm);
}

/* ------------------------------------------------------------------ the guide's data tables */

.guide-data-scroll {
  overflow-x: auto;
}

.guide-data {
  width: 100%;
  border-collapse: collapse;
  font-size: 16.5px;
  font-variant-numeric: lining-nums tabular-nums;
}

.guide-data th,
.guide-data td {
  padding: 10px 0 10px 16px;
  border-bottom: 1px solid var(--hair);
  text-align: right;
  white-space: nowrap;
}

.guide-data th:first-child,
.guide-data td:first-child {
  padding-left: 0;
  text-align: left;
  white-space: normal;
}

.guide-data thead th {
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  vertical-align: bottom;
  white-space: normal;
}

.guide-data td.gap {
  color: var(--verm);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.guide-data small {
  color: var(--muted);
  font-size: 12.5px;
}

/* A table of words rather than figures wraps and reads left to right. */
.guide-data.is-text th,
.guide-data.is-text td {
  text-align: left;
  white-space: normal;
  vertical-align: top;
}

.guide-data.is-text td:first-child {
  width: 40%;
}

/* Chapter 19's worked river: short discard and tile columns, the counting column takes the room. */
.guide-data.is-river th:first-child,
.guide-data.is-river td:first-child {
  width: auto;
  white-space: nowrap;
}

.guide-data.is-river {
  min-width: 560px;
}

.guide-data.is-river td:nth-child(2) {
  white-space: nowrap;
}

.guide-data.is-river th:nth-child(3),
.guide-data.is-river td:nth-child(3) {
  width: 42%;
}

.guide-data.is-river td:nth-child(4),
.guide-data.is-river td:nth-child(5) {
  word-break: keep-all;
}

/* Chapter 18's three squares: the river and the counts share the room, the figures stay whole. */
.guide-data.is-moments {
  min-width: 560px;
}

.guide-data.is-moments th:first-child,
.guide-data.is-moments td:first-child {
  width: auto;
  white-space: nowrap;
}

.guide-data.is-moments td:nth-child(2) {
  width: 30%;
}

.guide-data.is-moments td:nth-child(3) {
  width: 26%;
}

.guide-data.is-moments td:nth-child(4),
.guide-data.is-moments td:nth-child(5),
.guide-data.is-moments td:nth-child(6) {
  word-break: keep-all;
}

.point .guide-list {
  display: grid;
  gap: 8px;
  padding-left: 1.2em;
}

.point .guide-list li::marker {
  color: var(--verm);
}

/* Chapter 1's chart: your rate against LuckyJ's, as two small line charts. */
.guide-chart {
  grid-column: 1 / -1;
  display: grid;
  gap: 18px;
  margin: 36px 0 0;
  padding: 24px 26px 18px;
  border: 1px solid var(--hair);
  background: var(--plate);
}

.guide-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-family: var(--sans);
  font-size: 13.5px;
}

.guide-chart-legend .key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.guide-chart-legend .key::before {
  width: 22px;
  height: 2px;
  background: var(--verm-mark);
  box-shadow: 0 0 0 0 transparent;
  content: "";
}

.guide-chart-legend .key.lj::before {
  background: var(--jade-mark);
}

.guide-chart-legend .key.hollow {
  color: var(--ink-2);
}

.guide-chart-legend .key.hollow::before {
  width: 8px;
  height: 8px;
  border: 2px solid var(--verm-mark);
  border-radius: 50%;
  background: var(--plate);
}

.guide-chart-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 40px;
}

.guide-chart-head {
  display: grid;
  gap: 2px;
}

.guide-chart-head b {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
}

.guide-chart-head span {
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13px;
}

.guide-chart-plot {
  position: relative;
  margin-top: 8px;
}

.guide-chart-plot svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.guide-chart .grid {
  stroke: var(--hair-2);
  stroke-width: 1;
}

.guide-chart .tick,
.guide-chart .cat {
  fill: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
}

.guide-chart .tick {
  text-anchor: end;
}

.guide-chart .cat {
  fill: var(--ink-2);
  text-anchor: middle;
}

.guide-chart .line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.guide-chart .line.you {
  stroke: var(--verm-mark);
}

.guide-chart .line.lj {
  stroke: var(--jade-mark);
}

.guide-chart .dot {
  stroke: var(--plate);
  stroke-width: 2;
}

.guide-chart .dot.you {
  fill: var(--verm-mark);
}

.guide-chart .dot.lj {
  fill: var(--jade-mark);
}

.guide-chart .dot.hollow {
  fill: var(--plate);
  stroke: var(--verm-mark);
}

.guide-chart .end {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
}

.guide-chart .note {
  fill: var(--muted);
  font-family: var(--sans);
  font-size: 11.5px;
}

.guide-chart .cross {
  stroke: var(--ink);
  stroke-opacity: 0;
  stroke-width: 1;
}

.guide-chart .cross.is-on {
  stroke-opacity: 0.35;
}

.guide-chart .hit {
  fill: transparent;
  cursor: crosshair;
  outline: none;
}

.guide-chart-tip {
  position: absolute;
  top: 6px;
  z-index: 3;
  display: grid;
  gap: 5px;
  min-width: 150px;
  padding: 9px 11px;
  border-radius: 3px;
  background: var(--ink);
  color: var(--plate);
  font-family: var(--sans);
  pointer-events: none;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.45);
}

.guide-chart-tip[hidden] {
  display: none;
}

.guide-chart-tip span {
  color: var(--hair);
  font-size: 12px;
}

.guide-chart-tip b {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.guide-chart-tip b::before {
  width: 12px;
  height: 2px;
  background: var(--verm-mark);
  content: "";
}

.guide-chart-tip b.lj::before {
  background: #5fc49a;
}

.guide-chart-tip small {
  color: var(--hair);
  font-size: 12.5px;
  font-weight: 400;
}

.guide-chart figcaption {
  color: var(--ink-2);
  font-size: 15.5px;
  font-style: italic;
}

.guide-chart-table {
  grid-column: 1;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}

.guide-chart-table > summary {
  display: flex;
  align-items: center;
  min-height: 48px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 600;
}

.guide-chart-table .guide-data {
  margin-bottom: 12px;
}

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

.guide-frame-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.guide-frame-tabs button {
  min-height: 40px;
  border-color: var(--felt-line);
  background: transparent;
  color: var(--cream-2);
}

.guide-frame-tabs button.active {
  border-color: var(--cream);
  background: var(--cream);
  color: var(--felt);
}

.guide-card-title {
  color: var(--cream);
  font-size: 29px;
  line-height: 1.15;
  text-wrap: balance;
}

.guide-verdict {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  height: 22px;
  padding: 0 8px;
  border-radius: 2px;
  background: var(--jade-felt);
  color: var(--felt-deep);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-card-meta {
  margin-top: -8px;
  color: var(--cream-3);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.45;
}

.guide-situation {
  color: var(--cream);
  font-size: 18px;
  line-height: 1.55;
  text-wrap: pretty;
}

.guide-situation .inline-tile {
  font-size: 1.5em;
}

.replay-panel .guide-comparison .decision.guide-you {
  border-top-color: var(--verm-felt);
}

.replay-panel .guide-comparison .decision.guide-better {
  border-top-color: var(--jade-felt);
}

.replay-panel .guide-comparison .decision.guide-you b {
  color: var(--verm-felt);
}

.replay-panel .guide-comparison .decision.guide-better b {
  color: var(--jade-felt);
}

.replay-panel .guide-comparison .decision .discard-tile {
  display: inline-block;
  margin-top: 0;
  font-size: 1.9em;
  vertical-align: middle;
}

.replay-panel .guide-comparison .decision .tiles.inline-tile {
  display: inline;
  top: 0;
  font-size: 1.45em;
  line-height: 0;
  vertical-align: -0.22em;
}

.replay-panel .guide-safety {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.replay-panel .guide-safety span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cream-3);
  font-size: 12.5px;
}

.guide-game-link a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--cream);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  text-decoration-color: rgba(244, 240, 230, 0.45);
  text-underline-offset: 4px;
}

.guide-game-link a:hover {
  color: #fff;
}

.guide-note-host:empty,
.guide-options-host:empty {
  display: none;
}

.replay-notes > .guide-note-host,
.replay-notes > .guide-result,
.replay-notes > .guide-options-host {
  grid-column: 2;
}

.guide-frame-note {
  padding: 14px 16px;
  border-left: 0;
  background: var(--plate);
}

.guide-frame-note h5 {
  color: var(--verm);
}

.replay-notes .guide-note-host .analysis-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.guide-result {
  padding-top: 14px;
  border-top: 1px solid var(--hair);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
}

.guide-result b {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.guide-options {
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}

.guide-options summary {
  display: flex;
  align-items: center;
  min-height: 52px;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
}

.guide-options-scroll {
  overflow-x: auto;
}

.guide-options table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}

.guide-options th,
.guide-options td {
  padding: 7px 14px 7px 0;
  border-bottom: 1px solid var(--hair);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.guide-options thead th {
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.guide-options tbody th {
  font-weight: 500;
}

.guide-options tr.is-you {
  background: var(--verm-soft);
}

.guide-options tr.is-better {
  background: var(--jade-soft);
}

.guide-options tbody th small {
  margin-left: 8px;
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.guide-options .inline-tile {
  font-size: 1.6em;
}

.guide-options-note {
  margin: 10px 0 16px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.5;
}

.guide-error {
  color: var(--verm);
  font-family: var(--sans);
}

/* ------------------------------------------------------------------ narrow screens */

@media (max-width: 1179px) {
  .guide-masthead {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .guide-news {
    max-width: 680px;
  }
}

@media (max-width: 1023px) {
  .guide-chapters > .contents-list,
  .replay-notes > .guide-note-host,
  .replay-notes > .guide-result,
  .replay-notes > .guide-options-host {
    grid-column: 1;
  }

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

  .guide-metrics .metric:nth-child(3) {
    border-top: 1px solid var(--hair);
  }

  .guide-chart-panels {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .guide-masthead {
    padding-top: 44px;
  }

  .guide-masthead h1 {
    font-size: 40px;
  }

  .guide-masthead .standfirst {
    font-size: 19px;
  }

  .guide-news {
    padding: 18px 16px 6px;
  }

  .guide-news li {
    grid-template-columns: 52px minmax(0, 1fr);
    column-gap: 10px;
  }

  .guide-metrics .metric b {
    font-size: 34px;
  }

  .guide-chart {
    padding: 18px 14px 14px;
  }

  .guide-card-title {
    font-size: 24px;
  }

  .guide-situation {
    font-size: 16.5px;
  }

  .guide-data {
    font-size: 14.5px;
  }

  .guide-data th,
  .guide-data td {
    padding-left: 10px;
  }
}

/* A corrected example card carries a Corrected tag under its title. */
.guide-card-corrected {
  justify-self: start;
  align-self: flex-start;
}

/* ------------------------------------------------------------------ chapter 18's caller grid */

/* A heat table: a row per calls and run from the wall, a column per caller discard, rows of six marked. */
.caller-surface {
  grid-column: 1 / -1;
  margin: 30px 0 8px;
}

.cs-grid {
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.2;
}

.cs-grid th,
.cs-grid td {
  padding: 6px 2px;
  text-align: center;
}

.cs-grid td {
  min-width: 27px;
  border-bottom: 1px solid var(--plate);
  font-weight: 600;
}

.cs-grid thead th {
  color: var(--muted);
  font-weight: 500;
}

.cs-grid .cs-group {
  border-bottom: 1px solid var(--hair);
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
}

.cs-grid .cs-corner {
  vertical-align: bottom;
  text-align: left;
}

.cs-grid .cs-row-start {
  border-left: 2px solid var(--paper);
}

.cs-grid thead .cs-row-start,
.cs-grid .cs-group + .cs-group {
  border-left: 2px solid var(--hair);
}

.cs-grid tbody th[scope="row"],
.cs-grid .cs-corner {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 118px;
  max-width: 150px;
  padding-right: 10px;
  background: var(--paper);
  color: var(--ink-2);
  font-weight: 500;
  text-align: left;
}

.cs-grid .cs-calls th {
  position: sticky;
  left: 0;
  padding: 16px 0 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  text-align: left;
}

.cs-grid .cs-empty {
  background: repeating-linear-gradient(135deg, var(--paper) 0 4px, var(--hair-2) 4px 5px);
}

.caller-surface figcaption {
  margin-top: 12px;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
}

.cs-legend {
  display: inline-flex;
  margin-right: 8px;
  vertical-align: middle;
}

.cs-legend span {
  padding: 2px 6px;
  font-size: 11.5px;
  font-weight: 600;
}

/* LuckyJ's fold line: a jade rule down each block of rows, named in the block's heading row. */
.cs-grid .cs-fold {
  border-left: 3px solid var(--jade);
}

.cs-grid .cs-calls td {
  padding: 16px 0 6px;
  border-bottom: 0;
  vertical-align: bottom;
}

.cs-grid .cs-calls .cs-fold-label {
  padding-left: 7px;
  color: var(--jade);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.cs-fold-key {
  padding-left: 6px;
  border-left: 3px solid var(--jade);
  color: var(--jade);
  font-weight: 600;
}

/* The grid's two switches: radio buttons ahead of the tables, drawn as buttons, so no script is needed. */
.caller-surface {
  position: relative;
}

.cs-switch-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.cs-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
}

/* Sentence case: capitals would print LuckyJ as LUCKYJ. */
.cs-switch-label {
  min-width: 118px;
  margin-right: 4px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
}

.cs-switch label {
  padding: 7px 12px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: var(--plate);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
}

.cs-switch label:hover {
  border-color: var(--muted);
}

#cs-view-win:checked ~ .cs-switch label[for="cs-view-win"],
#cs-view-fold:checked ~ .cs-switch label[for="cs-view-fold"],
#cs-hand-far:checked ~ .cs-switch label[for="cs-hand-far"],
#cs-hand-one:checked ~ .cs-switch label[for="cs-hand-one"] {
  border-color: var(--felt);
  background: var(--felt);
  color: var(--cream);
}

#cs-view-win:focus-visible ~ .cs-switch label[for="cs-view-win"],
#cs-view-fold:focus-visible ~ .cs-switch label[for="cs-view-fold"],
#cs-hand-far:focus-visible ~ .cs-switch label[for="cs-hand-far"],
#cs-hand-one:focus-visible ~ .cs-switch label[for="cs-hand-one"] {
  outline: 2px solid var(--jade-mark);
  outline-offset: 2px;
}

/* Show the chosen table and its caption and hide the rest; the hand switch only applies to LuckyJ's folds. */
#cs-view-win:checked ~ .cs-hands,
#cs-view-win:checked ~ * [data-view^="fold"],
#cs-view-fold:checked ~ * [data-view="win"],
#cs-hand-far:checked ~ * [data-view="fold-one"],
#cs-hand-one:checked ~ * [data-view="fold-far"] {
  display: none;
}

/* Chapter 25's surface: a canvas on a plate above the grid (honver.js drawSurface). Its buttons are the grid
   switch's, as real buttons; the canvas lets a vertical swipe scroll the page and turns on a sideways drag. */
.rp-3d {
  margin: 0 0 22px;
  padding: 14px 14px 10px;
  border: 1px solid var(--hair);
  background: var(--plate);
}

.rp-3d .cs-switch button {
  padding: 7px 12px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: var(--plate);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
}

.rp-3d .cs-switch button:hover {
  border-color: var(--muted);
}

.rp-3d .cs-switch button[aria-pressed="true"] {
  border-color: var(--felt);
  background: var(--felt);
  color: var(--cream);
}

.rp-3d .cs-switch button:focus-visible {
  outline: 2px solid var(--jade-mark);
  outline-offset: 2px;
}

.rp-3d-canvas {
  display: block;
  width: 100%;
  height: 340px;
  cursor: grab;
  touch-action: pan-y;
}

.rp-3d-canvas:active {
  cursor: grabbing;
}

.rp-3d-readout {
  min-height: 1.5em;
  margin-top: 6px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
}

.rp-3d-hint {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12.5px;
}

/* Chapter 25's grid uses the same switch for the stage of the game, one table at a time
   (scripts/build_riichi_placement_figure.py). */
#rp-stage-east:checked ~ .cs-switch label[for="rp-stage-east"],
#rp-stage-south:checked ~ .cs-switch label[for="rp-stage-south"],
#rp-stage-all-last:checked ~ .cs-switch label[for="rp-stage-all-last"] {
  border-color: var(--felt);
  background: var(--felt);
  color: var(--cream);
}

#rp-stage-east:focus-visible ~ .cs-switch label[for="rp-stage-east"],
#rp-stage-south:focus-visible ~ .cs-switch label[for="rp-stage-south"],
#rp-stage-all-last:focus-visible ~ .cs-switch label[for="rp-stage-all-last"] {
  outline: 2px solid var(--jade-mark);
  outline-offset: 2px;
}

#rp-stage-east:checked ~ * .rp-grid:not([data-stage="East"]),
#rp-stage-south:checked ~ * .rp-grid:not([data-stage="South"]),
#rp-stage-all-last:checked ~ * .rp-grid:not([data-stage="All-last"]) {
  display: none;
}

@media (max-width: 640px) {
  .cs-switch-label {
    flex-basis: 100%;
    min-width: 0;
  }
}

/* ------------------------------------------------------------------ Japanese edition */

/* Slanted and tracked Japanese reads as broken type: upright faces, open leading, light tracking. */
html:lang(ja) .guide-masthead h1 {
  font-size: clamp(34px, 4.2vw, 54px);
  letter-spacing: 0;
  line-height: 1.22;
}

html:lang(ja) :is(.guide-news h2, .guide-chart figcaption, .cs-grid .cs-group) {
  font-style: normal;
}

/* Capitals would print LuckyJ as LUCKYJ in the step headings. */
html:lang(ja) .guide-card .analysis-step h5 {
  text-transform: none;
}

html:lang(ja) :is(.guide-news-tag, .guide-data thead th, .guide-verdict, .guide-result b, .guide-options thead th, .guide-options tbody th small) {
  letter-spacing: 0.04em;
}

/* Chapter 20's three turns: the callers take the room, the square stays whole. */
.guide-data.is-turns {
  min-width: 560px;
}

.guide-data.is-turns td:first-child {
  width: 18%;
}

.guide-data.is-turns td:nth-child(2) {
  width: 36%;
}

.guide-data.is-turns td:nth-child(3) {
  white-space: nowrap;
}

.guide-data.is-turns td:nth-child(4) {
  width: 16%;
}

/* Chapter 20's chart: how often LuckyJ broke its hand, drawn in the book's safe-tile timing style
   (scripts/build_break_fold_figure.py). One shade of jade per hand, darkest for the hand furthest from
   tenpai; the riichi column on the right repeats the same hands as diamonds. */
.point .break-figure {
  margin: 28px 0 8px;
  --bf-far: var(--jade-mark);
  --bf-one: #4f9c7b;
  --bf-tenpai: #9a9388;
}

.point .break-figure .timing-plate {
  max-width: none;
}

.break-figure .bf-far { --bf: var(--bf-far); --bf-tip: #5fc49a; }
.break-figure .bf-one { --bf: var(--bf-one); --bf-tip: #a9dcc4; }
.break-figure .bf-tenpai { --bf: var(--bf-tenpai); --bf-tip: #c9c2b6; }

.break-figure .bf-fit {
  fill: none;
  stroke: var(--bf);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.break-figure .bf-band {
  fill: var(--bf);
  fill-opacity: 0.13;
}

.break-figure .bf-dot {
  fill: var(--bf);
  fill-opacity: 0.45;
}

.break-figure .bf-riichi {
  fill: var(--bf);
  stroke: var(--plate);
  stroke-width: 1.5;
}

.break-figure .bf-end {
  fill: var(--bf);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
}

.break-figure .bf-divider {
  stroke: var(--hair);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.break-figure .timing-key:is(.bf-far, .bf-one, .bf-tenpai)::before {
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--bf);
}

.break-figure .timing-key.bf-riichi-key::before {
  width: 8px;
  height: 8px;
  margin: 0 3px;
  background: var(--ink-2);
  transform: rotate(45deg);
}

.break-figure .timing-tip b:is(.bf-far, .bf-one, .bf-tenpai)::before {
  background: var(--bf-tip);
}

/* Chapter 24's chart: how often LuckyJ declares a two-sided tenpai of 3 han pinfu, 4 han or 5+ han, by its turn
   (scripts/build_dama_value_figure.py). One shade of jade per value, darkest for the mangan; the
   chapter reads where each curve crosses the half line, which the book's charts already draw firmer. */
.point .dama-figure {
  margin: 28px 0 8px;
  --dv-3: #9a9388;
  --dv-4: #4f9c7b;
  --dv-5: var(--jade-mark);
}

.point .dama-figure .timing-plate {
  max-width: none;
}

.dama-figure .dv-3 { --dv: var(--dv-3); --dv-tip: #c9c2b6; }
.dama-figure .dv-4 { --dv: var(--dv-4); --dv-tip: #a9dcc4; }
.dama-figure .dv-5 { --dv: var(--dv-5); --dv-tip: #5fc49a; }

.dama-figure .dv-fit {
  fill: none;
  stroke: var(--dv);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dama-figure .dv-band {
  fill: var(--dv);
  fill-opacity: 0.12;
}

.dama-figure .dv-dot {
  fill: var(--dv);
  fill-opacity: 0.45;
}

.dama-figure .timing-key:is(.dv-3, .dv-4, .dv-5)::before {
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--dv);
}

.dama-figure .timing-tip b:is(.dv-3, .dv-4, .dv-5)::before {
  background: var(--dv-tip);
}

/* Chapter 22's figure: the book's dumbbells (styles.css, "Against the humans"), one panel per split of your
   costly turns against a riichi, you in vermilion and LuckyJ in jade (scripts/build_fold_motives_figure.py).
   The thin mark on each track is zero, where a player folds exactly as often as Mortal on the same turns. */
.point .motive-figure {
  margin: 28px 0 8px;
}

.motive-figure .motive-title {
  margin: 0 0 12px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
}

.point .motive-figure .contrast-panels {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: none;
}

.motive-figure .contrast-panel {
  --tc-you: var(--verm-mark);
}

.motive-figure .dumbbell {
  grid-template-columns: 52px minmax(0, 1fr) 70px;
}

.motive-figure .dumbbell.is-you :is(.dumbbell-who, .dumbbell-change) {
  color: var(--verm);
  font-weight: 650;
}

.motive-figure .dumbbell-bar.is-you { background: var(--tc-you); }
.motive-figure .dumbbell-dot.is-you { border-color: var(--tc-you); }
.motive-figure .dumbbell-dot.is-you.is-end { background: var(--tc-you); }

.motive-figure .dumbbell-zero {
  position: absolute;
  top: 6px;
  width: 1px;
  height: 18px;
  background: var(--ink-2);
  opacity: 0.55;
}

.motive-figure .motive-read .contrast-panel-sub {
  margin-bottom: 0 !important;
}

@media (max-width: 640px) {
  .point .motive-figure .contrast-panels {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Chapter 28's chart: LuckyJ's live cuts against the dealer's one call (jade) and anyone else's (gray), two hands
   side by side (scripts/build_dealer_caller_figure.py), and the dealer's river walked square by square. */
.point .dealer-figure {
  margin: 28px 0 8px;
}

.point .dealer-figure .timing-plate {
  max-width: none;
}

.point .dealer-figure .timing-panels {
  grid-template-columns: minmax(0, 480px);
}

.guide-data.is-river.is-dealer-river th:nth-child(3),
.guide-data.is-river.is-dealer-river td:nth-child(3) {
  width: auto;
}

.guide-data.is-dealer-river td:nth-child(6) {
  min-width: 9em;
}

/* Two marked tiles side by side in your hand (your cut next to the better tile): their labels are wider than a
   tile, so the second one drops a line and the hand makes room for it. */
.mahjong-table .tile-threat-cell[data-mark] + .tile-threat-cell[data-mark]::after {
  top: calc(100% + 1.55em);
}

.mahjong-table .player-hand.player-current:has(.tile-threat-cell[data-mark] + .tile-threat-cell[data-mark]) {
  padding-bottom: 2.6em;
}

.mahjong-table .player-hand.player-current:has(.tile-threat-cell[data-mark] + .tile-threat-cell[data-mark]):has(.table-melds) {
  padding-bottom: 0;
}

.mahjong-table .player-hand.player-current:has(.tile-threat-cell[data-mark] + .tile-threat-cell[data-mark]) .table-melds {
  margin-top: 2.6em;
}
