:root {
  color-scheme: dark;
  --page-bg: #11100d;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.stage-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-width: 320px;
  min-height: 420px;
  isolation: isolate;
  background:
    linear-gradient(180deg, #18242b 0%, #20291f 54%, #11100d 100%);
}

.stage-shell::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
  box-shadow:
    inset 0 0 112px rgba(0, 0, 0, 0.52),
    inset 0 -54px 130px rgba(31, 35, 20, 0.42);
}

#game {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.hud {
  --iron: #171b18;
  --iron-deep: #090c0b;
  --vellum: #ded0a7;
  --vellum-dim: #aa9d7c;
  --bronze: #b9934d;
  --bronze-bright: #e2c77c;
  --player-color: #73ead5;
  --enemy-color: #d97aef;
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  color: var(--vellum);
  font: 13px/1.25 Georgia, "Times New Roman", serif;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.92);
}

.hud *,
.arcane-announcement * {
  letter-spacing: 0;
}

.hud button {
  color: inherit;
  font: inherit;
}

.hud-zone {
  transition: opacity 180ms ease, transform 180ms ease;
}

.hud-zone.occluded {
  opacity: 0.2 !important;
}

.hud-zone.occluded:hover,
.hud-zone.occluded:focus-within {
  opacity: 0.9 !important;
}

.hud-interactive {
  pointer-events: auto;
}

.hud-caption {
  margin: 0 0 7px 2px;
  color: #d5c798;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Active effects live away from the navigation side of the screen. */
.active-spell-stack {
  position: absolute;
  top: 20px;
  left: 20px;
  width: min(292px, calc(100vw - 92px));
  opacity: 0;
  transform: translateX(-10px);
}

.active-spell-stack.has-content {
  opacity: 1;
  transform: translateX(0);
}

.active-spells {
  display: grid;
  gap: 5px;
}

.active-spell {
  --spell-rgb: 130, 255, 224;
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 38px;
  padding: 5px 10px 5px 7px;
  overflow: hidden;
  border: 1px solid rgba(var(--spell-rgb), 0.44);
  border-left: 3px solid rgb(var(--spell-rgb));
  border-radius: 2px;
  background:
    linear-gradient(90deg, rgba(var(--spell-rgb), 0.16), rgba(8, 12, 10, 0.88) 42%, rgba(8, 12, 10, 0.72));
  box-shadow:
    0 5px 15px rgba(0, 0, 0, 0.34),
    inset 0 0 18px rgba(var(--spell-rgb), 0.05);
}

.active-spell::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--timer-progress, 100%);
  height: 2px;
  content: "";
  background: rgb(var(--spell-rgb));
  box-shadow: 0 0 8px rgba(var(--spell-rgb), 0.72);
  transition: width 420ms linear;
}

.active-spell-sigil {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(var(--spell-rgb), 0.72);
  color: rgb(var(--spell-rgb));
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  transform: rotate(45deg);
}

.active-spell-sigil > span {
  transform: rotate(-45deg);
}

.active-spell-copy {
  min-width: 0;
}

.active-spell-name {
  display: block;
  overflow: hidden;
  color: #f1ead2;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-spell-note {
  display: block;
  margin-top: 1px;
  color: rgba(var(--spell-rgb), 0.82);
  font: 9px/1.1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

.active-time {
  min-width: 42px;
  color: rgb(var(--spell-rgb));
  font: 700 12px/1 ui-monospace, Consolas, monospace;
  text-align: right;
}

.ward-lock-status {
  padding: 8px 10px;
  border: 1px solid rgba(116, 236, 216, 0.52);
  border-left: 3px solid #7ff1da;
  border-radius: 2px;
  background: rgba(7, 25, 23, 0.9);
  color: #b9fff1;
  font-size: 11px;
  font-weight: 700;
}

/* Duel health remains visible but occupies the quiet lower-left corner. */
.duel-status {
  position: absolute;
  bottom: 18px;
  left: 20px;
  width: 300px;
  padding: 9px 12px 10px;
  border-top: 1px solid rgba(221, 195, 126, 0.58);
  border-bottom: 1px solid rgba(97, 77, 41, 0.8);
  background:
    linear-gradient(100deg, rgba(9, 13, 12, 0.92), rgba(16, 18, 14, 0.78) 75%, rgba(16, 18, 14, 0));
  filter: drop-shadow(0 7px 10px rgba(0, 0, 0, 0.38));
}

.duel-status::before,
.duel-status::after {
  position: absolute;
  left: 0;
  width: 78px;
  height: 1px;
  content: "";
  background: var(--bronze-bright);
  box-shadow: 0 0 8px rgba(218, 183, 99, 0.28);
}

.duel-status::before {
  top: -1px;
}

.duel-status::after {
  bottom: -1px;
  opacity: 0.5;
}

.combatant-status {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.combatant-status + .combatant-status {
  margin-top: 8px;
}

.wizard-mark {
  width: 13px;
  height: 13px;
  justify-self: center;
  border: 1px solid currentColor;
  color: var(--player-color);
  transform: rotate(45deg);
  box-shadow: 0 0 8px currentColor, inset 0 0 5px currentColor;
}

.wizard-mark::after {
  display: block;
  width: 5px;
  height: 5px;
  margin: 3px;
  content: "";
  background: currentColor;
}

.enemy-mark {
  color: var(--enemy-color);
}

.combatant-vitals {
  min-width: 0;
}

.combatant-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}

.status-name {
  min-width: 0;
  overflow: hidden;
  color: #eee5c9;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-value {
  flex: 0 0 auto;
  color: #cfc09a;
  font: 700 11px/1 ui-monospace, Consolas, monospace;
}

.vital-bar,
.stamina-track {
  position: relative;
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(210, 186, 121, 0.3);
  border-radius: 1px;
  background: rgba(0, 0, 0, 0.66);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.9);
}

.vital-bar span,
.stamina-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #298f82, #75efcf);
  box-shadow: 0 0 9px rgba(105, 237, 209, 0.48);
  transition: width 180ms ease;
}

.enemy-vital span {
  background: linear-gradient(90deg, #7d397b, #dd83e6);
}

.vital-bar span.heal-pulse {
  animation: heal-flash 520ms ease-out;
}

@keyframes heal-flash {
  0% { filter: brightness(2.3); }
  100% { filter: brightness(1); }
}

/* Dash appears only while spent, charging, or in use. */
.status-row.stamina {
  position: absolute;
  left: 50%;
  bottom: 108px;
  width: 224px;
  padding: 7px 11px 9px;
  border-top: 1px solid rgba(221, 194, 117, 0.48);
  background: rgba(8, 12, 10, 0.78);
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translate(-50%, 8px);
}

.status-row.stamina.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.dash-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  color: #cdbf9a;
  font-size: 10px;
  text-transform: uppercase;
}

.dash-line b {
  color: #ecd797;
  font: 700 10px/1 ui-monospace, Consolas, monospace;
}

.stamina-track span {
  background: linear-gradient(90deg, #a1732e, #f0cb71);
  box-shadow: 0 0 9px rgba(238, 193, 91, 0.45);
}

.status-row.stamina.dashing {
  border-color: rgba(255, 221, 130, 0.8);
}

.status-row.stamina.dashing .stamina-track span {
  filter: brightness(1.35);
}

/* Spell belt: luminous stored spells, amber formulae ready to brew. */
.spell-dock {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: max-content;
  max-width: calc(100vw - 640px);
  opacity: 0;
  transform: translate(-50%, 10px);
}

.spell-dock.has-spells {
  opacity: 1;
  transform: translate(-50%, 0);
}

.spell-list {
  display: grid;
  grid-template-columns: max-content 112px max-content;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
}

.spell-wing {
  display: flex;
  align-items: flex-end;
  gap: 5px;
}

.spell-breathing-space {
  display: block;
  width: 112px;
  height: 1px;
  pointer-events: none;
}

.spell-row {
  --spell-rgb: 151, 217, 203;
  position: relative;
  display: grid;
  width: 72px;
  height: 76px;
  flex: 0 0 72px;
  grid-template-rows: 32px 1fr 14px;
  place-items: center;
  padding: 8px 4px 4px;
  overflow: hidden;
  border: 1px solid rgba(182, 157, 94, 0.42);
  border-radius: 2px;
  outline: none;
  background:
    linear-gradient(155deg, rgba(49, 45, 31, 0.91), rgba(8, 12, 11, 0.94) 62%);
  box-shadow:
    0 7px 15px rgba(0, 0, 0, 0.44),
    inset 0 0 15px rgba(223, 191, 107, 0.035);
  color: #bdb18f;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease, box-shadow 130ms ease, transform 130ms ease;
}

.spell-list.crowded .spell-row {
  width: 60px;
  height: 72px;
  flex-basis: 60px;
}

.spell-row:disabled {
  cursor: default;
}

.spell-row:hover,
.spell-row:focus-visible {
  border-color: rgba(231, 204, 133, 0.84);
  transform: translateY(-3px);
}

.spell-row.usable {
  border-color: rgba(var(--spell-rgb), 0.62);
  background:
    linear-gradient(155deg, rgba(var(--spell-rgb), 0.18), rgba(8, 12, 11, 0.94) 62%);
  box-shadow:
    0 7px 17px rgba(0, 0, 0, 0.46),
    inset 0 0 18px rgba(var(--spell-rgb), 0.08);
}

.spell-row.brewable:not(.usable) {
  border-color: rgba(226, 184, 91, 0.68);
  background:
    linear-gradient(155deg, rgba(151, 105, 36, 0.24), rgba(13, 12, 9, 0.95) 62%);
}

.spell-row.selected {
  border-color: rgb(var(--spell-rgb));
  box-shadow:
    0 0 0 1px rgba(var(--spell-rgb), 0.42),
    0 0 19px rgba(var(--spell-rgb), 0.22),
    0 9px 20px rgba(0, 0, 0, 0.56);
  transform: translateY(-7px);
}

.spell-row.selected::before {
  position: absolute;
  top: 0;
  left: 18%;
  width: 64%;
  height: 2px;
  content: "";
  background: rgb(var(--spell-rgb));
  box-shadow: 0 0 9px rgb(var(--spell-rgb));
}

.spell-row.quick::after {
  position: absolute;
  top: 3px;
  right: 4px;
  content: "R";
  color: #f4d88b;
  font: 700 9px/1 ui-sans-serif, system-ui, sans-serif;
  text-shadow: 0 0 7px rgba(242, 198, 87, 0.8);
}

.spell-key {
  position: absolute;
  top: 3px;
  left: 5px;
  color: rgba(226, 213, 174, 0.72);
  font: 700 9px/1 ui-monospace, Consolas, monospace;
}

.spell-rune {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(var(--spell-rgb), 0.62);
  color: rgb(var(--spell-rgb));
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  transform: rotate(45deg);
  box-shadow: inset 0 0 9px rgba(var(--spell-rgb), 0.12);
}

.spell-rune span {
  transform: rotate(-45deg);
}

.spell-identity {
  align-self: center;
  min-width: 0;
  width: 100%;
}

.spell-name {
  display: block;
  overflow: hidden;
  color: #e8dfc1;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spell-type {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: #93886b;
  font: 8px/1.1 ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.spell-status {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
}

.spell-badge {
  display: inline-block;
  max-width: 100%;
  padding: 2px 4px;
  overflow: hidden;
  border: 1px solid currentColor;
  border-radius: 1px;
  font: 700 8px/1 ui-sans-serif, system-ui, sans-serif;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.spell-badge.use-ready {
  color: rgb(var(--spell-rgb));
  background: rgba(var(--spell-rgb), 0.08);
}

.spell-badge.brew-ready {
  color: #e4bb63;
  background: rgba(154, 101, 25, 0.18);
}

.spell-badge.quick-ready {
  color: #e7ca83;
}

/* The prepared-spell list grows from the selected slot without obscuring the world. */
.spell-dock {
  bottom: 16px;
  display: grid;
  width: min(320px, calc(100vw - 40px));
  max-width: none;
  justify-items: stretch;
  isolation: isolate;
  pointer-events: auto;
}

.spell-dock.has-spells {
  pointer-events: auto;
}

.spell-dock.picker-open {
  z-index: 42;
  opacity: 1 !important;
}

.selected-spell {
  --spell-rgb: 151, 217, 203;
  display: grid;
  min-width: 184px;
  min-height: 48px;
  grid-template-columns: 34px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 12px;
  border: 1px solid rgba(var(--spell-rgb), 0.62);
  border-radius: 2px;
  outline: none;
  background: rgba(8, 12, 10, 0.92);
  box-shadow:
    0 9px 24px rgba(0, 0, 0, 0.48),
    inset 0 0 20px rgba(var(--spell-rgb), 0.08);
  color: #f0e6c6;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.selected-spell:hover,
.selected-spell:focus-visible,
.selected-spell[aria-expanded="true"] {
  border-color: rgb(var(--spell-rgb));
  box-shadow:
    0 0 18px rgba(var(--spell-rgb), 0.2),
    0 9px 24px rgba(0, 0, 0, 0.52);
}

.selected-spell:hover,
.selected-spell:focus-visible {
  transform: translateY(-2px);
}

.selected-spell:disabled {
  border-color: rgba(181, 153, 90, 0.48);
  cursor: default;
}

.selected-spell-rune {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(var(--spell-rgb), 0.72);
  color: rgb(var(--spell-rgb));
  font: 700 9px/1 ui-sans-serif, system-ui, sans-serif;
  transform: rotate(45deg);
  box-shadow: inset 0 0 10px rgba(var(--spell-rgb), 0.13);
}

.selected-spell-rune span {
  transform: rotate(-45deg);
}

.selected-spell-copy {
  display: block;
  min-width: 0;
}

.selected-spell-copy b,
.selected-spell-copy small {
  display: block;
  white-space: normal;
}

.selected-spell-copy b {
  color: #f0e6c6;
  font-size: 13px;
  line-height: 1.05;
}

.selected-spell-copy small {
  margin-top: 3px;
  color: rgb(var(--spell-rgb));
  font: 700 8px/1.1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

.selected-spell-disclosure {
  width: 7px;
  height: 7px;
  border-top: 1px solid rgb(var(--spell-rgb));
  border-left: 1px solid rgb(var(--spell-rgb));
  opacity: 0.74;
  transform: translateY(2px) rotate(45deg);
  transition: transform 140ms ease, opacity 140ms ease;
}

.selected-spell[aria-expanded="true"] .selected-spell-disclosure {
  opacity: 1;
  transform: translateY(-2px) rotate(225deg);
}

.spell-dock-meta {
  display: flex;
  max-width: 320px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  color: #a99c79;
  font: 700 8px/1.15 ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  text-transform: uppercase;
}

#quickSpellSummary.assigned {
  color: #e7ca83;
}

#formulaReadySummary.ready {
  color: #e4bb63;
}

.spell-picker {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 35;
  width: 304px;
  overflow: visible;
  border: 1px solid rgba(205, 172, 95, 0.68);
  border-radius: 3px;
  background:
    linear-gradient(145deg, rgba(37, 28, 17, 0.98), rgba(7, 12, 10, 0.98) 68%),
    rgba(8, 12, 10, 0.98);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.64),
    inset 0 0 0 3px rgba(191, 151, 72, 0.055),
    inset 0 0 28px rgba(0, 0, 0, 0.34);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transform-origin: right bottom;
  transition: opacity 130ms ease, transform 130ms ease, visibility 130ms ease;
}

.spell-picker::after {
  position: absolute;
  right: 26px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(205, 172, 95, 0.68);
  border-bottom: 1px solid rgba(205, 172, 95, 0.68);
  background: #0b100d;
  content: "";
  transform: rotate(45deg);
}

.spell-picker.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.spell-picker-heading {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px 6px 12px;
  border-bottom: 1px solid rgba(199, 164, 86, 0.3);
  background: linear-gradient(90deg, rgba(127, 87, 29, 0.2), rgba(7, 11, 9, 0.2));
}

.spell-picker-heading span,
.spell-picker-heading small,
.spell-picker-heading b {
  display: block;
}

.spell-picker-heading small {
  color: #9d8d67;
  font: 700 7px/1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

.spell-picker-heading b {
  margin-top: 3px;
  color: #ead9ad;
  font: 700 13px/1 Georgia, "Times New Roman", serif;
}

.spell-picker-heading kbd,
.spell-picker-meta kbd {
  display: grid;
  place-items: center;
  border: 1px solid rgba(200, 166, 90, 0.42);
  border-radius: 2px;
  background: rgba(5, 8, 7, 0.56);
  color: #b7a67d;
  font: 700 8px/1 ui-monospace, Consolas, monospace;
  box-shadow: none;
}

.spell-picker-heading kbd {
  min-width: 30px;
  min-height: 22px;
  padding: 0 5px;
}

.spell-picker-list {
  display: grid;
  max-height: min(518px, calc(100vh - 158px));
  gap: 3px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px;
  scrollbar-color: rgba(191, 154, 75, 0.55) rgba(8, 12, 10, 0.5);
  scrollbar-width: thin;
}

.spell-picker-option {
  --spell-rgb: 151, 217, 203;
  position: relative;
  display: grid;
  width: 100%;
  min-height: 46px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 5px 7px 5px 9px;
  border: 1px solid rgba(176, 149, 88, 0.26);
  border-radius: 2px;
  outline: none;
  background: rgba(9, 14, 11, 0.76);
  color: #d7ccab;
  text-align: left;
  cursor: pointer;
  transition: border-color 100ms ease, background-color 100ms ease, box-shadow 100ms ease;
}

.spell-picker-option::before {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  width: 2px;
  background: transparent;
  content: "";
}

.spell-picker-option.selected::before {
  background: rgb(var(--spell-rgb));
  box-shadow: 0 0 9px rgba(var(--spell-rgb), 0.58);
}

.spell-picker-option.selected {
  border-color: rgba(var(--spell-rgb), 0.52);
  background: rgba(var(--spell-rgb), 0.075);
}

.spell-picker-option.highlighted,
.spell-picker-option:hover,
.spell-picker-option:focus-visible {
  border-color: rgb(var(--spell-rgb));
  background: rgba(var(--spell-rgb), 0.13);
  box-shadow: inset 0 0 18px rgba(var(--spell-rgb), 0.08), 0 0 14px rgba(var(--spell-rgb), 0.12);
}

.spell-picker-option.quick {
  box-shadow: inset 0 0 0 1px rgba(231, 202, 131, 0.42), inset 0 0 18px rgba(218, 171, 77, 0.06);
}

.spell-picker-option.quick.highlighted,
.spell-picker-option.quick:hover,
.spell-picker-option.quick:focus-visible {
  box-shadow:
    inset 0 0 0 1px rgba(231, 202, 131, 0.52),
    inset 0 0 18px rgba(var(--spell-rgb), 0.1),
    0 0 14px rgba(var(--spell-rgb), 0.12);
}

.spell-picker-rune {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(var(--spell-rgb), 0.72);
  color: rgb(var(--spell-rgb));
  font: 700 8px/1 ui-sans-serif, system-ui, sans-serif;
  transform: rotate(45deg);
  box-shadow: inset 0 0 10px rgba(var(--spell-rgb), 0.11);
}

.spell-picker-rune span {
  transform: rotate(-45deg);
}

.spell-picker-copy {
  min-width: 0;
}

.spell-picker-copy b,
.spell-picker-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spell-picker-copy b {
  color: #efe3c3;
  font: 700 12px/1.05 Georgia, "Times New Roman", serif;
}

.spell-picker-copy small {
  margin-top: 3px;
  color: #92876b;
  font: 700 7px/1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

.spell-picker-meta {
  display: grid;
  min-width: 65px;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: end;
  gap: 3px 5px;
}

.spell-picker-meta kbd {
  width: 20px;
  height: 18px;
  grid-row: 1 / span 2;
}

.spell-picker-status,
.spell-picker-quick {
  justify-self: end;
  font: 700 7px/1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
  white-space: nowrap;
}

.spell-picker-status {
  color: rgb(var(--spell-rgb));
}

.spell-picker-quick {
  padding: 2px 4px;
  border: 1px solid rgba(231, 202, 131, 0.52);
  color: #efd38b;
  background: rgba(154, 104, 27, 0.18);
}

@media (max-width: 900px) {
  .spell-picker {
    right: auto;
    left: 0;
    transform-origin: left bottom;
  }

  .spell-picker::after {
    right: auto;
    left: 26px;
  }
}
/* The satchel contains only carried items and grows upward without a scrollbar. */
.ingredient-pouch {
  position: absolute;
  right: 20px;
  bottom: 176px;
  width: min(344px, calc(100vw - 40px));
  padding: 8px 10px 10px;
  border-right: 1px solid rgba(204, 171, 98, 0.46);
  border-bottom: 1px solid rgba(204, 171, 98, 0.34);
  background:
    linear-gradient(135deg, rgba(37, 28, 17, 0.9), rgba(10, 12, 10, 0.78) 76%);
  box-shadow: 7px 9px 20px rgba(0, 0, 0, 0.32);
  opacity: 0;
  transform: translateX(12px);
}

.ingredient-pouch.has-items {
  opacity: 1;
  transform: translateX(0);
}

.pouch-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
  border-bottom: 1px solid rgba(198, 164, 89, 0.22);
  padding-bottom: 5px;
  color: #d9c897;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.pouch-heading b {
  color: #9f9475;
  font: 700 9px/1 ui-sans-serif, system-ui, sans-serif;
}

.ingredient-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 9px;
}

.ingredient-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 2px 4px 2px 1px;
  border-bottom: 1px solid rgba(215, 195, 137, 0.08);
}

.ingredient-name {
  overflow: hidden;
  color: #ddd2b2;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ingredient-count {
  min-width: 15px;
  color: #efd58f;
  font: 700 10px/1 ui-monospace, Consolas, monospace;
  text-align: right;
}

.inventory-empty {
  display: none;
}

.ingredient-token {
  --ingredient-fill: #9dce79;
  --ingredient-accent: #e1f2a2;
  --ingredient-glow: rgba(156, 224, 124, 0.42);
  position: relative;
  display: inline-block;
  width: 19px;
  height: 19px;
  border: 1px solid color-mix(in srgb, var(--ingredient-accent) 70%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--ingredient-fill) 88%, #0e1510);
  box-shadow: 0 0 8px var(--ingredient-glow), inset 0 0 5px rgba(255, 255, 255, 0.12);
}

.ingredient-token::after {
  position: absolute;
  inset: 4px;
  content: "";
  background: var(--ingredient-accent);
  opacity: 0.84;
}

.ingredient-token.shape-leaf::after {
  border-radius: 80% 12% 80% 12%;
  transform: rotate(-28deg);
}

.ingredient-token.shape-mushroom::after {
  inset: 4px 3px 8px;
  border-radius: 8px 8px 3px 3px;
  box-shadow: 3px 7px 0 -1px var(--ingredient-accent);
}

.ingredient-token.shape-root::after {
  inset: 3px 7px 3px 6px;
  border-radius: 60% 40% 70% 30%;
  transform: rotate(18deg);
}

.ingredient-token.shape-moss::after {
  inset: 5px 3px 3px;
  border-radius: 50%;
  box-shadow: 4px -2px 0 -1px var(--ingredient-accent), -3px -1px 0 -1px var(--ingredient-accent);
}

.ingredient-token.shape-flower::after {
  inset: 6px;
  border-radius: 50%;
  box-shadow:
    0 -4px 0 -1px var(--ingredient-accent),
    4px 0 0 -1px var(--ingredient-accent),
    0 4px 0 -1px var(--ingredient-accent),
    -4px 0 0 -1px var(--ingredient-accent);
}

.ingredient-token.shape-thorn::after {
  inset: 3px;
  clip-path: polygon(50% 0, 62% 35%, 100% 30%, 70% 53%, 91% 88%, 56% 68%, 35% 100%, 37% 63%, 0 62%, 35% 45%);
}

.ingredient-token.shape-seed::after {
  inset: 4px 6px;
  border-radius: 55% 45% 58% 42%;
  transform: rotate(27deg);
}

/* Compass and the staff control share one small navigation instrument. */
.navigation-cluster {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: 128px;
  justify-items: center;
  gap: 6px;
}

.compass {
  position: relative;
  width: 112px;
  height: 112px;
  border: 1px solid rgba(197, 163, 88, 0.5);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(15, 26, 23, 0.88) 0 29%, rgba(8, 12, 11, 0.9) 30% 66%, rgba(62, 47, 27, 0.82) 67% 72%, rgba(9, 12, 10, 0.88) 73%);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.42),
    inset 0 0 0 3px rgba(208, 174, 96, 0.1),
    inset 0 0 24px rgba(0, 0, 0, 0.58);
}

