@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Caudex:wght@400;700&family=Orbitron:wght@500;600;700;800&family=Rajdhani:wght@500;600;700&display=swap');

@font-face {
  font-family: "Saiba45";
  src: url("assets/font/saiba-45/SAIBA-45.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
}

:root {
  --bg: #1f2227;
  --panel: #2c3036;
  --panel-shell: #2c3036;
  --panel-2: #373c44;
  --line: #df2a21;
  --text: #f3f3f3;
  --muted: #d2d6dc;
  --accent: #df2a21;
  --danger: #ff8787;
  --header-bg: #991c17;
  --jump-hover-bg: #323740;
  --jump-panel-bg: #2c3036;
  --tab-bg: #3a3f47;
  --tab-hover-bg: #40454d;
  --field-bg: #2c3036;
  --field-border: #555b63;
  --toolbar-bg: #3b4048;
  --button-bg: #2f3339;
  --button-border: #7a7f87;
  --button-highlight: rgba(255,255,255,.14);
  --button-shadow: rgba(0,0,0,.18);
  --primary-button-bg: linear-gradient(180deg, #f3efe2, #ddd5bf);
  --primary-button-border: #fff4cf;
  --primary-button-text: #231f1b;
  --shadow: 0 16px 40px rgba(0,0,0,.38);
  --radius: 18px;
}

html {
  scroll-behavior: smooth;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(223,42,33,.08), transparent 20%),
    radial-gradient(circle at top left, rgba(255,255,255,.04), transparent 24%),
    var(--bg);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, black 0%, black 30%, transparent 90%);
}

body.modal-open {
  overflow: hidden;
}

body.theme-cyberpunk {
  --bg: #1f2227;
  --panel: #2c3036;
  --panel-shell: #2c3036;
  --panel-2: #373c44;
  --line: #df2a21;
  --text: #f3f3f3;
  --muted: #d2d6dc;
  --accent: #df2a21;
  --danger: #ff8787;
  --header-bg: #991c17;
  --jump-hover-bg: #323740;
  --jump-panel-bg: #2c3036;
  --tab-bg: #3a3f47;
  --tab-hover-bg: #40454d;
  --field-bg: #2c3036;
  --field-border: #555b63;
  --toolbar-bg: #3b4048;
  --button-bg: #2f3339;
  --button-border: #7a7f87;
  --button-highlight: rgba(255,255,255,.14);
  --button-shadow: rgba(0,0,0,.18);
  --primary-button-bg: linear-gradient(180deg, #f3efe2, #ddd5bf);
  --primary-button-border: #fff4cf;
  --primary-button-text: #231f1b;
}

body.theme-fantasy {
  --bg: #1f2227;
  --panel: #2c3036;
  --panel-shell: #2c3036;
  --panel-2: #373c44;
  --line: #839958;
  --text: #f3f3f3;
  --muted: #d2d6dc;
  --accent: #d3968c;
  --danger: #d3968c;
  --header-bg: #0a3323;
  --jump-hover-bg: #323740;
  --jump-panel-bg: #2c3036;
  --tab-bg: #3a3f47;
  --tab-hover-bg: #40454d;
  --field-bg: #26352c;
  --field-border: #6f8554;
  --toolbar-bg: #314237;
  --button-bg: #2f3339;
  --button-border: #7a7f87;
  --button-highlight: rgba(255,255,255,.14);
  --button-shadow: rgba(0,0,0,.18);
  --primary-button-bg: linear-gradient(180deg, #f7f4d5, #d3968c);
  --primary-button-border: #f7f4d5;
  --primary-button-text: #0a3323;
}

body.theme-fantasy .panel-header h1,
body.theme-fantasy .section-title h3,
body.theme-fantasy #newQuestBtn,
body.theme-fantasy #exportJsonBtn,
body.theme-fantasy #loadDemoBtn,
body.theme-fantasy #importJsonBtn,
body.theme-fantasy #printBtn,
body.theme-fantasy #printBtnBottom {
  font-family: "Caudex", Georgia, serif;
}

body.theme-fantasy #newQuestBtn,
body.theme-fantasy #exportJsonBtn,
body.theme-fantasy #loadDemoBtn,
body.theme-fantasy #importJsonBtn,
body.theme-fantasy #printBtn,
body.theme-fantasy #printBtnBottom {
  font-size: 1rem;
  font-weight: 700;
}

body.theme-fantasy #newQuestBtn,
body.theme-fantasy #exportJsonBtn,
body.theme-fantasy #loadDemoBtn,
body.theme-fantasy #importJsonBtn,
body.theme-fantasy #printBtn,
body.theme-fantasy #printBtnBottom {
  letter-spacing: .02em;
}

body.theme-fantasy .panel-header h1 {
  letter-spacing: .03em;
}

body.theme-fantasy .section-title h3 {
  letter-spacing: .03em;
  color: #f7f4d5;
}

body.theme-fantasy #printBtn,
body.theme-fantasy #printBtnBottom {
  background: linear-gradient(180deg, #5f7444, #435532);
  border-color: #9caf76;
  color: #f7f4d5;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 0 -1px 0 rgba(10,51,35,.34);
}

body.theme-fantasy #printBtn:hover,
body.theme-fantasy #printBtn:focus-visible,
body.theme-fantasy #printBtnBottom:hover,
body.theme-fantasy #printBtnBottom:focus-visible {
  background: linear-gradient(180deg, #6b8150, #4a5f38);
  border-color: #b3c487;
  color: #fffdf0;
}

body.theme-fantasy .section {
  background: linear-gradient(180deg, rgba(58,63,71,.96), rgba(48,53,60,.96));
  border-color: #839958;
  box-shadow: inset 0 1px 0 rgba(247,244,213,.05);
}

body.theme-fantasy .section-hint {
  color: rgba(247,244,213,.66);
}

body.theme-fantasy .item-card {
  background: linear-gradient(180deg, rgba(10,51,35,.52), rgba(16,86,102,.22));
  border-color: rgba(131,153,88,.7);
}

body.theme-fantasy .item-card-summary {
  color: rgba(247,244,213,.86);
}

body.theme-fantasy .npc-statblock-details {
  background: rgba(10,51,35,.22);
  border-color: rgba(131,153,88,.58);
}

body.theme-fantasy input,
body.theme-fantasy textarea,
body.theme-fantasy .core-pitch-editor {
  background: linear-gradient(180deg, rgba(34,49,39,.96), rgba(27,39,31,.96));
  border-color: #6f8554;
  color: #f7f4d5;
}

body.theme-fantasy select {
  background-color: transparent;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M2 2l5 5 5-5' fill='none' stroke='%23f7f4d5' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, rgba(34,49,39,.96), rgba(27,39,31,.96));
  background-position:
    calc(100% - 13px) 50%,
    0 0;
  background-size:
    14px 10px,
    100% 100%;
  background-repeat: no-repeat;
  border-color: #6f8554;
  color: #f7f4d5;
}

body.theme-fantasy select option,
body.theme-fantasy select optgroup {
  background: #223127;
  color: #f7f4d5;
}

body.theme-fantasy input::placeholder,
body.theme-fantasy textarea::placeholder {
  color: rgba(247,244,213,.34);
}

body.theme-fantasy input:focus,
body.theme-fantasy select:focus,
body.theme-fantasy textarea:focus,
body.theme-fantasy .core-pitch-editor:focus {
  border-color: #839958;
  box-shadow: 0 0 0 3px rgba(131,153,88,.22);
}

body.theme-fantasy .rich-toolbar {
  background: #314237;
  border-color: #6f8554;
}

body.theme-fantasy .rich-editor:focus-within {
  border-color: #839958;
  box-shadow: 0 0 0 3px rgba(131,153,88,.22);
}

body.theme-fantasy .toolbar-toggle-btn:hover,
body.theme-fantasy .toolbar-toggle-btn:focus-visible,
body.theme-fantasy .styled-checkbox:hover,
body.theme-fantasy .styled-checkbox:focus-visible {
  border-color: #839958;
  box-shadow: 0 0 0 3px rgba(131,153,88,.18);
}

body.theme-fantasy .styled-checkbox:checked {
  background: linear-gradient(180deg, rgba(131,153,88,.38), rgba(16,86,102,.2));
  border-color: rgba(131,153,88,.86);
}

