/* ============================================================
   Call of Cthulhu Investigator Creator — 1920s pulp theme
   ============================================================ */
@import url("../vendor/fonts/fonts.css");

:root {
  --ink: #1c1a17;
  --paper: #efe6d2;
  --paper-2: #e6dcc3;
  --parch: #f4ecd8;
  --line: #c8b994;
  --line-dk: #a8956b;
  --accent: #7c1f1f; /* oxblood */
  --accent-2: #c79b3b; /* tarnished gold */
  --green: #2f5d3a;
  --ink-soft: #514a3c;
  --shadow: rgba(28, 26, 23, 0.25);
  --field-bg: #fbf6e9;
  --ink-blue: #20305f; /* fountain-pen ink */
}

* { box-sizing: border-box; }

/* Slim oxblood scrollbars (a thin red line) in place of the chunky default. */
* { scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background-color: var(--accent); border-radius: 999px;
  border: 4px solid transparent; background-clip: padding-box; /* leaves a thin ~4px bar */
}
*::-webkit-scrollbar-thumb:hover { background-color: #5a1414; }

html, body {
  margin: 0;
  background:
    radial-gradient(ellipse at top, #2a2723 0%, #181613 70%) fixed;
  color: var(--ink);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 17px;
  line-height: 1.5;
  scrollbar-gutter: stable; /* reserve the gutter so locking scroll doesn't shift the page */
}

/* While a modal is open, freeze the page behind it — only the modal scrolls. */
html.modal-open, body.modal-open { overflow: hidden; }

#app {
  max-width: 940px;
  margin: 0 auto;
  padding: 0 16px 96px;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 4px 14px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, #181613 70%, rgba(24,22,19,0));
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  font-size: 30px; color: var(--accent-2);
  text-shadow: 0 0 14px rgba(199,155,59,0.5);
}
.brand-title {
  font-family: "Cinzel", serif; font-weight: 700; letter-spacing: 2px;
  color: var(--parch); font-size: 20px; line-height: 1;
}
.brand-sub {
  font-family: "Special Elite", monospace; color: var(--accent-2);
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase; margin-top: 4px;
}

/* ---- Stepper ---- */
.stepper {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 16px 0 18px;
}
.reset-chip { margin-left: auto; padding: 6px 14px; font-size: 12px; }
.step-chip {
  display: flex; align-items: center; gap: 7px;
  background: rgba(244,236,216,0.06);
  border: 1px solid rgba(200,185,148,0.25);
  color: #b8ad93; cursor: pointer;
  padding: 6px 12px; border-radius: 30px;
  font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 1px;
  transition: all 0.18s ease;
}
.step-chip:hover:not(:disabled) { border-color: var(--accent-2); color: var(--parch); }
.step-chip:disabled { opacity: 0.4; cursor: default; }
.step-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.step-chip.done { color: var(--accent-2); border-color: rgba(199,155,59,0.5); }
.chip-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.25); font-size: 11px;
}
.step-chip.active .chip-num { background: rgba(255,255,255,0.2); }
@media (max-width: 620px) { .chip-label { display: none; } }

/* ---- Card / paper surfaces ---- */
.stage { animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.012) 0 2px, transparent 2px 4px);
  border: 1px solid var(--line-dk);
  border-radius: 4px;
  padding: 28px 30px;
  margin-bottom: 18px;
  box-shadow: 0 10px 40px var(--shadow), inset 0 0 0 1px rgba(255,255,255,0.4);
  position: relative;
}
.card::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid rgba(168,149,107,0.4); border-radius: 2px; pointer-events: none;
}
.card.lead { text-align: center; }

h1 {
  font-family: "Cinzel", serif; font-weight: 700; font-size: 30px;
  margin: 4px 0 12px; color: var(--accent); letter-spacing: 1px;
}
h2 {
  font-family: "Cinzel", serif; font-weight: 700; font-size: 23px;
  margin: 0 0 6px; color: var(--ink); letter-spacing: 0.5px;
  border-bottom: 2px solid var(--line); padding-bottom: 8px;
}
h3.sk-head {
  font-family: "Cinzel", serif; font-size: 15px; letter-spacing: 1px;
  color: var(--accent); margin: 22px 0 8px; text-transform: uppercase;
}
h3.sk-head.inline { display: inline; }
.lede { color: var(--ink-soft); font-size: 17px; margin: 8px 0 18px; }
.card.lead .lede { max-width: 70ch; margin-left: auto; margin-right: auto; font-size: 18px; }
.hint-line { color: var(--ink-soft); font-size: 14px; font-style: italic; }
.warn { color: var(--accent); font-style: normal; font-weight: 600; }
.good { color: var(--green); font-style: normal; font-weight: 600; }

/* ---- Fields ---- */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.bg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
@media (max-width: 560px) { .field-grid, .bg-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label {
  font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-soft);
  display: flex; align-items: center; gap: 8px;
}
.req { color: var(--accent); font-style: normal; }
.input {
  background: var(--field-bg);
  border: 1px solid var(--line-dk);
  border-radius: 3px; padding: 9px 11px;
  font-family: "EB Garamond", serif; font-size: 16px; color: var(--ink);
  width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,31,31,0.15); }
.area { resize: vertical; line-height: 1.45; }
select.input { cursor: pointer; }