.compass::after {
  position: absolute;
  inset: 50%;
  width: 6px;
  height: 6px;
  border: 1px solid #d8be79;
  border-radius: 50%;
  content: "";
  background: #342a1d;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 5px rgba(220, 189, 108, 0.55);
}

.compass-ring {
  position: absolute;
  inset: 50%;
}

.compass-sector {
  position: absolute;
  width: 25px;
  margin: -5px 0 0 -12px;
  color: #796f59;
  font: 700 8px/10px ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  transition: color 150ms ease, text-shadow 150ms ease;
}

.compass-sector.active {
  color: #ec8ff3;
  text-shadow: 0 0 7px rgba(226, 91, 242, 0.88);
}

.compass-sector[data-dir="N"] { transform: translate(0, -44px); }
.compass-sector[data-dir="NE"] { transform: translate(31px, -31px); }
.compass-sector[data-dir="E"] { transform: translate(44px, 0); }
.compass-sector[data-dir="SE"] { transform: translate(31px, 31px); }
.compass-sector[data-dir="S"] { transform: translate(0, 44px); }
.compass-sector[data-dir="SW"] { transform: translate(-31px, 31px); }
.compass-sector[data-dir="W"] { transform: translate(-44px, 0); }
.compass-sector[data-dir="NW"] { transform: translate(-31px, -31px); }

.compass-needle,
.compass-home-needle {
  position: absolute;
  left: -1px;
  bottom: 0;
  width: 2px;
  transform-origin: 50% 100%;
}

.compass-needle {
  height: 37px;
  margin-bottom: 0;
  background: linear-gradient(#ee91f2, rgba(214, 81, 228, 0.12));
  box-shadow: 0 0 7px rgba(228, 109, 242, 0.75);
}

.compass-needle::before {
  position: absolute;
  top: -4px;
  left: -3px;
  width: 0;
  height: 0;
  border-right: 4px solid transparent;
  border-bottom: 7px solid #f1a5f5;
  border-left: 4px solid transparent;
  content: "";
}

.compass-home-needle {
  height: 28px;
  background: linear-gradient(#72ecd5, rgba(70, 194, 172, 0.08));
  box-shadow: 0 0 7px rgba(106, 235, 211, 0.7);
}

.compass-home-needle::before {
  position: absolute;
  top: -7px;
  left: -5px;
  width: 12px;
  height: 11px;
  content: "";
  background: #9ff1da;
  clip-path: polygon(50% 0, 100% 44%, 84% 44%, 84% 100%, 16% 100%, 16% 44%, 0 44%);
  filter: drop-shadow(0 0 4px rgba(126, 246, 214, 0.82));
}

.staff-control {
  display: grid;
  width: 118px;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-top: 1px solid rgba(204, 172, 96, 0.38);
  background: rgba(9, 13, 11, 0.78);
}

.staff-control .status-name {
  font-size: 10px;
  text-transform: uppercase;
}

.staff-key {
  color: #8d8369;
  font: 700 8px/1 ui-monospace, Consolas, monospace;
}

.staff-toggle {
  position: relative;
  width: 39px;
  height: 19px;
  padding: 0;
  border: 1px solid rgba(122, 224, 201, 0.58);
  border-radius: 10px;
  background: rgba(37, 119, 101, 0.34);
  box-shadow: inset 0 0 7px rgba(75, 235, 200, 0.15);
  cursor: pointer;
}

.staff-toggle span {
  position: absolute;
  top: 3px;
  left: 23px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #a6f5df;
  box-shadow: 0 0 7px rgba(111, 244, 210, 0.86);
  transition: left 130ms ease, background 130ms ease;
}

.staff-toggle b {
  position: absolute;
  top: 5px;
  left: 5px;
  color: #b9f2e3;
  font: 700 7px/1 ui-sans-serif, system-ui, sans-serif;
}

.staff-control.dark .staff-toggle,
.weather-audio-control.muted .staff-toggle,
.music-audio-control.muted .staff-toggle {
  border-color: rgba(152, 143, 117, 0.42);
  background: rgba(35, 34, 29, 0.7);
  box-shadow: none;
}

.staff-control.dark .staff-toggle span,
.weather-audio-control.muted .staff-toggle span,
.music-audio-control.muted .staff-toggle span {
  left: 3px;
  background: #6c685a;
  box-shadow: none;
}

.staff-control.dark .staff-toggle b,
.weather-audio-control.muted .staff-toggle b,
.music-audio-control.muted .staff-toggle b {
  right: 4px;
  left: auto;
  color: #aaa086;
}

.demo-mode-control.active .staff-toggle {
  border-color: rgba(231, 190, 90, 0.7);
  background: rgba(130, 83, 23, 0.48);
}

.demo-mode-control.active .staff-toggle span {
  background: #f1cd77;
  box-shadow: 0 0 8px rgba(238, 190, 76, 0.76);
}

/* Only high-value notices appear, briefly, at the top centre. */
.notification-log {
  position: absolute;
  top: 18px;
  left: 50%;
  width: min(440px, calc(100vw - 700px));
  transform: translateX(-50%);
}

.notification {
  padding: 8px 16px;
  border-top: 1px solid rgba(221, 195, 123, 0.58);
  border-bottom: 1px solid rgba(108, 86, 43, 0.5);
  background: linear-gradient(90deg, rgba(8, 12, 10, 0), rgba(8, 12, 10, 0.91) 18% 82%, rgba(8, 12, 10, 0));
  color: #e9dfbe;
  font-size: 12px;
  text-align: center;
  animation: notification-in 180ms ease-out;
}

.notification.danger {
  border-color: rgba(229, 92, 82, 0.58);
  color: #ffb5a9;
}

.notification.success {
  border-color: rgba(104, 230, 173, 0.56);
  color: #bff7d9;
}

@keyframes notification-in {
  from { opacity: 0; transform: translateY(-7px); }
  to { opacity: 1; transform: translateY(0); }
}

.options-toggle {
  position: absolute;
  top: 17px;
  right: 18px;
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(202, 174, 103, 0.52);
  border-radius: 50%;
  background: rgba(8, 12, 10, 0.76);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.34), inset 0 0 0 3px rgba(199, 165, 84, 0.06);
  color: #cdb87d;
  cursor: pointer;
  transition: color 130ms ease, border-color 130ms ease, transform 130ms ease;
}

.options-toggle:hover,
.options-toggle:focus-visible {
  border-color: rgba(236, 208, 133, 0.9);
  color: #f0d98f;
  transform: rotate(12deg);
}

.options-toggle span {
  font: 20px/1 Georgia, serif;
}

/* Paused options screen. */
.options-menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  pointer-events: auto;
}

.options-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(2, 5, 4, 0.72);
  cursor: default;
}

.options-panel {
  position: relative;
  width: min(458px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 24px;
  overflow-y: auto;
  border: 1px solid rgba(211, 180, 102, 0.58);
  border-radius: 3px;
  background:
    linear-gradient(145deg, rgba(48, 41, 27, 0.97), rgba(11, 16, 14, 0.99) 35% 100%);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.68),
    inset 0 0 0 4px rgba(205, 174, 93, 0.045);
}

.options-panel::before {
  position: absolute;
  top: 7px;
  right: 7px;
  bottom: 7px;
  left: 7px;
  border: 1px solid rgba(204, 172, 92, 0.12);
  content: "";
  pointer-events: none;
}

.options-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(204, 173, 98, 0.27);
}

.options-kicker {
  color: #8fdfcb;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.options-header h2 {
  margin: 3px 0 0;
  color: #f0e3bb;
  font-size: 28px;
  font-weight: 400;
}

.options-close,
.spellbook-header button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(204, 173, 98, 0.4);
  border-radius: 50%;
  background: rgba(7, 10, 9, 0.64);
  color: #c9b77e;
  font: 16px/1 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
}

.options-section {
  position: relative;
  margin-top: 18px;
}

.options-section h3 {
  margin: 0 0 8px;
  color: #bda86d;
  font-size: 11px;
  text-transform: uppercase;
}

.option-row {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 4px;
  border-bottom: 1px solid rgba(220, 198, 139, 0.1);
}

.option-row > div {
  display: grid;
  gap: 2px;
}

.option-row > div > span {
  color: #e2d7b7;
  font-size: 14px;
  font-weight: 700;
}

.option-row small {
  color: #8e866f;
  font: 10px/1.2 ui-sans-serif, system-ui, sans-serif;
}

.controller-status {
  min-height: 40px;
  padding: 10px 12px;
  border-left: 2px solid rgba(123, 221, 200, 0.44);
  background: rgba(8, 15, 13, 0.48);
  color: #a9a18a;
  font: 11px/1.45 ui-sans-serif, system-ui, sans-serif;
}

.controller-status.active {
  color: #b8efdf;
}

.resume-game {
  position: relative;
  width: 100%;
  margin-top: 20px;
  padding: 11px 14px;
  border: 1px solid rgba(218, 184, 95, 0.65);
  border-radius: 2px;
  background: linear-gradient(#89652c, #5d401d);
  box-shadow: inset 0 1px rgba(255, 238, 177, 0.18), 0 5px 13px rgba(0, 0, 0, 0.3);
  color: #fff0bd;
  font-weight: 700;
  cursor: pointer;
}

.resume-game:hover,
.resume-game:focus-visible {
  border-color: #f0d17e;
  filter: brightness(1.12);
}

/* The cauldron opens a full physical grimoire, with one readable formula per leaf. */
.spellbook {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 12px 18px;
  overflow: hidden;
  color: #302317;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  letter-spacing: 0;
  text-shadow: none;
  pointer-events: auto;
}

.spellbook-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(1, 5, 5, 0.88);
  backdrop-filter: blur(4px) saturate(0.68);
  cursor: default;
}

.spellbook-volume {
  --spellbook-ink: #302317;
  --spellbook-muted: #6d5a3e;
  --spellbook-oxblood: #71332b;
  --spellbook-verdigris: #315f58;
  position: relative;
  width: min(1320px, calc(100vw - 36px));
  height: min(860px, calc(100vh - 24px));
  padding: 12px 12px 58px;
  overflow: hidden;
  border: 1px solid #916b36;
  border-radius: 9px 9px 6px 6px;
  background:
    linear-gradient(90deg, #1c110f 0%, #4c281f 4%, #2d1815 48.5%, #150d0d 50%, #2d1815 51.5%, #4c281f 96%, #1c110f 100%);
  box-shadow:
    0 34px 100px rgba(0, 0, 0, 0.86),
    0 9px 20px rgba(0, 0, 0, 0.72),
    inset 0 0 0 2px rgba(208, 157, 73, 0.25),
    inset 0 0 36px rgba(0, 0, 0, 0.78);
  isolation: isolate;
}

.spellbook-volume::after {
  position: absolute;
  inset: 6px;
  z-index: 0;
  border: 1px solid rgba(211, 169, 94, 0.34);
  border-radius: 6px;
  content: "";
  pointer-events: none;
}

.spellbook-dialog-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.spellbook-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #a87d45;
  border-radius: 50%;
  background: #2b1916;
  color: #ead7a1;
  box-shadow:
    0 2px 7px rgba(0, 0, 0, 0.62),
    inset 0 0 0 2px rgba(111, 70, 36, 0.58);
  font: 700 24px/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
}

.spellbook-close:hover,
.spellbook-close:focus-visible {
  border-color: #f0d38d;
  outline: none;
  background: #583128;
  color: #fff0bd;
  box-shadow:
    0 0 0 3px rgba(181, 139, 79, 0.25),
    0 2px 9px rgba(0, 0, 0, 0.68),
    inset 0 0 0 2px rgba(131, 86, 43, 0.68);
}

.spellbook-list {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(76, 47, 25, 0.72);
  border-radius: 5px 5px 3px 3px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: #dfcc99;
  box-shadow:
    0 0 0 2px rgba(238, 215, 159, 0.3),
    0 6px 12px rgba(0, 0, 0, 0.52),
    inset 0 -7px 0 rgba(97, 60, 29, 0.08),
    inset 0 -9px 0 rgba(244, 225, 173, 0.28);
}

.spellbook-list::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 5;
  width: 34px;
  content: "";
  background:
    linear-gradient(90deg,
      rgba(52, 31, 18, 0.3) 0%,
      rgba(70, 42, 22, 0.12) 24%,
      rgba(255, 241, 193, 0.22) 48%,
      rgba(59, 35, 19, 0.14) 70%,
      rgba(43, 27, 17, 0.31) 100%);
  transform: translateX(-50%);
  pointer-events: none;
}

.spellbook-page {
  --formula-accent: var(--spellbook-verdigris);
  position: relative;
  min-width: 0;
  overflow: hidden auto;
  padding: 34px 54px 48px;
  scrollbar-color: rgba(109, 77, 43, 0.5) transparent;
  scrollbar-width: thin;
}

.spellbook-page[data-category="offensive"] {
  --formula-accent: var(--spellbook-oxblood);
}

.spellbook-page-left {
  padding-right: 62px;
  border-radius: 5px 1px 1px 4px;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 240, 189, 0.23), transparent 28%),
    repeating-linear-gradient(0deg, rgba(74, 48, 25, 0.025) 0 1px, transparent 1px 7px),
    linear-gradient(90deg, rgba(91, 56, 27, 0.14) 0%, transparent 8%, transparent 84%, rgba(69, 42, 22, 0.14) 100%),
    #e3d1a2;
  box-shadow:
    inset 6px 0 13px rgba(76, 45, 22, 0.13),
    inset -10px 0 18px rgba(68, 40, 21, 0.11);
}

.spellbook-page-right {
  padding-left: 62px;
  border-radius: 1px 5px 4px 1px;
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 245, 204, 0.2), transparent 28%),
    repeating-linear-gradient(0deg, rgba(74, 48, 25, 0.025) 0 1px, transparent 1px 7px),
    linear-gradient(90deg, rgba(68, 41, 21, 0.15) 0%, transparent 16%, transparent 92%, rgba(94, 58, 27, 0.13) 100%),
    #e7d7aa;
  box-shadow:
    inset 10px 0 18px rgba(68, 40, 21, 0.11),
    inset -6px 0 13px rgba(76, 45, 22, 0.13);
}

.spellbook-page::after {
  position: absolute;
  right: 28px;
  bottom: 20px;
  left: 28px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(91, 61, 31, 0.25), transparent);
  pointer-events: none;
}

.spellbook-running-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 20px;
  padding: 0 44px 11px 0;
  border-bottom: 1px solid rgba(77, 48, 25, 0.31);
  gap: 14px;
  color: var(--spellbook-muted);
  font-size: 10.5px;
  font-weight: 700;
  font-variant: small-caps;
  text-transform: uppercase;
}

.spellbook-running-head span:last-child {
  color: var(--formula-accent);
}

.spellbook-card {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: calc(100% - 43px);
  flex-direction: column;
  color: var(--spellbook-ink);
}

.spellbook-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
}

.spellbook-title-copy {
  min-width: 0;
}

.spellbook-formula-number {
  display: block;
  margin-bottom: 4px;
  color: var(--formula-accent);
  font-size: 11px;
  font-weight: 700;
  font-variant: small-caps;
  text-transform: uppercase;
}

.spellbook .spell-name {
  margin: 0;
  color: #281c13;
  font: 700 34px/1.02 Georgia, "Times New Roman", serif;
  text-align: left;
  text-shadow: 0 1px rgba(255, 244, 204, 0.42);
}

.spellbook .spell-type {
  margin: 7px 0 0;
  color: var(--spellbook-muted);
  font-size: 12.5px;
  font-style: italic;
  line-height: 1.35;
}

.spellbook .spell-key {
  position: static;
  display: grid;
  width: 54px;
  height: 58px;
  flex: 0 0 54px;
  place-items: center;
  align-content: center;
  border: 1px solid rgba(82, 52, 27, 0.56);
  border-radius: 2px;
  background:
    linear-gradient(rgba(255, 246, 211, 0.38), rgba(190, 159, 103, 0.12));
  box-shadow:
    inset 0 0 0 2px rgba(255, 242, 194, 0.22),
    0 2px 0 rgba(75, 45, 23, 0.18);
  color: #3c291b;
}

.spellbook .spell-key span {
  font-size: 9px;
  font-variant: small-caps;
  font-weight: 700;
  text-transform: uppercase;
}

.spellbook .spell-key b {
  font: 700 24px/1 Georgia, "Times New Roman", serif;
}

.spellbook .recipe-text {
  margin: 18px 0 17px;
  padding: 0 0 0 14px;
  border-left: 2px solid var(--formula-accent);
  color: #3e3021;
  font: italic 15.5px/1.48 "Palatino Linotype", Palatino, Georgia, serif;
}

.spellbook-section-heading {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
  color: var(--spellbook-oxblood);
  font-size: 12px;
  font-weight: 700;
  font-variant: small-caps;
  text-transform: uppercase;
}

.spellbook-section-heading::after {
  height: 1px;
  margin-left: 11px;
  flex: 1 1 auto;
  content: "";
  background: linear-gradient(90deg, rgba(103, 60, 37, 0.36), transparent);
}

