:root {
  --ink: #20211f;
  --muted: #686b63;
  --line: #d8ddd1;
  --paper: #fbfcf8;
  --panel: #ffffff;
  --green: #176b54;
  --red: #b9413a;
  --gold: #b1842f;
  --blue: #2c6479;
  --soft-green: #e6f0ea;
  --soft-red: #f6e7e4;
  --soft-gold: #f7efd9;
  --shadow: 0 18px 45px rgba(39, 45, 35, 0.12);
  --tile-size: 2.6em;
}

@font-face {
  font-family: "mahjongtile-clr";
  src: url("fonts/GL-MahjongTile-Clr.woff2") format("woff2");
}

@font-face {
  font-family: "mahjongtile-colr";
  src: url("fonts/GL-MahjongTile-COLRv1.woff2") format("woff2");
}

@font-face {
  font-family: "mahjongtile";
  src: url("fonts/GL-MahjongTile.otf") format("opentype");
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

section[id],
.point[id],
.chapter-card[id],
.point-example-card[id] {
  scroll-margin-top: 220px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

html:lang(ja) body {
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", Meiryo, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.75;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 248, 0.94);
  backdrop-filter: blur(12px);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.topbar > div {
  flex: 0 0 auto;
  min-width: 0;
}

@media (hover: none), (pointer: coarse), (max-width: 900px) {
  .topbar.can-touch-retract {
    will-change: transform;
  }

  .topbar.can-touch-retract.is-retracted {
    box-shadow: none;
    transform: translateY(calc(-100% + 8px));
  }

  .topbar.can-touch-retract:focus-within {
    box-shadow: var(--shadow);
    transform: translateY(0);
  }
}

@media (hover: hover) and (min-width: 901px) {
  .topbar {
    transform: translateY(calc(-100% + 10px));
  }

  .topbar:hover,
  .topbar:focus-within {
    box-shadow: var(--shadow);
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar {
    transition: none;
  }
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(18px, 1.8vw, 28px);
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.eyebrow,
.kicker,
.side-title {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toplinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: flex-end;
  max-width: 100%;
  width: auto;
}

.toplinks a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  background: #fff;
}

.toplinks .lang-link {
  border-color: var(--green);
  color: var(--green);
  font-weight: 800;
}

.toplinks .lang-link[aria-current="page"] {
  background: var(--green);
  color: #fff;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.button-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green);
  display: inline-flex;
  font-weight: 800;
  min-height: 42px;
  align-items: center;
  padding: 9px 14px;
  text-decoration: none;
}

.button-link.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.commit-stamp {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(380px, calc(100vw - 28px));
  min-height: 30px;
  padding: 6px 10px;
  overflow: hidden;
  border: 1px solid rgba(23, 107, 84, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 26px rgba(39, 45, 35, 0.16);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  text-decoration: none;
  text-overflow: ellipsis;
  transition: max-width 160ms ease, width 160ms ease, padding 160ms ease, color 120ms ease,
    background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

.commit-stamp::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
}

.commit-stamp.is-fallback::before {
  background: var(--gold);
}

.commit-stamp:hover,
.commit-stamp:focus-visible {
  color: var(--green);
  outline: none;
  border-color: rgba(23, 107, 84, 0.42);
}

@media (hover: hover) and (pointer: fine) {
  .commit-stamp {
    width: 30px;
    max-width: 30px;
    padding-right: 11px;
    padding-left: 11px;
    color: transparent;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 8px 18px rgba(39, 45, 35, 0.1);
  }

  .commit-stamp:hover,
  .commit-stamp:focus-visible,
  .commit-stamp:active {
    width: auto;
    max-width: min(380px, calc(100vw - 28px));
    padding-right: 10px;
    padding-left: 10px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 26px rgba(39, 45, 35, 0.16);
    color: var(--green);
  }
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 1460px;
  margin: 0 auto;
  padding: 32px;
}

.side {
  display: none;
}

.side-inner {
  position: sticky;
  top: 104px;
  border-right: 1px solid var(--line);
  padding-right: 20px;
}

.side ol {
  margin: 16px 0 0;
  padding-left: 24px;
}

.side li {
  margin: 8px 0;
  color: var(--muted);
}

.side a {
  text-decoration: none;
}

.side a:hover {
  color: var(--green);
}

.point-rail {
  display: none;
}

.point-rail-panel {
  display: none;
}

.book {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.intro,
.section,
.point {
  margin-bottom: 28px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 24px;
  align-items: start;
  padding: 30px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.intro-text,
.intro-panel {
  min-width: 0;
}

.intro h2,
.section h2 {
  margin: 8px 0 14px;
  font-size: clamp(28px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}

.section {
  padding: 28px 0 8px;
}

.section p,
.point p {
  color: #30332f;
  font-size: 17px;
}

.teacher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.teacher-grid article {
  min-width: 0;
}

.teacher-grid span {
  display: block;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.teacher-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.intro-panel {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.panel-kicker {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-panel h3 {
  margin: 8px 0 16px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.08;
  letter-spacing: 0;
}

.lesson-steps {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lesson-steps li {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.lesson-steps b {
  color: var(--red);
  font-size: 13px;
  line-height: 1.2;
}

.lesson-steps span {
  color: #30332f;
  font-size: 15px;
  line-height: 1.5;
}

.chapter-grid,
.model-point-grid,
.validation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.engine-consensus {
  border: 1px solid var(--line);
  background: var(--panel);
  margin: 20px 0;
  padding: 18px;
}

/* Prescriptions: reader-facing play rules */
.rx-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.rx-card {
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.rx-example {
  background: var(--soft-green);
  border: 1px solid var(--line);
  margin: 0 0 12px;
  padding: 10px 12px;
}

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

.rx-example p + p {
  margin-top: 5px;
}

.rx-example b {
  color: var(--ink);
  font-weight: 800;
}

.rx-example .tiles {
  filter: drop-shadow(0 3px 5px rgba(40, 45, 38, 0.12));
}

.rx-example .inline-tile {
  font-size: 1.5em;
  letter-spacing: 0;
  padding-right: 0;
  top: 0.11em;
}

.rx-example .rx-summary-tiles {
  font-size: 1.4em;
}

.rx-summary-draw {
  display: inline-block;
  margin-left: 8px;
}

.rx-animation {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdfa 0%, #f7efd9 100%);
  margin: 0 0 14px;
  padding: 10px 12px 12px;
}

.rx-anim-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.rx-anim-head b {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.15;
}

.rx-anim-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-align: right;
  text-transform: uppercase;
}

.rx-stage {
  min-height: 82px;
  overflow: hidden;
  position: relative;
}

.rx-turn {
  align-content: center;
  display: grid;
  gap: 5px;
  inset: 0;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.rx-turn.is-active {
  opacity: 1;
  pointer-events: auto;
}

.rx-lines .rx-stage {
  display: grid;
  gap: 6px;
  min-height: 0;
  overflow: visible;
  position: static;
}

.rx-lines .rx-turn {
  inset: auto;
  opacity: 1;
  pointer-events: auto;
  position: static;
}

.rx-turn-main {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.rx-lines .rx-turn-label {
  flex-basis: 42px;
  font-size: 9px;
}

.rx-turn-label {
  align-items: center;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  flex: 0 0 32px;
  font-size: 11px;
  font-weight: 850;
  height: 24px;
  justify-content: center;
  line-height: 1;
}

.rx-hand-line {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  min-inline-size: 0;
  overflow: hidden;
}

.rx-tile {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  justify-content: center;
  position: relative;
}

.rx-tile .inline-tile {
  filter: drop-shadow(0 2px 4px rgba(40, 45, 38, 0.14));
  font-size: 1.48em;
  padding-right: 0;
  top: 0.05em;
}

.rx-draw {
  margin-left: 10px;
  padding-left: 0;
}

.rx-draw::before {
  content: "";
  display: none;
}

.rx-discard .inline-tile {
  background: rgba(185, 65, 58, 0.1);
  outline: 2px solid rgba(185, 65, 58, 0.46);
  outline-offset: -2px;
}

.rx-hold .inline-tile {
  background: rgba(23, 107, 84, 0.11);
  outline: 2px solid rgba(23, 107, 84, 0.32);
  outline-offset: -2px;
}

.rx-sequence-list {
  display: grid;
  gap: 12px;
}

.rx-sequence + .rx-sequence {
  border-top: 1px solid rgba(23, 107, 84, 0.18);
  padding-top: 12px;
}

.rx-sequence-head {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 7px;
}

.rx-sequence-head b {
  color: var(--ink);
  font-size: 12px;
}

.rx-sequence-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-align: right;
  text-transform: uppercase;
}

.rx-focus-tile {
  align-items: center;
  display: inline-flex;
  gap: 3px;
}

.rx-focus-tile .inline-tile {
  font-size: 1.35em;
  padding-right: 0;
  top: 0.04em;
}

.rx-turn-context {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.2;
  padding-left: 40px;
}

.rx-honor-counts {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 0;
}

.rx-honor-counts > span {
  color: #60645e;
  margin-right: 2px;
  text-transform: uppercase;
}

.rx-honor-count {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 107, 84, 0.18);
  display: inline-flex;
  gap: 2px;
  height: 24px;
  padding: 1px 5px 1px 3px;
}

.rx-honor-count .inline-tile {
  font-size: 1.55em;
  padding-right: 0;
  top: 0.03em;
}

.rx-honor-count b {
  color: var(--green);
  font-size: 11px;
}

.rx-honor-count em,
.rx-table-context {
  color: #686c66;
  font-style: normal;
}

.rx-sequence-note {
  color: #53574f;
  font-size: 11px;
  line-height: 1.3;
  margin: 6px 0 0;
}

.rx-scrubber {
  display: grid;
  gap: 5px;
  margin-top: 9px;
}

.rx-scrub-range {
  --rx-progress: 0%;
  accent-color: var(--green);
  appearance: none;
  background:
    linear-gradient(90deg, var(--green) 0 var(--rx-progress), rgba(23, 107, 84, 0.18) var(--rx-progress) 100%);
  border-radius: 999px;
  cursor: pointer;
  height: 8px;
  inline-size: 100%;
  margin: 0;
}

.rx-scrub-range::-webkit-slider-thumb {
  appearance: none;
  background: #fff;
  border: 2px solid var(--green);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(40, 45, 38, 0.24);
  height: 18px;
  width: 18px;
}

.rx-scrub-range::-moz-range-thumb {
  background: #fff;
  border: 2px solid var(--green);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(40, 45, 38, 0.24);
  height: 14px;
  width: 14px;
}

.rx-scrub-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 10px;
  font-weight: 800;
  justify-content: space-between;
  line-height: 1;
  text-transform: uppercase;
}

.rx-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.rx-card .rx-rule {
  font-weight: 700;
  margin: 0 0 10px;
}

.rx-card table {
  border-collapse: collapse;
  font-size: 13px;
  margin: 10px 0 6px;
  width: 100%;
}

.rx-card th,
.rx-card td {
  border: 1px solid var(--line);
  padding: 5px 8px;
  text-align: left;
}

.rx-card th {
  background: var(--soft-green);
  font-weight: 700;
}

.rx-card .rx-except {
  border-left: 4px solid var(--gold);
  font-size: 13px;
  margin: 10px 0 0;
  padding: 6px 10px;
}

.rx-card .rx-mods {
  font-size: 13px;
  margin: 10px 0 0;
}

.rx-card .rx-mods p {
  border-left: 4px solid var(--line);
  margin: 4px 0;
  padding: 2px 0 2px 10px;
}

.rx-card .rx-mods .rx-up {
  border-left-color: var(--green);
}

.rx-card .rx-mods .rx-down {
  border-left-color: var(--red);
}

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

  .rx-anim-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .rx-anim-head span {
    text-align: left;
  }

  .rx-turn {
    gap: 5px;
  }

  .rx-stage {
    min-height: 96px;
  }

  .rx-turn-label {
    flex-basis: 28px;
    height: 22px;
  }

  .rx-lines .rx-turn-label {
    flex-basis: 36px;
    font-size: 8px;
  }

  .rx-tile .inline-tile {
    font-size: 1.2em;
  }

  .rx-draw {
    margin-left: 6px;
    padding-left: 0;
  }

  .rx-turn-context {
    font-size: 9px;
    padding-left: 33px;
  }

  .rx-sequence-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .rx-sequence-head span {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rx-stage {
    min-height: 0;
  }

  .rx-turn,
  .rx-animation-long .rx-turn {
    animation: none;
    margin-top: 4px;
  }

  .rx-turn.is-active,
  .rx-lines .rx-turn {
    opacity: 1;
  }

  .rx-draw .inline-tile,
  .rx-discard .inline-tile {
    animation: none;
  }
}

.engine-consensus h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.consensus-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 24px;
  margin-top: 12px;
}

.consensus-row {
  display: grid;
  grid-template-columns: 28px 1fr 44px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.consensus-row a {
  font-weight: 800;
  color: var(--green);
  text-decoration: none;
}

.consensus-row em {
  font-style: normal;
  color: var(--ink-soft, #55604f);
  text-align: right;
}

.consensus-bar {
  height: 8px;
  background: var(--soft-green, #eef4ea);
  border: 1px solid var(--line);
  overflow: hidden;
}

.consensus-bar span {
  display: block;
  height: 100%;
  background: var(--green);
}

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

.chapter-card,
.model-point-grid article,
.validation-card {
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  display: block;
  min-height: 178px;
  padding: 18px;
  text-decoration: none;
}

.chapter-card span,
.model-point-grid article span,
.validation-head b {
  color: var(--red);
  display: block;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.chapter-card h3,
.model-point-grid article h3,
.validation-card h3 {
  font-size: 22px;
  line-height: 1.14;
  margin: 0 0 8px;
}

.chapter-card p,
.model-point-grid article p,
.validation-card p {
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}

.chapter-card small {
  color: var(--blue);
  display: block;
  font-weight: 750;
  margin-top: 12px;
}

.model-point-grid article a {
  color: var(--green);
  display: inline-block;
  font-weight: 850;
  margin-top: 12px;
}

.validation-head {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.validation-head span {
  align-items: center;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  height: 32px;
  justify-content: center;
  min-width: 32px;
}

.validation-head em {
  border: 1px solid var(--line);
  color: var(--blue);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  margin-left: auto;
  padding: 5px 8px;
  text-transform: uppercase;
}

.validation-card.proxy_supported .validation-head em {
  color: var(--green);
}

.validation-card.contested .validation-head em {
  color: var(--red);
}

.validation-card.review_only .validation-head em {
  color: var(--blue);
}

.validation-method-warning {
  border-left: 4px solid var(--yellow);
  color: var(--muted);
  margin: 12px 0 0;
  padding-left: 12px;
}

.validation-card ul {
  color: #3f433d;
  font-size: 14px;
  line-height: 1.45;
  margin: 12px 0;
  padding-left: 18px;
}

.validation-card li + li {
  margin-top: 6px;
}

.validation-example {
  border-left: 4px solid var(--yellow);
  color: #292c28;
  display: grid;
  gap: 4px;
  margin: 14px 0;
  padding-left: 12px;
}

.validation-example strong {
  color: var(--red);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.validation-example span {
  color: #30332f;
  font-size: 14px;
}

.validation-example.review-derived {
  border-left-color: var(--green);
}

.validation-caveat {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.audit-details {
  background: #fff;
  border: 1px solid var(--line);
  margin: 18px 0;
  padding: 16px 18px;
}

.audit-details summary {
  color: var(--green);
  cursor: pointer;
  font-weight: 900;
}

.audit-details > p {
  color: var(--muted);
  font-size: 15px;
  margin-top: 12px;
}

.concept-divider {
  border-top: 1px solid var(--line);
  margin-top: 38px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 106px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 16px;
}

.metric b {
  display: block;
  color: var(--green);
  font-size: 30px;
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.tile-row {
  grid-column: 1 / -1;
  padding-top: 12px;
  overflow: hidden;
}

.tiles {
  font-family: "mahjongtile-clr", "mahjongtile";
  font-size: var(--tile-size);
  letter-spacing: -0.112em;
  line-height: 1;
  position: relative;
  white-space: nowrap;
}

.tiles.otf {
  font-family: "mahjongtile";
  letter-spacing: -0.086em;
}

.tiles.colr {
  font-family: "mahjongtile-colr";
}

.tile-row .tiles {
  display: inline-block;
  filter: drop-shadow(0 4px 8px rgba(40, 45, 38, 0.13));
}

.point {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 22px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.point-number {
  color: var(--red);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.point h3 {
  margin: 0 0 12px;
  font-size: clamp(25px, 3vw, 40px);
  line-height: 1.08;
  letter-spacing: 0;
}

.rule,
.checklist,
.diagram,
.two-col,
.method-grid,
.stat-strip,
.evidence-grid,
.chart,
.case-browser,
.point-example-card,
.case-card,
.drill-list > div {
  border: 1px solid var(--line);
  background: var(--panel);
  margin: 18px 0;
  padding: 18px;
}

.rule {
  border-left: 5px solid var(--green);
  background: var(--soft-green);
}

.exception {
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold, #c9a227);
  background: var(--panel);
  margin: 18px 0;
  padding: 14px 18px;
}

.compact {
  padding-left: 22px;
}

.compact li,
.checklist li {
  margin: 7px 0;
}

.diagram {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.diagram div {
  min-height: 112px;
  padding: 14px;
  background: #f7faf4;
  border: 1px solid var(--line);
}

.diagram b,
.diagram span {
  display: block;
}

.diagram span {
  margin-top: 7px;
  color: var(--blue);
  font-weight: 700;
}

.checklist h4,
.two-col h4,
.drill-list h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.two-col,
.method-grid,
.insight-grid,
.stat-strip,
.evidence-grid,
.drill-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.two-col div,
.method-grid div,
.insight-grid div,
.stat-strip div {
  padding: 14px;
  background: #f8faf5;
  border: 1px solid var(--line);
}

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

.evidence-card {
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
  min-height: 128px;
  padding: 14px;
}

.evidence-card b {
  color: var(--blue);
  font-size: 14px;
  line-height: 1.2;
}

.evidence-card strong {
  color: var(--green);
  font-size: 30px;
  line-height: 1;
}

.evidence-card span,
.evidence-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.insight-grid {
  margin: 18px 0;
}

.insight-grid h3 {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 20px;
  line-height: 1.15;
}

.insight-grid p {
  margin: 0;
}

.method-grid b {
  display: block;
  color: var(--red);
  font-size: 20px;
}

.method-grid p {
  margin: 7px 0 0;
}

.stat-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.safety-timing {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.safety-timing-card {
  border: 1px solid var(--line);
  background: #f8faf5;
  padding: 14px;
}

.safety-timing-card b,
.safety-timing-card strong,
.safety-timing-card span,
.safety-timing-card small {
  display: block;
}

.safety-timing-card b {
  color: var(--blue);
  font-size: 18px;
}

.safety-timing-card strong {
  color: var(--green);
  font-size: 30px;
  line-height: 1;
  margin-top: 6px;
}

.safety-timing-card span {
  color: #30332f;
  font-size: 13px;
  margin-top: 8px;
}

.safety-timing-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 8px;
}

.stat-strip b {
  display: block;
  color: var(--red);
  font-size: 30px;
  line-height: 1;
}

.stat-strip span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 12px;
}

.bar-track {
  height: 12px;
  background: #e6ebe0;
  border: 1px solid #d3dacb;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.drill-list {
  margin-top: 18px;
}

.drill-list > div {
  margin: 0;
}

.case-browser {
  padding: 0;
  overflow: hidden;
}

.case-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #f5f8f0;
}

.case-tabs button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  padding: 8px 12px;
}

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

.case-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
}

.case-card {
  margin: 0;
  padding: 16px;
}

.case-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.case-head h3 {
  margin: 4px 0 0;
  font-size: 23px;
  line-height: 1.12;
}

.case-head > span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.evidence-tier {
  border: 1px solid var(--line);
  color: var(--blue);
  display: block;
  font-size: 10px;
  font-weight: 800;
  margin-top: 7px;
  padding: 3px 6px;
  text-transform: uppercase;
}

.evidence-tier.stress_test {
  color: var(--red);
}

.evidence-tier.contested,
.evidence-tier.unsupported,
.example-evidence-note.contested,
.example-evidence-note.unsupported {
  color: var(--red);
}

.example-evidence-note {
  border-left: 3px solid var(--yellow);
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
  padding-left: 10px;
}

.case-meta,
.case-lesson,
.case-links {
  font-size: 14px;
}

.case-meta {
  color: var(--muted);
  margin: 12px 0 8px;
}

.point-example-card {
  margin: 20px 0 0;
  padding: 16px;
  background: #fffefb;
}

.point-example-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(430px, 0.95fr) minmax(360px, 1.05fr);
  margin-top: 16px;
}

.point-example-replay,
.point-example-explanation {
  min-width: 0;
}

.point-example-replay {
  position: sticky;
  top: 24px;
}

.point-example-explanation .natsu-analysis {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.point-example-explanation .analysis-step {
  padding: 9px 0;
}

.point-example-explanation .analysis-step p {
  font-size: 14px;
  line-height: 1.58;
}

.point-example-tabs {
  margin-top: 18px;
}

.example-tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.example-tab-list button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  justify-content: center;
  min-height: 38px;
  min-width: 66px;
  padding: 6px 8px;
}

.example-tab-list button b,
.example-tab-list button span {
  display: block;
  line-height: 1.1;
}

.example-tab-list button b {
  color: var(--ink);
  font-size: 15px;
}

.example-tab-list button span {
  font-size: 11px;
  font-weight: 750;
}

.example-tab-list button.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.example-tab-list button.active b {
  color: #fff;
}

.example-tab-list button:focus-visible {
  outline: 3px solid rgba(44, 100, 121, 0.28);
  outline-offset: 2px;
}

.example-tab-body {
  min-height: 420px;
}

.example-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.example-head h4 {
  margin: 4px 0 0;
  font-size: 22px;
  line-height: 1.16;
}

.example-head > span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.tile-list {
  margin: 8px 0 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.hand-tiles {
  display: inline-block;
  font-size: 2.35em;
}

.inline-tile {
  display: inline-block;
  font-size: 1.85em;
  top: 0.12em;
  padding-right: 0.08em;
}

.discard-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.discard-tile {
  font-size: 2.15em;
}

.discard-line em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.call-action-line em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.decision {
  border: 1px solid var(--line);
  background: #f8faf5;
  padding: 12px;
}

.comparison .decision-wide {
  grid-column: 1 / -1;
}

.decision b,
.decision span,
.decision small {
  display: block;
}

.decision b {
  color: var(--green);
  font-size: 18px;
}

.decision .choice-weight {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  display: inline-block;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.1;
  margin: 7px 0 4px;
  padding: 4px 6px;
  text-transform: uppercase;
}

.decision span {
  color: #30332f;
  font-size: 13px;
  margin-top: 3px;
}

.decision .discard-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.decision .call-action-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 7px;
  line-height: 1.25;
}

.decision .discard-tile {
  display: inline-block;
  font-size: 2.15em;
  line-height: 1;
  margin-top: 0;
}

.decision small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 8px;
}

.decision .model-badges {
  justify-content: flex-start;
  margin-top: 9px;
}

.decision .model-badge {
  display: inline-block;
}

.case-lesson {
  background: var(--soft-gold);
  border-left: 5px solid var(--gold);
  margin: 12px 0 0;
  padding: 12px;
}

.case-lesson p {
  font-size: 14px;
  margin: 0 0 10px;
}

.case-lesson p:last-child {
  margin-bottom: 0;
}

.safety-read {
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  background: #eef5f7;
  margin: 12px 0;
  padding: 12px;
}

.safety-read p {
  font-size: 14px;
  margin: 0 0 8px;
}

.safety-read ul {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.safety-read li {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: #30332f;
  font-size: 13px;
}

.safety-read li b {
  color: var(--green);
}

.diagnostics {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
}

.diagnostics summary {
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.natsu-analysis {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 6px;
}

.mortal-block {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 8px;
}

.mortal-block summary {
  cursor: pointer;
  list-style: none;
}

.mortal-block summary::-webkit-details-marker {
  display: none;
}

.mortal-summary {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mortal-summary::after {
  color: var(--blue);
  content: "show";
  font-size: 12px;
  font-weight: 850;
  margin-left: auto;
  text-transform: uppercase;
}

.mortal-block[open] .mortal-summary::after {
  content: "hide";
}

html:lang(ja) .mortal-summary::after {
  content: "表示";
}

html:lang(ja) .mortal-block[open] .mortal-summary::after {
  content: "閉じる";
}

.mortal-summary .kicker {
  flex: 0 0 auto;
}

.mortal-summary-line {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  flex: 1 1 360px;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 7px;
  line-height: 1.35;
}

.mortal-summary-line b {
  color: var(--ink);
}

.mortal-summary .choice-weight,
.mortal-summary .model-badge {
  font-size: 10px;
  line-height: 1;
  padding: 4px 6px;
}

.mortal-summary .discard-line {
  display: inline-flex;
  gap: 4px;
}

.mortal-summary .discard-tile {
  font-size: 1.45em;
}

.mortal-read em,
.mortal-branch em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.model-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: end;
}

.model-badge {
  border: 1px solid var(--line);
  color: var(--muted);
  display: inline-block;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.1;
  padding: 6px 8px;
  text-transform: uppercase;
}

.model-badge.agree {
  border-color: #9bc6b5;
  background: var(--soft-green);
  color: var(--green);
}

.model-badge.split {
  border-color: #ddaaa4;
  background: var(--soft-red);
  color: var(--red);
}

.mortal-details {
  background: #f6fafb;
  border: 1px solid var(--line);
  margin-top: 8px;
  padding: 12px;
}

.mortal-read h5,
.mortal-branch h5 {
  color: var(--blue);
  font-size: 14px;
  line-height: 1.2;
  margin: 0 0 8px;
}

.mortal-read p,
.mortal-branch p {
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 8px;
}

.mortal-read p:last-child,
.mortal-branch p:last-child {
  margin-bottom: 0;
}

.mortal-branch {
  margin-top: 12px;
}

.analysis-step {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.analysis-step h5 {
  color: var(--red);
  font-size: 15px;
  line-height: 1.2;
  margin: 0 0 5px;
}

.analysis-step p {
  font-size: 16px;
  line-height: 1.85;
  margin: 0;
}

.example-drill {
  border-left: 5px solid var(--blue);
  background: #e8f0f2;
  margin: 12px 0;
  padding: 12px;
}

.example-drill p {
  margin: 4px 0;
  font-size: 14px;
}

.call-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.call-line > span {
  border: 1px solid var(--line);
  background: #f8faf5;
  align-items: center;
  display: inline-flex;
  gap: 0.35em;
  font-size: 13px;
  overflow-x: auto;
  padding: 10px;
  white-space: nowrap;
}

.yaku-condition-read {
  border-left: 5px solid var(--red);
  background: var(--soft-red);
  margin: 12px 0;
  padding: 12px;
}

.yaku-condition-read h5 {
  color: var(--red);
  font-size: 15px;
  line-height: 1.2;
  margin: 0 0 6px;
}

.yaku-condition-read p {
  font-size: 14px;
  margin: 0 0 10px;
}

.yaku-condition-threats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.yaku-condition-threats > span {
  border: 1px solid #e2b8b3;
  background: #fff;
  display: block;
  font-size: 13px;
  padding: 10px;
}

.yaku-condition-threats b,
.yaku-condition-threats em {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 8px;
}

.yaku-condition-threats em {
  color: var(--muted);
  font-style: normal;
  font-weight: 750;
}

.mini-tile {
  display: inline-block;
  font-size: 1.58em;
  line-height: 1;
}

.mini-hand,
.river {
  overflow-x: auto;
  padding: 2px 0 4px;
  white-space: nowrap;
}

.empty {
  color: var(--muted);
  font-size: 12px;
}

.table-context {
  border: 1px solid var(--line);
  background: #f9fbf6;
  margin-top: 14px;
}

.table-summary,
.score-strip {
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 12px;
}

.table-summary span,
.score-strip span {
  color: #30332f;
  font-size: 13px;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.player-card {
  border-right: 1px solid var(--line);
  padding: 10px;
  min-width: 0;
}

.player-card:last-child {
  border-right: 0;
}

.player-card h5 {
  align-items: center;
  display: flex;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 14px;
}

.player-card h5 span {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  text-transform: uppercase;
}

.self-player {
  background: #eef6f1;
}

.row-label {
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin: 7px 0 2px !important;
  text-transform: uppercase;
}

.meld {
  border: 1px solid #d3dacb;
  display: inline-block;
  margin-right: 5px;
  padding: 1px 4px 2px;
}

.hidden-hands {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
}

.hidden-hands summary {
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

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

.hidden-hand-grid > div {
  border: 1px solid var(--line);
  background: #fff;
  min-width: 0;
  padding: 8px;
}

.lucky-table-wrap {
  display: flex;
  justify-content: center;
  margin: 14px 0 12px;
  overflow-x: auto;
}

.caption-container {
  align-items: center;
  display: flex;
  flex-direction: column;
  min-width: min-content;
}

.caption-content {
  border: 1px solid var(--line);
  background: #f8faf5;
  padding: 10px;
}

.caption-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 8px;
  max-width: 560px;
  text-align: center;
}

.mahjong-table {
  --display-base: clamp(0.54rem, 1.05vw, 0.9rem);
  --table-dark: #252a24;
  --table-light: #fff;
  display: grid;
  grid-template-areas:
    ".            hand-across     hand-across      hand-across   ."
    "hand-prev    discards-across discards-across  discards-next  hand-next"
    "hand-prev    discards-prev   center           discards-next  hand-next"
    "hand-prev    discards-prev   discards-current discards-current hand-next"
    "hand-current hand-current    hand-current     hand-current   hand-current";
  grid-template-columns: 1fr 3fr 3fr 3fr 1fr;
  grid-template-rows: 1fr 3fr 3fr 3fr 1.35fr;
  height: calc(36.75 * var(--display-base));
  margin: 0 auto;
  max-height: 34em;
  max-width: 34em;
  width: calc(36 * var(--display-base));
}

.mahjong-table .center {
  border: 1px solid var(--table-dark);
  display: grid;
  font-size: calc(1 * var(--display-base));
  grid-area: center;
  grid-template-areas:
    ". score-across ."
    "score-prev situation-box score-next"
    ". score-current .";
  grid-template-columns: 2fr 5fr 2fr;
  grid-template-rows: 2fr 5fr 2fr;
  height: calc(9 * var(--display-base));
  width: calc(9 * var(--display-base));
}

.mahjong-table .situation-container {
  background: var(--table-dark);
  color: var(--table-light);
  display: flex;
  flex-direction: column;
  grid-area: situation-box;
  height: calc(4.7 * var(--display-base));
  justify-content: center;
  padding: calc(0.45 * var(--display-base));
  width: calc(4.7 * var(--display-base));
}

.mahjong-table .round-container,
.mahjong-table .dora-indicator {
  align-items: center;
  display: flex;
  flex: 1 1 50%;
  justify-content: center;
  text-align: center;
}

.mahjong-table .round {
  font-size: 0.86em;
  font-weight: 800;
  line-height: 1.1;
}

.mahjong-table .dora-indicator {
  border-top: 1px dashed rgba(255, 255, 255, 0.8);
  font-size: calc(0.76 * var(--display-base));
  gap: 2px;
}

.mahjong-table .center .player-score {
  align-items: center;
  display: flex;
  flex-direction: row;
  font-size: calc(0.85 * var(--display-base));
}

.mahjong-table .player-score .wind {
  background: var(--table-dark);
  color: var(--table-light);
  height: calc(1.25 * var(--display-base));
  line-height: calc(1.2 * var(--display-base));
  margin: calc(0.15 * var(--display-base));
  text-align: center;
  width: calc(1.25 * var(--display-base));
}

.mahjong-table .player-score.player-current {
  grid-area: score-current;
}

.mahjong-table .player-score.player-next {
  grid-area: score-next;
}

.mahjong-table .player-score.player-across {
  grid-area: score-across;
}

.mahjong-table .player-score.player-prev {
  grid-area: score-prev;
}

.mahjong-table .player-hand {
  align-self: center;
  display: flex;
  flex-direction: column;
  font-size: calc(1 * var(--display-base));
  justify-self: center;
  max-width: calc(15 * var(--display-base));
}

.mahjong-table .player-hand.player-current {
  font-size: calc(1.14 * var(--display-base));
  grid-area: hand-current;
  max-width: none;
}

.mahjong-table .player-hand.player-next {
  grid-area: hand-next;
}

.mahjong-table .player-hand.player-across {
  grid-area: hand-across;
}

.mahjong-table .player-hand.player-prev {
  grid-area: hand-prev;
}

.mahjong-table .player-discards {
  font-size: calc(1 * var(--display-base));
  min-height: calc(5 * var(--display-base));
  min-width: calc(5 * var(--display-base));
}

.mahjong-table .player-discards.player-current {
  align-self: start;
  grid-area: discards-current;
  justify-self: start;
}

.mahjong-table .player-discards.player-next {
  align-self: end;
  grid-area: discards-next;
  justify-self: start;
}

.mahjong-table .player-discards.player-across {
  align-self: end;
  grid-area: discards-across;
  justify-self: end;
}

.mahjong-table .player-discards.player-prev {
  align-self: start;
  grid-area: discards-prev;
  justify-self: end;
}

.mahjong-table .player-prev,
.mahjong-table .player-next {
  writing-mode: vertical-rl;
}

.mahjong-table .player-across,
.mahjong-table .player-next {
  transform: rotate(180deg);
}

.mahjong-table .player-name {
  color: var(--muted);
  font-size: calc(0.74 * var(--display-base));
  line-height: 1.2;
  margin-bottom: calc(0.3 * var(--display-base));
}

.mahjong-table .player-current .player-name {
  color: var(--ink);
  font-weight: 800;
}

.mahjong-table .player-across .player-name {
  text-align: right;
  transform: rotate(180deg);
}

.table-tile-group {
  align-items: center;
  display: flex;
  gap: calc(0.25 * var(--display-base));
}

.tile-threat-hand {
  align-items: flex-end;
  display: inline-flex;
  gap: calc(0.025 * var(--tile-size));
  padding-top: calc(0.08 * var(--tile-size));
  white-space: nowrap;
}

.tile-threat-cell {
  align-items: center;
  display: inline-flex;
  flex-direction: column;
  justify-content: flex-end;
  line-height: 1;
  min-width: 0.76em;
}

.tile-threat-bars {
  align-items: end;
  display: grid;
  gap: calc(0.035 * var(--tile-size));
  grid-template-columns: repeat(3, calc(0.055 * var(--tile-size)));
  height: calc(0.4 * var(--tile-size));
  margin-bottom: calc(-0.082 * var(--tile-size));
  position: relative;
  z-index: 1;
}

.tile-threat-bar {
  background: linear-gradient(to top, #247a50 0%, #d8ad3d 52%, #d86a38 84%, var(--red) 100%);
  border-radius: 999px;
  clip-path: inset(calc(100% - var(--bar-level, 0%)) 0 0 0);
  display: block;
  height: 100%;
  min-width: 2px;
  width: 100%;
}

.mahjong-table .hand.compact {
  align-items: center;
  border: 0;
  display: flex;
  flex-direction: row;
  padding: 0;
}

.mahjong-table .hand-contents .tiles,
.mahjong-table .discard-row .tiles,
.mahjong-table .table-melds .tiles {
  font-size: var(--tile-size);
}

.discard-row {
  block-size: var(--tile-size);
  height: var(--tile-size);
  white-space: nowrap;
}

.discard-tiles {
  align-items: center;
  display: inline-flex;
  line-height: 1;
  white-space: nowrap;
}

.discard-tile-slot {
  --discard-step: calc(0.554 * var(--tile-size));
  align-items: center;
  display: inline-flex;
  flex: 0 0 var(--discard-step);
  justify-content: center;
  min-block-size: var(--tile-size);
  min-inline-size: var(--discard-step);
  width: var(--discard-step);
}

.riichi-discard-slot {
  flex-basis: var(--tile-size);
  min-inline-size: var(--tile-size);
  width: var(--tile-size);
}

.riichi-discard-tile {
  --riichi-align-shift: calc(0.086 * var(--tile-size));
  display: inline-block;
  position: relative;
  transform: rotate(90deg);
  transform-origin: center;
}

.mahjong-table .player-current .riichi-discard-tile,
.mahjong-table .player-across .riichi-discard-tile {
  top: calc(-1 * var(--riichi-align-shift));
}

.mahjong-table .player-prev .riichi-discard-tile,
.mahjong-table .player-next .riichi-discard-tile {
  left: var(--riichi-align-shift);
}

.table-melds {
  display: flex;
  flex-wrap: nowrap;
  gap: calc(0.3 * var(--display-base));
  margin-top: calc(0.25 * var(--display-base));
  white-space: nowrap;
}

.meld-run {
  --called-step: calc(0.86 * var(--tile-size));
  --kan-stack-edge-shift: 0px;
  --kan-stack-offset: calc(0.11 * var(--tile-size));
  --meld-step: calc(0.554 * var(--tile-size));
  border: 1px solid #c8cec0;
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0 calc(0.18 * var(--display-base));
  vertical-align: middle;
  white-space: nowrap;
}

.meld-tile-slot {
  align-items: center;
  display: inline-flex;
  flex: 0 0 var(--meld-step);
  height: calc(1.08 * var(--tile-size));
  justify-content: flex-start;
  line-height: 1;
  min-height: 0;
  min-width: 0;
  overflow: visible;
  width: var(--meld-step);
}

.called-tile-slot {
  flex-basis: var(--called-step);
  justify-content: center;
  width: var(--called-step);
}

.added-kan-slot {
  min-height: calc(1.14 * var(--tile-size));
}

.added-kan-stack {
  display: inline-block;
  height: calc(1.14 * var(--tile-size));
  line-height: 1;
  position: relative;
  width: var(--called-step);
}

.added-kan-stack .added-kan-stack-tile {
  left: 50%;
  position: absolute;
  top: calc(50% - var(--kan-stack-offset));
  transform: translate(calc(-50% + var(--kan-stack-edge-shift)), -50%) rotate(90deg);
  transform-origin: center;
}

.added-kan-stack .added-kan-stack-tile + .added-kan-stack-tile {
  top: calc(50% + var(--kan-stack-offset));
}

.mahjong-table .player-prev .added-kan-slot {
  --kan-stack-edge-shift: 0px;
}

.mahjong-table .player-next .added-kan-slot {
  --kan-stack-edge-shift: 0px;
}

.mahjong-table .player-prev .added-kan-stack,
.mahjong-table .player-next .added-kan-stack {
  --kan-stack-offset: calc(0.1 * var(--tile-size));
  height: var(--called-step);
  width: calc(1.14 * var(--tile-size));
}

.mahjong-table .player-prev .added-kan-stack .added-kan-stack-tile,
.mahjong-table .player-next .added-kan-stack .added-kan-stack-tile {
  left: calc(50% - var(--kan-stack-offset));
  top: calc(50% - 0.04 * var(--tile-size));
  transform: translate(calc(-50% + var(--kan-stack-edge-shift)), -50%) rotate(90deg);
}

.mahjong-table .player-prev .added-kan-stack .added-kan-stack-tile + .added-kan-stack-tile,
.mahjong-table .player-next .added-kan-stack .added-kan-stack-tile + .added-kan-stack-tile {
  left: calc(50% + var(--kan-stack-offset));
  top: calc(50% - 0.04 * var(--tile-size));
  transform: translate(calc(-50% + var(--kan-stack-edge-shift)), -50%) rotate(90deg);
}

.mahjong-table .player-prev .added-kan-run .added-kan-neighbor-before,
.mahjong-table .player-next .added-kan-run .added-kan-neighbor-before {
  transform: translateY(calc(0.12 * var(--tile-size)));
}

.mahjong-table .player-prev .added-kan-run .added-kan-neighbor-after,
.mahjong-table .player-next .added-kan-run .added-kan-neighbor-after {
  transform: translateY(calc(-0.12 * var(--tile-size)));
}

.mahjong-table .player-prev .added-kan-run.added-kan-edge-start .meld-tile-slot:not(.added-kan-slot),
.mahjong-table .player-next .added-kan-run.added-kan-edge-start .meld-tile-slot:not(.added-kan-slot) {
  transform: translateY(calc(-0.12 * var(--tile-size)));
}

.mahjong-table .player-prev .added-kan-run.added-kan-edge-end .meld-tile-slot:not(.added-kan-slot),
.mahjong-table .player-next .added-kan-run.added-kan-edge-end .meld-tile-slot:not(.added-kan-slot) {
  transform: translateY(calc(0.12 * var(--tile-size)));
}

.called-from-kamicha,
.called-from-toimen {
  justify-content: flex-end;
}

.called-from-toimen {
  --kan-stack-edge-shift: calc(-0.08 * var(--tile-size));
}

.called-from-shimocha {
  --kan-stack-edge-shift: calc(0.08 * var(--tile-size));
}

.tiles.meld-tile,
.called-tile {
  display: inline-block;
  letter-spacing: 0;
  line-height: 1;
}

.called-tile {
  --called-align-shift: calc(0.052 * var(--tile-size));
  position: relative;
  top: var(--called-align-shift);
  transform: rotate(90deg);
  transform-origin: center;
}

.mahjong-table .player-current .called-tile:not(.added-kan-stack-tile),
.mahjong-table .player-across .called-tile:not(.added-kan-stack-tile) {
  top: var(--called-align-shift);
}

.mahjong-table .player-prev .called-tile:not(.added-kan-stack-tile),
.mahjong-table .player-next .called-tile:not(.added-kan-stack-tile) {
  left: calc(-1 * var(--called-align-shift));
  top: auto;
}

.case-links {
  display: flex;
  gap: 12px;
  margin: 12px 0 0;
}

.case-links a {
  color: var(--blue);
  font-weight: 750;
}

.source-room {
  background: var(--soft-green, #eef4ea);
  border: 1px solid var(--line);
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
  padding: 3px 7px;
  text-transform: uppercase;
}

.source-scope-card {
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 18px;
}

.source-scope-card p {
  margin: 0;
}

.sources {
  margin-bottom: 80px;
}

@media (min-width: 1440px) {
  .point-rail {
    position: fixed;
    top: 50%;
    left: 8px;
    z-index: 8;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 50px;
    max-height: min(72vh, 620px);
    padding: 10px 7px;
    overflow-y: auto;
    border: 1px solid rgba(23, 107, 84, 0.22);
    border-radius: 8px;
    background: rgba(251, 252, 248, 0.92);
    box-shadow: 0 14px 34px rgba(39, 45, 35, 0.14);
    transform: translateY(-50%);
    animation: pointRailIn 220ms ease-out both;
    backdrop-filter: blur(10px);
    scrollbar-width: none;
  }

  .point-rail::-webkit-scrollbar {
    display: none;
  }

  .point-rail::before {
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 50%;
    z-index: 0;
    width: 2px;
    background: linear-gradient(180deg, transparent, rgba(23, 107, 84, 0.24), transparent);
    content: "";
    pointer-events: none;
    transform: translateX(-50%);
  }

  .point-rail a {
    position: relative;
    z-index: 1;
    display: grid;
    width: 34px;
    min-width: 34px;
    height: 24px;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    line-height: 1;
    text-decoration: none;
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease,
      transform 160ms ease;
  }

  .point-rail-number {
    transform: none;
  }

  .point-rail a.has-example-progress .point-rail-number {
    transform: translateY(-2px);
  }

  .point-rail-progress {
    position: absolute;
    right: 6px;
    bottom: 3px;
    left: 6px;
    display: none;
    height: 2px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(23, 107, 84, 0.16);
  }

  .point-rail-progress-fill {
    display: block;
    width: var(--example-progress, 0%);
    height: 100%;
    border-radius: inherit;
    background: var(--green);
  }

  .point-rail a.has-example-progress .point-rail-progress {
    display: block;
  }

  .point-rail a:hover,
  .point-rail a:focus-visible {
    border-color: rgba(23, 107, 84, 0.38);
    color: var(--green);
    outline: none;
    transform: translateX(7px) scale(1.04);
  }

  .point-rail a.is-active {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
    box-shadow: 0 6px 14px rgba(23, 107, 84, 0.24);
    transform: translateX(6px);
  }

  .point-rail a.is-active .point-rail-progress {
    background: rgba(255, 255, 255, 0.32);
  }

  .point-rail a.is-active .point-rail-progress-fill {
    background: #fff;
  }

  .point-rail-panel {
    position: fixed;
    top: 50%;
    left: 8px;
    z-index: 9;
    display: block;
    width: min(640px, calc(100vw - 112px));
    max-width: calc(100vw - 16px);
    max-height: min(84vh, 760px);
    padding: 12px;
    overflow-y: auto;
    border: 1px solid rgba(23, 107, 84, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 18px 42px rgba(39, 45, 35, 0.18);
    opacity: 0;
    pointer-events: none;
    transform: translate(-10px, -50%) scale(0.98);
    transform-origin: left center;
    transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
    visibility: hidden;
  }

  .point-rail:hover + .point-rail-panel,
  .point-rail:focus-within + .point-rail-panel,
  .point-rail-panel:hover,
  .point-rail-panel:focus-within {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%) scale(1);
    visibility: visible;
  }

  .point-rail-panel ol {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .point-rail-panel a {
    display: grid;
    grid-template-columns: 34px minmax(max-content, 1fr);
    gap: 8px;
    align-items: center;
    min-height: 26px;
    padding: 4px 7px;
    border-radius: 6px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
  }

  .point-rail-panel b {
    color: var(--green);
    font-size: 11px;
    font-weight: 900;
    line-height: 1.45;
  }

  .point-rail-panel span {
    min-width: 0;
    white-space: nowrap;
  }

  .point-rail-panel a:hover,
  .point-rail-panel a:focus-visible,
  .point-rail-panel a.is-active {
    background: var(--soft-green);
    outline: none;
  }

  .point-rail-panel a.is-active {
    box-shadow: inset 3px 0 0 var(--green);
  }
}

@keyframes pointRailIn {
  from {
    opacity: 0;
    transform: translate(-8px, -50%);
  }

  to {
    opacity: 1;
    transform: translate(0, -50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .point-rail {
    animation: none;
  }

  .point-rail a {
    transition: none;
  }

  .point-rail-panel {
    transition: none;
  }
}

@media print {
  .commit-stamp {
    display: none;
  }
}

@media (max-width: 1100px) {
  .point-example-layout {
    grid-template-columns: 1fr;
  }

  .point-example-replay {
    position: static;
  }
}

@media (max-width: 900px) {
  .commit-stamp {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    max-width: calc(100vw - 16px);
    min-height: 28px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
  }

  .topbar h1 {
    font-size: clamp(15px, 4.2vw, 20px);
    max-width: calc(100vw - 40px);
  }

  .toplinks {
    justify-content: flex-start;
    width: 100%;
  }

  .layout,
  .intro,
  .point {
    display: block;
  }

  .layout {
    max-width: 100%;
    padding: 20px;
  }

  .book,
  .intro {
    max-width: 100%;
  }

  .intro {
    overflow: hidden;
    padding: 24px 20px;
  }

  .intro h2 {
    font-size: clamp(27px, 8vw, 34px);
  }

  .intro p,
  .teacher-grid p,
  .lesson-steps span {
    overflow-wrap: anywhere;
  }

  .intro-panel {
    margin-top: 22px;
    padding-top: 18px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .lesson-steps li {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .side {
    display: none;
  }

  .metrics-grid,
  .teacher-grid,
  .diagram,
  .two-col,
  .chapter-grid,
  .model-point-grid,
  .validation-grid,
  .insight-grid,
  .stat-strip,
  .evidence-grid,
  .safety-timing,
  .drill-list,
  .call-line,
  .yaku-condition-threats,
  .player-grid,
  .hidden-hand-grid {
    grid-template-columns: 1fr;
  }

  .caption-content {
    padding: 6px;
  }

  .mahjong-table {
    --display-base: calc((100vw - 72px) / 36);
  }

  .analysis-step p {
    font-size: 15px;
    line-height: 1.75;
  }

  .point-number {
    margin-bottom: 12px;
  }

  .case-grid,
  .comparison,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .model-badges {
    justify-content: flex-start;
    margin-top: 10px;
  }

  .case-head {
    display: block;
  }

  .case-head > span,
  .example-head > span {
    display: block;
    margin-top: 8px;
    text-align: left;
  }

  .example-head {
    display: block;
  }

  .player-card {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .player-card:last-child {
    border-bottom: 0;
  }
}
