:root {
  color-scheme: dark;
  --ink: #e7dfcf;
  --muted: #a99d89;
  --paper: #171513;
  --paper-light: #24201c;
  --panel: #1d1a17;
  --line: #62584c;
  --wine: #b75a70;
  --wine-dark: #df91a1;
  --teal: #506b63;
  --teal-dark: #23332f;
  --gold: #a98b51;
  --forest: #354c3b;
  --sky: #10181c;
  --disabled: #4b4741;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  align-items: start;
  background:
    radial-gradient(circle at 18% 10%, rgba(126, 84, 58, 0.2), transparent 25%),
    radial-gradient(circle at 84% 22%, rgba(74, 98, 90, 0.18), transparent 22%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 5px),
    linear-gradient(135deg, #141514 0%, #221d1a 46%, #121819 100%);
  color: var(--ink);
  display: flex;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  justify-content: center;
  margin: 0;
  padding: 18px;
}

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

button {
  -webkit-tap-highlight-color: transparent;
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  gap: 14px;
  max-width: 1440px;
  min-width: 0;
  padding-top: 0;
  position: relative;
  width: min(100%, 1440px);
}

.top-menu {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(47, 42, 36, 0.99), rgba(27, 26, 23, 0.99)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 8px);
  border: 1px solid #6f624f;
  box-shadow: inset 0 0 0 2px #171512, 0 6px 18px rgba(0, 0, 0, 0.38);
  display: grid;
  gap: 7px;
  grid-template-areas: "brand quick actions donate";
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  min-width: 0;
  padding: 3px 6px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-menu-brand {
  align-items: center;
  display: flex;
  gap: 7px;
  grid-area: brand;
  min-width: max-content;
  padding-right: 3px;
}

.top-menu-brand-copy {
  display: grid;
  gap: 2px;
  line-height: 1;
  min-width: 0;
}

.menu-brand-kicker {
  color: #aa9878;
  font-size: 0.48rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.top-menu-brand h1 {
  color: #ddca9e;
  font-size: clamp(1.12rem, 1.65vw, 1.48rem);
  letter-spacing: -0.025em;
  line-height: 0.94;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.62);
  white-space: nowrap;
}

.forge-logo {
  filter: drop-shadow(0 2px 0 #0a0908) drop-shadow(0 0 6px rgba(180, 145, 82, 0.12));
  flex: 0 0 auto;
  height: 39px;
  overflow: visible;
  shape-rendering: geometricPrecision;
  width: 39px;
}

.forge-logo-shadow {
  fill: #090807;
}

.forge-logo-shell {
  fill: #2a2925;
  stroke: #b39762;
  stroke-linejoin: miter;
  stroke-width: 3;
}

.forge-logo-facet-top {
  fill: #48453d;
}

.forge-logo-facet-left {
  fill: #312c29;
}

.forge-logo-facet-right {
  fill: #251d20;
}

.forge-logo-facet-low {
  fill: #512d37;
}

.forge-logo-edge {
  fill: none;
  opacity: 0.68;
  stroke: #7f704f;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.7;
}

.forge-logo-zero-shadow {
  fill: #0e0c0b;
}

.forge-logo-zero {
  fill: #d2b573;
  stroke: #f0dab0;
  stroke-linejoin: miter;
  stroke-width: 1;
}

.forge-logo-glint {
  fill: #efe0bc;
}

.top-menu-actions,
.top-menu-quick-actions,
.top-sheet-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.top-menu-actions {
  grid-area: actions;
}

.top-menu-quick-actions {
  grid-area: quick;
}

.mobile-menu-toggle {
  grid-area: toggle;
}

.top-menu .donate-link {
  grid-area: donate;
  justify-self: end;
}

.top-sheet-actions .small-action {
  font-size: 0.72rem;
  min-height: 40px;
  padding: 6px 11px;
  white-space: nowrap;
  width: auto;
}

.top-sheet-actions .top-save-action {
  background: #4c2d36;
  border: 2px solid #966875;
  border-radius: 0;
  box-shadow: inset 0 0 0 2px #1b1114, inset 0 -4px 0 rgba(0, 0, 0, 0.3), 0 3px 0 #090708;
  color: #efe0c4;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.top-sheet-actions .top-save-action:hover {
  background: #633745;
  border-color: #bd8793;
}

.corner-edit {
  align-items: center;
  background: #2c2520;
  border: 1px solid #8a7657;
  border-radius: 3px;
  color: #e6d6b6;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 800;
  gap: 8px;
  letter-spacing: 0.1em;
  min-height: 40px;
  padding: 8px 14px;
  position: static;
  text-transform: uppercase;
  transition: background 140ms ease, border-color 140ms ease, transform 100ms ease;
}

.donate-link {
  border-radius: 999px;
  display: block;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.42));
  transition: filter 120ms ease, transform 100ms ease;
}

.donate-link:hover {
  filter: brightness(1.06) drop-shadow(0 3px 0 rgba(0, 0, 0, 0.42));
}

.donate-link:active {
  transform: translateY(2px);
}

.donate-link:focus-visible {
  outline: 2px solid #b39762;
  outline-offset: 3px;
}

.donate-image-crop {
  border-radius: 999px;
  display: block;
  height: 36px;
  overflow: hidden;
  position: relative;
  width: 195px;
}

.donate-image-crop img {
  height: auto;
  left: -7px;
  max-width: none;
  position: absolute;
  top: -20px;
  width: 208px;
}

.auth-actions {
  align-items: center;
  display: flex;
  gap: 6px;
}

.account-action,
.account-submit {
  background: #292e2a;
  border: 2px solid #776849;
  border-radius: 0;
  box-shadow: inset 0 0 0 2px #141714, inset 0 -3px 0 rgba(0, 0, 0, 0.34), 0 3px 0 #090a09;
  color: #e9dbba;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.075em;
  min-height: 38px;
  padding: 7px 10px;
  text-transform: uppercase;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}

.account-action:hover,
.account-submit:hover {
  background: #394239;
  border-color: #aa8f59;
}

.account-action:active,
.account-submit:active {
  transform: translateY(2px);
}

.account-action-primary {
  background: #4c2d36;
  border-color: #966875;
}

.account-action-primary:hover {
  background: #633745;
  border-color: #bd8793;
}