.spellbook-section-heading span::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 9px 1px 1px;
  content: "";
  background: var(--formula-accent);
  box-shadow: inset 0 0 0 1px rgba(255, 235, 173, 0.36);
  transform: rotate(45deg);
}

.spellbook-recipe {
  display: grid;
  gap: 0;
}

.recipe-chip {
  display: grid;
  min-width: 0;
  min-height: 64px;
  align-items: center;
  padding: 8px 3px;
  border-bottom: 1px solid rgba(82, 54, 29, 0.17);
  gap: 12px;
  grid-template-columns: 38px minmax(0, 1fr);
}

.recipe-chip.missing {
  filter: grayscale(0.55);
}

.recipe-chip.missing .ingredient-token {
  opacity: 0.48;
}

.recipe-chip.missing .recipe-name,
.recipe-chip.missing .ingredient-hint {
  color: #766a56;
}

.spellbook .ingredient-token {
  width: 34px;
  height: 34px;
  border-color: rgba(63, 47, 27, 0.48);
  box-shadow:
    0 1px 2px rgba(56, 35, 18, 0.25),
    inset 0 0 0 1px rgba(255, 244, 204, 0.24),
    0 0 9px var(--ingredient-glow);
}

.recipe-details {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.recipe-name {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: #39281b;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
}

.recipe-quantity {
  flex: 0 0 auto;
  color: #765f3f;
  font-size: 11.5px;
  font-weight: 400;
  white-space: nowrap;
}

.recipe-name b {
  color: var(--formula-accent);
  font-size: 13px;
}

.ingredient-hint {
  margin: 0;
  color: #65573f;
  font: 12.5px/1.4 "Palatino Linotype", Palatino, Georgia, serif;
}

.spellbook-lore {
  margin: 17px 0 18px;
  padding: 10px 13px 10px 15px;
  border-left: 2px solid var(--formula-accent);
  background: rgba(107, 74, 38, 0.055);
  color: #51442f;
}

.spellbook-lore-label {
  display: block;
  margin-bottom: 3px;
  color: var(--formula-accent);
  font-size: 10.5px;
  font-weight: 700;
  font-variant: small-caps;
  text-transform: uppercase;
}

.spellbook-lore p {
  margin: 0;
  font-size: 13px;
  font-style: italic;
  line-height: 1.43;
}

.spellbook-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(79, 50, 27, 0.22);
  gap: 15px;
}

.spellbook-readiness {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.spellbook-readiness-title {
  color: #65412c;
  font-size: 14.5px;
  font-weight: 700;
}

.formula-ready .spellbook-readiness-title {
  color: var(--spellbook-verdigris);
}

.formula-ready .spellbook-readiness-title::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 8px 1px 1px;
  content: "";
  background: var(--spellbook-verdigris);
  box-shadow: 0 0 8px rgba(49, 95, 88, 0.28);
  transform: rotate(45deg);
}

.spellbook-readiness-detail {
  color: var(--spellbook-muted);
  font-size: 12px;
  font-style: italic;
}

