:root {
  --paper: #15100d;
  --ink: #f1e6d2;
  --muted: #a99d8b;
  --line: #5b4a3d;
  --panel: #241b17;
  --panel-2: #342820;
  --panel-3: #46372c;
  --teal: #3d88bc;
  --moss: #7c9842;
  --wine: #b64137;
  --gold: #d6a552;
  --ember: #7f2f1d;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255, 238, 203, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 12%, rgba(94, 67, 42, 0.54), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(33, 61, 77, 0.32), transparent 24%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 34px),
    linear-gradient(180deg, #1d1714, #0d0b0a 72%),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

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

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1540px, calc(100% - 20px));
  min-height: calc(100vh - 20px);
  margin: 10px auto;
  border: 1px solid #6b5749;
  border-radius: 8px;
  padding: 0;
  background:
    linear-gradient(90deg, rgba(255, 226, 168, 0.07), transparent 14%, transparent 86%, rgba(0, 0, 0, 0.24)),
    linear-gradient(180deg, #211915, #15110f);
  box-shadow:
    0 0 0 2px rgba(18, 12, 10, 0.96),
    0 0 0 4px rgba(104, 81, 62, 0.4),
    0 26px 80px rgba(0, 0, 0, 0.62);
  overflow: hidden;
}

.version-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #5f4c3f;
  padding: 7px 12px;
  color: var(--muted);
  background:
    linear-gradient(90deg, rgba(214, 165, 82, 0.08), transparent 55%),
    linear-gradient(180deg, #221914, #15100d);
  font-size: 0.64rem;
}

.version-footer span {
  min-width: max-content;
}

.version-footer strong {
  color: #f1dfbd;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(360px, 0.82fr) minmax(250px, auto) auto;
  gap: 8px;
  align-items: center;
  min-height: 78px;
  border-bottom: 1px solid #6f594a;
  padding: 9px 12px;
  background:
    linear-gradient(90deg, rgba(214, 165, 82, 0.14), transparent 35%, rgba(0, 0, 0, 0.22)),
    linear-gradient(180deg, #3c2f28, #251c18 58%, #171210);
  box-shadow: inset 0 1px rgba(255, 239, 204, 0.13), inset 0 -1px rgba(0, 0, 0, 0.75);
}

.theme-toggle {
  display: grid;
  grid-template-columns: 20px auto;
  gap: 5px;
  align-self: start;
  align-items: center;
  min-width: 76px;
  min-height: 30px;
  border: 1px solid #80664f;
  border-radius: 999px;
  padding: 4px 8px 4px 5px;
  color: #fff0d8;
  background:
    linear-gradient(180deg, rgba(255, 235, 190, 0.18), transparent 52%),
    #17110f;
  cursor: pointer;
  font-size: 0.64rem;
  font-weight: 820;
  text-transform: uppercase;
  box-shadow: inset 0 1px rgba(255, 238, 203, 0.13), 0 2px 8px rgba(0, 0, 0, 0.28);
}

.theme-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  color: #23170f;
  background: linear-gradient(180deg, #f2dfb6, #b89b69);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  color: #fff5e4;
  font-size: clamp(1.45rem, 2.5vw, 2.55rem);
  font-weight: 760;
  line-height: 1.03;
  text-shadow: 0 2px 0 #1a100d, 0 0 28px rgba(214, 165, 82, 0.2);
}

h2 {
  margin: 0 0 8px;
  color: #fff1da;
  font-size: 0.92rem;
  font-weight: 760;
  text-transform: uppercase;
}

h3 {
  margin: 0 0 5px;
  font-size: 0.93rem;
  color: #fff0d7;
}

.subtle {
  margin: 8px 0 0;
  color: var(--muted);
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(8, minmax(46px, 1fr));
  gap: 4px;
  align-items: stretch;
}

.resource-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 4px;
  align-items: stretch;
}

.resource-chip {
  display: grid;
  min-height: 42px;
  align-content: center;
  border: 1px solid #6b5749;
  border-radius: 4px;
  padding: 4px 6px;
  color: #dacdb8;
  background: linear-gradient(180deg, rgba(58, 45, 37, 0.9), rgba(23, 17, 14, 0.92));
  font-size: 0.72rem;
  line-height: 1.15;
}

.resource-chip strong {
  color: #fff0d8;
  font-size: 0.64rem;
  font-weight: 780;
  text-transform: uppercase;
}

.resource-chip.available-chip {
  border-color: rgba(226, 207, 171, 0.68);
  color: #21150f;
  background: linear-gradient(180deg, #f2dfb6, #b89b69);
}

.resource-chip.available-chip strong {
  color: #3a2417;
}

.stat-tile,
.metric,
.card,
.list-card,
.editor-field {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(69, 55, 45, 0.92), rgba(31, 24, 20, 0.94));
  box-shadow: var(--shadow);
}

.stat-tile {
  min-height: 42px;
  padding: 5px 6px;
  border-radius: 4px;
  border-color: #756050;
  text-align: center;
}

.stat-label,
.field-label,
.table-note {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.stat-value {
  display: block;
  margin-top: 1px;
  color: #fff3df;
  font-size: 0.96rem;
  font-weight: 780;
}

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

.tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  align-content: start;
  gap: 0;
  overflow-x: visible;
  padding: 0;
  background: linear-gradient(180deg, #2f241f, #1d1714);
  border-right: 1px solid #5f4c3f;
  box-shadow: inset -1px 0 rgba(0, 0, 0, 0.7);
  backdrop-filter: none;
}

.tab {
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid #4f4036;
  border-radius: 0;
  padding: 0 12px;
  color: #c9bdaa;
  background:
    linear-gradient(90deg, rgba(255, 228, 188, 0.045), transparent 42%),
    linear-gradient(180deg, #332720, #241b17);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 760;
  text-align: left;
  text-transform: uppercase;
  transition:
    background 140ms ease,
    color 140ms ease,
    padding-left 140ms ease;
}

.tab.is-active {
  color: #fff4df;
  border-color: #715a49;
  background:
    linear-gradient(90deg, rgba(214, 165, 82, 0.26), transparent 72%),
    linear-gradient(180deg, #4a3a30, #2a201b);
  box-shadow: inset 5px 0 var(--gold), inset -1px 0 rgba(0, 0, 0, 0.88);
  padding-left: 16px;
}

.content {
  min-width: 0;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 220px),
    #171210;
}

.character-panel {
  border-left: 1px solid #5f4c3f;
  padding: 10px;
  background: linear-gradient(180deg, #2e231e, #181210);
  box-shadow: inset 1px 0 rgba(255, 238, 203, 0.05);
}

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

.character-panel-heading h2 {
  margin: 0;
}

.character-list {
  display: grid;
  gap: 8px;
}

.character-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}

.character-switch {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid #56463b;
  border-radius: 5px;
  padding: 10px;
  color: #e8d9c2;
  background:
    linear-gradient(90deg, rgba(214, 165, 82, 0.06), transparent 76%),
    #1a1310;
  cursor: pointer;
  text-align: left;
}

.character-switch strong {
  color: #fff2dd;
  font-size: 0.92rem;
}

.character-switch span {
  color: var(--muted);
  font-size: 0.78rem;
}

.character-switch.is-active {
  border-color: rgba(214, 165, 82, 0.78);
  background:
    linear-gradient(90deg, rgba(214, 165, 82, 0.24), transparent 78%),
    #2a201b;
  box-shadow: inset 4px 0 var(--gold);
}

.character-remove {
  border: 1px solid #5f4c3f;
  border-radius: 5px;
  padding: 0 8px;
  color: #f09c92;
  background: #17110f;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.wizard-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 6, 5, 0.76);
}

.wizard-window {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(860px, 100%);
  max-height: min(840px, calc(100vh - 36px));
  border: 1px solid #715d4c;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 235, 194, 0.06), transparent 130px),
    #1a1310;
  box-shadow:
    0 0 0 2px rgba(16, 10, 8, 0.95),
    0 24px 70px rgba(0, 0, 0, 0.72);
  overflow: hidden;
}

.wizard-titlebar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #5f4c3f;
  padding: 14px 16px;
  background: linear-gradient(180deg, #3d3028, #261d18);
}

.wizard-titlebar h2 {
  margin: 2px 0 0;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 12px 16px 0;
}

.wizard-steps span {
  display: grid;
  min-height: 28px;
  place-items: center;
  border: 1px solid #4f4036;
  border-radius: 4px;
  color: var(--muted);
  background: #120d0b;
  font-weight: 900;
}

.wizard-steps span.is-active {
  color: #1b120e;
  border-color: var(--gold);
  background: var(--gold);
}

.wizard-body {
  overflow: auto;
  padding: 16px;
}

.wizard-preview {
  margin-top: 12px;
}

.feature-allocation,
.wizard-review-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.wizard-note-card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 12px;
  background: rgba(31, 22, 18, 0.82);
}

.wizard-note-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.wizard-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid #5f4c3f;
  padding: 12px 16px;
  background: #17110f;
}

.warning-text {
  color: #f09c92;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.dashboard {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 10px;
}

.overview-grid,
.gear-custom-grid,
.story-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.overview-main-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(220px, 0.7fr) minmax(280px, 1fr);
  gap: 10px;
}

.overview-secondary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  align-items: start;
}

.overview-focus {
  min-height: 100%;
}

.overview-identity-card,
.overview-portrait-card {
  display: grid;
  gap: 8px;
  align-content: start;
}

.overview-portrait-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 86px;
  gap: 8px;
  align-items: stretch;
}

.portrait-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.portrait-pair.has-two-forms {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portrait-slot {
  position: relative;
  display: grid;
  min-height: 226px;
  overflow: hidden;
  border: 1px solid #715a49;
  border-radius: 5px;
  background:
    radial-gradient(circle at 50% 18%, rgba(214, 165, 82, 0.22), transparent 38%),
    linear-gradient(180deg, rgba(59, 46, 39, 0.88), rgba(18, 13, 11, 0.96));
}

.portrait-slot img {
  width: 100%;
  height: 100%;
  min-height: 226px;
  object-fit: cover;
}

.portrait-placeholder {
  display: grid;
  min-height: 226px;
  place-items: center;
  color: rgba(255, 241, 218, 0.72);
  font-size: 2.2rem;
  font-weight: 760;
}

.portrait-slot > span:last-child {
  position: absolute;
  right: 5px;
  bottom: 5px;
  border: 1px solid rgba(255, 238, 203, 0.18);
  border-radius: 3px;
  padding: 2px 5px;
  color: #f5dfb9;
  background: rgba(18, 13, 11, 0.78);
  font-size: 0.58rem;
  font-weight: 760;
  text-transform: uppercase;
}

.level-corner {
  display: grid;
  align-content: center;
  justify-items: center;
  border: 1px solid rgba(214, 165, 82, 0.54);
  border-radius: 5px;
  padding: 7px;
  color: #d8cbb7;
  background:
    linear-gradient(180deg, rgba(214, 165, 82, 0.18), transparent 56%),
    rgba(22, 16, 13, 0.86);
  text-align: center;
}

.level-corner strong {
  color: #fff1d8;
  font-size: 2rem;
  line-height: 1;
}

.level-corner span:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.2;
}

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