.logout-link,
.auth-switch {
  background: transparent;
  color: #c9b894;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 7px 3px;
  text-decoration: underline;
  text-decoration-color: rgba(201, 184, 148, 0.48);
  text-underline-offset: 3px;
}

.logout-link:hover,
.auth-switch:hover {
  color: #f0dfb8;
  text-decoration-color: currentColor;
}

.account-action:focus-visible,
.account-submit:focus-visible,
.logout-link:focus-visible,
.auth-switch:focus-visible,
.modal-close:focus-visible,
.character-card button:focus-visible {
  outline: 2px solid #c1a264;
  outline-offset: 3px;
}

.corner-edit:hover {
  background: #3a3028;
  border-color: #b29668;
}

.corner-edit:active {
  transform: translateY(1px);
}

.corner-edit-mark {
  color: #b89a5e;
  font-size: 0.92rem;
}

body.is-editing .corner-edit {
  background: #4b2530;
  border-color: #a56f78;
}

/* One compact forged-control language for every action in the main menu. */
.top-menu .top-menu-actions button,
.top-menu .top-menu-quick-actions button,
.top-menu .mobile-menu-toggle,
.top-menu .donate-link {
  background: linear-gradient(180deg, #3c372f 0%, #27231f 100%);
  border: 1px solid #8c7752;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px #171411, inset 0 -3px 0 rgba(0, 0, 0, 0.28), 0 2px 0 #0b0908;
  color: #eadbb9;
  filter: none;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}

.top-menu .top-menu-actions button,
.top-menu .top-menu-quick-actions button,
.top-menu .mobile-menu-toggle {
  align-items: center;
  display: inline-flex;
  font-size: 0.66rem;
  font-weight: 900;
  gap: 6px;
  justify-content: center;
  letter-spacing: 0.07em;
  line-height: 1;
  min-height: 32px;
  padding: 5px 9px;
  position: static;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  width: auto;
}

.top-menu .top-menu-actions button:hover,
.top-menu .top-menu-quick-actions button:hover,
.top-menu .mobile-menu-toggle:hover,
.top-menu .donate-link:hover {
  background: linear-gradient(180deg, #4a4439 0%, #302a24 100%);
  border-color: #b09560;
  color: #f2e3c1;
  filter: none;
}

.top-menu .top-menu-actions button:active,
.top-menu .top-menu-quick-actions button:active,
.top-menu .mobile-menu-toggle:active,
.top-menu .donate-link:active {
  transform: translateY(2px);
}

.top-menu .top-menu-actions button:focus-visible,
.top-menu .top-menu-quick-actions button:focus-visible,
.top-menu .mobile-menu-toggle:focus-visible,
.top-menu .donate-link:focus-visible {
  outline: 2px solid #c1a264;
  outline-offset: 3px;
}

.top-menu .top-menu-actions .logout-link {
  text-decoration: none;
}

body.is-editing .top-menu .top-menu-quick-actions .corner-edit {
  background: linear-gradient(180deg, #3c372f 0%, #27231f 100%);
  border-color: #b39762;
}

.top-menu .mobile-menu-toggle {
  display: none;
}

.mobile-menu-icon {
  height: 12px;
  position: relative;
  width: 14px;
}

.mobile-menu-icon::before,
.mobile-menu-icon::after {
  background: #d9c28e;
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  transition: box-shadow 140ms ease, top 140ms ease, transform 140ms ease;
  width: 14px;
}

.mobile-menu-icon::before {
  box-shadow: 0 4px #d9c28e, 0 8px #d9c28e;
  top: 1px;
}

.mobile-menu-icon::after {
  opacity: 0;
  top: 5px;
}

.top-menu.is-open .mobile-menu-icon::before {
  box-shadow: none;
  top: 5px;
  transform: rotate(45deg);
}

.top-menu.is-open .mobile-menu-icon::after {
  opacity: 1;
  transform: rotate(-45deg);
}

.top-menu .donate-link {
  padding: 2px 4px;
}

.top-menu .donate-image-crop {
  height: 26px;
  width: 142px;
}

.top-menu .donate-image-crop img {
  left: -5px;
  top: -14px;
  width: 152px;
}

.top-menu .export-pixel-icon {
  border-width: 1px;
  box-shadow: inset -2px -2px 0 #998052;
  height: 16px;
  width: 14px;
}

.top-menu .export-pixel-icon::before {
  border-bottom-width: 1px;
  border-left-width: 1px;
  height: 5px;
  right: -1px;
  top: -1px;
  width: 5px;
}

.top-menu .export-pixel-icon::after {
  box-shadow: 0 3px #7d6543, 0 6px #b75a70;
  height: 1px;
  left: 2px;
  top: 4px;
  width: 7px;
}

.quick-card,
.character-stage,
.sheet-panel {
  background:
    linear-gradient(rgba(43, 38, 33, 0.98), rgba(29, 27, 24, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 9px);
  border: 1px solid var(--line);
  border-radius: 5px;
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
  min-width: 0;
}

@media (min-width: 761px) {
  body:not(.is-editing) .app-shell {
    padding-top: 0;
  }
}

.eyebrow,
label,
.stat-head,
.panel-title span,
.points-inline span,
.points-inline small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  color: #d7c49c;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 5vw, 4.7rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 0.94;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.55);
}

h2 {
  color: #d7c49c;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1;
  margin: 0;
}

.workspace {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.preview-panel {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(320px, 0.92fr) repeat(2, minmax(240px, 1fr));
  grid-template-areas:
    "stage overview overview"
    "combat skills skills"
    "combat story gear";
  min-width: 0;
}

body.is-editing .preview-panel {
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.72fr);
  grid-template-areas:
    "overview stage"
    "combat stage"
    "skills stage"
    "gear stage"
    "story stage";
}

.hero-overview {
  grid-area: overview;
}

body:not(.is-editing) .hero-overview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body:not(.is-editing) .hero-overview > .eyebrow,
body:not(.is-editing) .hero-overview > h2,
body:not(.is-editing) .hero-overview > p,
body:not(.is-editing) .hero-overview > #hero-stats {
  grid-column: 1 / -1;
}

body:not(.is-editing) .hero-overview > #hero-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

body:not(.is-editing) .hero-overview > #summary-values,
body:not(.is-editing) .hero-overview > #summary-rules {
  align-self: start;
  margin-top: 0;
}

body:not(.is-editing) .hero-overview > #summary-rules {
  line-height: 1.25;
}

