:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #697680;
  --line: #dbe2e7;
  --line-strong: #b8c5cc;
  --page: #fffdf9;
  --surface: #ffffff;
  --app: #eef2f5;
  --soft: #f5f7f8;
  --accent: #1c6d72;
  --accent-dark: #124b4f;
  --accent-soft: #e4f1ef;
  --amber: #b98225;
  --danger: #a64038;
  --shadow: 0 18px 50px rgba(20, 35, 45, 0.14);
  --sheet-content-font: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--app);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

button {
  min-height: 38px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

button:active {
  transform: translateY(1px);
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

button.primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

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

button.danger:hover {
  background: #fff0ed;
}

.boot-screen {
  display: grid;
  min-height: 100vh;
  place-content: center;
  gap: 8px;
  text-align: center;
}

.boot-screen h1 {
  margin: 0;
  font-size: 28px;
}

.boot-screen p {
  margin: 0;
  color: var(--muted);
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 20px rgba(20, 35, 45, 0.05);
  backdrop-filter: blur(10px);
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.top-actions button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.settings-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: 21px;
  line-height: 1;
}

.settings-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.character-select {
  min-width: 220px;
  min-height: 38px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--ink);
}

.status {
  min-width: 126px;
  align-self: center;
  color: var(--accent-dark);
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(620px, 1fr);
  min-height: 0;
}

.preview-panel {
  min-width: 0;
  padding: 18px;
}

.page-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(20, 35, 45, 0.06);
}

.page-tabs button {
  min-width: 126px;
  border-color: transparent;
  background: transparent;
}