.compact-identity-grid .wide-field {
  grid-column: span 2;
}

.portrait-url-drawer {
  border: 1px solid rgba(113, 90, 73, 0.62);
  border-radius: 5px;
  padding: 6px 7px;
  background: rgba(18, 13, 11, 0.52);
}

.portrait-url-drawer summary {
  cursor: pointer;
  color: #f5dfb9;
  font-size: 0.68rem;
  font-weight: 780;
  text-transform: uppercase;
}

.portrait-url-drawer .field-grid {
  margin-top: 6px;
}

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

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

.card,
.list-card {
  position: relative;
  border-color: #725d4b;
  border-radius: 5px;
  padding: 10px;
  color: var(--ink);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(12, 8, 6, 0.74),
    0 10px 26px rgba(0, 0, 0, 0.28),
    inset 0 1px rgba(255, 238, 203, 0.07);
}

.card.accent-teal {
  border-top: 3px solid #3d88bc;
  background: linear-gradient(180deg, rgba(61, 136, 188, 0.1), rgba(31, 24, 20, 0.96));
}

.card.accent-wine {
  border-top: 3px solid #b64137;
  background: linear-gradient(180deg, rgba(182, 65, 55, 0.11), rgba(31, 24, 20, 0.96));
}

.card.accent-moss {
  border-top: 3px solid #7c9842;
  background: linear-gradient(180deg, rgba(124, 152, 66, 0.11), rgba(31, 24, 20, 0.96));
}

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

.metric,
.progress-cell {
  border-radius: 6px;
  padding: 7px;
}

.metric strong,
.progress-cell strong {
  display: block;
  margin-top: 2px;
  font-size: 1.05rem;
}

.card-heading,
.lane-header,
.ability-node-top {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

.progression-card {
  display: grid;
  gap: 7px;
}

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

.progress-cell {
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(214, 165, 82, 0.12), transparent 74%),
    rgba(42, 32, 27, 0.88);
  box-shadow: inset 0 1px rgba(255, 234, 195, 0.08);
}

.xp-ledger {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.xp-ledger-card {
  display: grid;
  gap: 7px;
  align-content: start;
}

.xp-summary-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.xp-summary-strip span {
  display: flex;
  min-height: 31px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 8px;
  color: var(--muted);
  background: rgba(18, 13, 11, 0.62);
  font-size: 0.64rem;
  font-weight: 760;
  text-transform: uppercase;
}

.xp-summary-strip em {
  font-style: normal;
}

.xp-summary-strip strong {
  color: #fff0d8;
  font-size: 0.95rem;
}

.ledger-header,
.ledger-entry {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.ledger-header h3 {
  margin: 0;
}

.ledger-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px auto;
  gap: 5px;
}

.ledger-form input {
  min-height: 31px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 7px;
  color: var(--ink);
  background: #17110f;
}

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

.ledger-entry {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 7px;
  background: rgba(25, 18, 15, 0.72);
}

.rules-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.patch-page {
  display: grid;
  gap: 8px;
}

.patch-current-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
}

.patch-current-card .rules-note {
  grid-column: 1 / -1;
}

.patch-version-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.patch-version-pair span,
.patch-row {
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(214, 165, 82, 0.08), transparent 72%),
    rgba(18, 13, 11, 0.66);
}

.patch-version-pair span {
  display: grid;
  gap: 2px;
  min-width: 128px;
  padding: 6px 8px;
  color: #fff0d8;
  font-weight: 780;
}

.patch-version-pair strong {
  color: var(--muted);
  font-size: 0.6rem;
  text-transform: uppercase;
}

.patch-list {
  display: grid;
  gap: 5px;
}

.patch-row {
  display: grid;
  grid-template-columns: 80px 96px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
}

.patch-version {
  color: #fff0d8;
  font-weight: 840;
}

.patch-date {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
}

.patch-row p {
  margin: 0;
  color: #dfcfb7;
  line-height: 1.25;
}

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

.field-grid.compact-identity-grid {
  grid-template-columns: 1fr;
}

.field-grid.compact-identity-grid .wide-field {
  grid-column: 1;
}

.field-grid.editor-form {
  grid-template-columns: 1fr;
  gap: 7px;
}

.overview-build-card .build-grid {
  grid-template-columns: 1fr;
}

.inline-editor-grid .editor-field {
  display: grid;
  grid-template-columns: minmax(74px, 0.42fr) minmax(0, 1fr);
  align-items: stretch;
  border-color: #6f594a;
  border-radius: 5px;
  padding: 0;
  background: rgba(17, 12, 10, 0.78);
  overflow: hidden;
}

.inline-editor-grid .field-label {
  display: flex;
  min-width: 0;
  align-items: center;
  border-right: 1px solid rgba(25, 16, 12, 0.78);
  padding: 0 7px;
  color: #f4e1be;
  background: linear-gradient(180deg, #4e3b2f, #35281f);
  font-size: 0.62rem;
  line-height: 1.05;
}

.overview-build-card .inline-editor-grid .field-label {
  background: linear-gradient(180deg, #5a302b, #39201c);
}

.inline-editor-grid .editor-field input,
.inline-editor-grid .editor-field select {
  min-height: 32px;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 4px 8px;
  color: #fff0d8;
  background: #100b09;
  font-size: 0.82rem;
  font-weight: 620;
}

.field-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  min-width: 0;
  background: #100b09;
}

.field-unit {
  display: flex;
  align-items: center;
  border-left: 1px solid rgba(113, 90, 73, 0.5);
  padding: 0 8px;
  color: var(--muted);
  background: rgba(28, 20, 16, 0.72);
  font-size: 0.62rem;
  font-weight: 760;
  text-transform: uppercase;
  white-space: nowrap;
}

.inline-editor-grid .editor-field input:focus,
.inline-editor-grid .editor-field select:focus {
  box-shadow: inset 0 0 0 2px rgba(214, 165, 82, 0.28);
}

.inline-editor-grid .wide-field {
  grid-column: 1 / -1;
}

.editor-field {
  border-radius: 5px;
  padding: 7px;
  background:
    linear-gradient(180deg, rgba(255, 242, 214, 0.035), rgba(0, 0, 0, 0.06)),
    #1a1310;
}

.editor-field input,
.editor-field select,
.editor-field textarea {
  width: 100%;
  margin-top: 4px;
  border: 1px solid #59483c;
  border-radius: 3px;
  outline: none;
  color: var(--ink);
  background: #120d0b;
  padding: 6px 8px;
}

.editor-field input:focus,
.editor-field select:focus,
.editor-field textarea:focus,
.searchbar input:focus,
.searchbar select:focus,
.matrix-number-input:focus,
.inline-number-field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(214, 165, 82, 0.2);
}

.editor-field textarea {
  min-height: 74px;
  resize: vertical;
}

.editor-form .editor-field {
  display: grid;
  grid-template-columns: minmax(112px, 0.28fr) minmax(0, 1fr);
  align-items: stretch;
  min-height: 38px;
  overflow: hidden;
  border-color: #6f594a;
  border-radius: 5px;
  padding: 0;
  background: rgba(17, 12, 10, 0.78);
}

.editor-form .field-label {
  display: flex;
  min-width: 0;
  align-items: center;
  border-right: 1px solid rgba(25, 16, 12, 0.78);
  padding: 0 8px;
  color: #f4e1be;
  background: linear-gradient(180deg, #4e3b2f, #35281f);
  font-size: 0.64rem;
  line-height: 1.05;
}

.editor-form .editor-field input,
.editor-form .editor-field select,
.editor-form .editor-field textarea {
  min-height: 36px;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 6px 9px;
  background: #100b09;
}

.editor-form .editor-field textarea {
  min-height: 104px;
}

.editor-form .editor-field input:focus,
.editor-form .editor-field select:focus,
.editor-form .editor-field textarea:focus {
  box-shadow: inset 0 0 0 2px rgba(214, 165, 82, 0.28);
}

.editor-form .editor-combat-info-grid,
.editor-form .editor-range-info-grid,
.editor-form .editor-rank-cost-grid {
  grid-template-columns: 1fr;
}

.wide-field {
  grid-column: 1 / -1;
}

.gear-page,
.karma-page,
.story-page,
.adventure-page,
.talents-page {
  display: grid;
  gap: 8px;
}

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

.gear-match-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: 8px;
}

.gear-match {
  display: grid;
  gap: 4px;
  border: 1px dashed var(--line);
  border-radius: 5px;
  padding: 7px;
  color: var(--muted);
  background: rgba(18, 13, 11, 0.76);
  font-size: 0.84rem;
}

.gear-match.matched {
  border-style: solid;
  border-color: rgba(214, 165, 82, 0.48);
  background: rgba(98, 62, 26, 0.22);
}

.gear-match strong {
  color: var(--ink);
}

.gear-ability-list {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.gear-ability-card {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(214, 177, 118, 0.22);
  border-left: 3px solid #9ec0dc;
  border-radius: 4px;
  padding: 5px;
  color: #eadbc3;
  background: rgba(18, 12, 9, 0.56);
}

.gear-ability-card.type-passive {
  border-left-color: #7c9842;
}

.gear-ability-card.type-unique,
.gear-ability-card.type-upgrade {
  border-left-color: #b174cc;
}

.gear-ability-head {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
}

.gear-ability-head strong {
  min-width: 0;
  overflow: hidden;
  color: #fff2dc;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gear-ability-card p {
  margin: 0;
  color: rgba(234, 219, 196, 0.8);
  font-size: 0.66rem;
  line-height: 1.3;
}

.compact-ability-short {
  padding: 0;
}

.condition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 6px;
}

.condition-notes {
  display: grid;
  gap: 4px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.3;
}

.condition-notes span {
  border: 1px solid rgba(214, 177, 118, 0.14);
  border-radius: 4px;
  padding: 5px 6px;
  background: rgba(18, 13, 11, 0.46);
}

.gear-kit-section {
  display: grid;
}

.kit-table-wrap {
  max-height: none;
}

.kit-table th:nth-child(2),
.kit-table th:nth-child(3),
.kit-table td:nth-child(2),
.kit-table td:nth-child(3) {
  width: 78px;
  text-align: center;
}

.kit-table tr.kit-owned {
  background: rgba(83, 96, 41, 0.22);
}

.kit-table td {
  vertical-align: top;
}

.kit-table .description {
  margin: 3px 0 0;
  font-size: 0.68rem;
  line-height: 1.28;
}

.kit-check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--ink);
}

.kit-check.compact {
  justify-content: center;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.kit-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--gold);
}

.gear-edit-list {
  display: grid;
  gap: 5px;
}

.gear-edit-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(120px, 0.6fr) minmax(180px, 1fr) auto;
  gap: 5px;
  align-items: center;
}

.gear-edit-row input {
  min-height: 31px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 7px;
  color: var(--ink);
  background: #120d0b;
}

.compact-empty {
  border: 1px dashed var(--line);
  border-radius: 5px;
  padding: 10px;
}

.karma-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 6px;
}

