:root {
  --ink: #161616;
  --muted-ink: #66635f;
  --paper: #fbfaf6;
  --paper-2: #f2f0e9;
  --white: #ffffff;
  --line: #d9d5ca;
  --line-strong: #aaa59a;
  --orange: #e85d20;
  --orange-dark: #a93c10;
  --orange-soft: #fff0e7;
  --dark: #171716;
  --dark-2: #242321;
  --lime: #d5ff47;
  --blue: #3767d6;
  --serif: "Songti SC", "Noto Serif SC", "STSong", serif;
  --sans: -apple-system, "SF Pro Text", "PingFang SC", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
  --topbar: 72px;
  --sidebar: 276px;
  --drawer: 440px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(22, 22, 22, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 32px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(232, 93, 32, 0.34);
  outline-offset: 2px;
}

select:focus-visible {
  outline: 3px solid rgba(232, 93, 32, 0.34);
  outline-offset: 2px;
}

::selection {
  color: #fff;
  background: var(--orange);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  height: var(--topbar);
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 0 22px 0 0;
  color: #fff;
  background: rgba(23, 23, 22, 0.98);
  border-bottom: 1px solid #30302e;
}

.brand {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 22px;
  border-right: 1px solid #353431;
}

.brand-mark {
  position: relative;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 3px solid var(--orange);
  transform: rotate(45deg);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  background: var(--orange);
}

.brand-copy {
  display: grid;
  gap: 1px;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 14px;
  letter-spacing: 0.06em;
}

.brand-copy span {
  color: #9f9d98;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.global-search {
  position: relative;
  width: min(650px, 100%);
  justify-self: center;
}

.global-search input {
  width: 100%;
  height: 42px;
  padding: 0 78px 0 42px;
  color: #fff;
  background: #2a2927;
  border: 1px solid #41403c;
  border-radius: 2px;
}

.global-search input::placeholder {
  color: #aaa7a0;
}

.global-search input:focus {
  background: #302f2c;
  border-color: #716f68;
  outline: none;
}

.search-glyph {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 15px;
  height: 15px;
  border: 2px solid #a9a69e;
  border-radius: 50%;
  transform: translateY(-55%);
  pointer-events: none;
}

.search-glyph::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 2px;
  background: #a9a69e;
  transform: rotate(45deg);
  transform-origin: left center;
}

.search-shortcut {
  position: absolute;
  top: 50%;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #8f8c86;
  font-family: var(--mono);
  font-size: 11px;
  transform: translateY(-50%);
  pointer-events: none;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-action,
.mobile-nav-button {
  min-height: 40px;
  padding: 0 13px;
  color: #d9d7d1;
  background: transparent;
  border: 1px solid #44433f;
  border-radius: 2px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.top-action:hover,
.mobile-nav-button:hover {
  color: #fff;
  background: #343330;
  border-color: #5b5954;
}

.top-action.is-english {
  color: #dce6ff;
  border-color: #465a83;
}

.mobile-nav-button {
  display: none;
}

.sidebar {
  position: fixed;
  z-index: 40;
  inset: var(--topbar) auto 0 0;
  width: var(--sidebar);
  overflow-y: auto;
  color: #e8e6df;
  background: var(--dark);
  border-right: 1px solid #302f2d;
  scrollbar-width: thin;
  scrollbar-color: #55524c transparent;
}

.sidebar-inner {
  display: grid;
  gap: 24px;
  padding: 22px 16px 30px;
}

.sidebar-section {
  display: grid;
  gap: 8px;
}

.sidebar-label {
  padding: 0 9px;
  color: #77746e;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-list {
  display: grid;
  gap: 2px;
}

.sidebar-item {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  color: #aaa7a0;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.sidebar-item:hover {
  color: #fff;
  background: #242321;
}

.sidebar-item.is-active {
  color: #fff;
  background: #2c2a27;
  box-shadow: inset 3px 0 0 var(--orange);
}

.sidebar-index {
  color: #6f6c66;
  font-family: var(--mono);
  font-size: 10px;
}

.sidebar-item.is-active .sidebar-index {
  color: var(--orange);
}

.sidebar-count {
  min-width: 26px;
  padding: 1px 6px;
  color: #77746e;
  background: #232220;
  border: 1px solid #363431;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
}

.sidebar-divider {
  height: 1px;
  background: #302f2c;
}

.source-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  color: #97948d;
  background: #201f1d;
  border: 1px solid #343330;
}

.source-card strong {
  color: #f1eee6;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
}

.source-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #77746e;
  font-family: var(--mono);
  font-size: 10px;
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--orange);
  font-size: 12px;
  text-decoration: none;
}

.source-link:hover {
  color: #ff8a55;
}

.main-content {
  min-height: 100vh;
  margin-left: 0;
  padding: calc(var(--topbar) + 38px) clamp(24px, 4vw, 68px) 80px;
  transition: margin-right 220ms ease;
}

.main-content.is-rules {
  padding-inline: clamp(22px, 2.2vw, 36px);
}

.content-frame {
  width: min(1040px, 100%);
  margin: 0 auto;
}

.content-frame.is-rules {
  width: min(1380px, 100%);
}

.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line-strong);
}

.page-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.page-kicker::before {
  content: "";
  width: 28px;
  height: 3px;
  background: var(--orange);
}

.page-heading h1 {
  max-width: 780px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.page-heading p {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--muted-ink);
  font-size: 16px;
  line-height: 1.8;
}

.page-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.rulebook-version {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: #77736b;
  font-family: var(--mono);
  white-space: nowrap;
}

