:root {
  color-scheme: light;

  --wood-dark: #3b2a1d;
  --wood-mid: #5c4530;
  --wood-light: #7a5c3e;
  --parchment: #e8dcc0;
  --parchment-dark: #d8c9a3;
  --moss: #4a6741;
  --moss-dark: #35492f;
  --moss-light: #7a9b6e;
  --metal-bronze: #8a6d3b;
  --metal-iron: #4a4642;
  --ink: #2a2420;
  --blood-accent: #7a2e2e;
  --will-accent: #3f6b4f;
  --bane-accent: #b8651f;

  --space-1: 0.2rem;
  --space-2: 0.4rem;
  --space-3: 0.6rem;
  --space-4: 0.9rem;
  --space-5: 1.25rem;

  --font-display: "Grenze Gotisch", Georgia, "Times New Roman", serif;
  --font-body: "Crimson Text", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 11px),
    linear-gradient(170deg, var(--wood-light), var(--wood-dark) 65%);
  background-attachment: fixed;
  min-height: 100vh;
  padding: 1.25rem;
}

#app {
  max-width: 1500px;
  margin-inline: auto;
}

h1 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  text-align: center;
  color: var(--parchment);
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.04em;
  margin: 0.5rem 0 1.25rem;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.03em;
  color: var(--parchment);
  background: linear-gradient(180deg, var(--moss-light), var(--moss) 40%, var(--moss-dark));
  clip-path: polygon(0 18%, 3% 0, 97% 0, 100% 18%, 100% 82%, 97% 100%, 3% 100%, 0 82%);
  filter: drop-shadow(0 1px 0 var(--metal-bronze)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
  text-align: center;
  padding: 0.15rem 1rem;
  margin: 0.2rem auto;
  width: fit-content;
  min-width: 55%;
}

/* panels */
section,
.panel,
.header-section,
.skills-section,
.abilities-section,
.armor-section,
.helmet-section,
.weapons-section,
.inventory-section,
.attributes-section {
  background:
    radial-gradient(circle at 15% 20%, rgba(90, 70, 40, 0.05), transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(90, 70, 40, 0.05), transparent 45%),
    radial-gradient(circle at 60% 15%, rgba(90, 70, 40, 0.04), transparent 35%),
    var(--parchment);
  border: 1px solid var(--metal-bronze);
  box-shadow: inset 0 0 0 1px var(--moss-dark), 0 3px 8px rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: start;
  gap: var(--space-3);
}

.sheet-grid > * { margin-bottom: 0; }
.sheet-grid > .full-width,
.sheet-grid > .divider {
  grid-column: 1 / -1;
}

.sheet-grid > .col-3 { grid-column: span 3; }
.sheet-grid > .col-4 { grid-column: span 4; }
.sheet-grid > .col-6 { grid-column: span 6; }

.sheet-grid > .stack { display: flex; flex-direction: column; }

/* forms */
.field { display: flex; flex-direction: row; align-items: center; gap: var(--space-2); margin-bottom: 0.15rem; }
.field > label { flex: 0 0 auto; white-space: nowrap; }
.field > input, .field > select { flex: 1; min-width: 0; }
.field-narrow > input, .field-narrow > select { max-width: 4.5rem; }

.field-select-custom { flex-wrap: wrap; }
.field-select-custom select { flex: 0 0 auto; }
.field-select-custom input[type="text"] { flex: 1; min-width: 6rem; }

.top-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.header-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 0 0 auto;
  max-width: 40rem;
}
.header-section .field { margin-bottom: 0; }