.karma-ability-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 138px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(70, 55, 45, 0.9), rgba(29, 22, 18, 0.95));
  box-shadow: var(--shadow);
}

.karma-ability-card.selected {
  border-color: rgba(214, 165, 82, 0.66);
  background: linear-gradient(180deg, rgba(117, 83, 37, 0.5), rgba(30, 22, 18, 0.96));
}

.karma-ability-card.locked {
  color: var(--muted);
  background: rgba(31, 24, 20, 0.74);
}

.talent-page-note {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: #dfcfb7;
  font-size: 0.72rem;
}

.talent-page-note span {
  border: 1px solid rgba(214, 177, 118, 0.22);
  border-radius: 4px;
  padding: 5px 7px;
  background: rgba(28, 20, 16, 0.76);
}

.talent-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
  gap: 7px;
}

.talent-level-list {
  display: grid;
  gap: 8px;
}

.talent-level-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(255, 231, 184, 0.035), transparent 86px),
    rgba(18, 13, 11, 0.84);
}

.talent-level-band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 30px;
  border-bottom: 1px solid rgba(214, 177, 118, 0.24);
  padding: 5px 8px;
  background: linear-gradient(180deg, rgba(76, 55, 42, 0.92), rgba(42, 30, 24, 0.96));
}

.talent-level-band strong {
  color: #fff3df;
  font-size: 0.78rem;
  font-weight: 850;
}

.talent-level-band span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 760;
  text-transform: uppercase;
}

.talent-full-row-list {
  display: grid;
  gap: 5px;
  padding: 6px;
}

.talent-card {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-left: 3px solid #b64137;
  border-radius: 4px;
  padding: 0;
  background: linear-gradient(180deg, rgba(68, 48, 38, 0.88), rgba(25, 18, 15, 0.96));
  overflow: visible;
}

.talent-card.granted {
  border-left-color: #d6a552;
}

.talent-card.selected {
  border-left-color: #3d88bc;
}

.talent-card.available {
  border-color: rgba(231, 211, 174, 0.5);
  border-left-color: #e7d3ae;
}

.talent-card.locked {
  color: var(--muted);
  border-left-color: #8c312c;
  background: rgba(27, 20, 17, 0.66);
}

.talent-card-line {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 24px 42px 56px 46px 24px;
  align-items: stretch;
  min-height: 28px;
}

.talent-row-line {
  grid-template-columns: minmax(220px, 1fr) 22px 54px 46px 22px;
}

.talent-name-cell {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 1px;
  padding: 3px 6px;
  color: #fff3df;
  background: linear-gradient(180deg, rgba(85, 58, 43, 0.92), rgba(49, 34, 27, 0.96));
}

.talent-name-cell strong {
  overflow: hidden;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.talent-name-cell em {
  overflow: hidden;
  color: rgba(239, 221, 194, 0.68);
  font-size: 0.5rem;
  font-style: normal;
  font-weight: 680;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.talent-source-icon,
.talent-level-cell,
.talent-rank-cell,
.talent-cost-cell {
  display: grid;
  place-items: center;
  border-left: 1px solid rgba(214, 177, 118, 0.18);
  background: rgba(21, 15, 13, 0.58);
}

.talent-source-icon {
  color: #24170f;
  background: #d9c5a2;
  font-size: 0.62rem;
  font-weight: 860;
}

.talent-source-icon.origin {
  background: #a9c97c;
}

.talent-source-icon.class,
.talent-source-icon.way {
  background: #9ec0dc;
}

.talent-level-cell strong,
.talent-rank-cell strong,
.talent-cost-cell {
  color: #fff2dc;
  font-size: 0.64rem;
  font-weight: 840;
}

.talent-level-cell em,
.talent-rank-cell em {
  color: var(--muted);
  font-size: 0.46rem;
  font-style: normal;
  text-transform: uppercase;
}

.talent-level-cell {
  background: rgba(61, 136, 188, 0.14);
}

.talent-cost-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 5px 6px 0;
}

.talent-cost-grid span,
.talent-effect-chip {
  border: 1px solid rgba(214, 177, 118, 0.18);
  border-radius: 4px;
  padding: 4px 5px;
  color: #e8d7bd;
  background: rgba(22, 16, 13, 0.62);
  font-size: 0.58rem;
  line-height: 1.12;
}

.talent-cost-grid strong,
.talent-effect-chip strong {
  display: block;
  color: var(--muted);
  font-size: 0.48rem;
  text-transform: uppercase;
}

.talent-effect-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
  padding: 3px 5px 0;
}

.talent-effect-chip {
  display: inline-grid;
  gap: 1px;
  white-space: nowrap;
}

.talent-effect-strip .ability-range-icon {
  flex: 0 0 auto;
}

.talent-description {
  margin: 0;
  padding: 2px 6px 4px;
  color: rgba(234, 219, 196, 0.76);
  font-size: 0.56rem;
  line-height: 1.25;
}

.talent-rule-lines {
  display: grid;
  gap: 3px;
  padding: 0 6px 4px;
}

.talent-rule-line {
  display: grid;
  grid-template-columns: minmax(58px, 0.18fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(214, 177, 118, 0.2);
  border-radius: 3px;
  background: rgba(18, 12, 9, 0.52);
  font-size: 0.6rem;
  line-height: 1.22;
}

.talent-rule-line strong {
  min-width: 0;
  padding: 3px 5px;
  color: #24170f;
  background: #d8bd82;
  font-weight: 840;
  text-transform: uppercase;
}

.talent-rule-line em {
  min-width: 0;
  padding: 3px 5px;
  color: #f2e2c8;
  font-style: normal;
  white-space: normal;
}

.talent-rank-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 0 5px;
}

.talent-rank-row span {
  border: 1px solid rgba(214, 177, 118, 0.18);
  border-radius: 4px;
  padding: 2px 5px;
  color: #e8d7bd;
  background: rgba(22, 16, 13, 0.62);
  font-size: 0.52rem;
}

.talent-row-controls {
  align-items: center;
  padding-top: 1px;
}

.talent-rank-row strong,
.talent-rank-setter strong {
  color: var(--muted);
  text-transform: uppercase;
}

.talent-rank-setter {
  display: inline-grid;
  grid-template-columns: 44px;
  align-items: center;
  border: 1px solid rgba(214, 177, 118, 0.18);
  border-radius: 4px;
  padding: 2px;
  color: #e8d7bd;
  background: rgba(22, 16, 13, 0.62);
  font-size: 0.56rem;
}

.talent-rank-setter input {
  width: 44px;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 4px;
  color: var(--ink);
  background: #120d0b;
  font: inherit;
  text-align: center;
}

.talent-card > .talent-actions {
  padding: 0 5px 5px;
}

.talent-matrix {
  grid-template-columns: 42px repeat(var(--lane-count), minmax(245px, 1fr));
  min-width: calc(42px + var(--lane-count) * 245px);
}

.talent-matrix-cell {
  min-height: 48px;
}

.editor-page {
  display: grid;
  gap: 8px;
}

.editor-dataset-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.editor-dataset-tab {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 7px;
  color: var(--muted);
  background: rgba(28, 20, 16, 0.78);
  cursor: pointer;
  font-size: 0.66rem;
  text-transform: uppercase;
}

.editor-dataset-tab.is-active {
  color: #fff2dc;
  border-color: rgba(214, 165, 82, 0.62);
  background: linear-gradient(180deg, rgba(103, 70, 31, 0.58), rgba(35, 24, 18, 0.94));
}

.editor-dataset-tab span {
  display: inline-grid;
  min-width: 20px;
  min-height: 18px;
  place-items: center;
  border-radius: 3px;
  color: #20140d;
  background: #d9c5a2;
  font-weight: 860;
}

.editor-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(128px, auto) repeat(5, auto);
  gap: 6px;
  align-items: center;
}

.editor-toolbar input {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 8px;
  color: var(--ink);
  background: #120d0b;
}

.editor-save-status {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(214, 177, 118, 0.32);
  border-radius: 4px;
  padding: 4px 7px;
  color: rgba(232, 213, 183, 0.72);
  background: rgba(31, 22, 18, 0.74);
  font-size: 0.68rem;
  font-weight: 780;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
}

.editor-save-status.ok {
  color: #2a190a;
  border-color: rgba(255, 221, 151, 0.6);
  background: linear-gradient(180deg, #f0d18d, #c8933d);
}

.editor-save-status.danger {
  color: #fff0eb;
  border-color: rgba(240, 156, 146, 0.72);
  background: #8e342d;
}

.editor-save-status.idle {
  color: rgba(232, 213, 183, 0.62);
}

.editor-validation-row {
  display: flex;
  gap: 7px;
  align-items: center;
  border: 1px solid rgba(240, 156, 146, 0.5);
  border-radius: 4px;
  margin-bottom: 8px;
  padding: 7px 8px;
  color: #ffd8cf;
  background: rgba(86, 29, 24, 0.46);
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.25;
}

.editor-validation-row strong {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #2a100c;
  background: #f09c92;
  font-weight: 900;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.34fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.editor-record-list {
  display: grid;
  gap: 4px;
  max-height: calc(100vh - 290px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  background: rgba(22, 16, 13, 0.72);
}

.editor-list-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.editor-record-button {
  display: grid;
  gap: 2px;
  width: 100%;
  border: 1px solid rgba(95, 77, 64, 0.78);
  border-radius: 4px;
  padding: 6px 7px;
  color: #e8d7bd;
  background: rgba(31, 22, 18, 0.78);
  cursor: pointer;
  text-align: left;
}

.editor-record-button.is-active {
  border-color: rgba(61, 136, 188, 0.76);
  background: rgba(42, 73, 92, 0.42);
}

.editor-record-button strong {
  overflow: hidden;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-record-button span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-detail {
  min-width: 0;
}

.editor-card-heading {
  align-items: start;
}

.editor-required-row,
.editor-token-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 7px;
}

.editor-required-row span,
.token-button {
  border: 1px solid rgba(214, 177, 118, 0.26);
  border-radius: 3px;
  padding: 3px 5px;
  color: #e9d9bf;
  background: rgba(22, 16, 13, 0.74);
  font-size: 0.58rem;
  font-weight: 760;
}

.token-button {
  cursor: pointer;
}

.editor-field-block {
  display: grid;
  gap: 6px;
}

.editor-field-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 780;
  text-transform: uppercase;
}

.editor-field-heading em {
  font-style: normal;
  font-weight: 600;
  text-transform: none;
}

.editor-attribute-grid,
.editor-attribute-list {
  display: grid;
  gap: 5px;
}

.editor-attribute-field {
  grid-template-columns: minmax(64px, 0.8fr) minmax(54px, 0.55fr) auto;
  align-items: stretch;
  overflow: hidden;
}

.editor-attribute-field .small-action {
  border-radius: 0;
  box-shadow: none;
}

.editor-attribute-add {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 5px;
}

.editor-attribute-add select {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 7px;
  color: var(--ink);
  background: #120d0b;
}

.editor-short-info-list {
  display: grid;
  gap: 5px;
}

.editor-short-info-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.28fr) minmax(180px, 1fr) auto;
  gap: 5px;
  align-items: stretch;
}