.rulebook-version small {
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rulebook-version strong {
  color: var(--orange-dark);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.rulebook-version.is-english strong {
  color: var(--blue);
}

.page-heading-actions {
  min-width: 184px;
  display: grid;
  gap: 8px;
}

.document-launch-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 12px 0 18px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  text-decoration: none;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.document-launch-link:hover {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange);
}

.document-launch-link span {
  font-weight: 750;
}

.document-launch-link small {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.keyword-launch-button {
  min-width: 184px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 0 12px 0 18px;
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-top: 4px solid var(--orange);
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}

.keyword-launch-button span {
  font-weight: 750;
}

.keyword-launch-button small {
  min-width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  color: #aaa69d;
  border: 1px solid #4a4843;
  font-family: var(--mono);
  font-size: 9px;
}

.keyword-launch-button:hover {
  color: var(--ink);
  background: var(--orange-soft);
}

.keyword-launch-button:hover small {
  color: var(--orange-dark);
  border-color: #e8b69f;
}

.view-switch {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: #e9e6de;
  border: 1px solid var(--line);
}

.view-switch button {
  min-height: 38px;
  padding: 0 15px;
  color: #716e67;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.view-switch button:hover {
  color: var(--ink);
}

.view-switch button.is-active {
  color: #fff;
  background: var(--ink);
}

.notice-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 26px 0 40px;
  padding: 12px 14px;
  background: #fff7d8;
  border: 1px solid #ded09a;
}

.notice-badge {
  padding: 3px 7px;
  color: #fff;
  background: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.notice-strip p {
  margin: 0;
  color: #5f552e;
  font-size: 13px;
  line-height: 1.6;
}

.notice-strip button {
  color: #4e451f;
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

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

.guide-card {
  position: relative;
  grid-column: span 4;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
  padding: 22px;
  overflow: hidden;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.guide-card:nth-child(1),
.guide-card:nth-child(5),
.guide-card:nth-child(9) {
  grid-column: span 8;
}

.guide-card:hover {
  z-index: 1;
  border-color: var(--ink);
  box-shadow: 7px 7px 0 rgba(22, 22, 22, 0.1);
  transform: translate(-3px, -3px);
}

.guide-card::after {
  content: attr(data-number);
  position: absolute;
  right: 14px;
  bottom: -22px;
  color: rgba(22, 22, 22, 0.035);
  font-family: var(--mono);
  font-size: 96px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.guide-card-eyebrow {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.guide-card h2 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.25;
}

.guide-card p {
  max-width: 510px;
  margin: 0;
  color: var(--muted-ink);
  font-size: 13px;
  line-height: 1.7;
}

.guide-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.guide-card-refs {
  color: #858179;
  font-family: var(--mono);
  font-size: 10px;
}

.arrow-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.guide-detail {
  min-height: 60vh;
}

.keyword-guide-summary {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: 26px 0 2px;
}

.keyword-guide-summary > div {
  display: grid;
  gap: 3px;
}

.keyword-guide-summary .page-kicker {
  margin-bottom: 2px;
}

.keyword-guide-summary strong {
  font-family: var(--mono);
  font-size: clamp(20px, 2.8vw, 30px);
  letter-spacing: -0.04em;
}

.keyword-guide-summary p {
  max-width: 680px;
  margin: 5px 0 0;
  color: var(--muted-ink);
  font-size: 14px;
  line-height: 1.75;
}

.keyword-guide-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-strong);
}

.keyword-guide-section-head > div {
  display: grid;
  gap: 2px;
}

.keyword-guide-section-head span {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.keyword-guide-section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 600;
  letter-spacing: -0.04em;
}

.keyword-guide-section-head p {
  margin: 0;
  color: var(--muted-ink);
  font-size: 12px;
}

.detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.back-button,
.text-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  color: var(--muted-ink);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.back-button:hover,
.text-button:hover {
  color: var(--orange-dark);
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: clamp(24px, 6vw, 72px);
  padding: 34px 0 42px;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
}

.detail-hero h1 {
  max-width: 740px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 70px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.detail-hero p {
  max-width: 720px;
  margin: 20px 0 0;
  color: var(--muted-ink);
  font-size: 17px;
  line-height: 1.8;
}

.hero-rule-stack {
  align-self: end;
  display: grid;
  gap: 8px;
}

.hero-rule-stack span {
  color: #77736b;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

/* Animated rule explainers */
.rule-diagram {
  margin-top: 26px;
  scroll-margin-top: calc(var(--topbar) + 12px);
  border: 1px solid var(--ink);
  background: var(--dark);
  box-shadow: 8px 8px 0 var(--paper-2);
}

.rule-diagram-head {
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px;
  color: #fff;
  border-bottom: 1px solid #43413d;
}

.rule-diagram-head > div > span {
  display: block;
  margin-bottom: 5px;
  color: #ff8c58;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rule-diagram-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(23px, 3.2vw, 34px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.rule-diagram-head button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 8px 13px;
  color: #fff;
  background: transparent;
  border: 1px solid #706d66;
  font-size: 12px;
  cursor: pointer;
}

.rule-diagram-head button:hover {
  color: var(--ink);
  background: var(--lime);
  border-color: var(--lime);
}

.rule-diagram-head button span {
  display: inline-block;
  margin-right: 5px;
  font-size: 17px;
  line-height: 0;
}

.rule-diagram-stage {
  position: relative;
  min-height: 340px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 38px;
  color: #fff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    #1d1c1a;
  background-size: 24px 24px;
}

.rule-diagram-stage::before {
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  content: "";
  pointer-events: none;
}

.rule-diagram-stage [data-step] {
  opacity: 0;
  animation: diagram-reveal 560ms cubic-bezier(0.2, 0.78, 0.26, 1) forwards;
  animation-delay: var(--diagram-delay, 0ms);
}

.rule-diagram-stage [data-step="1"] { --diagram-delay: 80ms; }
.rule-diagram-stage [data-step="2"] { --diagram-delay: 240ms; }
.rule-diagram-stage [data-step="3"] { --diagram-delay: 400ms; }
.rule-diagram-stage [data-step="4"] { --diagram-delay: 560ms; }
.rule-diagram-stage [data-step="5"] { --diagram-delay: 720ms; }
.rule-diagram-stage [data-step="6"] { --diagram-delay: 880ms; }
.rule-diagram-stage [data-step="7"] { --diagram-delay: 1040ms; }
.rule-diagram-stage [data-step="8"] { --diagram-delay: 1200ms; }
.rule-diagram-stage [data-step="9"] { --diagram-delay: 1360ms; }
.rule-diagram-stage [data-step="10"] { --diagram-delay: 1520ms; }

.rule-diagram-foot {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 16px 20px;
  color: var(--ink);
  background: #fff;
}

.rule-diagram-foot p {
  max-width: 780px;
  margin: 0;
  color: var(--muted-ink);
  font-size: 13px;
  line-height: 1.65;
}

.diagram-rule-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.diagram-rule-links button {
  min-width: 40px;
  min-height: 30px;
  padding: 4px 7px;
  color: var(--orange-dark);
  background: var(--orange-soft);
  border: 1px solid #efc6b3;
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
}

.diagram-rule-links button:hover {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange);
}

.diagram-priority,
.diagram-deck,
.diagram-timeline,
.diagram-turn,
.diagram-play-card,
.diagram-move,
.diagram-showdown,
.diagram-combat,
.diagram-score,
.diagram-modes,
.diagram-keywords {
  position: relative;
  z-index: 1;
  width: min(100%, 940px);
}

.diagram-priority {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 34px minmax(120px, 1fr) 44px minmax(120px, 1fr) 44px minmax(120px, 1fr);
  align-items: stretch;
  gap: 8px;
}

.priority-input,
.priority-gate,
.priority-output {
  min-height: 126px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
  border: 1px solid #6b6861;
  background: #242321;
}

.priority-input.is-card,
.priority-output {
  color: var(--ink);
  background: var(--lime);
  border-color: var(--lime);
}

.priority-gate {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange);
}

.priority-input span,
.priority-gate span,
.priority-output span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.priority-input strong,
.priority-gate strong,
.priority-output strong {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
}

.diagram-operator,
.diagram-arrow {
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 25px;
}

.diagram-deck {
  display: grid;
  grid-template-columns: 150px 54px repeat(3, minmax(115px, 1fr));
  align-items: center;
  gap: 18px;
}

.legend-anchor {
  min-height: 172px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 18px;
  color: var(--ink);
  background: var(--lime);
  border: 3px solid #fff;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.35);
}

.legend-anchor span,
.deck-pile span,
.legend-anchor small {
  font-family: var(--mono);
  font-size: 10px;
}

.legend-anchor strong {
  font-family: var(--serif);
  font-size: 27px;
}

.deck-link {
  height: 1px;
  background: #8b877f;
}

.deck-link::after {
  display: block;
  width: 7px;
  height: 7px;
  margin: -3px 0 0 auto;
  background: #8b877f;
  transform: rotate(45deg);
  content: "";
}

.deck-pile {
  position: relative;
  min-height: 126px;
  display: grid;
  align-content: end;
  padding: 16px;
  border: 1px solid #77736b;
  background: #2b2a27;
}

.deck-pile i {
  position: absolute;
  inset: 12px 12px 46px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: #3a3834;
  transform: translate(calc(var(--card-offset, 0) * 4px), calc(var(--card-offset, 0) * -4px));
}

.deck-pile i:nth-child(1) { --card-offset: 0; }
.deck-pile i:nth-child(2) { --card-offset: 1; }
.deck-pile i:nth-child(3) { --card-offset: 2; }
.deck-pile strong { position: relative; font-size: 14px; }
.deck-pile span { position: relative; color: #bbb7af; }

.deck-check {
  position: absolute;
  right: 0;
  bottom: -54px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #cbc7be;
  font-size: 11px;
}

.deck-check b {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--lime);
}

.diagram-timeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: start;
  gap: 0;
}

.timeline-track {
  position: absolute;
  top: 35px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, var(--orange), var(--lime));
  transform-origin: left;
  animation: diagram-line 1.2s ease-out both;
}

.timeline-node {
  position: relative;
  display: grid;
  justify-items: center;
  text-align: center;
}

.timeline-node > span {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  margin-bottom: 15px;
  color: var(--ink);
  background: #fff;
  border: 8px solid #2d2c29;
  outline: 1px solid #737069;
  font-family: var(--mono);
  font-size: 13px;
}

.timeline-node:last-child > span {
  background: var(--lime);
}

.timeline-node strong { font-family: var(--serif); font-size: 21px; }
.timeline-node small { max-width: 120px; color: #aaa69e; font-size: 10px; }

.diagram-turn {
  width: min(100%, 590px);
  height: 270px;
}

.turn-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150px;
  height: 94px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--ink);
  background: var(--lime);
  transform: translate(-50%, -50%);
}

.turn-center span,
.turn-node span { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; }
.turn-center strong { font-family: var(--serif); font-size: 21px; }

.turn-orbit {
  position: absolute;
  inset: 12px 70px;
  border: 1px dashed #767269;
  border-radius: 50%;
}

.turn-node {
  position: absolute;
  min-width: 105px;
  display: grid;
  gap: 1px;
  padding: 8px 11px;
  background: #2e2d29;
  border-left: 3px solid var(--orange);
}

.turn-node strong { font-size: 12px; }
.turn-node.node-1 { left: 16px; top: 40px; }
.turn-node.node-2 { left: 28px; bottom: 28px; }
.turn-node.node-3 { left: 50%; bottom: -3px; transform: translateX(-50%); }
.turn-node.node-4 { right: 20px; bottom: 48px; }
.turn-node.node-5 { right: 26px; top: 32px; }

.turn-sweep {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 236px;
  height: 2px;
  background: linear-gradient(90deg, var(--orange), transparent 72%);
  transform-origin: left;
  animation: turn-sweep 1.7s 120ms cubic-bezier(0.3, 0.65, 0.4, 1) both;
}

.diagram-play-card {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 132px;
  align-items: center;
  gap: 20px;
}

.play-card-object,
.play-card-result {
  min-height: 142px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 15px;
  border: 2px solid #fff;
  background: #292825;
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.32);
}

.play-card-object span,
.play-card-result span { color: #aaa69e; font-family: var(--mono); font-size: 9px; }
.play-card-object strong,
.play-card-result strong { font-family: var(--serif); font-size: 20px; }
.play-card-result { color: var(--ink); background: var(--lime); border-color: var(--lime); }
.play-card-result span { color: #4a4a32; }

.play-card-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}

.play-card-track::before {
  position: absolute;
  top: 22px;
  left: 0;
  right: 0;
  height: 1px;
  background: #78746c;
  content: "";
}

.play-step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 9px;
  text-align: center;
}

.play-step span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: #fff;
  border: 5px solid #272622;
  outline: 1px solid #767269;
  font-family: var(--mono);
  font-size: 10px;
}