.top-row > .weapons-section {
  flex: 1;
  min-width: 0;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.portrait-box {
  flex: 0 0 auto;
  width: 4.5rem;
  height: 5.5rem;
  border: 1px solid var(--metal-bronze);
  border-radius: 4px;
  background: var(--parchment-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.portrait-box:hover { filter: brightness(0.97); }
.portrait-file-input { display: none; }
.portrait-img { width: 100%; height: 100%; object-fit: cover; }
.portrait-placeholder {
  font-size: 0.7rem;
  text-align: center;
  color: var(--metal-iron);
  padding: 0.2rem;
}

input.name-title[type="text"] {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.03em;
  text-align: center;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--ink);
  padding: 0.2rem;
}
input.name-title[type="text"]:focus {
  outline: none;
  border-bottom: 2px solid var(--moss);
}

.header-compact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
}
.header-compact-row .field {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}
.header-compact-row .field > label { width: auto; }
.header-compact-row .field > select { max-width: 9rem; }
.header-compact-row .field-select-custom input[type="text"] { min-width: 7rem; max-width: 9rem; }

.field-textarea { align-items: flex-start; }
.field-textarea > label { padding-top: 0.25rem; }
.field-textarea > textarea { flex: 1; min-width: 0; resize: vertical; min-height: 3.2rem; }

/* themed +/- stepper wrapping a number input, used anywhere a plain numeric
   field appears (skills, resources, currency, armor, carry capacity, ...) */
.num-stepper {
  display: inline-flex;
  align-items: stretch;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--metal-bronze);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.num-stepper button.num-step {
  width: 1.1rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  cursor: pointer;
  background: linear-gradient(180deg, var(--wood-light), var(--wood-mid));
  color: var(--parchment);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
  transition: filter 120ms ease;
}

.num-stepper button.num-step:hover { filter: brightness(0.92); }
.num-stepper button.num-step:active { filter: brightness(0.85); }

.num-stepper input[type="number"] {
  width: 2.2rem;
  padding: 0.25rem 0.2rem;
  text-align: center;
  border: none;
  border-left: 1px solid var(--metal-bronze);
  border-right: 1px solid var(--metal-bronze);
  border-radius: 0;
}

.combat-strip {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.3rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--metal-bronze);
}

label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--metal-iron);
  font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--metal-bronze);
  background: var(--parchment-dark);
  color: var(--ink);
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: 2px solid var(--moss);
  outline-offset: 1px;
}

/* Firefox always shows the native up/down stepper on number inputs (Chrome
   only on hover/focus); hide it everywhere so the parchment theme isn't
   broken by a stray OS-chrome widget. */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

select {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.3rem 1.9rem 0.3rem 0.6rem;
  border-radius: 3px;
  border: 1px solid var(--metal-bronze);
  background-color: var(--moss);
  color: var(--parchment);
  /* The page is color-scheme: light overall, which tells Firefox to use its
     light native widget palette for form controls still under any native
     rendering - fighting our dark custom background. Scoping dark just to
     selects stops Firefox from painting light chrome underneath our colors. */
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23e8dcc0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 9px 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: background-color 120ms ease;
}

select:hover {
  background-color: var(--moss-light);
}

select:focus,
select:active,
select:focus-visible {
  background-color: var(--moss);
  color: var(--parchment);
  outline: 2px solid var(--metal-bronze);
  outline-offset: 1px;
}

select:hover:focus {
  background-color: var(--moss-light);
}

/* Firefox renders its native dotted focus ring using the text color, which
   makes a dark-on-dark select look broken even with -moz-appearance: none.
   This standard trick hides that ring without affecting real text color. */
select:-moz-focusring {
  color: transparent;
  text-shadow: 0 0 0 var(--parchment);
}

select option {
  background: var(--parchment);
  color: var(--ink);
  font-weight: 400;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 1rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.checkbox-field input[type="checkbox"] {
  appearance: none;
  width: 0.9rem;
  height: 0.9rem;
  border: 1px solid var(--metal-bronze);
  background: var(--parchment-dark);
  transform: rotate(45deg);
  margin: 0.15rem;
  cursor: pointer;
}

.checkbox-field input[type="checkbox"]:checked {
  background: var(--moss);
}

/* buttons */
button {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  border: 1px solid var(--metal-bronze);
  background: linear-gradient(180deg, var(--wood-light), var(--wood-mid));
  color: var(--parchment);
  cursor: pointer;
  margin-right: 0.4rem;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
  transition: filter 120ms ease, box-shadow 120ms ease;
}

button:hover { filter: brightness(0.92); }
button:active { filter: brightness(0.85); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5); }
button.active { text-decoration: underline; }