.page-tabs button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.character-manager {
  width: min(100%, 900px);
  margin: 0 auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-page {
  width: min(100%, 900px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #f8fbfa, var(--accent-soft));
}

.settings-kicker {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-head h2 {
  margin: 5px 0 0;
  font-size: 27px;
}

.settings-head p {
  max-width: 610px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.settings-card {
  display: grid;
  gap: 20px;
  padding: 28px 30px 32px;
}

.settings-card-copy h3 {
  margin: 0;
  font-size: 20px;
}

.settings-card-copy p,
.font-library p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.font-upload {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 16px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--soft);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.font-upload:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.font-upload.disabled {
  cursor: wait;
  opacity: 0.68;
}

.font-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.font-upload-icon {
  display: grid;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 700;
}

.font-upload strong,
.font-upload small {
  display: block;
}

.font-upload small {
  margin-top: 4px;
  color: var(--muted);
}

.font-choice {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(240px, 1fr);
  align-items: center;
  gap: 16px;
  font-weight: 700;
}

.font-choice select {
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  background: var(--surface);
  color: var(--ink);
}

.settings-font-preview {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
}

.settings-font-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-font-preview p {
  margin: 10px 0 0;
  color: var(--ink);
  font-family: var(--sheet-content-font);
  font-size: 20px;
  line-height: 1.5;
}

.font-library {
  padding-top: 2px;
}

.font-library ul {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.font-library li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.font-library li.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.font-library small {
  color: var(--muted);
}

.settings-status {
  min-height: 20px;
  margin: 0;
  color: var(--accent-dark);
  font-size: 13px;
}

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

.manager-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.manager-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.character-list {
  display: grid;
  gap: 9px;
  padding-top: 14px;
}

.character-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.character-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.character-name-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.character-name-field label,
.character-meta span {
  color: var(--muted);
  font-size: 12px;
}

.character-name-field input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.character-meta {
  display: grid;
  gap: 4px;
  min-width: 190px;
}

.character-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.character-actions button:disabled {
  opacity: 0.55;
  cursor: default;
}

.empty-manager {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-manager h3 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
}

.empty-manager p {
  margin: 8px 0 0;
}

.sheet-wrap {
  display: grid;
  place-items: start center;
  overflow: auto;
  max-height: calc(100vh - 142px);
  padding: 10px 10px 34px;
}

.sheet-paper {
  position: relative;
  width: min(100%, 900px);
  aspect-ratio: 210 / 297;
  overflow: hidden;
  border: 1px solid #cbd5dc;
  border-radius: 8px;
  background: var(--page);
  box-shadow: var(--shadow);
}

.document-sheet {
  background: #fbfcfa;
}

.document-sheet::before,
.document-sheet::after {
  content: none;
}

.page-one-document {
  position: absolute;
  inset: 34px 36px;
  display: grid;
  grid-template-rows: 118px minmax(0, 1fr) 188px;
  gap: 12px;
  color: #131b20;
  font-size: 10px;
}

.doc-header {
  display: grid;
  grid-template-columns: 40% minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.doc-main-grid {
  display: grid;
  grid-template-columns: 28% 32% minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.doc-column {
  display: grid;
  gap: 9px;
  min-height: 0;
}

.left-column {
  grid-template-rows: 270px 128px minmax(0, 1fr);
}

.middle-column {
  grid-template-rows: 82px 68px 80px minmax(0, 1fr);
}

.right-column {
  grid-template-rows: 220px 255px minmax(0, 1fr);
}

.doc-footer-grid {
  display: grid;
  grid-template-columns: 42% minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.doc-card {
  display: grid;
  grid-template-rows: 24px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid #c9d5d8;
  border-radius: 8px;
  background: #ffffff;
}

.doc-card-title {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0 10px;
  background: #e7f0ef;
  color: #315257;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.doc-card-body {
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.attacks-card .doc-card-body,
.wide-card .doc-card-body {
  background: #ffffff;
}

.identity-card .doc-card-body {
  display: grid;
  align-items: center;
}

.doc-value {
  min-height: 18px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 4px;
  color: #11181d;
  line-height: 1.18;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  white-space: pre-wrap;
  cursor: pointer;
}

.doc-value:hover {
  border-color: rgba(28, 109, 114, 0.35);
  background: #f5fbfa;
}

.doc-value-content {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.doc-value.selected {
  border-color: var(--accent);
  background: #e4f1ef;
  box-shadow: inset 0 0 0 1px rgba(28, 109, 114, 0.24);
}

.doc-value.multiline {
  width: 100%;
  height: 100%;
  min-height: 0;
  font-size: 14px;
  line-height: 1.16;
}

.doc-placeholder {
  color: transparent;
}

.doc-character-name {
  display: grid;
  place-items: center;
  min-height: 58px;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}

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

.meta-grid label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.meta-grid label span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.meta-grid .doc-value {
  min-height: 25px;
  border-bottom: 0;
  border-radius: 0;
  padding: 3px 0 2px;
  font-size: 13px;
  font-weight: 650;
}

.ability-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  height: 100%;
}

.ability-tile {
  display: grid;
  grid-template-rows: 18px minmax(0, 1fr) 18px;
  overflow: hidden;
  border: 1px solid #d6e1e3;
  border-radius: 8px;
  background: #f8fbfa;
}

.ability-name {
  display: grid;
  place-items: center;
  color: #315257;
  font-size: 8.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.ability-mod {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.ability-save {
  display: grid;
  grid-template-columns: 1fr 36px;
  align-items: center;
  gap: 3px;
  border-top: 0;
  padding: 0 5px;
  color: var(--muted);
  font-size: 8px;
}

.mini-value {
  min-height: 15px;
  padding: 0 2px;
  color: #11181d;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.stat-list {
  display: grid;
  gap: 2px;
  height: 100%;
}

.stat-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  min-height: 15px;
  border-bottom: 0;
}

.skill-list .stat-row {
  min-height: 14px;
}

.row-value {
  min-height: 14px;
  padding: 0 3px;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.row-label {
  min-width: 0;
  overflow: hidden;
  color: #36454c;
  font-size: 8.2px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.top-stats-grid,
.support-stats-grid,
.health-grid {
  display: grid;
  gap: 8px;
  min-height: 0;
}

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

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

.number-card .doc-card-body {
  display: grid;
  place-items: center;
  padding: 5px;
}

.number-card .doc-card-title {
  justify-content: center;
  padding: 0 4px;
  font-size: 7.8px;
  text-align: center;
}

.big-number,
.medium-number {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-weight: 800;
  text-align: center;
}

.big-number {
  font-size: 25px;
}

.medium-number {
  font-size: 18px;
}

.weapon-table {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 0.9fr) minmax(0, 0.95fr) minmax(0, 0.95fr) minmax(0, 1fr);
  grid-template-rows: 18px repeat(3, 44px);
  grid-auto-rows: 44px;
  align-content: start;
  gap: 5px;
  height: 100%;
  position: relative;
}

.weapon-head {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.weapon-cell {
  min-height: 0;
  border-radius: 6px;
  background: #f5f7f8;
  font-size: 8.8px;
  font-weight: 650;
}

.center-cell {
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.money-card .doc-card-body {
  display: grid;
  gap: 5px;
}

.coin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 4px;
  min-height: 22px;
}

.coin-row > span {
  color: var(--muted);
  font-size: 8px;
}

.coin-value {
  min-height: 20px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.gear-card .doc-card-body {
  padding: 7px;
}

.gear-card .doc-value {
  font-size: 8.6px;
  line-height: 1.16;
}

.footer-equipment-grid {
  display: grid;
  grid-template-columns: 23% minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
}

.footer-gear-card .doc-card-body {
  padding: 8px;
}

.traits-card .doc-card-body {
  display: grid;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.trait-block {
  display: grid;
  grid-template-rows: 11px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border-bottom: 0;
}

.trait-block > span {
  color: var(--muted);
  font-size: 7.8px;
  font-weight: 800;
  text-transform: uppercase;
}

.features-card .doc-value {
  font-size: 8.3px;
  line-height: 1.15;
}

.character-skills-card .doc-card-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 6px;
}

.class-features-card .doc-card-body {
  display: grid;
}

.wide-card .doc-card-body {
  display: grid;
  gap: 6px;
}

.wide-card .doc-value {
  font-size: 10px;
}

.page-one-document.source-page-one {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  color: #11181d;
  font-size: 10px;
}

.source-box,
.source-pill {
  position: absolute;
  overflow: hidden;
  border: 1px solid #8da1a8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 20px rgba(20, 35, 45, 0.06);
}

.source-box {
  display: grid;
  grid-template-rows: 22px minmax(0, 1fr);
  min-height: 0;
}

.source-box.title-bottom {
  grid-template-rows: 22px minmax(0, 1fr);
}

.source-box-no-title {
  grid-template-rows: minmax(0, 1fr);
}

.source-box-title {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0 7px;
  border-bottom: 0;
  background: #edf3f2;
  color: #1e373d;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.title-bottom .source-box-title {
  order: 0;
  border-top: 0;
  border-bottom: 0;
}

.title-bottom .source-box-body {
  order: 0;
}

.source-box-body {
  display: grid;
  min-height: 0;
  overflow: hidden;
  padding: 6px;
}

.source-box .doc-value,
.source-pill .doc-value {
  border-radius: 5px;
}

.source-name-box {
  border-color: #6d8087;
  border-radius: 10px;
}

.source-name-box .source-box-body {
  align-items: center;
  padding: 8px 16px 3px;
}

.source-name-box .source-box-title {
  justify-content: flex-start;
  padding-left: 14px;
  background: transparent;
  color: #27343b;
  font-size: 8px;
}

.source-name-box .doc-character-name {
  min-height: 0;
  font-size: 23px;
}

.source-identity-box {
  border-color: #8da1a8;
}

.source-identity-box .source-box-body {
  place-items: center;
  padding: 2px 8px 3px;
}

.source-identity-value {
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.05;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.source-meta-box {
  border-color: #6d8087;
  border-radius: 10px;
}

.source-meta-box .source-box-body {
  align-content: center;
  padding: 16px 18px 12px;
}

.source-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  gap: 18px;
  min-height: 0;
  height: 100%;
}

.source-meta-item {
  display: grid;
  grid-template-rows: 13px minmax(0, 1fr);
  gap: 2px;
  min-width: 0;
  border-bottom: 0;
}

.source-meta-item span {
  align-self: start;
  color: #1e2b31;
  font-size: 8px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.source-meta-item .doc-value {
  min-height: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.15;
}

.source-ability-box {
  border-radius: 11px;
  background: #f9fbfb;
}

.source-ability-box .source-box-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 22px;
  padding: 3px 6px 5px;
}

.source-ability-box .source-box-title {
  min-height: 22px;
  background: #edf3f2;
  color: #1e373d;
  font-size: 8px;
  font-weight: 900;
}

.source-ability-box .ability-mod {
  display: grid;
  place-items: center;
  min-height: 0;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.ability-score {
  display: grid;
  place-items: center;
  min-height: 18px;
  border: 1px solid #d6e0e3;
  border-radius: 999px;
  background: #ffffff;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.source-pill {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
}

.source-pill-value {
  display: grid;
  place-items: center;
  min-height: 24px;
  border: 1px solid #cfdbdf;
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.source-pill-title {
  min-width: 0;
  color: #182329;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.source-passive-pill {
  grid-template-columns: 54px minmax(0, 1fr);
}

.source-list-box .source-box-body {
  padding: 6px 6px 4px;
}

.source-stat-list {
  display: grid;
  align-content: start;
  gap: 2px;
  min-height: 0;
}

.source-saves-box .source-stat-list {
  grid-template-rows: repeat(6, 1fr);
}

.source-skill-list {
  grid-template-rows: repeat(18, 1fr);
}

.source-stat-row {
  display: grid;
  grid-template-columns: 14px 28px minmax(0, 1fr);
  align-items: center;
  min-height: 0;
  border-bottom: 0;
}

.source-dot {
  position: relative;
  justify-self: center;
  align-self: center;
  width: 16px;
  height: 16px;
  min-height: 0;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.source-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 1px solid #37464d;
  border-radius: 999px;
  background: #fff;
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.source-dot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  box-sizing: border-box;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.source-dot:hover::after {
  border-color: var(--accent);
  background: #e4f1ef;
}

.source-dot.active::after {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(28, 109, 114, 0.16);
}

.source-dot.expert::after {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: none;
}

.source-dot.expert::before {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(28, 109, 114, 0.18);
}

.source-stat-row .row-value {
  min-height: 14px;
  padding: 0 2px;
  border-bottom: 0;
  border-radius: 0;
  font-size: 9.5px;
  font-weight: 850;
}

.source-stat-row .row-label {
  font-size: 8px;
}

.source-number-box .source-box-body {
  place-items: center;
  padding: 5px;
}

.source-number-box .big-number {
  font-size: 27px;
}

.source-health-box .source-box-body {
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 7px 9px;
}

.health-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  align-items: center;
  gap: 8px;
  min-height: 0;
}

.source-health-box .health-line + .health-line {
  border-top: 0;
  padding-top: 5px;
}

.health-line > span,
.health-area > span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.health-value {
  min-height: 20px;
  border-bottom: 0;
  border-radius: 0;
  font-size: 14px;
  font-weight: 850;
  text-align: center;
}

.health-area {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 12px;
  min-height: 0;
  border-top: 0;
}

.health-area > span {
  align-self: end;
  justify-self: center;
  text-transform: uppercase;
}

.health-fill {
  min-height: 0;
  padding: 0;
}

.source-hitdice-box .source-box-body {
  align-items: start;
  padding: 7px;
}

.source-hitdice-box .health-line {
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 5px;
}

.source-death-box .source-box-body {
  align-content: center;
  gap: 8px;
  padding: 8px;
}

.death-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, 16px);
  align-items: center;
  gap: 5px;
}

.death-row span {
  color: #1c2b31;
  font-size: 8px;
  font-weight: 850;
  text-transform: uppercase;
}

.death-row i {
  width: 14px;
  height: 14px;
  border: 1px solid #33444b;
  border-radius: 999px;
  background: #fff;
}

.lined-box .source-box-body {
  background: #ffffff;
}

.source-attacks-box .source-box-body {
  padding: 6px 8px;
}

.source-attacks-box .weapon-table {
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 0.88fr) minmax(0, 0.92fr) minmax(0, 1.35fr) minmax(0, 1fr);
  grid-template-rows: 15px repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding-right: 4px;
  min-height: 0;
  height: 100%;
}

.source-attacks-box .weapon-head {
  display: grid;
  place-items: center;
  justify-content: center;
  text-align: center;
  font-size: 6.4px;
}

.source-attacks-box .weapon-cell {
  display: grid;
  align-items: center;
  min-height: 0;
  background: #eff3f4;
  font-size: 14px;
  line-height: 1.08;
}

.source-attacks-box .weapon-type-cell {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  font-size: 14px;
  line-height: 1.06;
}

.source-attacks-box .weapon-range-cell {
  place-items: center;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  font-size: 14px;
  line-height: 1.06;
  text-align: center;
  white-space: nowrap;
}

.source-attacks-box .weapon-range-cell .nowrap-value {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: keep-all;
}

.source-money-box .source-box-body {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  align-items: start;
  gap: 4px;
  padding: 5px 7px 12px;
}

.source-money-box .coin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  justify-items: center;
  align-content: start;
  gap: 3px;
  min-height: 0;
}

.source-money-box .coin-row > span {
  max-width: 100%;
  overflow: hidden;
  color: #63717a;
  font-size: 6.4px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.source-money-box .coin-value {
  display: grid;
  place-items: center;
  width: min(46px, 100%);
  min-height: 22px;
  padding: 2px 4px;
  border: 1px solid #d6e0e3;
  border-radius: 5px;
  background: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.source-proficiencies-box .source-box-body {
  padding: 8px;
}

.source-proficiencies-box .source-box-title {
  padding: 0 8px;
}

.armor-title-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
}

.armor-title-grid span {
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.armor-title-grid span:last-child {
  text-align: center;
}

.armor-table {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 5px;
  min-height: 0;
  height: 100%;
}

.armor-head {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 8px;
  font-weight: 850;
  text-transform: uppercase;
}

.armor-head:nth-child(2) {
  justify-content: center;
}

.armor-cell {
  display: grid;
  align-items: center;
  min-height: 0;
  border-radius: 6px;
  background: #eff3f4;
  font-size: 8.6px;
  font-weight: 650;
}

.armor-ac-cell {
  place-items: center;
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.source-equipment-box .source-box-body,
.source-features-box .source-box-body,
.source-trait-box .source-box-body {
  padding: 8px;
}

.source-equipment-box .doc-value,
.source-features-box .doc-value,
.source-trait-box .doc-value {
  font-size: 14px;
  line-height: 1.14;
}

.source-features-box .source-box-body {
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

.source-features-box .doc-value {
  min-height: 0;
}

.modern-sheet::before {
  content: "";
  position: absolute;
  inset: 2.4%;
  border: 1px solid rgba(28, 109, 114, 0.17);
  border-radius: 7px;
  pointer-events: none;
}

.modern-sheet::after {
  content: "DUNGEONS & DRAGONS";
  position: absolute;
  left: 5%;
  top: 2.5%;
  color: rgba(20, 75, 79, 0.82);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.sheet-paper.document-sheet::before,
.sheet-paper.document-sheet::after {
  content: none;
}

.sheet-scaffold {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.sheet-section,
.detail-box {
  position: absolute;
  overflow: hidden;
  border: 1px solid rgba(80, 100, 112, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.sheet-section {
  background: rgba(255, 255, 255, 0.72);
}

.sheet-section::before,
.detail-box::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 20px;
  background: #f0f4f5;
  border-bottom: 0;
}

.sheet-section span,
.detail-box span {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 5px;
  z-index: 1;
  color: rgba(23, 32, 38, 0.72);
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
}

.detail-box {
  z-index: 1;
  background: rgba(255, 255, 255, 0.48);
  pointer-events: none;
}

.detail-ability {
  border-color: rgba(28, 109, 114, 0.32);
  background: rgba(244, 249, 248, 0.72);
}

.detail-ability::before {
  height: 23px;
  background: #e7f1ef;
}

.detail-pill {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.detail-pill span {
  left: 44%;
  text-align: left;
}

.detail-stat-small {
  border-color: rgba(185, 130, 37, 0.38);
  background: rgba(255, 250, 241, 0.8);
}

.detail-panel span,
.detail-stat-small span {
  top: 5px;
  bottom: auto;
}

.section-abilities,
.section-money {
  border-color: rgba(28, 109, 114, 0.24);
  background: rgba(239, 247, 246, 0.6);
}

.section-features,
.section-equipment,
.section-allies,
.section-extra,
.section-treasure {
  border-color: rgba(185, 130, 37, 0.24);
}

.detail-label {
  position: absolute;
  z-index: 1;
  color: rgba(69, 83, 91, 0.68);
  font-size: 8.2px;
  font-weight: 700;
  line-height: 1.05;
  pointer-events: none;
  white-space: nowrap;
}

.page-2 .detail-label,
.page-3 .detail-label {
  text-align: center;
}

.page-3 .detail-label {
  font-size: 6.8px;
  line-height: 1.08;
  white-space: normal;
}

.sheet-text {
  position: absolute;
  z-index: 2;
  display: block;
  overflow: hidden;
  padding: 0.12em 0.24em;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #10171b;
  line-height: var(--lh, 1.14);
  white-space: pre-wrap;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  cursor: pointer;
}

.sheet-text.tone-value {
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.42);
  white-space: pre;
  overflow-wrap: normal;
}

.sheet-text.tone-name {
  display: grid;
  place-items: center;
  color: var(--ink);
  white-space: pre;
}

.sheet-text.tone-meta {
  color: #25343a;
}

.sheet-text.tone-long {
  padding: 0.22em 0.38em;
}

.sheet-text.selected {
  z-index: 4;
  border-color: rgba(28, 109, 114, 0.9);
  background: rgba(228, 241, 239, 0.72);
  box-shadow: 0 0 0 3px rgba(28, 109, 114, 0.14);
}

.sheet-text.overflow {
  border-color: rgba(166, 64, 56, 0.78);
  background: rgba(255, 238, 235, 0.72);
}

.template-field {
  position: absolute;
  z-index: 2;
  min-width: 0;
  min-height: 0;
}

.template-field .doc-value {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 4px;
  padding: 3px 5px;
  background: transparent;
  color: var(--class-ink);
}

.template-field .doc-value:hover {
  border-color: color-mix(in srgb, var(--class-accent) 42%, transparent);
  background: color-mix(in srgb, var(--class-surface) 45%, transparent);
}

.template-field .doc-placeholder {
  color: color-mix(in srgb, var(--class-ink) 25%, transparent);
}

.template-name-field .doc-value,
.spell-stat-field .doc-value,
.spell-slot-field .doc-value,
.template-bio-field .doc-value,
.organization-name-field .doc-value {
  display: grid;
  place-items: center;
  font-weight: 750;
  line-height: 1.05;
  text-align: center;
}

.template-name-field .doc-value {
  font-size: 14px;
}

.template-bio-field .doc-value,
.organization-name-field .doc-value {
  font-size: 10px;
}

.spell-stat-field .doc-value {
  font-size: 15px;
}

.template-writing-field .doc-value {
  overflow: hidden;
  padding: 5px 7px;
  font-size: 14px;
  line-height: 1.12;
}

.template-image-field {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed color-mix(in srgb, var(--class-line) 32%, transparent);
  border-radius: calc(var(--class-radius) - 2px);
  background: color-mix(in srgb, var(--class-surface) 36%, transparent);
  cursor: pointer;
}

.template-image-field.has-image {
  border-style: solid;
}

.template-image-field img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.template-image-hint {
  max-width: 78%;
  color: color-mix(in srgb, var(--class-ink) 38%, transparent);
  font: 600 8px/1.25 Georgia, 'Times New Roman', serif;
  text-align: center;
}

.organization-symbol-caption {
  position: absolute;
  z-index: 2;
  color: color-mix(in srgb, var(--class-ink) 68%, transparent);
  font: 700 7px/1 Georgia, 'Times New Roman', serif;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
}

.spell-slot-caption {
  position: absolute;
  z-index: 2;
  width: 5.5%;
  color: color-mix(in srgb, var(--class-ink) 60%, transparent);
  font: 700 6px/1 Georgia, 'Times New Roman', serif;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
}

.spell-slot-field .doc-value {
  border-bottom: 1px solid color-mix(in srgb, var(--class-line) 36%, transparent);
  border-radius: 0;
  padding: 0;
  font-size: 10px;
}

.spell-list-field .doc-value {
  padding: 3px 5px;
}

.sheet-image-field {
  padding: 0;
  background: rgba(245, 247, 248, 0.8);
}

.sheet-image-field img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-file-input {
  display: none;
}

.rich-heading {
  display: inline-block;
  margin-bottom: 0.25em;
  color: var(--accent-dark);
  font-weight: 800;
}

.sheet-text strong {
  color: #172026;
  font-weight: 800;
}

.inline-field-editor {
  position: absolute;
  z-index: 30;
  min-width: 24px;
  min-height: 18px;
  resize: none;
  overflow: auto;
  border: 1px solid var(--accent);
  border-radius: 5px;
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.98);
  color: #11181d;
  box-shadow: 0 0 0 3px rgba(28, 109, 114, 0.14), 0 10px 24px rgba(20, 35, 45, 0.16);
  outline: none;
  white-space: pre-wrap;
}

.inline-field-editor.singleline {
  overflow: hidden;
}

.preview-empty {
  position: absolute;
  inset: 44% 10% auto;
  z-index: 3;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  text-align: center;
}

.editor-panel {
  min-width: 0;
  border-left: 1px solid var(--line);
  background: #f9fbfb;
  overflow: auto;
  max-height: calc(100vh - 77px);
}

.editor-head {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(249, 251, 251, 0.96);
  backdrop-filter: blur(8px);
}

.editor-head h2 {
  margin: 0;
  font-size: 19px;
}

.editor-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.editor-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.field-list {
  display: grid;
  gap: 14px;
  padding: 14px 16px 26px;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}

.field-group-title h3 {
  margin: 0;
  color: #27343b;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.field-group-title span {
  min-width: 24px;
  border-radius: 999px;
  padding: 2px 7px;
  background: #e7ecef;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.field-card {
  border: 1px solid #d7e0e5;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(20, 35, 45, 0.06);
}

.field-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28, 109, 114, 0.12);
}

.field-card.overflow {
  border-color: #d99b94;
}

.field-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #e7ecef;
}

.field-label {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border-color: transparent;
  background: #f3f6f7;
  color: var(--ink);
  font-weight: 700;
}

.field-label:focus,
.field-body textarea:focus,
.character-select:focus {
  border-color: var(--accent);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(28, 109, 114, 0.12);
}

.field-page {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.field-body {
  display: grid;
  gap: 9px;
  padding: 10px;
}

.field-body textarea {
  width: 100%;
  min-height: 92px;
  max-height: 300px;
  resize: vertical;
  padding: 9px;
  background: #fffefa;
  color: var(--ink);
  line-height: 1.28;
}

.warning {
  margin: 0;
  color: var(--danger);
  font-size: 12px;
}

.empty-panel {
  padding: 24px 14px;
  color: var(--muted);
}

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

  .editor-panel {
    max-height: none;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .sheet-wrap {
    max-height: none;
  }
}

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

  .top-actions {
    justify-content: stretch;
  }

  .top-actions button,
  .character-select {
    flex: 1 1 160px;
  }

  .preview-panel {
    padding: 10px;
  }

  .page-tabs {
    display: flex;
    width: 100%;
  }

  .page-tabs button {
    min-width: 0;
    flex: 1 1 0;
  }

  .manager-head,
  .character-row {
    grid-template-columns: 1fr;
  }

  .manager-head {
    display: grid;
  }

  .character-meta {
    min-width: 0;
  }

  .character-actions {
    justify-content: stretch;
  }

  .character-actions button {
    flex: 1 1 0;
  }
}

/* Class-bound visual language. Geometry stays owned by the sheet layout above. */
.sheet-paper.class-themed {
  --class-paper: #f7f1e4;
  --class-surface-rgb: 255, 253, 246;
  --class-surface: rgba(var(--class-surface-rgb), 0.91);
  --class-soft: #e8deca;
  --class-line: #776b58;
  --class-ink: #28231c;
  --class-accent: #72542d;
  --class-glow: rgba(114, 84, 45, 0.16);
  --class-radius: 7px;
  --class-pattern: radial-gradient(circle at 18% 12%, var(--class-glow), transparent 29%),
    repeating-linear-gradient(0deg, transparent 0 17px, rgba(70, 60, 45, 0.018) 18px);
  --accent: var(--class-accent);
  border-color: color-mix(in srgb, var(--class-line) 78%, white);
  background-color: var(--class-paper);
  background-image: var(--class-pattern);
  color: var(--class-ink);
  transition: background-color 180ms ease, border-color 180ms ease;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.sheet-paper.class-themed::before,
.sheet-paper.class-themed::after {
  content: none;
}

.class-themed .page-one-document {
  color: var(--class-ink);
}

.class-themed .source-box,
.class-themed .source-pill,
.class-themed .sheet-section,
.class-themed .detail-box {
  border-color: color-mix(in srgb, var(--class-line) 63%, transparent);
  border-radius: var(--class-radius);
  background: var(--class-surface);
  box-shadow: 0 5px 16px var(--class-glow), inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.class-themed .source-box::after,
.class-themed .source-pill::after {
  content: "";
  position: absolute;
  inset: 3px;
  z-index: 0;
  border: 1px solid color-mix(in srgb, var(--class-accent) 19%, transparent);
  border-radius: calc(var(--class-radius) - 3px);
  pointer-events: none;
}

.class-themed .source-box-title,
.class-themed .sheet-section::before,
.class-themed .detail-box::before {
  background: linear-gradient(90deg, color-mix(in srgb, var(--class-soft) 54%, transparent), var(--class-soft), color-mix(in srgb, var(--class-soft) 54%, transparent));
  color: var(--class-ink);
}

.class-themed .source-box-title,
.class-themed .source-box-body,
.class-themed .source-pill > * {
  position: relative;
  z-index: 1;
}

.class-themed .lined-box .source-box-body {
  background: transparent;
}

.class-themed .source-box-title,
.class-themed .source-pill-title,
.class-themed .sheet-section span,
.class-themed .detail-box span,
.class-themed .detail-label {
  color: color-mix(in srgb, var(--class-ink) 86%, var(--class-accent));
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: 0.055em;
}

.class-themed .ability-score,
.class-themed .source-pill-value,
.class-themed .source-money-box .coin-value,
.class-themed .death-row i {
  border-color: color-mix(in srgb, var(--class-line) 34%, transparent);
  background: rgb(var(--class-surface-rgb));
}

.class-themed .source-attacks-box .weapon-cell,
.class-themed .armor-cell {
  background: color-mix(in srgb, var(--class-soft) 32%, rgb(var(--class-surface-rgb)));
}

.class-themed .sheet-text.tone-value {
  background: rgba(var(--class-surface-rgb), 0.42);
}

.class-themed .source-meta-item span,
.class-themed .source-money-box .coin-row > span,
.class-themed .armor-head,
.class-themed .source-attacks-box .weapon-head,
.class-themed .death-row span,
.class-themed .row-label {
  color: color-mix(in srgb, var(--class-ink) 76%, var(--class-accent));
}

.class-themed .source-dot {
  border-color: transparent;
  background: transparent;
}

.class-themed .source-dot::after {
  border-color: color-mix(in srgb, var(--class-accent) 72%, #37464d);
}

.class-themed .source-dot.active::after {
  border-color: var(--class-accent);
  background: var(--class-accent);
}

.class-themed .source-dot.expert::before {
  border-color: var(--class-accent);
  box-shadow: 0 0 0 1px var(--class-glow);
}

.class-themed .doc-value.selected,
.class-themed .sheet-text.selected {
  outline-color: var(--class-accent);
  box-shadow: 0 0 0 3px var(--class-glow);
}

.class-field-select {
  width: 100%;
  min-width: 0;
  height: 100%;
  appearance: none;
  border: 0;
  border-radius: 4px;
  outline: 0;
  padding: 0 6px;
  background-color: transparent;
  background-image: none;
  color: var(--class-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.05;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}

.class-field-select:focus-visible {
  outline: 2px solid var(--class-accent);
  outline-offset: 2px;
  background-color: color-mix(in srgb, var(--class-soft) 55%, transparent);
}

.sheet-paper [data-editable-field="true"],
.class-field-select,
.inline-field-editor {
  font-family: var(--sheet-content-font);
}

@media (max-width: 720px) {
  .settings-head {
    display: grid;
    padding: 22px 20px;
  }

  .settings-card {
    padding: 22px 20px 26px;
  }

  .font-choice {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.class-theme-crest {
  position: absolute;
  top: 0.55%;
  left: 18%;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 64%;
  height: 2.65%;
  color: var(--class-accent);
  pointer-events: none;
  opacity: 0.92;
}

.class-theme-art-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.class-theme-crest .class-theme-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.class-theme-name {
  color: var(--class-ink);
  font: 800 9px/1 Georgia, 'Times New Roman', serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.class-theme-motto {
  color: color-mix(in srgb, var(--class-accent) 82%, var(--class-ink));
  font: italic 7px/1 Georgia, 'Times New Roman', serif;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.class-theme-rule {
  width: 64px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--class-accent), transparent);
}

.sheet-paper.class-theme-barbarian {
  --class-paper: #f4e8dc; --class-surface-rgb: 252, 245, 237; --class-soft: #ead1bf;
  --class-line: #6e3e35; --class-ink: #35201b; --class-accent: #a43a2c; --class-glow: rgba(129, 39, 29, 0.18); --class-radius: 2px;
  --class-pattern: linear-gradient(135deg, rgba(120, 34, 25, .08) 0 2px, transparent 2px 36px), radial-gradient(circle at 90% 10%, rgba(82, 42, 27, .15), transparent 25%);
}

.sheet-paper.class-theme-bard {
  --class-paper: #f7eaf0; --class-surface-rgb: 253, 248, 251; --class-soft: #eccad9;
  --class-line: #7b365f; --class-ink: #381a2e; --class-accent: #9a3f61; --class-glow: rgba(111, 48, 91, .16); --class-radius: 12px;
  --class-pattern: repeating-radial-gradient(ellipse at 12% 10%, rgba(121, 46, 94, .06) 0 1px, transparent 2px 14px), linear-gradient(120deg, transparent, rgba(170, 112, 30, .07));
}

.sheet-paper.class-theme-cleric {
  --class-paper: #edf4fa; --class-surface-rgb: 248, 251, 254; --class-soft: #cbdff0;
  --class-line: #466b87; --class-ink: #21384a; --class-accent: #2f73a7; --class-glow: rgba(47, 115, 167, .17); --class-radius: 9px;
  --class-pattern: repeating-conic-gradient(from 0deg at 50% -8%, rgba(236, 184, 56, .09) 0deg 5deg, transparent 5deg 14deg), radial-gradient(circle at 50% 0%, rgba(255, 218, 111, .28), transparent 37%);
}

.sheet-paper.class-theme-druid {
  --class-paper: #eef4e8; --class-surface-rgb: 249, 252, 246; --class-soft: #d3e2c3;
  --class-line: #4d6842; --class-ink: #273820; --class-accent: #5d8047; --class-glow: rgba(68, 104, 55, .17); --class-radius: 14px 5px;
  --class-pattern: radial-gradient(ellipse at 8% 15%, rgba(73, 112, 57, .13) 0 7px, transparent 8px), radial-gradient(ellipse at 92% 85%, rgba(91, 124, 53, .11) 0 10px, transparent 11px);
}

.sheet-paper.class-theme-fighter {
  --class-paper: #f3e9e7; --class-surface-rgb: 252, 248, 247; --class-soft: #e5cbc6;
  --class-line: #664744; --class-ink: #302322; --class-accent: #983c33; --class-glow: rgba(112, 53, 47, .16); --class-radius: 3px;
  --class-pattern: repeating-linear-gradient(135deg, rgba(57, 66, 70, .055) 0 2px, transparent 2px 22px), linear-gradient(90deg, transparent, rgba(145, 46, 39, .06), transparent);
}

.sheet-paper.class-theme-monk {
  --class-paper: #f6eee1; --class-surface-rgb: 253, 250, 245; --class-soft: #edd8b8;
  --class-line: #655a49; --class-ink: #2d2922; --class-accent: #b24d32; --class-glow: rgba(176, 73, 44, .14); --class-radius: 2px 12px;
  --class-pattern: radial-gradient(circle at 82% 13%, transparent 0 52px, rgba(48, 47, 38, .08) 53px 55px, transparent 56px), repeating-linear-gradient(0deg, rgba(83, 72, 46, .018) 0 1px, transparent 1px 6px);
}

.sheet-paper.class-theme-paladin {
  --class-paper: #eef4fb; --class-surface-rgb: 249, 252, 255; --class-soft: #cdddf2;
  --class-line: #42669b; --class-ink: #20334f; --class-accent: #3b6eaf; --class-glow: rgba(61, 91, 144, .16); --class-radius: 5px;
  --class-pattern: linear-gradient(45deg, transparent 47%, rgba(71, 99, 151, .055) 48% 52%, transparent 53%) 0 0/32px 32px, radial-gradient(circle at 50% 0, rgba(218, 179, 74, .18), transparent 30%);
}

.sheet-paper.class-theme-ranger {
  --class-paper: #edf3e8; --class-surface-rgb: 249, 252, 247; --class-soft: #d1dec5;
  --class-line: #4c674b; --class-ink: #263829; --class-accent: #557849; --class-glow: rgba(54, 92, 62, .16); --class-radius: 10px 3px;
  --class-pattern: repeating-linear-gradient(125deg, rgba(54, 95, 60, .055) 0 1px, transparent 1px 19px), radial-gradient(ellipse at 98% 8%, rgba(116, 85, 43, .14), transparent 27%);
}

.sheet-paper.class-theme-rogue {
  --class-paper: #f4ecdf; --class-surface-rgb: 252, 248, 241; --class-soft: #eadcc4;
  --class-line: #655267; --class-ink: #312832; --class-accent: #74506f; --class-glow: rgba(84, 57, 79, .17); --class-radius: 2px 9px;
  --class-pattern: linear-gradient(135deg, rgba(38, 29, 45, .08) 25%, transparent 25%) 0 0/24px 24px, linear-gradient(315deg, rgba(111, 72, 143, .05) 25%, transparent 25%) 0 0/24px 24px;
}

.sheet-paper.class-theme-sorcerer {
  --class-paper: #edf0fa; --class-surface-rgb: 248, 249, 254; --class-soft: #d8dcf3;
  --class-line: #515889; --class-ink: #292b4a; --class-accent: #6556b8; --class-glow: rgba(85, 77, 174, .18); --class-radius: 13px 4px;
  --class-pattern: radial-gradient(circle at 15% 8%, rgba(170, 45, 119, .15), transparent 24%), linear-gradient(118deg, transparent 38%, rgba(70, 116, 190, .07) 39% 41%, transparent 42%);
}

.sheet-paper.class-theme-warlock {
  --class-paper: #eaf3f1; --class-surface-rgb: 247, 251, 250; --class-soft: #cfe3df;
  --class-line: #355f62; --class-ink: #1e3438; --class-accent: #486f78; --class-glow: rgba(41, 99, 102, .18); --class-radius: 1px 10px;
  --class-pattern: repeating-conic-gradient(from 22deg at 88% 9%, rgba(16, 83, 62, .075) 0 3deg, transparent 3deg 17deg), radial-gradient(circle at 88% 9%, rgba(20, 103, 76, .16), transparent 22%);
}

.sheet-paper.class-theme-wizard {
  --class-paper: #e9effb; --class-surface-rgb: 247, 250, 255; --class-soft: #cbd9f3;
  --class-line: #36598e; --class-ink: #1d3152; --class-accent: #3e68b1; --class-glow: rgba(41, 84, 139, .19); --class-radius: 6px;
  --class-pattern: radial-gradient(circle at 12% 8%, rgba(53, 112, 174, .18) 0 1px, transparent 2px), radial-gradient(circle at 82% 18%, rgba(89, 76, 157, .13) 0 1px, transparent 2px); background-size: 31px 37px, 47px 43px;
}

.sheet-paper.class-theme-artificer {
  --class-paper: #edf5f2; --class-surface-rgb: 248, 252, 250; --class-soft: #cbe2db;
  --class-line: #517168; --class-ink: #263a35; --class-accent: #2d8190; --class-glow: rgba(45, 129, 144, .17); --class-radius: 3px;
  --class-pattern: linear-gradient(90deg, rgba(32, 109, 112, .055) 1px, transparent 1px) 0 0/18px 18px, linear-gradient(rgba(32, 109, 112, .055) 1px, transparent 1px) 0 0/18px 18px, radial-gradient(circle at 90% 10%, rgba(164, 112, 33, .15), transparent 25%);
}

@media (prefers-reduced-motion: reduce) {
  .sheet-paper.class-themed { transition: none; }
}

@page {
  size: A4 portrait;
  margin: 9mm;
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .page-tabs {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .preview-panel,
  .sheet-wrap {
    display: block;
    min-height: auto;
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .sheet-paper {
    width: 192mm;
    height: 271.54mm;
    aspect-ratio: auto;
    margin: 0 auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    break-after: page;
  }
}