body:not(.is-editing) .hero-overview > #summary-rules div {
  padding: 6px;
}

.character-stage {
  display: grid;
  gap: 10px;
  grid-area: stage;
  padding: 12px;
}

body.is-editing .character-stage {
  align-self: start;
  position: sticky;
  top: 12px;
}

.preview-panel .quick-card:nth-of-type(3) {
  grid-area: combat;
}

.preview-panel .quick-card:nth-of-type(4) {
  grid-area: skills;
}

.preview-panel .quick-card:nth-of-type(5) {
  grid-area: story;
}

.preview-panel .quick-card:nth-of-type(6) {
  grid-area: gear;
}

.quick-card {
  align-content: start;
  display: grid;
  gap: 10px;
  padding: 12px;
}

canvas {
  background: var(--sky);
  border: 1px solid #736655;
  border-radius: 2px;
  display: block;
  image-rendering: pixelated;
  width: 100%;
}

.avatar-canvas-wrap {
  min-width: 0;
  position: relative;
}

.equipped-weapon-slots {
  display: grid;
  gap: 7px;
  left: 9px;
  max-height: calc(100% - 18px);
  overflow: auto;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
}

.equipped-weapon-slot {
  align-content: center;
  background: linear-gradient(145deg, rgba(48, 45, 40, 0.96), rgba(16, 17, 17, 0.96));
  border: 2px solid #8c7652;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.65), 0 4px 10px rgba(0, 0, 0, 0.45);
  display: grid;
  height: 55px;
  justify-items: center;
  overflow: hidden;
  padding: 3px;
  position: relative;
  width: 55px;
}

.equipped-weapon-slot img {
  height: 39px;
  image-rendering: pixelated;
  object-fit: contain;
  width: 39px;
}

.equipped-weapon-slot b {
  background: #161513;
  border: 1px solid #8c7652;
  bottom: 2px;
  color: #efe3cc;
  font-size: 0.62rem;
  line-height: 1;
  padding: 2px 3px;
  position: absolute;
  right: 2px;
}

