/* Commentarius — blätterbarer Spickzettel.
   Gilt für jedes Cheat Sheet, nicht nur für Accusatio. */

.sheet {
  width: min(1080px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Kopfleiste ---------- */

.sheet-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid rgba(180, 140, 70, 0.35);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(28, 20, 10, 0.78), rgba(20, 14, 7, 0.86));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.btn-menu { width: 42px; height: 42px; flex: 0 0 auto; }

.sheet-bar-title {
  flex: 1;
  min-width: 0;
  font-family: var(--display);
  font-size: clamp(12px, 1.7vw, 15px);
  letter-spacing: 0.2em;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-bar-count {
  flex: 0 0 auto;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--gold);
}

/* ---------- Seitenfläche ---------- */

.sheet-stage {
  position: relative;
  min-height: 62vh;
  padding: 30px 34px 34px;
  border: 1px solid rgba(120, 88, 40, 0.5);
  border-radius: 4px;
  background: linear-gradient(180deg, var(--parchment-top), var(--parchment-bottom));
  box-shadow: var(--shadow-panel), var(--frame-inset);
}

.sheet-page { display: none; }
.sheet-page.is-current { display: block; animation: leaf-in 220ms ease both; }

@keyframes leaf-in {
  from { opacity: 0; transform: translateX(var(--leaf-from, 14px)); }
  to   { opacity: 1; transform: none; }
}

.sheet-stage.is-back { --leaf-from: -14px; }

.kicker {
  font-family: var(--display);
  font-size: 11.5px;
  letter-spacing: 0.28em;
  color: var(--brass);
}

.sheet-page h2 {
  margin: 6px 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(21px, 3.2vw, 30px);
  letter-spacing: 0.08em;
  color: var(--ink);
}

.sheet-page > .lede {
  margin: 10px 0 0;
  font-size: 18px;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink-faint);
}

.rulebar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 0;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--rule);
}

.sheet-page h3 {
  margin: 26px 0 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(15px, 2vw, 18px);
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.sheet-page p { margin: 8px 0; font-size: 17px; line-height: 1.55; }

.sheet-page ul { margin: 8px 0; padding-left: 22px; }
.sheet-page li { margin: 5px 0; font-size: 17px; line-height: 1.5; }
.sheet-page li::marker { color: var(--brass); }

.sheet-page strong { color: var(--ink); font-weight: 600; }

/* ---------- Bausteine ---------- */

.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.block {
  padding: 14px 16px 16px;
  border: 1px solid var(--rule-faint);
  border-left: 3px solid var(--brass);
  border-radius: 3px;
  background: rgba(255, 252, 244, 0.5);
}

.block h3 { margin-top: 0; }
.block > :last-child { margin-bottom: 0; }

.block--bad { border-left-color: #a3231f; }
.block--good { border-left-color: #2e6d34; }

/* Ablaufkette auf der Übersichtsseite. */
.flow { display: flex; flex-direction: column; margin-top: 18px; }

.flow-step {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-faint);
}

.flow-step:last-child { border-bottom: none; }

.flow-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--brass);
  border-radius: 50%;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  color: var(--brass);
  background: rgba(255, 252, 244, 0.6);
}

.flow-step--aside .flow-num {
  border-style: dashed;
  color: var(--ink-faint);
  border-color: var(--ink-faint);
  font-size: 13px;
}

.flow-body { min-width: 0; }

.flow-title {
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.1em;
  color: var(--ink);
}

.flow-desc { margin: 3px 0 0; font-size: 16px; color: var(--ink-faint); line-height: 1.45; }

/* Formeln und Würfe. */
.formula {
  margin: 14px 0;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: rgba(61, 42, 17, 0.06);
  font-family: var(--display);
  font-size: clamp(14px, 2vw, 19px);
  letter-spacing: 0.04em;
  color: var(--ink);
  text-align: center;
  line-height: 1.7;
}

.formula em { font-style: normal; color: var(--brass); }

.callout {
  display: flex;
  gap: 12px;
  margin: 16px 0 0;
  padding: 13px 16px;
  border: 1px solid rgba(163, 35, 31, 0.35);
  border-radius: 3px;
  background: rgba(163, 35, 31, 0.07);
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--ink);
}

.callout::before {
  content: "!";
  flex: 0 0 auto;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(163, 35, 31, 0.6);
  border-radius: 50%;
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  color: #a3231f;
}

.callout--note { border-color: var(--rule); background: rgba(120, 88, 40, 0.08); }

.callout--note::before {
  content: "\00B7";
  border-color: var(--brass);
  color: var(--brass);
  font-size: 20px;
}

.callout p { margin: 0; font-size: inherit; }
.callout p + p { margin-top: 6px; }

/* Ergebnistabelle. */
.outcome {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 16.5px;
}

.outcome th, .outcome td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--rule-faint);
  vertical-align: top;
}

.outcome th {
  font-family: var(--display);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--rule);
}