button.primary {
  background: linear-gradient(180deg, var(--moss-light), var(--moss));
  border-color: var(--moss-dark);
}

button.danger {
  background: linear-gradient(180deg, #a04545, var(--blood-accent));
  border-color: var(--blood-accent);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.save-group { display: flex; align-items: center; gap: var(--space-3); }
.save-status { color: var(--moss-dark); font-weight: 600; }

/* login */
.login-view {
  display: flex;
  justify-content: center;
  padding-top: 3rem;
}

.login-card {
  text-align: center;
  max-width: 24rem;
  padding: var(--space-5) var(--space-5);
}

/* attributes band */
.attributes-section {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  justify-items: center;
}

.attributes-section > h2 {
  grid-column: 1 / -1;
}

.attribute {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.attribute-name {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--metal-iron);
}

.attribute-value {
  width: 3.4rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  aspect-ratio: 1;
}

/* Pre-existing specificity bug: the shared `input[type="number"]` rule's
   attribute selector outweighs a plain class, so border-radius needs the
   same specificity here (type selector + class) to actually win. */
input.attribute-value {
  border-radius: 50%;
}

/* a mossy ring around the score, echoing the h2 banner gradient so the
   attributes band reads as part of the same visual family as the rest
   of the sheet instead of a bare row of circles */
.attribute-ring {
  width: 3.8rem;
  height: 3.8rem;
  border-radius: 50%;
  background: conic-gradient(var(--moss-light) 0deg 216deg, var(--parchment-dark) 216deg 360deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.attribute-ring .attribute-value {
  width: 2.9rem;
}

.attribute-toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--metal-iron);
  font-weight: 600;
  cursor: pointer;
}

.attribute-toggle {
  appearance: none;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 1px solid var(--metal-bronze);
  background: var(--parchment-dark);
  margin: 0;
  cursor: pointer;
}

.attribute-toggle:checked {
  background: var(--blood-accent);
  border-color: var(--blood-accent);
}

/* resources / pip trackers */
.resource-track {
  border: 1px solid var(--metal-bronze);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  margin-top: 0.4rem;
  margin-bottom: 0.3rem;
  background: var(--parchment-dark);
}

.resource-track:last-child {
  margin-bottom: 0;
}

.resource-track .resource-name {
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.pip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.22rem;
  margin-bottom: 0.3rem;
}

.pip {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  border: 1px solid var(--metal-bronze);
  background: var(--parchment);
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}

.pip:hover { transform: scale(1.15); }
.pip:focus-visible { outline: 2px solid var(--moss); outline-offset: 1px; }

.resource-track.willpower .pip.filled { background: var(--will-accent); border-color: var(--will-accent); }
.resource-track.body-points .pip.filled { background: var(--blood-accent); border-color: var(--blood-accent); }

.resource-max {
  width: 3.2rem;
}

.death-rolls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px dashed var(--metal-bronze);
}

.death-rolls .field-narrow > input, .death-rolls .field-narrow > select { max-width: 6rem; }
.death-rolls.hidden { display: none; }

/* skills */
.skills-grid { display: flex; gap: var(--space-5); margin-bottom: var(--space-2); }
.skills-col { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }

.skill-row { display: flex; align-items: center; gap: 0.4rem; }
.skill-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 120ms ease;
}
.skill-mark:hover { transform: scale(1.15); }
.skill-mark:focus-visible { outline: 2px solid var(--moss); outline-offset: 1px; }
/* Hollow vs filled diamond, not just a shade/size change, so marked state
   reads clearly at a glance instead of blending into the unmarked rows. */
.skill-mark::before { content: "◇"; color: var(--metal-bronze); font-size: 0.85rem; }
.skill-mark.marked::before { content: "◆"; color: var(--blood-accent); font-size: 0.95rem; }
.skill-name { flex: 1; }
.skill-attr { color: var(--metal-iron); opacity: 0.75; width: 3rem; font-size: 0.85rem; }
.skill-value { width: 3rem; }