body.theme-fantasy .pill,
body.theme-fantasy .type-menu-toggle {
  background: linear-gradient(180deg, #35463a, #29372d);
  border-color: #839958;
  color: #f7f4d5;
}

body.theme-fantasy .tag-icon,
body.theme-fantasy .type-option-icon {
  filter: brightness(0) saturate(100%) invert(92%) sepia(18%) saturate(312%) hue-rotate(17deg) brightness(103%) contrast(94%);
}

body.theme-fantasy .type-menu-toggle:hover,
body.theme-fantasy .type-menu-toggle:focus-visible {
  border-color: #d3968c;
  box-shadow: 0 0 0 3px rgba(131,153,88,.18);
}

body.theme-fantasy .type-menu-popup {
  background: #2e3d32;
  border-color: #839958;
}

body.theme-fantasy .type-option-symbol {
  color: #f7f4d5;
}

body.theme-fantasy .type-option-reset .type-option-symbol {
  color: rgba(247,244,213,.82);
}

body.theme-fantasy .type-menu-toggle:not(.is-placeholder),
body.theme-fantasy .statblock-toggle.is-open {
  background: linear-gradient(180deg, rgba(131,153,88,.38), rgba(16,86,102,.2));
  border-color: rgba(131,153,88,.86);
  color: #f7f4d5;
  box-shadow: inset 0 0 0 1px rgba(247,244,213,.06);
}

body.theme-fantasy .section .pill,
body.theme-fantasy .section button:not(.danger):not(.mode-tab):not(.section-jump-toggle):not(#newQuestBtn):not(#exportJsonBtn):not(#loadDemoBtn):not(#importJsonBtn):not(#printBtn):not(#printBtnBottom) {
  background: linear-gradient(180deg, #35463a, #29372d);
  border-color: #839958;
  color: #f7f4d5;
}

body.theme-fantasy .sheet-title,
body.theme-fantasy .stat-card-side,
body.theme-fantasy .stat-box-label,
body.theme-fantasy .stat-panel-head,
body.theme-fantasy .stat-strip-label,
body.theme-fantasy .stat-box-value {
  font-family: "Caudex", Georgia, serif;
}

.section-jump-nav {
  position: fixed;
  top: 260px;
  left: 0;
  z-index: 30;
  width: 44px;
  display: block;
}

.section-jump-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 144px;
  padding: 12px 0;
  border: 0;
  border-bottom: none;
  border-radius: 14px 0 0 14px;
  background: var(--panel-shell);
  color: rgba(243,243,243,.74);
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: .88rem;
  letter-spacing: .1em;
  line-height: 1;
  text-transform: uppercase;
  text-align: center;
  writing-mode: vertical-rl;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}

.section-jump-toggle-label {
  display: block;
  transform: rotate(180deg);
}

.section-jump-toggle:hover,
.section-jump-toggle:focus-visible,
.section-jump-nav:hover .section-jump-toggle,
.section-jump-nav:focus-within .section-jump-toggle {
  background: var(--jump-hover-bg);
  box-shadow: none;
  outline: none;
  color: #fff;
}

.section-jump-links {
  position: absolute;
  top: 0;
  left: calc(100% - 1px);
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 154px;
  padding: 10px 12px;
  border: 0;
  border-radius: 0 14px 14px 0;
  background: var(--jump-panel-bg);
  box-shadow: 0 16px 30px rgba(0,0,0,.24);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-12px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.section-jump-nav:hover .section-jump-links,
.section-jump-nav:focus-within .section-jump-links {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}

.section-jump-link {
  display: block;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: rgba(243,243,243,.78);
  text-decoration: none;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: .94rem;
  letter-spacing: .05em;
  line-height: 1;
  text-transform: uppercase;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}

.section-jump-link + .section-jump-link {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.16);
}

.section-jump-link:hover,
.section-jump-link:focus-visible {
  color: #fff;
  outline: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-height: 820px) {
  .section-jump-toggle {
    min-height: 118px;
    padding: 8px 0;
  }
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 96px 24px 24px;
  display: block;
}

.panel {
  position: relative;
  background: var(--panel-shell);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: visible;
}

.panel-header {
  position: relative;
  padding: 18px 20px;
  border-bottom: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  background: var(--header-bg);
  border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
  overflow: hidden;
  z-index: 2;
}

.panel-header-main {
  flex: 1 1 auto;
  min-width: 0;
}

.mode-tabs {
  position: absolute;
  top: -32px;
  left: 22px;
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  z-index: 3;
}

.mode-tab {
  border: 0;
  border-bottom: 0;
  background: color-mix(in srgb, var(--panel-shell) 82%, #000 18%);
  color: rgba(243,243,243,.58);
  border-radius: 14px 14px 0 0;
  min-width: 150px;
  padding: 10px 18px 8px;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: .88rem;
  font-weight: 600;
  letter-spacing: .1em;
  line-height: 1;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0,0,0,.14);
  position: relative;
  z-index: 1;
  transition: box-shadow .15s ease, color .15s ease, background .15s ease, z-index .15s ease;
}

.mode-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--line);
  opacity: .95;
  pointer-events: none;
}

.mode-tab + .mode-tab {
  margin-left: -10px;
}

.mode-tab:hover,
.mode-tab:focus-visible {
  color: #fff;
  background: color-mix(in srgb, var(--panel-shell) 88%, #000 12%);
  transform: none;
  outline: none;
}

.mode-tab.is-active {
  background: var(--panel-shell);
  color: #fff;
  box-shadow: 0 16px 28px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.04);
  z-index: 4;
}

.mode-tab.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px solid var(--line);
  border-bottom: 0;
  border-radius: inherit;
  pointer-events: none;
}

.mode-tab.is-active::after {
  opacity: 0;
}

.panel-header h1,
.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.panel-header h1 {
  display: block;
  width: 100%;
  font-family: "Orbitron", "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 2rem;
  line-height: .95;
  letter-spacing: .06em;
}

.title-lockup {
  display: inline-block;
  white-space: nowrap;
}

.subtle {
  color: rgba(255,255,255,.88);
  font-size: .92rem;
}

.header-subtitle {
  margin-top: 8px;
  font-size: .8rem;
  line-height: 1.35;
  max-width: 38rem;
}

.header-copy + .header-copy {
  margin-top: 4px;
}

.header-subtitle a {
  color: #fff6c9;
  text-decoration: none;
}

.header-donate {
  white-space: nowrap;
}

.header-subtitle a:hover {
  text-decoration: underline;
}

.content {
  padding: 20px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.section {
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
  margin-bottom: 18px;
  scroll-margin-top: 22px;
}

.section-action {
  padding: 14px 18px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h3 {
  margin: 0;
  font-size: 1.5rem;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
}

.section-hint {
  margin-top: 3px;
  font-size: .74rem;
  line-height: 1.2;
  color: rgba(243,243,243,.64);
}


label {
  display: block;
  font-size: .82rem;
  color: #ffffff;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

input, select, textarea {
  width: 100%;
  background: var(--field-bg);
  color: var(--text);
  border: 1px solid var(--field-border);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(223,42,33,.18);
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

textarea {
  resize: vertical;
  min-height: 84px;
}

.location-card textarea {
  min-height: 44px;
  height: 44px;
  padding-top: 11px;
  padding-bottom: 11px;
  line-height: 1.2;
}

textarea[data-autogrow="true"] {
  overflow: hidden;
  resize: none;
}

.npc-card textarea[data-field="plus"],
.npc-card textarea[data-field="minus"],
.npc-card textarea[data-field="secret"],
.npc-card textarea[data-field="incongruency"] {
  min-height: 44px;
  height: 44px;
  padding-top: 11px;
  padding-bottom: 11px;
  line-height: 1.2;
}

.npc-advanced > div > textarea {
  min-height: 58px;
}

.rich-editor {
  position: relative;
  border: 1px solid var(--field-border);
  border-radius: 12px;
  background: var(--field-bg);
  overflow: hidden;
}

.rich-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(223,42,33,.18);
}

.rich-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.rich-toolbar[hidden] {
  display: none;
}

.rich-toolbar-header {
  padding: 10px 12px;
  height: 52px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--field-border);
  background: var(--toolbar-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.toolbar-toggle-btn {
  flex: 0 0 auto;
  margin-left: auto;
  border: 1px solid var(--button-border);
  border-radius: 999px;
  background: var(--button-bg);
  color: #e6e6e6;
  padding: 4px 9px;
  font: inherit;
  font-size: .78rem;
  line-height: 1;
}

.toolbar-toggle-btn:hover,
.toolbar-toggle-btn:focus-visible {
  color: var(--text);
  border-color: rgba(223,42,33,.7);
  box-shadow: 0 0 0 2px rgba(223,42,33,.16);
  outline: none;
}

.toolbar-btn,
.toolbar-select {
  border: 1px solid var(--button-border);
  border-radius: 10px;
  background: var(--button-bg);
  color: var(--text);
  font: inherit;
}

.toolbar-btn {
  min-width: 28px;
  padding: 3px 7px;
  min-height: 30px;
  line-height: 1;
}

.toolbar-select {
  appearance: none;
  width: auto;
  min-width: 96px;
  min-height: 30px;
  padding: 3px 28px 3px 8px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.styled-checkbox {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--button-border);
  border-radius: 5px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--button-bg) 92%, #fff 8%), color-mix(in srgb, var(--button-bg) 88%, #000 12%));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
}

.styled-checkbox:hover,
.styled-checkbox:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(223,42,33,.16);
  outline: none;
}

.styled-checkbox:checked {
  background: linear-gradient(180deg, rgba(223,42,33,.35), rgba(223,42,33,.18));
  border-color: rgba(223,42,33,.8);
}

.styled-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 9px;
  border: solid var(--text);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -58%) rotate(45deg);
}