.outcome th:first-child,
.outcome td:first-child {
  /* schrumpft auf den Inhalt, damit kurze Werte nicht in der Mitte schweben */
  width: 1%;
  white-space: nowrap;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.table-wrap { overflow-x: auto; }

/* ---------- Regelverweis mit Popover ---------- */

.rule {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px 2px;
  border: 1px solid rgba(138, 90, 27, 0.45);
  border-radius: 2px;
  background: rgba(138, 90, 27, 0.09);
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--brass);
  cursor: help;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.rule:hover,
.rule:focus-visible,
.rule.is-open {
  background: var(--brass);
  border-color: var(--brass);
  color: #fdf6e6;
  outline: none;
}

.rule--missing { border-style: dashed; opacity: 0.6; cursor: default; }

.rule-popover {
  position: fixed;
  z-index: 60;
  width: min(460px, calc(100vw - 24px));
  max-height: min(52vh, 460px);
  border: 1px solid rgba(180, 140, 70, 0.5);
  border-radius: 4px;
  background: linear-gradient(180deg, #f6ecd6, #eaddc0);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: none;
}

.rule-popover.is-open { display: flex; flex-direction: column; }

.rule-popover-head {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  background: rgba(120, 88, 40, 0.12);
}

.rule-popover-id {
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--brass);
}

.rule-popover-title {
  flex: 1;
  min-width: 0;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-popover-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 16px 14px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}

.rule-popover-body p { margin: 0 0 9px; }
.rule-popover-body p:last-child { margin-bottom: 0; }
.rule-popover-body ul { margin: 0 0 9px; padding-left: 20px; }
.rule-popover-body li { margin: 4px 0; }

.rule-popover-foot {
  flex: 0 0 auto;
  padding: 7px 14px 8px;
  border-top: 1px solid var(--rule-faint);
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}

/* ---------- Blättern ---------- */

.sheet-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.sheet-nav .tile-btn { width: 58px; height: 58px; }

.dots { display: flex; align-items: center; gap: 9px; }

.dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1px solid rgba(203, 171, 110, 0.75);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}

.dot:hover { background: rgba(203, 171, 110, 0.5); }
.dot.is-current { background: var(--gold); transform: scale(1.25); }
.dot:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- Sidemenü ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 7, 3, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.scrim.is-open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: min(340px, 86vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(180, 140, 70, 0.45);
  background: linear-gradient(180deg, #1d150b, #120c06);
  box-shadow: 20px 0 60px rgba(0, 0, 0, 0.6);
  transform: translateX(-100%);
  /* visibility mitschalten, sonst bleibt das geschlossene Menue tabbar. */
  visibility: hidden;
  transition: transform 220ms ease, visibility 0s linear 220ms;
}

.drawer.is-open {
  transform: none;
  visibility: visible;
  transition: transform 220ms ease, visibility 0s;
}

.drawer-head {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(180, 140, 70, 0.3);
}

.drawer-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.18em;
  color: var(--cream);
}

.drawer-sub {
  margin-top: 5px;
  font-family: var(--display);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  color: var(--gold);
}

.drawer-list {
  flex: 1 1 auto;
  overflow-y: auto;
  margin: 0;
  padding: 8px 0;
  list-style: none;
}

.drawer-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: baseline;
  width: 100%;
  padding: 11px 20px;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.drawer-item:hover { background: rgba(203, 171, 110, 0.1); }

.drawer-item.is-current {
  border-left-color: var(--gold);
  background: rgba(203, 171, 110, 0.14);
}

.drawer-item:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.drawer-num {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
}

.drawer-item.is-current .drawer-num { color: var(--gold); }

.drawer-label {
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: #d9c8a4;
  line-height: 1.35;
}

.drawer-item.is-current .drawer-label { color: var(--cream); }

.drawer-kicker {
  display: block;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--gold-dim);
  margin-bottom: 2px;
}

.drawer-foot {
  flex: 0 0 auto;
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(180, 140, 70, 0.3);
}

.drawer-foot a {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--gold-dim);
  text-decoration: none;
}

.drawer-foot a:hover { color: var(--gold); }

/* ---------- Schmale Viewports ---------- */

@media (max-width: 700px) {
  .sheet-stage { min-height: 0; padding: 22px 18px 26px; }
  .sheet-nav .tile-btn { width: 50px; height: 50px; }
  .sheet-nav { gap: 14px; }
  .dots { gap: 7px; }
  .sheet-page p, .sheet-page li { font-size: 16px; }
  .flow-step { grid-template-columns: 40px 1fr; gap: 12px; }
}

/* Nummerierte Listen und Inline-Code auf den Seiten. */
.sheet-page ol { margin: 8px 0; padding-left: 22px; }
.sheet-page ol li { margin: 5px 0; font-size: 17px; line-height: 1.5; }
.sheet-page ol li::marker { font-family: var(--display); color: var(--brass); }

.sheet-page code {
  padding: 1px 5px;
  border: 1px solid var(--rule-faint);
  border-radius: 2px;
  background: rgba(120, 88, 40, 0.08);
  font-family: 'Courier New', monospace;
  font-size: 0.88em;
  color: var(--ink-soft);
}