/* bane warning - governing attribute is distressed */
.skill-row.has-bane,
.secondary-skill-row.has-bane {
  border-left: 2px solid var(--bane-accent);
  padding-left: 0.3rem;
  background: rgba(184, 101, 31, 0.08);
}
.skill-row.has-bane .skill-name,
.skill-row.has-bane .skill-attr,
.secondary-skill-row.has-bane .secondary-skill-name,
.secondary-skill-row.has-bane .secondary-skill-attr {
  color: var(--bane-accent);
  opacity: 1;
}

.item-row, .secondary-skill-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
  align-items: center;
}

.item-row input[type="text"] { flex: 1; min-width: 0; }
.item-row select { flex: 0 0 auto; }

.secondary-skill-name { flex: 1; min-width: 0; }
.secondary-skill-attr { padding: 0.25rem 1.6rem 0.25rem 0.4rem; font-size: 0.78rem; }

.weight-total {
  display: block;
  font-size: 0.85rem;
  color: var(--metal-iron);
  opacity: 0.75;
  margin: -0.15rem 0 0.3rem;
}
.weight-total.over-capacity {
  color: var(--bane-accent);
  opacity: 1;
  font-weight: 600;
}

/* weapon table - header and rows share one column grid so labels line up */
.weapon-row {
  display: grid;
  grid-template-columns: 2fr 0.7fr 0.8fr 0.8fr 0.9fr 1.3fr auto;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
  align-items: center;
}

.weapon-row > input, .weapon-row > select, .weapon-row > span, .weapon-row > details { min-width: 0; }

.weapon-properties { position: relative; }

.weapon-properties > summary {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--metal-bronze);
  background: var(--parchment-dark);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weapon-properties-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 5;
  background: var(--parchment);
  border: 1px solid var(--metal-bronze);
  border-radius: 4px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  padding: 0.4rem 0.6rem;
  margin-top: 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 11rem;
  max-height: 14rem;
  overflow-y: auto;
}

.weapon-table-header {
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--metal-iron);
  border-bottom: 1px solid var(--metal-bronze);
  padding-bottom: 0.3rem;
  margin-bottom: 0.4rem;
}

.remove-row {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--blood-accent);
  line-height: 1;
  font-size: 1rem;
}

/* armor */
.armor-row { display: flex; align-items: center; gap: 0.5rem 0.75rem; flex-wrap: wrap; }
.armor-row .field-narrow { flex: 0 0 auto; }