.rich-input {
  min-height: 110px;
  padding: 11px 12px;
  outline: none;
  line-height: 1.4;
}

.rich-input:empty::before {
  content: attr(data-placeholder);
  color: rgba(232, 237, 247, .42);
  font: inherit;
  line-height: inherit;
  opacity: 1;
}

body.theme-fantasy .rich-input:empty::before {
  color: rgba(247,244,213,.34);
}

.rich-input p,
.rich-input ul {
  margin: 0;
}

.rich-input ul {
  padding-left: 22px;
  margin-left: 2px;
}

.rich-input p:last-child,
.rich-input ul:last-child {
  margin-bottom: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  column-gap: 10px;
  row-gap: 6px;
}

#npcs-section .actions {
  align-items: center;
}

.panel-header > div:first-child {
  flex: 1 1 auto;
  padding-right: 20px;
}

.panel-header .actions {
  flex: 0 0 320px;
  padding-left: 20px;
  border-left: 2px solid rgba(255,255,255,.45);
  align-self: center;
  align-items: flex-start;
  align-content: flex-start;
}

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

.actions-grid > button {
  width: 100%;
}

.action-span-2 {
  grid-column: 1 / -1;
}

.action-with-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.action-with-note > button {
  width: 100%;
}

.action-note {
  font-size: .76rem;
  line-height: 1.3;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

.button-label {
  position: relative;
  display: inline-block;
}

.button-note-mark {
  position: absolute;
  left: 100%;
  top: -.10em;
  margin-left: 2px;
  font-size: .85em;
  line-height: 1;
  font-family: "Orbitron", "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 700;
}

.action-note-spaced {
  margin-top: 4px;
}

button {
  appearance: none;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: .15s ease;
}

#newQuestBtn,
#exportJsonBtn,
#loadDemoBtn,
#importJsonBtn,
#printBtn,
#printBtnBottom {
  font-family: "Orbitron", "Barlow Condensed", "Arial Narrow", sans-serif;
  letter-spacing: .04em;
  box-shadow: inset 0 1px 0 var(--button-highlight), inset 0 -1px 0 var(--button-shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

#newQuestBtn:hover,
#exportJsonBtn:hover,
#loadDemoBtn:hover,
#importJsonBtn:hover,
#printBtn:hover,
#printBtnBottom:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--button-highlight) 80%, #fff 20%), inset 0 -1px 0 color-mix(in srgb, var(--button-shadow) 85%, #000 15%);
}

button.primary {
  background: var(--primary-button-bg);
  border-color: var(--primary-button-border);
  color: var(--primary-button-text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
}

.wide-action-btn {
  width: 100%;
  padding: 14px 18px;
  font-size: 1rem;
  justify-content: center;
}

.bottom-action-wrap {
  margin-top: 2px;
  margin-bottom: 18px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 9, 12, .68);
  backdrop-filter: blur(3px);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  width: min(480px, calc(100vw - 32px));
  padding: 20px 20px 18px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 96%, #fff 4%), color-mix(in srgb, var(--panel-2) 92%, #000 8%));
  box-shadow: var(--shadow);
}

.modal-eyebrow {
  margin-bottom: 6px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  line-height: 1.05;
}

.modal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.export-meta-fields {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.export-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.export-meta-label {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.export-meta-chip,
.export-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid color-mix(in srgb, var(--line) 58%, #fff 18%);
  background: color-mix(in srgb, var(--panel-2) 85%, #000 15%);
  color: var(--text);
  font-size: .78rem;
}

.export-meta-chip-auto {
  font-weight: 700;
  border-color: color-mix(in srgb, var(--accent) 55%, #fff 20%);
}

.export-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 30px;
}

.export-chip-remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  line-height: 1;
  font-size: .9rem;
  padding: 0;
}

.page-footer-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 24px 32px;
}

.site-footer-support {
  position: relative;
  margin-top: 44px;
  padding-top: 68px;
  background: transparent;
  border: 0;
}

.site-footer-support::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 120px));
  height: 1px;
  background: linear-gradient(90deg, rgba(171,185,204,0), rgba(171,185,204,0.7) 22%, rgba(171,185,204,0.7) 78%, rgba(171,185,204,0));
}

.site-footer-support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 32px;
}

.footer-meta {
  margin-top: 24px;
  padding-top: 0;
  text-align: center;
}

.footer-meta-divider {
  display: none;
}

.footer-meta-copy {
  font-size: .74rem;
  line-height: 1.45;
  color: var(--muted);
}

.footer-meta-copy + .footer-meta-copy {
  margin-top: 3px;
}

.footer-column {
  min-width: 0;
}

.footer-heading {
  margin: 0 0 12px;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 1.2rem;
  font-weight: 700;
  color: rgba(243,243,243,.88);
}

.footer-copy {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.footer-actions,
.footer-contact-form {
  display: grid;
  gap: 10px;
}

.footer-link-btn,
.footer-link-anchor,
.footer-send-btn {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  padding: 11px 16px;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: .96rem;
  letter-spacing: .04em;
}

.footer-link-btn,
.footer-link-anchor {
  border: 1px solid var(--field-border);
  background: color-mix(in srgb, var(--panel-shell) 58%, transparent);
  color: var(--text);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  white-space: normal;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  text-transform: none;
}

.footer-link-anchor {
  text-decoration: none;
}

.footer-link-btn:hover,
.footer-link-btn:focus-visible,
.footer-link-anchor:hover,
.footer-link-anchor:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--panel-shell) 72%, transparent);
  color: #fff;
}