/* ---- Nav footer ---- */
.navbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 15;
  display: flex; align-items: center; gap: 14px;
  /* Fixed height so the bar doesn't grow/shrink with the status pill's presence. */
  min-height: 64px;
  /* Center the controls to the #app column (940px) with 16px gutters. */
  padding: 13px max(16px, calc((100% - 940px) / 2 + 16px));
  background: #201d18;
  border-top: 2px solid var(--line-dk);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
}
.nav-hint { flex: 1; display: flex; align-items: center; justify-content: center; }
.nav-pill {
  display: inline-flex; align-items: center; padding: 7px 18px;
  font-family: "Cinzel", serif; font-weight: 600; font-size: 15px; letter-spacing: 0.6px; line-height: 1;
  color: #1c1812; background: var(--accent-2);
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 10px rgba(199, 155, 59, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
/* On phones there isn't room for the status between the buttons — drop it and
   push Back / Next to opposite ends. */
@media (max-width: 640px) {
  .nav-hint { display: none; }
  .navbar { justify-content: space-between; }
}
.navbar .ghost-btn { color: var(--parch); background: transparent; border-color: rgba(200, 185, 148, 0.6); }
.navbar .ghost-btn:hover:not(:disabled) { color: var(--parch); border-color: var(--accent-2); background: rgba(199, 155, 59, 0.12); }

/* Floating prev/next arrows that ride in the desktop gutters, fixed and
   vertically centered (à la D&D Beyond). Hidden until there's room for them. */
.side-nav {
  display: none;
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 16;
  width: 54px; height: 54px; padding: 0; overflow: hidden;
  cursor: pointer; color: #fff; white-space: nowrap;
  background: var(--accent); border: 1px solid #5a1414; border-radius: 12px;
  box-shadow: 0 6px 18px rgba(124, 31, 31, 0.45);
  transition: width 0.26s cubic-bezier(0.2, 0.7, 0.3, 1), filter 0.12s;
}
.side-nav:hover:not(:disabled) { width: 132px; filter: brightness(1.12); }
.side-nav:disabled { opacity: 0.3; cursor: default; box-shadow: none; }
/* The arrow rides the outer (far) edge as the pill opens outward, so the label
   fades into the space beside it: "‹ Back" on the left, "Next ›" on the right. */
.side-ico {
  position: absolute; top: 0; bottom: 0; width: 54px;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.side-prev .side-ico { left: 0; }
.side-next .side-ico { right: 0; }
.side-label {
  display: block; height: 54px; line-height: 54px;
  font-family: "Cinzel", serif; font-size: 14px; letter-spacing: 1px; text-transform: uppercase;
  opacity: 0; transition: opacity 0.14s;
}
.side-prev .side-label { margin: 0 14px 0 54px; text-align: right; }
.side-next .side-label { margin: 0 54px 0 14px; text-align: left; }
.side-nav:hover:not(:disabled) .side-label { opacity: 1; transition-delay: 0.12s; }
/* Anchor each pill by its inner (content-facing) edge, just outside the 940px
   column, so the outward growth never reaches the content. */
.side-prev { right: calc((100% + 940px) / 2 + 16px); }
.side-next { left: calc((100% - 940px) / 2 + 956px); }

/* Only show the arrows once the gutters are wide enough to seat the expanded
   pill; on narrower screens the bottom-bar buttons take over. */
@media (min-width: 1240px) {
  .side-nav { display: block; }
  .navbar #back-btn, .navbar #next-btn { display: none; }
}
.primary-btn {
  font-family: "Cinzel", serif; letter-spacing: 1px; font-weight: 700;
  background: var(--accent); color: #fff; border: 1px solid #5a1414;
  padding: 11px 22px; border-radius: 3px; cursor: pointer; font-size: 14px;
  box-shadow: 0 4px 14px rgba(124,31,31,0.4); transition: transform 0.12s, filter 0.12s;
}
.primary-btn:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.primary-btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.primary-btn.small { padding: 8px 16px; font-size: 13px; box-shadow: none; }
/* Default: readable on the light parchment cards (the nav bar re-skins these
   for its dark background below). */
.ghost-btn {
  font-family: "Cinzel", serif; letter-spacing: 1px;
  background: var(--field-bg); color: var(--ink); border: 1px solid var(--line-dk);
  padding: 10px 18px; border-radius: 3px; cursor: pointer; font-size: 13px;
  transition: all 0.15s;
}
.ghost-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: #f3e7d0; }
.ghost-btn:disabled { opacity: 0.4; cursor: default; }
.mini-btn {
  background: var(--paper-2); border: 1px solid var(--line-dk); color: var(--accent);
  border-radius: 3px; cursor: pointer; padding: 4px 9px; font-size: 15px; line-height: 1;
  transition: all 0.12s;
}
.mini-btn:hover { background: var(--accent); color: #fff; }
.mini-btn.inline { font-family: "EB Garamond", serif; font-size: 12px; padding: 2px 8px; text-transform: none; letter-spacing: 0; margin-left: 12px; }
.mini-btn.wide { width: 100%; margin: 8px 0; padding: 8px; }
.mini-btn.sel { background: var(--accent); color: #fff; }

/* Prominent action button (Roll all, EDU Average/Roll, Luck Roll) */
.act-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--paper-2); border: 1.5px solid var(--line-dk); color: var(--accent);
  border-radius: 5px; cursor: pointer; padding: 8px 16px;
  font-family: "Cinzel", serif; font-weight: 700; font-size: 14px; letter-spacing: 0.5px;
  transition: all 0.13s;
}
.act-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: translateY(-1px); }
.act-btn.sel { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,31,31,0.18); }
.act-btn.big { font-size: 16px; padding: 11px 24px; }

.roll-all-wrap { display: flex; justify-content: center; margin: 4px 0 16px; }

.edu-choice { display: inline-flex; gap: 8px; }
.edu-formula {
  font-family: "Courier New", monospace; font-size: 12px; color: var(--ink-soft);
  margin-left: 8px; white-space: nowrap;
}
.edu-gain-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.edu-gain { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--ink); }
.edu-gain-input {
  width: 64px; text-align: center; font-weight: 700; padding: 6px 8px;
  -moz-appearance: textfield; appearance: textfield;
}
.edu-gain-input::-webkit-outer-spin-button,
.edu-gain-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---- Method tabs (one connected segmented control) ---- */
.method-tabs {
  display: flex; margin: 6px 0 12px;
  border: 1.5px solid var(--line-dk); border-radius: 6px; overflow: hidden;
  background: var(--field-bg);
}
.method-tab {
  flex: 1; cursor: pointer; background: transparent; border: 0;
  border-right: 1.5px solid var(--line-dk);
  padding: 11px 10px; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: "Cinzel", serif; font-weight: 700; font-size: 15px; color: var(--ink-soft);
  transition: background 0.15s, color 0.15s;
}
.method-tab:last-child { border-right: 0; }
.method-tab .ph { font-size: 18px; }
.method-tab:hover { background: #f2e7da; color: var(--accent); }
.method-tab.active { background: var(--accent); color: #fbeee6; }
@media (max-width: 440px) { .method-tab span { display: none; } .method-tab .ph { font-size: 20px; } }
.method-desc {
  background: var(--field-bg); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 4px;
  padding: 10px 14px; margin: 0 0 18px;
  color: var(--ink-soft); font-size: 14px; line-height: 1.5;
}
.method-desc-hint { font-style: italic; }

/* ---- Roll method entry ---- */
.roll-entry { display: flex; align-items: center; gap: 10px; }
.roll-rule {
  font-family: "Courier New", monospace; font-size: 13px; color: var(--ink-soft);
  white-space: nowrap; letter-spacing: 0.3px;
}
.roll-input {
  flex: 0 0 auto; width: 72px; text-align: center; font-weight: 700;
  padding: 6px 8px; -moz-appearance: textfield; appearance: textfield;
}
.roll-input::-webkit-outer-spin-button,
.roll-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---- Characteristics ---- */
.char-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 22px; margin: 14px 0;
}
@media (max-width: 560px) { .char-grid { grid-template-columns: minmax(0, 1fr); } }
.char-row {
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
  padding: 8px 0; border-bottom: 1px dotted var(--line);
}
.char-line, .luck-block {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.stat-desc {
  font-size: 13px; font-style: italic; color: var(--ink-soft);
  line-height: 1.4; min-height: 1.4em; /* always reserve one line — no shift when empty */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.luck-block { margin-top: 8px; border-top: 2px solid var(--line); border-bottom: none; padding-top: 12px; }
.luck-note .luck-note-text {
  font-size: 14px; font-style: italic; color: var(--ink-soft);
  max-width: 48ch; text-align: right; line-height: 1.35;
}
.luck-note .luck-note-text strong { color: var(--accent); font-style: normal; }
.luck-entry { display: flex; align-items: center; gap: 12px; }
.luck-input {
  flex: 0 0 auto; width: 72px; text-align: center; font-weight: 700;
  padding: 6px 8px; -moz-appearance: textfield; appearance: textfield;
}
.luck-input::-webkit-outer-spin-button,
.luck-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.luck-rules {
  font-family: "Courier New", monospace; font-size: 13px; color: var(--ink-soft);
  white-space: nowrap; letter-spacing: 0.3px;
}
.vital.pending { border-style: dashed; }
.vital-pending {
  font-family: "Special Elite", monospace; font-size: 13px; color: var(--ink-soft);
  letter-spacing: 0.5px; white-space: nowrap;
}
.char-name { display: flex; align-items: center; gap: 10px; }
.char-name-text { display: flex; flex-direction: column; }
.char-name strong { font-family: "Cinzel", serif; letter-spacing: 1px; }
.char-name span { font-size: 12px; color: var(--ink-soft); }
.stat-icon { font-size: 24px; line-height: 1; color: var(--ink); flex: 0 0 auto; }
.char-select { max-width: 110px; text-align: center; }

/* standard-array checkbox chips: value stacked above a borderless checkbox */
.array-choices { display: flex; flex-wrap: wrap; gap: 6px 9px; justify-content: flex-end; }
.arr-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer; -webkit-user-select: none; user-select: none;
  border: none; background: transparent; padding: 0;
  font-family: "Special Elite", monospace; font-size: 14px; line-height: 1;
}
.arr-chip input { accent-color: var(--accent); margin: 0; cursor: pointer; }
.arr-chip:hover:not(.disabled) .arr-val { color: var(--accent-2); }
.arr-val { color: var(--ink-soft); }
.arr-chip.checked .arr-val { color: var(--accent); font-weight: bold; }
.arr-chip.disabled { opacity: 0.35; cursor: default; }
@media (max-width: 560px) { .array-choices { justify-content: flex-start; } }
.char-rolled { display: flex; align-items: center; gap: 10px; }
.char-val {
  font-family: "Special Elite", monospace; font-size: 26px; color: var(--accent);
  min-width: 46px; text-align: right;
}
.roll-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 6px 0 4px; }

/* derived ("inferred") values panel */
.infer-panel { margin-top: 18px; border-top: 2px solid var(--line); padding-top: 14px; }
.infer-head {
  font-family: "Cinzel", serif; font-size: 13px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}
.infer-hint {
  font-family: "EB Garamond", serif; text-transform: none; letter-spacing: 0;
  font-style: italic; color: var(--ink-soft); font-size: 13px;
}
.infer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; }
@media (max-width: 560px) { .infer-grid { grid-template-columns: 1fr; } }
.infer { background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px; }
.infer summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 7px 12px; list-style: none;
}
.infer summary::-webkit-details-marker { display: none; }
.infer summary::before { content: "\25B8"; color: var(--accent); font-size: 11px; }
.infer[open] summary::before { content: "\25BE"; }
.infer-label { flex: 1; font-size: 15px; font-weight: 600; }
.infer-val {
  font-family: "Special Elite", monospace; font-weight: bold;
  color: var(--accent); font-size: 17px;
}
.infer-flavor {
  font-family: "EB Garamond", serif; font-weight: normal; font-style: italic;
  font-size: 13px; color: var(--ink-soft); margin-left: 4px;
}
/* the characteristics (icon + key) that feed this derived value, just right of its label */
.infer-deps { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-left: 8px; vertical-align: middle; }
.infer-dep {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: "Cinzel", serif; font-weight: 400; font-size: 11px; letter-spacing: 0.5px;
  color: var(--ink-soft);
}
.infer-dep i { font-size: 14px; }
.infer-detail { margin: 0 12px 9px 24px; padding-top: 8px; border-top: 1px dotted var(--line); }
/* (1) what it is + what it impacts, then (2) how it's calculated, on its own line */
.infer-what { margin: 0; font-size: 13px; color: var(--ink); line-height: 1.45; }
.infer-calc { margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); font-style: italic; line-height: 1.4; }
/* inline lookup table (Damage Bonus / Build); the player's row is bold-highlighted.
   Spans the dropdown width with evenly distributed columns. */
.calc-table {
  width: 100%; table-layout: fixed; border-collapse: collapse; margin: 8px 0 2px;
  font-style: normal; font-family: "Special Elite", monospace; font-size: 12px;
}
.calc-table th, .calc-table td { padding: 4px 10px; text-align: center; border-bottom: 1px dotted var(--line); }
.calc-table th { font-family: "Cinzel", serif; font-size: 9px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--ink-soft); }
/* first column (the condition / range) flexes; value columns stay narrow */
.calc-table th:first-child, .calc-table td:first-child { text-align: left; }
.calc-table th:not(:first-child), .calc-table td:not(:first-child) { width: 72px; }
.calc-table tr.hit td { font-weight: bold; color: var(--accent); background: rgba(124, 31, 31, 0.08); }
.calc-table tr:last-child td { border-bottom: none; }
/* the resulting-total row (e.g. final Move Rate): divider above + emphasis */
.calc-table tr.total td { border-top: 1.5px solid var(--line-dk); font-weight: bold; color: var(--accent); }
.calc-note { margin-top: 6px; font-size: 12px; color: var(--ink-soft); }
.calc-lead { margin: 10px 0 3px; }
.calc-lead:first-child { margin-top: 0; }

/* point-buy sliders — shared 15–90 scale, custom track shows the gradient */
.slider-row { flex-direction: row; align-items: center; gap: 14px; }
.slider-row .char-name { flex: 0 0 92px; width: 92px; }
.pb-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pb-col .stat-desc { text-align: left; }
.pb-slider-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pb-slider {
  flex: 1; min-width: 80px; height: 8px; border-radius: 5px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background: #cdbf9c; /* fallback; real track set inline via gradient */
  border: 1px solid var(--line-dk);
}
.pb-slider:focus { outline: none; box-shadow: 0 0 0 2px rgba(124,31,31,0.18); }
.pb-slider::-webkit-slider-runnable-track { -webkit-appearance: none; background: transparent; height: 8px; border-radius: 5px; }
.pb-slider::-moz-range-track { background: transparent; height: 8px; border-radius: 5px; }
.pb-slider::-moz-range-progress { background: transparent; }
.pb-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
  box-shadow: 0 0 0 2px #f7efda, 0 1px 3px rgba(0,0,0,0.45);
}
.pb-slider::-moz-range-thumb {
  width: 16px; height: 16px; border: none; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 0 0 2px #f7efda, 0 1px 3px rgba(0,0,0,0.45);
}
.pb-value {
  font-family: "Special Elite", monospace; font-size: 20px; color: var(--accent);
  min-width: 30px; text-align: right; flex: 0 0 auto;
  background: transparent; cursor: text; border-radius: 2px;
  text-underline-offset: 3px;
}
.pb-value:hover { text-decoration: underline dotted rgba(124, 31, 31, 0.45); }
.pb-value:focus {
  outline: none;
  text-decoration: underline dotted var(--accent);
}
@media (max-width: 560px) {
  .card { padding: 22px 18px; }
  .pb-slider { min-width: 0; }
  /* Just the three-letter key by the slider — drop the full attribute name. */
  .char-name span { display: none; }
  /* Wide enough for icon + key, with clear separation before the slider/text. */
  .slider-row { gap: 16px; }
  .slider-row .char-name { flex: 0 0 64px; width: 64px; }
  .pb-col { padding-left: 4px; }
  .pb-slider-wrap { gap: 8px; }
  /* Keep the Luck note on one line: tighter gap, smaller text, no width cap. */
  .luck-block { gap: 8px; }
  .luck-note .luck-note-text { font-size: 12px; max-width: none; }
}

/* ---- Age ---- */
.age-picker { margin: 18px 0; }
.slider { width: 100%; accent-color: var(--accent); height: 6px; }
.age-readout { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-family: "Cinzel", serif; }
.age-num { max-width: 90px; text-align: center; font-size: 20px; font-family: "Special Elite", monospace; }
.age-list { margin: 8px 0; padding-left: 22px; }
.age-list li { margin: 5px 0; }
.split-box { background: var(--field-bg); border: 1px solid var(--line-dk); border-radius: 4px; padding: 14px 16px; margin: 12px 0; }
.split-title { font-family: "Cinzel", serif; font-size: 13px; letter-spacing: 1px; margin-bottom: 10px; }
.split-row { display: flex; flex-direction: column; gap: 12px; }
.split-stat { display: flex; flex-direction: column; gap: 3px; }
.split-eq-line { display: flex; align-items: center; gap: 10px; font-family: "Special Elite", monospace; font-size: 15px; }
.split-key { font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 1px; color: var(--ink-soft); min-width: 34px; }
.split-eq { display: flex; align-items: center; gap: 6px; }
.split-eq b { color: var(--accent); min-width: 22px; text-align: left; }
.split-desc { font-size: 13px; font-style: italic; color: var(--ink-soft); line-height: 1.3; }
.input.tiny { width: 68px; max-width: 68px; text-align: center; padding-left: 6px; padding-right: 4px; }