.editor-short-info-row input {
  min-width: 0;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 8px;
  color: var(--ink);
  background: #120d0b;
  font: inherit;
}

.editor-combat-info-grid,
.editor-range-info-grid,
.editor-rank-cost-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 6px;
}

.editor-combat-info-grid .wide-field,
.editor-range-info-grid .wide-field,
.editor-rank-cost-grid .wide-field {
  grid-column: 1 / -1;
}

.editor-rank-upgrade-list {
  display: grid;
  gap: 5px;
}

.editor-rank-upgrade-row {
  display: grid;
  grid-template-columns: minmax(72px, 0.25fr) minmax(90px, 1fr) auto;
  gap: 5px;
  align-items: center;
}

.editor-rank-upgrade-row span {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.editor-rank-upgrade-row input {
  min-width: 0;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 8px;
  color: var(--ink);
  background: #120d0b;
  font: inherit;
}

.editor-form textarea {
  min-height: 96px;
  resize: vertical;
}

.editor-form textarea.has-error {
  border-color: #bf5041;
  box-shadow: 0 0 0 1px rgba(191, 80, 65, 0.35);
}

.editor-check-field {
  display: grid;
  grid-template-columns: minmax(112px, 0.28fr) minmax(0, 1fr);
  align-items: stretch;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0;
  color: var(--ink);
  background: rgba(22, 16, 13, 0.74);
  font-size: 0.72rem;
  font-weight: 780;
  overflow: hidden;
}

.editor-check-control {
  display: flex;
  align-items: center;
  padding: 6px 9px;
  background: #100b09;
}

.editor-check-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.editor-json-preview textarea {
  width: 100%;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px;
  color: #e8d7bd;
  background: #100b09;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
}

.editor-reference-panel {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.editor-reference-grid {
  display: grid;
  gap: 5px;
}

.editor-reference-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.65fr) minmax(220px, 1fr) auto;
  gap: 7px;
  align-items: center;
  border: 1px solid rgba(214, 177, 118, 0.2);
  border-radius: 5px;
  padding: 6px 7px;
  background: rgba(22, 16, 13, 0.66);
}

.editor-reference-row .row-note {
  white-space: normal;
}

.story-grid textarea {
  min-height: 96px;
}

.story-grid-two textarea {
  min-height: 84px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #130e0c;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #3b2e27;
  color: #d1c2ac;
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  color: #eadbc4;
  background: rgba(31, 24, 20, 0.62);
}

.matrix-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.matrix-wrap {
  background:
    linear-gradient(90deg, rgba(214, 165, 82, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(214, 165, 82, 0.028) 1px, transparent 1px),
    #130e0c;
  background-size: 46px 46px;
}

.matrix-table {
  min-width: 1040px;
}

.attributes-matrix {
  min-width: 820px;
}

.skills-matrix {
  min-width: 620px;
}

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

.stats-column,
.stats-page .card {
  min-width: 0;
}

.stats-page .card {
  height: auto;
}

.stats-page .table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
}

.stats-page .matrix-table {
  min-width: 0;
  table-layout: fixed;
}

.stats-page .skills-matrix {
  min-width: 0;
}

.stats-page .attributes-matrix {
  min-width: 0;
}

.stats-page .matrix-table th,
.stats-page .matrix-table td {
  min-width: 0;
  padding: 5px 6px;
}

.stats-page .matrix-table thead th {
  overflow-wrap: anywhere;
  font-size: 0.58rem;
  line-height: 1.05;
}

.stats-page .matrix-table th:first-child,
.stats-page .matrix-table td:first-child {
  min-width: 0;
}

.stats-page .skills-matrix th:nth-child(1),
.stats-page .skills-matrix td:nth-child(1) {
  width: 40%;
}

.stats-page .skills-matrix th:nth-child(2),
.stats-page .skills-matrix td:nth-child(2) {
  width: 17%;
}

.stats-page .skills-matrix th:nth-child(3),
.stats-page .skills-matrix td:nth-child(3) {
  width: 25%;
}

.stats-page .skills-matrix th:nth-child(4),
.stats-page .skills-matrix td:nth-child(4) {
  width: 18%;
}

.stats-page .attributes-matrix th:nth-child(1),
.stats-page .attributes-matrix td:nth-child(1) {
  width: 31%;
}

.stats-page .attributes-matrix th:nth-child(2),
.stats-page .attributes-matrix td:nth-child(2) {
  width: 15%;
}

.stats-page .attributes-matrix th:nth-child(3),
.stats-page .attributes-matrix td:nth-child(3) {
  width: 27%;
}

.stats-page .attributes-matrix th:nth-child(4),
.stats-page .attributes-matrix td:nth-child(4),
.stats-page .attributes-matrix th:nth-child(5),
.stats-page .attributes-matrix td:nth-child(5) {
  width: 13.5%;
}

.stats-page .matrix-number-input {
  width: min(52px, 100%);
}

.stats-page .source-tooltip-wrap {
  width: 22px;
  height: 22px;
}

.stats-page .source-icon {
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
}

.stats-page .source-popover {
  display: none;
}

.stats-page .source-tooltip-wrap:hover .source-popover,
.stats-page .source-tooltip-wrap:focus .source-popover,
.stats-page .source-tooltip-wrap:focus-within .source-popover {
  display: grid;
}

.matrix-table th,
.matrix-table td {
  min-width: 86px;
  border-right: 1px dotted rgba(25, 32, 29, 0.28);
  text-align: center;
}

.matrix-table th:first-child,
.matrix-table td:first-child {
  min-width: 150px;
  text-align: left;
}

.matrix-table thead th {
  background: #46382e;
  color: #f0dfc7;
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 820;
  text-transform: none;
}

.matrix-number-input {
  width: 76px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 7px;
  color: var(--ink);
  background: #120d0b;
  font: inherit;
  text-align: center;
}

.matrix-number-input:focus {
  border-color: var(--gold);
  outline: 0;
}

.matrix-main-row th,
.skills-matrix tbody th {
  color: #fff0d8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-style: normal;
}

.matrix-name-block {
  display: flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgba(25, 16, 12, 0.78);
  border-radius: 4px;
  padding: 5px 8px;
  color: #fff0d8;
  background: linear-gradient(180deg, #4e3b2f, #35281f);
  font-size: 0.73rem;
  font-weight: 760;
  line-height: 1.1;
  text-transform: uppercase;
}

.summary-cell {
  color: #fff3df;
  font-size: 0.94rem;
  font-weight: 900;
}

.summary-cell strong {
  display: block;
  color: #fff3df;
}

.summary-breakdown {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
}

.empty-cell {
  color: transparent;
}

.review-cell {
  background: rgba(143, 47, 69, 0.08);
}

.needs-review-row .summary-cell {
  color: var(--wine);
}

.matrix-detail-row td {
  padding: 10px 12px 14px;
  background: rgba(21, 15, 13, 0.72);
  text-align: left;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: 12px;
}

.reference-list {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.attributes-matrix .matrix-main-row:nth-of-type(4n + 1) {
  background: rgba(127, 47, 29, 0.2);
}

.attributes-matrix .matrix-main-row:nth-of-type(4n + 3) {
  background: rgba(61, 136, 188, 0.12);
}

.feature-band th,
.feature-band td {
  border-top: 2px solid rgba(226, 207, 171, 0.18);
  padding: 5px 6px;
  text-align: center;
}

.feature-band .feature-name-block {
  border-color: rgba(124, 152, 66, 0.52);
  color: #f5dfb9;
  background:
    linear-gradient(90deg, rgba(124, 152, 66, 0.24), transparent 76%),
    linear-gradient(180deg, #4a3d2f, #2e251d);
}

.feature-band td:empty {
  background: rgba(18, 13, 11, 0.36);
}

.skill-physique {
  background: rgba(143, 47, 69, 0.2);
}

.skill-consciousness {
  background: rgba(205, 91, 74, 0.18);
}

.skill-perception {
  background: rgba(89, 122, 56, 0.2);
}

.skill-charisma {
  background: rgba(69, 133, 172, 0.2);
}

.skill-intelligence {
  background: rgba(181, 139, 42, 0.2);
}

.detail-drawer {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 9px;
  background: rgba(20, 14, 12, 0.78);
}

.detail-drawer summary {
  cursor: pointer;
  color: var(--gold);
  font-weight: 900;
}

.skill-detail-card {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 7px;
  color: #eadbc4;
  background: #30251f;
  font-size: 0.74rem;
}

.inline-number-field {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.75rem;
  font-weight: 800;
}

.inline-number-field input {
  width: 52px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 6px;
  color: var(--ink);
  background: #120d0b;
  font: inherit;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  color: #d5c6b1;
  background: #30251f;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.ok {
  color: #a9d2f0;
  border-color: rgba(61, 136, 188, 0.52);
}

.badge.warn,
.mini-warning {
  color: #f09c92;
  border-color: rgba(182, 65, 55, 0.52);
}

.badge.fixed {
  color: #ffd68e;
  border-color: rgba(214, 165, 82, 0.54);
}

.mini-warning {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 4px;
}

.source-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 6px;
  background: rgba(32, 24, 20, 0.86);
  font-size: 0.72rem;
}

.source-chip strong {
  font-size: 0.8rem;
}

.source-chip em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
}

.source-chip.needs-review {
  border-color: rgba(143, 47, 69, 0.34);
  background: rgba(143, 47, 69, 0.08);
}

.source-tooltip-cell {
  position: relative;
  overflow: visible;
  text-align: center;
}

.source-tooltip-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  outline: 0;
}

.source-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid rgba(226, 207, 171, 0.62);
  border-radius: 50%;
  color: #231710;
  background: linear-gradient(180deg, #f3dfb7, #b99055);
  font-size: 0.78rem;
  font-weight: 820;
  line-height: 1;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.28), 0 2px 8px rgba(0, 0, 0, 0.22);
}

.source-popover {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  z-index: 30;
  display: grid;
  width: max-content;
  min-width: 210px;
  max-width: 280px;
  gap: 4px;
  border: 1px solid #7a624f;
  border-radius: 5px;
  padding: 7px;
  color: #eadbc4;
  background:
    linear-gradient(180deg, rgba(255, 239, 204, 0.06), transparent 48px),
    #18110e;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.46), inset 0 1px rgba(255, 238, 203, 0.08);
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translate(-50%, 4px);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.source-popover::before {
  position: absolute;
  top: -5px;
  left: calc(50% - 5px);
  width: 9px;
  height: 9px;
  border-top: 1px solid #7a624f;
  border-left: 1px solid #7a624f;
  background: #18110e;
  content: "";
  transform: rotate(45deg);
}

.source-tooltip-wrap:hover .source-popover,
.source-tooltip-wrap:focus .source-popover,
.source-tooltip-wrap:focus-within .source-popover {
  opacity: 1;
  transform: translate(-50%, 0);
}

.source-popover > strong {
  color: #f5dfb9;
  font-size: 0.64rem;
  font-weight: 780;
  text-transform: uppercase;
}

.source-tooltip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 22px;
  border-top: 1px solid rgba(113, 90, 73, 0.42);
  padding-top: 4px;
}