.footer-donate-btn {
  border-color: #f1c232;
  background: linear-gradient(180deg, #f8d94f, #f0bc1d);
  color: #1c1303;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}

.footer-donate-btn:hover,
.footer-donate-btn:focus-visible {
  border-color: #ffe27a;
  background: linear-gradient(180deg, #ffe27a, #f4c62a);
}

.footer-contact-form select {
  min-height: 46px;
  border-radius: 12px;
  border-color: var(--field-border);
  background-color: color-mix(in srgb, var(--panel-shell) 58%, transparent);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M2 2l5 5 5-5' fill='none' stroke='%23d7dbe1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: calc(100% - 14px) 50%;
  background-size: 14px 10px;
  background-repeat: no-repeat;
  color: var(--text);
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  letter-spacing: .04em;
}

.footer-send-btn {
  border: 1px solid var(--field-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-shell) 76%, #000 24%), color-mix(in srgb, var(--panel-shell) 62%, #000 38%));
  color: #fff;
  font-weight: 700;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

.footer-send-btn:hover,
.footer-send-btn:focus-visible {
  border-color: var(--accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-shell) 64%, var(--accent) 36%), color-mix(in srgb, #000 72%, var(--accent) 28%));
}

.footer-btn-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  font-size: 14px;
}

.footer-btn-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bottom-print-btn,
.bottom-print-btn.primary {
  background: linear-gradient(180deg, #df2a21, #b91f19);
  border-color: #ff6d66;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}

button.danger:hover {
  border-color: var(--danger);
}

.remove-btn {
  padding: 5px 10px;
  font-size: .86rem;
  line-height: 1;
}

.item-card {
  padding: 14px;
  border: 1px solid #646a73;
  border-radius: 14px;
  background: #2b2f35;
  margin-bottom: 12px;
  position: relative;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.item-card.card-enter {
  animation: cardEnter .24s ease-out;
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
  transition: transform .16s ease, filter .16s ease;
}

.drag-handle {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.drag-handle:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

body.type-menu-open .drag-handle:hover {
  transform: none;
  filter: none;
}

body.type-menu-open .drag-handle {
  cursor: default;
}

.item-card.has-open-type-menu {
  z-index: 6;
}

.drag-handle:active {
  cursor: grabbing;
}

.item-card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.item-card-summary {
  font-size: .88rem;
  line-height: 1.35;
  color: rgba(243,243,243,.86);
  padding: 2px 2px 0;
}

.item-card.is-collapsed .item-card-header {
  margin-bottom: 6px;
}

.item-card.card-toggle-flash {
  transform: translateY(-1px);
  border-color: rgba(223,42,33,.72);
  box-shadow: 0 0 0 2px rgba(223,42,33,.14);
}

.item-card.is-dragging {
  opacity: .88;
  transform: translateY(-6px) scale(1.01);
  border-color: rgba(223,42,33,.85);
  box-shadow: 0 18px 36px rgba(0,0,0,.28), 0 0 0 2px rgba(223,42,33,.18);
  z-index: 2;
}

.item-card.is-drag-source {
  opacity: 0;
}

.drag-placeholder {
  margin-bottom: 12px;
  border: 1px dashed rgba(223,42,33,.42);
  border-radius: 14px;
  background: rgba(223,42,33,.06);
}

body.theme-fantasy .item-card.is-dragging {
  border-color: rgba(131,153,88,.9);
  box-shadow: 0 18px 36px rgba(0,0,0,.28), 0 0 0 2px rgba(131,153,88,.2);
}

body.theme-fantasy .drag-placeholder {
  border-color: rgba(131,153,88,.5);
  background: rgba(131,153,88,.08);
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  margin: 0;
  opacity: .96;
  transform: rotate(-1deg);
  box-shadow: 0 24px 42px rgba(0,0,0,.34), 0 0 0 2px rgba(223,42,33,.14);
}

.drag-ghost .item-card-header {
  transform: none;
  filter: none;
}

.drag-handle .item-card-header,
.drag-handle .item-card-summary,
.drag-handle .item-card-body {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.drag-handle input,
.drag-handle textarea,
.drag-handle select,
.drag-handle button,
.drag-handle a,
.drag-handle label {
  cursor: auto;
  user-select: auto;
  -webkit-user-select: auto;
}

.section-title {
  user-select: none;
  -webkit-user-select: none;
}

.section-title button,
.section-title a,
.section-title input,
.section-title textarea,
.section-title select,
.section-title label {
  user-select: auto;
  -webkit-user-select: auto;
}

.npc-statblock-details {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid #646a73;
  border-radius: 12px;
  background: rgba(0,0,0,.12);
}

.statblock-toggle {
  margin-top: 2px;
}

.npc-card-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.duplicate-npc-btn {
  margin-top: 2px;
}

.statblock-toggle.is-open {
  background: linear-gradient(180deg, rgba(223,42,33,.36), rgba(223,42,33,.18));
  border-color: rgba(255,109,102,.85);
  color: var(--text);
}

.compact-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

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

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

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

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

.compact-stat-field {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-size: .74rem;
}

.compact-stat-field span {
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.compact-stat-field input {
  padding: 7px 8px;
  min-height: 0;
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #8d9299;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: .78rem;
  color: #efefef;
  background: #30353b;
}

.type-menu {
  position: relative;
}

.complication-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-menu-toggle {
  background: linear-gradient(180deg, #3d4249, #30353b);
  border-color: #8d9299;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}

.type-menu-toggle.is-placeholder {
  color: #f0f0f0;
}

.type-menu-toggle:hover,
.type-menu-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(223,42,33,.16);
}

.type-menu-toggle:focus-visible {
  outline: none;
}

.type-menu-toggle:not(.is-placeholder) {
  background: linear-gradient(180deg, rgba(223,42,33,.36), rgba(223,42,33,.18));
  border-color: rgba(255,109,102,.85);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}

.type-menu-toggle:not(.is-placeholder) {
  min-width: 2.2rem;
  justify-content: center;
}

.tag-icon {
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  display: block;
}

.type-menu-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(340px, 72vw);
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #2f3339;
  box-shadow: var(--shadow);
}

.type-menu-popup[hidden] {
  display: none;
}

.type-option {
  width: 100%;
  display: grid;
  grid-template-columns: 18px 1fr;
  column-gap: 8px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.type-option[hidden] {
  display: none;
}

.type-option-symbol {
  color: #ff6d66;
  font-weight: 700;
  line-height: 1;
  align-self: start;
  width: 18px;
  text-align: center;
  margin-top: 0;
}

.type-option-icon {
  width: 1rem;
  height: 1rem;
  object-fit: contain;
  display: block;
}

.type-option-copy {
  font-size: .8rem;
  line-height: 1.25;
  min-width: 0;
  display: block;
}

.type-option-copy strong {
  display: inline;
  margin: 0;
  line-height: inherit;
}

.type-option-reset .type-option-symbol {
  color: #d2d6dc;
}

#fantasyNpcSystemMenu .type-menu-toggle {
  align-self: center;
}

#fantasyNpcSystemMenu .type-menu-popup {
  width: min(340px, 72vw);
  left: auto;
  right: 0;
}

#fantasyNpcSystemMenu .type-option {
  display: block;
  padding: 10px 12px;
  text-align: right;
}

#fantasyNpcSystemMenu .type-option-copy {
  font-size: .8rem;
  line-height: 1.25;
}

#fantasyNpcSystemMenu .type-option-copy strong {
  display: inline;
  font-size: inherit;
  font-weight: 700;
}

.preview-shell {
  background: #111;
  padding: 18px;
  min-height: 100%;
}

.print-sheet {
  max-width: 794px;
  margin: 0 auto;
  background: #fff;
  color: #141414;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  border: 1px solid #d8d8d8;
}

.sheet-title {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-family: "Orbitron", "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.1;
  padding-bottom: 8px;
  border-bottom: 3px solid #c71919;
}

.sheet-subtitle {
  color: #2d2d2d;
  margin-bottom: 14px;
  font-size: .9rem;
  line-height: 1.3;
}

.setup-intro {
  background: #f5f5f5;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
  color: #111;
}

.sheet-subtitle p,
.sheet-subtitle ul {
  margin: 0 0 8px;
}

.sheet-subtitle ul {
  padding-left: 18px;
}

.sheet-subtitle p:last-child,
.sheet-subtitle ul:last-child {
  margin-bottom: 0;
}

.sheet-section {
  margin-bottom: 12px;
  border: 1px solid #d8d8d8;
  border-left: 4px solid #c71919;
  background: #f0f0f0;
  padding: 10px 11px;
  border-radius: 10px;
  break-inside: avoid;
}

.gm-notes-section {
  break-inside: auto;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding-top: 14px;
}

.flowing-section {
  break-inside: auto;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding-top: 14px;
}

.sheet-section h4 {
  margin: 0 0 9px;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #121212;
}

.sheet-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.sheet-field strong {
  display: block;
  font-size: .68rem;
  text-transform: uppercase;
  color: #7a1a1a;
  margin-bottom: 2px;
  line-height: 1.2;
}

.sheet-field + .sheet-field {
  margin-top: 5px;
}

.sheet-grid > .sheet-field {
  margin-top: 0;
}

.sheet-grid > .sheet-field + .sheet-field {
  margin-top: 0;
}

.print-tag-symbol,
.print-tag-separator {
  display: inline-block;
  vertical-align: middle;
}

.print-tag-symbol {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.print-tag-icon {
  width: 1rem;
  height: 1rem;
  object-fit: contain;
  display: block;
  filter: brightness(0) saturate(100%);
}

.npc-name-symbol {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.print-tag-separator {
  margin: 0 6px;
  color: #a53b3b;
  font-size: .9rem;
  line-height: 1;
}

.complication-symbols,
.location-symbols {
  line-height: 1;
}

.inline-print-symbols {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
}

.npc-title-icon {
  margin-left: 2px;
}

.location-title-icon {
  margin-left: 2px;
}

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

#previewLocations.sheet-list,
#previewNpcs.sheet-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.sheet-item {
  border: 1px solid #e5e5e5;
  border-left: 3px solid #111;
  background: #fff;
  border-radius: 8px;
  padding: 7px 8px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.sheet-item-title {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: .92rem;
  line-height: 1.2;
  color: #151515;
}

.sheet-item-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sheet-item-role {
  font-weight: 400;
  color: #666;
}

.empty {
  color: #777;
  font-style: italic;
}

.small {
  font-size: .78rem;
  line-height: 1.25;
}

.print-columns {
  display: grid;
  grid-template-columns: 1.12fr .88fr;
  gap: 10px;
  align-items: start;
}

@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .print-columns { grid-template-columns: 1fr; }
  .page-footer-shell { padding: 8px 16px 24px; }
  .site-footer-support { padding: 10px 0 0; }
  .site-footer-support-grid { grid-template-columns: 1fr; gap: 20px; }
  .footer-heading { font-size: 1.08rem; }
  #previewLocations.sheet-list,
  #previewNpcs.sheet-list,
  #printComplications.sheet-list {
    grid-template-columns: 1fr;
  }
  .section-jump-nav {
    display: none;
  }
}

/* ── Minimal mode toggle button ── */
.minimal-toggle-btn {
  position: absolute;
  top: -40px;
  right: 20px;
  z-index: 5;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel-shell);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.minimal-toggle-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}
.minimal-toggle-btn:hover {
  color: var(--text);
  background: var(--panel-2);
  box-shadow: 0 6px 18px rgba(0,0,0,.32);
}
.minimal-toggle-btn.is-active {
  background: var(--text);
  color: var(--panel-shell);
  border-color: var(--text);
}
body.is-minimal .minimal-toggle-btn {
  background: #2b2b2b;
  color: #f1ede8;
  border-color: #2b2b2b;
}
body.is-minimal .minimal-toggle-btn:hover {
  background: #3d3835;
  color: #f1ede8;
}

/* ── Minimal / monochrome mode ── */
body.is-minimal {
  --bg: #f1ede8;
  --panel: #f7f3ef;
  --panel-shell: #f7f3ef;
  --panel-2: #e8e3dc;
  --line: #c9c8c9;
  --text: #2b2b2b;
  --muted: #afa7a2;
  --accent: #2b2b2b;
  --danger: #b83232;
  --header-bg: #ddd8d2;
  --jump-hover-bg: #e3ddd7;
  --jump-panel-bg: #f7f3ef;
  --tab-bg: #e5e0d9;
  --tab-hover-bg: #dbd6cf;
  --field-bg: #f7f3ef;
  --field-border: #c9c8c9;
  --toolbar-bg: #e8e3dc;
  --button-bg: #f7f3ef;
  --button-border: #c9c8c9;
  --button-highlight: rgba(43,43,43,.03);
  --button-shadow: rgba(43,43,43,.06);
  --primary-button-bg: linear-gradient(180deg, #3d3835, #2b2b2b);
  --primary-button-border: #2b2b2b;
  --primary-button-text: #f1ede8;
  --shadow: 0 16px 40px rgba(43,43,43,.08);
  background: #f1ede8;
  background-image: none;
}
body.is-minimal::before {
  background-image:
    linear-gradient(rgba(43, 43, 43, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 43, 43, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, black 0%, black 30%, transparent 90%);
}
/* mode tabs */
body.is-minimal .mode-tab { background: #e5e0d9; color: #afa7a2; }
body.is-minimal .mode-tab:hover { background: #dbd6cf; color: #2b2b2b; }
body.is-minimal .mode-tab.is-active { background: #f7f3ef; color: #2b2b2b; }
body.is-minimal .mode-tab.is-active::before { border-color: #c9c8c9; }
body.is-minimal .mode-tab::after { background: #c9c8c9; }
/* panel */
body.is-minimal .panel-header a { color: #2b2b2b; }
body.is-minimal .header-subtitle,
body.is-minimal .header-copy { color: #6b6460; }
/* section jump nav — hardcoded colors need direct overrides */
body.is-minimal .section-jump-toggle {
  background: #f7f3ef;
  color: #2b2b2b;
  border-right: 0;
  box-shadow: none;
}
body.is-minimal .section-jump-toggle:hover,
body.is-minimal .section-jump-nav:hover .section-jump-toggle,
body.is-minimal .section-jump-nav:focus-within .section-jump-toggle {
  background: #e3ddd7;
  color: #2b2b2b;
  box-shadow: none;
}
body.is-minimal .section-jump-links {
  background: #f7f3ef;
  box-shadow: 0 8px 20px rgba(43,43,43,.10);
  border: 1px solid #c9c8c9;
}
body.is-minimal .section-jump-link {
  color: #afa7a2;
  border-top-color: #ddd8d2;
}
body.is-minimal .section-jump-link + .section-jump-link { border-top-color: #ddd8d2; }
body.is-minimal .section-jump-link:hover,
body.is-minimal .section-jump-nav:focus-within .section-jump-link:hover { color: #2b2b2b; }
/* section boxes */
body.is-minimal .section { border-color: #c9c8c9; background: #f4efe9; }
body.is-minimal .section-title h3 { color: #2b2b2b; }
body.is-minimal .section-hint { color: #5a5250; }
body.is-minimal label { color: #2b2b2b; }
/* inputs/selects — fantasy theme uses explicit gradient backgrounds */
body.is-minimal input,
body.is-minimal textarea,
body.is-minimal .core-pitch-editor {
  background: #f7f3ef;
  border-color: #c9c8c9;
  color: #2b2b2b;
}
body.is-minimal input::placeholder,
body.is-minimal textarea::placeholder { color: #c0b8b3; }
body.is-minimal select {
  background-color: #f7f3ef;
  background-image: linear-gradient(45deg, transparent 50%, #afa7a2 50%), linear-gradient(135deg, #afa7a2 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border-color: #c9c8c9;
  color: #2b2b2b;
}
body.is-minimal select option,
body.is-minimal select optgroup { background: #f7f3ef; color: #2b2b2b; }
/* item cards */
body.is-minimal .item-card {
  background: #faf7f4;
  border-color: #c9c8c9;
}
body.is-minimal .item-card-summary { color: #5a5250; }
body.is-minimal .item-card.card-toggle-flash { border-color: #c9c8c9; box-shadow: 0 0 0 2px rgba(43,43,43,.06); }
body.is-minimal .item-card.is-dragging { border-color: #2b2b2b; box-shadow: 0 12px 28px rgba(43,43,43,.12), 0 0 0 2px rgba(43,43,43,.10); }
body.is-minimal .drag-placeholder { border-color: rgba(43,43,43,.2); background: rgba(43,43,43,.03); }
/* type menu popup */
body.is-minimal .type-menu-popup {
  background: #f7f3ef;
  border-color: #c9c8c9;
  box-shadow: 0 8px 24px rgba(43,43,43,.10);
}
body.is-minimal .type-option:hover { background: #e3ddd7; }
body.is-minimal .type-option-symbol { color: #2b2b2b; }
body.is-minimal .type-menu-toggle,
body.is-minimal .pill { background: #f7f3ef; border-color: #c9c8c9; color: #2b2b2b; }
body.is-minimal .type-menu-toggle:not(.is-placeholder),
body.is-minimal .statblock-toggle.is-open { background: #e5e0d9; border-color: #afa7a2; color: #2b2b2b; box-shadow: none; }
/* fantasy-themed section buttons */
body.is-minimal .section .pill,
body.is-minimal .section button:not(.danger):not(.mode-tab):not(.section-jump-toggle):not(#newQuestBtn):not(#exportJsonBtn):not(#loadDemoBtn):not(#importJsonBtn):not(#printBtn):not(#printBtnBottom) {
  background: #f7f3ef;
  border-color: #c9c8c9;
  color: #2b2b2b;
}
body.is-minimal .section .pill:hover,
body.is-minimal .section button:not(.danger):not(.mode-tab):not(.section-jump-toggle):not(#newQuestBtn):not(#exportJsonBtn):not(#loadDemoBtn):not(#importJsonBtn):not(#printBtn):not(#printBtnBottom):hover {
  background: #e3ddd7;
  border-color: #afa7a2;
  color: #2b2b2b;
}
/* fantasy print/export button override */
body.is-minimal #printBtn,
body.is-minimal #printBtnBottom {
  background: linear-gradient(180deg, #3d3835, #2b2b2b) !important;
  border-color: #2b2b2b !important;
  color: #f1ede8 !important;
  box-shadow: none !important;
}
/* tag icons — reset fantasy filter */
body.is-minimal .tag-icon,
body.is-minimal .type-option-icon { filter: grayscale(1) brightness(0.45); }
/* rich editor */
body.is-minimal .rich-editor { border-color: #c9c8c9; }
body.is-minimal .rich-editor:focus-within { border-color: #2b2b2b; box-shadow: 0 0 0 3px rgba(43,43,43,.10); }
body.is-minimal .rich-toolbar { background: #e8e3dc; border-bottom-color: #c9c8c9; }
body.is-minimal .rich-toolbar-header { background: #e8e3dc; border-bottom-color: #c9c8c9; }
body.is-minimal .toolbar-toggle-btn { background: #f7f3ef; border-color: #c9c8c9; color: #2b2b2b; }
body.is-minimal .toolbar-toggle-btn:hover { border-color: #afa7a2; color: #2b2b2b; box-shadow: none; }
body.is-minimal .toolbar-btn { background: #f7f3ef; border-color: #c9c8c9; color: #2b2b2b; }
body.is-minimal .toolbar-btn:hover { background: #e3ddd7; color: #2b2b2b; }
/* primary/action buttons */
body.is-minimal .primary,
body.is-minimal .bottom-print-btn,
body.is-minimal .bottom-print-btn.primary {
  background: linear-gradient(180deg, #3d3835, #2b2b2b) !important;
  color: #f1ede8 !important;
  border-color: #2b2b2b !important;
  box-shadow: none !important;
}
/* tags */
body.is-minimal .tag { background: #e5e0d9; color: #afa7a2; border-color: #c9c8c9; }
body.is-minimal .tag-icon { filter: grayscale(1) brightness(0.45); }
/* stat blocks */
body.is-minimal .stat-block { background: #faf7f4; border-color: #c9c8c9; }
body.is-minimal .stat-label,
body.is-minimal .stat-box-label,
body.is-minimal .stat-strip-label { color: #afa7a2; }
body.is-minimal .stat-box { background: #f1ede8; border-color: #c9c8c9; color: #2b2b2b; }
/* sheet preview */
body.is-minimal .preview-shell { background: #f1ede8; }
body.is-minimal .print-sheet { background: #faf7f4; border-color: #c9c8c9; color: #2b2b2b; }
body.is-minimal .sheet-header { background: #ddd8d2; color: #2b2b2b; }
body.is-minimal .sheet-header h2,
body.is-minimal .sheet-header h3 { color: #2b2b2b; }
body.is-minimal .sheet-section { background: #f1ede8; border-color: #c9c8c9; border-left-color: #afa7a2; }
body.is-minimal .sheet-section h4 { color: #2b2b2b; }
body.is-minimal .sheet-field strong { color: #2b2b2b; }
body.is-minimal .sheet-field .empty { color: #c0b8b3; }
/* footer */
body.is-minimal .page-footer-shell { background: #f1ede8; }
body.is-minimal .footer-heading { color: #2b2b2b; }
body.is-minimal .footer-copy,
body.is-minimal .footer-meta-copy { color: #afa7a2; }
body.is-minimal .footer-meta-divider { background: #c9c8c9; }
body.is-minimal .site-footer-support::before {
  background: linear-gradient(90deg, rgba(43,43,43,0), rgba(43,43,43,0.15) 22%, rgba(43,43,43,0.15) 78%, rgba(43,43,43,0));
}
body.is-minimal .footer-link-btn,
body.is-minimal .footer-link-anchor { background: #f7f3ef; border-color: #c9c8c9; color: #2b2b2b; }
body.is-minimal .footer-link-btn:hover,
body.is-minimal .footer-link-anchor:hover { background: #e3ddd7; border-color: #afa7a2; color: #2b2b2b; }
body.is-minimal .footer-send-btn { background: #2b2b2b; border-color: #2b2b2b; color: #f1ede8; }
body.is-minimal .footer-send-btn:hover { background: #3d3835; }
body.is-minimal .footer-contact-form select { background-color: #f7f3ef; border-color: #c9c8c9; color: #2b2b2b; }
/* modal */
body.is-minimal .modal-overlay { background: rgba(43,43,43,.40); backdrop-filter: blur(2px); }
body.is-minimal .modal-card { background: #f7f3ef; border-color: #c9c8c9; color: #2b2b2b; box-shadow: 0 12px 32px rgba(43,43,43,.15); }
body.is-minimal .modal-card h2 { color: #2b2b2b; }
body.is-minimal .modal-eyebrow { color: #afa7a2; }
body.is-minimal .modal-card p { color: #5a5250; }
/* input focus ring */
body.is-minimal input:focus,
body.is-minimal select:focus,
body.is-minimal textarea:focus,
body.is-minimal .rich-editor:focus-within {
  border-color: #2b2b2b;
  box-shadow: 0 0 0 3px rgba(43,43,43,.10);
}

@media print {
  .section-jump-nav {
    display: none !important;
  }
  .page-footer-shell,
  .site-footer-support,
  .footer-meta {
    display: none !important;
  }
  html, body {
    background: #fff;
    font-size: 11px;
    line-height: 1.25;
  }
  body { margin: 0; }
  .app { display: block; padding: 0; max-width: none; }
  .panel:first-child { display: none !important; }
  .panel:last-child {
    border: 0;
    box-shadow: none;
    border-radius: 0;
  }
  .panel-header { display: none; }
  body:not(.print-preview-window) .preview-shell { padding: 0; background: #fff; }
  body:not(.print-preview-window) .print-sheet {
    box-shadow: none;
    margin: 0;
    max-width: none;
    width: 100%;
    padding: 0;
    font-size: 11px;
    border: 0;
  }
  body:not(.print-preview-window) .print-sheet,
  body:not(.print-preview-window) .print-sheet * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body:not(.print-preview-window) .sheet-section {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 7px;
    padding: 7px 8px;
    border-radius: 7px;
    background: #f0f0f0 !important;
  }
  body:not(.print-preview-window) .gm-notes-section {
    break-inside: auto;
    page-break-inside: auto;
    padding-top: 7px;
  }
  body:not(.print-preview-window) .flowing-section {
    break-inside: auto;
    page-break-inside: auto;
    padding-top: 7px;
  }
  body:not(.print-preview-window) .sheet-title {
    margin: 0 0 3px;
    font-size: 1.2rem;
    font-family: "Orbitron", "Barlow Condensed", "Arial Narrow", sans-serif;
    font-weight: 700;
    line-height: 1.05;
    padding-bottom: 2px;
  }
  body:not(.print-preview-window) .sheet-subtitle {
    margin-bottom: 2px;
    font-size: .92rem;
    line-height: 1.32;
  }
  body:not(.print-preview-window) .setup-intro {
    padding: 5px 7px;
    margin-bottom: 7px;
    border-radius: 6px;
  }
  body:not(.print-preview-window) .sheet-subtitle p,
  body:not(.print-preview-window) .sheet-subtitle ul {
    margin: 0;
  }
  body:not(.print-preview-window) .sheet-section h4 {
    margin: 0 0 5px;
    font-size: .72rem;
    letter-spacing: .04em;
  }
  body:not(.print-preview-window) .sheet-grid {
    gap: 5px 8px;
  }
  body:not(.print-preview-window) .sheet-list {
    gap: 5px;
  }
  body:not(.print-preview-window) #previewLocations.sheet-list,
  body:not(.print-preview-window) #previewNpcs.sheet-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 6px;
  }
  body:not(.print-preview-window) #printComplications.sheet-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 6px;
  }
  body:not(.print-preview-window) .sheet-item {
    padding: 5px 6px;
    border-radius: 5px;
    background: #fff !important;
  }
  body:not(.print-preview-window) .sheet-item-title {
    margin-bottom: 2px;
    font-size: .82rem;
  }
  body:not(.print-preview-window) .sheet-item-title-row {
    gap: 5px;
  }
  body:not(.print-preview-window) .sheet-field {
    line-height: 1.2;
  }
  body:not(.print-preview-window) .sheet-field + .sheet-field {
    margin-top: 4px;
  }
  body:not(.print-preview-window) .sheet-grid > .sheet-field,
  body:not(.print-preview-window) .sheet-grid > .sheet-field + .sheet-field {
    margin-top: 0;
  }
  body:not(.print-preview-window) .sheet-field strong {
    margin-bottom: 0;
    font-size: .6rem;
  }
  body:not(.print-preview-window) .print-tag-symbol {
    font-size: 1.08rem;
    vertical-align: middle;
  }
  body:not(.print-preview-window) .print-tag-icon {
    width: 1.08rem;
    height: 1.08rem;
  }
  body:not(.print-preview-window) .npc-name-symbol {
    vertical-align: middle;
  }
  body:not(.print-preview-window) .print-tag-separator {
    margin: 0 5px;
    font-size: .95rem;
  }
  body:not(.print-preview-window) .small {
    font-size: .72rem;
    line-height: 1.15;
  }
  body:not(.print-preview-window) .print-columns {
    display: block;
    gap: 0;
  }
  body:not(.print-preview-window) .empty {
    line-height: 1.15;
  }
  body:not(.print-preview-window) #previewLocations .empty,
  body:not(.print-preview-window) #previewNpcs .empty {
    grid-column: 1 / -1;
  }
  body:not(.print-preview-window) #printComplications .empty {
    grid-column: 1 / -1;
  }
  body.print-preview-window {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    color: #141414 !important;
  }
  body.print-preview-window::before,
  body.print-preview-window::after {
    display: none !important;
    content: none !important;
  }
  body.print-preview-window .print-sheet {
    background: #fff !important;
    color: #141414 !important;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 6mm 8mm !important;
    box-shadow: none !important;
    border: 0 !important;
  }
  body.print-preview-window .print-sheet,
  body.print-preview-window .print-sheet *,
  body.print-preview-window .stat-card-page,
  body.print-preview-window .stat-card-page * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  @page { size: A4; margin: 0; }
}

.print-preview-window {
  background: #d7d7d7;
  font-size: 11px;
  line-height: 1.25;
  margin: 0;
  padding: 12px;
  box-sizing: border-box;
}

.print-preview-window .print-sheet {
  box-shadow: none;
  margin: 0 auto;
  max-width: 262mm;
  width: min(262mm, calc(100vw - 48px));
  padding: 3mm 7mm 3mm;
  font-size: 11px;
  box-sizing: border-box;
  border: 0;
  background: #fff;
}

.print-preview-window .print-sheet,
.print-preview-window .print-sheet * {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.print-preview-window .sheet-section {
  break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 7px;
  padding: 7px 8px;
  border-radius: 7px;
}

.print-preview-window .gm-notes-section {
  break-inside: auto;
  page-break-inside: auto;
  padding-top: 7px;
}

.print-preview-window .flowing-section {
  break-inside: auto;
  page-break-inside: auto;
  padding-top: 7px;
}

.print-preview-window .sheet-title {
  margin: 0 0 3px;
  font-size: 1.2rem;
  font-family: "Orbitron", "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 700;
  line-height: 1.05;
  padding-bottom: 2px;
}

.print-preview-window .sheet-subtitle {
  margin-bottom: 2px;
  font-size: 1rem;
  line-height: 1.32;
}

.print-preview-window .sheet-subtitle font[size="2"] {
  font-size: .92rem;
}

.print-preview-window .sheet-subtitle font[size="3"] {
  font-size: 1rem;
}

.print-preview-window .sheet-subtitle font[size="4"] {
  font-size: 1.12rem;
}

.print-preview-window .sheet-subtitle font[size="5"] {
  font-size: 1.28rem;
}

.print-preview-window .print-hero-section {
  padding: 7px 8px;
}

.print-preview-window .print-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 21%);
  align-items: start;
  gap: 8px;
}

.print-preview-window .setup-intro {
  min-width: 0;
  padding: 7px 9px 8px;
  margin-bottom: 0;
  background: inherit;
  border: 0;
  border-radius: 0;
}

.print-preview-window .setup-intro h4 {
  margin: 0 0 4px;
  font-size: .72rem;
  letter-spacing: .04em;
  color: #7c1717;
}

.print-preview-window .print-hero-sidebar {
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 5px 7px;
  background: #f5f5f5;
  border-radius: 6px;
  color: #111;
}

.print-preview-window .print-hero-sidebar .sheet-field + .sheet-field {
  margin-top: 6px;
}

.print-preview-window .print-hero-section-no-hook .print-hero-layout {
  grid-template-columns: minmax(0, 1fr);
}

.print-preview-window .print-hero-section-no-hook .print-hero-sidebar {
  min-width: 0;
  max-width: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 12px;
}

.print-preview-window .print-hero-section-no-hook .print-hero-sidebar .sheet-field,
.print-preview-window .print-hero-section-no-hook .print-hero-sidebar .sheet-field + .sheet-field {
  margin-top: 0;
}

.print-preview-window .sheet-subtitle p,
.print-preview-window .sheet-subtitle ul {
  margin: 0;
}

.print-preview-window .sheet-section h4 {
  margin: 0 0 5px;
  font-size: .72rem;
  letter-spacing: .04em;
}

.print-preview-window .sheet-grid {
  gap: 5px 8px;
  align-items: start;
}

.print-preview-window .sheet-list {
  gap: 5px;
}

.print-preview-window #previewLocations.sheet-list,
.print-preview-window #previewNpcs.sheet-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 6px;
}

.print-preview-window #printComplications.sheet-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 6px;
}

.print-preview-window .sheet-item {
  padding: 5px 6px;
  border-radius: 5px;
}

.print-preview-window .sheet-item-title {
  margin-bottom: 2px;
  font-size: .82rem;
}

.print-preview-window .sheet-item-title-row {
  gap: 5px;
}

.print-preview-window .sheet-field {
  line-height: 1.2;
}

.print-preview-window .sheet-field + .sheet-field {
  margin-top: 4px;
}

.print-preview-window .sheet-grid > .sheet-field,
.print-preview-window .sheet-grid > .sheet-field + .sheet-field {
  margin-top: 0;
}

.print-preview-window .sheet-field strong {
  margin-bottom: 0;
  font-size: .6rem;
}

.print-preview-window .print-tag-symbol {
  font-size: 1.08rem;
  vertical-align: middle;
}

.print-preview-window .print-tag-icon {
  width: 1.08rem;
  height: 1.08rem;
}

.print-preview-window .npc-name-symbol {
  vertical-align: middle;
}

.print-preview-window .print-tag-separator {
  margin: 0 5px;
  font-size: .95rem;
}

.print-preview-window .small {
  font-size: .72rem;
  line-height: 1.15;
}

.print-preview-window .print-columns {
  display: block;
  gap: 0;
}

.print-preview-window .empty {
  line-height: 1.15;
}

@media (max-width: 720px) {
  .print-preview-window .print-hero-layout {
    grid-template-columns: 1fr;
  }

  .print-preview-window .print-hero-sidebar {
    min-width: 0;
    max-width: none;
  }
}

.print-preview-window #previewLocations .empty,
.print-preview-window #previewNpcs .empty {
  grid-column: 1 / -1;
}

.print-preview-window #printComplications .empty {
  grid-column: 1 / -1;
}

.theme-fantasy .print-sheet {
  background: #fff;
  color: #1f2e22;
}

.theme-fantasy .sheet-title {
  color: #0a3323;
  border-bottom-color: #839958;
  font-family: "Caudex", Georgia, serif;
}

.theme-fantasy .sheet-subtitle {
  color: #274236;
}

.theme-fantasy .setup-intro {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
}

.print-preview-window.theme-cyberpunk .setup-intro {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  color: #111;
}

.theme-fantasy .sheet-section {
  border-color: #c9d1af;
  border-left-color: #5f7444;
  background: #f0f0f0;
}

.theme-fantasy .sheet-section h4,
.theme-fantasy .sheet-field strong {
  color: #5f7444;
}

.theme-fantasy .sheet-item {
  border-color: #d9dec4;
  border-left-color: #105666;
  background: #fcfaee;
}

.theme-fantasy .sheet-item-title {
  color: #0a3323;
}

.theme-fantasy .sheet-item-role,
.theme-fantasy .sheet-subtle,
.theme-fantasy .small {
  color: #4d5a44;
}

.theme-fantasy .print-tag-separator {
  color: #839958;
}

.theme-fantasy .stat-box-value {
  font-family: "Rajdhani", "Segoe UI", sans-serif;
  font-size: .92rem;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: 0;
}

.stat-card-page {
  page-break-before: always;
  break-before: page;
  margin-top: 12px;
  padding: 0;
}

.stat-card-stack {
  display: grid;
  gap: 8mm;
}

.stat-card {
  --stat-red: #a31714;
  --stat-paper: #ffffff;
  --stat-paper-2: #ffffff;
  --stat-ink: #171717;
  --stat-cut: 14px;
  border: 6px solid var(--stat-red);
  background: var(--stat-paper);
  color: var(--stat-ink);
  display: grid;
  grid-template-columns: 58px 1fr;
  min-height: 198px;
  clip-path: polygon(var(--stat-cut) 0, 100% 0, 100% 100%, 0 100%, 0 var(--stat-cut));
  box-shadow: 0 0 0 1px rgba(0,0,0,.04);
  width: 156mm;
  max-width: 156mm;
  margin: 0 auto;
}

.stat-card-side {
  background: var(--stat-red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 1.7rem;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 calc(var(--stat-cut) + 2px));
}

.stat-card-main {
  padding: 7px 7px 7px 6px;
  display: grid;
  gap: 5px;
}

.stat-row-6,
.stat-row-5,
.stat-row-4,
.stat-row-3,
.stat-row-2 {
  display: grid;
  gap: 4px;
}

.stat-row-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stat-row-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stat-box,
.stat-panel,
.stat-strip {
  border: 2px solid var(--stat-red);
  background: var(--stat-paper-2);
}

.stat-box {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.stat-box-label,
.stat-panel-head,
.stat-strip-label {
  background: var(--stat-red);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .72rem;
  line-height: 1;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
}

.stat-box-label { padding: 3px 6px; }
.stat-box-value {
  padding: 2px 8px 1px;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: .95;
  justify-self: center;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  letter-spacing: .02em;
}

.stat-panel-head,
.stat-strip-label {
  padding: 3px 6px;
}

.stat-panel-body {
  padding: 4px 6px;
}

.stat-strip-writing .stat-panel-body {
  min-height: 18mm;
  display: flex;
  align-items: flex-start;
}

.stat-table {
  width: 100%;
  border-collapse: collapse;
}

.stat-table td {
  border-top: 2px solid var(--stat-red);
  padding: 2px 5px;
  font-size: .78rem;
  vertical-align: top;
}

.stat-table tr:first-child td {
  border-top: 0;
}

.stat-table td:last-child {
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
  font-family: "Rajdhani", "Segoe UI", sans-serif;
}

.stat-text {
  font-size: .78rem;
  line-height: 1.18;
  font-family: "Rajdhani", "Segoe UI", sans-serif;
}

.fantasy-stat-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7mm 6mm;
  align-items: start;
}

.fantasy-stat-stack-nimble {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5mm 4mm;
}

.fantasy-stat-card {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 9px 10px 10px;
  border: 2px solid #8b4a22;
  background: #f8f1dc;
  color: #3a2214;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .04);
}

.fantasy-stat-header {
  display: grid;
  gap: 3px;
}

.fantasy-stat-title {
  font-family: "Caudex", Georgia, serif;
  font-size: 1.5rem;
  line-height: 1;
  color: #8b2f1b;
}

.fantasy-stat-role {
  font-size: .88rem;
  font-weight: 700;
}

.fantasy-stat-system {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8b4a22;
}

.fantasy-stat-type {
  font-style: italic;
  font-size: .84rem;
}

.fantasy-stat-divider {
  height: 0;
  border-top: 2px solid #8b4a22;
  margin: 8px 0;
}

.fantasy-stat-summary,
.fantasy-stat-detail-grid {
  display: grid;
  gap: 4px;
}

.fantasy-stat-summary-nimble,
.fantasy-stat-detail-grid-nimble {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 8px;
}

.fantasy-stat-summary-generic {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 8px;
}

.generic-stat-card {
  padding: 8px 9px 9px;
}

.generic-stat-card .fantasy-stat-header {
  gap: 2px;
}

.generic-stat-card .fantasy-stat-title {
  font-size: 1.34rem;
}

.generic-stat-card .fantasy-stat-role,
.generic-stat-card .fantasy-stat-type {
  font-size: .78rem;
}

.generic-stat-card .fantasy-stat-divider {
  margin: 6px 0;
}

.generic-stat-card .fantasy-stat-summary {
  gap: 3px;
}

.generic-stat-card .fantasy-stat-line {
  font-size: .72rem;
  line-height: 1.16;
}

.generic-stat-card .fantasy-stat-section {
  margin-top: 7px;
}

.generic-stat-card .fantasy-stat-section h5 {
  margin-bottom: 2px;
  padding-bottom: 2px;
  font-size: .9rem;
}

.generic-stat-card .fantasy-stat-section-body {
  min-height: 0;
  font-size: .72rem;
  line-height: 1.18;
}

.fantasy-stat-summary-nimble {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.fantasy-stat-detail-grid-nimble {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nimble-stat-card {
  position: relative;
  padding: 11px 14px 12px;
  border-width: 1.5px;
  border-color: #585047;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.26), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,.22), rgba(0,0,0,0) 24%),
    #f3ead6;
  box-shadow: none;
}

.nimble-stat-topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: .7rem;
  line-height: 1;
  color: #383027;
  text-transform: uppercase;
}

.nimble-stat-meta-left {
  font-weight: 700;
  letter-spacing: .03em;
}

.nimble-stat-meta-right {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  font-weight: 700;
}

.nimble-stat-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nimble-stat-meta-icon {
  position: relative;
  display: inline-block;
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
}

.nimble-stat-meta-item-heart .nimble-stat-meta-icon::before,
.nimble-stat-meta-item-heart .nimble-stat-meta-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 10px;
  background: currentColor;
  border-radius: 6px 6px 0 0;
  top: 0;
}

.nimble-stat-meta-item-heart .nimble-stat-meta-icon::before {
  left: 5px;
  transform: rotate(-45deg);
  transform-origin: 0 100%;
}

.nimble-stat-meta-item-heart .nimble-stat-meta-icon::after {
  left: 0;
  transform: rotate(45deg);
  transform-origin: 100% 100%;
}

.nimble-stat-meta-item-speed .nimble-stat-meta-icon::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 11px solid currentColor;
}

.nimble-stat-meta-item-speed .nimble-stat-meta-icon::after {
  content: none;
}

.nimble-stat-title {
  margin-top: 2px;
  font-size: 2.05rem;
  line-height: .94;
  letter-spacing: -.02em;
  text-transform: uppercase;
  color: #1f1713;
}

.nimble-stat-banner {
  position: relative;
  margin: 10px -14px 10px;
  padding: 8px 22px;
  background: #d4cab6;
  font-size: .82rem;
  line-height: 1.18;
  font-style: italic;
  text-align: center;
  color: #2f2823;
}

.nimble-stat-banner::before,
.nimble-stat-banner::after {
  content: "";
  position: absolute;
  top: 0;
  width: 18px;
  height: 100%;
  background: inherit;
}

.nimble-stat-banner::before {
  left: -13px;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.nimble-stat-banner::after {
  right: -13px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.nimble-stat-rule {
  height: 0;
  border-top: 1px solid #6d5844;
  margin: 8px 0 9px;
}

.nimble-stat-block,
.nimble-stat-footer {
  font-size: .78rem;
  line-height: 1.2;
  color: #2b241e;
}

.nimble-stat-actions strong,
.nimble-stat-footer-line strong {
  color: #171311;
  text-transform: uppercase;
}

.nimble-stat-footer-line + .nimble-stat-footer-line {
  margin-top: 5px;
}

.nimble-stat-builder {
  margin-top: 9px;
  padding-top: 7px;
  border-top: 1px solid rgba(109, 88, 68, .8);
  font-size: .68rem;
  line-height: 1.15;
  color: #5a4330;
}

.fantasy-stat-abilities {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
}

.fantasy-stat-ability {
  border: 1px solid #d7c7ad;
  background: #fff;
  padding: 3px 4px;
  text-align: center;
}

.fantasy-stat-ability strong {
  display: block;
  margin-bottom: 2px;
  color: #8b2f1b;
  font-family: "Caudex", Georgia, serif;
  font-size: .78rem;
  letter-spacing: .04em;
}

.fantasy-stat-ability span {
  display: block;
  color: #3f2c18;
  font-family: "Rajdhani", "Segoe UI", sans-serif;
  font-size: .84rem;
  line-height: 1.1;
  font-weight: 700;
}

.fantasy-stat-line {
  font-size: .76rem;
  line-height: 1.24;
}

.fantasy-stat-line strong {
  color: #8b2f1b;
}

.fantasy-stat-detail-grid .fantasy-stat-line + .fantasy-stat-line {
  margin-top: 0;
}

.fantasy-stat-section {
  margin-top: 10px;
}

.fantasy-stat-section h5 {
  margin: 0 0 4px;
  padding-bottom: 3px;
  border-bottom: 2px solid #8b4a22;
  font-family: "Caudex", Georgia, serif;
  font-size: .98rem;
  font-variant: small-caps;
  letter-spacing: .05em;
  color: #8b2f1b;
}

.fantasy-stat-section-body {
  min-height: 11mm;
  font-size: .76rem;
  line-height: 1.28;
  white-space: normal;
}

@media print {
  .stat-card-page {
    margin-top: 0;
    padding: 0;
  }
  .stat-card-stack {
    gap: 6mm;
  }
  .stat-card,
  .stat-card * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .stat-card {
    border-width: 5px;
    --stat-cut: 12px;
    background: #fff !important;
    width: 154mm;
    max-width: 154mm;
    margin: 0 auto;
  }
  .stat-box,
  .stat-panel,
  .stat-strip,
  .stat-panel-body {
    background: #fff !important;
  }
  .stat-card-side,
  .stat-box-label,
  .stat-panel-head,
  .stat-strip-label {
    background: var(--stat-red) !important;
    color: #fff !important;
  }

  .fantasy-stat-card,
  .fantasy-stat-card * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