.icon-shield, .icon-helmet, .icon-sword, .icon-book, .icon-scroll, .icon-backpack {
  width: 2.4rem;
  height: 2.4rem;
  flex-shrink: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* small inline variant for sitting next to text in an h2 banner */
.h2-icon {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  vertical-align: -0.2rem;
  margin-right: 0.3rem;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* a crossed hilt and blade */
.icon-sword {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 L13 15 L11 15 Z' fill='%23e8dcc0' stroke='%238a6d3b' stroke-width='1'/%3E%3Cpath d='M7 12 L17 12' stroke='%238a6d3b' stroke-width='1.5'/%3E%3Crect x='10.5' y='15' width='3' height='6' fill='%235c4530' stroke='%238a6d3b' stroke-width='1'/%3E%3C/svg%3E");
}

/* an open book */
.icon-book {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5 C10 3.5 6 3.5 4 4.5 L4 18 C6 17 10 17 12 18.5 C14 17 18 17 20 18 L20 4.5 C18 3.5 14 3.5 12 5 Z' fill='%23e8dcc0' stroke='%238a6d3b' stroke-width='1'/%3E%3Cline x1='12' y1='5' x2='12' y2='18.5' stroke='%238a6d3b' stroke-width='1'/%3E%3C/svg%3E");
}

/* a rolled scroll */
.icon-scroll {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='6' width='14' height='12' fill='%23e8dcc0' stroke='%238a6d3b' stroke-width='1'/%3E%3Ccircle cx='5' cy='6' r='2' fill='%23e8dcc0' stroke='%238a6d3b' stroke-width='1'/%3E%3Ccircle cx='5' cy='18' r='2' fill='%23e8dcc0' stroke='%238a6d3b' stroke-width='1'/%3E%3Ccircle cx='19' cy='6' r='2' fill='%23e8dcc0' stroke='%238a6d3b' stroke-width='1'/%3E%3Ccircle cx='19' cy='18' r='2' fill='%23e8dcc0' stroke='%238a6d3b' stroke-width='1'/%3E%3C/svg%3E");
}

/* a satchel/backpack */
.icon-backpack {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 9 C7 5 9 3 12 3 C15 3 17 5 17 9 L18 9 L19 20 L5 20 L6 9 Z' fill='%235c4530' stroke='%238a6d3b' stroke-width='1'/%3E%3Crect x='9' y='12' width='6' height='5' fill='%237a5c3e' stroke='%238a6d3b' stroke-width='1'/%3E%3C/svg%3E");
}

/* a breastplate: hexagonal body with a V-neck collar line */
.icon-shield {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 L18 5 L19 12 L16 14 L16 20 L8 20 L8 14 L5 12 L6 5 Z' fill='%234a6741' stroke='%238a6d3b' stroke-width='1'/%3E%3Cpath d='M12 2 L12 9 M9 6 L12 9 L15 6' fill='none' stroke='%238a6d3b' stroke-width='1'/%3E%3C/svg%3E");
}

/* a helmet: domed bowl, brim line and a nose guard */
.icon-helmet {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 14 C4 6 8 3 12 3 C16 3 20 6 20 14 L20 16 L4 16 Z' fill='%234a6741' stroke='%238a6d3b' stroke-width='1'/%3E%3Crect x='10.5' y='14' width='3' height='7' fill='%234a6741' stroke='%238a6d3b' stroke-width='1'/%3E%3Cline x1='4' y1='11' x2='20' y2='11' stroke='%238a6d3b' stroke-width='1'/%3E%3C/svg%3E");
}

/* currency */
.currency-rows { display: flex; flex-direction: row; flex-wrap: wrap; gap: var(--space-3) var(--space-4); margin-top: var(--space-2); }

.currency-row { display: flex; align-items: center; gap: 0.6rem; }

.currency-icon {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--metal-iron);
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.35);
}

.currency-icon.gold { background: radial-gradient(circle at 35% 30%, #f5d66b, #c9a227 70%); }
.currency-icon.silver { background: radial-gradient(circle at 35% 30%, #f2f2f2, #a8a8a8 70%); }
.currency-icon.copper { background: radial-gradient(circle at 35% 30%, #e3a471, #a9601f 70%); }

.currency-row input { flex: 1; width: auto; min-width: 0; }

/* character list */
.character-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 0.3rem;
  border-bottom: 1px solid var(--metal-bronze);
}
.character-row:last-child { border-bottom: none; }

.character-row .name {
  font-weight: 700;
  min-width: 10rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 120ms ease;
}
.character-row .name:hover { text-decoration-color: var(--metal-iron); }
.character-row .meta { opacity: 0.75; flex: 1; }

.error-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--blood-accent);
  color: var(--parchment);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.error-banner button { color: var(--parchment); border-color: var(--parchment); background: transparent; }

.mode-toggle { margin-bottom: 1rem; }

/* responsive */
@media (max-width: 1100px) {
  .sheet-grid { grid-template-columns: repeat(6, 1fr); }
  .top-row { flex-direction: column; align-items: stretch; }
  .header-section { max-width: none; }
  .attributes-section { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
  body { padding: var(--space-2); }

  .sheet-grid { grid-template-columns: 1fr; }
  .sheet-grid > .col-3,
  .sheet-grid > .col-4,
  .sheet-grid > .col-6 { grid-column: 1 / -1; }

  .attributes-section { grid-template-columns: repeat(2, 1fr); }

  .weapon-row, .weapon-table-header {
    grid-template-columns: 1fr;
  }
  .weapon-table-header { display: none; }
  .weapon-row {
    gap: 0.2rem;
    padding-bottom: var(--space-2);
    border-bottom: 1px dashed var(--metal-bronze);
  }
}