.source-tooltip-name {
  min-width: 0;
  overflow: hidden;
  color: #d7c8b3;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-tooltip-value {
  min-width: 38px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 0.72rem;
  font-weight: 820;
  text-align: center;
}

.source-tooltip-value.race {
  color: #1f3324;
  background: #c8d9a0;
}

.source-tooltip-value.way {
  color: #172c3a;
  background: #a9d2f0;
}

.source-tooltip-value.gear {
  color: #322211;
  background: #e3b96f;
}

.source-tooltip-value.ability {
  color: #351916;
  background: #e6a09a;
}

.source-tooltip-value.origin {
  color: #332211;
  background: #e4c98f;
}

.source-tooltip-value.feature {
  color: #1f3324;
  background: #b9cf85;
}

.source-tooltip-value.skill {
  color: #162a34;
  background: #9fc5d8;
}

.source-tooltip-value.condition {
  color: #351916;
  background: #d9877f;
}

.source-tooltip-value.manual,
.source-tooltip-value.other {
  color: #24170f;
  background: #d9c5a2;
}

.source-empty {
  color: rgba(234, 219, 196, 0.38);
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(160px, auto));
  gap: 6px;
  margin-bottom: 8px;
}

.searchbar input,
.searchbar select {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 8px;
  color: var(--ink);
  background: #120d0b;
}

.description {
  max-width: 74ch;
  white-space: pre-line;
}

.rule-link {
  color: #ffd68e;
  font-weight: 800;
  text-decoration: none;
}

.small-action {
  border: 1px solid #c38b41;
  border-radius: 3px;
  padding: 4px 7px;
  color: #fff1d7;
  background:
    linear-gradient(180deg, rgba(255, 226, 160, 0.22), transparent 48%),
    linear-gradient(180deg, #8d4a1b, #592512);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 780;
  text-transform: uppercase;
  box-shadow: inset 0 1px rgba(255, 238, 201, 0.22), 0 2px 0 rgba(0, 0, 0, 0.32);
}

.small-action.danger {
  border-color: #bf5041;
  background:
    linear-gradient(180deg, rgba(255, 209, 181, 0.16), transparent 48%),
    linear-gradient(180deg, #9f3d32, #592018);
}

.small-action.ghost {
  color: #ffd68e;
  background: rgba(31, 22, 18, 0.78);
}

.small-action.danger.ghost {
  color: #f09c92;
  background: rgba(31, 22, 18, 0.78);
}

.ability-page {
  display: grid;
  gap: 8px;
}

.ability-toolbar {
  display: grid;
  gap: 14px;
}

.ability-toolbar .progression-card {
  box-shadow: none;
  background: rgba(27, 20, 17, 0.72);
}

.ability-lanes {
  display: grid;
  gap: 18px;
}

.ability-matrix-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(19, 14, 12, 0.88);
  box-shadow: var(--shadow);
}

.ability-matrix {
  display: grid;
  grid-template-columns: 46px repeat(var(--lane-count), minmax(260px, 1fr));
  min-width: calc(46px + var(--lane-count) * 260px);
}

.ability-matrix-head,
.level-row-label,
.ability-matrix-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ability-matrix-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  gap: 2px;
  min-height: 50px;
  padding: 6px;
  background: #3b2e27;
}

.ability-matrix-head strong {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
}

.ability-matrix-head span:last-child {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.level-head,
.level-row-label {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #241b17;
}

.level-row-label {
  display: grid;
  place-items: start center;
  padding-top: 9px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
}

.ability-matrix-cell {
  display: grid;
  align-content: stretch;
  gap: 3px;
  min-height: 52px;
  padding: 4px;
}

.ability-matrix-cell > .ability-node,
.ability-matrix-cell > .ability-slot.empty-slot {
  height: 100%;
}

.ability-matrix-head.lane-teal,
.ability-matrix-cell.lane-teal {
  background: rgba(61, 136, 188, 0.09);
}

.ability-matrix-head.lane-moss,
.ability-matrix-cell.lane-moss {
  background: rgba(124, 152, 66, 0.1);
}

.ability-matrix-head.lane-wine,
.ability-matrix-cell.lane-wine {
  background: rgba(182, 65, 55, 0.08);
}

.ability-slot.empty-slot {
  display: grid;
  min-height: 36px;
  place-items: center;
  border: 1px dashed rgba(214, 165, 82, 0.22);
  border-radius: 5px;
  color: rgba(234, 219, 196, 0.28);
}

.ability-lane {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: rgba(27, 20, 17, 0.84);
  box-shadow: var(--shadow);
}

.ability-lane.lane-teal {
  border-top: 6px solid var(--teal);
}

.ability-lane.lane-wine {
  border-top: 6px solid var(--wine);
}

.ability-lane.lane-moss {
  border-top: 6px solid var(--moss);
}

.ability-lane.lane-neutral {
  border-top: 6px solid var(--muted);
}

.lane-header h2 {
  margin-bottom: 0;
}

.lane-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.lane-counts span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--panel-2);
}

.level-rail {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 0;
}

.rail-dot {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: var(--panel);
  font-size: 0.76rem;
  font-weight: 900;
}

.rail-dot.granted {
  color: var(--ink);
  border-color: rgba(181, 139, 42, 0.44);
  background: rgba(181, 139, 42, 0.16);
}

.rail-dot.selected {
  color: white;
  border-color: var(--gold);
  background: #7f2f1d;
}

.rail-dot.available {
  color: #a9d2f0;
  border-color: rgba(61, 136, 188, 0.52);
  background: rgba(61, 136, 188, 0.14);
}

.rail-dot.locked {
  color: var(--muted);
  background: rgba(25, 32, 29, 0.06);
}

.ability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.ability-node {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0;
  background: linear-gradient(180deg, rgba(65, 51, 42, 0.9), rgba(29, 22, 18, 0.96));
  overflow: visible;
}

.ability-row-line {
  display: grid;
  grid-template-columns: minmax(126px, 1fr) 24px minmax(64px, 0.5fr) 28px;
  align-items: stretch;
  min-height: 27px;
}

.ability-name-cell {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 1px;
  padding: 3px 6px;
  color: #f3e7d3;
  background: linear-gradient(180deg, rgba(74, 56, 44, 0.88), rgba(52, 38, 30, 0.9));
}

.ability-name-cell strong {
  overflow: hidden;
  font-size: 0.68rem;
  font-weight: 760;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ability-name-cell em {
  overflow: hidden;
  color: rgba(232, 213, 183, 0.72);
  font-size: 0.52rem;
  font-style: normal;
  font-weight: 680;
  line-height: 1.08;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.ability-bonus-cell {
  display: block;
  min-width: 0;
  overflow: hidden;
  align-self: stretch;
  padding: 6px 5px 3px;
  color: rgba(243, 231, 211, 0.84);
  background: rgba(34, 25, 20, 0.42);
  font-size: 0.6rem;
  line-height: 1.18;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ability-cost-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  position: relative;
  padding: 4px 3px;
  color: #f6e7c8;
  background: rgba(34, 25, 20, 0.86);
  border-left: 1px solid rgba(214, 177, 118, 0.18);
  font-size: 0.58rem;
  font-weight: 820;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.has-tooltip {
  position: relative;
  overflow: visible;
}

.has-tooltip:hover,
.has-tooltip:focus,
.has-tooltip:focus-within {
  z-index: 90;
}

.has-tooltip[data-tooltip]:hover::after,
.has-tooltip[data-tooltip]:focus::after,
.has-tooltip[data-tooltip]:focus-within::after {
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  z-index: 100;
  width: max-content;
  max-width: min(380px, 72vw);
  padding: 7px 8px;
  border: 1px solid rgba(229, 198, 143, 0.72);
  border-radius: 4px;
  color: #fff3dc;
  background: rgba(18, 12, 9, 0.97);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.42);
  content: attr(data-tooltip);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.28;
  text-align: left;
  text-transform: none;
  white-space: normal;
  pointer-events: none;
}

body.has-floating-tooltips [data-tooltip]::after {
  display: none !important;
}

.floating-tooltip {
  position: fixed;
  z-index: 100000;
  width: max-content;
  max-width: min(420px, calc(100vw - 16px));
  padding: 7px 8px;
  border: 1px solid rgba(229, 198, 143, 0.78);
  border-radius: 4px;
  color: #fff3dc;
  background: rgba(18, 12, 9, 0.98);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.3;
  text-align: left;
  text-transform: none;
  white-space: normal;
  pointer-events: none;
}

.floating-tooltip[hidden] {
  display: none;
}

.ability-cost-cell.free {
  color: #23180f;
  background: linear-gradient(180deg, #f3ddb0, #cfae72);
}

.ability-type-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  background: rgba(21, 15, 13, 0.38);
}

.ability-type-icon {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  color: #25180f;
  background: #d9c5a2;
  font-size: 0.62rem;
  font-weight: 860;
  line-height: 1;
}

.ability-type-icon.maneuver {
  color: #f9e9dd;
  border-color: rgba(211, 97, 72, 0.58);
  background: #9a3a29;
}

.ability-type-icon.action {
  color: #eaf7ff;
  border-color: rgba(94, 163, 203, 0.6);
  background: #2f789f;
}

.ability-type-icon.passive {
  color: #f4ffe6;
  border-color: rgba(124, 152, 66, 0.62);
  background: #5f7f2f;
}

.ability-type-icon.upgrade {
  color: #2d1c10;
  border-color: rgba(214, 165, 82, 0.66);
  background: #d6a552;
}

.ability-type-icon.unique {
  color: #fff2fa;
  border-color: rgba(177, 116, 204, 0.7);
  background: #7f4b9e;
}

.ability-state-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  background: rgba(21, 15, 13, 0.42);
}

.ability-description-line {
  display: block;
  margin: 0;
  padding: 4px 8px 7px;
  color: rgba(247, 234, 213, 0.82);
  font-size: 0.66rem;
  line-height: 1.3;
  white-space: pre-line;
}

.ability-short-info {
  display: grid;
  gap: 3px;
  padding: 3px 6px 0;
}

.ability-short-chip {
  display: grid;
  grid-template-columns: minmax(54px, 0.28fr) minmax(0, 1fr);
  position: relative;
  overflow: visible;
  border: 1px solid rgba(214, 177, 118, 0.18);
  border-radius: 3px;
  background: rgba(22, 15, 12, 0.58);
  font-size: 0.61rem;
  line-height: 1.22;
}

.ability-short-chip strong {
  min-width: 0;
  padding: 3px 5px;
  color: #26170f;
  background: #d8bd82;
  font-weight: 840;
  text-transform: uppercase;
}

.ability-short-chip em {
  min-width: 0;
  overflow: hidden;
  padding: 3px 5px;
  color: #f3e7d3;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ability-short-chip:hover,
.ability-cost-cell:hover,
.ability-range-icon:hover,
.ability-type-icon:hover,
.ability-state-icon:hover,
.talent-source-icon:hover,
.talent-effect-chip:hover {
  z-index: 30;
}

.ability-short-chip[data-tooltip]:hover::after,
.ability-short-chip[data-tooltip]:focus-within::after,
.ability-cost-cell[data-tooltip]:hover::after,
.ability-cost-cell[data-tooltip]:focus-within::after {
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  z-index: 50;
  width: min(360px, 72vw);
  padding: 7px 8px;
  border: 1px solid rgba(229, 198, 143, 0.72);
  border-radius: 4px;
  color: #fff3dc;
  background: rgba(18, 12, 9, 0.97);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.42);
  content: attr(data-tooltip);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.28;
  text-align: left;
  text-transform: none;
  white-space: normal;
  pointer-events: none;
}

.ability-range-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
  padding: 3px 6px 0;
}