.spellbook-card button {
  min-width: 122px;
  min-height: 42px;
  flex: 0 0 auto;
  padding: 8px 15px;
  border: 1px solid #9d723b;
  border-radius: 2px;
  background:
    linear-gradient(#7b3a2f, #57271f);
  box-shadow:
    inset 0 0 0 2px rgba(234, 193, 114, 0.12),
    0 2px 4px rgba(72, 43, 22, 0.28);
  color: #f2dfab;
  font: 700 15px/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
}

.spellbook-card button:hover,
.spellbook-card button:focus-visible {
  border-color: #d7ad60;
  outline: none;
  background: linear-gradient(#8d4538, #652d24);
  box-shadow:
    0 0 0 3px rgba(126, 91, 46, 0.16),
    inset 0 0 0 2px rgba(244, 205, 127, 0.16),
    0 2px 5px rgba(72, 43, 22, 0.32);
}

.spellbook-card button:disabled {
  border-color: rgba(91, 69, 45, 0.38);
  background: rgba(91, 77, 54, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 244, 203, 0.08);
  color: rgba(78, 65, 47, 0.54);
  cursor: default;
}

.spellbook-folio {
  position: absolute;
  bottom: 26px;
  z-index: 2;
  color: rgba(71, 48, 28, 0.72);
  font-size: 11px;
  font-style: italic;
}

.spellbook-page-left .spellbook-folio {
  left: 54px;
}

.spellbook-page-right .spellbook-folio {
  right: 54px;
}

.spellbook-navigation {
  position: absolute;
  bottom: 11px;
  left: 50%;
  z-index: 8;
  display: flex;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transform: translateX(-50%);
}

.spellbook-turn {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  padding: 0;
  border: 1px solid #a47b43;
  border-radius: 50%;
  background: #281714;
  color: #ead49a;
  box-shadow: inset 0 0 0 2px rgba(112, 70, 35, 0.54);
  font: 700 27px/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
}

.spellbook-turn:hover,
.spellbook-turn:focus-visible {
  border-color: #edce83;
  outline: none;
  background: #4d2b23;
  color: #fff0bd;
}

.spellbook-turn:disabled {
  border-color: rgba(133, 99, 54, 0.34);
  color: rgba(221, 199, 145, 0.28);
  cursor: default;
}

.spellbook-progress {
  display: grid;
  min-width: 184px;
  place-items: center;
  gap: 4px;
  color: #dfc98f;
  font-size: 10.5px;
  font-variant: small-caps;
  text-transform: uppercase;
}

.spellbook-markers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.spellbook-markers button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 1px solid rgba(219, 191, 125, 0.56);
  background: rgba(36, 20, 17, 0.72);
  box-shadow: none;
  cursor: pointer;
  transform: rotate(45deg);
}

.spellbook-markers button.active {
  border-color: #f0d28a;
  background: #c59650;
  box-shadow: 0 0 8px rgba(220, 180, 100, 0.34);
}

.spellbook-markers button:focus-visible {
  outline: 2px solid #f0d28a;
  outline-offset: 3px;
}

@media (max-width: 1100px) and (min-width: 761px) {
  .spellbook-page {
    padding-right: 40px;
    padding-left: 40px;
  }

  .spellbook-page-left {
    padding-right: 48px;
  }

  .spellbook-page-right {
    padding-left: 48px;
  }

  .spellbook .spell-name {
    font-size: 31px;
  }

  .spellbook .recipe-text {
    font-size: 14.5px;
  }

  .recipe-chip {
    gap: 10px;
  }

  .recipe-name {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .recipe-quantity {
    white-space: normal;
  }

  .spellbook-page-left .spellbook-folio {
    left: 40px;
  }

  .spellbook-page-right .spellbook-folio {
    right: 40px;
  }
}

@media (max-width: 760px) {
  .spellbook {
    padding: 8px;
  }

  .spellbook-volume {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 7px 7px 54px;
    border-radius: 6px;
  }

  .spellbook-close {
    top: 16px;
    right: 16px;
  }

  .spellbook-list {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .spellbook-list::before {
    display: none;
  }

  .spellbook-page {
    min-height: 650px;
    overflow: visible;
    padding: 34px 29px 52px;
  }

  .spellbook-page-left {
    padding-right: 29px;
    border-bottom: 1px solid rgba(77, 48, 25, 0.38);
  }

  .spellbook-page-right {
    padding-left: 29px;
  }

  .spellbook-running-head {
    padding-right: 45px;
  }

  .spellbook .spell-name {
    font-size: 32px;
  }

  .spellbook .recipe-text {
    font-size: 15px;
  }

  .spellbook-page-left .spellbook-folio {
    left: 29px;
  }

  .spellbook-page-right .spellbook-folio {
    right: 29px;
  }
}

@media (max-width: 520px) {
  .spellbook-page {
    min-height: 680px;
    padding-right: 21px;
    padding-left: 21px;
  }

  .spellbook-running-head {
    align-items: flex-start;
    padding-right: 40px;
    flex-direction: column;
    gap: 3px;
  }

  .spellbook .spell-name {
    font-size: 29px;
  }

  .spellbook .spell-key {
    width: 48px;
    height: 53px;
    flex-basis: 48px;
  }

  .recipe-name {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .recipe-quantity {
    white-space: normal;
  }

  .spellbook-action {
    align-items: stretch;
    flex-direction: column;
  }

  .spellbook-card button {
    width: 100%;
  }

  .spellbook-progress {
    min-width: 145px;
  }

  .spellbook-page-left .spellbook-folio {
    left: 21px;
  }

  .spellbook-page-right .spellbook-folio {
    right: 21px;
  }
}

@media (max-height: 720px) and (min-width: 761px) {
  .spellbook {
    padding: 8px 16px;
  }

  .spellbook-volume {
    height: calc(100vh - 16px);
    padding: 8px 8px 50px;
  }

  .spellbook-page {
    padding-top: 21px;
    padding-bottom: 34px;
  }

  .spellbook-running-head {
    margin-bottom: 11px;
    padding-bottom: 7px;
  }

  .spellbook .spell-name {
    font-size: 28px;
  }

  .spellbook .spell-type {
    margin-top: 4px;
    font-size: 11px;
  }

  .spellbook .spell-key {
    width: 47px;
    height: 50px;
    flex-basis: 47px;
  }

  .spellbook .spell-key b {
    font-size: 20px;
  }

  .spellbook .recipe-text {
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.36;
  }

  .recipe-chip {
    min-height: 51px;
    padding: 5px 3px;
  }

  .spellbook .ingredient-token {
    width: 30px;
    height: 30px;
  }

  .recipe-name {
    font-size: 13.5px;
  }

  .ingredient-hint {
    font-size: 11.5px;
    line-height: 1.3;
  }

  .spellbook-lore {
    margin: 10px 0;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .spellbook-lore p {
    font-size: 11.8px;
    line-height: 1.34;
  }

  .spellbook-action {
    padding-top: 9px;
  }

  .spellbook-card button {
    min-height: 36px;
    font-size: 13.5px;
  }

  .spellbook-folio {
    bottom: 17px;
  }
}

.arcane-announcement {
  position: absolute;
  top: 84px;
  left: 50%;
  z-index: 8;
  width: min(520px, calc(100vw - 48px));
  padding: 13px 20px 14px;
  border-top: 1px solid rgba(137, 235, 217, 0.52);
  border-bottom: 1px solid rgba(208, 172, 93, 0.42);
  background: rgba(11, 8, 15, 0.82);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.42), inset 0 0 28px rgba(83, 181, 169, 0.08);
  color: #e8fff7;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  transform: translate(-50%, -12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 240ms ease, transform 300ms ease, visibility 0s linear 300ms;
  pointer-events: none;
}

.arcane-announcement.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}

.arcane-announcement[data-team="enemy"] {
  border-top-color: rgba(236, 116, 255, 0.58);
  color: #ffe9ff;
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.42), inset 0 0 30px rgba(214, 69, 235, 0.11);
}

.arcane-announcement-title {
  color: #d5fff5;
  font: 700 19px/1.1 Georgia, "Times New Roman", serif;
}

.arcane-announcement[data-team="enemy"] .arcane-announcement-title {
  color: #ffd9ff;
}

.arcane-announcement-message {
  margin-top: 5px;
  color: #cfccb9;
  font: 12px/1.35 ui-sans-serif, system-ui, sans-serif;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .spell-dock {
    right: 20px;
    bottom: 105px;
    left: 20px;
    width: auto;
    max-width: none;
    transform: translateY(10px);
  }

  .spell-dock.has-spells {
    transform: translateY(0);
  }

  .spell-list {
    display: flex;
    overflow: hidden;
    justify-content: center;
  }

  .spell-breathing-space {
    flex: 0 0 92px;
    width: 92px;
  }

  .status-row.stamina {
    bottom: 190px;
  }

  .ingredient-pouch {
    bottom: 174px;
  }

  .notification-log {
    width: min(410px, calc(100vw - 430px));
  }
}

@media (max-width: 760px) {
  .duel-status {
    top: 10px;
    right: 58px;
    bottom: auto;
    left: 10px;
    width: auto;
    padding: 7px 9px;
  }

  .combatant-status + .combatant-status {
    margin-top: 5px;
  }

  .active-spell-stack {
    top: 98px;
    left: 10px;
    width: 230px;
  }

  .active-spell {
    min-height: 34px;
  }

  .hud-caption {
    display: none;
  }

  .options-toggle {
    top: 10px;
    right: 10px;
  }

  .notification-log {
    top: 91px;
    right: 10px;
    left: auto;
    width: min(250px, calc(100vw - 20px));
    transform: none;
  }

  .navigation-cluster {
    right: 8px;
    bottom: 86px;
    transform: scale(0.8);
    transform-origin: right bottom;
  }

  .ingredient-pouch {
    right: 10px;
    bottom: 205px;
    width: min(300px, calc(100vw - 20px));
  }

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

  .spell-dock {
    right: 8px;
    bottom: 9px;
    left: 8px;
  }

  .spell-list {
    justify-content: flex-start;
    overflow-x: auto;
    padding-top: 8px;
    scrollbar-width: none;
  }

  .spell-breathing-space {
    display: none;
  }

  .spell-list::-webkit-scrollbar {
    display: none;
  }

  .spell-row {
    width: 62px;
    height: 68px;
    flex-basis: 62px;
  }

  .status-row.stamina {
    bottom: 89px;
    width: 184px;
  }


  .arcane-announcement {
    top: auto;
    right: 12px;
    bottom: 88px;
    left: 12px;
    width: auto;
    transform: translateY(12px);
  }

  .arcane-announcement.active {
    transform: translateY(0);
  }
}

@media (max-height: 680px) and (min-width: 761px) {
  .ingredient-pouch {
    bottom: 142px;
  }

  .navigation-cluster {
    transform: scale(0.82);
    transform-origin: right bottom;
  }

  .spell-row {
    height: 68px;
  }

  .status-row.stamina {
    bottom: 94px;
  }
}

@media (max-width: 1180px) {
  .spell-dock,
  .spell-dock.has-spells {
    right: auto;
    bottom: 14px;
    left: 50%;
    width: min(320px, calc(100vw - 40px));
    max-width: none;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 760px) {
  .spell-dock,
  .spell-dock.has-spells {
    right: auto;
    bottom: 8px;
    left: 50%;
    width: min(250px, calc(100vw - 24px));
    transform: translate(-50%, 0);
  }

  .selected-spell {
    min-width: 168px;
    min-height: 44px;
    grid-template-columns: 30px minmax(108px, 1fr);
    padding: 6px 10px;
  }

  .selected-spell-rune {
    width: 25px;
    height: 25px;
  }

  .spell-dock-meta {
    max-width: 250px;
    font-size: 7px;
  }

  .spell-picker {
    width: min(286px, calc(100vw - 24px));
  }

  .spell-picker-list {
    max-height: min(468px, calc(100vh - 132px));
  }

  .spell-picker-option {
    min-height: 44px;
    grid-template-columns: 29px minmax(0, 1fr) auto;
    gap: 7px;
    padding: 5px 6px 5px 8px;
  }

  .spell-picker-rune {
    width: 23px;
    height: 23px;
    font-size: 7px;
  }

  .spell-picker-copy b {
    font-size: 11px;
  }

  .spell-picker-meta {
    min-width: 59px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hud-zone,
  .spell-row,
  .spell-picker,
  .spell-picker-option,
  .notification,
  .options-toggle,
  .active-spell::after {
    animation: none;
    transition: none;
  }
}
.performance-monitor {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 1200;
  min-width: 292px;
  padding: 10px 12px;
  border: 1px solid rgba(225, 190, 104, 0.62);
  border-radius: 6px;
  background: rgba(7, 11, 10, 0.9);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.38);
  color: #d9d5c6;
  font: 12px/1.45 Consolas, "Courier New", monospace;
  letter-spacing: 0;
  white-space: pre;
  pointer-events: none;
}

.performance-monitor[data-status="pass"] {
  border-color: rgba(111, 219, 167, 0.75);
  color: #dff5e8;
}

.performance-monitor[hidden] {
  display: none;
}
.realm-pending .hud,
.realm-arriving .hud {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.realm-arriving .hud {
  transition: opacity 700ms ease, visibility 0s linear 700ms;
}

.realm-gate {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(3, 8, 7, 0.68);
  box-shadow: inset 0 0 180px rgba(0, 0, 0, 0.74);
  color: #eee4c5;
  text-align: center;
  transition: opacity 650ms ease, visibility 0s linear 650ms;
}

.realm-gate.departing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.realm-gate-content {
  width: min(760px, 100%);
  transform: translateY(-2vh);
}

.realm-gate-kicker {
  display: block;
  margin-bottom: 12px;
  color: #b99b5a;
  font: 700 12px/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

.realm-gate h1 {
  margin: 0;
  color: #f3e9ca;
  font: 700 58px/1 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.9), 0 0 26px rgba(95, 192, 166, 0.18);
}

.realm-gate p {
  max-width: 620px;
  margin: 19px auto 28px;
  color: #c9c3ad;
  font: 16px/1.55 Georgia, "Times New Roman", serif;
}

.realm-gate-actions {
  display: grid;
  width: min(280px, 100%);
  gap: 10px;
  margin: 0 auto;
}

.enter-realm,
.open-instructions,
.option-action {
  min-height: 44px;
  border: 1px solid #9d7935;
  border-radius: 2px;
  background: linear-gradient(180deg, #73501c, #4f3414);
  color: #f2dfab;
  box-shadow: inset 0 1px rgba(255, 231, 164, 0.12), 0 5px 18px rgba(0, 0, 0, 0.28);
  font: 700 15px/1 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  cursor: pointer;
}

.open-instructions,
.option-action {
  background: rgba(8, 15, 13, 0.88);
}

.enter-realm:hover,
.enter-realm:focus-visible,
.open-instructions:hover,
.open-instructions:focus-visible,
.option-action:hover,
.option-action:focus-visible {
  border-color: #efd48a;
  outline: none;
  color: #fff4cf;
  box-shadow: 0 0 0 2px rgba(207, 173, 87, 0.18), inset 0 0 22px rgba(218, 179, 82, 0.12);
}

.option-action {
  width: 100%;
  min-height: 34px;
  margin-top: 10px;
  font-size: 12px;
}

.book-modal {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: grid;
  place-items: center;
  padding: 17px 22px;
  isolation: isolate;
  pointer-events: auto;
}

.book-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(1, 5, 5, 0.86);
  backdrop-filter: blur(3px) saturate(0.72);
  cursor: default;
}

.ancient-book {
  --book-ink: #302317;
  --book-muted: #6d5a3e;
  --book-oxblood: #6d3029;
  --book-verdigris: #315f58;
  position: relative;
  width: min(1120px, calc(100vw - 44px));
  height: min(790px, calc(100vh - 34px));
  padding: 11px;
  overflow: hidden;
  border: 1px solid #8f6a37;
  border-radius: 8px 8px 5px 5px;
  background:
    linear-gradient(90deg, #211411 0%, #4b271e 5%, #2c1815 48.5%, #160f0e 50%, #2c1815 51.5%, #4b271e 95%, #211411 100%);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.82),
    0 8px 18px rgba(0, 0, 0, 0.68),
    inset 0 0 0 2px rgba(202, 151, 70, 0.24),
    inset 0 0 28px rgba(0, 0, 0, 0.72);
  color: var(--book-ink);
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  letter-spacing: 0;
}

.ancient-book::after {
  position: absolute;
  inset: 6px;
  z-index: 0;
  border: 1px solid rgba(206, 166, 94, 0.34);
  border-radius: 5px;
  content: "";
  pointer-events: none;
}

.book-close {
  position: absolute;
  top: 19px;
  right: 19px;
  z-index: 8;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #b58b4f;
  border-radius: 50%;
  background: #2b1a17;
  color: #ead7a1;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.5),
    inset 0 0 0 2px rgba(111, 70, 36, 0.58);
  font: 700 22px/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
}

.book-close:hover,
.book-close:focus-visible {
  border-color: #f0d38d;
  outline: none;
  background: #563027;
  color: #fff0bd;
  box-shadow:
    0 0 0 2px rgba(181, 139, 79, 0.26),
    0 2px 8px rgba(0, 0, 0, 0.58),
    inset 0 0 0 2px rgba(131, 86, 43, 0.68);
}

.book-pages {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(77, 47, 25, 0.66);
  border-radius: 5px 5px 3px 3px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: #dfcc99;
  box-shadow:
    0 0 0 2px rgba(238, 215, 159, 0.28),
    0 5px 10px rgba(0, 0, 0, 0.48),
    inset 0 -7px 0 rgba(97, 60, 29, 0.08),
    inset 0 -9px 0 rgba(244, 225, 173, 0.28);
}

.book-pages::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 5;
  width: 30px;
  content: "";
  background:
    linear-gradient(90deg,
      rgba(58, 36, 20, 0.24) 0%,
      rgba(70, 42, 22, 0.11) 23%,
      rgba(255, 240, 190, 0.2) 48%,
      rgba(59, 35, 19, 0.13) 70%,
      rgba(43, 27, 17, 0.28) 100%);
  transform: translateX(-50%);
  pointer-events: none;
}

.book-page {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 33px 49px 43px;
}

.book-page-left {
  padding-right: 55px;
  border-radius: 5px 1px 1px 4px;
  background:
    repeating-linear-gradient(0deg, rgba(74, 48, 25, 0.025) 0 1px, transparent 1px 7px),
    linear-gradient(90deg, rgba(91, 56, 27, 0.13) 0%, transparent 8%, transparent 84%, rgba(69, 42, 22, 0.13) 100%),
    #e3d1a2;
  box-shadow:
    inset 5px 0 12px rgba(76, 45, 22, 0.12),
    inset -9px 0 16px rgba(68, 40, 21, 0.1);
}

.book-page-right {
  padding-left: 55px;
  border-radius: 1px 5px 4px 1px;
  background:
    repeating-linear-gradient(0deg, rgba(74, 48, 25, 0.025) 0 1px, transparent 1px 7px),
    linear-gradient(90deg, rgba(68, 41, 21, 0.14) 0%, transparent 16%, transparent 92%, rgba(94, 58, 27, 0.12) 100%),
    #e7d7aa;
  box-shadow:
    inset 9px 0 16px rgba(68, 40, 21, 0.1),
    inset -5px 0 12px rgba(76, 45, 22, 0.12);
}

.book-page::after {
  position: absolute;
  right: 23px;
  bottom: 18px;
  left: 23px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(91, 61, 31, 0.22), transparent);
  pointer-events: none;
}

.book-heading {
  position: relative;
  z-index: 1;
  margin: 0 0 17px;
  padding: 0 0 17px;
  border-bottom: 1px solid rgba(77, 48, 25, 0.34);
  background: none;
  text-align: left;
}

.book-heading::after {
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 72px;
  height: 7px;
  border-right: 1px solid var(--book-verdigris);
  border-left: 1px solid var(--book-verdigris);
  content: "";
  background: linear-gradient(90deg, transparent, rgba(49, 95, 88, 0.28), transparent);
}

.book-heading span,
.book-running-head {
  color: var(--book-verdigris);
  font-size: 10px;
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0;
  text-transform: uppercase;
}

.book-heading h2 {
  margin: 4px 0;
  color: #2c2016;
  font: 700 39px/1 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  text-shadow: 0 1px rgba(255, 244, 204, 0.42);
}

.book-heading p {
  margin: 0;
  color: var(--book-muted);
  font-size: 12px;
  font-style: italic;
  line-height: 1.35;
}

.book-running-head {
  margin: 1px 40px 18px 0;
  padding: 0 0 10px;
  border-bottom: 1px solid rgba(77, 48, 25, 0.3);
  color: var(--book-muted);
  text-align: center;
}

.book-section {
  position: relative;
  z-index: 1;
}

.book-section + .book-section {
  margin-top: 14px;
}

.book-section h3 {
  display: flex;
  align-items: center;
  margin: 0 0 6px;
  color: var(--book-oxblood);
  font: 700 17px/1.18 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.book-section h3::before {
  width: 7px;
  height: 7px;
  margin-right: 9px;
  flex: 0 0 auto;
  content: "";
  background: var(--book-verdigris);
  box-shadow: inset 0 0 0 1px rgba(240, 219, 160, 0.34);
  transform: rotate(45deg);
}

.book-section h3::after {
  height: 1px;
  margin-left: 10px;
  flex: 1 1 auto;
  content: "";
  background: linear-gradient(90deg, rgba(109, 48, 41, 0.32), transparent);
}

.book-section p {
  margin: 0 0 7px;
  color: var(--book-ink);
  font-size: 13px;
  line-height: 1.45;
}

.book-section-opening > p::first-letter {
  float: left;
  margin: 4px 6px 0 0;
  color: var(--book-oxblood);
  font: 700 34px/0.72 Georgia, "Times New Roman", serif;
}

.book-marginalia,
.book-maxim {
  padding: 5px 0 5px 11px;
  border-left: 2px solid var(--book-verdigris);
  color: #51442f !important;
  font-size: 12px !important;
  font-style: italic;
  line-height: 1.38 !important;
}

.book-marginalia strong,
.book-maxim strong {
  color: var(--book-oxblood);
  font-style: normal;
  font-variant: small-caps;
}

.book-spellcraft {
  margin-bottom: 13px;
}

.book-spellcraft p {
  font-size: 12.4px;
  line-height: 1.4;
}

.book-maxim {
  margin-top: 9px !important;
  border-left-color: var(--book-oxblood);
}

.book-command-section + .book-command-section {
  margin-top: 11px;
}

.book-command-section h3 {
  margin-bottom: 4px;
  font-size: 15px;
}

.book-controls {
  display: grid;
  margin: 0;
  gap: 0;
  color: var(--book-ink);
  font-size: 11px;
}

.book-controls > div {
  display: grid;
  min-height: 25px;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px solid rgba(76, 49, 26, 0.14);
  gap: 10px;
  grid-template-columns: minmax(126px, 41%) minmax(0, 1fr);
}

.book-controls dt {
  min-width: 0;
  color: #5d3b28;
  font-weight: 700;
  line-height: 1.15;
}

.book-controls dd {
  display: flex;
  min-width: 0;
  align-items: center;
  margin: 0;
  gap: 4px;
  flex-wrap: wrap;
  color: var(--book-ink);
}

.book-controls kbd {
  display: inline-flex;
  min-height: 18px;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border: 1px solid rgba(70, 45, 25, 0.48);
  border-radius: 3px;
  background: rgba(255, 246, 206, 0.34);
  box-shadow:
    0 1px 0 rgba(72, 44, 23, 0.24),
    inset 0 0 0 1px rgba(255, 244, 201, 0.22);
  color: #39271b;
  font: 700 10px/1.35 Georgia, "Times New Roman", serif;
  white-space: nowrap;
}

.book-controls i {
  color: #806b4b;
  font-size: 9px;
  font-style: normal;
  line-height: 1;
}

.book-folio {
  position: absolute;
  bottom: 23px;
  z-index: 2;
  color: rgba(71, 48, 28, 0.72);
  font-size: 11px;
  font-style: italic;
}

.book-page-left .book-folio {
  left: 49px;
}

.book-page-right .book-folio {
  right: 49px;
}

.ancient-book {
  height: min(740px, calc(100vh - 34px));
}

.book-heading h2 {
  font-size: 42px;
}

.book-heading p {
  font-size: 13px;
}

.book-section + .book-section {
  margin-top: 16px;
}

.book-section h3 {
  font-size: 18px;
}

.book-section p {
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.book-marginalia,
.book-maxim {
  font-size: 13px !important;
  line-height: 1.42 !important;
}

.book-spellcraft p {
  font-size: 12.8px;
  line-height: 1.42;
}

.book-command-section + .book-command-section {
  margin-top: 10px;
}

.book-command-section h3 {
  font-size: 16px;
}

.book-controls {
  font-size: 11.4px;
}

.book-controls > div {
  min-height: 26px;
}

.book-controls kbd {
  font-size: 10.3px;
}
.compass-needle {
  transition: transform 180ms linear, opacity 260ms ease;
}

.compass-needle.uncertain {
  filter: saturate(0.72);
}

@media (max-width: 1100px) and (min-width: 861px) {
  .book-page {
    padding-right: 38px;
    padding-left: 38px;
  }

  .book-page-left {
    padding-right: 44px;
  }

  .book-page-right {
    padding-left: 44px;
  }

  .book-heading {
    margin-bottom: 13px;
    padding-bottom: 13px;
  }

  .book-heading h2 {
    font-size: 37px;
  }

  .book-heading p {
    font-size: 12px;
  }

  .book-section + .book-section {
    margin-top: 12px;
  }

  .book-section h3 {
    font-size: 16px;
  }

  .book-section p {
    margin-bottom: 6px;
    font-size: 13px;
    line-height: 1.42;
  }

  .book-marginalia,
  .book-maxim {
    font-size: 12px !important;
    line-height: 1.36 !important;
  }

  .book-spellcraft {
    margin-bottom: 9px;
  }

  .book-spellcraft p {
    font-size: 11.8px;
    line-height: 1.36;
  }

  .book-command-section + .book-command-section {
    margin-top: 8px;
  }

  .book-command-section h3 {
    font-size: 14.5px;
  }

  .book-controls {
    font-size: 10.8px;
  }

  .book-controls > div {
    min-height: 23px;
    padding: 2px 0;
    grid-template-columns: minmax(116px, 40%) minmax(0, 1fr);
  }

  .book-controls kbd {
    min-height: 17px;
    padding-right: 5px;
    padding-left: 5px;
    font-size: 9.6px;
  }

  .book-page-left .book-folio {
    left: 38px;
  }

  .book-page-right .book-folio {
    right: 38px;
  }
}
@media (max-width: 860px) {
  .realm-gate {
    padding: 22px;
  }

  .realm-gate h1 {
    font-size: 38px;
    line-height: 1.04;
  }

  .realm-gate p {
    font-size: 14px;
  }

  .book-modal {
    padding: 8px;
  }

  .ancient-book {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 7px;
    border-radius: 6px;
  }

  .book-close {
    top: 16px;
    right: 16px;
  }

  .book-pages {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 4px;
  }

  .book-pages::before {
    display: none;
  }

  .book-page {
    min-height: auto;
    overflow: visible;
    padding: 31px 29px 45px;
  }

  .book-page-left,
  .book-page-right {
    border-radius: 3px;
  }

  .book-page-left {
    padding-right: 29px;
    border-bottom: 1px solid rgba(77, 48, 25, 0.38);
    background:
      repeating-linear-gradient(0deg, rgba(74, 48, 25, 0.025) 0 1px, transparent 1px 7px),
      linear-gradient(90deg, rgba(91, 56, 27, 0.13), transparent 10%, transparent 92%, rgba(91, 56, 27, 0.08)),
      #e3d1a2;
  }

  .book-page-right {
    padding-left: 29px;
    background:
      repeating-linear-gradient(0deg, rgba(74, 48, 25, 0.025) 0 1px, transparent 1px 7px),
      linear-gradient(90deg, rgba(91, 56, 27, 0.09), transparent 10%, transparent 92%, rgba(91, 56, 27, 0.12)),
      #e7d7aa;
  }

  .book-heading {
    padding-right: 40px;
  }

  .book-heading h2 {
    font-size: 32px;
  }

  .book-running-head {
    margin-right: 42px;
  }

  .book-page-left .book-folio {
    left: 29px;
  }

  .book-page-right .book-folio {
    right: 29px;
  }

  .book-controls > div {
    grid-template-columns: minmax(122px, 40%) minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .book-page {
    padding-right: 22px;
    padding-left: 22px;
  }

  .book-controls > div {
    align-items: start;
    padding: 5px 0;
    gap: 4px;
    grid-template-columns: 1fr;
  }

  .book-heading {
    padding-right: 38px;
  }

  .book-heading h2 {
    font-size: 29px;
  }

  .book-page-left .book-folio {
    left: 22px;
  }

  .book-page-right .book-folio {
    right: 22px;
  }
}

@media (max-height: 720px) and (min-width: 861px) {
  .book-modal {
    padding: 8px 16px;
  }

  .ancient-book {
    height: calc(100vh - 16px);
    padding: 8px;
  }

  .book-pages {
    overflow-y: auto;
  }

  .book-page {
    overflow: visible;
    padding-top: 23px;
    padding-bottom: 35px;
  }

  .book-heading {
    margin-bottom: 11px;
    padding-bottom: 11px;
  }

  .book-heading h2 {
    font-size: 32px;
  }

  .book-heading p,
  .book-section p {
    font-size: 11.5px;
    line-height: 1.34;
  }

  .book-section + .book-section {
    margin-top: 9px;
  }

  .book-section h3 {
    margin-bottom: 4px;
    font-size: 14px;
  }

  .book-running-head {
    margin-bottom: 11px;
    padding-bottom: 7px;
  }

  .book-spellcraft {
    margin-bottom: 8px;
  }

  .book-spellcraft p,
  .book-marginalia,
  .book-maxim {
    font-size: 10.8px !important;
    line-height: 1.3 !important;
  }

  .book-command-section + .book-command-section {
    margin-top: 7px;
  }

  .book-controls > div {
    min-height: 20px;
    padding: 1px 0;
  }

  .book-controls kbd {
    min-height: 16px;
    font-size: 9px;
  }

  .book-folio {
    bottom: 18px;
  }
}
/* Arcane ledger HUD */
.duel-status > .staff-control {
  width: auto;
  margin-top: 9px;
  padding: 6px 0 0 28px;
  border-top: 1px solid rgba(204, 172, 96, 0.24);
  background: transparent;
}

.navigation-cluster {
  right: auto;
  bottom: 14px;
  left: 50%;
  width: 112px;
  gap: 0;
  transform: translateX(-50%);
}

.status-row.stamina {
  bottom: 138px;
}

.spell-dock,
.spell-dock.has-spells {
  right: auto;
  bottom: 24px;
  left: 50%;
  width: 190px;
  max-width: 190px;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(calc(-100% - 70px));
}

.spell-dock .selected-spell {
  width: 190px;
  min-width: 0;
}

.spell-dock .selected-spell:disabled {
  cursor: default;
  opacity: 0.7;
}

.quick-spell-display {
  --spell-rgb: 154, 139, 101;
  position: absolute;
  bottom: 24px;
  left: 50%;
  display: grid;
  width: 174px;
  min-height: 48px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border: 1px solid rgba(var(--spell-rgb), 0.4);
  border-radius: 2px;
  background: rgba(8, 12, 10, 0.86);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.42), inset 0 0 18px rgba(var(--spell-rgb), 0.05);
  opacity: 0.72;
  transform: translateX(70px);
}

.quick-spell-display.assigned {
  border-color: rgba(var(--spell-rgb), 0.68);
  opacity: 1;
}

.quick-spell-rune,
.ledger-spell-rune,
.index-spell-rune {
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--spell-rgb), 0.68);
  color: rgb(var(--spell-rgb));
  transform: rotate(45deg);
}

.quick-spell-rune {
  width: 27px;
  height: 27px;
  font: 700 8px/1 ui-sans-serif, system-ui, sans-serif;
}

.quick-spell-rune > span,
.ledger-spell-rune > span,
.index-spell-rune > span {
  transform: rotate(-45deg);
}

.quick-spell-copy {
  min-width: 0;
}

.quick-spell-copy small,
.quick-spell-copy b,
.quick-spell-copy > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-spell-copy small {
  color: #9f9475;
  font: 700 8px/1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

.quick-spell-copy b {
  margin-top: 3px;
  color: #eee4c5;
  font-size: 12px;
}

.quick-spell-copy > span {
  margin-top: 2px;
  color: rgba(var(--spell-rgb), 0.86);
  font: 700 7px/1.1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

.arcane-ledger {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: min(376px, calc(100vw - 40px));
  overflow: hidden;
  border: 1px solid rgba(192, 155, 78, 0.42);
  border-radius: 2px;
  background: linear-gradient(145deg, rgba(35, 27, 17, 0.95), rgba(8, 12, 10, 0.95) 72%);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.46), inset 0 0 26px rgba(204, 165, 79, 0.035);
}

.formula-ready-banner {
  display: grid;
  width: 100%;
  min-height: 54px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid rgba(195, 161, 88, 0.24);
  border-radius: 0;
  background: linear-gradient(90deg, rgba(124, 88, 34, 0.16), rgba(8, 12, 10, 0.2));
  text-align: left;
  cursor: pointer;
}

.arcane-ledger.has-formulae .formula-ready-banner {
  background: linear-gradient(90deg, rgba(174, 113, 28, 0.31), rgba(24, 19, 11, 0.74));
  box-shadow: inset 3px 0 0 #e2b75b, inset 0 0 20px rgba(213, 157, 48, 0.08);
}

.formula-ready-banner:hover,
.formula-ready-banner:focus-visible {
  outline: none;
  background-color: rgba(182, 127, 39, 0.18);
}

.formula-ready-mark {
  color: #a99669;
  font-size: 23px;
  line-height: 1;
  text-align: center;
}

.has-formulae .formula-ready-mark {
  color: #f0c76d;
  text-shadow: 0 0 10px rgba(232, 179, 62, 0.62);
}

.formula-ready-copy {
  min-width: 0;
}

.formula-ready-copy small,
.formula-ready-copy b,
.formula-ready-copy span {
  display: block;
}

.formula-ready-copy small {
  color: #96896a;
  font: 700 8px/1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

.formula-ready-copy b {
  margin-top: 3px;
  color: #e8dcba;
  font-size: 12px;
}

.has-formulae .formula-ready-copy b {
  color: #f1cc77;
}

.formula-ready-copy span {
  margin-top: 2px;
  overflow: hidden;
  color: #aca07d;
  font: 9px/1.15 ui-sans-serif, system-ui, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.formula-ready-count {
  min-width: 48px;
  padding: 4px 6px;
  border: 1px solid rgba(207, 172, 90, 0.34);
  color: #a99c79;
  font: 700 8px/1 ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  text-transform: uppercase;
}

.has-formulae .formula-ready-count {
  border-color: rgba(236, 191, 83, 0.66);
  color: #f0ca72;
  background: rgba(143, 91, 22, 0.22);
}

.ledger-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid rgba(197, 163, 88, 0.2);
}

.ledger-tabs button {
  min-width: 0;
  padding: 7px 4px;
  border: 0;
  border-right: 1px solid rgba(197, 163, 88, 0.14);
  border-radius: 0;
  background: rgba(5, 9, 8, 0.38);
  color: #9e9272;
  font: 700 9px/1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
  cursor: pointer;
}

.ledger-tabs button:last-child {
  border-right: 0;
}

.ledger-tabs button.active,
.ledger-tabs button[aria-selected="true"] {
  color: #eadcae;
  background: rgba(139, 102, 42, 0.2);
  box-shadow: inset 0 -2px 0 #caa356;
}

.ledger-tabs b {
  margin-left: 4px;
  color: #78d8c5;
  font: inherit;
}

.ledger-tabs button[data-ledger-tab="formulae"] b {
  color: #e3b957;
}

.ledger-page {
  padding: 8px 10px 10px;
}

.ledger-page[hidden] {
  display: none !important;
}

.ledger-page-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: #cfc09a;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.ledger-page-heading b {
  color: #887e64;
  font: 700 8px/1 ui-sans-serif, system-ui, sans-serif;
}

.arcane-ledger .ingredient-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.arcane-ledger .ingredient-list:empty::after {
  grid-column: 1 / -1;
  padding: 11px 4px;
  color: #8f856a;
  content: "The satchel is empty.";
  font-style: italic;
  text-align: center;
}

.ledger-spell-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.ledger-spell-row {
  --spell-rgb: 151, 217, 203;
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 50px;
  grid-template-columns: 25px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 6px 7px;
  border: 1px solid rgba(var(--spell-rgb), 0.3);
  border-radius: 1px;
  background: rgba(5, 10, 9, 0.52);
  color: #d9cfb0;
  text-align: left;
}

button.ledger-spell-row {
  cursor: pointer;
}

button.ledger-spell-row:hover,
button.ledger-spell-row:focus-visible,
.ledger-spell-row.selected {
  outline: none;
  border-color: rgba(var(--spell-rgb), 0.74);
  background: rgba(var(--spell-rgb), 0.09);
}

.ledger-spell-row.quick::after {
  position: absolute;
  top: 3px;
  right: 4px;
  color: #f0cf7c;
  content: "QUICK";
  font: 700 6px/1 ui-sans-serif, system-ui, sans-serif;
}

.ledger-spell-row.formula {
  border-color: rgba(220, 175, 74, 0.42);
  background: rgba(119, 77, 22, 0.12);
}

.ledger-spell-rune {
  width: 21px;
  height: 21px;
  font: 700 7px/1 ui-sans-serif, system-ui, sans-serif;
}

.ledger-spell-copy {
  min-width: 0;
}

.ledger-spell-copy b,
.ledger-spell-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-spell-copy b {
  color: #e9dfc0;
  font-size: 10px;
}

.ledger-spell-copy small {
  margin-top: 3px;
  color: rgba(var(--spell-rgb), 0.74);
  font: 7px/1.1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

.ledger-spell-key {
  position: absolute;
  right: 5px;
  bottom: 4px;
  color: #7e755e;
  font: 700 6px/1 ui-monospace, Consolas, monospace;
  text-transform: uppercase;
}

.ledger-formula-state {
  display: flex;
  grid-column: 1 / -1;
  justify-content: space-between;
  gap: 6px;
  margin-top: -2px;
  padding-left: 28px;
}

.ledger-formula-state b,
.ledger-formula-state small {
  color: #e4b95a;
  font: 700 7px/1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

.ledger-formula-state small {
  color: #9d9070;
}

.ledger-empty {
  grid-column: 1 / -1;
  padding: 12px 4px;
  color: #8f856a;
  font-style: italic;
  text-align: center;
}

.notification.formula {
  border-top-color: rgba(239, 194, 87, 0.78);
  color: #f2d687;
  text-shadow: 0 0 9px rgba(223, 168, 48, 0.4);
}

/* Grimoire contents spread */
.spellbook-index-card {
  height: 100%;
  color: var(--spellbook-ink);
}

.spellbook-index-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(91, 59, 31, 0.35);
  color: var(--spellbook-oxblood);
  font: 700 19px/1.1 Georgia, "Times New Roman", serif;
}

.spellbook-index-heading b {
  color: var(--spellbook-muted);
  font: 700 9px/1 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

.spellbook-index-list {
  display: grid;
  gap: 6px;
}

.spellbook-index-entry {
  --spell-rgb: 78, 105, 97;
  display: grid;
  min-height: 64px;
  grid-template-columns: 30px minmax(0, 1fr) auto 70px;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid rgba(78, 54, 31, 0.25);
  background: rgba(98, 69, 34, 0.035);
}

.spellbook-index-entry.formula-ready {
  border-color: rgba(75, 105, 79, 0.5);
  background: rgba(55, 98, 79, 0.08);
  box-shadow: inset 3px 0 0 var(--spellbook-verdigris);
}

.index-spell-rune {
  width: 24px;
  height: 24px;
  color: rgb(var(--spell-rgb));
  font: 700 7px/1 ui-sans-serif, system-ui, sans-serif;
}

.index-spell-copy {
  min-width: 0;
}

.index-formula-link {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #3a281a !important;
  font: 700 14px/1.05 Georgia, "Times New Roman", serif !important;
  text-align: left;
  cursor: pointer;
}

.index-formula-link:hover,
.index-formula-link:focus-visible {
  outline: 0;
  color: var(--spellbook-oxblood) !important;
  text-decoration: underline;
}

.index-spell-copy small,
.index-recipe {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--spellbook-muted);
  font: 700 8px/1.1 ui-sans-serif, system-ui, sans-serif;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.index-recipe {
  color: #806742;
  font-weight: 500;
  text-transform: none;
}

.index-spell-state {
  display: grid;
  min-width: 76px;
  gap: 3px;
  justify-items: end;
}

.index-readiness,
.index-stored,
.index-active {
  font: 700 8px/1 ui-sans-serif, system-ui, sans-serif;
  white-space: nowrap;
}

.index-readiness.ready {
  color: var(--spellbook-verdigris);
}

.index-readiness.missing,
.index-stored {
  color: var(--spellbook-muted);
}

.index-active {
  color: #7a4f79;
}

.index-brew {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--spellbook-oxblood);
  border-radius: 1px;
  background: #7a3a2d;
  color: #f3dfb0 !important;
  font: 700 10px/1 Georgia, "Times New Roman", serif !important;
  cursor: pointer;
}

.index-brew:hover,
.index-brew:focus-visible {
  outline: 2px solid rgba(49, 95, 88, 0.35);
}

.index-brew:disabled {
  border-color: rgba(82, 61, 40, 0.3);
  background: rgba(79, 61, 40, 0.08);
  color: rgba(72, 55, 37, 0.48) !important;
  cursor: default;
}

@media (max-width: 1180px) {
  .arcane-ledger {
    width: min(338px, calc(100vw - 32px));
  }

  .spell-dock,
  .spell-dock.has-spells {
    width: 166px;
    transform: translateX(calc(-100% - 62px));
  }

  .spell-dock .selected-spell {
    width: 166px;
  }

  .quick-spell-display {
    width: 154px;
    transform: translateX(62px);
  }
}

@media (max-width: 900px) {
  .arcane-ledger {
    right: 8px;
    bottom: 140px;
    width: min(324px, calc(100vw - 16px));
  }

  .navigation-cluster {
    bottom: 4px;
    transform: translateX(-50%) scale(0.78);
    transform-origin: center bottom;
  }

  .status-row.stamina {
    bottom: 91px;
    width: 184px;
  }

  .spell-dock,
  .spell-dock.has-spells {
    right: auto;
    bottom: 8px;
    left: 8px;
    width: 150px;
    transform: none;
  }

  .spell-dock .selected-spell {
    width: 150px;
  }

  .quick-spell-display {
    right: 8px;
    bottom: 8px;
    left: auto;
    width: 145px;
    transform: none;
  }

  .spellbook-index-entry {
    grid-template-columns: 26px minmax(0, 1fr) 64px;
  }

  .index-spell-state {
    min-width: 64px;
  }

  .index-brew {
    grid-column: 2 / -1;
    justify-self: end;
    min-height: 26px;
  }
}

@media (max-width: 620px) {
  .quick-spell-copy > span,
  .selected-spell-copy small {
    display: none;
  }

  .spell-dock,
  .spell-dock.has-spells,
  .spell-dock .selected-spell {
    width: 128px;
  }

  .quick-spell-display {
    width: 124px;
  }

  .arcane-ledger {
    bottom: 140px;
  }

  .formula-ready-copy span {
    max-width: 190px;
  }

  .ledger-spell-list {
    grid-template-columns: 1fr;
  }

  .spellbook-index-heading {
    font-size: 16px;
  }

  .spellbook-index-entry {
    min-height: 58px;
    padding: 5px 6px;
  }

  .index-recipe {
    display: none;
  }
}

@media (min-width: 761px) and (max-width: 900px) {
  .spell-dock,
  .spell-dock.has-spells {
    bottom: 140px;
    left: 20px;
  }
}

/* Generated ancient grimoire visual layer */
.spellbook {
  padding: 6px;
  color: #352416;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

.spellbook-backdrop {
  background:
    radial-gradient(circle at 50% 46%, rgba(42, 31, 20, 0.28), rgba(1, 4, 4, 0.94) 70%),
    rgba(1, 4, 4, 0.94);
  backdrop-filter: blur(5px) saturate(0.55);
}

.spellbook-volume {
  --spellbook-ink: #342315;
  --spellbook-muted: #725a3a;
  --spellbook-oxblood: #722f25;
  --spellbook-verdigris: #315e51;
  width: min(1440px, calc(100vw - 18px), calc(150vh - 18px));
  height: auto;
  aspect-ratio: 3 / 2;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: url("./assets/ui/spellbook-ancient-open.webp") center / 100% 100% no-repeat;
  box-shadow:
    0 38px 110px rgba(0, 0, 0, 0.86),
    0 12px 28px rgba(0, 0, 0, 0.72);
  isolation: isolate;
}

.spellbook-volume::before {
  position: absolute;
  inset: 1.4%;
  z-index: 0;
  border-radius: 2.5%;
  background:
    radial-gradient(ellipse at center, transparent 64%, rgba(20, 10, 6, 0.2) 100%);
  content: "";
  pointer-events: none;
}

.spellbook-volume::after {
  display: none;
}

.spellbook-list {
  position: absolute;
  inset: 6.4% 10.7% 7.3%;
  z-index: 2;
  display: grid;
  width: auto;
  height: auto;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 3.2%;
  background: transparent;
  box-shadow: none;
}

.spellbook-list::before {
  display: none;
}

.spellbook-page,
.spellbook-page-left,
.spellbook-page-right {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden auto;
  padding: 2.8% 4.3% 4.8%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  scrollbar-width: none;
}

.spellbook-page::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.spellbook-page-left {
  padding-right: 4.7%;
}

.spellbook-page-right {
  padding-left: 4.7%;
}

.spellbook-page::after {
  right: 6%;
  bottom: 2.4%;
  left: 6%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(83, 49, 25, 0.34) 20%, rgba(83, 49, 25, 0.34) 80%, transparent);
  opacity: 0.7;
}

.spellbook-running-head {
  flex: 0 0 auto;
  margin: 0 0 14px;
  padding: 0 0 8px;
  border-bottom: 1px solid rgba(82, 48, 24, 0.34);
  color: #665033;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.spellbook-running-head::after {
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 1px;
  background: rgba(116, 78, 42, 0.16);
  content: "";
}

.spellbook-running-head span:last-child {
  color: var(--formula-accent);
  font-style: italic;
}

.spellbook-card,
.spellbook-index-card {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  color: var(--spellbook-ink);
}

.spellbook-top {
  align-items: center;
  gap: 18px;
}

.spellbook-formula-number {
  margin-bottom: 3px;
  color: var(--formula-accent);
  font: italic 700 11px/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

.spellbook .spell-name {
  color: #2d1c11;
  font: 700 clamp(28px, 2.5vw, 38px)/0.98 Georgia, "Times New Roman", serif;
  text-shadow: 0 1px rgba(255, 235, 180, 0.36);
}

.spellbook .spell-name::first-letter {
  color: var(--formula-accent);
  font-size: 1.18em;
}

.spellbook .spell-type {
  margin-top: 6px;
  color: #735d3e;
  font: italic 12px/1.3 "Palatino Linotype", Palatino, Georgia, serif;
}

.spellbook .spell-key {
  width: 58px;
  height: 58px;
  flex-basis: 58px;
  border: 2px double rgba(79, 43, 23, 0.62);
  border-radius: 50%;
  background: rgba(116, 72, 35, 0.055);
  box-shadow: inset 0 0 0 3px rgba(115, 66, 31, 0.06);
  color: #4b2e1a;
  transform: rotate(3deg);
}

.spellbook .spell-key span {
  color: #795b38;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 8px;
}

.spellbook .spell-key b {
  font-size: 23px;
}

.spellbook .recipe-text {
  margin: 14px 0 15px;
  padding: 0;
  border: 0;
  color: #453320;
  font: italic 15px/1.42 "Palatino Linotype", Palatino, Georgia, serif;
}

.spellbook .recipe-text::first-letter {
  float: left;
  margin: 0 4px -2px 0;
  color: var(--spellbook-oxblood);
  font: 700 30px/0.82 Georgia, "Times New Roman", serif;
}

.spellbook-section-heading {
  margin: 0 0 5px;
  color: #6d2c23;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  letter-spacing: 0;
}

.spellbook-section-heading::after {
  background: linear-gradient(90deg, rgba(102, 57, 30, 0.48), transparent);
}

.spellbook-section-heading span::before {
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border: 1px solid var(--formula-accent);
  background: transparent;
  box-shadow: none;
}

.spellbook-recipe {
  gap: 0;
}

.recipe-chip {
  min-height: 64px;
  padding: 7px 2px;
  border-bottom: 1px dashed rgba(76, 47, 25, 0.26);
  gap: 11px;
  grid-template-columns: 38px minmax(0, 1fr);
}

.recipe-chip:last-child {
  border-bottom: 0;
}

.spellbook .ingredient-token {
  border: 1px solid rgba(73, 47, 26, 0.52);
  border-radius: 50%;
  background-color: rgba(109, 75, 40, 0.08);
  box-shadow: inset 0 0 0 2px rgba(255, 229, 166, 0.16), 0 0 8px var(--ingredient-glow);
  transform: rotate(-2deg);
}

.recipe-name {
  color: #382317;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
}

.recipe-quantity {
  color: #70583a;
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 11px;
}

.ingredient-hint {
  color: #625036;
  font: 11.8px/1.32 "Palatino Linotype", Palatino, Georgia, serif;
}

.spellbook-lore {
  width: 72%;
  margin: 13px 0 13px auto;
  padding: 7px 3px 6px 11px;
  border: 0;
  border-top: 1px solid rgba(91, 54, 29, 0.2);
  border-bottom: 1px solid rgba(91, 54, 29, 0.16);
  background: transparent;
  color: #5e4931;
  transform: rotate(-0.45deg);
}

.spellbook-lore-label {
  color: var(--formula-accent);
  font: 700 9px/1.1 "Segoe Print", "Bradley Hand", cursive;
  letter-spacing: 0;
  text-transform: none;
}

.spellbook-lore p {
  font: italic 11.8px/1.38 "Segoe Print", "Bradley Hand", "Palatino Linotype", cursive;
}

.spellbook-action {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px double rgba(80, 47, 24, 0.32);
  gap: 12px;
}

.spellbook-readiness-title {
  color: #5f3a25;
  font: 700 14px/1.12 Georgia, "Times New Roman", serif;
}

.spellbook-readiness-detail {
  color: #756043;
  font: italic 11.5px/1.2 "Palatino Linotype", Palatino, Georgia, serif;
}

.formula-ready .spellbook-readiness-title::before {
  border: 1px solid var(--spellbook-verdigris);
  background: transparent;
  box-shadow: none;
}

.spellbook-card button {
  width: 72px;
  min-width: 72px;
  height: 72px;
  min-height: 72px;
  padding: 8px;
  border: 2px solid #542018;
  border-radius: 50%;
  background:
    radial-gradient(circle at 37% 30%, #a65743, #713025 58%, #451b16 100%);
  box-shadow:
    0 3px 6px rgba(48, 26, 15, 0.36),
    inset 0 0 0 3px rgba(241, 181, 105, 0.1),
    inset 0 -4px 8px rgba(44, 16, 13, 0.26);
  color: #f0d7a1;
  font: 700 12px/1.08 Georgia, "Times New Roman", serif;
  text-shadow: 0 1px 1px rgba(42, 17, 12, 0.76);
  transform: rotate(-2deg);
}

.spellbook-card button:hover,
.spellbook-card button:focus-visible {
  border-color: #d19b55;
  background: radial-gradient(circle at 37% 30%, #b86750, #82382b 58%, #4f2019 100%);
  box-shadow:
    0 0 0 3px rgba(116, 75, 39, 0.16),
    0 4px 8px rgba(48, 26, 15, 0.38),
    inset 0 0 0 3px rgba(244, 190, 116, 0.12);
  transform: rotate(0) scale(1.04);
}

.spellbook-card button:disabled {
  border-color: rgba(78, 55, 35, 0.42);
  background: radial-gradient(circle at 38% 32%, rgba(123, 105, 72, 0.36), rgba(73, 63, 46, 0.24));
  box-shadow: inset 0 0 0 3px rgba(255, 235, 188, 0.05);
  color: rgba(68, 54, 38, 0.58);
  text-shadow: none;
  filter: grayscale(0.7);
}

.spellbook-folio {
  bottom: 1.2%;
  color: rgba(68, 43, 25, 0.7);
  font: italic 11px/1 Georgia, "Times New Roman", serif;
}

.spellbook-page-left .spellbook-folio {
  left: 4.5%;
}

.spellbook-page-right .spellbook-folio {
  right: 4.5%;
}

.spellbook-close {
  top: 2.7%;
  right: 2.5%;
  z-index: 14;
  width: 39px;
  height: 39px;
  border: 2px solid #6e4825;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 31%, #74402e, #351b17 68%, #1c0e0c);
  color: #d7b978;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.48),
    inset 0 0 0 2px rgba(197, 144, 70, 0.16);
  font-size: 22px;
}

.spellbook-close:hover,
.spellbook-close:focus-visible {
  border-color: #c89c58;
  background: radial-gradient(circle at 38% 31%, #8c4f38, #47231d 68%, #25120f);
  color: #f0d69a;
}

.spellbook-navigation {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: block;
  width: auto;
  height: auto;
  transform: none;
  pointer-events: none;
}

.spellbook-turn {
  position: absolute;
  top: 48%;
  width: 39px;
  height: 48px;
  border: 2px solid #5c3b1d;
  border-radius: 48% 52% 48% 52%;
  background:
    radial-gradient(circle at 40% 30%, #a47a3e, #66431f 62%, #34200f);
  color: #e1c27c;
  box-shadow:
    0 4px 9px rgba(0, 0, 0, 0.5),
    inset 0 0 0 2px rgba(231, 193, 113, 0.14);
  font-size: 29px;
  transform: translateY(-50%);
  pointer-events: auto;
}

#spellbookPrev {
  left: 2.3%;
}

#spellbookNext {
  right: 2.3%;
}

.spellbook-turn:hover,
.spellbook-turn:focus-visible {
  border-color: #d0a25a;
  background: radial-gradient(circle at 40% 30%, #bd914d, #785125 62%, #3e2812);
  color: #f4dea0;
}

.spellbook-turn:disabled {
  border-color: rgba(91, 61, 30, 0.52);
  background: radial-gradient(circle at 40% 30%, rgba(118, 88, 48, 0.62), rgba(54, 36, 19, 0.72));
  color: rgba(225, 194, 124, 0.34);
  filter: grayscale(0.5);
}

.spellbook-progress {
  position: absolute;
  bottom: 1.3%;
  left: 50%;
  min-width: 190px;
  gap: 3px;
  color: #d0ae69;
  font: 700 9px/1 Georgia, "Times New Roman", serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  transform: translateX(-50%);
  pointer-events: auto;
}

.spellbook-markers {
  gap: 10px;
}

.spellbook-markers button {
  width: 7px;
  height: 7px;
  border: 1px solid #9b753d;
  border-radius: 50%;
  background: #382315;
  box-shadow: inset 0 0 0 1px rgba(215, 172, 91, 0.08);
  transform: none;
}

.spellbook-markers button.active {
  border-color: #e0b966;
  background: #b8853e;
  box-shadow: 0 0 7px rgba(221, 174, 78, 0.44);
}

.spellbook-index-heading {
  margin: 0 0 4px;
  padding: 0 0 9px;
  border-bottom: 2px double rgba(88, 50, 25, 0.38);
  color: #6f2c23;
  font: 700 clamp(18px, 1.55vw, 24px)/1.05 Georgia, "Times New Roman", serif;
}

.spellbook-index-heading b {
  color: #725a3a;
  font: italic 700 9px/1 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

.spellbook-index-list {
  display: grid;
  gap: 0;
}

.spellbook-index-entry {
  --spell-rgb: 78, 105, 97;
  position: relative;
  display: grid;
  min-height: 70px;
  grid-template-columns: 38px minmax(0, 1fr) auto 62px;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px dashed rgba(77, 46, 24, 0.27);
  background: transparent;
}

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

.spellbook-index-entry.formula-ready {
  border-color: rgba(49, 94, 81, 0.38);
  background: transparent;
  box-shadow: none;
}

.spellbook-index-entry.formula-ready::before {
  position: absolute;
  top: 50%;
  left: -8px;
  width: 8px;
  height: 8px;
  border: 1px solid var(--spellbook-verdigris);
  content: "";
  transform: translateY(-50%) rotate(45deg);
}

.spellbook .index-spell-rune {
  width: 29px;
  height: 29px;
  border: 1px solid rgba(var(--spell-rgb), 0.66);
  border-radius: 50%;
  background: rgba(var(--spell-rgb), 0.04);
  color: rgb(var(--spell-rgb));
  font: 700 7px/1 Georgia, "Times New Roman", serif;
  transform: rotate(-3deg);
}

.spellbook .index-spell-rune > span {
  transform: none;
}

.index-formula-link {
  color: #352116 !important;
  font: 700 clamp(14px, 1.15vw, 17px)/1.04 Georgia, "Times New Roman", serif !important;
}

.index-formula-link:hover,
.index-formula-link:focus-visible {
  color: var(--spellbook-oxblood) !important;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.index-spell-copy small,
.index-recipe {
  margin-top: 3px;
  color: #725c3d;
  font: 700 8px/1.1 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

.index-recipe {
  color: #806846;
  font-style: italic;
  font-weight: 400;
  text-transform: none;
}

.index-spell-state {
  min-width: 72px;
  gap: 3px;
}

.index-readiness,
.index-stored,
.index-active {
  font: 700 8px/1 Georgia, "Times New Roman", serif;
}

.index-readiness.ready {
  color: var(--spellbook-verdigris);
}

.index-readiness.missing,
.index-stored {
  color: #776044;
}

.index-active {
  color: #6f4168;
}

.index-brew {
  width: 58px;
  min-width: 58px;
  height: 42px;
  min-height: 42px;
  padding: 4px;
  border: 2px solid #542018;
  border-radius: 50%;
  background: radial-gradient(circle at 37% 30%, #a65743, #713025 58%, #451b16 100%);
  color: #f3d99f !important;
  box-shadow: inset 0 0 0 2px rgba(241, 181, 105, 0.09), 0 2px 4px rgba(60, 31, 18, 0.28);
  font: 700 10px/1 Georgia, "Times New Roman", serif !important;
  text-shadow: 0 1px 1px rgba(42, 17, 12, 0.72);
  transform: rotate(-2deg);
}

.index-brew:hover,
.index-brew:focus-visible {
  border-color: #c9944e;
  outline: 0;
  transform: rotate(0) scale(1.05);
}

.index-brew:disabled {
  width: 62px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(70, 55, 38, 0.55) !important;
  font-size: 8px !important;
  font-style: italic !important;
  text-shadow: none;
  transform: rotate(-1deg);
}

@media (max-width: 1100px) and (min-width: 761px) {
  .spellbook-list {
    inset: 6.1% 10.2% 7.2%;
  }

  .spellbook-page,
  .spellbook-page-left,
  .spellbook-page-right {
    padding: 2.1% 3.5% 4.1%;
  }

  .spellbook-running-head {
    margin-bottom: 8px;
    padding-bottom: 5px;
    font-size: 9px;
  }

  .spellbook-index-heading {
    padding-bottom: 6px;
    font-size: 17px;
  }

  .spellbook-index-entry {
    min-height: 55px;
    grid-template-columns: 30px minmax(0, 1fr) auto 54px;
    gap: 5px;
    padding: 4px 1px;
  }

  .spellbook .index-spell-rune {
    width: 24px;
    height: 24px;
  }

  .index-formula-link {
    font-size: 14px !important;
  }

  .index-spell-copy small,
  .index-recipe,
  .index-readiness,
  .index-stored,
  .index-active {
    font-size: 7px;
  }

  .index-spell-state {
    min-width: 58px;
  }

  .index-brew {
    width: 50px;
    min-width: 50px;
    height: 36px;
    min-height: 36px;
    font-size: 9px !important;
  }

  .spellbook .spell-name {
    font-size: 28px;
  }

  .spellbook .recipe-text {
    margin: 9px 0 10px;
    font-size: 13px;
  }

  .recipe-chip {
    min-height: 50px;
    padding: 4px 2px;
  }

  .spellbook .ingredient-token {
    width: 30px;
    height: 30px;
  }

  .ingredient-hint {
    font-size: 10.5px;
  }

  .spellbook-lore {
    margin: 8px 0 8px auto;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .spellbook-lore p {
    font-size: 10.5px;
  }

  .spellbook-card button {
    width: 60px;
    min-width: 60px;
    height: 60px;
    min-height: 60px;
    font-size: 10px;
  }
}

@media (max-height: 720px) and (min-width: 761px) {
  .spellbook .spell-name {
    font-size: 26px;
  }

  .spellbook .spell-type {
    font-size: 10px;
  }

  .spellbook .spell-key {
    width: 45px;
    height: 45px;
    flex-basis: 45px;
  }

  .spellbook .spell-key b {
    font-size: 19px;
  }

  .spellbook-section-heading {
    font-size: 10px;
  }

  .recipe-name {
    font-size: 12.5px;
  }

  .recipe-quantity,
  .spellbook-readiness-detail {
    font-size: 9.5px;
  }

  .spellbook-readiness-title {
    font-size: 12px;
  }
}

@media (max-width: 760px) {
  .spellbook {
    padding: 4px;
  }

  .spellbook-volume {
    width: calc(100vw - 8px);
    height: calc(100vh - 8px);
    aspect-ratio: auto;
    overflow: hidden;
    background: #160d09;
  }

  .spellbook-list {
    inset: 0;
    display: flex;
    column-gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .spellbook-list::-webkit-scrollbar {
    display: none;
  }

  .spellbook-page,
  .spellbook-page-left,
  .spellbook-page-right {
    min-width: 100%;
    min-height: 100%;
    flex: 0 0 100%;
    overflow-y: auto;
    border: 0;
    background-image: url("./assets/ui/spellbook-ancient-open.webp");
    background-repeat: no-repeat;
    background-size: 200% 100%;
    scroll-snap-align: start;
  }

  .spellbook-page-left {
    padding: 9% 5% 13% 21%;
    background-position: left center;
  }

  .spellbook-page-right {
    padding: 9% 21% 13% 5%;
    background-position: right center;
  }

  .spellbook-running-head {
    padding-right: 38px;
  }

  .spellbook-close {
    top: 2.2%;
    right: 2.2%;
  }

  #spellbookPrev {
    left: 1.2%;
  }

  #spellbookNext {
    right: 1.2%;
  }

  .spellbook-turn {
    width: 34px;
    height: 43px;
    opacity: 0.86;
  }

  .spellbook-progress {
    bottom: 1.2%;
  }

  .spellbook-index-entry {
    min-height: 62px;
    grid-template-columns: 30px minmax(0, 1fr) 62px;
    padding: 6px 2px;
  }

  .spellbook-index-entry .index-spell-rune {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .spellbook-index-entry .index-spell-copy {
    grid-column: 2;
  }

  .spellbook-index-entry .index-spell-state {
    grid-column: 3;
  }

  .spellbook-index-entry .index-brew {
    grid-column: 2 / 4;
    justify-self: end;
  }

  .spellbook-lore {
    width: 82%;
  }
}

@media (max-width: 520px) {
  .spellbook-page-left {
    padding-left: 19%;
  }

  .spellbook-page-right {
    padding-right: 19%;
  }

  .spellbook .spell-name {
    font-size: 27px;
  }

  .spellbook .spell-key {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .spellbook-action {
    align-items: center;
    flex-direction: row;
  }

  .spellbook-card button {
    width: 64px;
    min-width: 64px;
    height: 64px;
    min-height: 64px;
  }
}
/* End-of-duel proclamation */
.match-result {
  --result-accent: #93ead5;
  --result-accent-rgb: 147, 234, 213;
  --result-metal: #d3ae61;
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: auto;
  color: #eee2bd;
  font-family: Georgia, "Times New Roman", serif;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.94);
}

.match-result[data-result="defeat"] {
  --result-accent: #dfa0ea;
  --result-accent-rgb: 223, 160, 234;
  --result-metal: #b783a5;
}

.match-result-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 43%, rgba(var(--result-accent-rgb), 0.12), rgba(4, 7, 6, 0.72) 42%, rgba(1, 3, 3, 0.91) 100%),
    rgba(2, 5, 4, 0.78);
  backdrop-filter: blur(3px) saturate(0.58);
}

.match-result-panel {
  position: relative;
  width: min(700px, calc(100vw - 32px));
  padding: 58px 58px 48px;
  border: 0;
  border-top: 1px solid rgba(224, 195, 119, 0.7);
  border-bottom: 1px solid rgba(224, 195, 119, 0.58);
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(10, 14, 12, 0.22), rgba(15, 20, 16, 0.94) 17%, rgba(17, 17, 13, 0.96) 50%, rgba(15, 20, 16, 0.94) 83%, rgba(10, 14, 12, 0.22));
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.7),
    inset 0 1px rgba(255, 236, 177, 0.05),
    inset 0 0 80px rgba(var(--result-accent-rgb), 0.045);
  text-align: center;
  animation: match-result-reveal 620ms cubic-bezier(0.2, 0.76, 0.24, 1) both;
}

.match-result-panel::before,
.match-result-panel::after {
  position: absolute;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(211, 174, 97, 0.36) 24%, rgba(211, 174, 97, 0.36) 76%, transparent);
  content: "";
}

.match-result-panel::before {
  left: 16px;
}

.match-result-panel::after {
  right: 16px;
}

.match-result-sigil {
  position: relative;
  width: 68px;
  height: 68px;
  margin: -94px auto 18px;
  border: 1px solid rgba(218, 181, 94, 0.72);
  border-radius: 50%;
  background: rgba(8, 13, 11, 0.96);
  box-shadow:
    0 0 0 6px rgba(10, 15, 12, 0.82),
    0 0 34px rgba(var(--result-accent-rgb), 0.26),
    inset 0 0 22px rgba(var(--result-accent-rgb), 0.12);
}

.match-result-sigil::before,
.match-result-sigil::after,
.match-result-sigil span::before,
.match-result-sigil span::after {
  position: absolute;
  content: "";
}

.match-result-sigil::before {
  inset: 13px;
  border: 1px solid rgba(var(--result-accent-rgb), 0.66);
  transform: rotate(45deg);
}

.match-result-sigil::after {
  top: 50%;
  left: 17px;
  width: 34px;
  height: 1px;
  background: rgba(var(--result-accent-rgb), 0.72);
}

.match-result-sigil span::before {
  top: 17px;
  left: 50%;
  width: 1px;
  height: 34px;
  background: rgba(var(--result-accent-rgb), 0.72);
}

.match-result-sigil span::after {
  top: 28px;
  left: 28px;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(246, 229, 169, 0.88);
  border-radius: 50%;
  background: rgba(var(--result-accent-rgb), 0.38);
  box-shadow: 0 0 13px rgba(var(--result-accent-rgb), 0.7);
}

.match-result-kicker {
  display: block;
  color: var(--result-accent);
  font: 700 11px/1.2 Georgia, "Times New Roman", serif;
  text-transform: uppercase;
}

.match-result h2 {
  max-width: 600px;
  margin: 10px auto 0;
  color: #f2e5bd;
  font-size: 44px;
  font-weight: 400;
  line-height: 1.05;
}

.match-result h2::after {
  display: block;
  width: 128px;
  height: 1px;
  margin: 24px auto 0;
  background: linear-gradient(90deg, transparent, rgba(211, 174, 97, 0.78), transparent);
  content: "";
}

.match-result p {
  max-width: 570px;
  margin: 22px auto 0;
  color: #c9c0a5;
  font: 17px/1.55 Georgia, "Times New Roman", serif;
}

.match-result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.match-result-actions button {
  min-width: 220px;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 2px;
  color: #eee3c3;
  font: 700 14px/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.match-result-secondary {
  border: 1px solid rgba(202, 174, 108, 0.42);
  background: rgba(7, 10, 9, 0.7);
}

.match-result-primary {
  border: 1px solid rgba(var(--result-accent-rgb), 0.74);
  background: rgba(var(--result-accent-rgb), 0.13);
  box-shadow: inset 0 0 24px rgba(var(--result-accent-rgb), 0.07);
}

.match-result-actions button:hover,
.match-result-actions button:focus-visible {
  border-color: #efd995;
  background: rgba(188, 147, 64, 0.18);
  color: #fff2c9;
  outline: 2px solid rgba(var(--result-accent-rgb), 0.42);
  outline-offset: 3px;
  transform: translateY(-2px);
}

body.match-result-open .hud-zone,
body.match-result-open .options-toggle {
  opacity: 0.12 !important;
}

@keyframes match-result-reveal {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .match-result {
    padding: 16px;
  }

  .match-result-panel {
    padding: 48px 24px 32px;
  }

  .match-result-sigil {
    margin-top: -82px;
  }

  .match-result h2 {
    font-size: 32px;
  }

  .match-result p {
    font-size: 15px;
  }

  .match-result-actions {
    flex-direction: column-reverse;
  }

  .match-result-actions button {
    width: 100%;
    min-width: 0;
  }
}
/* Authored grimoire inscriptions and sigils */
.spellbook-volume {
  --spellbook-ink: #26170d;
  --spellbook-muted: #5e472e;
  --spellbook-oxblood: #68281f;
  --spellbook-verdigris: #28584d;
}

.spellbook-page {
  color: var(--spellbook-ink);
  text-rendering: optimizeLegibility;
}

.spellbook-running-head {
  margin-bottom: 17px;
  padding-bottom: 9px;
  color: #594028;
  font-family: "Goudy Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  opacity: 0.9;
}

.spellbook-running-head span:last-child {
  color: var(--formula-accent);
  font-style: italic;
}

.grimoire-sigil {
  display: inline-grid;
  place-items: center;
  color: var(--formula-accent);
  filter: drop-shadow(0 1px 0 rgba(255, 235, 182, 0.2));
  transform: rotate(-1.5deg);
}

.grimoire-sigil svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.grimoire-sigil .sigil-orbit,
.grimoire-sigil .sigil-mark {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.grimoire-sigil .sigil-orbit {
  stroke-dasharray: 3 1.3 8 1.8;
  opacity: 0.66;
}

.grimoire-sigil .sigil-orbit-inner {
  stroke-dasharray: 1.5 3.5;
  opacity: 0.32;
}

.grimoire-sigil .sigil-mark {
  stroke-width: 2.05;
}

.grimoire-sigil .sigil-heavy {
  stroke-width: 2.75;
}

.grimoire-sigil .sigil-cut {
  stroke: #402417;
  stroke-width: 2.6;
}

.grimoire-sigil .sigil-echo {
  opacity: 0.56;
}

.grimoire-sigil .sigil-fill,
.grimoire-sigil .sigil-node {
  fill: currentColor;
}

.grimoire-sigil .sigil-fill {
  stroke: #4b2c1b;
  stroke-linejoin: round;
  stroke-width: 0.7;
}

.spellbook-top {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 58px;
  align-items: start;
  gap: 15px;
}

.grimoire-sigil-detail {
  width: 76px;
  height: 76px;
  margin-top: 2px;
}

.spellbook-title-copy {
  min-width: 0;
}

.spellbook-formula-number {
  margin-bottom: 4px;
  font-family: "Goudy Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 12px;
  line-height: 1.1;
}

.spellbook .spell-name {
  color: #24140b;
  font-family: "Goudy Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 35px;
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: 0;
  text-shadow: 0 1px rgba(255, 237, 187, 0.38);
}

.spellbook .spell-type {
  margin-top: 7px;
  color: #5c452d;
  font: italic 13px/1.28 "Palatino Linotype", Palatino, Georgia, serif;
}

.spellbook .spell-key {
  width: 54px;
  height: 54px;
  flex-basis: 54px;
  border-color: rgba(70, 39, 21, 0.68);
  background: rgba(87, 51, 27, 0.06);
  color: #3d2415;
}

.spellbook .recipe-text {
  margin: 16px 0;
  color: #352316;
  font: italic 16px/1.45 "Palatino Linotype", Palatino, Georgia, serif;
}

.spellbook-section-heading {
  color: #5f261e;
  font: 700 13px/1.2 "Goudy Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

.recipe-name {
  color: #2e1b11;
  font-family: "Goudy Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 16px;
}

.recipe-quantity {
  color: #5f492f;
  font-size: 11.5px;
}

.ingredient-hint {
  color: #4f3c28;
  font-size: 12.5px;
  line-height: 1.35;
}

.spellbook-index-heading {
  position: relative;
  display: grid;
  min-height: 68px;
  margin: 0 0 5px;
  padding: 0 0 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  border-bottom: 2px double rgba(79, 43, 22, 0.46);
}

.spellbook-index-heading-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.spellbook-index-heading-copy > span {
  color: #5d241c;
  font-family: "Goudy Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 29px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px rgba(255, 235, 182, 0.28);
}

.spellbook-index-heading-copy small {
  color: #5f492f;
  font: italic 12.5px/1.2 "Palatino Linotype", Palatino, Georgia, serif;
}

.spellbook-index-heading b {
  padding-bottom: 3px;
  color: #60472d;
  font: italic 700 10.5px/1.1 "Palatino Linotype", Palatino, Georgia, serif;
  text-transform: none;
}

.spellbook-index-list {
  display: grid;
  gap: 0;
}

.spellbook-index-entry {
  position: relative;
  display: grid;
  min-height: 88px;
  padding: 9px 0;
  grid-template-columns: 60px minmax(0, 1fr) 104px 66px;
  align-items: center;
  gap: 11px;
  border: 0;
  background: transparent;
}

.spellbook-index-entry::after {
  position: absolute;
  right: 1%;
  bottom: 0;
  left: 1%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(73, 41, 21, 0.31) 10%, rgba(73, 41, 21, 0.31) 90%, transparent);
  content: "";
}

.spellbook-index-entry:last-child::after {
  display: none;
}

.spellbook-index-entry.formula-ready {
  background: radial-gradient(ellipse at 73% 50%, rgba(38, 92, 76, 0.1), transparent 55%);
}

.spellbook-index-entry.formula-ready::before {
  left: -6px;
  width: 7px;
  height: 7px;
  border-color: var(--spellbook-verdigris);
  background: rgba(40, 88, 77, 0.12);
}

.spellbook .index-spell-rune {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--formula-accent);
  font: inherit;
  transform: none;
}

.grimoire-sigil-index {
  width: 54px;
  height: 54px;
}

.index-spell-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
}

.index-formula-link {
  width: auto;
  padding: 0;
  color: #25150c !important;
  font-family: "Goudy Old Style", "Palatino Linotype", Palatino, Georgia, serif !important;
  font-size: 21px !important;
  font-weight: 700 !important;
  line-height: 1.02 !important;
  letter-spacing: 0 !important;
  text-align: left;
  text-shadow: 0 1px rgba(255, 236, 187, 0.34);
}

.index-formula-link::first-letter {
  color: var(--formula-accent);
  font-size: 1.12em;
}

.index-spell-copy small {
  display: flex;
  width: 100%;
  margin-top: 5px;
  justify-content: flex-start;
  gap: 12px;
  color: #5c452d;
  font: 700 10.5px/1.15 "Palatino Linotype", Palatino, Georgia, serif;
  letter-spacing: 0;
  text-transform: none;
}

.index-spell-copy small span + span {
  padding-left: 12px;
  border-left: 1px solid rgba(75, 42, 22, 0.3);
}

.index-recipe {
  margin-top: 5px;
  color: #563f29;
  font: italic 12.5px/1.2 "Palatino Linotype", Palatino, Georgia, serif;
  letter-spacing: 0;
  text-transform: none;
}

.index-spell-state {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  text-align: right;
}

.index-readiness,
.index-stored,
.index-active {
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0;
}

.index-readiness.ready {
  color: #205247;
}

.index-readiness.missing,
.index-stored {
  color: #5c472f;
}

.index-active {
  color: #653e62;
  font-style: italic;
}

.index-entry-folio {
  justify-self: center;
  color: rgba(75, 43, 24, 0.48);
  font: italic 29px/1 "Goudy Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  transform: rotate(-3deg);
}

.index-brew {
  width: 62px;
  min-width: 62px;
  height: 62px;
  min-height: 62px;
  padding: 7px;
  border: 2px solid #542018;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 29%, #b45e48, #742d23 58%, #421713 100%);
  color: #f3dca8 !important;
  box-shadow: 0 3px 6px rgba(50, 25, 14, 0.3), inset 0 0 0 3px rgba(239, 181, 104, 0.1);
  font: 700 11.5px/1 "Goudy Old Style", "Palatino Linotype", Palatino, Georgia, serif !important;
  text-shadow: 0 1px 1px rgba(42, 17, 12, 0.72);
  transform: rotate(-2deg);
}

.spellbook-index-maxim {
  position: relative;
  width: 72%;
  margin: auto auto 5%;
  padding: 13px 22px 0;
  color: rgba(70, 48, 30, 0.73);
  font: italic 15px/1.38 "Goudy Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  text-align: center;
  transform: rotate(-0.35deg);
}

.spellbook-index-maxim::before {
  display: block;
  width: 82px;
  height: 1px;
  margin: 0 auto 10px;
  background: linear-gradient(90deg, transparent, var(--formula-accent), transparent);
  content: "";
  opacity: 0.58;
}

@media (max-width: 1100px) and (min-width: 761px), (max-height: 760px) and (min-width: 761px) {
  .spellbook-running-head {
    margin-bottom: 9px;
    padding-bottom: 6px;
    font-size: 9.5px;
  }

  .spellbook-index-heading {
    min-height: 50px;
    padding-bottom: 7px;
  }

  .spellbook-index-heading-copy > span {
    font-size: 22px;
  }

  .spellbook-index-heading-copy small {
    font-size: 9.5px;
  }

  .spellbook-index-heading b {
    font-size: 8.5px;
  }

  .spellbook-index-entry {
    min-height: 68px;
    padding: 5px 0;
    grid-template-columns: 46px minmax(0, 1fr) 78px 50px;
    gap: 7px;
  }

  .spellbook .index-spell-rune,
  .grimoire-sigil-index {
    width: 43px;
    height: 43px;
  }

  .index-formula-link {
    font-size: 17px !important;
  }

  .index-spell-copy small {
    margin-top: 3px;
    gap: 7px;
    font-size: 8px;
  }

  .index-spell-copy small span + span {
    padding-left: 7px;
  }

  .index-recipe {
    margin-top: 3px;
    font-size: 9.5px;
  }

  .index-readiness,
  .index-stored,
  .index-active {
    font-size: 8.5px;
  }

  .index-entry-folio {
    font-size: 23px;
  }

  .index-brew {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    font-size: 9.5px !important;
  }

  .spellbook-index-maxim {
    padding-top: 8px;
    font-size: 11.5px;
  }

  .spellbook-top {
    grid-template-columns: 61px minmax(0, 1fr) 46px;
    gap: 10px;
  }

  .grimoire-sigil-detail {
    width: 58px;
    height: 58px;
  }

  .spellbook .spell-name {
    font-size: 28px;
  }

  .spellbook .spell-type,
  .spellbook .recipe-text {
    font-size: 12px;
  }
}

@media (max-width: 760px) {
  .spellbook-index-heading-copy > span {
    font-size: 23px;
  }

  .spellbook-index-heading-copy small {
    font-size: 10.5px;
  }

  .spellbook-index-entry {
    min-height: 84px;
    grid-template-columns: 50px minmax(0, 1fr) 78px;
    gap: 8px;
  }

  .spellbook .index-spell-rune,
  .grimoire-sigil-index {
    width: 46px;
    height: 46px;
  }

  .index-formula-link {
    font-size: 18px !important;
  }

  .index-spell-copy small {
    flex-wrap: wrap;
    gap: 3px 8px;
    font-size: 8.5px;
  }

  .index-spell-copy small span + span {
    padding-left: 8px;
  }

  .index-recipe {
    font-size: 10.5px;
  }

  .index-spell-state {
    grid-column: 3;
    font-size: 9px;
  }

  .index-entry-folio,
  .index-brew {
    grid-column: 3;
    justify-self: center;
  }

  .index-entry-folio {
    font-size: 22px;
  }

  .index-brew {
    width: 52px;
    min-width: 52px;
    height: 52px;
    min-height: 52px;
  }

  .spellbook-index-maxim {
    width: 84%;
    font-size: 12px;
  }

  .spellbook-top {
    grid-template-columns: 58px minmax(0, 1fr) 48px;
    gap: 9px;
  }

  .grimoire-sigil-detail {
    width: 55px;
    height: 55px;
  }
}
/* Grimoire ink contrast refinement */
.spellbook-running-head {
  color: #3e2919;
  font-size: 13px;
  opacity: 1;
}

.spellbook .spell-type {
  color: #49331f;
}

.spellbook .recipe-chip.missing {
  filter: none;
}

.spellbook .recipe-chip.missing .ingredient-token {
  filter: grayscale(0.58) sepia(0.18);
  opacity: 0.62;
}

.spellbook .recipe-chip.missing .recipe-name {
  color: #49331f;
}

.spellbook .recipe-chip.missing .ingredient-hint {
  color: #5a452d;
}

.spellbook-lore {
  color: #493421;
}

.spellbook-lore-label {
  font-size: 10.5px;
}

.spellbook-lore p {
  color: #493421;
  font-size: 13px;
}

.spellbook-readiness-title {
  color: #482f1d;
}

.spellbook-card button:disabled {
  border-color: rgba(75, 51, 31, 0.58);
  color: rgba(54, 38, 24, 0.72);
  filter: grayscale(0.5);
}

.spellbook-index-maxim {
  color: rgba(63, 42, 26, 0.82);
}

@media (max-width: 1100px) and (min-width: 761px), (max-height: 760px) and (min-width: 761px) {
  .spellbook-running-head {
    font-size: 10px;
  }
}
/* Expanded grimoire page and legibility pass */
@media (min-width: 761px) {
  .spellbook-volume {
    width: min(1800px, 120vw, 180vh);
    max-width: none;
  }

  .spellbook-list {
    inset: 11.8% 12.5% 11%;
    column-gap: 3.4%;
  }

  .spellbook-page,
  .spellbook-page-left,
  .spellbook-page-right {
    padding-top: 3.2%;
    padding-bottom: 5.2%;
  }

  .spellbook-page-left {
    padding-right: 5.4%;
    padding-left: 5.2%;
  }

  .spellbook-page-right {
    padding-right: 5.2%;
    padding-left: 5.4%;
  }

  .spellbook-close {
    top: max(2.7%, calc((100% - 100vh) / 2 + 18px));
    right: max(2.5%, calc((100% - 100vw) / 2 + 18px));
  }

  #spellbookPrev {
    left: max(2.3%, calc((100% - 100vw) / 2 + 18px));
  }

  #spellbookNext {
    right: max(2.3%, calc((100% - 100vw) / 2 + 18px));
  }

  .spellbook-progress {
    bottom: max(1.3%, calc((100% - 100vh) / 2 + 18px));
  }

  .spellbook-running-head {
    margin-bottom: 19px;
    padding-bottom: 10px;
    font-size: 14px;
    font-weight: 700;
  }

  .spellbook-index-heading {
    min-height: 76px;
    padding-bottom: 14px;
  }

  .spellbook-index-heading-copy > span {
    font-size: 32px;
  }

  .spellbook-index-heading-copy small {
    font-size: 14px;
    font-weight: 600;
  }

  .spellbook-index-heading b {
    font-size: 11.5px;
    font-weight: 700;
  }

  .spellbook-index-entry {
    min-height: 92px;
    padding: 10px 0;
    grid-template-columns: 64px minmax(0, 1fr) 112px 70px;
    gap: 12px;
  }

  .spellbook .index-spell-rune,
  .grimoire-sigil-index {
    width: 59px;
    height: 59px;
  }

  .index-formula-link {
    font-size: 23px !important;
    font-weight: 700 !important;
  }

  .index-spell-copy small {
    margin-top: 6px;
    font-size: 11.5px;
    font-weight: 700;
  }

  .index-recipe {
    margin-top: 6px;
    font-size: 13.5px;
    font-weight: 600;
  }

  .index-readiness,
  .index-stored,
  .index-active {
    font-size: 12px;
    font-weight: 700;
  }

  .index-entry-folio {
    font-size: 32px;
    font-weight: 600;
  }

  .index-brew {
    width: 66px;
    min-width: 66px;
    height: 66px;
    min-height: 66px;
    font-size: 12.5px !important;
  }

  .spellbook-index-maxim {
    font-size: 16.5px;
    font-weight: 600;
  }

  .spellbook-top {
    grid-template-columns: 88px minmax(0, 1fr) 62px;
    gap: 17px;
  }

  .grimoire-sigil-detail {
    width: 84px;
    height: 84px;
  }

  .spellbook-formula-number {
    font-size: 13px;
    font-weight: 700;
  }

  .spellbook .spell-name {
    font-size: 39px;
    font-weight: 700;
  }

  .spellbook .spell-type {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
  }

  .spellbook .recipe-text {
    margin: 18px 0;
    font-size: 17.5px;
    font-weight: 600;
  }

  .spellbook-section-heading {
    font-size: 14px;
  }

  .recipe-chip {
    min-height: 70px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .recipe-name {
    font-size: 17.5px;
    font-weight: 700;
  }

  .recipe-quantity {
    font-size: 12.5px;
    font-weight: 600;
  }

  .ingredient-hint {
    font-size: 13.5px;
    font-weight: 600;
  }

  .spellbook-lore-label {
    font-size: 11.5px;
    font-weight: 700;
  }

  .spellbook-lore p {
    font-size: 14px;
    font-weight: 600;
  }

  .spellbook-readiness-title {
    font-size: 15px;
    font-weight: 700;
  }

  .spellbook-readiness-detail {
    font-size: 12.5px;
    font-weight: 600;
  }
}

@media (max-width: 1100px) and (min-width: 761px), (max-height: 760px) and (min-width: 761px) {
  .spellbook-volume {
    width: min(1260px, 112vw, 168vh);
  }

  .spellbook-list {
    inset: 10.5% 12.2% 9.8%;
  }

  .spellbook-running-head {
    margin-bottom: 10px;
    padding-bottom: 7px;
    font-size: 11.5px;
  }

  .spellbook-index-heading {
    min-height: 56px;
    padding-bottom: 8px;
  }

  .spellbook-index-heading-copy > span {
    font-size: 26px;
  }

  .spellbook-index-heading-copy small {
    font-size: 11px;
  }

  .spellbook-index-heading b {
    font-size: 9px;
  }

  .spellbook-index-entry {
    min-height: 74px;
    padding: 6px 0;
    grid-template-columns: 49px minmax(0, 1fr) 84px 54px;
    gap: 8px;
  }

  .spellbook .index-spell-rune,
  .grimoire-sigil-index {
    width: 46px;
    height: 46px;
  }

  .index-formula-link {
    font-size: 19px !important;
  }

  .index-spell-copy small {
    margin-top: 3px;
    font-size: 9px;
  }

  .index-recipe {
    margin-top: 3px;
    font-size: 10.5px;
  }

  .index-readiness,
  .index-stored,
  .index-active {
    font-size: 9.5px;
  }

  .index-entry-folio {
    font-size: 25px;
  }

  .index-brew {
    width: 52px;
    min-width: 52px;
    height: 52px;
    min-height: 52px;
    font-size: 10px !important;
  }

  .spellbook-index-maxim {
    font-size: 12px;
  }

  .spellbook-top {
    grid-template-columns: 64px minmax(0, 1fr) 48px;
    gap: 11px;
  }

  .grimoire-sigil-detail {
    width: 61px;
    height: 61px;
  }

  .spellbook .spell-name {
    font-size: 31px;
  }

  .spellbook .spell-type {
    font-size: 11.5px;
  }

  .spellbook .recipe-text {
    margin: 10px 0;
    font-size: 13.5px;
  }

  .recipe-chip {
    min-height: 53px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .recipe-name {
    font-size: 14px;
  }

  .recipe-quantity,
  .ingredient-hint,
  .spellbook-lore p {
    font-size: 10.5px;
  }

  .spellbook-readiness-title {
    font-size: 12.5px;
  }

  .spellbook-readiness-detail {
    font-size: 10px;
  }
}

@media (max-width: 760px) {
  .spellbook-volume {
    width: calc(100vw - 8px);
    max-width: none;
    height: calc(100vh - 8px);
    aspect-ratio: auto;
  }

  .spellbook-list {
    inset: 0;
  }

  .spellbook-page-left {
    padding: 9% 5% 13% 21%;
  }

  .spellbook-page-right {
    padding: 9% 21% 13% 5%;
  }

  .spellbook-close {
    top: 2.2%;
    right: 2.2%;
  }

  #spellbookPrev {
    left: 1.2%;
  }

  #spellbookNext {
    right: 1.2%;
  }

  .spellbook-progress {
    bottom: 1.2%;
  }
}
/* Centre oversized grimoire symmetrically */
@media (min-width: 761px) {
  .spellbook-volume {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 760px) {
  .spellbook-volume {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
  }
}

/* Handwritten grimoire inscriptions */
.spellbook-volume {
  --grimoire-hand: "Segoe Print", "Bradley Hand", "Lucida Handwriting", cursive;
}

.spellbook-page,
.spellbook-page *,
.spellbook-progress,
.spellbook-close,
.spellbook-turn {
  font-family: var(--grimoire-hand) !important;
}

.spellbook-page {
  font-weight: 600;
}

.spellbook-page .spellbook-running-head,
.spellbook-page .spellbook-index-heading-copy > span,
.spellbook-page .index-formula-link,
.spellbook-page .spell-name,
.spellbook-page .spellbook-section-heading,
.spellbook-page .recipe-name,
.spellbook-page .spellbook-readiness-title,
.spellbook-page button {
  font-weight: 700 !important;
}

.spellbook-page .recipe-chip {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding-right: 4px;
  padding-left: 4px;
}

/* Legible grimoire footer inscriptions */
.spellbook-page .spellbook-readiness {
  gap: 5px;
}

.spellbook-page .spellbook-readiness-title {
  color: #321f14;
  font-size: 16px;
  font-weight: 700 !important;
  line-height: 1.18;
  text-shadow: 0 1px rgba(255, 232, 175, 0.22);
}

.spellbook-page .spellbook-readiness-detail {
  color: #3f2b1c;
  font-size: 13.5px;
  font-style: italic;
  font-weight: 700;
  line-height: 1.22;
  opacity: 1;
  text-shadow: 0 1px rgba(255, 232, 175, 0.2);
}

.spellbook-page .spellbook-card button:disabled {
  border-color: rgba(65, 42, 25, 0.72);
  color: #3d2a1b;
  filter: grayscale(0.35);
  opacity: 1;
  text-shadow: 0 1px rgba(255, 225, 166, 0.18);
}

@media (max-width: 1100px) and (min-width: 761px), (max-height: 760px) and (min-width: 761px) {
  .spellbook-page .spellbook-readiness-title {
    font-size: 13px;
  }

  .spellbook-page .spellbook-readiness-detail {
    font-size: 11px;
  }
}

/* Stronger small grimoire inscriptions */
.spellbook-page .recipe-name {
  color: #24150d;
  font-size: 18px;
  font-weight: 700 !important;
  line-height: 1.22;
  text-shadow:
    0.3px 0 #24150d,
    0 1px rgba(255, 233, 180, 0.24);
}

.spellbook-page .ingredient-hint {
  color: #302014;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.4;
  text-shadow:
    0.25px 0 #302014,
    0 1px rgba(255, 233, 180, 0.22);
}

.spellbook-page .spellbook-readiness-title {
  color: #24140c;
  font-size: 17px;
  text-shadow:
    0.35px 0 #24140c,
    0 1px rgba(255, 235, 184, 0.24);
}

.spellbook-page .spellbook-readiness-detail {
  color: #2d1c11;
  font-size: 15px;
  font-weight: 700;
  text-shadow:
    0.3px 0 #2d1c11,
    0 1px rgba(255, 235, 184, 0.22);
}

@media (max-width: 1100px) and (min-width: 761px), (max-height: 760px) and (min-width: 761px) {
  .spellbook-page .recipe-name {
    font-size: 14.5px;
  }

  .spellbook-page .ingredient-hint {
    font-size: 11.5px;
  }

  .spellbook-page .spellbook-readiness-title {
    font-size: 13.5px;
  }

  .spellbook-page .spellbook-readiness-detail {
    font-size: 11.5px;
  }
}

/* Instructions rendered in the ancient grimoire */
.ancient-book {
  --book-hand: "Segoe Print", "Bradley Hand", "Lucida Handwriting", cursive;
  --book-ink: #2b1a10;
  --book-muted: #493321;
  --book-oxblood: #6a291f;
  --book-verdigris: #23594e;
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(1800px, 120vw, 180vh);
  max-width: none;
  height: auto;
  aspect-ratio: 3 / 2;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: url("./assets/ui/spellbook-ancient-open.webp") center / 100% 100% no-repeat;
  box-shadow:
    0 38px 110px rgba(0, 0, 0, 0.86),
    0 12px 28px rgba(0, 0, 0, 0.72);
  color: var(--book-ink);
  font-family: var(--book-hand);
  isolation: isolate;
  transform: translate(-50%, -50%);
}

.ancient-book::before {
  position: absolute;
  inset: 1.4%;
  z-index: 0;
  border-radius: 2.5%;
  background: radial-gradient(ellipse at center, transparent 64%, rgba(20, 10, 6, 0.2) 100%);
  content: "";
  pointer-events: none;
}

.ancient-book::after,
.book-pages::before {
  display: none;
}

.book-pages {
  position: absolute;
  inset: 11.8% 12.5% 11%;
  z-index: 2;
  display: grid;
  width: auto;
  height: auto;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 3.4%;
  background: transparent;
  box-shadow: none;
}

.book-page,
.book-page-left,
.book-page-right {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 3.2% 5.2% 5.2%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--book-ink);
  font-family: var(--book-hand);
  font-weight: 600;
}

.book-page-left {
  padding-right: 5.4%;
}

.book-page-right {
  padding-left: 5.4%;
}

.ancient-book *,
.book-close {
  font-family: var(--book-hand) !important;
}

.book-close {
  top: max(2.7%, calc((100% - 100vh) / 2 + 18px));
  right: max(2.5%, calc((100% - 100vw) / 2 + 18px));
  width: 40px;
  height: 40px;
  border-color: #9a6737;
  background: radial-gradient(circle at 38% 30%, #70412d, #351b16 68%, #1b100e);
  color: #eed7a2;
  font-size: 22px;
}

.book-heading {
  margin-bottom: 14px;
  padding-bottom: 13px;
  border-bottom-color: rgba(76, 42, 22, 0.42);
}

.book-heading span,
.book-running-head {
  color: var(--book-verdigris);
  font-size: 13px;
  font-weight: 700;
  font-variant: normal;
  text-transform: none;
}

.book-heading h2 {
  margin: 4px 0 5px;
  color: #25140c;
  font-size: 41px;
  font-weight: 700;
  line-height: 1.05;
  text-shadow:
    0.4px 0 #25140c,
    0 1px rgba(255, 233, 180, 0.28);
}

.book-heading p {
  color: #3e2a1a;
  font-size: 13.5px;
  font-style: italic;
  font-weight: 700;
  line-height: 1.35;
}

.book-running-head {
  margin: 1px 40px 15px 0;
  padding-bottom: 9px;
  border-bottom-color: rgba(76, 42, 22, 0.38);
  text-align: left;
}

.book-section + .book-section {
  margin-top: 12px;
}

.book-section h3 {
  margin-bottom: 5px;
  color: var(--book-oxblood);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0.25px 0 var(--book-oxblood);
}

.book-section h3::before {
  border: 1px solid var(--book-verdigris);
  background: transparent;
  box-shadow: none;
}

.book-section p {
  margin-bottom: 6px;
  color: var(--book-ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.43;
  text-shadow: 0.2px 0 var(--book-ink);
}

.book-section-opening > p::first-letter {
  color: var(--book-oxblood);
  font-family: var(--book-hand);
}

.book-marginalia,
.book-maxim {
  border-left-color: var(--book-verdigris);
  color: #342217 !important;
  font-size: 12.5px !important;
  font-weight: 700;
  line-height: 1.38 !important;
}

.book-spellcraft {
  margin-bottom: 10px;
}

.book-spellcraft p {
  font-size: 12.5px;
  line-height: 1.38;
}

.book-command-section + .book-command-section {
  margin-top: 9px;
}

.book-command-section h3 {
  margin-bottom: 3px;
  font-size: 16px;
}

.book-controls {
  color: var(--book-ink);
  font-size: 11.5px;
  font-weight: 600;
}

.book-controls > div {
  min-height: 25px;
  padding: 3px 0;
  border-bottom-color: rgba(67, 38, 21, 0.22);
  gap: 8px;
  grid-template-columns: minmax(134px, 42%) minmax(0, 1fr);
}

.book-controls dt {
  color: #3b2517;
  font-weight: 700;
}

.book-controls dd {
  color: #2d1c11;
}

.book-controls kbd {
  min-height: 19px;
  padding: 1px 6px;
  border-color: rgba(62, 37, 21, 0.58);
  border-radius: 2px;
  background: rgba(255, 235, 183, 0.18);
  box-shadow: none;
  color: #2b1a10;
  font-size: 10.5px;
  font-weight: 700;
}

.book-controls i {
  color: #513925;
  font-size: 9.5px;
  font-weight: 700;
}

.book-folio {
  bottom: 2.4%;
  color: rgba(57, 34, 19, 0.78);
  font-size: 12px;
  font-weight: 700;
}

.book-page-left .book-folio {
  left: 5.2%;
}

.book-page-right .book-folio {
  right: 5.2%;
}

@media (max-width: 1100px) and (min-width: 861px), (max-height: 760px) and (min-width: 861px) {
  .ancient-book {
    width: min(1260px, 112vw, 168vh);
  }

  .book-pages {
    inset: 10.5% 12.2% 9.8%;
  }

  .book-heading {
    margin-bottom: 9px;
    padding-bottom: 8px;
  }

  .book-heading span,
  .book-running-head {
    font-size: 10px;
  }

  .book-heading h2 {
    font-size: 31px;
  }

  .book-heading p {
    font-size: 10px;
  }

  .book-running-head {
    margin-bottom: 8px;
    padding-bottom: 6px;
  }

  .book-section + .book-section {
    margin-top: 7px;
  }

  .book-section h3 {
    margin-bottom: 3px;
    font-size: 13.5px;
  }

  .book-section p,
  .book-spellcraft p {
    margin-bottom: 3px;
    font-size: 9.8px;
    line-height: 1.34;
  }

  .book-marginalia,
  .book-maxim {
    padding-top: 3px;
    padding-bottom: 3px;
    font-size: 9px !important;
    line-height: 1.3 !important;
  }

  .book-command-section + .book-command-section {
    margin-top: 5px;
  }

  .book-command-section h3 {
    font-size: 12.5px;
  }

  .book-controls {
    font-size: 8.8px;
  }

  .book-controls > div {
    min-height: 18px;
    padding: 1px 0;
    grid-template-columns: minmax(106px, 42%) minmax(0, 1fr);
  }

  .book-controls kbd {
    min-height: 14px;
    padding: 0 4px;
    font-size: 8px;
  }
}

@media (max-width: 860px) {
  .ancient-book {
    position: relative;
    top: auto;
    left: auto;
    width: calc(100vw - 10px);
    height: calc(100vh - 10px);
    aspect-ratio: auto;
    padding: 8px;
    overflow: hidden;
    border: 1px solid #76502d;
    border-radius: 5px;
    background: linear-gradient(90deg, #281712, #4a281d 8%, #281712 100%);
    transform: none;
  }

  .book-pages {
    position: relative;
    inset: auto;
    display: block;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    background: #d5b982;
  }

  .book-page,
  .book-page-left,
  .book-page-right {
    min-height: auto;
    overflow: visible;
    padding: 34px 28px 46px;
    background:
      radial-gradient(circle at 18% 10%, rgba(96, 57, 29, 0.13), transparent 26%),
      linear-gradient(90deg, rgba(68, 38, 20, 0.12), transparent 10%, transparent 91%, rgba(68, 38, 20, 0.12)),
      #d8bd87;
  }

  .book-page-left {
    border-bottom: 2px solid rgba(70, 39, 21, 0.42);
  }

  .book-close {
    top: 15px;
    right: 15px;
  }

  .book-controls > div {
    grid-template-columns: minmax(125px, 40%) minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .book-page,
  .book-page-left,
  .book-page-right {
    padding-right: 21px;
    padding-left: 21px;
  }

  .book-heading h2 {
    font-size: 32px;
  }

  .book-controls > div {
    align-items: start;
    grid-template-columns: 1fr;
  }
}

/* Instructions page-edge and marginalia legibility */
@media (min-width: 861px) {
  .book-page-left {
    padding-right: 4.2%;
    padding-left: 6.4%;
  }

  .book-page-right {
    padding-right: 4%;
    padding-left: 6.6%;
  }
}

.book-section p {
  color: #24150d;
  font-weight: 700;
  text-shadow:
    0.32px 0 #24150d,
    0 1px rgba(255, 234, 181, 0.22);
}

.book-marginalia,
.book-maxim {
  padding: 7px 9px 7px 13px;
  border-left-width: 3px;
  color: #21130c !important;
  background: linear-gradient(90deg, rgba(244, 222, 167, 0.16), transparent 88%);
  font-size: 14px !important;
  font-weight: 700;
  line-height: 1.43 !important;
  text-shadow:
    0.35px 0 #21130c,
    0 1px rgba(255, 237, 190, 0.24);
}

.book-marginalia strong,
.book-maxim strong {
  color: #562219;
  font-size: 1em;
  font-variant: normal;
  font-weight: 700;
  letter-spacing: 0;
}

@media (max-width: 1100px) and (min-width: 861px), (max-height: 760px) and (min-width: 861px) {
  .book-marginalia,
  .book-maxim {
    padding: 4px 6px 4px 9px;
    border-left-width: 2px;
    font-size: 10px !important;
    line-height: 1.32 !important;
  }
}


/* Cinematic title flyover */
.realm-gate {
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(2, 7, 6, 0.54) 0%, rgba(2, 7, 6, 0.42) 27%, rgba(2, 7, 6, 0.16) 62%, rgba(1, 4, 3, 0.4) 100%);
  box-shadow:
    inset 0 0 150px rgba(0, 0, 0, 0.34),
    inset 0 -110px 130px rgba(0, 0, 0, 0.3);
}

.realm-gate::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 12%, rgba(2, 6, 5, 0.05) 28%, rgba(1, 5, 4, 0.22) 42%, rgba(1, 5, 4, 0.22) 58%, rgba(2, 6, 5, 0.05) 72%, transparent 88%);
  content: "";
  pointer-events: none;
}

.realm-gate-content {
  position: relative;
  z-index: 1;
}

.realm-gate h1 {
  font-size: 64px;
  text-shadow:
    0 5px 28px rgba(0, 0, 0, 0.98),
    0 0 34px rgba(94, 224, 193, 0.18);
}

.realm-gate p {
  color: #d4cfbd;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.98);
}

.realm-gate-kicker {
  color: #d0b16b;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.96);
}

@media (max-width: 700px) {
  .realm-gate {
    padding: 22px;
    background: radial-gradient(ellipse at 50% 42%, rgba(2, 7, 6, 0.6), rgba(1, 4, 3, 0.36) 62%, rgba(1, 3, 3, 0.56));
  }

  .realm-gate h1 {
    font-size: 46px;
  }
}

/* About The Other Wizard */
.open-about {
  min-height: 44px;
  border: 1px solid #9d7935;
  border-radius: 2px;
  background: rgba(8, 15, 13, 0.88);
  color: #f2dfab;
  box-shadow: inset 0 1px rgba(255, 231, 164, 0.08), 0 5px 18px rgba(0, 0, 0, 0.28);
  font: 700 15px/1 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  cursor: pointer;
}

.open-about:hover,
.open-about:focus-visible {
  border-color: #efd48a;
  outline: none;
  color: #fff4cf;
  box-shadow: 0 0 0 2px rgba(207, 173, 87, 0.18), inset 0 0 22px rgba(218, 179, 82, 0.12);
}

.about-modal {
  position: absolute;
  inset: 0;
  z-index: 16;
  display: grid;
  place-items: center;
  padding: 18px;
  isolation: isolate;
  pointer-events: auto;
}

.about-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(1, 4, 4, 0.9);
  backdrop-filter: blur(5px) saturate(0.7);
}

.about-feature {
  position: relative;
  width: min(1240px, calc(100vw - 36px));
  height: min(900px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid #87683d;
  border-radius: 5px;
  background: #cdb783;
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.86), inset 0 0 0 2px rgba(232, 203, 137, 0.15);
  color: #281c15;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

.about-scroll {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #76562e #201714;
  scrollbar-width: thin;
}

.about-close {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 8;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(222, 190, 118, 0.82);
  border-radius: 50%;
  background: rgba(28, 17, 14, 0.9);
  color: #f1d99d;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.52);
  font: 700 25px/1 Georgia, serif;
  cursor: pointer;
}

.about-close:hover,
.about-close:focus-visible {
  border-color: #fff0bd;
  outline: none;
  background: #63352a;
  color: #fff6d8;
}

.about-hero {
  position: relative;
  display: flex;
  min-height: 520px;
  align-items: flex-end;
  overflow: hidden;
  padding: 70px 74px;
  background: #050706;
  color: #f6e9c2;
}

.about-hero::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(2, 4, 4, 0.97) 0%, rgba(2, 4, 4, 0.78) 43%, rgba(2, 4, 4, 0.16) 78%), linear-gradient(0deg, rgba(2, 4, 4, 0.86), transparent 64%);
  content: "";
}

.about-hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 34%;
  image-rendering: pixelated;
  filter: saturate(0.88) contrast(1.06);
  opacity: 0.82;
}

.about-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 660px;
}

.about-eyebrow,
.about-kicker {
  display: block;
  margin: 0 0 12px;
  color: #2f7469;
  font: 700 12px/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

.about-hero .about-eyebrow {
  color: #d4b666;
}

.about-hero h2 {
  max-width: 650px;
  margin: 0;
  color: #fff1c7;
  font: 700 64px/0.98 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.92);
}

.about-hero p {
  max-width: 610px;
  margin: 23px 0 0;
  color: #ddd3b9;
  font: 18px/1.55 "Palatino Linotype", Palatino, Georgia, serif;
}

.about-status {
  display: inline-block;
  margin-top: 25px;
  padding: 8px 11px;
  border: 1px solid rgba(212, 182, 102, 0.58);
  color: #e9d596;
  font: 700 11px/1 Georgia, serif;
  text-transform: uppercase;
}

.about-body {
  background:
    linear-gradient(rgba(68, 45, 22, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 24% 18%, rgba(255, 238, 184, 0.32), transparent 34%),
    #d8c28d;
  background-size: 100% 4px, auto, auto;
}

.about-chapter {
  display: grid;
  max-width: 1080px;
  margin: 0 auto;
  padding: 76px 66px;
  gap: 58px;
  grid-template-columns: minmax(0, 1.22fr) minmax(300px, 0.78fr);
}

.about-copy {
  position: relative;
}

.about-copy-wide {
  max-width: 850px;
  grid-column: 1 / -1;
}

.about-section-number {
  display: block;
  margin-bottom: 20px;
  color: rgba(92, 50, 33, 0.46);
  font: italic 26px/1 Georgia, serif;
}

.about-chapter h3,
.about-channel h3,
.about-thanks h3 {
  margin: 0 0 22px;
  color: #5e2925;
  font: 700 35px/1.08 Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.about-chapter p,
.about-channel p,
.about-thanks p {
  margin: 0 0 18px;
  font-size: 17px;
  line-height: 1.65;
}

.about-figure {
  align-self: center;
  margin: 0;
}

.about-figure img {
  display: block;
  width: 100%;
  border: 5px solid #f0dfb0;
  border-radius: 2px;
  box-shadow: 0 14px 32px rgba(54, 31, 17, 0.28), 0 0 0 1px rgba(78, 48, 26, 0.52);
}

.about-figure figcaption,
.about-gallery figcaption {
  margin-top: 11px;
  color: #624d34;
  font: italic 13px/1.45 "Palatino Linotype", Palatino, Georgia, serif;
}

.about-quote {
  margin: 0;
  padding: 58px max(74px, calc((100% - 930px) / 2));
  background: #14201d;
  color: #f0dfb3;
  text-align: center;
  box-shadow: inset 0 1px rgba(238, 211, 143, 0.18), inset 0 -1px rgba(0, 0, 0, 0.65);
}

.about-quote p {
  margin: 0 auto;
  font: italic 31px/1.35 Georgia, "Times New Roman", serif;
}

.about-quote cite {
  display: block;
  margin-top: 18px;
  color: #8fb9a9;
  font: 700 12px/1.2 Georgia, serif;
  text-transform: uppercase;
}

.about-feud {
  padding-bottom: 54px;
}

.about-gallery {
  display: grid;
  padding: 42px 56px 56px;
  gap: 22px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: #211714;
  color: #dbc89c;
}

.about-gallery figure {
  min-width: 0;
  margin: 0;
}

.about-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border: 1px solid rgba(201, 168, 100, 0.42);
  border-radius: 3px;
  background: #050606;
  image-rendering: pixelated;
}

.about-gallery figure:last-child img {
  object-fit: cover;
  image-rendering: auto;
}

.about-gallery figcaption {
  color: #baa982;
}

.about-reimagining {
  grid-template-columns: minmax(0, 1.38fr) minmax(260px, 0.62fr);
}

.about-reimagining .about-copy-wide {
  grid-column: auto;
}

.about-name-callout {
  align-self: center;
  padding: 28px 0 28px 30px;
  border-left: 3px double #357e71;
}

.about-name-callout span {
  color: #6a3029;
  font: 700 12px/1.2 Georgia, serif;
  text-transform: uppercase;
}

.about-name-callout strong {
  display: block;
  margin: 12px 0;
  color: #214f49;
  font: italic 28px/1.2 Georgia, serif;
}

.about-name-callout p {
  margin: 0;
  color: #5a472f;
  font-size: 15px;
}

.about-channel {
  display: grid;
  padding: 68px max(62px, calc((100% - 980px) / 2));
  gap: 48px;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.65fr);
  background: #172723;
  color: #ddd1ad;
}

.about-channel h3 {
  color: #f0dfb1;
}

.about-channel .about-kicker {
  color: #77b6a7;
}

.about-channel-actions {
  display: flex;
  align-self: center;
  flex-direction: column;
  gap: 12px;
}

.about-channel-actions a,
.about-video-pending {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid #a78544;
  border-radius: 2px;
  color: #f2dfac;
  font: 700 14px/1.2 Georgia, serif;
  text-align: center;
  text-decoration: none;
}

.about-channel-actions a {
  background: #6b421c;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

.about-channel-actions a:hover,
.about-channel-actions a:focus-visible {
  border-color: #f2d894;
  outline: none;
  background: #8a5726;
  color: #fff4d1;
}

.about-video-pending {
  border-color: rgba(153, 175, 159, 0.38);
  color: #95a99f;
}

.about-thanks {
  max-width: 880px;
  margin: 0 auto;
  padding: 76px 64px 84px;
  text-align: center;
}

.about-thanks .about-kicker {
  color: #357e71;
}

.about-thanks strong {
  display: block;
  margin: 30px 0;
  color: #5d2924;
  font: italic 22px/1.4 Georgia, serif;
}

.about-thanks small {
  display: block;
  padding-top: 24px;
  border-top: 1px solid rgba(91, 59, 31, 0.3);
  color: #6e5b40;
  font: 12px/1.55 Georgia, serif;
}

@media (max-width: 820px) {
  .about-modal {
    padding: 0;
  }

  .about-feature {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .about-close {
    position: fixed;
    top: 13px;
    right: 13px;
  }

  .about-hero {
    min-height: 530px;
    padding: 74px 25px 45px;
  }

  .about-hero::after {
    background: linear-gradient(0deg, rgba(2, 4, 4, 0.96) 0%, rgba(2, 4, 4, 0.76) 58%, rgba(2, 4, 4, 0.34) 100%);
  }

  .about-hero h2 {
    font-size: 43px;
    line-height: 1.02;
  }

  .about-hero p {
    font-size: 16px;
  }

  .about-chapter,
  .about-reimagining,
  .about-channel {
    grid-template-columns: minmax(0, 1fr);
  }

  .about-chapter {
    padding: 52px 25px;
    gap: 34px;
  }

  .about-chapter h3,
  .about-channel h3,
  .about-thanks h3 {
    font-size: 29px;
  }

  .about-chapter p,
  .about-channel p,
  .about-thanks p {
    font-size: 16px;
    line-height: 1.58;
  }

  .about-quote {
    padding: 44px 25px;
  }

  .about-quote p {
    font-size: 25px;
  }

  .about-gallery {
    padding: 30px 25px 42px;
    grid-template-columns: minmax(0, 1fr);
  }

  .about-name-callout {
    padding: 20px 0 20px 22px;
  }

  .about-channel {
    padding: 52px 25px;
    gap: 28px;
  }

  .about-thanks {
    padding: 58px 25px 64px;
  }
}
/* Custom skirmish book */
.open-skirmish {
  min-height: 44px;
  border: 1px solid rgba(136, 214, 191, 0.7);
  border-radius: 2px;
  background: rgba(12, 30, 25, 0.9);
  color: #dff4df;
  box-shadow: inset 0 0 22px rgba(92, 211, 177, 0.08), 0 5px 18px rgba(0, 0, 0, 0.3);
  font: 700 15px/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
}
.open-skirmish:hover, .open-skirmish:focus-visible { border-color: #c8f3d9; color: #fff7d9; outline: 2px solid rgba(108, 230, 191, 0.2); outline-offset: 2px; }
.skirmish-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 12px; color: #342416; font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; }
.skirmish-backdrop { position: absolute; inset: 0; border: 0; background: rgba(1, 4, 3, 0.92); backdrop-filter: blur(5px) saturate(0.55); }
.skirmish-volume { position: relative; width: min(1400px, calc(100vw - 18px), calc(150vh - 18px)); aspect-ratio: 3 / 2; background: url("./assets/ui/spellbook-ancient-open.webp") center / 100% 100% no-repeat; filter: drop-shadow(0 34px 55px rgba(0,0,0,0.82)); }
.skirmish-pages { position: absolute; inset: 7.8% 12.25% 9.5%; display: grid; grid-template-columns: 1fr 1fr; gap: 5.8%; overflow: hidden; }
.skirmish-page { position: relative; min-width: 0; overflow: hidden auto; padding: 2.8% 5.2% 4%; background: radial-gradient(ellipse at 50% 18%, rgba(247,225,176,.14), transparent 67%); scrollbar-width: thin; scrollbar-color: rgba(83,54,30,.48) transparent; text-shadow: 0 1px rgba(247,226,180,.42); }
.skirmish-page-rules { padding-left: 6.4%; }
.skirmish-heading { border-bottom: 1px solid rgba(83,50,27,.38); padding-bottom: 10px; }
.skirmish-heading > span { color: #27665c; font-size: 12px; font-weight: 700; }
.skirmish-heading h2 { margin: 4px 0; color: #5d271f; font: 700 clamp(25px, 2.35vw, 38px)/1.05 Georgia, serif; }
.skirmish-heading p { margin: 0; color: #3e2d1d; font: 700 14px/1.42 "Segoe Print", cursive; }
.skirmish-rule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin: 12px 0; }
.skirmish-rule-grid label:first-child { grid-column: 1 / -1; }
.skirmish-rule-grid label { display: grid; gap: 4px; color: #3c2819; font-size: 13px; font-weight: 800; }
.skirmish-rule-grid select { min-height: 38px; padding: 6px 28px 6px 10px; border: 1px solid rgba(74,45,24,.62); border-radius: 1px; background: rgba(240,220,174,.5); color: #2f2015; font: 700 14px Georgia, serif; }
.skirmish-mirror { display: flex; gap: 9px; align-items: center; margin: 10px 0 13px; padding: 8px 10px; border-left: 3px solid #2f7669; background: rgba(59,113,91,.08); color: #3f2d1d; cursor: pointer; }
.skirmish-mirror input { width: 18px; height: 18px; accent-color: #32796b; }
.skirmish-mirror span { display: grid; gap: 1px; }
.skirmish-mirror small { color: #6a5439; font-size: 10px; }
.skirmish-loadout-heading { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin: 8px 0 5px; color: #652c24; font: 700 14px Georgia, serif; }
.skirmish-loadout-heading small { color: #6b573d; font: 600 10px "Segoe Print", cursive; }
.skirmish-loadout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; }
.skirmish-spell-row { display: grid; grid-template-columns: minmax(0,1fr) 70px; grid-template-rows: auto auto; align-items: center; gap: 2px 7px; min-height: 43px; padding: 4px 5px; border-bottom: 1px dotted rgba(87,57,32,.38); }
.skirmish-spell-row > span:first-child { display: grid; grid-row: 1 / 3; min-width: 0; color: #2f2015; font: 800 13px/1.12 Georgia, serif; }
.skirmish-spell-row > span small { color: #604b32; font: 700 10px/1.2 "Segoe Print", cursive; }
.skirmish-spell-row select { width: 70px; min-height: 28px; border: 1px solid rgba(74,45,24,.56); background: rgba(244,224,180,.46); color: #2f2015; font: 700 12px Georgia, serif; }
.skirmish-unlimited { display: flex; align-items: center; gap: 4px; color: #432b1b; font: 800 10px Georgia, serif; cursor: pointer; }
.skirmish-unlimited input { accent-color: #7b3028; }
.skirmish-page-rival.mirrored .skirmish-loadout { opacity: .46; filter: saturate(.5); pointer-events: none; }
.skirmish-note { margin-top: 12px; padding: 9px 12px; border-left: 2px solid #7b3028; background: rgba(114,46,36,.06); color: #4b3020; }
.skirmish-note b { color: #6b2c25; font: 700 13px Georgia, serif; }
.skirmish-note p { margin: 3px 0 0; font-size: 11px; line-height: 1.35; }
.skirmish-actions { position: absolute; right: 11.4%; bottom: 3.7%; left: 11.4%; display: grid; grid-template-columns: 150px 1fr 180px; align-items: center; gap: 14px; color: #d7b96e; text-align: center; font: 700 12px Georgia, serif; }
.skirmish-actions button, .skirmish-close { border: 1px solid rgba(197,151,68,.66); background: rgba(49,24,17,.88); color: #efdca4; font: 700 13px Georgia, serif; cursor: pointer; }
.skirmish-actions button { min-height: 38px; }
.skirmish-begin { box-shadow: inset 0 0 20px rgba(92,211,177,.11); }
.skirmish-actions button:hover, .skirmish-actions button:focus-visible, .skirmish-close:hover, .skirmish-close:focus-visible { border-color: #f0d58c; outline: 2px solid rgba(239,201,109,.22); outline-offset: 2px; color: #fff2bf; }
.skirmish-close { position: absolute; z-index: 3; top: 5.1%; right: 3.2%; width: 40px; height: 40px; border-radius: 50%; font-size: 21px; }
.bout-score { position: fixed; z-index: 7; top: 14px; left: 50%; transform: translateX(-50%); min-width: 290px; padding: 7px 16px; border-top: 1px solid rgba(214,181,104,.58); border-bottom: 1px solid rgba(214,181,104,.4); background: rgba(7,12,10,.78); color: #dfd2ae; text-align: center; font: 700 12px Georgia, serif; text-shadow: 0 2px 6px #000; pointer-events: none; }
.bout-score b { color: #94e5d2; }
.bout-score .rival-score { color: #e0a0e8; }
.match-result-score { color: #ead79c !important; font-size: 21px !important; font-weight: 700 !important; }
.match-result-countdown { color: var(--result-accent) !important; font-size: 14px !important; text-transform: uppercase; }
@media (max-width: 850px), (max-height: 650px) {
  .skirmish-volume { width: min(1050px, calc(100vw - 10px)); aspect-ratio: auto; height: calc(100vh - 10px); background: #d8bd80; border: 8px solid #3d2118; }
  .skirmish-pages { inset: 10px 12px 58px; gap: 12px; }
  .skirmish-close { top: 8px; right: 8px; }
  .skirmish-actions { right: 18px; bottom: 10px; left: 18px; }
}
@media (max-width: 650px) {
  .skirmish-pages { grid-template-columns: 1fr; overflow-y: auto; }
  .skirmish-page { overflow: visible; }
  .skirmish-actions { grid-template-columns: 92px 1fr 130px; }
  .skirmish-spell-row { grid-template-columns: minmax(0,1fr) 66px; }
  .bout-score { top: 8px; min-width: 250px; }
}@media (max-width: 480px) {
  .skirmish-loadout { grid-template-columns: 1fr; }
  .skirmish-rule-grid { grid-template-columns: 1fr; }
  .skirmish-rule-grid label:first-child { grid-column: auto; }
}