.play-step:nth-child(6) span { background: var(--orange); color: #fff; outline-color: var(--orange); }
.play-step strong { font-size: 11px; white-space: nowrap; }

.diagram-move {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(130px, 0.8fr) minmax(160px, 1fr);
  align-items: center;
  gap: 24px;
}

.move-zone {
  position: relative;
  min-height: 176px;
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 18px;
  border: 1px solid #747169;
  background: #292825;
}

.move-zone > span { color: #aaa69e; font-family: var(--mono); font-size: 9px; }
.move-zone > strong { font-family: var(--serif); font-size: 21px; }
.move-zone.is-field { background: #32251f; border-color: #9f4c27; }

.unit-token,
.moving-token {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--lime);
  border: 6px double var(--ink);
  border-radius: 50%;
  font-family: var(--mono);
  font-style: normal;
  font-weight: 800;
}

.unit-token { position: absolute; right: 16px; bottom: 16px; }
.unit-token.is-enemy { color: #fff; background: var(--orange); }

.move-route {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 80px;
  border-top: 1px dashed #8a867d;
}

.move-route span { margin-top: 12px; color: #aaa69e; font-size: 10px; }
.move-route i { position: absolute; right: -2px; top: -5px; width: 9px; height: 9px; background: var(--orange); transform: rotate(45deg); }

.move-result {
  position: absolute;
  right: 18px;
  bottom: -42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.move-result span { padding: 2px 6px; color: #fff; background: var(--orange); font-size: 10px; }
.move-result strong { font-size: 11px; }
.moving-token { position: absolute; left: 8%; bottom: 18px; animation: moving-token 1.35s 420ms cubic-bezier(0.25, 0.72, 0.25, 1) both; }

.diagram-showdown {
  display: grid;
  grid-template-columns: 180px minmax(160px, 1fr) 180px;
  align-items: center;
  gap: 24px;
}

.showdown-player {
  min-height: 138px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 17px;
  border: 1px solid #77736b;
  background: #292825;
}

.showdown-player.is-a { border-top: 5px solid var(--lime); }
.showdown-player.is-b { border-top: 5px solid var(--orange); }
.showdown-player span { color: #aaa69e; font-family: var(--mono); font-size: 9px; }
.showdown-player strong { font-family: var(--serif); font-size: 19px; }

.focus-lane {
  position: relative;
  height: 42px;
  display: grid;
  place-items: center;
  border-top: 1px dashed #827f77;
  border-bottom: 1px dashed #827f77;
  color: #8f8b83;
  font-family: var(--mono);
  font-size: 9px;
}

.focus-token {
  position: absolute;
  left: 0;
  width: 25px;
  height: 25px;
  background: var(--lime);
  border: 5px solid #2b2a27;
  outline: 1px solid var(--lime);
  animation: focus-pass 1.6s 350ms ease-in-out both;
}

.showdown-chain,
.showdown-pass {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.showdown-chain { top: -48px; display: grid; text-align: center; }
.showdown-chain span { color: #aaa69e; font-family: var(--mono); font-size: 9px; }
.showdown-chain strong { font-size: 12px; }

.showdown-pass {
  bottom: -62px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.showdown-pass b { padding: 6px 8px; color: #bbb7ae; border: 1px solid #625f59; font-family: var(--mono); font-size: 9px; }
.showdown-pass strong { margin-left: 5px; padding: 6px 9px; color: var(--ink); background: var(--lime); font-size: 10px; }

.diagram-combat {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.combat-phase {
  position: relative;
  min-height: 156px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 17px;
  border: 1px solid #6c6962;
  background: #292825;
}

.combat-phase > span { color: #ff8c58; font-family: var(--mono); font-size: 10px; }
.combat-phase > strong { font-family: var(--serif); font-size: 20px; }
.combat-phase > small { color: #aaa69e; font-size: 10px; }
.combat-phase.is-damage { background: var(--orange); border-color: var(--orange); }
.combat-phase.is-damage > span { color: #fff; }
.combat-phase.is-result { color: var(--ink); background: var(--lime); border-color: var(--lime); }
.combat-phase.is-result > span,
.combat-phase.is-result > small { color: #464532; }

.combat-lines { display: grid; gap: 4px; margin-top: 12px; }
.combat-lines i { width: 0; height: 3px; background: #fff; animation: damage-line 550ms calc(650ms + var(--line-delay, 0ms)) ease-out forwards; }
.combat-lines i:nth-child(2) { --line-delay: 90ms; }
.combat-lines i:nth-child(3) { --line-delay: 180ms; }
.combat-lines i:nth-child(4) { --line-delay: 270ms; }

.diagram-score {
  display: grid;
  grid-template-columns: 110px minmax(260px, 1fr) 145px 94px;
  align-items: center;
  gap: 15px;
}

.score-source { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px; }
.score-source span { padding: 6px; border: 1px solid #77736b; font-size: 10px; }
.score-source b { grid-row: 1 / 3; grid-column: 2; color: var(--lime); font-family: var(--mono); font-size: 19px; }
.score-track { display: grid; grid-template-columns: repeat(8, 1fr); border: 1px solid #77736b; }
.score-track i { min-height: 58px; display: grid; place-items: center; color: var(--ink); background: var(--lime); border-right: 1px solid #2a2a1d; font-family: var(--mono); font-size: 10px; font-style: normal; transform-origin: bottom; animation-name: score-fill; }
.score-track i:last-child { border-right: 0; background: var(--orange); color: #fff; }
.score-gate { min-height: 82px; display: grid; align-content: center; padding: 12px; border: 1px dashed #969188; }
.score-gate span { color: #ff8c58; font-family: var(--mono); font-size: 16px; }
.score-gate strong { font-size: 10px; }
.score-result { min-height: 110px; display: grid; align-content: center; padding: 12px; color: var(--ink); background: #fff; border: 5px double var(--ink); outline: 2px solid #fff; }
.score-result span { font-family: var(--mono); font-size: 8px; }
.score-result strong { font-family: var(--serif); font-size: 27px; }

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

.mode-map {
  min-height: 184px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: 20px;
  border: 1px solid #706d66;
  background: #292825;
}

.mode-map > span { width: 100%; color: #ff8c58; font-family: var(--mono); font-size: 16px; text-align: center; }
.mode-map i { width: 42px; height: 42px; display: grid; place-items: center; color: var(--ink); background: var(--lime); border-radius: 50%; font-family: var(--mono); font-size: 10px; font-style: normal; font-weight: 700; }
.mode-map i:nth-of-type(even) { color: #fff; background: var(--orange); }
.mode-map b { font-family: var(--mono); font-size: 9px; }
.mode-map small { width: 100%; color: #aaa69e; font-size: 10px; text-align: center; }
.mode-map.is-ffa { display: grid; grid-template-columns: repeat(2, 42px); align-content: center; }
.mode-map.is-ffa > span,
.mode-map.is-ffa > small { grid-column: 1 / -1; }
.mode-map.is-team > div { display: flex; gap: 4px; }
.mode-map.is-team i { width: 35px; height: 35px; }

.diagram-keywords {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px 210px;
  align-items: center;
  gap: 18px;
}

.keyword-stream { display: flex; flex-wrap: wrap; align-content: center; gap: 7px; }
.keyword-stream span { padding: 8px 12px; color: var(--ink); background: #fff; border-left: 4px solid var(--orange); font-family: var(--serif); font-size: 17px; }
.keyword-stream span:nth-child(3n + 1) { background: var(--lime); border-left-color: var(--lime); }
.keyword-arrow { display: grid; place-items: center; font-family: var(--mono); font-size: 26px; }
.keyword-index { min-height: 142px; display: grid; align-content: center; gap: 3px; padding: 20px; color: var(--ink); background: var(--orange-soft); border: 1px solid var(--orange); box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.3); }
.keyword-index span { color: var(--orange-dark); font-family: var(--mono); font-size: 9px; }
.keyword-index strong { font-family: var(--mono); font-size: 24px; letter-spacing: -0.05em; }
.keyword-index small { color: var(--muted-ink); font-size: 10px; }

@keyframes diagram-reveal {
  from { opacity: 0; filter: blur(3px); }
  to { opacity: 1; filter: blur(0); }
}

@keyframes diagram-line {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes turn-sweep {
  from { opacity: 0; transform: rotate(-155deg) scaleX(0.22); }
  15% { opacity: 1; }
  to { opacity: 0.35; transform: rotate(155deg) scaleX(1); }
}

@keyframes moving-token {
  0% { opacity: 0; transform: translateX(0) scale(0.8); }
  12% { opacity: 1; }
  78%, 100% { opacity: 1; transform: translateX(clamp(350px, 62vw, 700px)) scale(0.8); }
}

@keyframes focus-pass {
  0%, 18% { transform: translateX(0); }
  48%, 64% { transform: translateX(calc(100% + clamp(100px, 22vw, 290px))); }
  100% { transform: translateX(0); }
}

@keyframes damage-line {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes score-fill {
  from { opacity: 0; transform: scaleY(0.08); }
  to { opacity: 1; transform: scaleY(1); }
}

.rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rule-chip {
  min-height: 30px;
  padding: 4px 8px;
  color: var(--orange-dark);
  background: var(--orange-soft);
  border: 1px solid #efc6b3;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
}

.rule-chip:hover {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-top: 26px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.stat-block {
  min-height: 128px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 20px;
  background: #fff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat-block strong {
  font-family: var(--mono);
  font-size: 34px;
  letter-spacing: -0.06em;
  line-height: 1;
}

.stat-block span {
  color: var(--muted-ink);
  font-size: 12px;
}

.detail-content {
  margin-top: 38px;
}

.fact-list,
.step-list {
  display: grid;
  border-top: 1px solid var(--line-strong);
}

.fact-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.7fr) minmax(0, 2fr) minmax(120px, auto);
  align-items: start;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.fact-row h3,
.step-row h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
}

.fact-row p,
.step-row p {
  margin: 0;
  color: #4f4d48;
  font-size: 14px;
  line-height: 1.8;
}

.step-row {
  display: grid;
  grid-template-columns: 58px minmax(150px, 0.7fr) minmax(0, 1.8fr) minmax(120px, auto);
  align-items: start;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.step-index {
  color: var(--orange);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.mode-table {
  width: 100%;
  margin-top: 26px;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line-strong);
}

.mode-table th,
.mode-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.mode-table th {
  color: #77736b;
  background: var(--paper-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-table td:first-child {
  font-weight: 750;
}

.mode-table tr:last-child td {
  border-bottom: 0;
}

.mode-table button {
  color: var(--orange-dark);
  background: transparent;
  border: 0;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
}

.keyword-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-top: 30px;
  background: var(--line);
  border: 1px solid var(--line);
}

.keyword-tile {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  text-align: left;
  background: #fff;
  border: 0;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.keyword-tile:hover {
  color: #fff;
  background: var(--ink);
}

.keyword-tile strong {
  font-family: var(--serif);
  font-size: 20px;
}

.keyword-tile small {
  color: #5d6370;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.35;
}

.keyword-tile span {
  color: #88847c;
  font-family: var(--mono);
  font-size: 10px;
}

.keyword-tile:hover span,
.keyword-tile:hover small {
  color: #bdb9b0;
}

.keyword-modal-layer {
  position: fixed;
  z-index: 75;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 15, 14, 0.72);
  backdrop-filter: blur(7px);
  animation: rule-modal-layer-in 160ms ease both;
}

.keyword-modal {
  width: min(1120px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid #35332f;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
  animation: rule-modal-in 180ms ease both;
}

.keyword-modal-header {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 18px 20px 18px 26px;
  color: #f6f2e9;
  background: var(--dark-2);
  border-top: 4px solid var(--orange);
}

.keyword-modal-header > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.keyword-modal-header > div:first-child > span {
  color: var(--orange);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.keyword-modal-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.25;
}

.keyword-modal-header p {
  margin: 2px 0 0;
  color: #aaa69e;
  font-size: 12px;
}

.keyword-modal-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.keyword-modal-actions > span {
  color: #aaa69e;
  font-family: var(--mono);
  font-size: 10px;
}

.keyword-modal-actions > span strong {
  color: #fff;
  font-size: 13px;
}

.keyword-modal-actions button {
  width: 48px;
  height: 48px;
  padding: 0;
  color: #f6f2e9;
  background: transparent;
  border: 1px solid #4b4944;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.keyword-modal-actions button:hover {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange);
}

.keyword-modal-body {
  min-height: 0;
  overflow: auto;
  padding: 20px 24px 24px;
}

.keyword-modal-range {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--mono);
}

.keyword-modal-range span {
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 800;
}

.keyword-modal-range small {
  color: #88847c;
  font-size: 9px;
}

.keyword-modal .keyword-grid {
  margin-top: 14px;
}

.keyword-modal .keyword-tile {
  min-height: 92px;
}

.rules-toolbar {
  position: sticky;
  z-index: 15;
  top: calc(var(--topbar) - 1px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 0;
  padding: 12px 0;
  background: rgba(251, 250, 246, 0.96);
  border-bottom: 1px solid var(--line-strong);
  backdrop-filter: blur(10px);
}

.chapter-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  scroll-padding-inline: 12px;
}

.chapter-filter {
  min-height: 34px;
  padding: 4px 10px;
  color: #716e67;
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.chapter-filter:hover {
  color: var(--ink);
  background: var(--paper-2);
  border-color: var(--line-strong);
}

.chapter-filter.is-active,
.chapter-filter.is-active:hover {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.result-count {
  flex: 0 0 auto;
  color: #7d7971;
  font-family: var(--mono);
  font-size: 11px;
}

.rules-list {
  display: grid;
  margin-top: 12px;
  border-top: 1px solid var(--line-strong);
}

.rules-workspace {
  display: block;
}

.rules-list-column {
  min-width: 0;
}

.rule-row {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  min-height: 62px;
  padding: 14px 10px 14px calc(10px + var(--depth, 0) * 10px);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.rule-row:hover,
.rule-row.is-selected {
  background: #fff;
  box-shadow: inset 3px 0 0 var(--orange);
}

.rule-number {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 750;
}

.rule-copy-main {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.rule-text {
  display: block;
  color: #3d3b37;
  line-height: 1.75;
}

.pdf-bold {
  font-weight: 700;
}

.rule-text-en {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  padding-top: 9px;
  color: #5e6370;
  border-top: 1px dashed #d9dde7;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.65;
}

.rule-text-en > b {
  margin-top: 2px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.rule-copy-notes {
  display: grid;
  gap: 4px;
  padding-top: 8px;
  color: #77736b;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  line-height: 1.65;
}

.rule-meta {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.rule-example-count {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.rule-page {
  color: #8a867e;
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
}

.rule-row mark {
  color: inherit;
  background: #ffdd74;
  padding: 0 1px;
}

.rules-example-rail {
  position: sticky;
  top: calc(var(--topbar) + 68px);
  min-width: 0;
  max-height: calc(100vh - var(--topbar) - 92px);
  overflow: auto;
  color: var(--ink);
  background: #f1eee6;
  border: 1px solid #d4cfc4;
  border-top: 4px solid var(--orange);
  scrollbar-width: thin;
  scrollbar-color: #b7b0a4 transparent;
}

.rules-example-rail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 14px;
  padding: 20px 22px 17px;
  border-bottom: 1px solid #d4cfc4;
}

.rules-example-rail-head > div {
  display: grid;
  gap: 2px;
}

.rules-example-rail-head span {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.rules-example-rail-head strong {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.25;
}

.rules-example-rail-head b {
  color: #aaa398;
  font-family: var(--mono);
  font-size: 28px;
}

.rules-example-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 22px;
  color: #777168;
  background: #e8e4da;
  border-bottom: 1px solid #d4cfc4;
  font-family: var(--mono);
  font-size: 10px;
}

.rules-example-source strong {
  color: var(--orange-dark);
  font-weight: 800;
}

.rules-example-list {
  display: grid;
}

.rules-example-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  padding: 20px 22px 22px;
}

.rules-example-item + .rules-example-item {
  border-top: 1px solid #d4cfc4;
}

.rules-example-item > span {
  padding-top: 3px;
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
}

.rules-example-item p {
  margin: 0;
  color: #37342f;
  font-size: 15px;
  line-height: 1.82;
  text-wrap: pretty;
}

.rules-example-item mark {
  color: inherit;
  background: #ffdd74;
  padding: 0 1px;
}

.rules-example-empty {
  min-height: 180px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 28px 22px;
}

.rules-example-empty strong {
  font-family: var(--serif);
  font-size: 22px;
}

.rules-example-empty span {
  color: #777168;
  font-size: 13px;
  line-height: 1.75;
}

.rules-example-hint {
  padding: 12px 22px;
  color: #8a847b;
  border-top: 1px solid #d4cfc4;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.rules-load-sentinel,
.rules-list-end {
  width: 100%;
  min-height: 58px;
  margin-top: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.rules-load-sentinel strong,
.rules-list-end strong {
  margin-left: auto;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}

.rules-load-pulse {
  height: 16px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.rules-load-pulse i {
  width: 3px;
  height: 8px;
  display: block;
  background: var(--orange);
  animation: rules-load-pulse 0.9s ease-in-out infinite alternate;
}

.rules-load-pulse i:nth-child(2) {
  animation-delay: 0.14s;
}

.rules-load-pulse i:nth-child(3) {
  animation-delay: 0.28s;
}

.rules-list-end {
  justify-content: space-between;
}

@keyframes rules-load-pulse {
  from {
    transform: scaleY(0.55);
    opacity: 0.45;
  }
  to {
    transform: scaleY(1.3);
    opacity: 1;
  }
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 40px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  font-family: var(--serif);
  font-size: 28px;
}

.empty-state p {
  margin: 0;
  color: var(--muted-ink);
}

.rule-modal-layer {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(15, 15, 14, 0.72);
  backdrop-filter: blur(7px);
  animation: rule-modal-layer-in 160ms ease both;
}

.rule-modal {
  width: min(1040px, 100%);
  max-height: min(880px, calc(100vh - 64px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #35332f;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
  animation: rule-modal-in 180ms ease both;
}

.rule-modal.is-leaf:not(.has-examples) {
  width: min(760px, 100%);
  grid-template-rows: auto auto;
}

.rule-modal.is-leaf:not(.has-examples) .rule-modal-body {
  gap: 0;
  padding: 24px;
}

.rule-modal.is-bilingual,
.rule-modal.is-bilingual.is-leaf:not(.has-examples) {
  width: min(1180px, 100%);
  grid-template-rows: auto minmax(0, 1fr);
}

.rule-modal.is-bilingual.is-leaf:not(.has-examples) .rule-modal-body {
  gap: 30px;
  padding: 28px;
}

.rule-modal-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 15px 18px 15px 22px;
  color: #f6f2e9;
  background: var(--dark-2);
  border-top: 4px solid var(--orange);
  border-bottom: 1px solid #3d3a35;
}

.rule-modal-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.rule-modal-back {
  flex: 0 0 auto;
  min-width: 68px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  color: #ddd8ce;
  background: #302e2a;
  border: 1px solid #57534c;
  cursor: pointer;
}

.rule-modal-back:hover {
  color: #fff;
  border-color: var(--orange);
}

.rule-modal-back > span {
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1;
}

.rule-modal-back > strong {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.rule-modal-title {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.rule-modal-title > span {
  color: #a8a39a;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.rule-modal-title h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.25;
}

.rule-modal-title h2:focus {
  outline: 0;
}

.rule-modal-title p {
  margin: 0;
  color: #9f9a90;
  font-size: 11px;
  line-height: 1.5;
}

.rule-modal-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.rule-modal-action,
.rule-modal-close {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  color: #d4d0c7;
  background: #302e2a;
  border: 1px solid #4d4a44;
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}

.rule-modal-action:hover {
  color: #fff;
  border-color: #7b766d;
}

.rule-modal-parent-action {
  gap: 6px;
  border-color: #625a50;
  white-space: nowrap;
}

.rule-modal-parent-action span {
  color: #aaa49a;
  font-size: 9px;
}

.rule-modal-parent-action strong {
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
}

.rule-modal-parent-action b {
  color: var(--orange);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1;
}

.rule-modal-parent-action:hover {
  border-color: var(--orange);
}

.rule-modal-action.is-primary {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange);
}

.rule-modal-action.is-english {
  color: #e8eeff;
  border-color: #53678f;
}

.rule-modal-close {
  width: 40px;
  padding: 0;
  color: #d8d4cb;
  background: transparent;
  font-family: var(--sans);
  font-size: 24px;
  line-height: 1;
}

.rule-modal-close:hover {
  color: #fff;
  background: #393631;
}

.rule-modal button:focus-visible,
.rule-modal a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.rule-modal-body {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 30px;
  padding: 28px;
  overflow: auto;
  overscroll-behavior: contain;
}

.rule-modal-root {
  display: grid;
  gap: 14px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line-strong);
}

.rule-modal-root-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #858078;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.rule-modal-root-layout {
  display: grid;
  gap: 24px;
}

.rule-modal-root-layout.has-examples {
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.9fr);
  align-items: start;
}

.rule-modal-root-layout.is-bilingual,
.rule-modal-root-layout.is-bilingual.has-examples {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.rule-language-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  align-content: start;
  gap: 15px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
}

.rule-language-panel.is-english {
  background: #f6f8fd;
  border-color: #cbd4e8;
}

.rule-language-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.rule-language-panel.is-english .rule-language-head {
  border-bottom-color: #d3daea;
}

.rule-language-head > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.rule-language-head span,
.rule-language-head a {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.rule-language-head strong {
  font-family: var(--serif);
  font-size: 17px;
}

.rule-language-head a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  text-decoration: none;
  border: 1px solid #e3bca8;
}

.rule-language-panel.is-english .rule-language-head span,
.rule-language-panel.is-english .rule-language-head a,
.rule-modal-root-copy.is-english > strong {
  color: #315dbf;
}

.rule-language-panel.is-english .rule-language-head a {
  border-color: #b9c7e5;
}

.rule-modal-root-copy {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
}

.rule-modal-root-copy > strong {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 13px;
}

.rule-modal-root-copy > p {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.85;
  text-wrap: pretty;
}

.rule-modal-root-copy.is-english > p {
  color: #30394b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.72;
}

.rule-modal-notes {
  display: grid;
  gap: 7px;
  margin-top: 6px;
  padding-top: 14px;
  color: var(--muted-ink);
  border-top: 1px dashed var(--line-strong);
}

.rule-modal-notes > span {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.rule-modal-notes p {
  margin: 0;
  font-size: 12px;
  line-height: 1.75;
}

.rule-modal-root-examples {
  min-width: 0;
  background: var(--paper-2);
  border-top: 4px solid var(--orange);
}

.rule-modal-root-examples.is-english {
  background: #edf1f9;
  border-top-color: var(--blue);
}

.rule-modal-root-examples.is-english .rule-modal-examples-head span {
  color: #315dbf;
}

.rule-modal-root-examples.is-english .rule-modal-examples-head strong {
  font-family: Georgia, "Times New Roman", serif;
}

.rule-modal-root-examples.is-english .rule-modal-example p {
  color: #30394b;
  font-family: Georgia, "Times New Roman", serif;
}

.rule-modal-examples-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
}

.rule-modal-examples-head > div {
  display: grid;
  gap: 2px;
}

.rule-modal-examples-head span {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.rule-modal-examples-head strong {
  font-family: var(--serif);
  font-size: 20px;
}

.rule-modal-examples-head b {
  color: #aaa49a;
  font-family: var(--mono);
  font-size: 25px;
}

.rule-modal-example-list {
  display: grid;
}

.rule-modal-example {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  padding: 15px 17px 17px;
}

.rule-modal-example + .rule-modal-example {
  border-top: 1px solid var(--line);
}

.rule-modal-example > span {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
}

.rule-modal-example p {
  margin: 0;
  color: #34312d;
  font-size: 14px;
  line-height: 1.82;
  text-wrap: pretty;
}

.rule-modal-references {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.rule-modal-references > span {
  flex: 0 0 auto;
  color: #7d7870;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.rule-modal-references > div {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.rule-modal-reference {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  cursor: pointer;
}

.rule-modal-reference:hover {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.rule-modal-reference small {
  color: #89847c;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
}

.rule-modal-reference strong {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 10px;
}

.rule-modal-reference b {
  font-size: 10px;
  font-weight: 500;
}

.rule-modal-reference:hover small,
.rule-modal-reference:hover strong {
  color: #fff;
}

.rule-modal-references.is-compact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
}

.rule-modal-references.is-compact > span {
  font-size: 8px;
}

.rule-modal-references.is-compact .rule-modal-reference {
  min-height: 26px;
  padding: 2px 6px;
}

.rule-modal-children {
  display: grid;
  gap: 8px;
}

.rule-modal-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-strong);
}

.rule-modal-section-head > div {
  display: grid;
  gap: 2px;
}

.rule-modal-section-head span {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.rule-modal-section-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.25;
}

.rule-modal-section-head > strong {
  color: #a39d93;
  font-family: var(--mono);
  font-size: 25px;
}

.rule-modal-tree {
  display: grid;
  border-top: 1px solid var(--line);
}

.rule-modal-child {
  --child-index-width: 124px;
  --child-gap: 14px;
  border-bottom: 1px solid var(--line);
}

.rule-modal-child-main {
  width: 100%;
  display: grid;
  grid-template-columns: var(--child-index-width) minmax(0, 1fr);
  align-items: start;
  gap: var(--child-gap);
  padding: 8px 8px 8px calc(8px + var(--child-depth, 0) * 14px);
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.rule-modal-child-main:hover,
.rule-modal-child-main:focus-visible {
  background: rgba(232, 93, 32, 0.035);
  box-shadow: inset 3px 0 0 var(--orange);
}

.rule-modal-child-index {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.rule-modal-child-index strong {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.rule-modal-child-index small {
  color: #8a857d;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.rule-modal-child-copy {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.rule-modal-child-copy.is-bilingual {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rule-modal-child-language {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 4px;
}

.rule-modal-child-language.is-english {
  padding-left: 14px;
  border-left: 1px solid #d3daea;
}

.rule-modal-child-language > small {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.rule-modal-child-language.is-english > small {
  color: #315dbf;
}

.rule-modal-child-text {
  display: block;
  font-size: 14px;
  line-height: 1.58;
  text-wrap: pretty;
}

.rule-modal-child-text-en {
  display: block;
  color: #454e61;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.56;
  text-wrap: pretty;
}

.rule-modal-child-notes {
  display: grid;
  gap: 2px;
  color: #716d66;
  font-size: 10px;
  line-height: 1.4;
}

.rule-modal-child-tools {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin: 0 8px 8px calc(8px + var(--child-index-width) + var(--child-gap));
}

.rule-modal-child-examples {
  flex: 0 0 auto;
  width: min(680px, 100%);
  min-width: 220px;
  margin: 0;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
}

.rule-modal-child-examples summary {
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 7px;
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.rule-modal-child-examples summary::-webkit-details-marker {
  display: none;
}

.rule-modal-child-examples summary::after {
  content: "展开";
  color: #87827a;
  font-size: 8px;
  font-weight: 500;
}

.rule-modal-child-examples[open] summary::after {
  content: "收起";
}

.rule-modal-child-examples > div {
  display: grid;
  gap: 6px;
  padding: 0 9px 9px;
}

.rule-modal-child-examples > div.is-bilingual {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rule-modal-child-example-language {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 9px;
  background: #fff;
}

.rule-modal-child-example-language.is-english {
  background: #edf1f9;
}

.rule-modal-child-example-language > strong {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.rule-modal-child-example-language.is-english > strong {
  color: #315dbf;
}

.rule-modal-child-examples p {
  margin: 0;
  color: #4e4a44;
  font-size: 13px;
  line-height: 1.68;
}

.rule-modal-child-example-language.is-english p {
  color: #3f485a;
  font-family: Georgia, "Times New Roman", serif;
}

@keyframes rule-modal-layer-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rule-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  .rule-modal-layer {
    place-items: stretch;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: 0;
  }

  .rule-modal {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: 0;
  }

  .rule-modal.is-leaf:not(.has-examples) {
    width: 100%;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .rule-modal.is-leaf:not(.has-examples) .rule-modal-body {
    padding: 16px 14px 24px;
  }

  .rule-modal-header {
    position: relative;
    display: grid;
    align-items: start;
    gap: 11px;
    padding: 12px 58px 12px 14px;
  }

  .rule-modal-heading {
    align-items: flex-start;
    gap: 9px;
  }

  .rule-modal-back {
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
  }

  .rule-modal-back > strong {
    display: none;
  }

  .rule-modal-title h2 {
    font-size: 21px;
  }

  .rule-modal-actions {
    width: 100%;
    gap: 6px;
  }

  .rule-modal-action {
    flex: 1;
    min-height: 42px;
  }

  .rule-modal-parent-action {
    flex: 1.3;
    gap: 4px;
    padding-inline: 7px;
  }

  .rule-modal-parent-action b {
    display: none;
  }

  .rule-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }

  .rule-modal-body {
    gap: 22px;
    padding: 16px 14px 24px;
  }

  .rule-modal-root {
    gap: 12px;
    padding: 16px;
  }

  .rule-modal-root-layout.has-examples {
    grid-template-columns: 1fr;
  }

  .rule-modal-root-layout.is-bilingual,
  .rule-modal-root-layout.is-bilingual.has-examples {
    grid-template-columns: 1fr;
  }

  .rule-language-panel {
    padding: 14px;
  }

  .rule-modal-root-copy > p {
    font-size: 19px;
    line-height: 1.82;
  }

  .rule-modal-root-copy.is-english > p {
    font-size: 17px;
    line-height: 1.7;
  }

  .rule-modal-references:not(.is-compact) {
    align-items: flex-start;
  }

  .rule-modal-child {
    --child-index-width: 86px;
    --child-gap: 9px;
  }

  .rule-modal-child-main {
    padding: 9px 5px 10px calc(5px + var(--child-depth, 0) * 5px);
  }

  .rule-modal-child-index {
    display: grid;
    align-content: start;
    gap: 1px;
  }

  .rule-modal-child-text {
    font-size: 13px;
    line-height: 1.68;
  }

  .rule-modal-child-copy,
  .rule-modal-child-examples > div {
    grid-template-columns: 1fr;
  }

  .rule-modal-child-language.is-english {
    padding: 7px 0 0;
    border-top: 1px solid #d3daea;
    border-left: 0;
  }

  .rule-modal-child-text-en {
    font-size: 12px;
    line-height: 1.62;
  }

  .rule-modal-child-tools {
    margin: 0 5px 10px calc(5px + var(--child-index-width) + var(--child-gap));
  }

  .rule-modal-references.is-compact {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .rule-modal-references.is-compact > span {
    display: none;
  }

  .rule-modal-references.is-compact .rule-modal-reference {
    min-height: 28px;
  }

  .rule-modal-section-head h3 {
    font-size: 23px;
  }
}

.reference-drawer {
  position: fixed;
  z-index: 45;
  inset: var(--topbar) 0 0 auto;
  width: var(--drawer);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  color: #eeeae2;
  background: var(--dark-2);
  border-left: 1px solid #3d3b37;
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.12);
}

.reference-drawer.has-examples {
  width: min(880px, calc(100vw - var(--sidebar)));
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 62px;
  padding: 10px 16px;
  border-bottom: 1px solid #403e39;
}

.drawer-title {
  display: grid;
  gap: 1px;
}

.drawer-title span {
  color: #8d8980;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.drawer-title strong {
  font-family: var(--mono);
  font-size: 15px;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #b8b4ac;
  background: transparent;
  border: 1px solid #4a4842;
  cursor: pointer;
}

.icon-button:hover {
  color: #fff;
  background: #34322e;
}

.drawer-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 10px 16px 0;
  border-bottom: 1px solid #403e39;
}

.drawer-tab {
  min-height: 38px;
  color: #858178;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.drawer-tab:hover {
  color: #d8d4cb;
}

.drawer-tab.is-active {
  color: #fff;
  border-bottom-color: var(--orange);
}

.drawer-body {
  min-height: 0;
  overflow: auto;
}

.original-pane {
  display: grid;
  align-content: start;
  gap: 24px;
  padding: 26px 24px 38px;
}

.original-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #89857d;
  font-family: var(--mono);
  font-size: 10px;
}

.original-rule {
  margin: 0;
  color: #f5f1e8;
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.9;
}

.original-copy-layout {
  display: grid;
  gap: 28px;
}

.original-copy-layout.has-examples {
  grid-template-columns: minmax(280px, 0.9fr) minmax(340px, 1.1fr);
  align-items: start;
}

.original-rule-column {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
}

.original-section-label {
  color: #8d8980;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.original-rule-notes {
  display: grid;
  gap: 7px;
  margin-top: 6px;
  padding-top: 14px;
  color: #a9a49a;
  border-top: 1px dashed #4e4b44;
}

.original-rule-notes > span {
  color: #817d74;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.original-rule-notes p {
  margin: 0;
  font-size: 11px;
  line-height: 1.7;
}

.original-examples {
  min-width: 0;
  color: var(--ink);
  background: #f1eee6;
  border-top: 4px solid var(--orange);
}

.original-examples-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 14px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid #d4cfc4;
}

.original-examples-head span {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.original-examples-head strong {
  grid-column: 1;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.25;
}

.original-examples-head b {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  color: #a8a297;
  font-family: var(--mono);
  font-size: 27px;
}

.original-example-list {
  display: grid;
}

.original-example {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  padding: 18px 20px 20px;
}

.original-example + .original-example {
  border-top: 1px solid #d4cfc4;
}

.original-example > span {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
}

.original-example p {
  margin: 0;
  color: #34312d;
  font-size: 14px;
  line-height: 1.85;
  text-wrap: pretty;
}

.original-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drawer-action {
  min-height: 36px;
  padding: 5px 10px;
  color: #c6c2b9;
  background: #2e2c28;
  border: 1px solid #494741;
  font-size: 11px;
  cursor: pointer;
}

.drawer-action:hover {
  color: #fff;
  border-color: #777269;
}

.drawer-action.is-primary {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange);
}

.related-block {
  display: grid;
  gap: 9px;
  padding-top: 18px;
  border-top: 1px solid #403e39;
}

.related-block > span {
  color: #77736b;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.drawer-rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.drawer-rule-chip {
  min-height: 29px;
  padding: 3px 8px;
  color: #cfcbc2;
  background: transparent;
  border: 1px solid #494741;
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
}

.drawer-rule-chip:hover {
  color: #fff;
  background: #383631;
}

.neighbor-list {
  display: grid;
  gap: 1px;
  background: #3c3a35;
  border: 1px solid #3c3a35;
}

.neighbor-rule {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  padding: 11px;
  color: #a7a39a;
  text-align: left;
  background: #292824;
  border: 0;
  cursor: pointer;
}

.neighbor-rule:hover,
.neighbor-rule.is-active {
  color: #fff;
  background: #34322e;
}

.neighbor-rule strong {
  color: var(--orange);
  font-family: var(--mono);
  font-size: 10px;
}

.neighbor-rule span {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.neighbor-rule small {
  grid-column: 2;
  justify-self: start;
  margin-top: -7px;
  padding: 2px 5px;
  color: #d08a69;
  border: 1px solid #604330;
  font-family: var(--mono);
  font-size: 8px;
}

.pdf-pane {
  height: 100%;
  min-height: 400px;
  background: #151515;
}

.pdf-pane iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.pdf-fallback {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 32px;
  color: #a7a39a;
  text-align: center;
}

.sidebar-backdrop,
.drawer-backdrop {
  display: none;
}

.copy-toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 26px;
  padding: 9px 13px;
  color: #fff;
  background: var(--ink);
  border: 1px solid #444;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  transform: translateX(-50%);
  animation: toast-in 180ms ease both;
}

/* Settlement chain lab */
.chain-lab-page {
  display: grid;
  gap: 0;
}

.lab-disclaimer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  padding: 12px 14px;
  color: #5f552e;
  background: #fff7d8;
  border: 1px solid #ded09a;
}

.lab-disclaimer > span {
  padding: 3px 7px;
  color: #fff;
  background: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.lab-disclaimer p {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
}

.lab-disclaimer button,
.lab-rule-evidence-head button {
  color: #4e451f;
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.scenario-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-top: 22px;
  background: var(--line);
  border: 1px solid var(--line);
}

.scenario-option {
  min-height: 116px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: 6px 11px;
  padding: 16px;
  text-align: left;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.scenario-option:last-child {
  border-right: 0;
}

.scenario-option > span {
  color: var(--orange);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

.scenario-option strong {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 650;
  line-height: 1.3;
}

.scenario-option small {
  grid-column: 1 / -1;
  align-self: end;
  color: var(--muted-ink);
  font-size: 11px;
  line-height: 1.55;
}

.scenario-option:hover,
.scenario-option.is-active {
  color: #fff;
  background: var(--ink);
}

.scenario-option:hover small,
.scenario-option.is-active small {
  color: #b9b6ae;
}

.scenario-brief {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 0;
}

.scenario-brief > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.scenario-brief span {
  padding-top: 2px;
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.scenario-brief p {
  max-width: 920px;
  margin: 0;
  color: #4d4a45;
  font-size: 13px;
  line-height: 1.65;
}

.scenario-brief > button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  color: #5e5a53;
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-size: 11px;
  cursor: pointer;
}

.scenario-brief > button:hover {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.chain-step-rail {
  display: grid;
  grid-template-columns: minmax(176px, 1.3fr) repeat(4, minmax(108px, 0.7fr));
  margin-top: 26px;
  background: #fff;
  border: 1px solid var(--line-strong);
}

.chain-step-intro {
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 12px 15px;
  color: #fff;
  background: var(--ink);
}

.chain-step-intro span {
  color: var(--orange);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.chain-step-intro strong {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
}

.chain-step {
  position: relative;
  min-height: 68px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  text-align: left;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
}

.chain-step:last-child {
  border-right: 0;
}

.chain-step > span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #77736b;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 10px;
}

.chain-step strong {
  font-size: 12px;
}

.chain-step small {
  color: #89857d;
  font-family: var(--mono);
  font-size: 9px;
}

.chain-step:hover {
  background: var(--paper-2);
}

.chain-step.is-active {
  color: #fff;
  background: var(--orange);
}

.chain-step.is-active > span {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.62);
}

.chain-step.is-active small {
  color: rgba(255, 255, 255, 0.72);
}

.chain-workbench {
  display: grid;
  grid-template-columns: minmax(220px, 0.78fr) minmax(420px, 1.45fr) minmax(254px, 0.9fr);
  align-items: start;
  gap: 12px;
  margin-top: 12px;
}

.lab-panel {
  min-width: 0;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line-strong);
}

.lab-panel-heading {
  display: grid;
  gap: 2px;
  padding: 16px 17px 13px;
  border-bottom: 1px solid var(--line);
}

.lab-panel-heading.is-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.lab-panel-heading > div {
  display: grid;
  gap: 2px;
}

.lab-panel-heading span {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.lab-panel-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.priority-card {
  display: grid;
  gap: 4px;
  margin: 12px;
  padding: 12px;
  color: #fff;
  background: var(--ink);
  border-top: 3px solid var(--orange);
}

.priority-card span,
.priority-card small {
  color: #aaa69e;
  font-family: var(--mono);
  font-size: 9px;
}

.priority-card strong {
  font-size: 12px;
  line-height: 1.5;
}

.action-groups {
  display: grid;
  gap: 19px;
  padding: 0 12px 14px;
}

.action-group {
  display: grid;
  gap: 7px;
}

.action-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #6f6b64;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.action-group-label small {
  color: #9a968e;
  font-size: 8px;
}

.lab-action-card {
  position: relative;
  width: 100%;
  min-height: 108px;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 11px 12px 10px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.lab-action-card:hover:not(:disabled) {
  border-color: var(--ink);
  box-shadow: 4px 4px 0 rgba(22, 22, 22, 0.1);
  transform: translate(-2px, -2px);
}

.lab-action-card:disabled {
  color: #9d9991;
  background: #f0eee8;
  cursor: not-allowed;
  opacity: 0.65;
}

.timing-tag {
  width: fit-content;
  padding: 1px 5px;
  color: #fff;
  background: #77736b;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.timing-tag.is-reaction {
  color: #171716;
  background: var(--lime);
}

.timing-tag.is-swift {
  color: #fff;
  background: var(--blue);
}

.lab-action-card > strong {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 650;
}

.lab-action-card p {
  margin: 0;
  color: #605d57;
  font-size: 11px;
  line-height: 1.55;
}

.action-cta {
  align-self: end;
  margin-top: 2px;
  color: var(--orange-dark);
  font-size: 9px;
  font-weight: 800;
}

.lab-action-card:disabled .action-cta {
  color: #aaa69e;
}

.counter-target-select {
  display: grid;
  gap: 4px;
  padding: 8px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}

.counter-target-select span {
  color: #77736b;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.counter-target-select select {
  width: 100%;
  min-height: 34px;
  padding: 0 7px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  font-size: 10px;
}

.chain-count {
  min-width: 42px;
  padding: 3px 7px;
  color: #fff;
  background: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  text-align: center;
}

.chain-direction,
.chain-base {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 13px;
  color: #858179;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chain-stack {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background:
    linear-gradient(90deg, transparent 49.85%, rgba(22, 22, 22, 0.08) 50%, transparent 50.15%),
    #f4f2ec;
}

.chain-stack.is-empty {
  display: grid;
  place-items: center;
}

.chain-item {
  position: relative;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  gap: 11px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line-strong);
  box-shadow: 0 4px 0 rgba(22, 22, 22, 0.07);
  animation: chain-item-in 180ms ease-out both;
}

.chain-item.is-pending {
  border-style: dashed;
  border-color: var(--orange);
}

.chain-item.is-next {
  box-shadow: 5px 5px 0 rgba(232, 93, 32, 0.18);
}

.chain-item-sequence {
  display: grid;
  align-content: start;
  gap: 4px;
  padding-right: 9px;
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9px;
}

.chain-item-sequence > span {
  color: var(--orange-dark);
  font-weight: 800;
}

.chain-item-sequence strong {
  width: fit-content;
  padding: 1px 4px;
  color: #171716;
  background: var(--lime);
  font-size: 7px;
  letter-spacing: 0.06em;
}

.chain-item-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.chain-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  color: #827e76;
  font-family: var(--mono);
  font-size: 8px;
}

.player-badge {
  width: fit-content;
  padding: 1px 5px;
  color: #fff;
  background: var(--ink);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.player-badge.is-b {
  color: #171716;
  background: var(--lime);
}

.chain-item-main > strong {
  overflow-wrap: anywhere;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
}

.chain-item-main p {
  margin: 0;
  color: #4f4c47;
  font-size: 11px;
  line-height: 1.55;
}

.chain-item-main small {
  color: #8a867e;
  font-family: var(--mono);
  font-size: 8px;
}

.chain-item-order {
  color: #aaa69e;
  font-family: var(--mono);
  font-size: 9px;
}

.empty-chain {
  width: min(280px, 90%);
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 28px;
  text-align: center;
  background: rgba(255, 255, 255, 0.76);
  border: 1px dashed var(--line-strong);
}

.empty-chain > span {
  padding: 2px 7px;
  color: #fff;
  background: var(--ink);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
}

.empty-chain strong {
  font-family: var(--serif);
  font-size: 21px;
}

.empty-chain p,
.phase-control p {
  margin: 0;
  color: #6a665f;
  font-size: 11px;
  line-height: 1.65;
}

.chain-base {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.phase-control {
  display: grid;
  gap: 9px;
  padding: 13px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.primary-lab-button {
  min-height: 44px;
  padding: 8px 14px;
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
  font-weight: 750;
  cursor: pointer;
}

.primary-lab-button:hover {
  background: var(--orange);
  border-color: var(--orange);
}

.primary-lab-button.is-resolve {
  color: #171716;
  background: var(--lime);
  border-color: #b8dd38;
}

.primary-lab-button.is-resolve:hover {
  background: #c5ef3d;
}

.open-hint {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 8px 12px;
  color: #6e6a62;
  background: var(--paper-2);
  border: 1px dashed var(--line-strong);
  font-size: 11px;
  text-align: center;
}

.unit-board {
  display: grid;
  gap: 9px;
  padding: 12px;
  background: #f4f2ec;
  border-bottom: 1px solid var(--line);
}

.lab-unit {
  display: grid;
  gap: 7px;
  padding: 11px;
  background: #fff;
  border: 1px solid var(--line);
}

.lab-unit.is-gone {
  opacity: 0.55;
  filter: grayscale(1);
}

.lab-unit-head,
.lab-unit-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lab-unit-head > span:last-child {
  color: #7f7b73;
  font-family: var(--mono);
  font-size: 8px;
}

.lab-unit > strong {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 650;
}

.damage-meter {
  height: 7px;
  overflow: hidden;
  background: #e6e2d9;
}

.damage-meter > span {
  height: 100%;
  display: block;
  background: var(--orange);
  transition: width 240ms ease;
}

.lab-unit-stats {
  color: #76726b;
  font-family: var(--mono);
  font-size: 9px;
}

.lab-unit-stats b {
  color: var(--ink);
  font-size: 12px;
}

.lab-unit p {
  margin: 0;
  padding-top: 6px;
  color: #5b574f;
  border-top: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.55;
}

.reinforcement-list {
  display: grid;
  gap: 4px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.reinforcement-list span {
  padding: 4px 6px;
  color: #3f3c36;
  background: #f4f2ec;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8px;
}

.reinforcement-list span.is-destroyed {
  color: #8a867e;
  text-decoration: line-through;
  background: #e9e6de;
}

.lab-unit.is-zone {
  min-height: 138px;
  align-content: start;
}

.lab-zone-empty {
  margin: 0;
  padding: 16px 8px;
  color: #8a867e;
  background: var(--paper-2);
  border: 1px dashed var(--line-strong);
  font-size: 10px;
  text-align: center;
}

.versus-mark {
  justify-self: center;
  padding: 0 6px;
  color: #fff;
  background: var(--ink);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
}

.event-log {
  display: grid;
}

.event-log-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.event-log-heading strong {
  font-size: 11px;
}

.event-log-heading span {
  color: #8a867e;
  font-family: var(--mono);
  font-size: 8px;
}

.event-log-list {
  max-height: 480px;
  overflow-y: auto;
  padding: 3px 12px 14px;
}

.event-entry {
  display: grid;
  grid-template-columns: 9px 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.event-entry:last-child {
  border-bottom: 0;
}

.event-entry > span {
  width: 7px;
  height: 7px;
  margin-top: 7px;
  background: #8d8981;
}

.event-entry.is-resolve > span,
.event-entry.is-nullify > span {
  background: var(--orange);
}

.event-entry.is-trigger > span {
  background: var(--lime);
  border: 1px solid #9bbb2f;
}

.event-entry > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.event-entry strong {
  font-size: 10px;
}

.event-entry p {
  margin: 0;
  color: #67635c;
  font-size: 9px;
  line-height: 1.55;
}

.event-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.event-refs button {
  padding: 1px 4px;
  color: var(--orange-dark);
  background: var(--orange-soft);
  border: 1px solid #efc6b3;
  font-family: var(--mono);
  font-size: 7px;
  cursor: pointer;
}

.lab-rule-evidence {
  margin-top: 28px;
  border-top: 3px solid var(--ink);
}

.lab-rule-evidence-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--line-strong);
}

.lab-rule-evidence-head > div {
  display: grid;
  gap: 3px;
}

.lab-rule-evidence-head span {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.lab-rule-evidence-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 650;
}

.lab-rule-evidence-head button {
  color: var(--orange-dark);
}

.lab-rule-excerpts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-top: 0;
}

.lab-rule-excerpts > button {
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 15px;
  text-align: left;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.lab-rule-excerpts > button:nth-child(3n) {
  border-right: 0;
}

.lab-rule-excerpts > button:hover {
  color: #fff;
  background: var(--ink);
}

.lab-rule-excerpts span {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
}

.lab-rule-excerpts p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #55524c;
  font-size: 11px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.lab-rule-excerpts > button:hover p,
.lab-rule-excerpts > button:hover span {
  color: #e2dfd7;
}

.lab-rule-excerpts > button.has-examples {
  grid-template-rows: auto auto 1fr;
}

.lab-rule-excerpts .lab-example-preview {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 7px;
  padding-top: 9px;
  color: #625d55;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
}

.lab-example-preview b {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
}

.lab-example-preview small {
  display: -webkit-box;
  overflow: hidden;
  color: #716d65;
  font-size: 9px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.lab-example-preview i {
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-style: normal;
}

.lab-rule-excerpts > button:hover .lab-example-preview {
  border-top-color: #494741;
}

.lab-rule-excerpts > button:hover .lab-example-preview b,
.lab-rule-excerpts > button:hover .lab-example-preview small,
.lab-rule-excerpts > button:hover .lab-example-preview i {
  color: #e2dfd7;
}

@keyframes chain-item-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 1500px) {
  .chain-workbench {
    grid-template-columns: minmax(220px, 0.72fr) minmax(420px, 1.28fr);
  }

  .result-panel {
    grid-column: 1 / -1;
  }

  .unit-board {
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .event-log-list {
    max-height: 300px;
  }
}

@media (max-width: 1300px) {
  :root {
    --sidebar: 252px;
    --drawer: 400px;
  }

  .topbar {
    grid-template-columns: auto minmax(240px, 1fr) auto;
  }

  .drawer-backdrop {
    position: fixed;
    z-index: 44;
    inset: var(--topbar) 0 0 var(--sidebar);
    display: block;
    background: rgba(15, 15, 14, 0.38);
    border: 0;
    backdrop-filter: blur(2px);
  }
}

@media (max-width: 980px) {
  :root {
    --topbar: 64px;
  }

  .topbar {
    grid-template-columns: auto minmax(160px, 1fr) auto;
    gap: 10px;
    padding: 0 12px;
  }

  .brand {
    padding: 0;
    border-right: 0;
  }

  .brand-copy span,
  .search-shortcut,
  .top-action {
    display: none;
  }

  .global-search input {
    height: 40px;
    padding-right: 12px;
  }

  .mobile-nav-button {
    display: inline-flex;
    align-items: center;
  }

  .sidebar {
    width: min(330px, 88vw);
    transform: translateX(-102%);
    transition: transform 220ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 39;
    inset: var(--topbar) 0 0;
    display: block;
    background: rgba(12, 12, 11, 0.52);
    border: 0;
  }

  .main-content {
    margin-left: 0;
    padding: calc(var(--topbar) + 28px) 24px 64px;
  }

  .drawer-backdrop {
    inset: var(--topbar) 0 0;
  }

  .guide-card,
  .guide-card:nth-child(1),
  .guide-card:nth-child(5),
  .guide-card:nth-child(9) {
    grid-column: span 6;
  }

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

  .rule-diagram-stage {
    padding-inline: 28px;
  }

  .diagram-priority {
    grid-template-columns: minmax(105px, 1fr) 24px minmax(105px, 1fr) 30px minmax(105px, 1fr) 30px minmax(105px, 1fr);
    gap: 4px;
  }

  .priority-input,
  .priority-gate,
  .priority-output {
    padding: 12px;
  }

  .priority-input strong,
  .priority-gate strong,
  .priority-output strong {
    font-size: 18px;
  }
}

@media (max-width: 720px) {
  .brand-copy strong {
    display: none;
  }

  .brand-mark {
    width: 22px;
    height: 22px;
  }

  .topbar {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .main-content {
    padding-inline: 15px;
  }

  .page-heading {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .page-heading h1 {
    font-size: 42px;
  }

  .keyword-launch-button {
    width: 100%;
    min-height: 52px;
  }

  .page-heading-actions,
  .document-launch-link {
    width: 100%;
  }

  .view-switch {
    width: 100%;
  }

  .view-switch button {
    flex: 1;
    min-height: 44px;
  }

  .keyword-guide-summary,
  .keyword-guide-section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .keyword-guide-summary .result-count {
    align-self: flex-start;
  }

  .notice-strip {
    grid-template-columns: auto 1fr;
  }

  .notice-strip button {
    display: none;
  }

  .guide-overview {
    grid-template-columns: 1fr;
  }

  .guide-card,
  .guide-card:nth-child(1),
  .guide-card:nth-child(5),
  .guide-card:nth-child(9) {
    grid-column: auto;
    min-height: 190px;
  }

  .detail-hero {
    grid-template-columns: 1fr;
    padding-top: 26px;
  }

  .hero-rule-stack {
    align-self: start;
  }

  .rule-diagram {
    margin-top: 18px;
    box-shadow: 4px 4px 0 var(--paper-2);
  }

  .rule-diagram-head {
    min-height: 94px;
    align-items: flex-start;
    padding: 17px;
  }

  .rule-diagram-head h2 {
    font-size: 22px;
  }

  .rule-diagram-head button {
    min-height: 38px;
    padding: 6px 9px;
    white-space: nowrap;
  }

  .rule-diagram-stage {
    min-height: 390px;
    padding: 30px 20px;
    overflow-x: auto;
  }

  .rule-diagram-stage::before {
    inset: 10px;
  }

  .rule-diagram-foot {
    grid-template-columns: 1fr;
    gap: 11px;
    padding: 14px 16px;
  }

  .diagram-rule-links {
    justify-content: flex-start;
  }

  .diagram-priority {
    width: 100%;
    grid-template-columns: 1fr 22px 1fr;
    gap: 5px;
  }

  .priority-input,
  .priority-gate,
  .priority-output {
    min-height: 88px;
    padding: 12px;
  }

  .priority-input:first-child { grid-column: 1; }
  .diagram-priority .diagram-operator { grid-column: 2; }
  .priority-input.is-card { grid-column: 3; }
  .diagram-priority .diagram-arrow:nth-child(4) { grid-column: 1 / -1; transform: rotate(90deg); }
  .priority-gate { grid-column: 1 / -1; }
  .diagram-priority .diagram-arrow:nth-child(6) { grid-column: 1 / -1; transform: rotate(90deg); }
  .priority-output { grid-column: 1 / -1; }

  .diagram-deck {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
    gap: 11px;
  }

  .legend-anchor {
    grid-column: 1 / -1;
    min-height: 92px;
  }

  .deck-link { display: none; }
  .deck-pile { min-height: 118px; padding: 10px; }
  .deck-pile i { inset-inline: 8px; }
  .deck-check { right: auto; left: 0; bottom: -46px; }

  .diagram-timeline {
    width: 470px;
    flex: 0 0 470px;
  }

  .timeline-node > span {
    width: 58px;
    height: 58px;
  }

  .timeline-track { top: 29px; }
  .timeline-node strong { font-size: 18px; }

  .diagram-turn {
    width: 100%;
    height: 320px;
  }

  .turn-orbit { inset: 24px 13%; }
  .turn-center { width: 125px; height: 82px; }
  .turn-node { min-width: 88px; padding: 6px 8px; }
  .turn-node.node-1 { left: 0; top: 40px; }
  .turn-node.node-2 { left: 0; bottom: 46px; }
  .turn-node.node-3 { bottom: 0; }
  .turn-node.node-4 { right: 0; bottom: 49px; }
  .turn-node.node-5 { right: 0; top: 34px; }
  .turn-sweep { width: 40%; }

  .diagram-play-card {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .play-card-object,
  .play-card-result {
    min-height: 72px;
  }

  .play-card-track { gap: 1px; }
  .play-step span { width: 38px; height: 38px; }
  .play-card-track::before { top: 19px; }

  .diagram-move {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .move-zone { min-height: 112px; }
  .move-route { min-height: 44px; border-top: 0; border-left: 1px dashed #8a867d; }
  .move-route i { left: -5px; right: auto; top: auto; bottom: -2px; }
  .move-result { right: 0; bottom: -47px; }
  .moving-token { left: auto; right: 10px; top: 30px; bottom: auto; animation-name: moving-token-mobile; }

  .diagram-showdown {
    width: 100%;
    grid-template-columns: 1fr 58px 1fr;
    gap: 8px;
  }

  .showdown-player { min-height: 124px; padding: 10px; }
  .showdown-player strong { font-size: 15px; }
  .showdown-chain { top: -58px; }
  .showdown-pass { bottom: -72px; white-space: nowrap; }
  .showdown-pass b { padding: 5px; }
  .focus-token { animation-name: focus-pass-mobile; }

  .diagram-combat {
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
  }

  .combat-phase { min-height: 126px; padding: 12px; }
  .combat-phase > strong { font-size: 17px; }

  .diagram-score {
    width: 100%;
    grid-template-columns: 1fr 110px;
    gap: 10px;
  }

  .score-source { grid-column: 1; }
  .score-track { grid-column: 1 / -1; grid-row: 2; }
  .score-track i { min-height: 48px; }
  .score-gate { grid-column: 2; grid-row: 1; min-height: 70px; }
  .score-result { grid-column: 1 / -1; min-height: 70px; }

  .diagram-modes {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .mode-map { min-height: 108px; padding: 10px; }
  .mode-map > span { width: auto; }
  .mode-map small { width: auto; }
  .mode-map.is-ffa { display: flex; }
  .mode-map.is-ffa > span,
  .mode-map.is-ffa > small { width: auto; }

  .diagram-keywords {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .keyword-stream span { padding: 6px 9px; font-size: 14px; }
  .keyword-arrow { transform: rotate(90deg); }
  .keyword-index { min-height: 94px; }

  .fact-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .step-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px 14px;
  }

  .step-row p,
  .step-row .rule-chips {
    grid-column: 2;
  }

  .mode-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

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

  .keyword-tile:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .rules-toolbar {
    align-items: flex-start;
  }

  .chapter-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .chapter-filter {
    flex: 0 0 auto;
  }

  .rule-row {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 11px;
    padding-left: 7px;
  }

  .rule-page {
    display: none;
  }

  .reference-drawer {
    inset: var(--topbar) 0 0;
    width: 100%;
  }

  .original-rule {
    font-size: 19px;
  }
}

@keyframes moving-token-mobile {
  0% { opacity: 0; transform: translateY(0) scale(0.78); }
  12% { opacity: 1; }
  78%, 100% { opacity: 1; transform: translateY(166px) scale(0.78); }
}

@keyframes focus-pass-mobile {
  0%, 18% { transform: translateX(0); }
  48%, 64% { transform: translateX(32px); }
  100% { transform: translateX(0); }
}

@media (max-width: 1180px) {
  .scenario-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scenario-option:nth-child(even) {
    border-right: 0;
  }

  .scenario-option:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .scenario-option:last-child {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .chain-workbench {
    grid-template-columns: 1fr;
  }

  .result-panel {
    grid-column: auto;
  }

  .action-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .lab-rule-excerpts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lab-rule-excerpts > button:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .lab-rule-excerpts > button:nth-child(2n) {
    border-right: 0;
  }
}

@media (max-width: 720px) {
  .lab-disclaimer {
    grid-template-columns: auto 1fr;
  }

  .lab-disclaimer button {
    display: none;
  }

  .scenario-option {
    min-height: 108px;
    padding: 13px;
  }

  .scenario-brief {
    align-items: flex-start;
  }

  .scenario-brief > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .scenario-brief > button {
    min-height: 40px;
  }

  .chain-step-rail {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .chain-step-intro {
    grid-column: 1 / -1;
    min-height: 58px;
  }

  .chain-step {
    min-height: 62px;
    grid-template-columns: auto 1fr;
    padding: 8px;
  }

  .chain-step small {
    display: none;
  }

  .action-groups {
    grid-template-columns: 1fr;
  }

  .chain-stack {
    min-height: 330px;
    padding: 10px;
  }

  .chain-item {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .chain-item-order {
    display: none;
  }

  .unit-board {
    grid-template-columns: 1fr;
  }

  .lab-rule-evidence-head {
    align-items: start;
  }

  .lab-rule-evidence-head button {
    display: none;
  }

  .lab-rule-excerpts {
    grid-template-columns: 1fr;
  }

  .lab-rule-excerpts > button,
  .lab-rule-excerpts > button:nth-child(2n),
  .lab-rule-excerpts > button:nth-child(3n) {
    min-height: 132px;
    border-right: 0;
  }
}

@media (max-width: 1180px) {
  .rules-workspace {
    display: block;
  }

  .rule-row {
    grid-template-columns: 86px minmax(0, 1fr) auto;
    gap: 14px;
  }
}

@media (max-width: 860px) {
  .rules-workspace {
    display: block;
  }

  .rule-row {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 11px;
  }

  .rule-meta {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-self: start;
    gap: 8px;
  }

  .rule-page {
    display: none;
  }
}

@media (max-width: 720px) {
  .main-content.is-rules {
    padding-inline: 15px;
  }

  .rules-workspace {
    display: block;
  }

  .rules-example-rail {
    display: none;
  }

  .rule-row {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 11px;
    padding-left: 7px;
  }

  .rule-meta {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-self: start;
    gap: 8px;
  }

  .rule-page {
    display: none;
  }

  .reference-drawer.has-examples {
    width: 100%;
  }

  .original-copy-layout.has-examples {
    grid-template-columns: 1fr;
  }

  .original-examples {
    margin-top: 4px;
  }
}

@media (max-width: 760px) {
  .keyword-modal-layer {
    place-items: stretch;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: 0;
  }

  .keyword-modal {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: 0;
  }

  .keyword-modal-header {
    min-height: 116px;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 12px 13px 15px;
  }

  .keyword-modal-header h2 {
    font-size: 28px;
  }

  .keyword-modal-header p {
    max-width: 230px;
    line-height: 1.5;
  }

  .keyword-modal-actions {
    gap: 7px;
  }

  .keyword-modal-actions > span {
    display: none;
  }

  .keyword-modal-actions button {
    width: 46px;
    height: 46px;
  }

  .keyword-modal-body {
    padding: 14px 12px 24px;
  }

  .keyword-modal-range {
    padding-bottom: 10px;
  }

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

  .keyword-modal .keyword-tile {
    min-height: 88px;
    padding: 12px;
  }

  .keyword-modal .keyword-tile strong {
    font-size: 18px;
  }
}

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

@media print {
  .topbar,
  .sidebar,
  .reference-drawer,
  .drawer-backdrop,
  .rule-modal-layer,
  .keyword-modal-layer,
  .sidebar-backdrop,
  .view-switch,
  .rules-toolbar,
  .notice-strip {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }

  .content-frame {
    width: 100%;
  }

  body {
    background: #fff;
  }
}