.ability-range-icon {
  display: inline-grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid rgba(218, 190, 146, 0.32);
  border-radius: 3px;
  color: #f2dfbd;
  background: rgba(55, 43, 34, 0.72);
  font-size: 0.54rem;
  font-weight: 820;
  line-height: 1;
}

.ability-range-icon.aoe {
  color: #2b1c12;
  background: #d4a35a;
}

.ability-range-icon.self {
  color: #183028;
  background: #a9c97c;
}

.ability-range-icon.targets {
  color: #1c2733;
  background: #9ec0dc;
}

.ability-node.type-maneuver {
  border-left: 3px solid #9a3a29;
}

.ability-node.type-action {
  border-left: 3px solid #2f789f;
}

.ability-node.type-passive {
  border-left: 3px solid #6f8f37;
}

.ability-node.type-upgrade {
  border-left: 3px solid #d6a552;
}

.ability-node.type-unique {
  border-left: 3px solid #7f4b9e;
}

.ability-state-icon {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  color: #231710;
  background: #d9c5a2;
  font-size: 0.68rem;
  font-weight: 820;
  line-height: 1;
}

.ability-state-icon.selected {
  color: #2a190a;
  border-color: rgba(255, 221, 151, 0.72);
  background: #e8b75d;
}

.ability-state-icon.granted {
  color: #27190d;
  border-color: rgba(241, 196, 111, 0.6);
  background: #f1c46f;
}

.ability-state-icon.available {
  color: #24170f;
  border-color: rgba(77, 49, 29, 0.36);
  background: #f4dfb8;
}

.ability-state-icon.locked {
  color: #fff0eb;
  border-color: rgba(240, 156, 146, 0.72);
  background: #b64137;
}

.ability-node.granted {
  border-color: rgba(238, 194, 108, 0.78);
  background: linear-gradient(180deg, rgba(96, 67, 30, 0.5), rgba(29, 22, 18, 0.97));
  box-shadow: inset 3px 0 0 rgba(238, 194, 108, 0.9);
}

.ability-node.granted .ability-name-cell {
  color: #26180d;
  background: linear-gradient(180deg, #efd08c, #c99038);
}

.ability-node.granted .ability-name-cell em {
  color: rgba(38, 24, 13, 0.7);
}

.ability-node.selected {
  border-color: rgba(238, 194, 108, 0.82);
  background: linear-gradient(180deg, rgba(88, 67, 36, 0.5), rgba(29, 22, 18, 0.97));
  box-shadow: inset 3px 0 0 rgba(238, 194, 108, 0.92);
}

.ability-node.available {
  border-color: rgba(187, 161, 118, 0.54);
  color: #d8c7aa;
  background: linear-gradient(180deg, rgba(56, 45, 35, 0.8), rgba(28, 21, 17, 0.94));
  box-shadow: none;
}

.ability-node.available .ability-name-cell {
  color: #ead9bc;
  background: linear-gradient(180deg, rgba(79, 63, 47, 0.82), rgba(53, 40, 31, 0.88));
}

.ability-node.available .ability-name-cell em {
  color: rgba(224, 204, 171, 0.62);
}

.ability-node.available .ability-bonus-cell {
  color: rgba(224, 204, 171, 0.74);
  background: rgba(31, 23, 19, 0.36);
}

.ability-node.available .ability-description-line {
  color: rgba(224, 204, 171, 0.72);
}

.ability-node.available .ability-state-cell {
  background: rgba(91, 65, 38, 0.16);
}

.ability-node.available .badge.ok {
  color: #3a2618;
  border-color: rgba(77, 49, 29, 0.38);
  background: rgba(255, 247, 225, 0.56);
}

.ability-node.available h3,
.ability-node.available .ability-full-text,
.ability-node.available .ability-meta,
.ability-node.available .requirement,
.ability-node.available .table-note,
.ability-node.available .level-token {
  color: #dcc9aa;
}

.ability-node.available .ability-meta span,
.ability-node.available .requirement,
.ability-node.available .source-chip {
  border-color: rgba(77, 49, 29, 0.3);
  background: rgba(255, 247, 225, 0.45);
}

.ability-node.upgrade-node {
  border-style: dashed;
}

.ability-node.locked {
  color: var(--muted);
  background: rgba(31, 24, 20, 0.74);
}

.ability-node.locked .ability-name-cell {
  color: #b9ad9c;
  background: linear-gradient(180deg, #4b4037, #302721);
}

.ability-node.locked .ability-name-cell em,
.ability-node.locked .ability-bonus-cell {
  color: #998c7b;
}

.level-token {
  border-radius: 4px;
  padding: 2px 6px;
  color: #1b120e;
  background: var(--gold);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.ability-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ability-meta span,
.requirement {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 5px;
  background: var(--panel-2);
}

.requirement {
  width: max-content;
  max-width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.upgrade-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.ability-point-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.ability-point-strip span {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 7px;
  background: rgba(31, 22, 18, 0.78);
}

.ability-summary {
  display: -webkit-box;
  max-height: 5.8em;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.ability-full-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
  white-space: pre-line;
}

.ability-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  justify-content: flex-start;
  min-height: 24px;
}

.ability-footer-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: auto;
  padding: 4px 6px 6px;
}

.ability-status-text {
  min-width: 0;
  color: rgba(232, 213, 183, 0.64);
  font-size: 0.56rem;
  font-weight: 760;
  line-height: 1.1;
  text-align: right;
  text-transform: uppercase;
}

.ability-node.selected .ability-status-text,
.ability-node.granted .ability-status-text {
  color: rgba(245, 212, 142, 0.88);
}

.ability-node.available .ability-status-text {
  color: rgba(224, 204, 171, 0.58);
}

.ability-node.locked .ability-status-text {
  color: rgba(240, 156, 146, 0.86);
}

.adventure-hero {
  display: grid;
  gap: 8px;
}

.adventure-title {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.adventure-title h2 {
  margin: 0;
  font-size: 1.15rem;
  text-transform: none;
}

.adventure-attribute-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 5px;
}

.adventure-attribute {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #6e5948;
  border-radius: 4px;
  padding: 5px 7px;
  background: rgba(20, 14, 12, 0.66);
}

.adventure-attribute span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 780;
  text-transform: uppercase;
}

.adventure-attribute strong {
  color: #fff2dc;
  font-size: 0.94rem;
}

.adventure-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr) minmax(220px, 0.58fr);
  gap: 8px;
}

.war-page {
  gap: 8px;
}

.war-hero {
  padding-bottom: 9px;
}

.war-attribute-grid {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.war-attribute-grid .adventure-attribute {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.war-attribute-grid .adventure-attribute span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.war-action-board,
.war-maneuver-board {
  display: grid;
  gap: 8px;
}

.war-action-board {
  grid-template-columns: minmax(210px, 1.05fr) repeat(4, minmax(170px, 1fr));
}

.war-maneuver-board {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.war-action-column,
.war-maneuver-column {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(64, 48, 38, 0.82), rgba(24, 17, 14, 0.96));
  overflow: hidden;
}

.war-action-column header {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.32);
}

.war-action-column header span {
  display: grid;
  gap: 1px;
}

.war-action-column header strong {
  color: #24160f;
  font-size: 0.78rem;
  font-weight: 860;
  text-transform: uppercase;
}

.war-action-column header em {
  color: rgba(35, 22, 15, 0.78);
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 780;
  text-transform: uppercase;
}

.war-action-column header b {
  color: #24160f;
  font-size: 0.68rem;
}

.war-action-column.tone-red header {
  background: #d88a8a;
}

.war-action-column.tone-blue header {
  background: #9fbce8;
}

.war-action-column.tone-green header {
  background: #a9ca98;
}

.war-action-column.tone-gray header {
  background: #b7b7b7;
}

.war-action-column.tone-common header {
  background: #d7bc84;
}

.war-common-column .war-basic-actions {
  align-content: start;
}

.war-style-picker {
  display: grid;
  grid-template-columns: auto minmax(150px, 210px);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 6px 5px 9px;
  background: rgba(15, 10, 8, 0.52);
}

.war-style-picker span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 840;
  text-transform: uppercase;
}

.war-style-picker select {
  min-height: 30px;
  border: 1px solid #6a5242;
  border-radius: 4px;
  padding: 3px 8px;
  color: var(--text);
  background: rgba(9, 6, 5, 0.72);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 760;
}

.war-style-summary {
  display: grid;
  min-width: min(360px, 100%);
  max-width: 520px;
  gap: 2px;
  border: 1px solid rgba(214, 177, 118, 0.38);
  border-radius: 5px;
  padding: 6px 8px;
  background: rgba(15, 10, 8, 0.52);
}

.war-style-summary strong {
  color: #fff2dc;
  font-size: 0.76rem;
  font-weight: 840;
}

.war-style-summary span,
.war-style-summary em {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 720;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.war-basic-actions,
.war-column-list,
.war-maneuver-list {
  display: grid;
  gap: 5px;
  padding: 6px;
}

.war-basic-action {
  border: 1px solid rgba(59, 45, 36, 0.7);
  border-radius: 4px;
  padding: 5px 6px;
  background: rgba(245, 231, 210, 0.72);
  color: #20140e;
}

.war-basic-action strong {
  display: block;
  font-size: 0.65rem;
  font-weight: 860;
  text-align: center;
}

.war-basic-action p,
.war-ability-card p {
  margin: 2px 0 0;
  font-size: 0.68rem;
  line-height: 1.34;
}

.war-ability-card {
  border: 1px solid rgba(214, 177, 118, 0.28);
  border-radius: 4px;
  padding: 0;
  background: rgba(24, 16, 13, 0.78);
  overflow: visible;
}

.war-ability-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  padding: 5px 6px;
  background: rgba(58, 45, 36, 0.78);
}