.equipped-weapon-slot small {
  background: rgba(12, 13, 13, 0.9);
  bottom: 0;
  color: #d8c6a8;
  display: none;
  font-size: 0.48rem;
  left: 0;
  overflow: hidden;
  padding: 1px 2px;
  position: absolute;
  right: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipped-weapon-slot.is-empty {
  border-color: #6d6559;
  color: #a99d89;
  font-size: 1.25rem;
  opacity: 0.86;
}

.equipped-weapon-slot.is-empty small {
  display: block;
  text-align: center;
}

.avatar-hair-stepper {
  display: none;
  inset: 0;
  pointer-events: none;
  position: absolute;
}

body.is-editing .avatar-hair-stepper {
  display: block;
}

.avatar-hair-stepper button,
.avatar-option-row button {
  align-items: center;
  background: rgba(30, 28, 25, 0.92);
  border: 1px solid #9a896d;
  border-radius: 2px;
  color: #f1e6d3;
  display: inline-flex;
  font-size: 1.35rem;
  font-weight: 800;
  justify-content: center;
  min-height: 34px;
  min-width: 34px;
  padding: 0;
  pointer-events: auto;
}

.avatar-hair-stepper > span {
  background: rgba(17, 18, 17, 0.86);
  border: 1px solid rgba(151, 134, 105, 0.72);
  color: #eadcc4;
  display: grid;
  justify-items: center;
  left: 50%;
  min-width: 92px;
  padding: 4px 9px;
  pointer-events: auto;
  position: absolute;
  top: 9px;
  transform: translateX(-50%);
}

.avatar-hair-stepper button {
  position: absolute;
  top: 34%;
  transform: translateY(-50%);
}

.avatar-hair-stepper button:first-child {
  left: 10px;
}

.avatar-hair-stepper button:last-child {
  right: 10px;
}

.avatar-hair-stepper small,
.avatar-option-row small {
  color: #b9aa92;
  display: block;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.avatar-hair-stepper strong,
.avatar-option-row strong {
  font-size: 0.76rem;
}

.avatar-customizer {
  display: none;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.is-editing .avatar-customizer {
  display: grid;
}

.avatar-option-row {
  align-items: center;
  background: #1c1b19;
  border: 1px solid #62594e;
  display: grid;
  gap: 5px;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  min-width: 0;
  padding: 5px;
}

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

.avatar-option-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: center;
}

.avatar-option-row button {
  font-size: 1rem;
  min-height: 30px;
  min-width: 30px;
}

.avatar-option-row:last-child {
  grid-column: 1 / -1;
}

.preview-caption {
  align-items: center;
  background: #111615;
  border: 1px solid #62594d;
  border-radius: 2px;
  color: #e7dfcf;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 48px;
  padding: 8px 10px;
}

.preview-caption strong,
.preview-caption span,
.summary-lines,
.tag-list,
.sheet-skill-list,
.quick-card p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.preview-caption strong {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.preview-caption span {
  color: #b9a276;
  font-size: 0.9rem;
  font-weight: 900;
  text-align: right;
}

.small-action.export-action {
  align-items: center;
  background: #2b322d;
  border: 2px solid #8c7752;
  border-radius: 0;
  box-shadow: inset 0 0 0 2px #171a18, inset 0 -4px 0 rgba(0, 0, 0, 0.28), 0 3px 0 #0b0b0a;
  color: #eadbb9;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  letter-spacing: 0.04em;
  min-height: 38px;
  padding: 5px 10px;
  text-transform: uppercase;
}

.small-action.export-action:hover {
  background: #364139;
  border-color: #b09560;
}

.export-pixel-icon {
  background: #d5c28f;
  border: 2px solid #342c20;
  box-shadow: inset -3px -3px 0 #998052;
  display: block;
  flex: 0 0 auto;
  height: 22px;
  position: relative;
  width: 18px;
}

.export-pixel-icon::before {
  background: #2b322d;
  border-bottom: 2px solid #342c20;
  border-left: 2px solid #342c20;
  content: "";
  height: 6px;
  position: absolute;
  right: -2px;
  top: -2px;
  width: 6px;
}

.export-pixel-icon::after {
  background: #7d6543;
  box-shadow: 0 4px #7d6543, 0 8px #b75a70;
  content: "";
  height: 2px;
  left: 3px;
  position: absolute;
  top: 5px;
  width: 8px;
}

.hp-tracker {
  align-items: center;
  background: #171614;
  border: 1px solid var(--line);
  border-radius: 2px;
  display: grid;
  gap: 8px;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  padding: 8px;
}

.hp-button {
  background: #1a1716;
  border: 2px solid #786957;
  border-radius: 0;
  box-shadow: inset 0 0 0 2px #29231f, inset 0 -5px 0 rgba(0, 0, 0, 0.28), 0 3px 0 #0b0b0a;
  color: #eee4d4;
  display: grid;
  image-rendering: pixelated;
  place-items: center;
  min-height: 44px;
  padding: 0;
  position: relative;
  transition:
    filter 120ms ease,
    transform 80ms ease;
}

.heal-button {
  background: #243d31;
  border-color: #67836d;
}

.damage-button {
  background: #512835;
  border-color: #a56772;
}

.hp-button-icon,
.hp-button-icon::before,
.hp-button-icon::after {
  display: block;
  position: absolute;
}

.hp-button-icon {
  height: 24px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
}

.hp-button-icon::before {
  content: "";
  height: 4px;
  left: 2px;
  top: 2px;
  width: 4px;
}

.heal-button .hp-button-icon::before {
  background: #87c08c;
  box-shadow:
    4px 0 #b7d79e, 12px 0 #b7d79e, 16px 0 #87c08c,
    -4px 4px #426e51, 0 4px #6fa679, 4px 4px #9ccc8f, 8px 4px #6fa679, 12px 4px #9ccc8f, 16px 4px #6fa679, 20px 4px #426e51,
    -4px 8px #426e51, 0 8px #6fa679, 4px 8px #9ccc8f, 8px 8px #9ccc8f, 12px 8px #9ccc8f, 16px 8px #6fa679, 20px 8px #426e51,
    0 12px #426e51, 4px 12px #6fa679, 8px 12px #9ccc8f, 12px 12px #6fa679, 16px 12px #426e51,
    4px 16px #426e51, 8px 16px #6fa679, 12px 16px #426e51,
    8px 20px #294634;
}

.heal-button .hp-button-icon::after {
  background: #e5edc6;
  box-shadow: -4px 4px #e5edc6, 4px 4px #e5edc6, 0 8px #e5edc6;
  content: "";
  height: 4px;
  left: 10px;
  top: 6px;
  width: 4px;
}

.damage-button .hp-button-icon::before {
  background: #c56671;
  box-shadow:
    4px 0 #e18a88, 12px 0 #e18a88, 16px 0 #c56671,
    -4px 4px #743140, 0 4px #b74e62, 4px 4px #d86c75, 8px 4px #743140, 12px 4px #d86c75, 16px 4px #b74e62, 20px 4px #743140,
    -4px 8px #743140, 0 8px #b74e62, 4px 8px #d86c75, 8px 8px #743140, 12px 8px #d86c75, 16px 8px #b74e62, 20px 8px #743140,
    0 12px #743140, 4px 12px #b74e62, 8px 12px #743140, 12px 12px #b74e62, 16px 12px #743140,
    4px 16px #743140, 8px 16px #b74e62, 12px 16px #743140,
    8px 20px #3f1c25;
}

.damage-button .hp-button-icon::after {
  background: #28141a;
  box-shadow: -4px 4px #28141a, 0 8px #28141a, -4px 12px #28141a;
  content: "";
  height: 4px;
  left: 14px;
  top: 6px;
  width: 4px;
}

.hp-readout {
  display: grid;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.hp-readout > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hp-readout strong {
  color: #d9c9a9;
  font-size: 1.2rem;
  line-height: 1;
}

.hp-readout strong span {
  color: inherit;
  font-size: inherit;
  text-transform: none;
}

.hp-bar {
  background: #2a2723;
  border: 1px solid #4e4941;
  border-radius: 1px;
  height: 12px;
  overflow: hidden;
}

.hp-bar span {
  background: var(--forest);
  display: block;
  height: 100%;
  transition: width 160ms ease;
  width: 100%;
}

body:not(.is-editing) #builder-panel {
  display: none;
}

.summary-name-slot {
  min-width: 0;
}

.inline-name-editor {
  display: none;
}

body.is-editing .summary-name-slot #summary-title {
  display: none;
}

body.is-editing .inline-name-editor {
  display: grid;
  gap: 5px;
}

body.is-editing .inline-name-editor input {
  border-color: #9c8358;
  box-shadow: inset 0 0 0 1px #1b1712, 0 0 0 1px rgba(179, 151, 98, 0.12);
  color: #e8d5ab;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.24rem;
  font-weight: 600;
  min-height: 43px;
  padding: 7px 10px;
}

body.is-editing #preview-name {
  display: none;
}

body.is-editing .preview-caption {
  justify-content: flex-end;
}

.secondary-action {
  background: var(--teal);
}

.edit-reveal {
  display: none;
  gap: 10px;
  min-width: 0;
}

body.is-editing .edit-reveal {
  animation: editor-unfold 220ms ease-out both;
  border-top: 1px solid #51483d;
  display: grid;
  margin-top: 4px;
  padding-top: 12px;
}

@keyframes editor-unfold {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.edit-reveal .builder-toolbar,
.edit-reveal .identity-grid,
.edit-reveal .rules-panel,
.edit-reveal .combat-grid,
.edit-reveal .story-pickers,
.edit-reveal .skill-choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.edit-reveal .rules-panel label,
.edit-reveal .combat-grid label:nth-child(2) {
  grid-column: auto;
}

.editor-footer {
  background: #151412;
  padding: 10px 14px;
}

.editor-footer form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.editor-footer .license-note {
  flex: 1 1 520px;
}

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

.mini-grid div,
.summary-lines div,
.tag-list span,
.sheet-skill-list span {
  background: #171715;
  border: 1px solid rgba(137, 124, 105, 0.42);
  border-radius: 2px;
  min-width: 0;
  padding: 7px;
}

.mini-grid span,
.summary-lines small {
  color: var(--muted);
  display: block;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-grid strong {
  display: block;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.summary-lines {
  display: grid;
  gap: 7px;
  line-height: 1.35;
}

.attack-options-panel {
  border-top: 1px solid #51483d;
  display: grid;
  gap: 7px;
  padding-top: 9px;
}

.attack-options-head {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.attack-options-head h3 {
  color: #d7c49c;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  margin: 0;
}

.attack-options-head span {
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 800;
  text-transform: uppercase;
}

.attack-options {
  display: grid;
  gap: 6px;
}

.attack-option {
  align-items: center;
  background: #151514;
  border: 1px solid rgba(137, 124, 105, 0.5);
  display: grid;
  gap: 4px 7px;
  grid-template-columns: minmax(0, 1fr) 52px minmax(76px, auto);
  min-width: 0;
  padding: 7px;
}

.attack-option > strong {
  color: #e5d8bf;
  font-size: 0.76rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.attack-option > span {
  display: grid;
  gap: 1px;
}

.attack-option small {
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 800;
  text-transform: uppercase;
}

.attack-option b {
  color: var(--wine-dark);
  font-size: 0.75rem;
}

.attack-option em {
  color: #aca18f;
  font-size: 0.62rem;
  font-style: normal;
  grid-column: 1 / -1;
  line-height: 1.3;
}

.chosen-summary {
  margin-top: 2px;
}

.rules-summary {
  margin-top: 8px;
}

.summary-control input,
.summary-control textarea {
  min-height: 34px;
  padding: 5px 7px;
}

.sheet-mini-input {
  max-width: 130px;
}

.sheet-note-input {
  margin-top: 4px;
}

.sheet-currency input {
  min-width: 0;
}

.summary-equipment-grid {
  align-items: center;
  display: grid;
  gap: 5px 7px;
  grid-template-columns: minmax(0, 1fr) 44px 44px;
  margin-top: 4px;
}

.summary-equipment-grid strong {
  color: var(--muted);
  font-size: 0.68rem;
  text-align: center;
  text-transform: uppercase;
}

.summary-equipment-grid label {
  display: grid;
  justify-items: center;
}

.summary-equipment-grid input {
  accent-color: var(--wine);
  height: 18px;
  min-height: 0;
  padding: 0;
  width: auto;
}

.tag-list {
  align-content: start;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-list span {
  font-size: 0.82rem;
  font-weight: 900;
}

.sheet-skill-list {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body:not(.is-editing) .sheet-skill-list {
  gap: 5px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sheet-skill-list span {
  align-items: center;
  display: grid;
  font-size: 0.72rem;
  font-weight: 700;
  gap: 4px;
  grid-template-columns: minmax(0, 1fr) auto;
  line-height: 1.15;
}

.sheet-skill-list span.is-trained {
  background: #202c24;
  border-color: #637160;
  font-weight: 900;
}

.sheet-skill-list strong {
  font-weight: inherit;
  min-width: 0;
  overflow-wrap: anywhere;
}

.sheet-skill-list em {
  color: var(--wine-dark);
  font-style: normal;
  font-weight: 900;
}

.sheet-panel {
  padding: 14px;
}

form {
  display: grid;
  gap: 14px;
  min-width: 0;
  width: 100%;
}

.builder-toolbar {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 132px;
}

.points-inline {
  align-content: center;
  background: #1d2921;
  border: 1px solid #5c6859;
  border-radius: 2px;
  display: grid;
  justify-items: center;
  min-height: 74px;
  min-width: 0;
  padding: 8px;
}

.points-inline strong {
  color: var(--wine);
  font-size: 2rem;
  line-height: 1;
}

.identity-grid,
.notes-grid,
.skill-choice-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
}

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

.skill-choice-grid section {
  min-width: 0;
}

.skill-choice-grid h3 {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1;
  margin: 0 0 8px;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field-group {
  border: 0;
  display: grid;
  gap: 5px;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.field-group legend {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  margin-bottom: 5px;
  padding: 0;
  text-transform: uppercase;
}

.field-note {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1.25;
}

input,
select,
textarea {
  background: #11110f;
  border: 1px solid #706557;
  border-radius: 2px;
  color: var(--ink);
  min-height: 42px;
  min-width: 0;
  outline: 0;
  padding: 8px 9px;
  width: 100%;
}

select[multiple] {
  min-height: 150px;
  overflow: auto;
}

.check-list {
  background: #11110f;
  border: 1px solid #706557;
  display: grid;
  gap: 5px;
  max-height: 190px;
  min-height: 120px;
  overflow: auto;
  padding: 7px;
}

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

.check-option {
  align-items: center;
  background: #1b1a18;
  border: 1px solid #504940;
  color: var(--ink);
  display: grid;
  font-size: 0.76rem;
  font-weight: 650;
  gap: 7px;
  grid-template-columns: 18px minmax(0, 1fr);
  letter-spacing: 0;
  min-height: 34px;
  padding: 5px 7px;
  text-transform: none;
}

.check-option:has(input:checked) {
  background: #26342b;
  border-color: #74846f;
}

.check-option:has(input:disabled:not(:checked)) {
  color: #777168;
}

.check-option input,
.equipment-option input {
  accent-color: var(--wine);
  border: 0;
  height: 18px;
  margin: 0;
  min-height: 0;
  padding: 0;
  width: 18px;
}

.equipment-field {
  grid-column: span 2;
}

.equipment-check-list {
  display: grid;
  gap: 5px;
  max-height: 420px;
  overflow: auto;
}

.equipment-check-head,
.equipment-option {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 52px 52px;
}

.equipment-check-head {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  padding: 0 8px 3px;
  text-align: center;
  text-transform: uppercase;
}

.equipment-check-head span:first-child {
  text-align: left;
}

.equipment-option {
  background: #151513;
  border: 1px solid #514a41;
  min-height: 40px;
  padding: 6px 8px;
}

.equipment-option > span {
  min-width: 0;
}

.equipment-option > span small {
  color: var(--muted);
  display: block;
  font-size: 0.64rem;
  margin-top: 2px;
  text-transform: capitalize;
}

.equipment-option label {
  display: grid;
  justify-items: center;
}

.equipment-option:has([data-equipment-equip]:checked) {
  background: #2b2621;
  border-color: #9a825d;
}

textarea {
  min-height: 88px;
  resize: vertical;
  text-transform: none;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: #b39762;
  outline: 2px solid rgba(169, 139, 81, 0.54);
  outline-offset: 2px;
}

.flex-bonuses {
  background: #1b2520;
  border: 1px solid #596456;
  border-radius: 2px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 10px;
}

.flex-bonuses[hidden],
#race-skill-wrap[hidden],
#feat-wrap[hidden],
#subrace-wrap[hidden] {
  display: none;
}

.stats-panel,
.skills-panel,
.rules-panel,
.spell-panel,
.combat-grid,
.story-pickers,
.notes-grid {
  background: #191714;
  border: 1px solid #5c5348;
  border-radius: 2px;
  min-width: 0;
  padding: 10px;
}

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

.derived-grid > div {
  background: #1b211d;
  border: 1px solid #555c52;
  border-radius: 2px;
  min-width: 0;
  padding: 8px;
  text-align: center;
}

.derived-grid span {
  color: var(--muted);
  display: block;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.derived-grid strong {
  display: block;
  font-size: clamp(1rem, 2vw, 1.45rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.ac-shield {
  align-items: center;
  aspect-ratio: 0.84;
  background: linear-gradient(135deg, #e1c176 0 18%, #80642f 19% 36%, #c89f51 37% 62%, #5a431f 63% 100%);
  clip-path: polygon(50% 0, 91% 17%, 84% 72%, 50% 100%, 16% 72%, 9% 17%);
  color: #f5e7c7;
  display: inline-grid !important;
  filter: drop-shadow(0 4px 0 #0a0908) drop-shadow(0 0 7px rgba(202, 157, 73, 0.28));
  font-weight: 900;
  justify-items: center;
  min-height: 62px;
  min-width: 52px;
  padding: 9px 10px 15px;
  position: relative;
  text-shadow: 2px 2px 0 #080807;
}

.ac-shield::before {
  background:
    linear-gradient(90deg, transparent 47%, rgba(215, 181, 104, 0.5) 48% 52%, transparent 53%),
    linear-gradient(145deg, #26333a 0 45%, #11191e 46% 100%);
  clip-path: polygon(50% 0, 91% 17%, 84% 72%, 50% 100%, 16% 72%, 9% 17%);
  content: "";
  inset: 5px;
  position: absolute;
  z-index: 0;
}

.ac-shield::after {
  background: #e1c176;
  box-shadow: 28px 0 #e1c176, 14px 31px #8a6a31;
  content: "";
  height: 4px;
  left: 10px;
  position: absolute;
  top: 15px;
  width: 4px;
  z-index: 1;
}

.ac-shield > span {
  color: #f5e7c7 !important;
  display: block;
  font-family: "Courier New", monospace;
  font-size: 1.18rem !important;
  font-weight: 900;
  line-height: 1;
  position: relative;
  z-index: 2;
}

.derived-grid .ac-shield {
  margin: 2px auto 0;
}

.combat-title {
  align-items: center;
  background: #121514;
  border: 1px solid #6f6049;
  box-shadow: inset 0 0 0 2px #29251f;
  display: inline-flex;
  gap: 9px;
  justify-content: flex-end;
  padding: 5px 7px 5px 10px;
}

.combat-title .ac-label {
  color: #cdb886;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  max-width: 48px;
  text-align: right;
}

.stat-head,
.stat-row {
  align-items: center;
  display: grid;
  gap: 7px;
  grid-template-columns: minmax(54px, 0.9fr) minmax(110px, 1.3fr) 52px 52px 58px 48px;
}

.stat-head {
  padding: 0 4px 8px;
}

.stat-head span:not(:first-child),
.stat-cell {
  text-align: center;
}

.stat-row {
  border-top: 1px solid rgba(151, 136, 113, 0.2);
  min-height: 54px;
  padding: 7px 4px;
}

.stat-name {
  color: var(--line);
  font-size: 1.05rem;
  font-weight: 900;
}

.score-control {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 36px minmax(38px, 1fr) 36px;
}

.score-control button,
.small-action,
.flaw-remove {
  background: var(--wine);
  border: 1px solid #87636a;
  border-radius: 2px;
  color: #eee4d4;
  font-weight: 900;
  min-height: 36px;
  transition:
    filter 120ms ease,
    transform 80ms ease;
}

.score-control button {
  font-size: 1.25rem;
  line-height: 1;
  padding: 0;
}

.score-control button:hover,
.small-action:hover,
.hp-button:hover,
.flaw-remove:hover {
  filter: brightness(1.08);
}

.score-control button:active,
.small-action:active,
.hp-button:active,
.flaw-remove:active {
  transform: translateY(2px);
}

.hp-button.heal-button {
  background: #243d31;
}

.hp-button.damage-button {
  background: #512835;
}

.score-control button:disabled,
.hp-button:disabled {
  background: var(--disabled);
  color: #6f665d;
  cursor: default;
  filter: none;
}

.hp-button:disabled .hp-button-icon {
  opacity: 0.38;
}

.score-value,
.stat-cell {
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 900;
}

.panel-title {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.rule-line,
.slots-line {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.35;
  margin: 0 0 10px;
}

.slots-line {
  color: var(--teal-dark);
}

.skill-table,
.choice-grid,
.spell-options {
  display: grid;
  gap: 8px;
}

.skill-table {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 10px;
}

.choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 212px;
  overflow: auto;
  padding-right: 3px;
}

.skill-row,
.skill-option,
.spell-option {
  align-items: center;
  background: #131311;
  border: 1px solid rgba(128, 115, 96, 0.58);
  border-radius: 2px;
  color: var(--ink);
  display: grid;
  font-size: 0.86rem;
  gap: 7px;
  font-weight: 900;
  min-width: 0;
  padding: 7px;
  text-transform: none;
}

.skill-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.skill-row.is-trained {
  background: #202c24;
  border-color: #637160;
}

.skill-row.is-trained strong {
  color: var(--wine-dark);
  font-weight: 900;
}

.skill-option {
  grid-template-columns: 22px minmax(0, 1fr);
}

.skill-row strong,
.skill-option span,
.spell-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.skill-row small {
  color: var(--muted);
  display: block;
  font-weight: 900;
}

.spell-panel[hidden] {
  display: none;
}

.spell-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-height: 430px;
  overflow: auto;
  padding-right: 3px;
}

.spell-option {
  grid-template-columns: 22px minmax(0, 1fr) auto;
}

.skill-option input,
.spell-option input {
  accent-color: var(--wine);
  border: 0;
  height: 18px;
  margin: 0;
  min-height: 0;
  padding: 0;
  width: auto;
}

.skill-option:has(input:checked),
.spell-option:has(input:checked) {
  background: #202c24;
  border-color: #637160;
}

.skill-option:has(input:disabled:not(:checked)),
.spell-option:has(input:disabled:not(:checked)) {
  color: var(--disabled);
}

.spell-option small {
  color: var(--muted);
  font-weight: 900;
}

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

.rules-panel label,
.combat-grid label:nth-child(2) {
  grid-column: span 2;
}

.currency-row,
.currency-labels {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.currency-labels {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.story-pickers {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.trait-panel {
  background: rgba(14, 14, 13, 0.62);
  border: 1px solid rgba(126, 113, 94, 0.42);
  border-radius: 2px;
  min-width: 0;
  padding: 8px;
}

.flaw-tools {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 80px;
  margin-top: 8px;
  min-width: 0;
}

.small-action {
  min-height: 42px;
  padding: 7px 12px;
}

.chosen-flaws {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 10px 0 0;
  min-height: 42px;
  padding: 0;
}

.chosen-flaws li {
  align-items: center;
  background: #202c24;
  border: 1px solid #637160;
  border-radius: 2px;
  color: var(--ink);
  display: inline-flex;
  gap: 8px;
  max-width: 100%;
  min-height: 38px;
  padding: 4px 4px 4px 9px;
}

.chosen-flaws span {
  overflow-wrap: anywhere;
}

.flaw-remove {
  background: var(--teal);
  min-height: 28px;
  min-width: 28px;
  padding: 0;
}

.notes-grid {
  grid-template-columns: 1fr;
}

.license-note {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
}

.modal-backdrop[hidden],
.account-action[hidden],
.logout-link[hidden] {
  display: none !important;
}

.modal-backdrop {
  align-items: center;
  background: rgba(8, 9, 8, 0.8);
  display: grid;
  inset: 0;
  justify-items: center;
  overflow-y: auto;
  padding: 22px;
  position: fixed;
  z-index: 100;
}

body.has-modal {
  overflow: hidden;
}

.account-modal {
  background:
    linear-gradient(rgba(42, 37, 32, 0.99), rgba(24, 23, 20, 0.99)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 2px, transparent 2px 8px);
  border: 2px solid #806f51;
  box-shadow: inset 0 0 0 4px #171512, 0 20px 70px rgba(0, 0, 0, 0.68);
  max-width: 460px;
  padding: 26px;
  position: relative;
  width: min(100%, 460px);
}

.account-modal::before,
.account-modal::after {
  background: #b09358;
  content: "";
  height: 5px;
  position: absolute;
  width: 5px;
}

.account-modal::before {
  left: 7px;
  top: 7px;
}

.account-modal::after {
  bottom: 7px;
  right: 7px;
}

.account-modal h2 {
  color: #efe3c8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
  margin: 4px 34px 5px 0;
}

.modal-copy {
  color: #b9aa8d;
  font-size: 0.88rem;
  line-height: 1.55;
  margin: 0 0 18px;
}

.modal-close {
  background: #3e2c2b;
  border: 1px solid #8c6b60;
  color: #e7d6bb;
  font-size: 1.35rem;
  height: 34px;
  line-height: 1;
  position: absolute;
  right: 15px;
  top: 15px;
  width: 34px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  color: #d9c9a8;
  display: grid;
  font-size: 0.78rem;
  font-weight: 900;
  gap: 6px;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.auth-form input {
  background: #121412;
  border: 1px solid #776d5c;
  border-radius: 1px;
  color: #f0e9da;
  min-height: 44px;
  padding: 9px 11px;
}

.auth-form input:focus {
  border-color: #b09358;
  box-shadow: 0 0 0 2px rgba(176, 147, 88, 0.18);
  outline: 0;
}

.account-submit {
  margin-top: 3px;
  min-height: 44px;
}

.account-submit:disabled {
  cursor: wait;
  opacity: 0.58;
}

.auth-message {
  color: #efb3aa;
  font-size: 0.82rem;
  font-weight: 800;
  min-height: 1.25em;
  margin: 11px 0 3px;
}

.auth-message.is-success {
  color: #aaca91;
}

.auth-switch {
  padding-left: 0;
}

.character-library-modal {
  max-width: 680px;
  width: min(100%, 680px);
}

.characters-list {
  display: grid;
  gap: 10px;
  max-height: min(62vh, 560px);
  overflow-y: auto;
  padding: 2px 3px 3px 0;
}

.character-list-state {
  background: rgba(13, 14, 12, 0.62);
  border: 1px dashed #665d4e;
  color: #baaa8d;
  margin: 0;
  padding: 18px;
  text-align: center;
}

.character-card {
  align-items: center;
  background: #171916;
  border: 1px solid #655b49;
  box-shadow: inset 4px 0 0 #79505a;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 13px 14px 13px 17px;
}

.character-card h3 {
  color: #eadfc8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  margin: 0 0 3px;
}

.character-card p {
  color: #b9aa8c;
  font-size: 0.8rem;
  margin: 0;
}

.character-card time {
  color: #817765;
  display: block;
  font-size: 0.7rem;
  margin-top: 4px;
}

.character-card-actions {
  display: flex;
  gap: 6px;
}

.character-card button {
  background: #334038;
  border: 1px solid #78826d;
  color: #e4dcc7;
  font-size: 0.72rem;
  font-weight: 900;
  min-height: 34px;
  padding: 6px 10px;
  text-transform: uppercase;
}

.character-card .delete-character {
  background: #44262e;
  border-color: #80535e;
}

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

  .top-menu,
  #builder-panel {
    display: none !important;
  }

  .preview-panel {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "overview stage"
      "combat skills"
      "story gear";
  }
}

@media (max-width: 1180px) {
  .top-menu {
    grid-template-areas: "brand quick toggle";
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .top-menu .mobile-menu-toggle {
    display: inline-flex;
  }

  .top-menu .top-menu-actions,
  .top-menu .donate-link {
    display: none;
  }

  .top-menu.is-open {
    grid-template-areas:
      "brand quick toggle"
      "actions actions actions"
      "donate donate donate";
  }

  .top-menu .top-menu-quick-actions {
    gap: 4px;
  }

  .top-menu .top-menu-quick-actions button {
    min-width: 62px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .top-menu.is-open .top-menu-actions {
    animation: mobile-menu-unfold 160ms ease-out both;
    border-top: 1px solid rgba(179, 151, 98, 0.25);
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 5px;
  }

  .top-menu.is-open .top-sheet-actions,
  .top-menu.is-open .auth-actions {
    display: contents;
  }

  .top-menu.is-open .top-menu-actions button {
    width: 100%;
  }

  .top-menu.is-open .donate-link {
    align-items: center;
    display: flex;
    justify-content: center;
    justify-self: stretch;
  }

  @keyframes mobile-menu-unfold {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .preview-panel {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 1.05fr);
    grid-template-areas:
      "stage overview"
      "combat overview"
      "skills skills"
      "story gear";
  }

  body:not(.is-editing) .hero-overview > #hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .skill-table,
  .spell-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rules-panel,
  .combat-grid,
  .story-pickers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    padding: 10px;
  }

  .top-menu {
    gap: 6px;
    padding: 3px 4px;
  }

  .top-menu-actions {
    gap: 5px;
  }

  .forge-logo {
    height: 36px;
    width: 36px;
  }

  .top-menu-brand h1 {
    font-size: 1.08rem;
  }

  .menu-brand-kicker {
    display: none;
  }

  .top-sheet-actions {
    display: contents;
  }

  .auth-actions {
    flex-wrap: wrap;
  }

  .donate-image-crop {
    height: 29px;
    width: 158px;
  }

  .donate-image-crop img {
    left: -5px;
    top: -16px;
    width: 169px;
  }

  .quick-card,
  .character-stage,
  .sheet-panel {
    box-shadow: 0 9px 24px rgba(0, 0, 0, 0.3);
  }

  .preview-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "stage"
      "overview"
      "combat"
      "skills"
      "gear"
      "story";
  }

  body:not(.is-editing) .hero-overview {
    grid-template-columns: minmax(0, 1fr);
  }

  body:not(.is-editing) .hero-overview > #hero-stats,
  body:not(.is-editing) .hero-overview > #summary-values,
  body:not(.is-editing) .hero-overview > #summary-rules {
    grid-column: 1;
  }

  body:not(.is-editing) .hero-overview > #hero-stats,
  body:not(.is-editing) .sheet-skill-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.is-editing .preview-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "stage"
      "overview"
      "combat"
      "skills"
      "gear"
      "story";
  }

  body.is-editing .character-stage {
    position: static;
  }

  .preview-caption {
    align-items: start;
    flex-direction: column;
  }

  .preview-caption span {
    text-align: left;
  }

  .hp-tracker,
  .builder-toolbar,
  .identity-grid,
  .notes-grid,
  .rules-panel,
  .combat-grid,
  .story-pickers,
  .skill-choice-grid,
  .choice-grid,
  .flex-bonuses {
    grid-template-columns: 1fr;
  }

  .edit-reveal .builder-toolbar,
  .edit-reveal .identity-grid,
  .edit-reveal .rules-panel,
  .edit-reveal .combat-grid,
  .edit-reveal .story-pickers,
  .edit-reveal .skill-choice-grid,
  .edit-reveal .derived-grid {
    grid-template-columns: 1fr;
  }

  .avatar-customizer,
  .language-check-list {
    grid-template-columns: 1fr;
  }

  .avatar-option-row:last-child,
  .equipment-field {
    grid-column: auto;
  }

  .rules-panel label,
  .combat-grid label:nth-child(2) {
    grid-column: auto;
  }

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

  .sheet-skill-list {
    grid-template-columns: 1fr;
  }

  .equipped-weapon-slot {
    height: 48px;
    width: 48px;
  }

  .equipped-weapon-slot img {
    height: 34px;
    width: 34px;
  }

  .attack-option {
    grid-template-columns: minmax(0, 1fr) 48px minmax(70px, auto);
  }

  .stat-head {
    display: none;
  }

  .stat-row {
    gap: 5px;
    grid-template-columns: 38px 92px repeat(4, 34px);
    overflow: visible;
    padding-left: 0;
    padding-right: 0;
  }

  .score-control {
    gap: 4px;
    grid-template-columns: 28px minmax(24px, 1fr) 28px;
  }

  .score-control button {
    min-height: 32px;
  }

  .stat-name,
  .score-value,
  .stat-cell {
    font-size: 0.94rem;
  }

  .skill-table,
  .spell-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-top: 0;
  }

  .corner-edit {
    font-size: 0.68rem;
    padding-left: 8px;
    padding-right: 8px;
  }

  .top-menu-brand {
    gap: 6px;
  }

  .forge-logo {
    height: 34px;
    width: 34px;
  }

  .menu-brand-kicker {
    font-size: 0.45rem;
    letter-spacing: 0.1em;
  }

  .top-menu-brand h1 {
    font-size: 1rem;
  }

  .top-menu.is-open .top-menu-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .donate-image-crop {
    height: 25px;
    width: 136px;
  }

  .donate-image-crop img {
    left: -4px;
    top: -14px;
    width: 146px;
  }

  .account-action {
    font-size: 0.64rem;
    min-height: 34px;
    padding: 6px 7px;
  }

  .logout-link {
    font-size: 0.68rem;
  }

  .top-sheet-actions .small-action,
  .top-menu-actions > .small-action {
    font-size: 0.62rem;
    padding-left: 7px;
    padding-right: 7px;
  }

  .modal-backdrop {
    align-items: start;
    padding: 12px;
  }

  .account-modal {
    margin-top: 14px;
    padding: 22px 18px;
  }

  .character-card {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

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