/* age allocation mode toggle */
.age-mode-toggle { display: inline-flex; border: 1px solid var(--line-dk); border-radius: 4px; overflow: hidden; margin: 0 0 12px; }
.age-mode {
  font-family: "Cinzel", serif; font-size: 11px; letter-spacing: 1px; cursor: pointer;
  background: var(--field-bg); color: var(--ink-soft); border: none; padding: 6px 16px;
}
.age-mode + .age-mode { border-left: 1px solid var(--line-dk); }
.age-mode.active { background: var(--accent); color: #fff; }

/* age allocation pie */
.age-pie-row { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.age-pie { flex: 0 0 auto; }
.age-grid {
  flex: 1 1 240px; min-width: 240px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 14px; align-content: center;
}
.age-gcell {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--field-bg);
}
.age-gcell.changed { border-color: var(--line-dk); }
.age-gname { display: flex; align-items: center; gap: 7px; min-width: 0; }
.age-gname strong { font-family: "Cinzel", serif; letter-spacing: 1px; }
.age-gright { display: flex; align-items: center; gap: 8px; }
.age-delta { font-family: "Special Elite", monospace; font-size: 13px; line-height: 1; }
.age-delta.neg { color: var(--accent); }
.age-delta.pos { color: var(--green); }
.age-gval { font-family: "Special Elite", monospace; font-weight: bold; font-size: 18px; }
.age-gcell:not(.changed) .age-gval { color: var(--ink-soft); }
@media (max-width: 560px) {
  .age-pie-row { justify-content: center; }
  .age-grid { min-width: 0; width: 100%; gap: 6px 8px; }
  .age-gcell { padding: 5px 7px; gap: 5px; }
  .age-gname { gap: 5px; }
  .age-gright { gap: 5px; }
  .age-gval { font-size: 15px; }
  .age-delta { font-size: 11px; }
}
.pie-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.pie-svg { width: 200px; height: 200px; flex: 0 0 auto; overflow: visible; touch-action: none; -webkit-user-select: none; user-select: none; }
.pie-label { font-family: "Cinzel", serif; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; }
.pie-handle { cursor: grab; }
.pie-handle:active, .pie-handle.active { cursor: grabbing; }
.pie-handle.active { fill: var(--accent); }
.pie-center-num { font-family: "Special Elite", monospace; font-size: 22px; fill: var(--accent); }
.pie-center-lbl { font-family: "Cinzel", serif; font-size: 9px; letter-spacing: 1.5px; fill: var(--ink-soft); }
.pie-legend { display: flex; flex-direction: column; gap: 9px; }
.pie-leg { display: flex; align-items: center; gap: 9px; font-family: "Special Elite", monospace; font-size: 16px; }
.pie-swatch { width: 15px; height: 15px; border-radius: 3px; flex: 0 0 auto; border: 1px solid rgba(0,0,0,0.2); }
.pie-leg b { color: var(--accent); }
.pie-leg-tot { color: var(--ink-soft); }
.split-status { margin-top: 10px; font-size: 14px; }
.prev-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.prev-chip {
  font-family: "Special Elite", monospace; font-size: 12px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 3px; padding: 3px 8px;
}
.prev-chip b { color: var(--accent); }

/* ---- Occupations ---- */
/* descriptor traits in the occupation prompt */
.trait { white-space: nowrap; font-weight: 600; font-style: normal; }
.trait i { font-size: 1.05em; vertical-align: -0.15em; margin-right: 3px; }
.trait.pos { color: var(--green); }
.trait.neg { color: var(--accent); }

/* occupation view tabs + wealth filter */
.occ-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.occ-title-row h2 { margin: 0; }
.occ-controls {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin: 4px 0 10px;
}
.occ-tabs { display: inline-flex; border: 1px solid var(--line-dk); border-radius: 4px; overflow: hidden; }
.occ-tab {
  font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 1px; cursor: pointer;
  background: var(--field-bg); color: var(--ink-soft); border: none; padding: 8px 16px;
  transition: background 0.15s, color 0.15s;
}
.occ-tab + .occ-tab { border-left: 1px solid var(--line-dk); }
.occ-tab:hover { color: var(--ink); }
.occ-tab.active { background: var(--accent); color: #fff; }
.occ-wealth { display: inline-flex; align-items: center; gap: 8px; }
.wealth-row { display: inline-flex; align-items: center; gap: 8px; }
/* On mobile the controls stack; left-align both pill groups (label above). */
@media (max-width: 620px) {
  .occ-controls { flex-direction: column; align-items: flex-start; gap: 10px; }
  .occ-wealth { flex-direction: column; align-items: flex-start; gap: 5px; }
}
.wealth-label {
  font-family: "Cinzel", serif; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--ink-soft);
}
.wealth-group { display: inline-flex; border: 1px solid var(--line-dk); border-radius: 4px; overflow: hidden; }
.wealth-btn {
  font-family: "Special Elite", monospace; font-size: 14px; color: var(--green);
  background: var(--field-bg); border: none; padding: 7px 11px; cursor: pointer; transition: all 0.15s;
}
.wealth-btn + .wealth-btn { border-left: 1px solid var(--line-dk); }
.wealth-btn:hover { background: #ece2c8; }
.wealth-btn.active { background: var(--green); color: #fff; }
.ghost-btn.tiny-btn { padding: 5px 12px; font-size: 11px; }
.wealth-clear.hidden { visibility: hidden; }

/* ghost buttons sitting on the light card need dark, legible text */
#open-skill-modal,
.wealth-clear,
#occ-clear {
  color: var(--accent); border-color: var(--accent); background: var(--field-bg);
}
#open-skill-modal:hover:not(:disabled),
.wealth-clear:hover:not(:disabled),
#occ-clear:hover:not(:disabled) {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
#open-skill-modal { margin-top: 4px; font-weight: 700; }

.stat-tok-i { font-size: 1.05em; vertical-align: -0.13em; margin-right: 2px; }

.occ-group-head {
  font-family: "Cinzel", serif; font-size: 14px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--accent); margin: 20px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 5px;
}
.occ-group-head:first-of-type { margin-top: 6px; }
.occ-group-sub {
  font-family: "EB Garamond", serif; text-transform: none; letter-spacing: 0;
  font-style: italic; color: var(--ink-soft); font-size: 12px;
}
/* On mobile drop the calculation onto its own line below the point total. */
@media (max-width: 620px) { .occ-group-sub { display: block; margin-top: 3px; } }
.occ-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0; }
@media (max-width: 620px) { .occ-grid { grid-template-columns: 1fr; } }
.occ-card {
  text-align: left; cursor: pointer; background: var(--field-bg);
  border: 1.5px solid var(--line-dk); border-radius: 4px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 5px; transition: all 0.15s;
}
.occ-card:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.occ-card.active { border-color: var(--accent); background: #fbeee6; box-shadow: 0 0 0 2px rgba(124,31,31,0.18); }
.occ-name { font-family: "Cinzel", serif; font-weight: 700; font-size: 16px; color: var(--accent); display: flex; align-items: center; gap: 7px; }
.occ-icon { font-size: 19px; flex: 0 0 auto; }
.occ-blurb { font-size: 14px; color: var(--ink-soft); }
.occ-meta { font-family: "Special Elite", monospace; font-size: 11px; color: var(--line-dk); letter-spacing: 0.5px; }
/* custom profession card */
.occ-create {
  display: flex; flex-direction: column; gap: 5px; width: 100%; text-align: left; cursor: pointer;
  background: repeating-linear-gradient(45deg, var(--field-bg) 0 11px, #f7f1e3 11px 22px);
  border: 1.5px dashed var(--accent); border-radius: 4px; padding: 14px 16px; margin: 18px 0 6px;
  transition: all 0.15s;
}
.occ-create:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.occ-custom-wrap { position: relative; margin: 18px 0 6px; }
.occ-custom-wrap .occ-card { width: 100%; border-style: solid; border-color: var(--accent); }
.occ-edit-custom {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: var(--field-bg); border: 1px solid var(--accent); color: var(--accent);
  border-radius: 3px; cursor: pointer; font-size: 14px; line-height: 1; padding: 4px 8px;
}
.occ-edit-custom:hover { background: var(--accent); color: #fff; }

/* custom profession modal fields */
.modal-custom .modal-body { padding-top: 8px; }
.cf-field { display: block; margin-bottom: 14px; }
.cf-label {
  display: block; font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-soft); margin: 14px 0 7px;
}
.modal-custom .modal-body > .cf-field:first-child .cf-label { margin-top: 0; }
.cf-sub {
  text-transform: none; letter-spacing: 0; font-family: "EB Garamond", serif;
  font-style: italic; color: var(--ink-soft); font-size: 13px; margin: -3px 0 9px;
}
.cf-count { float: right; text-transform: none; letter-spacing: 0; font-family: "Special Elite", monospace; }
.cf-count.good { color: var(--green); }
.cf-count.warn { color: var(--accent); }
.cf-formulas { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
@media (max-width: 560px) { .cf-formulas { grid-template-columns: 1fr; } }
.cf-formula {
  display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer;
  background: var(--field-bg); border: 1px solid var(--line-dk);
  border-radius: 4px; padding: 8px 11px; transition: all 0.12s;
}
.cf-formula:hover { border-color: var(--accent-2); }
.cf-formula.active { background: #fbeee6; border-color: var(--accent); box-shadow: 0 0 0 1px rgba(124,31,31,0.2); }
.cf-f-title { font-family: "Cinzel", serif; font-weight: 700; font-size: 14px; letter-spacing: 0.5px; color: var(--accent); }
.cf-f-sub { font-size: 12px; color: var(--ink-soft); }
.cf-f-sub b { font-family: "Special Elite", monospace; color: var(--accent); font-size: 13px; }
.cf-credit { display: flex; align-items: center; gap: 10px; font-family: "Cinzel", serif; font-size: 13px; }

/* occupation review modal facts + shared footer status */
.occm-facts {
  display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 6px;
  font-size: 14px; color: var(--ink-soft);
}
.occm-facts span:first-child { color: var(--ink); }
.occm-facts b { font-family: "Special Elite", monospace; color: var(--accent); font-size: 15px; margin-right: 3px; }
.modal-custom .modal-foot, .modal-occ .modal-foot { justify-content: space-between; align-items: center; gap: 14px; }
.modal-foot-btns { display: flex; gap: 10px; }
.modal-status { flex: 1; font-size: 13px; font-style: italic; color: var(--accent); }

.occ-detail { margin-top: 18px; border-top: 2px solid var(--line); padding-top: 16px; }
.occ-stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.occ-stat {
  flex: 1; min-width: 150px; text-align: center; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.occ-stat .big { font-family: "Special Elite", monospace; font-size: 28px; color: var(--accent); }
.occ-stat span { font-size: 13px; }
.occ-stat em { font-size: 11px; color: var(--ink-soft); font-family: "Special Elite", monospace; }
.occ-skills-label { font-family: "Cinzel", serif; font-size: 13px; letter-spacing: 1px; margin-bottom: 8px; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.skill-chip {
  font-size: 13px; padding: 4px 11px; border-radius: 20px;
  background: var(--paper-2); border: 1px solid var(--line-dk);
}
.skill-chip.fixed { border-style: solid; }
.skill-chip.chosen { background: var(--accent); color: #fff; border-color: #5a1414; cursor: pointer; }
.skill-chip.chosen:hover { filter: brightness(1.15); }

/* ---- Skills table ---- */
/* One sticky bar at the top: skill description (left, most of the width) +
   points-left budget box (right). */
.skills-topbar {
  position: sticky; top: 0; z-index: 12;
  display: flex; align-items: stretch; gap: 14px;
  /* Opaque so scrolling skill rows don't show through behind it. */
  background: var(--paper); padding: 8px 0 10px; margin: 4px 0 10px;
  box-shadow: 0 6px 10px -6px rgba(0, 0, 0, 0.35);
}
.topbar-budget { flex: 0 0 240px; display: flex; }
.topbar-budget .budget-box { flex: 1; min-width: 0; }

.budget-box {
  position: relative; background: var(--paper-2);
  border: 1.5px solid var(--line-dk); border-radius: 5px; padding: 10px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.budget-box.good { border-color: var(--green); }
.budget-box.over { border-color: var(--accent); background: #f6ddd6; }
.budget-num { font-family: "Special Elite", monospace; font-size: 22px; }
.budget-num b { color: var(--accent); font-size: 26px; }
.budget-box.good .budget-num b { color: var(--green); }
.budget-ast { color: var(--accent); font-size: 0.55em; font-weight: bold; vertical-align: super; margin-left: 1px; }
.budget-label { font-size: 12px; font-family: "Cinzel", serif; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); }
.budget-note-in {
  display: block; margin-top: 5px; text-align: center;
  font-size: 11px; line-height: 1.25; font-style: italic; color: var(--ink-soft);
}

/* Credit Rating's own section on the occupation step (flavor above the
   slider, like the characteristics page; wealth table right below it). */
.credit-flavor { margin: 0 4px 8px; font-size: 14px; font-style: italic; color: var(--ink-soft); line-height: 1.45; }
.credit-flavor .cr-tier {
  font-style: normal; color: var(--accent); font-family: "Cinzel", serif;
  font-size: 12.5px; letter-spacing: 0.5px; text-transform: uppercase;
}

/* Wealth table (Spending Level / Cash / Assets) under the Credit Rating slider. */
.wealth-wrap { margin: 8px 4px 6px; }
/* A solid card behind the wealth tables so they read clearly on the parchment. */
.calc-table.wealth-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--field-bg); border: 1px solid var(--line-dk); border-radius: 5px;
  box-shadow: 0 1px 4px rgba(28, 26, 23, 0.14);
}
.calc-table.wealth-table th:not(:first-child), .calc-table.wealth-table td:not(:first-child) { width: auto; }
.wealth-table th {
  background: var(--paper-2); border-bottom: 1px solid var(--line-dk);
  color: var(--ink); font-size: 9.5px; padding-top: 5px; padding-bottom: 4px;
}
.wealth-table thead th:first-child { border-top-left-radius: 4px; }
.wealth-table thead th:last-child { border-top-right-radius: 4px; }
/* Mini: a single centred three-cell row (no Wealth column). Its modern-day
   "≈ today" lines stay tucked away until the table is expanded. */
.wealth-table.wealth-mini th, .wealth-table.wealth-mini td { text-align: center; width: 33.3%; }
.wealth-mini .w-mod {
  max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease;
}
.wealth-open .wealth-mini .w-mod { max-height: 20px; opacity: 1; }
/* Per-column explanations: fold open beneath the values while expanded. */
.w-desc td { padding: 0; border-bottom: none; vertical-align: top; }
.w-desc-i {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows 0.35s ease, opacity 0.3s ease;
}
.w-desc-i > span {
  overflow: hidden; min-height: 0;
  font-family: "EB Garamond", serif; font-style: italic; font-size: 12px;
  color: var(--ink-soft); line-height: 1.35; padding: 0 10px;
  transition: padding 0.35s ease;
}
.wealth-open .w-desc-i { grid-template-rows: 1fr; opacity: 1; }
.wealth-open .w-desc-i > span { padding: 5px 10px 7px; }
/* The full table grows/shrinks under the mini one. */
.wealth-full {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows 0.35s ease, opacity 0.3s ease, margin-top 0.35s ease;
  margin-top: 0;
}
.wealth-open .wealth-full { grid-template-rows: 1fr; opacity: 1; margin-top: 10px; }
.wealth-full-inner { overflow: hidden; min-height: 0; }
.wealth-table td { vertical-align: top; }
.wealth-table .w-era { display: block; font-size: 13.5px; }
.wealth-table .w-mod { display: block; font-size: 10.5px; font-style: italic; color: var(--ink-soft); }
.wealth-table .w-tier b { font-family: "Cinzel", serif; font-size: 11.5px; letter-spacing: 0.4px; }
.wealth-table .w-range { display: block; font-size: 10.5px; color: var(--ink-soft); font-family: "Special Elite", monospace; }
.wealth-table tr.hit .w-mod, .wealth-table tr.hit .w-range { color: rgba(124, 31, 31, 0.7); }
.wealth-table tr[data-wealth-toggle] { cursor: pointer; }
.wealth-table tr[data-wealth-toggle]:hover td { background: rgba(124, 31, 31, 0.05); }
.wealth-table tr.hit[data-wealth-toggle]:hover td { background: rgba(124, 31, 31, 0.13); }
.w-toggle td { padding: 0; border-bottom: none; }
.w-toggle-btn {
  display: block; width: 100%; padding: 5px 0; border: none; background: none; cursor: pointer;
  font-family: "EB Garamond", serif; font-size: 12px; font-style: italic; color: var(--ink-soft);
  text-align: center;
}
.w-toggle-btn:hover { color: var(--accent); }

/* Skill description, left side of the top bar (mirrors the modal info panel). */
.skill-info-panel {
  flex: 1 1 auto; min-width: 0; align-self: stretch;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px;
  /* Room for all three lines (title + explanation + example) so the bar
     doesn't grow when a skill is picked. */
  padding: 10px 12px; min-height: 96px; box-sizing: border-box;
}

/* per-category "+ Parent (Other)" specialization buttons inside the skills table */
.skill-add-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px dotted var(--line); }
.sk-remove {
  margin-left: 6px; border: none; background: none; cursor: pointer; padding: 0 4px;
  color: var(--ink-soft); font-size: 16px; line-height: 1; vertical-align: -1px;
}
.sk-remove:hover { color: var(--accent); }

/* skill allocation as slider rows (mirrors the characteristics point-buy) */
.skill-srow { display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-bottom: 1px dotted var(--line); }
.skill-srow:nth-child(odd) { background: rgba(255, 255, 255, 0.25); }
.skill-srow[data-row] { cursor: pointer; }
.skill-srow[data-row]:hover { background: #f3e7d0; }
.skill-srow.selected { background: #fbeee6; box-shadow: inset 3px 0 0 var(--accent); }
.skill-sname { flex: 0 0 150px; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.skill-snm { font-size: 14px; display: flex; align-items: center; }
.skill-ssub { font-size: 11px; color: var(--ink-soft); font-family: "Special Elite", monospace; }
.skill-swrap { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.skill-swrap .pb-slider { flex: 1; min-width: 70px; }
.skill-sval { font-family: "Special Elite", monospace; font-weight: bold; color: var(--accent); min-width: 46px; text-align: right; }
.skill-srow.locked .skill-swrap { justify-content: flex-end; }
.skill-srow.locked .skill-sval { color: var(--ink-soft); }
.gold-word { color: #8a6a16; font-weight: 600; }
@media (max-width: 560px) {
  .skill-sname { flex-basis: 108px; }
  .skill-snm { font-size: 13px; }
  .skill-swrap { gap: 8px; }
}

.skill-table { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.skill-row {
  display: grid; grid-template-columns: 1fr 56px 64px 64px 64px;
  align-items: center; gap: 8px; padding: 6px 12px;
  border-bottom: 1px dotted var(--line);
}
/* "All other skills" has no Occupation column — one fewer track. */
.skill-table.no-occ .skill-row { grid-template-columns: 1fr 56px 64px 64px; }
/* Occupation-points step: Skill | Base | Occ | Total (no Pers). */
.skill-table.occ-only .skill-row { grid-template-columns: 1fr 56px 64px 64px; }
.skill-row:nth-child(odd) { background: rgba(255,255,255,0.25); }
.skill-row.head {
  background: var(--ink); color: var(--parch);
  font-family: "Cinzel", serif; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
}
.skill-row.head span { text-align: center; }
.skill-row.head span:first-child { text-align: left; }
.skill-row.credit { background: #f6efdb; }
.skill-row[data-row] { cursor: pointer; }
.skill-row[data-row]:hover { background: #f3e7d0; }
.skill-row.selected { background: #fbeee6; box-shadow: inset 3px 0 0 var(--accent); }
.skill-row.cat {
  display: block; background: var(--paper-2);
  font-family: "Cinzel", serif; font-size: 11px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--accent);
  padding: 5px 12px; border-bottom: 1px solid var(--line-dk);
}
.skill-row.cat:nth-child(odd) { background: var(--paper-2); }
.sk-name { font-size: 15px; }
.sk-i { font-size: 1.05em; vertical-align: -0.15em; margin-right: 6px; color: var(--ink-soft); }
.modal-skill .sk-i, .mi-name .sk-i { color: inherit; }
.sk-name .range, .sk-name .lock { font-size: 11px; color: var(--ink-soft); font-style: italic; }
.sk-base { text-align: center; color: var(--ink-soft); font-family: "Special Elite", monospace; font-size: 13px; }
.sk-cell { text-align: center; }
/* read-only occupation-points value shown on the personal step */
.sk-cell.sk-ro { font-family: "Special Elite", monospace; font-size: 13px; color: var(--ink-soft); }
.pts {
  width: 56px; text-align: center; background: var(--field-bg);
  border: 1px solid var(--line-dk); border-radius: 3px; padding: 4px; font-size: 15px;
  font-family: "Special Elite", monospace;
}
.pts:focus { outline: none; border-color: var(--accent); }
.sk-total { text-align: center; font-family: "Special Elite", monospace; font-weight: bold; color: var(--accent); }
.other-skills summary { cursor: pointer; list-style: none; }
.other-skills summary::-webkit-details-marker { display: none; }
.other-skills summary::before { content: "▸ "; color: var(--accent); }
.other-skills[open] summary::before { content: "▾ "; }

/* ---- Skills page on mobile: slim top bar + two-line skill rows ---- */
@media (max-width: 560px) {
  /* Stack the bar: description on top, a slim points strip beneath. */
  .skills-topbar { flex-direction: column; gap: 8px; padding: 6px 0 8px; }
  .topbar-budget { flex: 0 0 auto; }
  .skill-info-panel { min-height: 0; }
  .budget-box { min-width: 0; padding: 6px 10px; }
  .budget-num { font-size: 16px; }
  .budget-num b { font-size: 19px; }
  .budget-label { font-size: 9px; letter-spacing: 0.5px; line-height: 1.2; text-align: center; }
  .bl-suffix { display: none; } /* "Occupation" / "Personal Interest" — the ratio shows it's points */

  /* Two lines per skill: name + total on top, base + the inputs beneath. */
  .skill-table .skill-row[data-row],
  .skill-table .skill-row.head {
    grid-template-columns: auto auto auto 1fr auto;
    grid-template-areas:
      "name name name name total"
      "base occ  pers  .    total";
    column-gap: 10px; row-gap: 4px; padding: 8px 11px;
  }
  .skill-table.no-occ .skill-row[data-row],
  .skill-table.no-occ .skill-row.head {
    grid-template-columns: auto auto 1fr auto;
    grid-template-areas:
      "name name name total"
      "base pers .    total";
  }
  .skill-table.occ-only .skill-row[data-row],
  .skill-table.occ-only .skill-row.head {
    grid-template-columns: auto auto 1fr auto;
    grid-template-areas:
      "name name name total"
      "base occ  .    total";
  }
  .skill-row .sk-name { grid-area: name; font-size: 14px; }
  .skill-row .sk-base { grid-area: base; font-size: 12px; }
  .skill-row .sk-occ { grid-area: occ; }
  .skill-row .sk-pers { grid-area: pers; }
  .skill-row .sk-total { grid-area: total; align-self: center; font-size: 15px; }
  .skill-row.head { font-size: 9px; letter-spacing: 0.4px; }
  .sk-i { margin-right: 4px; }
  .pts { width: 50px; padding: 4px 2px; font-size: 14px; }
}

/* ---- Background ---- */
.bg-field { grid-column: span 1; }

/* ============================================================
   PASSPORT (identity / name step)
   ============================================================ */
.passport-caption {
  text-align: center; color: var(--accent-2); font-style: italic;
  font-size: 16px; margin: 4px 0 18px;
}
.passport {
  position: relative;
  max-width: 600px; margin: 0 auto;
  background:
    repeating-linear-gradient(115deg, rgba(124,31,31,0.05) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(65deg, rgba(47,93,58,0.045) 0 1px, transparent 1px 9px),
    radial-gradient(circle at 30% 20%, #f7efda, #ece0c2 80%);
  border: 2px solid var(--line-dk);
  border-radius: 6px;
  padding: 18px 22px 22px;
  box-shadow: 0 16px 50px var(--shadow), inset 0 0 0 1px rgba(255,255,255,0.5),
    inset 0 0 60px rgba(168,149,107,0.25);
  overflow: hidden;
}
.passport::before {
  content: ""; position: absolute; inset: 8px;
  border: 1.5px double var(--line-dk); border-radius: 4px; pointer-events: none;
}
.pp-head {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  border-bottom: 2px solid var(--line-dk); padding-bottom: 12px; margin-bottom: 16px;
  position: relative; z-index: 1;
}
.pp-eagle { color: var(--accent); font-size: 22px; }
.pp-headtext { text-align: center; }
.pp-country {
  font-family: "Cinzel", serif; font-weight: 700; letter-spacing: 2px;
  color: var(--accent); font-size: 18px;
}
.pp-doc {
  font-family: "Special Elite", monospace; letter-spacing: 3px;
  font-size: 11px; color: var(--ink-soft); text-transform: uppercase; margin-top: 3px;
}
.pp-body { display: flex; gap: 20px; position: relative; z-index: 1; }
.pp-photo {
  flex: 0 0 116px; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.pp-silhouette {
  width: 116px; height: 140px;
  background: repeating-linear-gradient(45deg, #e3d7b8 0 3px, #dccfac 3px 6px);
  border: 1px solid var(--line-dk); border-radius: 3px; padding: 8px;
  fill: #8d8164;
}
.pp-photo-cap {
  font-family: "Special Elite", monospace; font-size: 10px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--ink-soft);
}
.pp-fields { flex: 1; min-width: 0; }
.pp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-top: 12px; }
.pp-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pp-name-field { margin-bottom: 4px; }
.pp-label {
  font-family: "Special Elite", monospace; font-size: 9.5px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink-soft);
}
.ink { color: var(--ink-blue); }
.pp-val {
  font-family: "Caveat", cursive; font-size: 24px; line-height: 1.1;
  border-bottom: 1px dotted var(--line-dk); padding-bottom: 1px;
}
.pp-input {
  font-family: "Caveat", cursive; color: var(--ink-blue);
  background: transparent; border: none;
  border-bottom: 1.5px solid var(--line-dk);
  font-size: 34px; line-height: 1.05; padding: 0 2px 2px; width: 100%;
}
.pp-input.small { font-size: 24px; border-bottom-style: dotted; border-bottom-width: 1px; }
.pp-input::placeholder { color: rgba(32,48,95,0.32); font-style: italic; }
.pp-input:focus {
  outline: none; border-bottom-color: var(--accent);
  background: rgba(124,31,31,0.04);
}
.pp-foot {
  display: flex; align-items: flex-end; gap: 14px;
  border-top: 2px solid var(--line-dk); margin-top: 16px; padding-top: 12px;
  position: relative; z-index: 1;
}
.pp-foot .pp-label { padding-bottom: 8px; }
/* The printed name up top fills in as the bearer signs below. */
.pp-name-val { min-height: 28px; }
/* The signature is where the player actually types — true cursive, distinct
   from the passport's typed/inked Caveat lettering. The ruled line is drawn
   behind the script so the pen rides it like a real signature: baseline on
   the rule, descenders and swashes bleeding past it, with a slight tilt of
   the hand. */
.pp-sigline { flex: 1; position: relative; height: 48px; min-width: 0; }
.pp-sigline::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 13px;
  border-bottom: 1px solid var(--line);
}
.pp-sigline:focus-within::after { border-bottom-color: var(--accent); }
.pp-signature {
  font-family: "Great Vibes", cursive; font-size: 38px; line-height: 1;
  position: absolute; left: 8px; bottom: 1px; width: calc(100% - 8px);
  white-space: nowrap; overflow: visible;
  transform: rotate(-2deg); transform-origin: left bottom;
  text-shadow: 0 0 0.5px currentColor; /* a touch of ink bleed */
  background: transparent; border: none; padding: 0;
}
.pp-signature:focus { outline: none; }
.pp-signature::placeholder { color: rgba(32,48,95,0.32); }
.pp-stamp {
  position: absolute; right: 16px; bottom: 64px; z-index: 2;
  font-family: "Special Elite", monospace; font-size: 11px; line-height: 1.25;
  text-align: center; color: rgba(124,31,31,0.65);
  border: 2px solid rgba(124,31,31,0.55); border-radius: 50%;
  width: 92px; height: 92px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  transform: rotate(-14deg); letter-spacing: 1px;
  box-shadow: inset 0 0 0 3px rgba(124,31,31,0.12);
  mix-blend-mode: multiply; pointer-events: none;
}
.pp-stamp b { font-size: 12px; }
@media (max-width: 560px) {
  .pp-body { flex-direction: column; align-items: center; }
  .pp-grid { grid-template-columns: 1fr; }
  .pp-stamp { bottom: 14px; right: 10px; }
}


/* ============================================================
   MODAL (occupation skill picker)
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(20, 18, 15, 0.66);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  animation: fade 0.2s ease;
}
.modal {
  background: var(--paper); border: 1px solid var(--line-dk); border-radius: 6px;
  width: min(680px, 100%); max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.modal-head { padding: 18px 22px 14px; border-bottom: 2px solid var(--line); }
.modal-head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-info {
  margin: 12px 0 18px; background: var(--paper-2); border: 1px solid var(--line);
  /* Reserve room for all three lines (title + explanation + example) so the
     panel doesn't grow when a skill is picked. */
  border-radius: 4px; padding: 10px 12px; min-height: 96px;
}
.mi-name {
  font-family: "Cinzel", serif; font-size: 13px; letter-spacing: 0.5px;
  color: var(--accent); margin-bottom: 3px;
}
.mi-what { font-size: 14px; color: var(--ink); line-height: 1.4; }
.mi-eg { display: block; margin-top: 5px; font-size: 14px; color: var(--ink-soft); font-style: italic; line-height: 1.4; }
.mi-eg b { font-style: normal; }
.modal-head h3 {
  font-family: "Cinzel", serif; color: var(--accent); margin: 0; font-size: 20px; letter-spacing: 0.5px;
}
.modal-sub { font-size: 14px; color: var(--ink-soft); margin-top: 4px; }
.modal-sub .good { color: var(--green); font-weight: 600; }
.modal-sub .warn { color: var(--accent); font-weight: 600; }
.modal-close {
  background: none; border: none; font-size: 28px; line-height: 1; cursor: pointer;
  color: var(--ink-soft); padding: 0 4px;
}
.modal-close:hover { color: var(--accent); }
.modal-body { overflow-y: auto; overscroll-behavior: contain; padding: 14px 22px; }

/* Occupation modal: one scroll region so the profession facts scroll away and
   the skill-details panel sticks to the top once you pass it. */
.modal-occ { position: relative; }
.modal-occ .modal-close {
  position: absolute; top: 8px; right: 10px; z-index: 4;
  background: var(--paper); border-radius: 50%; width: 32px; height: 32px;
}
.occm-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.occm-head { padding: 18px 22px 12px; }
.occm-head h3 {
  font-family: "Cinzel", serif; color: var(--accent); margin: 0;
  font-size: 20px; letter-spacing: 0.5px; padding-right: 30px;
}
.occm-info-bar {
  position: sticky; top: 0; z-index: 2;
  background: var(--paper); padding: 8px 22px 10px;
  box-shadow: 0 6px 10px -6px rgba(0, 0, 0, 0.35);
}
.occm-info-bar .modal-info { margin: 0; }
.modal-occ .modal-body { overflow: visible; }
.modal-cat { margin-bottom: 14px; }
.modal-cat-head {
  font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 7px; border-bottom: 1px solid var(--line); padding-bottom: 4px;
}
.modal-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.modal-skill {
  font-family: "EB Garamond", serif; font-size: 14px; padding: 6px 12px;
  border: 1px solid var(--line-dk); border-radius: 20px; background: var(--field-bg);
  cursor: pointer; transition: all 0.12s; color: var(--ink);
}
.modal-skill:hover:not(:disabled) { border-color: var(--accent-2); transform: translateY(-1px); }
.modal-skill.chosen { background: var(--accent); color: #fff; border-color: #5a1414; }
.modal-skill.included { background: var(--paper-2); color: var(--ink-soft); }
.modal-skill.included em { font-style: italic; font-size: 11px; opacity: 0.8; }
.modal-skill.maxed { opacity: 0.4; } /* can't be added now, but still readable */
.modal-skill.focused { box-shadow: 0 0 0 2px var(--accent-2); border-color: var(--accent-2); }
/* "(Other)" specialization chips read as actions, not picks */
.modal-skill.add-other-chip { border-style: dashed; color: var(--ink-soft); background: transparent; }
.modal-skill.add-other-chip:hover { color: var(--accent); border-color: var(--accent); transform: none; }
/* in-chip delete for custom skills in the pickers (chip is always "chosen") */
.chip-del { margin-left: 8px; padding: 0 2px; font-weight: bold; opacity: 0.7; cursor: pointer; }
.chip-del:hover { opacity: 1; }
.modal-foot {
  padding: 12px 22px 18px; border-top: 2px solid var(--line);
  display: flex; justify-content: flex-end;
}
@media print { .modal-overlay { display: none !important; } }

/* themed confirm dialog */
.modal-confirm {
  width: min(420px, 100%); max-height: none; display: block; padding: 24px 26px;
}
.confirm-body { font-size: 17px; color: var(--ink); line-height: 1.5; margin-bottom: 22px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================
   LANGUAGE PICKER
   ============================================================ */
/* The language chip occupies the skill name cell's second line (where the
   "base %" subtext sits on other rows), so language rows stay aligned. */
.skill-sline2 { display: flex; align-items: center; min-height: 15px; min-width: 0; }
.lang-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 2px 9px; border-radius: 999px; cursor: pointer;
  font-family: "EB Garamond", serif; font-size: 12.5px; line-height: 1.2;
  border: 1px solid var(--line-dk); background: var(--field-bg); color: var(--ink);
  transition: border-color 0.12s, background 0.12s;
}
.lang-chip:hover { border-color: var(--accent-2); }
.lang-chip .lang-flag { font-size: 14px; line-height: 1; flex: 0 0 auto; }
.lang-chip i.lang-flag.glyph { color: var(--ink-soft); }
.lang-chip .lang-chip-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-chip.set { background: var(--paper-2); }
/* Unset language with points riding on it — draw the eye and pulse gently. */
.lang-chip.needs {
  background: var(--accent); color: #fff; border-color: #5a1414; font-weight: 600;
  box-shadow: 0 0 0 0 rgba(124, 31, 31, 0.5); animation: langPulse 1.8s ease-in-out infinite;
}
.lang-chip.needs i { color: #fff; }
@keyframes langPulse {
  0% { box-shadow: 0 0 0 0 rgba(124, 31, 31, 0.45); }
  60% { box-shadow: 0 0 0 7px rgba(124, 31, 31, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 31, 31, 0); }
}
.skill-srow.lang-needs { background: rgba(124, 31, 31, 0.06); box-shadow: inset 3px 0 0 var(--accent); }

/* The modal. */
.lang-modal { width: min(760px, 100%); padding: 20px 24px 18px; }
.lang-title { font-family: "Cinzel", serif; color: var(--accent); margin: 0; font-size: 20px; letter-spacing: 0.5px; }
.lang-lede { font-size: 14px; color: var(--ink-soft); margin: 6px 0 14px; line-height: 1.45; }
.lang-cols { display: flex; gap: 16px; flex: 1; min-height: 0; }
.lang-list {
  flex: 0 0 246px; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: 5px; background: var(--field-bg); padding: 6px;
}
.lang-group-h {
  font-family: "Cinzel", serif; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--accent); margin: 10px 6px 4px; border-bottom: 1px solid var(--line); padding-bottom: 3px;
}
.lang-group-h:first-child { margin-top: 2px; }
.lang-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 7px 9px; border: 1px solid transparent; border-radius: 4px; background: none; cursor: pointer;
  font-family: "EB Garamond", serif; font-size: 15px; color: var(--ink); transition: background 0.1s;
}
.lang-item:hover { background: var(--paper-2); }
.lang-item.taken { opacity: 0.45; cursor: not-allowed; }
.lang-item.taken:hover { background: none; }
.lang-taken-tag {
  margin-left: auto; flex: 0 0 auto; font-size: 10px; letter-spacing: 0.5px;
  text-transform: uppercase; font-style: italic; color: var(--ink-soft);
}
.lang-dup-msg { margin: 8px 0 0; font-size: 13px; color: var(--accent); font-style: italic; }
.lang-item.sel { background: var(--accent); color: #fff; }
.lang-item.sel i.lang-flag.glyph { color: #fff; }
.lang-item .lang-flag { font-size: 18px; line-height: 1; width: 22px; text-align: center; flex: 0 0 auto; }
.lang-item i.lang-flag.glyph { color: var(--ink-soft); }
.lang-item-lbl { flex: 1; }

.lang-detail {
  flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: 5px; background: var(--paper-2);
}
.lang-detail-empty { padding: 28px 22px; color: var(--ink-soft); font-style: italic; text-align: center; }
.lang-detail-pad { padding: 16px 18px; }
.lang-d-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.lang-d-flag { font-size: 34px; line-height: 1; }
i.lang-d-flag.glyph { font-size: 30px; color: var(--ink-soft); }
.lang-d-name { font-family: "Cinzel", serif; font-size: 19px; color: var(--accent); }
.lang-d-speak { font-style: italic; color: var(--ink-soft); font-size: 14px; margin: 0 0 10px; line-height: 1.4; }
.lang-regions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.lang-region {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: var(--field-bg); border: 1px solid var(--line); color: var(--ink-soft);
}
.lang-d-why { font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink); margin-bottom: 6px; }
.lang-reasons { margin: 0 0 12px; padding-left: 20px; }
.lang-reasons li { font-size: 14px; color: var(--ink); line-height: 1.5; margin-bottom: 5px; }
.lang-d-note { font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; border-top: 1px solid var(--line); padding-top: 9px; margin: 0; }
.lang-custom-input { margin-top: 4px; }
.lang-modal .confirm-actions { margin-top: 14px; }

@media (max-width: 600px) {
  /* Give modals nearly the whole screen on phones. */
  .modal-overlay { padding: 8px; }
  .modal { max-height: 96vh; }
  .lang-cols { flex-direction: column; min-height: 0; }
  /* The list gets all the room; the flavor pane is desktop-only — except when
     "A different language…" is picked, since the name input lives there. */
  .lang-list { flex: 1 1 auto; max-height: none; min-height: 0; }
  .lang-detail { display: none; }
  .lang-detail.custom { display: block; flex: 0 0 auto; overflow: visible; }
  .lang-chip .lang-chip-lbl { display: none; }
}

/* ============================================================
   DOSSIER / SHEET
   ============================================================ */
.sheet {
  background: var(--parch);
  background-image: repeating-linear-gradient(0deg, rgba(0,0,0,0.012) 0 2px, transparent 2px 4px);
  border: 2px solid var(--line-dk); border-radius: 4px;
  padding: 30px 34px; box-shadow: 0 14px 50px var(--shadow);
  position: relative;
}
.sheet::before { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(168,149,107,0.45); pointer-events: none; }
.sheet-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  border-bottom: 3px double var(--line-dk); padding-bottom: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.sheet-name { font-family: "Cinzel", serif; font-weight: 700; font-size: 30px; color: var(--accent); letter-spacing: 1px; }
.sheet-idgrid {
  display: grid; grid-template-columns: repeat(3, auto); gap: 6px 26px;
  margin-top: 10px; justify-content: start;
}
@media (max-width: 560px) { .sheet-idgrid { grid-template-columns: 1fr 1fr; } }
.sid { display: flex; flex-direction: column; gap: 1px; }
.sid-label {
  font-family: "Cinzel", serif; font-size: 10.5px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--accent);
}
.sid-val { font-size: 15px; color: var(--ink); }
.sheet-vitals { display: flex; gap: 10px; }
.vital {
  text-align: center; background: var(--paper-2); border: 1px solid var(--line-dk);
  border-radius: 5px; padding: 8px 12px; min-width: 64px;
}
.vital-val { font-family: "Special Elite", monospace; font-size: 22px; color: var(--accent); }
.vital-label { font-family: "Cinzel", serif; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); }

.sheet-stats { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin-bottom: 16px; }
@media (max-width: 620px) { .sheet-stats { grid-template-columns: repeat(4, 1fr); } }
.stat-cell { text-align: center; background: var(--paper-2); border: 1px solid var(--line-dk); border-radius: 4px; padding: 8px 4px; }
.stat-key { font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 1px; color: var(--ink-soft); }
.stat-val { font-family: "Special Elite", monospace; font-size: 24px; color: var(--accent); line-height: 1.1; }
.stat-sub { font-size: 11px; color: var(--ink-soft); font-family: "Special Elite", monospace; }
.stat-weight { font-size: 10px; color: var(--ink-soft); font-family: "Special Elite", monospace; margin-top: 2px; }

.sheet-derived { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.dchip {
  display: flex; flex-direction: column; align-items: center;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px; padding: 6px 14px;
}
.dchip b { font-family: "Special Elite", monospace; font-size: 17px; color: var(--ink); }
.dchip-flavor { font-family: "EB Garamond", serif; font-weight: normal; font-style: italic; font-size: 12px; color: var(--ink-soft); text-transform: none; letter-spacing: 0; }
.dchip span { font-size: 11px; font-family: "Cinzel", serif; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); }

.sheet-section {
  font-family: "Cinzel", serif; font-size: 16px; letter-spacing: 1px; color: var(--accent);
  border-bottom: 2px solid var(--line); padding-bottom: 6px; margin: 22px 0 12px; text-transform: uppercase;
}
.sheet-section small { font-family: "EB Garamond", serif; text-transform: none; letter-spacing: 0; color: var(--ink-soft); font-size: 13px; }
/* Multi-column so the alphabetical list reads top-to-bottom down each column. */
.dsk-grid { columns: 3; column-gap: 18px; }
@media (max-width: 620px) { .dsk-grid { columns: 2; } }
.dsk {
  display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 8px;
  padding: 3px 0; border-bottom: 1px dotted var(--line); font-size: 14px;
  break-inside: avoid;
}
.dsk-name { color: var(--ink-soft); }
.dsk.imp .dsk-name { color: var(--ink); font-weight: 600; }
.dsk-flag { margin-right: 4px; }
.dsk.imp .dsk-val { color: var(--accent); }
.dsk-val { font-family: "Special Elite", monospace; font-weight: bold; }
.dsk-val small { font-size: 10px; }
.dsk-sub { font-family: "Special Elite", monospace; font-size: 10px; color: var(--ink-soft); }

/* ---- Gear & Possessions (top of the Story step) ---- */
.gear-card { margin-bottom: 18px; }
.gear-context { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.gear-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px;
  background: var(--paper-2); border: 1px solid var(--line-dk); border-radius: 999px;
  font-size: 14px; color: var(--ink);
}
.gear-chip i { color: var(--accent); font-size: 15px; }
.gear-lede { margin-bottom: 10px; }
.gear-lifestyle { font-style: italic; color: var(--ink-soft); font-size: 15.5px; margin: 0 0 12px; }
/* line-by-line inventory; weapons (mechanical impact) ride at the top */
.gear-list {
  list-style: none; margin: 0 0 16px; padding: 0;
  background: var(--field-bg); border: 1px solid var(--line-dk); border-radius: 4px;
  max-width: 560px;
}
.gear-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px 7px 12px; border-bottom: 1px dotted var(--line);
  font-size: 14.5px; color: var(--ink);
}
.gear-item:last-child { border-bottom: none; }
.gear-item-ico { font-size: 14px; color: var(--line-dk); flex: 0 0 auto; }
.gear-item.mech .gear-item-ico { color: var(--accent); }
.gear-item.weapon .gear-item-name { font-weight: 600; }
.gear-item-name { flex: 1; min-width: 0; }
.gear-item-stat {
  flex: 0 0 auto; font-family: "Special Elite", monospace; font-size: 11.5px;
  color: var(--accent); padding-right: 2px;
}
.gear-del {
  border: none; background: none; cursor: pointer; padding: 0 6px;
  font-size: 16px; line-height: 1; color: var(--ink-soft);
}
.gear-del:hover { color: var(--accent); }
.gear-empty { font-style: italic; color: var(--ink-soft); padding: 10px 14px; }
.gear-addrow { display: flex; gap: 8px; flex-wrap: wrap; }
.gear-add-input { flex: 1; min-width: 140px; }
.gear-weapon-btn i { font-size: 14px; margin-right: 4px; }

/* wealth strip: Wealth / Spending Level / Cash, resolved for this investigator */
.wealth-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 6px 0 14px;
}
@media (max-width: 640px) { .wealth-strip { grid-template-columns: 1fr; } }
.wbox {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--field-bg); border: 1px solid var(--line-dk); border-radius: 4px;
  padding: 10px 14px;
}
.wbox-label {
  font-family: "Cinzel", serif; font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--accent);
}
.wbox-val { font-family: "Special Elite", monospace; font-size: 21px; color: var(--ink); }
.wbox-sub { font-size: 12.5px; font-style: italic; color: var(--ink-soft); line-height: 1.35; }

/* On Hand / At Home columns */
.gear-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 640px) { .gear-cols { grid-template-columns: 1fr; } }
.gear-col .gear-list { max-width: none; }
.gear-col-home .gear-item { font-size: 13.5px; padding: 6px 6px 6px 10px; }
.gear-subhead {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-family: "Cinzel", serif; font-weight: 700; font-size: 15px; color: var(--accent);
  margin: 0 0 8px;
}
.gear-subhead i { font-size: 16px; align-self: center; }
.gear-subnote { font-family: "EB Garamond", serif; font-weight: 400; font-style: italic; font-size: 12.5px; color: var(--ink-soft); letter-spacing: 0; }

/* assets: total + an approximate estate */
.gear-assets { margin-top: 18px; border-top: 2px solid var(--line); padding-top: 12px; }
.assets-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-family: "Cinzel", serif; font-weight: 700; font-size: 15px; color: var(--accent);
  margin-bottom: 8px;
}
.assets-head i { font-size: 17px; align-self: center; }
.assets-total { font-family: "Special Elite", monospace; font-size: 19px; color: var(--ink); }
.assets-sub { font-family: "EB Garamond", serif; font-weight: 400; font-style: italic; font-size: 12.5px; color: var(--ink-soft); letter-spacing: 0; }
.asset-list { list-style: none; margin: 0; padding: 0; max-width: 560px; }
.asset-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 2px; font-size: 14.5px; color: var(--ink);
}
.asset-name { flex: 0 1 auto; }
.asset-dots { flex: 1; border-bottom: 1px dotted var(--line-dk); transform: translateY(-3px); min-width: 24px; }
.asset-val { font-family: "Special Elite", monospace; font-size: 13px; color: var(--accent); white-space: nowrap; }
.asset-none { font-style: italic; color: var(--ink-soft); }
.gear-footrow { margin-top: 14px; }

/* ---- The Armory (weapon picker modal) ---- */
.modal-weapons { width: min(820px, 100%); }
.wpn-tabrow { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.wpn-tabs { display: flex; gap: 0; flex: 1; border: 1.5px solid var(--line-dk); border-radius: 5px; overflow: hidden; background: var(--field-bg); }
.wpn-adv {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  -webkit-user-select: none; user-select: none;
  font-family: "Cinzel", serif; font-weight: 700; font-size: 12.5px; letter-spacing: 0.5px;
  color: var(--ink-soft); padding: 7px 12px;
  border: 1.5px solid var(--line-dk); border-radius: 5px; background: var(--field-bg);
  transition: all 0.13s;
}
.wpn-adv:hover { color: var(--accent); }
.wpn-adv:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fbeee6; }
.wpn-adv input { accent-color: var(--accent); margin: 0; cursor: pointer; }
.wpn-info-bar { margin-top: 12px; }
.wpn-info-bar .modal-info { margin: 0; min-height: 84px; }
.wpn-tab {
  flex: 1; cursor: pointer; background: transparent; border: 0;
  border-right: 1.5px solid var(--line-dk); padding: 8px 6px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-family: "Cinzel", serif; font-weight: 700; font-size: 13.5px; color: var(--ink-soft);
  transition: background 0.13s, color 0.13s;
}
.wpn-tab:last-child { border-right: 0; }
.wpn-tab .ph { font-size: 16px; }
.wpn-tab:hover { background: #f2e7da; color: var(--accent); }
.wpn-tab.active { background: var(--accent); color: #fbeee6; }
.wpn-cat-head {
  font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--accent); margin: 14px 0 4px; border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
}
.wpn-cat-head:first-child { margin-top: 0; }
.wpn-row {
  display: grid; align-items: center; gap: 8px;
  grid-template-columns: minmax(0, 1fr) 86px 86px 52px 56px 42px 50px 30px;
  padding: 6px 4px; border-bottom: 1px dotted var(--line);
  font-size: 13px; color: var(--ink);
}
.wpn-row[data-wname] { cursor: pointer; }
.wpn-row[data-wname]:hover { background: #f2e7da; }
.wpn-row.focused { background: #fbeee6; box-shadow: inset 2px 0 0 var(--accent); }
.wpn-row:last-child { border-bottom: none; }
.wpn-row.wpn-head {
  font-family: "Cinzel", serif; font-size: 10.5px; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--ink-soft); border-bottom: 1px solid var(--line-dk); padding-bottom: 3px;
}
.wpn-main { display: flex; flex-direction: column; min-width: 0; }
.wpn-name { font-weight: 600; font-size: 14px; }
.wpn-row.owned .wpn-name::after { content: " ✓"; color: var(--green); }
.wpn-skill {
  font-size: 12px; font-style: italic; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wpn-add {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--line-dk); background: var(--paper-2); color: var(--accent);
  font-size: 15px; line-height: 1; cursor: pointer; transition: all 0.12s;
  display: flex; align-items: center; justify-content: center;
}
.wpn-add:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (max-width: 680px) {
  .wpn-row { grid-template-columns: minmax(0, 1fr) 86px 30px; }
  .wpn-range, .wpn-ammo, .wpn-malf, .wpn-cost, .wpn-atk { display: none; }
}

.dossier-bgs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
@media (max-width: 560px) { .dossier-bgs { grid-template-columns: 1fr; } }
.dossier-bg h4 { font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); margin: 0 0 3px; }
.dossier-bg p { margin: 0; font-size: 15px; }

.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }

/* ---- Sheet page top bar (home / manage) ---- */
.sheet-topnav { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; margin: 0 0 16px; }
/* the view toggle now rides in the same row as the nav buttons */
.sheet-topnav .sheet-viewtabs { margin: 0; }
/* guest mode: viewing someone else's shared investigator */
.sheet-topnav.guest { align-items: center; flex-wrap: wrap; }
.guest-note {
  display: flex; align-items: center; gap: 8px;
  font-style: italic; font-size: 14.5px; color: var(--line);
}
.guest-note i { font-size: 17px; color: var(--accent-2); }
.guest-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Wizard completion screen ---- */
.done-card { text-align: center; padding-top: 40px; padding-bottom: 44px; }
.done-ico { display: block; font-size: 64px; color: var(--accent); margin-bottom: 10px; }
.done-card .lede { max-width: 56ch; margin-left: auto; margin-right: auto; }
.done-actions { display: flex; justify-content: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.done-view { font-size: 17px; padding: 12px 30px; }

/* ---- Home: the investigator roster ---- */
.home-wrap { padding-top: 26px; }
.home-title {
  font-family: "Cinzel", serif; text-align: center; margin: 0;
  font-size: 40px; letter-spacing: 2px; font-weight: 700;
  /* gold leaf, like the classic sheet's wordmark — legible on the dark page */
  background: linear-gradient(170deg, #e8c45c, #9a7418 70%, #c9a23f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6));
}
.home-tagline {
  text-align: center; margin: 6px 0 28px; font-style: italic;
  color: var(--line); font-size: 17px; letter-spacing: 0.5px;
}
/* first-visit welcome page */
.welcome-wrap { padding-top: 9vh; }
.welcome-card { text-align: center; padding-top: 38px; padding-bottom: 42px; }
.welcome-create { margin-top: 22px; font-size: 17px; padding: 13px 34px; }
/* The roster lives on a parchment panel so the cards aren't lost on the dark page. */
.home-panel { padding: 22px 26px 26px; }
.home-panel-head {
  font-family: "Cinzel", serif; font-size: 15px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--accent); margin: 0 0 16px; border-bottom: 1px solid var(--line); padding-bottom: 10px;
}
.home-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px; align-items: stretch;
}
.home-card {
  position: relative; min-height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--field-bg); border: 1.5px solid var(--line-dk); border-radius: 6px;
  padding: 20px 16px 16px; cursor: pointer; text-align: center;
  box-shadow: 0 2px 7px rgba(28, 26, 23, 0.14);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.home-card:hover { transform: translateY(-2px); border-color: var(--accent-2); box-shadow: 0 6px 16px rgba(28, 26, 23, 0.2); }
.home-card-ico { font-size: 34px; color: var(--accent); opacity: 0.85; }
.home-name { font-family: "Cinzel", serif; font-size: 17px; color: var(--ink); line-height: 1.25; }
.home-sub { font-size: 13.5px; color: var(--ink-soft); }
.home-status {
  margin-top: 6px; font-size: 11px; font-family: "Cinzel", serif; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--ink-soft);
}
.home-status.ready { color: var(--green); }
.home-del {
  position: absolute; top: 6px; right: 8px;
  border: none; background: none; cursor: pointer; padding: 2px 6px;
  font-size: 18px; line-height: 1; color: var(--ink-soft);
}
.home-del:hover { color: var(--accent); }
.home-actions { display: flex; gap: 8px; margin-top: 10px; }
.home-act {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: "Cinzel", serif; font-size: 10.5px; letter-spacing: 0.5px; text-transform: uppercase;
  padding: 4px 13px; border: 1px solid var(--line-dk); border-radius: 999px;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.home-act:hover { color: var(--accent); border-color: var(--accent); }
.home-act i { font-size: 12px; }
.home-card.new {
  border-style: dashed; background: transparent; box-shadow: none;
  font-family: "Cinzel", serif; color: var(--ink-soft);
}
.home-card.new:hover { color: var(--accent); border-color: var(--accent); transform: none; }
.home-new-plus { font-size: 38px; line-height: 1; }
.home-new-label { font-size: 14px; letter-spacing: 1px; }

/* type-DELETE confirmation */
.del-warn { margin: 0 0 14px; }
.del-label { display: block; font-size: 14px; margin-bottom: 6px; color: var(--ink-soft); }
.del-input { width: 100%; font-family: "Special Elite", monospace; letter-spacing: 2px; }

/* ---- Dossier / Classic Sheet view toggle ---- */
.sheet-viewtabs { display: flex; justify-content: center; margin: 0 0 16px; }
.vtab {
  font-family: "Cinzel", serif; font-size: 13px; letter-spacing: 1px; cursor: pointer;
  padding: 7px 24px; border: 1.5px solid var(--line-dk); background: var(--parch); color: var(--ink-soft);
  transition: background 0.12s, color 0.12s;
}
.vtab:first-child { border-radius: 4px 0 0 4px; border-right: none; }
.vtab:last-child { border-radius: 0 4px 4px 0; }
.vtab.active { background: var(--accent); color: #fff; border-color: #5a1414; }
.vtab:not(.active):hover { color: var(--accent); }

/* ============================================================
   CLASSIC SHEET — official-style 1920s investigator sheet.
   Printed furniture in aged brown ink; the investigator's values
   "typed in" in fountain-pen blue (faded when untrained).
   ============================================================ */
.csheet {
  --cs-line: #6b5638; /* printed rule lines */
  --cs-ink: #33291c; /* printed text */
  --cs-faint: #7b6a4e; /* tiny printed sub-labels */
  --cs-cell: #f6eed9; /* value cell fill */
  background:
    radial-gradient(ellipse at 28% 18%, rgba(255, 250, 235, 0.5), transparent 60%),
    linear-gradient(160deg, #ead9b4, #e2cfa4 55%, #dcc69b);
  border: 1px solid var(--line-dk); border-radius: 4px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28), inset 0 0 70px rgba(120, 90, 40, 0.16);
  padding: 20px 22px 24px;
  color: var(--cs-ink);
  font-family: "EB Garamond", serif;
}

/* --- header: banner + identity lines left, photo/logo right, with the
   characteristics band tucked directly beneath the fields (no dead space). --- */
.cs-headgrid {
  display: grid; grid-template-columns: minmax(0, 1fr) 156px;
  grid-template-areas: "head right" "chars right";
  gap: 0 16px; margin-bottom: 2px;
}
.cs-head-l { grid-area: head; min-width: 0; margin-bottom: 12px; }
.cs-right { grid-area: right; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.cs-headgrid .cs-charwrap { grid-area: chars; min-width: 0; }
.cs-banner {
  margin: 0 auto 14px; width: max-content; max-width: 100%;
  font-family: "Cinzel", serif; font-size: 19px; letter-spacing: 1.5px; text-align: center;
  padding: 5px 30px; background: var(--cs-cell);
  border: 2px solid var(--cs-line); outline: 1px solid var(--cs-line); outline-offset: 2px;
}
/* Six-column grid (label | line ×3): label columns auto-size to the widest
   label so the write-in lines align between the two rows. Cells are
   bottom-aligned so each label's foot sits on its entry line. */
.cs-idgrid {
  display: grid;
  grid-template-columns: auto minmax(0, 1.25fr) auto minmax(0, 1fr) auto minmax(0, 0.5fr);
  gap: 10px 4px; align-items: end;
}
.cs-fk { font-size: 14px; line-height: 1; white-space: nowrap; padding-bottom: 2px; }
/* Break before the labels that start the 2nd and 3rd field of a row. */
.cs-idgrid .cs-fk:nth-child(6n + 3), .cs-idgrid .cs-fk:nth-child(6n + 5) { padding-left: 8px; }
.cs-fv {
  min-width: 0; border-bottom: 1px solid var(--cs-line); padding: 0 3px 1px;
  font-family: "Special Elite", monospace; font-size: 13.5px; line-height: 16px; color: var(--ink-blue);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 17px;
}
/* No write-in line on fields that aren't editable in play (Age — set in the editor). */
.cs-fv:not([data-edit-text]) { border-bottom: none; }
.cs-photo {
  width: 148px; height: 170px; flex: 0 0 auto; background: #fffef8;
  border: 1px solid #b9a87f;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), inset 0 0 0 6px #fff;
  display: flex; align-items: center; justify-content: center;
}
/* The same silhouette as the passport photograph, framed by the white inset. */
.cs-photo .pp-silhouette {
  width: calc(100% - 14px); height: calc(100% - 14px);
  margin: 7px; padding: 10px;
}

/* --- section bands with the rotated rail label ("[" bracket) --- */
.cs-band { display: flex; margin-bottom: 14px; }
.cs-rail {
  flex: 0 0 24px; position: relative; margin-right: 10px;
  border: 1.5px solid var(--cs-line); border-right: none; border-radius: 7px 0 0 7px;
}
.cs-rail span {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(180deg);
  writing-mode: vertical-rl; white-space: nowrap;
  font-family: "Cinzel", serif; font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
}
.cs-bandbody { flex: 1; min-width: 0; padding: 3px 0; }

/* --- the [reg|half|fifth] cell box --- */
.cs-tri {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr;
  border: 1.5px solid var(--cs-line); border-radius: 7px; overflow: hidden;
  background: var(--cs-cell); height: 26px;
}
.cs-tri b, .cs-tri > span {
  display: flex; align-items: center; justify-content: center; min-width: 0;
  font-family: "Special Elite", monospace; font-weight: normal;
  border-left: 1px solid var(--cs-line);
  font-size: 11px; color: rgba(32, 48, 95, 0.6); /* untrained: lighter ink, still legible */
}
.cs-tri b { border-left: none; font-size: 14px; }
.cs-tri.on b, .cs-tri.on > span { color: var(--ink-blue); } /* trained: full ink */
.cs-heads, .cs-colheads { display: grid; grid-template-columns: 1.5fr 1fr 1fr; }
.cs-heads span, .cs-colheads span {
  font-size: 7.5px; font-style: italic; color: var(--cs-faint); text-align: center; line-height: 1.5;
}

/* --- characteristics band --- */
.cs-charband { display: flex; gap: 18px; align-items: flex-start; }
.cs-chargrid { flex: 1.2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 16px; }
.cs-stat { display: flex; align-items: flex-end; gap: 8px; }
.cs-statk {
  flex: 0 0 34px; text-align: right; padding-bottom: 6px; line-height: 1;
  font-family: "Cinzel", serif; font-size: 13px;
}
.cs-statk small { display: block; margin-top: 2px; font-size: 6.5px; letter-spacing: 1px; color: var(--cs-faint); }
.cs-statbox { flex: 1; min-width: 0; }

.cs-pools { flex: 1; min-width: 218px; display: flex; flex-direction: column; gap: 8px; }
.cs-pool { display: flex; align-items: center; gap: 9px; }
/* Label hugs its box: right-aligned so all the boxes share a right edge. */
.cs-poolk { flex: 1; font-size: 14px; white-space: nowrap; text-align: right; }
.cs-poolbox {
  display: flex; flex: 0 0 auto; border: 1.5px solid var(--cs-line); border-radius: 7px;
  overflow: hidden; background: var(--cs-cell);
}
.cs-pcell {
  display: flex; flex-direction: column; align-items: center;
  min-width: 44px; padding: 1px 5px 2px; border-left: 1px solid var(--cs-line);
}
.cs-pcell:first-child { border-left: none; }
.cs-pcell small { font-size: 7px; font-style: italic; color: var(--cs-faint); line-height: 1.5; letter-spacing: 0.2px; }
.cs-pcell b {
  font-family: "Special Elite", monospace; font-weight: normal; font-size: 12px;
  color: var(--ink-blue); align-self: stretch;
  /* flex-centred at a shared height so small and big values sit level */
  display: flex; align-items: center; justify-content: center; min-height: 19px;
}
/* Official-sheet proportions: the tracked (editable) value gets the wide box. */
.cs-pcell.big { min-width: 84px; }
.cs-pcell.big b { font-size: 15px; }

.cs-logo { text-align: center; }
.cs-logo-main {
  display: block; font-family: "Cinzel", serif; font-weight: 700;
  font-size: 26px; line-height: 1.08; letter-spacing: 1px;
  background: linear-gradient(170deg, #e8c45c, #9a7418 70%, #c9a23f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 rgba(80, 55, 5, 0.3));
}
.cs-logo-sub {
  display: block; margin-top: 5px;
  font-family: "Cinzel", serif; font-size: 9px; letter-spacing: 3px; text-transform: uppercase; color: #8a6a16;
}

/* --- sanity/wound status strip --- */
.cs-status {
  display: flex; align-items: center; gap: 15px; flex-wrap: wrap;
  margin: 0 0 14px 34px; font-size: 13px;
}
.cs-maxsan {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 23px; margin-left: -8px;
  border: 1.5px solid var(--cs-line); border-radius: 7px; background: var(--cs-cell);
  font-family: "Special Elite", monospace; font-size: 13px; color: var(--ink-blue);
}
.cs-statusbox { display: inline-flex; align-items: center; gap: 5px; }
.cs-cb { width: 10px; height: 10px; flex: 0 0 auto; border: 1px solid var(--cs-ink); background: #fbf7ea; display: inline-block; }
.cs-cbspace { width: 10px; flex: 0 0 auto; display: inline-block; }

/* --- skills: three printed columns --- */
.cs-skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.cs-scol { display: flex; flex-direction: column; min-width: 0; }
.cs-colheads { margin-left: auto; width: 86px; margin-bottom: 1px; }
/* Every row is the same fixed height so the three columns stay in register. */
.cs-srow {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) 86px;
  gap: 5px; align-items: center; height: 27px; padding: 0;
}
.cs-srow .cs-tri { height: 21px; border-width: 1px; border-radius: 6px; }
.cs-srow .cs-tri b { font-size: 12px; }
.cs-srow .cs-tri > span { font-size: 10px; }
.cs-sname { font-size: 12.5px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-sname small { font-size: 10px; color: var(--cs-faint); }
/* Write-in line: the dotted rule is centred like a printed name (its ink sits on
   the line); the tiny printed label tucks just beneath it, official-sheet style. */
.cs-swrite { position: relative; display: block; min-width: 0; align-self: center; }
.cs-swrite i {
  display: block; min-height: 16px; line-height: 16px;
  border-bottom: 1px dotted var(--cs-ink);
  font-family: "Special Elite", monospace; font-style: normal; font-size: 11px; color: var(--ink-blue);
  white-space: nowrap; overflow: hidden;
}
.cs-swrite small {
  position: absolute; left: 1px; top: 100%; line-height: 1;
  font-size: 8px; font-style: italic; color: var(--cs-faint); white-space: nowrap;
}

/* --- combat band --- */
.cs-combat { display: flex; gap: 24px; align-items: flex-start; }
.cs-wtable { flex: 1; border-collapse: collapse; font-size: 12.5px; }
.cs-wtable th {
  font-family: "Cinzel", serif; font-size: 10px; font-weight: 600; letter-spacing: 0.4px;
  padding: 2px 6px 3px; text-align: center; border-bottom: 1.5px solid var(--cs-line);
}
.cs-wtable td { padding: 5px 6px; text-align: center; border-bottom: 1px dotted var(--cs-line); height: 28px; }
.cs-wtable td.cs-wname { text-align: left; font-size: 13px; }
/* Brawl's damage / attacks are pre-printed on the official sheet, not written in. */
.cs-wtable td.cs-wink { font-size: 12.5px; color: var(--cs-ink); }
/* Owned weapons are written in by hand. */
.cs-wtable td.cs-wval {
  font-family: "Special Elite", monospace; font-size: 11.5px; color: var(--ink-blue);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px;
}
.cs-wtable td .cs-tri { width: 84px; height: 21px; border-width: 1px; border-radius: 6px; margin: 0 auto; }
.cs-cstats { flex: 0 0 195px; display: flex; flex-direction: column; gap: 9px; padding-top: 4px; }
/* Label hugs its box; boxes share a right edge. */
.cs-cstat { display: flex; align-items: center; gap: 9px; }
.cs-cstat > span { flex: 1; font-size: 14px; text-align: right; }
.cs-cstat .cs-tri { width: 96px; height: 24px; flex: 0 0 auto; }
.cs-box {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 56px; height: 24px; padding: 0 8px;
  border: 1.5px solid var(--cs-line); border-radius: 7px; background: var(--cs-cell);
  font-family: "Special Elite", monospace; font-weight: normal; font-size: 13px; color: var(--ink-blue);
}

/* --- play-mode editing --- */
[data-edit-skill], [data-edit-pool], [data-edit-text] { cursor: text; }
.cs-tri b[data-edit-skill]:hover, .cs-pcell b[data-edit-pool]:hover, .cs-fv[data-edit-text]:hover {
  background: rgba(32, 48, 95, 0.08);
}
/* "Write here" affordance: editable cells carry a faint dotted writing line
   beneath the digits, like a form's blank — fixed cells have none. */
b[data-edit-pool], .cs-tri b[data-edit-skill] { position: relative; }
b[data-edit-pool]::after, .cs-tri b[data-edit-skill]::after {
  content: ""; position: absolute; left: 16%; right: 16%; bottom: 2px;
  border-bottom: 1px dotted rgba(32, 48, 95, 0.38);
}
/* hide the line while its input is swapped in */
b[data-edit-pool]:has(input)::after, .cs-tri b[data-edit-skill]:has(input)::after { display: none; }
.cs-edit-input {
  width: 100%; min-width: 0; border: none; margin: 0; padding: 0; outline: none;
  background: rgba(32, 48, 95, 0.08);
  font: inherit; color: inherit; text-align: center;
  -moz-appearance: textfield; appearance: textfield;
}
.cs-edit-input::-webkit-inner-spin-button, .cs-edit-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cs-fv .cs-edit-input { text-align: left; }
.cs-cb[data-check], .cs-cb[data-status] { cursor: pointer; }
.cs-cb[data-check]:hover, .cs-cb[data-status]:hover { border-color: var(--ink-blue); box-shadow: 0 0 0 1px rgba(32, 48, 95, 0.3); }
.cs-cb.on { position: relative; }
.cs-cb.on::after {
  content: "\2715"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; line-height: 1; font-weight: bold; color: var(--ink-blue);
}

/* Desktop-first layout: let it scroll sideways rather than collapse on phones. */
@media (max-width: 760px) {
  .stage:has(.csheet) { overflow-x: auto; }
  .csheet { min-width: 720px; }
}

/* ---- Print ---- */
@media print {
  html, body { background: #fff; font-size: 12px; }
  .topbar, .stepper, .navbar, .sheet-actions, .sheet-viewtabs, .sheet-topnav { display: none !important; }
  #app { max-width: none; padding: 0; }
  .sheet { box-shadow: none; border: 1px solid #555; }
  .sheet::before { display: none; }
  .csheet { box-shadow: none; }
}