.war-ability-head strong {
  overflow: hidden;
  color: #fff3df;
  font-size: 0.66rem;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.war-ability-head span,
.war-cost-line {
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 720;
  text-transform: uppercase;
}

.war-cost-line {
  padding: 4px 6px 0;
}

.war-ability-card p {
  padding: 5px 7px 7px;
  color: rgba(244, 230, 208, 0.84);
}

.war-ability-card.type-action {
  border-left: 3px solid #2f789f;
}

.war-ability-card.style-action {
  border-color: rgba(231, 196, 125, 0.66);
  background: rgba(45, 31, 21, 0.9);
}

.war-ability-card.style-action .war-ability-head {
  background: linear-gradient(90deg, rgba(218, 164, 58, 0.9), rgba(77, 50, 30, 0.86));
}

.war-ability-card.signature-action {
  border-color: rgba(157, 93, 200, 0.72);
}

.war-ability-card.signature-action .war-ability-head {
  background: rgba(82, 50, 103, 0.8);
}

.war-ability-card.type-unique {
  border-left: 3px solid #7f4b9e;
}

.war-ability-card.maneuver-standard,
.war-maneuver-column.tone-blue {
  border-color: rgba(76, 137, 202, 0.5);
}

.war-ability-card.maneuver-overpower,
.war-maneuver-column.tone-red {
  border-color: rgba(202, 91, 76, 0.5);
}

.war-ability-card.maneuver-counter,
.war-maneuver-column.tone-green {
  border-color: rgba(118, 159, 82, 0.5);
}

.war-ability-card.maneuver-standard .war-ability-head {
  background: rgba(50, 89, 128, 0.76);
}

.war-ability-card.maneuver-overpower .war-ability-head {
  background: rgba(128, 55, 45, 0.78);
}

.war-ability-card.maneuver-counter .war-ability-head {
  background: rgba(73, 101, 51, 0.78);
}

.compact-list {
  display: grid;
  gap: 5px;
}

.compact-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.95fr) auto minmax(180px, 1.4fr);
  gap: 7px;
  align-items: center;
  min-height: 36px;
  border: 1px solid #5f4d40;
  border-radius: 4px;
  padding: 5px 7px;
  background: rgba(22, 16, 13, 0.66);
}

.compact-row.selected {
  border-color: rgba(61, 136, 188, 0.6);
  background: rgba(43, 76, 94, 0.26);
}

.compact-row.granted {
  border-color: rgba(214, 165, 82, 0.54);
  background: rgba(112, 77, 32, 0.28);
}

.talent-row {
  grid-template-columns: minmax(150px, 0.9fr) auto minmax(180px, 1.2fr) auto;
  border-color: rgba(182, 65, 55, 0.48);
  background: rgba(92, 35, 28, 0.26);
}

.talent-row.granted {
  border-color: rgba(214, 165, 82, 0.56);
  background: rgba(101, 71, 30, 0.24);
}

.talent-row.available {
  border-color: rgba(231, 211, 174, 0.62);
  background: rgba(83, 62, 38, 0.24);
}

.talent-row.locked {
  color: var(--muted);
  border-color: rgba(182, 65, 55, 0.34);
  background: rgba(30, 22, 18, 0.56);
}

.talent-actions {
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: flex-end;
}

.talent-actions .small-action {
  min-width: 22px;
  padding-inline: 5px;
}

.row-main {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.row-main strong {
  min-width: 0;
  overflow: hidden;
  color: #fff0d8;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-main em {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.66rem;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.row-note {
  overflow: hidden;
  color: #c9baa4;
  font-size: 0.7rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-total {
  justify-self: end;
  color: #fff2dc;
  font-size: 0.94rem;
  font-weight: 780;
}

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

.empty {
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

body.theme-light {
  --paper: #ffffff;
  --ink: #2f241c;
  --muted: #74675b;
  --line: #c7b59c;
  --panel: #fffaf0;
  --panel-2: #f2e6d4;
  --panel-3: #e1cfb5;
  --teal: #1d6f9f;
  --moss: #657f25;
  --wine: #a13e34;
  --gold: #b87924;
  --ember: #bf5b2a;
  --shadow: 0 12px 30px rgba(99, 76, 50, 0.14), inset 0 1px rgba(255, 255, 255, 0.88);
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(198, 174, 130, 0.12) 0 1px, transparent 1px 34px),
    linear-gradient(180deg, #ffffff, #f7f0e5);
}

body.theme-light .app-shell {
  border-color: #c8b495;
  background:
    linear-gradient(90deg, rgba(184, 121, 36, 0.08), transparent 18%, transparent 84%, rgba(29, 111, 159, 0.08)),
    #fffaf2;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.92),
    0 18px 52px rgba(93, 70, 44, 0.16);
}

body.theme-light .topbar {
  border-bottom-color: #c7b59c;
  background:
    linear-gradient(90deg, rgba(184, 121, 36, 0.12), transparent 42%, rgba(29, 111, 159, 0.08)),
    linear-gradient(180deg, #fff7e8, #ebddc8);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.95), inset 0 -1px rgba(129, 96, 62, 0.18);
}

body.theme-light h1,
body.theme-light h2,
body.theme-light h3 {
  color: #2d2119;
  text-shadow: none;
}

body.theme-light .subtle,
body.theme-light .rules-note,
body.theme-light .table-note,
body.theme-light .field-label,
body.theme-light .stat-label,
body.theme-light .patch-date {
  color: #74675b;
}

body.theme-light .eyebrow,
body.theme-light .rule-link {
  color: #9b5f16;
}

body.theme-light .workspace,
body.theme-light .content {
  background:
    linear-gradient(180deg, rgba(29, 111, 159, 0.04), transparent 230px),
    #ffffff;
}

body.theme-light .tabs,
body.theme-light .character-panel {
  border-color: #c7b59c;
  background: linear-gradient(180deg, #f2e6d4, #e7d8c2);
  box-shadow: inset -1px 0 rgba(122, 92, 61, 0.12);
}

body.theme-light .tab {
  color: #514438;
  border-bottom-color: #d0bea4;
  background:
    linear-gradient(90deg, rgba(184, 121, 36, 0.06), transparent 48%),
    linear-gradient(180deg, #f7ecda, #ead9bf);
}

body.theme-light .tab.is-active {
  color: #2a1d15;
  border-color: #b89b75;
  background:
    linear-gradient(90deg, rgba(184, 121, 36, 0.3), transparent 74%),
    linear-gradient(180deg, #fff4dc, #dfc59e);
  box-shadow: inset 5px 0 #b87924, inset -1px 0 rgba(129, 96, 62, 0.16);
}

body.theme-light .theme-toggle {
  color: #2b2118;
  border-color: #bfa783;
  background: linear-gradient(180deg, #ffffff, #eadbc2);
  box-shadow: 0 3px 12px rgba(107, 79, 46, 0.14);
}

body.theme-light .theme-icon {
  color: #fff9ed;
  background: linear-gradient(180deg, #1d6f9f, #154e75);
}

body.theme-light .version-footer {
  color: #716354;
  border-top-color: #c7b59c;
  background:
    linear-gradient(90deg, rgba(184, 121, 36, 0.1), transparent 55%),
    #f4ead9;
}

body.theme-light .version-footer strong {
  color: #4b3322;
}

body.theme-light .resource-chip,
body.theme-light .stat-tile,
body.theme-light .metric,
body.theme-light .progress-cell,
body.theme-light .card,
body.theme-light .list-card,
body.theme-light .editor-field,
body.theme-light .character-switch,
body.theme-light .gear-match,
body.theme-light .ledger-entry,
body.theme-light .patch-row,
body.theme-light .patch-version-pair span,
body.theme-light .talent-level-section {
  color: #2f241c;
  border-color: #c7b59c;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(247, 239, 226, 0.88)),
    #fff9ee;
  box-shadow: var(--shadow);
}

body.theme-light .card.accent-teal {
  border-top-color: #1d6f9f;
  background: linear-gradient(180deg, rgba(29, 111, 159, 0.1), rgba(255, 252, 246, 0.98));
}

body.theme-light .condition-notes span {
  color: #5a4b3d;
  border-color: #d2bea1;
  background: #fff8ea;
}

body.theme-light .kit-table tr.kit-owned {
  background: rgba(133, 156, 75, 0.18);
}

body.theme-light .kit-check {
  color: #2f241c;
}

body.theme-light .kit-check.compact {
  color: #74675b;
}

body.theme-light .gear-ability-card {
  color: #34281f;
  border-color: #c7b59c;
  background: #fff8ea;
}

body.theme-light .gear-ability-head strong {
  color: #2d2119;
}

body.theme-light .gear-ability-card p {
  color: #4f4237;
}

body.theme-light .card.accent-wine {
  border-top-color: #a13e34;
  background: linear-gradient(180deg, rgba(161, 62, 52, 0.1), rgba(255, 252, 246, 0.98));
}

body.theme-light .card.accent-moss {
  border-top-color: #657f25;
  background: linear-gradient(180deg, rgba(101, 127, 37, 0.1), rgba(255, 252, 246, 0.98));
}

body.theme-light .editor-form .editor-field,
body.theme-light .editor-check-field {
  border-color: #c7b59c;
  background: rgba(255, 253, 249, 0.96);
}

body.theme-light .editor-save-status {
  color: #6d5f52;
  border-color: #c7b59c;
  background: #fffdf8;
}

body.theme-light .editor-save-status.ok {
  color: #2d2119;
  border-color: #c49745;
  background: linear-gradient(180deg, #ffe7ac, #d8b15e);
}

body.theme-light .editor-save-status.danger,
body.theme-light .editor-validation-row {
  color: #6f241f;
  border-color: #d79a91;
  background: #ffe9e4;
}

body.theme-light .editor-validation-row strong {
  color: #fff7f4;
  background: #a94338;
}

body.theme-light .resource-chip strong,
body.theme-light .stat-value,
body.theme-light .metric strong,
body.theme-light .progress-cell strong,
body.theme-light .xp-summary-strip strong,
body.theme-light .character-switch strong,
body.theme-light .row-total,
body.theme-light .summary-cell,
body.theme-light .patch-version {
  color: #2d2119;
}

body.theme-light .character-switch span {
  color: #6d5f52;
}

body.theme-light .xp-summary-strip span,
body.theme-light .progress-cell,
body.theme-light .ledger-entry {
  color: #66584b;
  border-color: #c7b59c;
  background:
    linear-gradient(90deg, rgba(184, 121, 36, 0.08), transparent 78%),
    #fffdf8;
}

body.theme-light .resource-chip.available-chip,
body.theme-light .small-action {
  color: #2a1c11;
  border-color: #c99546;
  background: linear-gradient(180deg, #ffe9b8, #d9b062);
}

body.theme-light .small-action.ghost,
body.theme-light .small-action.danger.ghost,
body.theme-light .character-remove {
  color: #7a421e;
  background: #fff7e8;
}

body.theme-light .small-action.danger,
body.theme-light .ability-state-icon.locked {
  color: #fff8ef;
  border-color: #a13e34;
  background: linear-gradient(180deg, #c75347, #8e322c);
}

body.theme-light input,
body.theme-light select,
body.theme-light textarea,
body.theme-light .searchbar input,
body.theme-light .searchbar select,
body.theme-light .matrix-number-input,
body.theme-light .inline-number-field input,
body.theme-light .editor-field input,
body.theme-light .editor-field select,
body.theme-light .editor-field textarea,
body.theme-light .editor-short-info-row input {
  color: #2f241c;
  border-color: #bca789;
  background: #fffdf9;
}

body.theme-light .field-control,
body.theme-light .inline-editor-grid .editor-field input,
body.theme-light .inline-editor-grid .editor-field select,
body.theme-light .editor-form .editor-field input,
body.theme-light .editor-form .editor-field select,
body.theme-light .editor-form .editor-field textarea,
body.theme-light .editor-check-control {
  color: #2f241c;
  background: #fffdf9;
}

body.theme-light .inline-editor-grid .field-label,
body.theme-light .editor-form .field-label,
body.theme-light .matrix-name-block,
body.theme-light .talent-name-cell,
body.theme-light .level-corner,
body.theme-light .portrait-url-drawer,
body.theme-light .field-unit {
  color: #33261d;
  border-color: #c0ac8d;
  background: linear-gradient(180deg, #f0dfc4, #dac29f);
}

body.theme-light .table-wrap,
body.theme-light .matrix-wrap,
body.theme-light .ability-matrix-shell {
  border-color: #c7b59c;
  background:
    linear-gradient(90deg, rgba(184, 121, 36, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(184, 121, 36, 0.035) 1px, transparent 1px),
    #fffdf8;
}

body.theme-light table,
body.theme-light .matrix-table {
  color: #2f241c;
}

body.theme-light th,
body.theme-light td,
body.theme-light .matrix-table th,
body.theme-light .matrix-table td,
body.theme-light .ability-matrix-head,
body.theme-light .level-row-label,
body.theme-light .ability-matrix-cell {
  border-color: #c7b59c;
}

body.theme-light .matrix-table thead th,
body.theme-light .ability-matrix-head,
body.theme-light .talent-level-band {
  color: #2f241c;
  background: linear-gradient(180deg, #e7d6bb, #d8c2a0);
}

body.theme-light .level-head,
body.theme-light .level-row-label {
  background: #efe3cf;
}

body.theme-light .ability-matrix-cell.lane-teal,
body.theme-light .ability-matrix-head.lane-teal {
  background: rgba(29, 111, 159, 0.09);
}

body.theme-light .ability-matrix-cell.lane-moss,
body.theme-light .ability-matrix-head.lane-moss {
  background: rgba(101, 127, 37, 0.1);
}

body.theme-light .ability-matrix-cell.lane-wine,
body.theme-light .ability-matrix-head.lane-wine {
  background: rgba(161, 62, 52, 0.08);
}

body.theme-light .ability-node,
body.theme-light .talent-card,
body.theme-light .karma-ability-card,
body.theme-light .war-ability-card,
body.theme-light .war-basic-action {
  color: #2f241c;
  border-color: #bfa783;
  background: linear-gradient(180deg, #fff8e8, #e7d3ae);
}

body.theme-light .ability-node.selected,
body.theme-light .talent-card.selected,
body.theme-light .karma-ability-card.selected {
  border-color: #b87924;
  background: linear-gradient(180deg, #fff2ce, #e3c98d);
}

body.theme-light .ability-node.granted,
body.theme-light .talent-card.granted {
  border-color: #b87924;
  background: linear-gradient(180deg, #fff2ce, #e3c98d);
}

body.theme-light .ability-node.available,
body.theme-light .talent-card.available {
  border-color: #c9b99d;
  background: linear-gradient(180deg, #fffaf0, #eee2ce);
}

body.theme-light .ability-node.locked,
body.theme-light .talent-card.locked {
  color: #7c6f62;
  border-color: #b98076;
  background: linear-gradient(180deg, #f3ebe1, #e4d8ca);
}

body.theme-light .ability-name-cell {
  color: #2f241c;
  background: linear-gradient(180deg, #ead9bd, #d4bea0);
}

body.theme-light .ability-node.available .ability-name-cell,
body.theme-light .ability-node.granted .ability-name-cell {
  color: #2d2119;
  background: linear-gradient(180deg, #f4e1bd, #d5b980);
}

body.theme-light .ability-node.selected .ability-name-cell {
  color: #2d2119;
  background: linear-gradient(180deg, #ffe5a9, #d2a04f);
}

body.theme-light .ability-node.locked .ability-name-cell {
  color: #ffffff;
  background: linear-gradient(180deg, #9a5149, #7d3a35);
}

body.theme-light .ability-bonus-cell,
body.theme-light .ability-cost-cell,
body.theme-light .ability-state-cell,
body.theme-light .ability-short-chip em,
body.theme-light .talent-source-icon,
body.theme-light .talent-rank-cell,
body.theme-light .talent-cost-cell {
  color: #2f241c;
  background: rgba(255, 252, 246, 0.72);
}

body.theme-light .ability-status-text {
  color: rgba(85, 69, 50, 0.72);
}

body.theme-light .ability-node.selected .ability-status-text,
body.theme-light .ability-node.granted .ability-status-text {
  color: #8a5b1f;
}

body.theme-light .ability-short-chip,
body.theme-light .talent-rule-line,
body.theme-light .talent-effect-chip,
body.theme-light .talent-rank-row span,
body.theme-light .talent-rank-setter,
body.theme-light .pill,
body.theme-light .badge {
  color: #2f241c;
  border-color: #c7b59c;
  background: #fff8ea;
}

body.theme-light .ability-short-chip strong {
  color: #2d2119;
  background: #dec18b;
}

body.theme-light .talent-rule-line strong {
  color: #2d2119;
  background: #dec18b;
}

body.theme-light .talent-rule-line em {
  color: #3f3329;
}

body.theme-light .ability-description-line,
body.theme-light .ability-node.available .ability-description-line,
body.theme-light .talent-description,
body.theme-light .row-note,
body.theme-light .description,
body.theme-light .patch-row p {
  color: #4f4237;
}

body.theme-light .ability-range-icon,
body.theme-light .source-icon {
  color: #2d2119;
  border-color: #bfa783;
  background: linear-gradient(180deg, #fff0c9, #d9b064);
}

body.theme-light .ability-type-icon.maneuver {
  color: #fff8ef;
  background: #a13e34;
}

body.theme-light .ability-type-icon.action {
  color: #f7fcff;
  background: #1d6f9f;
}

body.theme-light .ability-type-icon.passive {
  color: #f9fff0;
  background: #657f25;
}

body.theme-light .ability-type-icon.unique {
  color: #fff8ff;
  background: #7b5298;
}

body.theme-light .source-popover {
  color: #2f241c;
  border-color: #bfa783;
  background: #fffaf0;
  box-shadow: 0 14px 30px rgba(105, 80, 49, 0.2);
}

body.theme-light .has-tooltip[data-tooltip]:hover::after,
body.theme-light .has-tooltip[data-tooltip]:focus::after,
body.theme-light .has-tooltip[data-tooltip]:focus-within::after {
  color: #2f241c;
  border-color: #bfa783;
  background: #fffaf0;
  box-shadow: 0 14px 30px rgba(105, 80, 49, 0.2);
}

body.theme-light .floating-tooltip {
  color: #2f241c;
  border-color: #bfa783;
  background: #fffaf0;
  box-shadow: 0 14px 30px rgba(105, 80, 49, 0.2);
}

body.theme-light .source-popover::before {
  border-color: #bfa783;
  background: #fffaf0;
}

body.theme-light .source-popover > strong,
body.theme-light .source-tooltip-name {
  color: #3a2b20;
}

body.theme-light .editor-dataset-tab,
body.theme-light .editor-record-button,
body.theme-light .editor-field-block,
body.theme-light .editor-reference-row,
body.theme-light .token-button {
  color: #2f241c;
  border-color: #c7b59c;
  background: linear-gradient(180deg, #fff9ef, #eadbc4);
}

body.theme-light .editor-dataset-tab.is-active,
body.theme-light .editor-record-button.is-active,
body.theme-light .character-switch.is-active {
  border-color: #b87924;
  background: linear-gradient(180deg, #fff1cf, #dec18b);
}

body.theme-light .war-action-column,
body.theme-light .war-maneuver-column {
  color: #2f241c;
  border-color: #c7b59c;
  background: #fffaf0;
}

body.theme-light .war-style-picker {
  background: #fff6e8;
}

body.theme-light .war-style-summary {
  border-color: #c7b59c;
  background: #fff6e8;
}

body.theme-light .war-style-summary strong {
  color: #2f241c;
}

body.theme-light .war-style-summary span,
body.theme-light .war-style-summary em {
  color: #66584a;
}

body.theme-light .war-style-picker select {
  color: #2f241c;
  border-color: #b99267;
  background: #fffdf7;
}

body.theme-light .war-ability-card {
  background: #fff6e7;
}

body.theme-light .war-ability-card p {
  color: #3f3127;
}

body.theme-light .war-ability-card.style-action .war-ability-head {
  background: linear-gradient(90deg, #eed18e, #d4a64c);
}

body.theme-light .war-ability-head strong {
  color: #2f241c;
}

body.theme-light .empty,
body.theme-light .compact-empty {
  color: #7f7162;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100% - 20px, 1500px);
    margin-block: 10px;
  }

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

  .tabs {
    position: sticky;
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid #5f4c3f;
  }

  .character-panel {
    border-top: 1px solid #5f4c3f;
    border-left: 0;
  }

  .character-list {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .tab {
    min-width: max-content;
    min-height: 50px;
    border-right: 1px solid #4f4036;
    border-bottom: 0;
    padding: 0 16px;
    text-align: center;
  }

  .tab.is-active {
    box-shadow: inset 0 -4px var(--gold);
    padding-left: 16px;
  }

  .topbar,
  .dashboard,
  .overview-grid,
  .gear-custom-grid,
  .story-grid-two,
  .adventure-grid,
  .war-maneuver-board,
  .editor-layout,
  .stats-page,
  .talent-cost-grid {
    grid-template-columns: 1fr;
  }

  .quick-stats,
  .resource-strip,
  .overview-main-grid,
  .overview-secondary-grid,
  .panel-grid,
  .metric-grid,
  .progress-grid,
  .compact-identity-grid,
  .ledger-form,
  .build-grid,
  .field-grid,
  .gear-equip-grid,
  .gear-match-grid,
  .searchbar,
  .editor-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 620px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .topbar,
  .content {
    padding-inline: 14px;
  }

  .quick-stats,
  .resource-strip,
  .panel-grid,
  .metric-grid,
  .progress-grid,
  .compact-identity-grid,
  .ledger-form,
  .build-grid,
  .field-grid,
  .gear-equip-grid,
  .gear-match-grid,
  .gear-edit-row,
  .searchbar,
  .editor-toolbar,
  .editor-attribute-grid,
  .editor-combat-info-grid,
  .editor-range-info-grid,
  .editor-rank-cost-grid,
  .editor-rank-upgrade-row,
  .war-action-board,
  .war-maneuver-board {
    grid-template-columns: 1fr;
  }

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

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

  .overview-portrait-row,
  .portrait-pair.has-two-forms {
    grid-template-columns: 1fr;
  }

  .compact-identity-grid .wide-field {
    grid-column: 1;
  }

  .adventure-title,
  .compact-row,
  .talent-card-line,
  .editor-reference-row {
    grid-template-columns: 1fr;
  }

  .talent-actions {
    justify-content: flex-start;
  }

  .adventure-title {
    align-items: flex-start;
  }

  .card-heading,
  .lane-header,
  .detail-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .lane-counts {
    justify-content: flex-start;
  }

  h1 {
    font-size: 1.9rem;
  }

  .tabs {
    padding-inline: 14px;
  }
}
