﻿:root {
  color-scheme: dark;
  --bg-0: #0b0a09;
  --bg-1: #14110f;
  --bg-2: #1c1714;
  --panel: #191512;
  --panel-soft: #231b16;
  --edge: #3a2a1d;
  --edge-bright: #7d5c2c;
  --accent: #d8b46a;
  --accent-strong: #f0d38a;
  --text: #f3e7cf;
  --muted: #c5b59a;
  --danger: #b24a3e;
  --ok: #5f9f7a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --radius-sm: 12px;
  --wizard-sticky-offset: 112px;
  --font-body: "Alegreya", serif;
  --font-display: "Cinzel", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: radial-gradient(circle at 20% 0%, #261c15, transparent 45%),
    radial-gradient(circle at 90% 20%, #1f1a15, transparent 40%),
    linear-gradient(160deg, #090807 0%, #0e0c0a 35%, #15110e 100%);
  letter-spacing: 0.01em;
}

.ambient {
  min-height: 100vh;
  background-image: repeating-linear-gradient(120deg,
      rgba(255, 255, 255, 0.015) 0,
      rgba(255, 255, 255, 0.015) 1px,
      transparent 1px,
      transparent 14px),
    radial-gradient(circle at 15% 85%, rgba(125, 92, 44, 0.15), transparent 60%);
}

.app {
  min-height: 100vh;
  padding: 24px clamp(16px, 2.5vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
  position: sticky;
  top: 12px;
  z-index: 90;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(32, 24, 18, 0.95), rgba(20, 16, 12, 0.95));
  border: 1px solid var(--edge);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand__sigil {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, #2c2218, #16110d);
  border: 1px solid var(--edge-bright);
  box-shadow: inset 0 0 12px rgba(216, 180, 106, 0.35);
}

.brand__sigil svg {
  width: 26px;
  height: 26px;
  color: var(--accent);
  fill: var(--accent);
  filter: drop-shadow(0 0 6px rgba(216, 180, 106, 0.4));
}

.brand__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand__subtitle {
  font-size: 0.95rem;
  color: var(--muted);
}

.mode {
  display: inline-flex;
  gap: 8px;
  background: rgba(15, 12, 10, 0.7);
  border-radius: 999px;
  padding: 6px;
  border: 1px solid rgba(125, 92, 44, 0.4);
}

.mode__button {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode__button.is-active {
  color: var(--text);
  background: linear-gradient(140deg, rgba(216, 180, 106, 0.35), rgba(125, 92, 44, 0.15));
  box-shadow: inset 0 0 12px rgba(216, 180, 106, 0.3);
}

.topbar__actions {
  display: flex;
  gap: 12px;
}

.topbar__step-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(125, 92, 44, 0.38);
  background: rgba(15, 12, 10, 0.62);
  flex: 0 0 auto;
}

.topbar__step-nav-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
}

.topbar__step-nav-btn .btn__icon {
  font-size: 1rem;
}

.export-menu {
  position: relative;
}

.export-menu__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.export-menu__chevron {
  font-size: 0.72rem;
  transition: transform 0.2s ease;
}

.export-menu.is-open .export-menu__chevron {
  transform: rotate(180deg);
}

.export-menu__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  min-width: 220px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(125, 92, 44, 0.7);
  background: linear-gradient(180deg, rgba(27, 21, 17, 0.98), rgba(16, 12, 9, 0.98));
  box-shadow: var(--shadow);
}

.export-menu__panel[hidden] {
  display: none !important;
}

.export-menu__item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  white-space: nowrap;
}

.export-menu__item:focus-visible,
.export-menu__toggle:focus-visible {
  outline: 2px solid rgba(240, 211, 138, 0.5);
  outline-offset: 2px;
}

.topbar__creation-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  flex: 0 1 auto;
}

.topbar__creation-mode .mode-switch-container {
  margin: 0;
  padding: 0;
  gap: 0;
  background: transparent;
  border: 0;
  border-left: 0;
  border-radius: 0;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
}

.topbar__creation-mode .mode-switch-label {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.topbar__creation-mode .mode-toggle {
  padding: 3px;
  gap: 4px;
  max-width: 100%;
  flex-wrap: nowrap;
}

.topbar__creation-mode .mode-btn {
  font-size: 0.72rem;
  line-height: 1.1;
  padding: 6px 10px;
  white-space: nowrap;
}

.layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(240px, 320px);
  align-items: start;
}

.layout > * {
  min-width: 0;
}

.panel {
  background: linear-gradient(180deg, rgba(28, 22, 18, 0.98), rgba(21, 16, 13, 0.98));
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel__title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar__header .panel__title {
  margin-bottom: 0;
}

.sidebar__toggle {
  flex-shrink: 0;
  min-height: 40px;
  padding: 8px 12px;
}

.progress {
  display: grid;
  gap: 8px;
}

.progress__track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid rgba(125, 92, 44, 0.4);
}

.progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #f8e1a6);
  box-shadow: 0 0 8px rgba(216, 180, 106, 0.6);
  transition: width 0.3s ease;
}

.progress__label {
  font-size: 0.9rem;
  color: var(--muted);
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.step-list--grouped {
  gap: 14px;
}

.step-list__group {
  display: grid;
  gap: 8px;
}

.step-list__group-label {
  padding: 0 4px;
  font-family: var(--font-display);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.step-list__group.is-active-group .step-list__group-label {
  color: var(--accent-strong);
}

.step-list__group-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.step-list__item {
  border-radius: 12px;
}

.step-list__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(18, 14, 11, 0.6);
  color: inherit;
  font: inherit;
  text-align: left;
  appearance: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.step-list__item:hover .step-list__trigger {
  border-color: rgba(216, 180, 106, 0.45);
  transform: translateY(-1px);
}

.step-list__item.is-active .step-list__trigger {
  border-color: var(--accent);
  background: rgba(216, 180, 106, 0.12);
  box-shadow: inset 0 0 12px rgba(216, 180, 106, 0.25);
}

.step-list__trigger:focus-visible {
  outline: none;
  border: 1px solid transparent;
  box-shadow: 0 0 0 2px rgba(216, 180, 106, 0.42);
}

.step-list__index {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--accent-strong);
  border: 1px solid rgba(216, 180, 106, 0.4);
}

.step-list__title {
  font-size: 0.95rem;
}

.mobile-steps-toggle {
  display: none;
}

.sidebar-steps-content {
  display: grid;
  gap: 12px;
}

.content {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.content__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.content__step-switcher[hidden] {
  display: none !important;
}

.content__step-switcher {
  position: sticky;
  top: var(--wizard-sticky-offset);
  z-index: 75;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(125, 92, 44, 0.55);
  background: linear-gradient(135deg, rgba(34, 26, 20, 0.96), rgba(17, 13, 10, 0.96));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.38);
}

.step-switcher__bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.step-switcher__expand,
.step-switcher__arrow {
  min-height: 44px;
}

.step-switcher__nav {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.step-switcher__toggle {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(216, 180, 106, 0.45);
  background: rgba(19, 15, 12, 0.72);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.step-switcher__toggle:hover {
  border-color: rgba(216, 180, 106, 0.62);
  transform: translateY(-1px);
}

.step-switcher__toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(216, 180, 106, 0.42);
}

.step-switcher__summary {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.step-switcher__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.84rem;
}

.step-switcher__state {
  font-size: 0.92rem;
  color: var(--muted);
}

.step-switcher__chevron {
  font-size: 0.82rem;
  transition: transform 0.2s ease;
}

.content__step-switcher.is-open .step-switcher__chevron {
  transform: rotate(180deg);
}

.step-switcher__menu {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(125, 92, 44, 0.4);
}

.step-switcher__menu[hidden] {
  display: none !important;
}

.step-switcher__menu .step-list {
  max-height: min(50vh, 420px);
  overflow: auto;
  padding-right: 4px;
}

.content__title {
  font-family: var(--font-display);
  margin: 6px 0 0;
  font-size: clamp(1.6rem, 2vw, 2.2rem);
  letter-spacing: 0.04em;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: var(--muted);
}

.content__actions {
  display: flex;
  gap: 10px;
}

.content__mobile-nav {
  display: none;
  transition: transform 0.24s ease, opacity 0.2s ease;
}

body.has-step-sidebar-collapsed .sidebar {
  display: none;
}

body.has-step-sidebar-collapsed .content__actions {
  display: none;
}

.content__body {
  display: grid;
  gap: 16px;
  animation: fadeUp 0.4s ease;
}

.content__footer {
  font-size: 0.9rem;
  color: var(--muted);
  border-top: 1px solid rgba(125, 92, 44, 0.3);
  padding-top: 12px;
}

.rule {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(12, 10, 8, 0.65);
  border: 1px solid rgba(125, 92, 44, 0.4);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
}

.rule p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
}

.rule ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.rule li {
  line-height: 1.5;
}

.rule__source {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.rule__source span {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(125, 92, 44, 0.4);
  background: rgba(18, 14, 11, 0.6);
}




/* ========================================
   Fantasy RPG Table Styles
   ======================================== */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 22px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(33, 25, 20, 0.95), rgba(17, 13, 10, 0.95));
  border: 1px solid rgba(125, 92, 44, 0.58);
  border-left: 4px solid rgba(216, 180, 106, 0.68);
  box-shadow: var(--shadow);
}

.table-responsive.table-responsive--content-fit {
  width: min(532px, 100%);
  max-width: 100%;
  justify-self: start;
}

.table-responsive.table-responsive--price-list {
  width: max-content;
  max-width: 100%;
  justify-self: start;
}

@media (min-width: 1200px) {
  .table-responsive.table-responsive--price-list {
    justify-self: center;
    margin-inline: auto;
  }
}

.table-responsive>table,
.table-responsive>.rpg-table,
.table-responsive>.table,
table.rpg-table,
table.table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
  border: none;
  min-width: 100%;
}

table.rpg-table,
table.table {
  border: 1px solid rgba(125, 92, 44, 0.52);
  background: linear-gradient(180deg, rgba(33, 25, 20, 0.95), rgba(17, 13, 10, 0.95));
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.table-responsive>.rpg-table,
.table-responsive>.table,
.table-responsive>table {
  border: none;
  background: transparent;
  border-radius: 0;
}

.table-responsive>table caption,
table.rpg-table caption,
table.table caption {
  font-family: var(--font-display);
  color: var(--accent-strong);
  text-align: left;
  margin-bottom: 10px;
  font-size: 0.9rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0 8px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.table-responsive>table th,
table.rpg-table th,
table.table th {
  padding: 12px 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent-strong);
  background: linear-gradient(180deg, rgba(57, 39, 24, 0.95), rgba(31, 22, 14, 0.95));
  border-bottom: 2px solid rgba(216, 180, 106, 0.4);
  border-right: 1px solid rgba(125, 92, 44, 0.38);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.42);
}

.table-responsive>table td,
table.rpg-table td,
table.table td {
  padding: 11px 14px;
  color: var(--text);
  border-bottom: 1px solid rgba(125, 92, 44, 0.24);
  border-right: 1px solid rgba(125, 92, 44, 0.18);
  font-size: 0.94rem;
  line-height: 1.5;
  vertical-align: top;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: rgba(15, 12, 9, 0.75);
}

/* Header rows represented with TD (common in imported wizard content). */
.table-responsive>table tr.is-table-header>td,
table.rpg-table tr.is-table-header>td,
table.table tr.is-table-header>td {
  padding: 12px 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent-strong);
  background: linear-gradient(180deg, rgba(57, 39, 24, 0.95), rgba(31, 22, 14, 0.95)) !important;
  border-bottom: 2px solid rgba(216, 180, 106, 0.4);
  border-right: 1px solid rgba(125, 92, 44, 0.38);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.42);
}

/* Internal group headers (e.g. I./II./III. kaszt csoport). */
.table-responsive>table tr.is-group-header>td,
table.rpg-table tr.is-group-header>td,
table.table tr.is-group-header>td {
  position: relative;
  padding: 12px 16px 11px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #f3d896;
  background: linear-gradient(180deg, rgba(68, 46, 27, 0.96), rgba(34, 24, 16, 0.96)) !important;
  border-top: 1px solid rgba(216, 180, 106, 0.4);
  border-bottom: 1px solid rgba(216, 180, 106, 0.36);
  border-right: none;
  box-shadow: inset 0 1px 0 rgba(255, 226, 166, 0.12);
}

.table-responsive>table tr.is-group-header>td::before,
table.rpg-table tr.is-group-header>td::before,
table.table tr.is-group-header>td::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, rgba(240, 211, 138, 0.95), rgba(216, 180, 106, 0.62));
}

table.rpg-table.rpg-has-group-headers tr.is-group-header+tr.is-table-header>td,
table.table.rpg-has-group-headers tr.is-group-header+tr.is-table-header>td {
  border-top: none;
}

.table-responsive>table tbody tr:last-child td,
table.rpg-table tbody tr:last-child td,
table.table tbody tr:last-child td {
  border-bottom: none;
}

.table-responsive>table tbody tr:nth-child(even) td,
table.rpg-table tbody tr:nth-child(even) td,
table.table tbody tr:nth-child(even) td {
  background: rgba(29, 22, 17, 0.78);
}

.table-responsive>table tbody tr:hover td,
table.rpg-table tbody tr:hover td,
table.table tbody tr:hover td {
  background: rgba(216, 180, 106, 0.11);
}

.table-responsive>table .num,
table.rpg-table .num,
table.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--accent-strong);
}

.table-responsive>table th:last-child,
.table-responsive>table td:last-child,
table.rpg-table th:last-child,
table.rpg-table td:last-child,
table.table th:last-child,
table.table td:last-child {
  border-right: none;
}

table.rpg-cols-1 {
  min-width: 300px;
}

table.rpg-cols-2 {
  min-width: 560px;
}

table.rpg-cols-3 {
  min-width: 760px;
}

table.rpg-cols-4 {
  min-width: 860px;
}

table.rpg-cols-5,
table.rpg-cols-6,
table.rpg-cols-7,
table.rpg-cols-8,
table.rpg-cols-9,
table.rpg-cols-10,
table.rpg-cols-11,
table.rpg-cols-12 {
  min-width: 1000px;
}

table.rpg-cols-2 :is(th, td):first-child {
  width: 72%;
}

table.rpg-cols-2 :is(th, td):last-child {
  width: 28%;
}

table.rpg-cols-3 :is(th, td):first-child {
  width: 24%;
}

table.rpg-cols-3 :is(th, td):nth-child(2) {
  width: 56%;
}

table.rpg-cols-3 :is(th, td):last-child {
  width: 20%;
}

table.rpg-value-last.rpg-cols-2 :is(th, td):last-child,
table.rpg-value-last.rpg-cols-3 :is(th, td):last-child {
  text-align: right;
  white-space: nowrap;
}

/* Description-heavy 3-column tables: 1:1:2 layout. */
table.rpg-cols-3.rpg-has-description.rpg-desc-col-1 :is(th, td):nth-child(1) {
  width: 50%;
}

table.rpg-cols-3.rpg-has-description.rpg-desc-col-1 :is(th, td):nth-child(2),
table.rpg-cols-3.rpg-has-description.rpg-desc-col-1 :is(th, td):nth-child(3) {
  width: 25%;
}

table.rpg-cols-3.rpg-has-description.rpg-desc-col-2 :is(th, td):nth-child(2) {
  width: 50%;
}

table.rpg-cols-3.rpg-has-description.rpg-desc-col-2 :is(th, td):nth-child(1),
table.rpg-cols-3.rpg-has-description.rpg-desc-col-2 :is(th, td):nth-child(3) {
  width: 25%;
}

table.rpg-cols-3.rpg-has-description.rpg-desc-col-3 :is(th, td):nth-child(3) {
  width: 50%;
}

table.rpg-cols-3.rpg-has-description.rpg-desc-col-3 :is(th, td):nth-child(1),
table.rpg-cols-3.rpg-has-description.rpg-desc-col-3 :is(th, td):nth-child(2) {
  width: 25%;
}

/* KFP conversion table: keep the 2 columns visually closer. */
.table-responsive > table[name="kfp"] {
  width: min(520px, 100%) !important;
  min-width: 320px;
  margin-right: auto;
}

.table-responsive.table-responsive--content-fit > table[name="kfp"] {
  min-width: 0;
}

.table-responsive > table[name="kfp"] :is(th, td):first-child {
  width: 62%;
}

.table-responsive > table[name="kfp"] :is(th, td):last-child {
  width: 38%;
  text-align: left;
  white-space: nowrap;
  padding-left: 16px;
}

/* Price list tables (2 columns: item + price): keep columns visually close. */
.table-responsive > table.rpg-price-list,
table.rpg-table.rpg-price-list {
  width: auto;
  min-width: 0;
  table-layout: auto;
  margin-right: auto;
}

.table-responsive > table.rpg-price-list :is(th, td):first-child,
table.rpg-table.rpg-price-list :is(th, td):first-child {
  width: auto !important;
}

.table-responsive > table.rpg-price-list :is(th, td):last-child,
table.rpg-table.rpg-price-list :is(th, td):last-child {
  width: auto !important;
  min-width: 110px;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  text-align: right;
  padding-left: 14px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 960px) {
  .table-responsive.table-responsive--price-list {
    width: 100%;
    max-width: 100%;
    justify-self: start;
    margin-inline: 0;
  }

  .table-responsive > table.rpg-price-list,
  table.rpg-table.rpg-price-list {
    width: 100%;
    min-width: 0;
  }
}

/* Targyalkoto table: better usability on tablet + mobile */
.table-responsive.table-responsive--crafting>table.rpg-table--crafting {
  min-width: 980px;
  table-layout: auto;
}

/* Keep middle stat/cost columns compact: about 2x text width. */
.table-responsive.table-responsive--crafting>table.rpg-table--crafting :is(tr:first-child>td:nth-child(2), tbody tr>td:nth-child(2)) {
  width: 8ch;
  min-width: 8ch;
  white-space: nowrap !important;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding-inline: 10px;
}

.table-responsive.table-responsive--crafting>table.rpg-table--crafting :is(tr:first-child>td:nth-child(n+3):nth-child(-n+8), tbody tr>td:nth-child(n+3):nth-child(-n+8)) {
  width: 6ch;
  min-width: 6ch;
  white-space: nowrap !important;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding-inline: 10px;
}

/* Penultimate column ("Pajzs lehet?"): no forced line break, centered values. */
.table-responsive.table-responsive--crafting>table.rpg-table--crafting :is(tr:first-child>td:nth-last-child(2), tbody tr>td:nth-last-child(2)) {
  min-width: 10ch;
  text-align: center;
}

.table-responsive.table-responsive--crafting>table.rpg-table--crafting tr:first-child>td:nth-last-child(2) p {
  display: inline;
  margin: 0;
}

.table-responsive.table-responsive--crafting>table.rpg-table--crafting tr:first-child>td:nth-last-child(2) p+p {
  margin-left: 0.35ch;
}

.table-responsive.table-responsive--crafting>table.rpg-table--crafting tr:first-child>td {
  position: sticky;
  top: 0;
  z-index: 3;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent-strong);
  background: linear-gradient(180deg, rgba(57, 39, 24, 0.95), rgba(31, 22, 14, 0.95));
  border-bottom: 1px solid rgba(216, 180, 106, 0.34);
}

.table-responsive.table-responsive--crafting>table.rpg-table--crafting :is(tr:first-child>td:first-child, tbody tr>td:first-child) {
  position: sticky;
  left: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(26, 20, 15, 0.96), rgba(17, 13, 10, 0.96));
  box-shadow: 10px 0 14px rgba(0, 0, 0, 0.35);
}

.table-responsive.table-responsive--crafting>table.rpg-table--crafting tr:first-child>td:first-child {
  z-index: 4;
}

.table-responsive.table-responsive--crafting>table.rpg-table--crafting tr.is-empty-row td {
  padding: 0;
  height: 12px;
  border-bottom: none;
  background: transparent;
}

@media (max-width: 760px) {
  .table-responsive.table-responsive--crafting {
    border-left-width: 1px;
    padding: 8px;
  }

  .table-responsive.table-responsive--crafting>table.rpg-table--crafting {
    min-width: 0;
    width: 100%;
    table-layout: auto;
    border: none;
    background: transparent;
  }

  .table-responsive.table-responsive--crafting>table.rpg-table--crafting tbody {
    display: grid;
    gap: 10px;
  }

  .table-responsive.table-responsive--crafting>table.rpg-table--crafting tr:first-child,
  .table-responsive.table-responsive--crafting>table.rpg-table--crafting tr.is-empty-row {
    display: none;
  }

  .table-responsive.table-responsive--crafting>table.rpg-table--crafting tbody tr {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid rgba(125, 92, 44, 0.52);
    border-left: 3px solid rgba(216, 180, 106, 0.72);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(27, 21, 16, 0.95), rgba(16, 12, 9, 0.95));
  }

  .table-responsive.table-responsive--crafting>table.rpg-table--crafting tbody tr td {
    display: grid;
    grid-template-columns: minmax(86px, 42%) 1fr;
    gap: 8px;
    align-items: start;
    padding: 0;
    border: none;
    background: transparent !important;
    white-space: normal;
  }

  .table-responsive.table-responsive--crafting>table.rpg-table--crafting tbody tr td::before {
    content: attr(data-label);
    font-family: var(--font-display);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    opacity: 0.95;
  }

  .table-responsive.table-responsive--crafting>table.rpg-table--crafting tbody tr td:first-child {
    margin-bottom: 3px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(125, 92, 44, 0.35);
  }

  .table-responsive.table-responsive--crafting>table.rpg-table--crafting tbody tr td:first-child::before {
    content: 'Tétel';
  }

  .table-responsive.table-responsive--crafting>table.rpg-table--crafting tbody tr td:first-child :is(p, span) {
    font-family: var(--font-display);
    color: var(--accent-strong);
  }
}

/* Complex Character Creation Table Interactive Styles */
#complex-char-table td[data-col] {
  cursor: pointer;
  transition: all 0.2s ease;
}

#complex-char-table td[data-col]:hover {
  background: rgba(216, 180, 106, 0.15);
  box-shadow: inset 0 0 8px rgba(216, 180, 106, 0.2);
}

#complex-char-table td.is-selected {
  background: var(--accent);
  color: var(--bg-0);
  font-weight: bold;
  box-shadow: 0 0 12px rgba(216, 180, 106, 0.5);
  border-color: var(--accent-strong);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 10px 16px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.btn--primary {
  background: linear-gradient(140deg, var(--accent), #f0d28b);
  color: #1b140f;
  border-color: rgba(216, 180, 106, 0.7);
  box-shadow: 0 0 12px rgba(216, 180, 106, 0.4);
}

.btn--primary:hover {
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: rgba(125, 92, 44, 0.6);
}

.btn--ghost:disabled,
.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.sheet {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.form {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.form__field {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.form__field span {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
}

.form__field input,
.form__field select {
  background: rgba(10, 8, 6, 0.65);
  color: var(--text);
  border: 1px solid rgba(125, 92, 44, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.form__value {
  background: rgba(10, 8, 6, 0.65);
  color: var(--text);
  border: 1px solid rgba(125, 92, 44, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.3;
  min-height: 42px;
  display: flex;
  align-items: center;
}

.form__field input:focus,
.form__field select:focus {
  outline: 2px solid rgba(216, 180, 106, 0.45);
  box-shadow: 0 0 12px rgba(216, 180, 106, 0.2);
}

.validation {
  display: grid;
  gap: 10px;
}

.inspector__mobile-bar,
.mobile-summary-toggle,
.mobile-summary-backdrop {
  display: none;
}

.sheet__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(125, 92, 44, 0.3);
  background: rgba(12, 10, 8, 0.45);
}

.sheet__label {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}

.sheet__value {
  font-size: 0.95rem;
}

.callout {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  border: 1px solid rgba(125, 92, 44, 0.4);
}

.callout--muted {
  background: rgba(12, 10, 8, 0.45);
  color: var(--muted);
}

.callout--warn {
  background: rgba(178, 74, 62, 0.15);
  border-color: rgba(178, 74, 62, 0.5);
}

.source-note {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.library-list {
  display: grid;
  gap: 10px;
}

.library-item {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(125, 92, 44, 0.35);
  background: rgba(18, 14, 11, 0.55);
  cursor: pointer;
  transition: all 0.2s ease;
}

.library-item:hover {
  border-color: var(--accent);
}

.library-item.is-active {
  border-color: var(--accent);
  background: rgba(216, 180, 106, 0.12);
}

.accordion {
  display: grid;
  gap: 12px;
}

.accordion__item {
  border-radius: 14px;
  border: 1px solid rgba(125, 92, 44, 0.4);
  background: rgba(14, 11, 9, 0.55);
  overflow: hidden;
}

.accordion__header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-family: var(--font-display);
}

.accordion__content {
  padding: 0 16px 16px;
  display: none;
}

.accordion__item.is-open .accordion__content {
  display: grid;
  gap: 12px;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body[data-mode="library"] [data-progress-wrapper],
body[data-mode="library"] [data-wizard-actions],
body[data-mode="library"] [data-topbar-step-nav],
body[data-mode="library"] [data-mobile-nav] {
  display: none;
}

body[data-mode="library"] .back-to-top,
body[data-mode="library"] .mobile-summary-toggle,
body[data-mode="library"] .mobile-summary-backdrop {
  display: none;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .inspector {
    position: static;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand steps actions"
      "mode mode mode"
      "creation creation creation";
    align-items: start;
  }

  .brand {
    grid-area: brand;
    min-width: 0;
  }

  .mode {
    grid-area: mode;
  }

  .topbar__creation-mode {
    grid-area: creation;
    width: 100%;
  }

  .topbar__step-nav {
    grid-area: steps;
    justify-self: end;
  }

  .topbar__actions {
    grid-area: actions;
    justify-self: end;
  }

  .topbar__creation-mode .mode-switch-container {
    width: 100%;
    justify-content: center;
  }

  .content__header {
    flex-direction: column;
  }

  .content__step-switcher {
    top: var(--wizard-sticky-offset);
  }
}

@media (max-width: 960px) {
  .sidebar__toggle,
  .content__step-switcher {
    display: none !important;
  }

  .content__actions {
    display: none;
  }

  .content.panel {
    padding-bottom: calc(132px + env(safe-area-inset-bottom));
  }

  .content__mobile-nav {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 60;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 48px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(125, 92, 44, 0.55);
    border-left: 3px solid rgba(216, 180, 106, 0.65);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(30, 23, 18, 0.96), rgba(14, 10, 8, 0.96));
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.5);
    opacity: 1;
    transform: translateY(0);
  }

  .content__mobile-nav .btn {
    width: 100%;
    min-height: 44px;
    padding-inline: 10px;
  }

  .content__mobile-nav [data-prev-mobile] {
    grid-column: 1;
  }

  .content__mobile-nav .mobile-summary-toggle {
    grid-column: 2;
  }

  .content__mobile-nav .back-to-top {
    grid-column: 3;
    position: static;
    display: inline-flex;
    width: 100%;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    font-size: 1rem;
    letter-spacing: 0;
    line-height: 1;
  }

  .content__mobile-nav [data-next-mobile] {
    grid-column: 4;
  }

  .content__mobile-nav:has(.mobile-summary-toggle[hidden]) {
    grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
  }

  .content__mobile-nav:has(.mobile-summary-toggle[hidden]) .back-to-top {
    grid-column: 2;
  }

  .content__mobile-nav:has(.mobile-summary-toggle[hidden]) [data-next-mobile] {
    grid-column: 3;
  }

  .back-to-top--floating {
    display: none;
  }

  .mobile-summary-toggle {
    position: static;
    z-index: auto;
    display: inline-flex;
    width: 100%;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(216, 180, 106, 0.58);
    background: linear-gradient(140deg, rgba(36, 27, 21, 0.96), rgba(18, 13, 10, 0.96));
    box-shadow: inset 0 0 10px rgba(216, 180, 106, 0.12);
    color: var(--accent-strong);
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
  }

  .mobile-summary-backdrop {
    position: fixed;
    inset: 0;
    z-index: 94;
    display: block;
    background: rgba(6, 5, 4, 0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  body.has-mobile-summary-open {
    overflow: hidden;
  }

  body.has-mobile-summary-open .mobile-summary-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .inspector {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(68px + env(safe-area-inset-bottom));
    z-index: 100;
    max-height: min(68vh, 760px);
    overflow: auto;
    border-radius: 22px;
    transform: translateY(calc(100% + 28px));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.24s ease, opacity 0.2s ease;
    box-shadow: 0 24px 54px rgba(0, 0, 0, 0.58);
  }

  body.has-mobile-summary-open .inspector {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .inspector__mobile-bar {
    position: sticky;
    top: -16px;
    z-index: 2;
    display: grid;
    gap: 10px;
    margin: -16px -16px 14px;
    padding: 10px 16px 12px;
    background: linear-gradient(180deg, rgba(31, 24, 19, 0.98), rgba(18, 13, 10, 0.98));
    border-bottom: 1px solid rgba(125, 92, 44, 0.35);
  }

  .inspector__mobile-handle {
    width: 54px;
    height: 4px;
    margin: 0 auto;
    border-radius: 999px;
    background: rgba(216, 180, 106, 0.42);
  }

  .inspector__mobile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .inspector__mobile-title {
    font-family: var(--font-display);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-strong);
    font-size: 0.84rem;
  }

  .inspector__mobile-close {
    min-height: 40px;
  }

  .sidebar.is-mobile-steps {
    gap: 10px;
    padding: 12px;
  }

  .sidebar.is-mobile-steps [data-sidebar-title] {
    display: none;
  }

  .sidebar.is-mobile-steps .mobile-steps-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 10px;
    border: 1px solid rgba(216, 180, 106, 0.45);
    background: linear-gradient(140deg, rgba(32, 24, 18, 0.95), rgba(19, 14, 11, 0.95));
    color: var(--accent-strong);
    font-family: var(--font-display);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.82rem;
    padding: 10px 12px;
    cursor: pointer;
  }

  .sidebar.is-mobile-steps .mobile-steps-toggle::after {
    content: "▾";
    transition: transform 0.2s ease;
    font-size: 0.86rem;
  }

  .sidebar.is-mobile-steps:not(.is-mobile-steps-open) .mobile-steps-toggle::after {
    transform: rotate(-90deg);
  }

  .sidebar.is-mobile-steps .mobile-steps-toggle__state {
    color: var(--muted);
    font-family: var(--font-body);
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.92rem;
  }

  .sidebar.is-mobile-steps:not(.is-mobile-steps-open) .sidebar-steps-content {
    display: none;
  }

  .sidebar.is-mobile-steps [data-progress-wrapper] {
    display: none;
  }

  .sidebar.is-mobile-steps .step-list {
    gap: 8px;
    max-height: 52vh;
    overflow: auto;
    padding-right: 2px;
  }

  .sidebar.is-mobile-steps .step-list--grouped {
    gap: 14px;
  }

  .sidebar.is-mobile-steps .step-list__group {
    gap: 7px;
  }

  .sidebar.is-mobile-steps .step-list__group-label {
    padding: 0 2px;
    font-size: 0.72rem;
    color: rgba(240, 211, 138, 0.88);
  }

  .sidebar.is-mobile-steps .step-list__trigger {
    padding: 8px 10px;
  }

  .sidebar.is-mobile-steps .step-list__index {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }

  .sidebar.is-mobile-steps .step-list__title {
    font-size: 0.9rem;
  }

  body.has-mobile-nav-hidden .content__mobile-nav {
    transform: translateY(calc(100% + 18px));
    opacity: 0;
    pointer-events: none;
  }

  .mobile-summary-toggle[hidden] {
    display: none;
  }

  body.has-mobile-nav-hidden .inspector {
    bottom: calc(18px + env(safe-area-inset-bottom));
  }
}

.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  border-radius: 10px;
  border: 1px solid rgba(125, 92, 44, 0.6);
  background: linear-gradient(140deg, rgba(33, 25, 20, 0.97), rgba(17, 13, 10, 0.97));
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 12px;
  cursor: pointer;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 720px) {
  .topbar {
    padding: 12px 16px;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "mode mode"
      "creation creation";
  }

  .brand {
    gap: 12px;
  }

  .brand__sigil {
    width: 40px;
    height: 40px;
  }

  .brand__sigil svg {
    width: 22px;
    height: 22px;
  }

  .brand__title {
    font-size: 1.08rem;
  }

  .brand__subtitle {
    font-size: 0.84rem;
  }

  .mode {
    width: 100%;
    justify-content: space-between;
  }

  .mode__button {
    flex: 1;
    min-height: 44px;
    text-align: center;
  }

  .topbar__creation-mode {
    width: 100%;
  }

  .topbar__step-nav {
    display: none;
  }

  .topbar__creation-mode .mode-switch-label {
    display: none;
  }

  .topbar__creation-mode .mode-switch-container {
    width: 100%;
    justify-content: center;
    padding: 0;
  }

  .topbar__creation-mode .mode-toggle {
    width: 100%;
  }

  .topbar__creation-mode .mode-btn {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding-inline: 8px;
  }

  .topbar__actions {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .topbar__actions .btn,
  .topbar__actions .export-menu {
    width: auto;
    min-width: 0;
  }

  .topbar__actions .btn {
    min-height: 44px;
    padding-inline: 12px;
  }

  .export-menu__panel {
    left: auto;
    right: 0;
    min-width: 220px;
  }

  .export-menu__item {
    justify-content: center;
    white-space: normal;
  }
}

@media (min-width: 461px) and (max-width: 720px) {
  .topbar {
    grid-template-columns: minmax(0, auto) minmax(130px, 1fr) auto;
    grid-template-areas:
      "brand creation actions"
      "mode mode mode";
    align-items: center;
  }

  .brand__subtitle,
  .topbar__actions .btn__label,
  .topbar__actions .export-menu__chevron {
    display: none;
  }

  .topbar__creation-mode {
    justify-self: stretch;
  }

  .topbar__creation-mode .mode-btn {
    font-size: 0.66rem;
    padding-inline: 5px;
  }

  .topbar__actions {
    gap: 8px;
  }

  .topbar__actions .btn,
  .topbar__actions .export-menu__toggle {
    min-width: 44px;
    padding-inline: 10px;
  }
}

@media (max-width: 540px) {
  .brand__subtitle {
    display: none;
  }

  .topbar__actions {
    gap: 8px;
  }

  .topbar__actions .btn__label,
  .topbar__actions .export-menu__chevron {
    display: none;
  }

  .topbar__actions .btn,
  .topbar__actions .export-menu__toggle {
    min-width: 44px;
    padding-inline: 10px;
  }
}

@media (max-width: 600px) {
  .app {
    padding: 16px;
  }

  .panel {
    padding: 16px;
  }

  .content__title {
    font-size: 1.5rem;
  }
}

/* ========================================
   Kaszt (Class) Selector Styles
   ======================================== */

/* ========================================
   Kaszt (Class) Selector Styles - REDESIGNED
   ======================================== */

.kaszt-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  /* Removed max-height/overflow to allow full page layout */
}

.kaszt-picker {
  display: grid;
  gap: 14px;
}

.kaszt-search {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
  padding-bottom: 8px;
  padding-top: 4px;
  /* Adjust for sticky overlap */
  border-bottom: 1px solid var(--edge);
  /* Visual separator when sticky */
}

.kaszt-search__input {
  width: 100%;
  background: rgba(10, 8, 6, 0.85);
  color: var(--text);
  border: 1px solid rgba(125, 92, 44, 0.45);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.kaszt-search__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(216, 180, 106, 0.25);
}

.kaszt-search__input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.kaszt-modal-launcher {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(125, 92, 44, 0.35);
  border-radius: 12px;
  background: rgba(12, 10, 8, 0.42);
}

.kaszt-modal-launcher__button {
  width: 100%;
}

.kaszt-modal-launcher__selected {
  color: var(--muted);
  font-size: 0.84rem;
}

body.kaszt-modal-open {
  overflow: hidden;
}

.kaszt-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 26px;
  background: rgba(7, 5, 4, 0.78);
  backdrop-filter: blur(3px);
}

.kaszt-modal[hidden] {
  display: none !important;
}

.kaszt-modal__dialog {
  width: min(1120px, 100%);
  max-height: min(92vh, 980px);
  display: grid;
  grid-template-rows: auto 1fr;
  background: linear-gradient(180deg, rgba(29, 22, 17, 0.98), rgba(15, 11, 8, 0.98));
  border: 1px solid rgba(125, 92, 44, 0.55);
  border-left: 3px solid rgba(216, 180, 106, 0.62);
  border-radius: 16px;
  box-shadow: 0 24px 42px rgba(0, 0, 0, 0.62);
  overflow: hidden;
}

.kaszt-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(125, 92, 44, 0.38);
  background: linear-gradient(180deg, rgba(27, 21, 16, 0.98), rgba(18, 14, 11, 0.98));
}

.kaszt-modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.kaszt-modal__close {
  min-height: 36px;
}

.kaszt-modal__body {
  overflow: auto;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.kaszt-modal .kaszt-categories__panel {
  max-height: min(56vh, 640px);
}

/* Grid Layout for Categories */
.kaszt-categories {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  align-items: start;
}

.kaszt-categories__nav {
  display: grid;
  gap: 10px;
  align-content: start;
}

.kaszt-categories__panel {
  min-height: 220px;
  max-height: 62vh;
  overflow-y: auto;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: linear-gradient(180deg, rgba(23, 17, 13, 0.9), rgba(14, 10, 8, 0.92));
  box-shadow: var(--shadow);
}

.kaszt-category {
  min-width: 0;
}

.kaszt-category__header {
  width: 100%;
  border: 1px solid var(--edge);
  border-radius: 12px;
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.22);
  transition: background 0.2s ease, border-color 0.2s ease;
  appearance: none;
}

.kaszt-category__header:hover {
  background: rgba(216, 180, 106, 0.08);
}

.kaszt-category__header::after {
  content: '▸';
  transition: transform 0.2s ease;
  font-size: 1.1em;
}

.kaszt-category.is-open .kaszt-category__header {
  border-color: rgba(216, 180, 106, 0.55);
  background: rgba(216, 180, 106, 0.08);
}

.kaszt-category.is-open .kaszt-category__header::after {
  transform: rotate(90deg);
}

.kaszt-category__content {
  display: none;
  gap: 6px;
  align-content: start;
}

.kaszt-category__content.is-open {
  display: grid;
}

.kaszt-item {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-family: var(--font-body);
}

.kaszt-item:hover {
  background: rgba(216, 180, 106, 0.12);
  border-color: rgba(216, 180, 106, 0.4);
  transform: translateX(4px);
}

.kaszt-item.is-selected {
  background: rgba(216, 180, 106, 0.2);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.kaszt-category__header:focus-visible,
.kaszt-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(216, 180, 106, 0.42);
}

/* Kaszt Preview Panel */
.kaszt-preview {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(125, 92, 44, 0.3);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kaszt-table-collapsible {
  margin-top: 1rem;
  border: 1px solid rgba(125, 92, 44, 0.45);
  border-left: 4px solid rgba(216, 180, 106, 0.72);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(26, 19, 14, 0.9), rgba(15, 11, 8, 0.92));
  padding: 10px 12px 12px;
}

.kaszt-table-collapsible__summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  user-select: none;
}

.kaszt-table-collapsible__summary::-webkit-details-marker {
  display: none;
}

.kaszt-table-collapsible__summary::after {
  content: '▾';
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.kaszt-table-collapsible:not([open]) .kaszt-table-collapsible__summary::after {
  transform: rotate(-90deg);
}

.kaszt-table-collapsible__body {
  margin-top: 10px;
}

.kaszt-stats__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 10px;
  color: var(--accent-strong);
}



.stat-label {
  cursor: help;
  border-bottom: 1px dotted var(--muted);
}

/* Level Control */
.level-control {
  background: rgba(12, 10, 8, 0.5);
  border-radius: 10px;
  padding: 12px;
  border: 1px solid rgba(125, 92, 44, 0.3);
}

.level-control__label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.level-control__slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.level-control__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(216, 180, 106, 0.5);
}

.level-control__slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(216, 180, 106, 0.5);
}

.level-control__value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--accent-strong);
  min-width: 24px;
  text-align: center;
}

.kaszt-level-control {
  display: grid;
  gap: 0.55rem;
}

.kaszt-level-control__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
  align-items: end;
}

.kaszt-level-control__field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.kaszt-level-control__field > span {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.kaszt-level-control__level-value {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
}

.kaszt-level-control__field > .number-input-shell {
  display: block;
  width: 100%;
}

.kaszt-level-control__field > .number-input-shell > input[type="number"] {
  width: 100%;
}

.kaszt-level-control__meta {
  color: var(--muted);
  font-size: 0.82rem;
}

/* Kaszt Skills */
.kaszt-skills__title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  margin: 0 0 10px;
  color: var(--accent);
}

.skill-level {
  margin-bottom: 12px;
}

.skill-level__header {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  padding-left: 4px;
}

/* Confirm Button */
.kaszt-confirm {
  width: 100%;
  margin-top: 8px;
}

/* Loading State */
body.is-loading .content__body {
  opacity: 0.5;
  pointer-events: none;
}

body.is-loading .content__title::after {
  content: '...';
  animation: dots 1.5s infinite;
}

@keyframes dots {

  0%,
  20% {
    content: '.';
  }

  40% {
    content: '..';
  }

  60%,
  100% {
    content: '...';
  }
}

/* Tooltip */
.tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: rgba(125, 92, 44, 0.3);
  border-radius: 50%;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: help;
  margin-left: 4px;
  position: relative;
}

.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 16, 12, 0.95);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
  color: var(--text);
  z-index: 100;
  box-shadow: var(--shadow);
}

/* Button Icon */
.btn__icon {
  font-size: 0.9em;
}

/* Scrollbar Styling */
.kaszt-container::-webkit-scrollbar,
.content__body::-webkit-scrollbar {
  width: 8px;
}

.kaszt-container::-webkit-scrollbar-track,
.content__body::-webkit-scrollbar-track {
  background: rgba(12, 10, 8, 0.5);
  border-radius: 4px;
}

.kaszt-container::-webkit-scrollbar-thumb,
.content__body::-webkit-scrollbar-thumb {
  background: rgba(125, 92, 44, 0.4);
  border-radius: 4px;
}

.kaszt-container::-webkit-scrollbar-thumb:hover,
.content__body::-webkit-scrollbar-thumb:hover {
  background: rgba(125, 92, 44, 0.6);
}

/* Level Preview */
.level-preview h4 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 8px;
}

/* Faj (Race) Selector Styles */
.faj-selector {
  display: grid;
  gap: 12px;
}

.faj-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(12, 10, 8, 0.6);
  color: var(--text);
  border: 1px solid rgba(125, 92, 44, 0.4);
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='%23c5b59a'%3E%3Cpath d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.faj-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(216, 180, 106, 0.2);
}

.faj-details {
  border-radius: 10px;
  background: rgba(12, 10, 8, 0.3);
  border: 1px solid rgba(125, 92, 44, 0.25);
  padding: 14px;
  display: grid;
  gap: 10px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: fadeUp 0.3s ease;
}

.faj-details__desc {
  color: var(--text);
}

.faj-details__stats {
  color: var(--accent-strong);
  font-size: 0.85rem;
}

.faj-details__specials {
  margin-top: 4px;
}

.faj-details__specials strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  margin-bottom: 4px;
  color: var(--muted);
  text-transform: uppercase;
}

.faj-details__specials ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Percentage Skills Box */
.percent-skills {
  margin-top: 16px;
  border-top: 1px solid rgba(125, 92, 44, 0.3);
  padding-top: 16px;
}

.percent-skills .kaszt-skills__title {
  color: var(--accent-strong);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.percent-skills .skill-list__item {
  background: rgba(216, 180, 106, 0.05);
  border: 1px solid rgba(216, 180, 106, 0.15);
}



/* Document View Styles (for Page 1 / Introduction) */
.document-page {
  /* No background or borders, just clean text flow */
  padding: 0 10px;
  color: var(--text);
  line-height: 1.5;
  max-width: 900px;
  margin: 0 auto;
}

.document-line {
  white-space: pre-wrap;
  /* Preserve spaces if any */
  margin-bottom: 2px;
  /* Small break between lines to mimic PDF */
}

/* Ensure strong emphasis for heading lines */
.document-line[style*="font-weight: bold"],
.document-line.is-heading {
  margin-top: 1.25em;
  /* Add more space before headings */
  margin-bottom: 0.75em;
  border-bottom: 1px solid rgba(125, 92, 44, 0.3);
  /* Subtle separator */
  padding-bottom: 4px;
}

/* DOCX Content Styling - Tables now handled by medieval styles at top */
.docx-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.document-line.is-list-item {
  padding-left: 1.5em;
  text-indent: -1.5em;
  margin-bottom: 4px;
}

.document-line.is-sub-list-item {
  padding-left: 3em;
  text-indent: -1.5em;
  margin-bottom: 2px;
  font-size: 0.95em !important;
  /* Slightly smaller if needed, but keeping alignment is key */
}

/* ========================================
   Matrix Table (Kaszt-Faj) Styles
   ======================================== */

.matrix-container {
  overflow-x: auto;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--edge);
  /* Ensure container itself is dark */
  background-color: var(--panel);
  color: var(--text);
  margin-top: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.matrix-container table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.9rem;
  /* Reset medieval styles */
  background: none;
  box-shadow: none;
  border-radius: 0;
  margin-bottom: 0;
}

.matrix-container th,
.matrix-container td {
  padding: 8px;
  text-align: center;
  border: 1px solid var(--edge);
  /* Base transparent cell background; specific cells override this. */
  background-color: transparent;
}

.matrix-container th {
  background-color: var(--panel-soft) !important;
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: normal;
  position: relative;
  border-bottom: 2px solid var(--edge-bright);
}

/* Rotated Headers */
.matrix-container th.rotate {
  height: 180px;
  /* Give enough space for longest text */
  vertical-align: bottom;
  padding: 8px 4px;
}

.matrix-container th.rotate>div {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  width: auto;
  margin: 0 auto;
  text-align: right;
  /* Aligns text to bottom because of 180deg rotation */
}

/* Row Headers (Sticky Left) */
.matrix-container .row-header {
  position: sticky;
  left: 0;
  z-index: 6;
  /* Needs to be above normal cells */
  background-color: var(--panel) !important;
  /* Must be opaque to hide scrolling content */
  text-align: left;
  font-family: var(--font-display);
  color: var(--accent);
  border-right: 2px solid var(--edge-bright);
  box-shadow: 2px 0 0 rgba(125, 92, 44, 0.55);
}

/* Alternating Rows (Zebra Striping) */
.matrix-container tr:nth-child(even) td:not(.row-header) {
  background-color: rgba(255, 255, 255, 0.03) !important;
}

/* Hover Effects */
.matrix-container tr:hover td:not(.row-header) {
  background-color: rgba(216, 180, 106, 0.08) !important;
}

.matrix-container td:not(.row-header):hover {
  background-color: rgba(216, 180, 106, 0.15) !important;
  /* Force highlight on cell hover */
  cursor: crosshair;
}

.matrix-container td.row-header:hover,
.matrix-container th.row-header:hover {
  background-color: var(--panel) !important;
  cursor: default;
}

/* Values (I/N) */
.val-i {
  color: var(--ok);
  font-weight: bold;
}

.val-n {
  color: var(--danger);
  opacity: 0.5;
}

/* ========================================
   Card Layout Refactor Styles
   ======================================== */

.sheet-full,
.sheet-full-kaszt {
  display: grid;
  gap: 20px;
  align-items: start;
}

.sheet-full {
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  container-type: inline-size;
}

.print-sheet {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.print-sheet__panel {
  min-height: 0;
}

.print-sheet [data-print-inventory-panel] {
  grid-column: 1 / -1;
}

.print-sheet [data-print-inventory-table] {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.print-sheet__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.92rem;
}

.print-sheet__table th,
.print-sheet__table td {
  border: 1px solid rgba(125, 92, 44, 0.35);
  padding: 8px 10px;
  vertical-align: top;
}

.print-sheet__table th {
  width: 42%;
  text-align: left;
  color: var(--accent);
  font-weight: 600;
  background: rgba(125, 92, 44, 0.12);
}

.print-sheet__table td {
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.sheet-full-kaszt {
  grid-template-columns: minmax(300px, 400px) 1fr;
}

.sheet-full--legacy {
  align-items: stretch;
  grid-auto-flow: row;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.sheet-full--legacy > * {
  min-width: 0;
  align-self: stretch;
}

.sheet-full--legacy > .panel {
  height: 100%;
}

.sheet-vitality-zodiac-panel__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.sheet-vitality-zodiac-panel__section {
  min-width: 0;
}

.sheet-vitality-zodiac-panel__section--vitality {
  border-top: 1px dashed rgba(125, 92, 44, 0.35);
  padding-top: 14px;
}

.sheet-vitality-zodiac-panel [data-sheet-primary="vitality"] .stat-grid {
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  margin-top: 0;
}

.sheet-full--legacy > [data-kaszt-preview-panel],
.sheet-full--legacy > [data-character-skills-panel],
.sheet-full--legacy > [data-character-equipment-panel] {
  grid-column: 1 / -1;
}

@media (min-width: 1600px) {
  .sheet-full--legacy {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.complex-quick-form {
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
}

.ability-combat-allocation-step {
  display: grid;
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.ability-combat-allocation-step__allocation {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 16px;
  align-items: stretch;
  min-width: 0;
}

.ability-combat-allocation-step > *,
.ability-combat-allocation-step__allocation > * {
  min-width: 0;
}

/* Enhanced Panel Styles for Cards */
.panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-left: 3px solid rgba(125, 92, 44, 0.55);
}

/* Wizard text consistency */
.docx-content {
  display: grid;
  gap: 1rem;
  min-width: 0;
  max-width: 100%;
  font-size: 1.05rem;
  line-height: 1.65;
}

.docx-content--table-panels {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
}

.docx-content--table-panels > :not(.docx-table-panel) {
  grid-column: 1 / -1;
}

.docx-content--table-panels > .docx-table-panel {
  min-width: 0;
  align-self: start;
}

.docx-content--table-panels > .table-responsive.docx-table-panel,
.docx-content--table-panels > .docx-table-panel > .table-responsive:last-child {
  margin-bottom: 0;
}

.docx-content h1,
.docx-content h2,
.docx-content h3,
.docx-content h4 {
  font-family: var(--font-display);
  color: var(--accent-strong);
  line-height: 1.25;
  letter-spacing: 0.03em;
  margin: 0.4rem 0 0.2rem;
}

.docx-content p,
.docx-content li {
  color: var(--text);
  line-height: 1.65;
}

.docx-content .material-type-title {
  color: #f3e7cf;
  font-size: 1.15em;
  line-height: 1.3;
}

/* Long-form reading copy: justify on desktop, but keep table text left-aligned. */
@media (min-width: 761px) {
  .docx-content p,
  .docx-content li {
    text-align: justify;
    text-wrap: pretty;
    hyphens: auto;
  }

  .docx-content .table-responsive :is(p, li),
  .docx-content table :is(p, li) {
    text-align: left;
    text-wrap: wrap;
    hyphens: manual;
  }
}

.docx-content ul,
.docx-content ol {
  margin: 0.25rem 0 0.8rem;
  padding-left: 1.4rem;
}

/* Reading-focused sections: keep prose blocks in a cleaner measure. */
.docx-content--reading :is(h1, h2, h3, h4, p, ul, ol) {
  width: min(1120px, 100%);
  margin-inline: auto;
}

.docx-content--reading :is(ul, ol) {
  padding-left: 1.6rem;
}

.docx-content img {
  display: block;
  margin: 0 auto;
}

.classic-char-copy {
  display: grid;
  gap: 1rem;
  max-width: min(1120px, 100%);
  margin: 0 auto;
}

.classic-char-copy p {
  margin: 0;
  text-align: justify;
  text-wrap: pretty;
  hyphens: auto;
}

.classic-char-bands {
  width: fit-content;
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(230px, auto) auto;
  column-gap: 2.3rem;
  row-gap: 0.2rem;
  margin-top: 0.2rem;
}

.classic-char-bands__value {
  white-space: nowrap;
}

.classic-char-note {
  margin-top: -0.1rem;
}

@media (max-width: 760px) {
  .docx-content--table-panels {
    grid-template-columns: 1fr;
  }

  .classic-char-copy p {
    text-align: left;
    hyphens: manual;
  }

  .classic-char-bands {
    width: 100%;
    grid-template-columns: 1fr;
    row-gap: 0.05rem;
  }

  .classic-char-bands__value {
    margin-bottom: 0.45rem;
  }
}

.callout {
  border-left: 3px solid rgba(125, 92, 44, 0.6);
}

/* Stat Grid for Level Preview & Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 0.75rem;
}

.stat-item {
  background: rgba(12, 10, 8, 0.5);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(125, 92, 44, 0.34);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-item__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: center;
}

.stat-item__value {
  font-size: 1.1rem;
  color: var(--accent-strong);
  font-family: var(--font-display);
}

/* Skill List Styling */
.skill-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.skill-list__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  font-size: 0.9rem;
  border: 1px solid rgba(125, 92, 44, 0.2);
}

.skill-list__item:hover {
  background: rgba(216, 180, 106, 0.08);
  border-color: rgba(216, 180, 106, 0.4);
}

.skill-name {
  color: var(--text);
}

.skill-grade {
  color: var(--accent);
  font-weight: bold;
  white-space: nowrap;
}

[data-magic-resistance-modifiers] {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(216, 180, 106, 0.22);
}

[data-magic-resistance-modifiers] .magic-resistance-modifiers__title {
  margin: 0 0 0.55rem;
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 700;
}

[data-magic-resistance-modifiers] .skill-list__item {
  align-items: flex-start;
  flex-wrap: wrap;
}

[data-magic-resistance-modifiers] .skill-name {
  flex: 1 1 10rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

[data-magic-resistance-modifiers] .skill-grade {
  flex: 999 1 18rem;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
  line-height: 1.45;
}

.input,
.input--sm {
  background: rgba(10, 8, 6, 0.85);
  color: var(--text);
  border: 1px solid rgba(125, 92, 44, 0.45);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.input:focus,
.input--sm:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(216, 180, 106, 0.22);
}

/* Custom stepper for all number inputs (browser-native spinner hidden) */
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.number-input-shell {
  position: relative;
  display: inline-block;
  max-width: 100%;
  vertical-align: middle;
}

.number-input-shell > input[type="number"] {
  padding-right: 2rem;
}

.number-input-stepper {
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  width: 1.4rem;
  border-radius: 8px;
  border: 1px solid rgba(125, 92, 44, 0.62);
  background: linear-gradient(180deg, rgba(42, 31, 22, 0.92), rgba(21, 16, 12, 0.95));
  display: grid;
  grid-template-rows: 1fr 1fr;
  overflow: hidden;
}

.number-input-stepper-btn {
  border: 0;
  margin: 0;
  padding: 0;
  font-family: var(--font-display);
  font-size: 0.6rem;
  line-height: 1;
  color: var(--accent);
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.number-input-stepper-btn + .number-input-stepper-btn {
  border-top: 1px solid rgba(125, 92, 44, 0.52);
}

.number-input-stepper-btn:hover {
  color: var(--accent-strong);
  background: rgba(216, 180, 106, 0.16);
}

.number-input-stepper-btn:active {
  background: rgba(216, 180, 106, 0.24);
}

.number-input-stepper-btn:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(240, 211, 138, 0.65);
}

.form__field > .number-input-shell {
  display: block;
  width: 100%;
}

.form__field > .number-input-shell > input[type="number"] {
  width: 100%;
}

.text-success {
  color: var(--ok);
}

.text-error {
  color: var(--danger);
}

.ability-allocation {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.2rem;
}

.ability-allocation__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.ability-allocation__toolbar-text {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  flex: 1 1 320px;
}

.ability-allocation__reset {
  padding: 8px 12px;
  font-size: 0.68rem;
}

.ability-allocation__rows {
  display: grid;
  gap: 0.55rem;
}

.ability-allocation__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid rgba(125, 92, 44, 0.28);
  border-radius: 12px;
  background: rgba(12, 10, 8, 0.38);
  padding: 10px;
}

.ability-allocation__label-box {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.ability-allocation__label {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.ability-allocation__hint {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.ability-allocation__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ability-allocation__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border-radius: 999px;
  border: 1px solid rgba(125, 92, 44, 0.35);
  background: rgba(20, 16, 12, 0.6);
  color: var(--muted);
  padding: 3px 8px;
  font-size: 0.74rem;
  line-height: 1.2;
}

.ability-allocation__chip--accent {
  color: var(--accent-strong);
  border-color: rgba(216, 180, 106, 0.35);
  background: rgba(216, 180, 106, 0.07);
}

.ability-allocation__controls {
  display: grid;
  grid-template-columns: auto minmax(88px, 104px) auto;
  grid-template-areas: "dec input inc";
  gap: 0.35rem 0.45rem;
  align-items: center;
  justify-items: stretch;
}

.ability-allocation__controls > .number-input-shell {
  grid-area: input;
  display: block;
  width: 100%;
}

.ability-allocation__step {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  border: 1px solid rgba(125, 92, 44, 0.58);
  background: linear-gradient(180deg, rgba(42, 31, 22, 0.92), rgba(21, 16, 12, 0.95));
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.ability-allocation__step[data-ability-allocation-step="decrement"] {
  grid-area: dec;
}

.ability-allocation__step[data-ability-allocation-step="increment"] {
  grid-area: inc;
}

.ability-allocation__step:hover:not(:disabled) {
  border-color: rgba(216, 180, 106, 0.65);
  background: rgba(216, 180, 106, 0.16);
  transform: translateY(-1px);
}

.ability-allocation__step:focus-visible {
  outline: 2px solid rgba(216, 180, 106, 0.45);
  outline-offset: 2px;
}

.ability-allocation__step:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.ability-allocation__input {
  grid-area: input;
  width: 100%;
  min-width: 0;
  text-align: center;
  background: rgba(10, 8, 6, 0.85);
  color: var(--text);
  border: 1px solid rgba(125, 92, 44, 0.45);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.ability-allocation__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(216, 180, 106, 0.22);
}

.ability-allocation__delta {
  grid-area: delta;
  text-align: center;
  border-radius: 999px;
  border: 1px solid rgba(125, 92, 44, 0.28);
  padding: 2px 8px;
  font-size: 0.74rem;
  color: var(--muted);
  background: rgba(12, 10, 8, 0.42);
}

.ability-allocation__delta.is-positive {
  color: #a9d7b2;
  border-color: rgba(84, 153, 102, 0.4);
  background: rgba(63, 119, 74, 0.12);
}

.ability-allocation__delta.is-negative {
  color: #f0c59f;
  border-color: rgba(184, 117, 52, 0.45);
  background: rgba(184, 117, 52, 0.11);
}

.ability-allocation__details {
  border: 1px solid rgba(125, 92, 44, 0.22);
  border-radius: 12px;
  background: rgba(12, 10, 8, 0.28);
  padding: 0.35rem 0.6rem;
}

.ability-allocation__details > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.2rem 0;
  user-select: none;
}

.ability-allocation__details > summary:hover {
  color: var(--accent);
}

.ability-allocation__details-rows {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(125, 92, 44, 0.25);
}

.ability-allocation__details-row {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

@media (min-width: 761px) {
  .ability-allocation__controls {
    grid-template-columns: minmax(88px, 104px);
    grid-template-areas: "input";
  }

  .ability-allocation__controls > .ability-allocation__step {
    display: none;
  }
}

@media (max-width: 760px) {
  .ability-allocation__row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ability-allocation__controls {
    justify-content: stretch;
    grid-template-columns: minmax(0, 1fr) minmax(88px, 110px) minmax(0, 1fr);
  }

  .ability-allocation__step {
    width: 100%;
  }
}

/* ========================================
   Creation Mode Switcher
   ======================================== */

.mode-switch-container {
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  border-left: 3px solid rgba(125, 92, 44, 0.55);
}

.mode-switch-label {
  font-weight: bold;
  color: var(--accent);
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.mode-toggle {
  display: flex;
  gap: 8px;
  background: rgba(10, 8, 6, 0.5);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(125, 92, 44, 0.3);
}

.mode-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.mode-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.mode-btn.is-active {
  background: var(--accent);
  color: var(--bg-0);
  font-weight: bold;
  border-color: rgba(216, 180, 106, 0.7);
  box-shadow: 0 0 10px rgba(216, 180, 106, 0.4);
}

/* ========================================
   Route Choice Cards (Section: Útválasztás)
   ======================================== */

.mode-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.mode-choice-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2vw, 2rem);
  color: var(--accent-strong);
}

.mode-choice-card {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
  text-align: left;
  border: 1px solid rgba(125, 92, 44, 0.45);
  border-left: 6px solid rgba(216, 180, 106, 0.72);
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(22, 17, 13, 0.92), rgba(13, 10, 8, 0.95));
  color: var(--text);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.mode-choice-card:hover {
  border-color: var(--accent);
  border-left-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.mode-choice-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mode-choice-card.is-active {
  border-color: var(--accent);
  border-left-color: var(--accent-strong);
  background: linear-gradient(150deg, rgba(40, 29, 17, 0.9), rgba(17, 13, 10, 0.96));
  box-shadow: inset 0 0 24px rgba(216, 180, 106, 0.2);
}

.mode-choice-title {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 1.55vw, 1.95rem);
  line-height: 1.2;
  font-weight: 700;
  text-align: center;
}

.mode-choice-media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.mode-choice-media img {
  max-width: 100%;
  max-height: 250px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}

.mode-choice-copy {
  font-size: clamp(1.12rem, 1.2vw, 1.35rem);
  line-height: 1.55;
  font-weight: 600;
  color: #e6dac2;
}

/* ========================================
   KFP Distributor (Fantasy UI)
   ======================================== */

.kfp-distributor {
  display: grid;
  gap: 1rem;
}

.kfp-distributor--compact {
  gap: 0.75rem;
}

.kfp-distributor[data-kfp-context="sheet"] .kfp-header {
  margin: 0;
}

.kfp-distributor--compact .kfp-header {
  padding: 12px 14px;
  gap: 0.75rem;
}

.kfp-distributor--compact .kfp-heading {
  gap: 0.4rem;
}

.kfp-distributor--compact .kfp-title {
  font-size: 0.95rem;
}

.kfp-distributor--compact .kfp-subtitle {
  font-size: 0.85rem;
}

.kfp-distributor--compact .kfp-controls {
  gap: 0.35rem;
  padding-bottom: 0.65rem;
}

.kfp-distributor--compact .kfp-level-control {
  gap: 0.45rem;
}

.kfp-distributor--compact .kfp-level-input {
  width: 82px;
}

.kfp-distributor--compact .kfp-level-display {
  width: 82px;
  min-height: 36px;
}

.kfp-distributor--compact .kfp-summary {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.45rem;
}

.kfp-distributor--compact .kfp-total,
.kfp-distributor--compact .kfp-used,
.kfp-distributor--compact .kfp-remaining {
  padding: 7px 8px;
  font-size: 0.86rem;
}

.kfp-distributor--compact .kfp-grid {
  gap: 0.55rem;
}

.kfp-distributor--compact .kfp-row {
  padding: 8px 10px;
  gap: 0.45rem;
}

.kfp-distributor--compact .kfp-controls-inline {
  gap: 0.55rem;
}

.kfp-distributor--compact .kfp-input {
  width: 78px;
  font-size: 0.95rem;
}

.kfp-distributor--compact .kfp-meta {
  gap: 0.5rem;
  font-size: 0.85rem;
}

.kfp-classic-note {
  border-left-color: var(--accent);
}

.kfp-header {
  background: linear-gradient(165deg, rgba(26, 20, 14, 0.96), rgba(12, 9, 7, 0.96));
  border: 1px solid rgba(125, 92, 44, 0.55);
  border-left: 6px solid rgba(216, 180, 106, 0.75);
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  gap: 0.9rem;
  box-shadow: inset 0 0 18px rgba(216, 180, 106, 0.08);
}

.kfp-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
}

.kfp-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.kfp-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.kfp-controls {
  display: grid;
  gap: 0.4rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(125, 92, 44, 0.35);
}

.kfp-level-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.92rem;
}

.kfp-level-control span {
  color: var(--accent);
  font-family: var(--font-display);
}

.kfp-level-input {
  width: 96px;
  text-align: center;
}

.kfp-level-display {
  width: 96px;
  text-align: center;
  font-family: var(--font-display);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kfp-controls small {
  color: var(--muted);
}

.kfp-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.55rem;
}

.kfp-total,
.kfp-used,
.kfp-remaining {
  background: rgba(11, 9, 7, 0.68);
  border: 1px solid rgba(125, 92, 44, 0.42);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.92rem;
}

.kfp-total strong,
.kfp-used span,
.kfp-remaining span {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-left: 0.25rem;
}

.kfp-progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(8, 7, 5, 0.82);
  border: 1px solid rgba(125, 92, 44, 0.45);
  overflow: hidden;
}

.kfp-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #be8b35, #f4d89a);
  transition: width 0.2s ease;
}

.kfp-info {
  color: var(--muted);
  font-size: 0.88rem;
}

.kfp-grid {
  display: grid;
  gap: 0.75rem;
}

.kfp-row {
  background: rgba(14, 11, 8, 0.75);
  border: 1px solid rgba(125, 92, 44, 0.45);
  border-left: 4px solid rgba(125, 92, 44, 0.65);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 0.55rem;
}

.kfp-row.is-near-limit {
  border-left-color: #d39a3f;
}

.kfp-row.is-over-limit {
  border-left-color: var(--danger);
}

.kfp-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.kfp-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--accent-strong);
}

.kfp-cost {
  font-size: 0.82rem;
  color: var(--muted);
}

.kfp-controls-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.kfp-input-wrapper {
  flex: 0 0 auto;
}

.kfp-input {
  width: 90px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1rem;
}

.kfp-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
}

.kfp-subtotal {
  font-family: var(--font-display);
  color: var(--accent);
}

.kfp-row-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(125, 92, 44, 0.3);
  overflow: hidden;
}

.kfp-row-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(216, 180, 106, 0.5), rgba(216, 180, 106, 1));
  transition: width 0.2s ease;
}

.kfp-input.is-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(178, 74, 62, 0.28);
}

/* ========================================
   Skills Step
   ======================================== */

.skills-step {
  display: grid;
  gap: 1rem;
}

.skills-intro {
  border-left: 4px solid rgba(216, 180, 106, 0.72);
}

.skills-kp-rail {
  position: sticky;
  top: var(--skills-kp-rail-top, 112px);
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(125, 92, 44, 0.48);
  border-left: 4px solid rgba(216, 180, 106, 0.72);
  background: linear-gradient(180deg, rgba(29, 22, 17, 0.96), rgba(17, 13, 10, 0.96));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.skills-kp-rail__primary {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.skills-kp-rail__label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.skills-kp-rail__value {
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1;
}

.skills-kp-rail__meta {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.skills-kp-rail--ok .skills-kp-rail__value {
  color: #b5e3c7;
}

.skills-kp-rail--muted {
  border-left-color: rgba(145, 136, 122, 0.65);
}

.skills-kp-rail--muted .skills-kp-rail__value {
  color: #c6bda8;
}

.skills-kp-rail--warn {
  border-left-color: rgba(242, 179, 79, 0.78);
}

.skills-kp-rail--warn .skills-kp-rail__value {
  color: #f2c978;
}

.skills-kp-rail--danger {
  border-left-color: rgba(226, 130, 114, 0.82);
}

.skills-kp-rail--danger .skills-kp-rail__value {
  color: #f0a091;
}

.skills-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.6rem;
}

.skills-summary__card {
  background: rgba(11, 9, 7, 0.7);
  border: 1px solid rgba(125, 92, 44, 0.42);
  border-radius: 10px;
  padding: 9px 10px;
  display: grid;
  gap: 0.25rem;
}

.skills-summary__label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.skills-summary__value {
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 1rem;
}

.skills-summary__card--ok .skills-summary__value {
  color: #9fd0ad;
}

.skills-summary__card--danger .skills-summary__value {
  color: #e28272;
}

.skills-filters {
  background: rgba(14, 11, 8, 0.75);
  border: 1px solid rgba(125, 92, 44, 0.4);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(180px, 0.9fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.skills-filter {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.skills-filter span {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.skills-filter__input {
  width: 100%;
}

.skills-filter-count {
  color: var(--muted);
  font-size: 0.86rem;
  justify-self: end;
  white-space: nowrap;
}

.skills-table-shell {
  margin-bottom: 0;
}

.skills-table {
  min-width: 980px;
}

.skills-row--af td {
  background: rgba(216, 180, 106, 0.08);
}

.skills-row--mf td {
  background: rgba(95, 159, 122, 0.14);
}

.skills-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(125, 92, 44, 0.5);
  background: rgba(20, 16, 13, 0.75);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.skills-badge--af {
  color: var(--accent-strong);
  border-color: rgba(216, 180, 106, 0.56);
}

.skills-badge--mf {
  color: #b5e3c7;
  border-color: rgba(95, 159, 122, 0.65);
}

.skills-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  min-width: 170px;
}

.skills-action-btn,
.skills-remove-btn {
  padding: 6px 10px;
  font-size: 0.82rem;
  border-radius: 10px;
}

.skills-remove-btn {
  border-color: rgba(178, 74, 62, 0.45);
  color: #efc2bb;
}

.skills-remove-btn:hover {
  border-color: rgba(178, 74, 62, 0.75);
  color: #ffd5ce;
}

.skills-summary--percent {
  margin-top: -0.2rem;
}

.skills-percent-note {
  margin-top: -0.2rem;
}

.skills-percent-panel {
  background: rgba(14, 11, 8, 0.72);
  border: 1px solid rgba(125, 92, 44, 0.4);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 0.7rem;
}

.skills-percent-panel__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--accent-strong);
}

.skills-repeatable-details {
  padding: 0;
  gap: 0;
}

.skills-repeatable-details__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 10px 12px;
}

.skills-repeatable-details__summary::-webkit-details-marker {
  display: none;
}

.skills-repeatable-details__summary::after {
  content: "";
  width: 0.72rem;
  height: 0.72rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
  flex: 0 0 auto;
  margin-right: 0.1rem;
  color: var(--accent-strong);
}

.skills-repeatable-details:not([open]) .skills-repeatable-details__summary::after {
  transform: rotate(-45deg);
}

.skills-repeatable-details__body {
  display: grid;
  gap: 0.7rem;
  padding: 0 12px 10px;
}

.skills-repeatable-group {
  display: grid;
  gap: 0.7rem;
}

.skills-repeatable-group + .skills-repeatable-group {
  padding-top: 0.5rem;
  border-top: 1px solid rgba(125, 92, 44, 0.24);
}

.skills-repeatable-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.skills-repeatable-group__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.skills-repeatable-table {
  min-width: 820px;
}

.skills-repeatable-name-input,
.skills-language-select {
  min-width: 180px;
  width: 100%;
}

.skills-language-note {
  margin: -0.1rem 0 0;
}

.skills-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.skills-percent-table {
  min-width: 940px;
}

.skills-percent-input {
  width: 92px;
  text-align: right;
}

.skills-percent-row__total {
  color: var(--accent-strong);
  font-family: var(--font-display);
}

@media (max-width: 720px) {
  .skills-kp-rail {
    align-items: flex-start;
    flex-direction: column;
  }

  .skills-kp-rail__meta {
    text-align: left;
  }
}

@media (max-width: 760px) {
  .skills-table-shell,
  .skills-percent-table-shell,
  .skills-repeatable-table-shell {
    padding: 8px;
    border-left-width: 1px;
  }

  .skills-table,
  .skills-percent-table,
  .skills-repeatable-table,
  .skills-language-table {
    width: 100%;
    min-width: 0;
    border: none;
    background: transparent;
  }

  .skills-table thead,
  .skills-percent-table thead,
  .skills-repeatable-table thead,
  .skills-language-table thead {
    display: none;
  }

  .skills-table tbody,
  .skills-percent-table tbody,
  .skills-repeatable-table tbody,
  .skills-language-table tbody {
    display: grid;
    gap: 10px;
  }

  .skills-table tbody tr,
  .skills-percent-table tbody tr,
  .skills-repeatable-table tbody tr,
  .skills-language-table tbody tr {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(125, 92, 44, 0.52);
    border-left: 3px solid rgba(216, 180, 106, 0.7);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(27, 21, 16, 0.96), rgba(16, 12, 9, 0.96));
  }

  .skills-table tbody tr.skills-row--af,
  .skills-repeatable-table tbody tr.skills-row--af,
  .skills-language-table tbody tr.skills-row--af {
    border-left-color: rgba(216, 180, 106, 0.88);
  }

  .skills-table tbody tr.skills-row--mf,
  .skills-repeatable-table tbody tr.skills-row--mf,
  .skills-language-table tbody tr.skills-row--mf {
    border-left-color: rgba(95, 159, 122, 0.86);
  }

  .skills-table tbody tr td,
  .skills-percent-table tbody tr td,
  .skills-repeatable-table tbody tr td,
  .skills-language-table tbody tr td {
    display: grid;
    grid-template-columns: minmax(88px, 40%) 1fr;
    gap: 8px;
    align-items: start;
    padding: 0;
    border: none;
    background: transparent !important;
    white-space: normal;
  }

  .skills-table tbody tr td::before,
  .skills-percent-table tbody tr td::before,
  .skills-repeatable-table tbody tr td::before,
  .skills-language-table tbody tr td::before {
    content: attr(data-label);
    font-family: var(--font-display);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    opacity: 0.95;
  }

  .skills-table tbody tr td:first-child,
  .skills-percent-table tbody tr td:first-child,
  .skills-repeatable-table tbody tr td:first-child,
  .skills-language-table tbody tr td:first-child {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 4px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(125, 92, 44, 0.3);
    font-family: var(--font-display);
    color: var(--accent-strong);
  }

  .skills-table tbody tr td:first-child::before,
  .skills-percent-table tbody tr td:first-child::before,
  .skills-repeatable-table tbody tr td:first-child::before,
  .skills-language-table tbody tr td:first-child::before {
    display: none;
  }

  .skills-repeatable-name-input,
  .skills-language-select,
  .skills-percent-input {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .skills-actions {
    min-width: 0;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .skills-actions .skills-action-btn,
  .skills-actions .skills-remove-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================
   Advantages Step
   ======================================== */

.advantages-planner {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.advantages-planner__meta {
  margin: 0;
}

.advantages-planner__fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem;
}

.advantages-planner__field {
  display: grid;
  gap: 0.35rem;
}

.advantages-planner__field > span {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ========================================
   Weapon Shop Step
   ======================================== */

.weapon-step {
  display: grid;
  gap: 1rem;
}

.weapon-intro {
  border-left: 4px solid rgba(216, 180, 106, 0.72);
}

.weapon-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.6rem;
}

.weapon-summary__card {
  background: rgba(11, 9, 7, 0.7);
  border: 1px solid rgba(125, 92, 44, 0.42);
  border-radius: 10px;
  padding: 9px 10px;
  display: grid;
  gap: 0.3rem;
}

.weapon-summary__label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.weapon-summary__value {
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 0.98rem;
}

.weapon-summary__card--ok .weapon-summary__value {
  color: #9fd0ad;
}

.weapon-summary__card--danger .weapon-summary__value {
  color: #e28272;
}

.weapon-top-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  align-items: start;
  width: 100%;
  max-width: 100%;
}

.weapon-panel {
  display: grid;
  gap: 0.7rem;
  align-content: start;
}

.weapon-panel__title {
  margin: 0;
}

.weapon-panel__meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.weapon-panel__meta-stack {
  display: grid;
  gap: 0.25rem;
}

.weapon-panel__meta-stack .weapon-panel__meta {
  line-height: 1.35;
}

.weapon-base-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 0.5rem;
  align-content: start;
  align-items: start;
}

.weapon-base-card {
  border: 1px solid rgba(125, 92, 44, 0.35);
  border-radius: 10px;
  background: rgba(11, 9, 7, 0.62);
  padding: 8px 10px;
  display: grid;
  gap: 0.25rem;
  align-content: start;
}

.weapon-equipped-summary {
  border: 1px solid rgba(125, 92, 44, 0.35);
  border-radius: 10px;
  background: rgba(11, 9, 7, 0.5);
  padding: 10px;
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.weapon-equipped-summary__title {
  margin: 0;
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 1rem;
}

.weapon-equipped-summary__row {
  display: grid;
  grid-template-columns: minmax(96px, max-content) minmax(0, 1fr);
  gap: 0.2rem 0.6rem;
  align-items: baseline;
  min-width: 0;
}

.weapon-equipped-summary__label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.weapon-equipped-summary__value {
  color: var(--text);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
  min-width: 0;
}

.weapon-equipped-summary__meta {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.weapon-equipped-summary__armor-list {
  display: grid;
  gap: 0.45rem;
}

.weapon-equipped-summary__weapon {
  border: 1px solid rgba(125, 92, 44, 0.3);
  border-radius: 10px;
  background: rgba(14, 11, 8, 0.45);
  padding: 8px;
  display: grid;
  gap: 0.5rem;
  min-width: 0;
}

.weapon-equipped-summary__weapon .weapon-result-item__head {
  align-items: start;
}

.weapon-equipped-summary__weapon .weapon-equipped-summary__meta {
  grid-column: auto;
}

.weapon-base-card__label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.weapon-base-card__value {
  color: var(--accent-strong);
  font-family: var(--font-display);
}

.weapon-base-card__detail {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

.weapon-empty {
  margin: 0;
}

.weapon-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.weapon-result-item {
  border: 1px solid rgba(125, 92, 44, 0.35);
  border-radius: 10px;
  background: rgba(11, 9, 7, 0.62);
  padding: 0.6rem 0.65rem;
  display: grid;
  gap: 0.35rem;
}

.weapon-result-item__head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
  color: var(--accent-strong);
  font-family: var(--font-display);
}

.weapon-result-item__main {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.weapon-result-variant-select {
  min-width: 180px;
  max-width: 100%;
}

.weapon-result-rune-select {
  min-width: 180px;
  max-width: 100%;
}

.weapon-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.75rem, max-content));
  justify-content: start;
  gap: 0.45rem;
}

.weapon-result-card {
  padding: 7px 8px;
}

.weapon-result-card .weapon-base-card__label {
  font-size: 0.72rem;
}

.weapon-result-card .weapon-base-card__value {
  font-size: 0.9rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.weapon-filters {
  background: rgba(14, 11, 8, 0.75);
  border: 1px solid rgba(125, 92, 44, 0.4);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.weapon-filter {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.weapon-filter span {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.weapon-filter__input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.weapon-filter-count {
  color: var(--muted);
  font-size: 0.86rem;
  justify-self: end;
  white-space: nowrap;
}

.weapon-loadout-controls {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  align-items: start;
}

.weapon-loadout-controls .weapon-filter {
  min-width: 0;
}

.weapon-filter__title-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.weapon-filter__title-link:hover,
.weapon-filter__title-link:focus-visible {
  color: var(--accent-strong);
  text-decoration: underline;
}

.weapon-catalog-shell {
  margin-bottom: 0;
}

.weapon-catalog-table {
  min-width: 1200px;
}

.weapon-catalog-table :is(th, td):nth-child(1) {
  width: 22%;
}

.weapon-catalog-table :is(th, td):nth-child(2) {
  width: 9%;
}

.weapon-catalog-table :is(th, td):nth-child(3),
.weapon-catalog-table :is(th, td):nth-child(4),
.weapon-catalog-table :is(th, td):nth-child(5),
.weapon-catalog-table :is(th, td):nth-child(6) {
  width: 5.5%;
}

.weapon-catalog-table :is(th, td):nth-child(7) {
  width: 13%;
}

.weapon-catalog-table :is(th, td):nth-child(8) {
  width: 8%;
}

.weapon-catalog-table :is(th, td):nth-child(9) {
  width: 5.5%;
}

.weapon-catalog-table :is(th, td):nth-child(10) {
  width: 7.5%;
}

.weapon-catalog-table :is(th, td):nth-child(11) {
  width: 5%;
}

.weapon-catalog-table :is(th, td):nth-child(12) {
  width: 9.5%;
}

.weapon-price-sub {
  color: var(--muted);
  font-size: 0.8rem;
  display: block;
  margin-top: 2px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}

.weapon-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.weapon-actions__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.weapon-action-btn {
  padding: 6px 10px;
  font-size: 0.82rem;
  border-radius: 10px;
}

/* ========================================
   Equipment Shop Step
   ======================================== */

.equipment-step {
  display: grid;
  gap: 1rem;
}

.equipment-intro {
  border-left: 4px solid rgba(216, 180, 106, 0.72);
}

.equipment-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.6rem;
}

.equipment-summary__card {
  background: rgba(11, 9, 7, 0.7);
  border: 1px solid rgba(125, 92, 44, 0.42);
  border-radius: 10px;
  padding: 9px 10px;
  display: grid;
  gap: 0.3rem;
}

.equipment-summary__label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.equipment-summary__value {
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 0.98rem;
}

.equipment-summary__card--ok .equipment-summary__value {
  color: #9fd0ad;
}

.equipment-summary__card--danger .equipment-summary__value {
  color: #e28272;
}

.equipment-top-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0.9rem;
  align-items: start;
}

.equipment-conversion-shell {
  width: min(620px, 100%);
  max-width: 100%;
  justify-self: start;
  margin-bottom: 0;
}

.equipment-conversion-table {
  min-width: 0 !important;
  width: 100% !important;
}

.equipment-quick-basket {
  display: grid;
  gap: 0.7rem;
}

.equipment-quick-title {
  margin: 0;
}

.equipment-quick-empty {
  margin: 0;
}

.equipment-quick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.equipment-quick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(125, 92, 44, 0.35);
  background: rgba(11, 9, 7, 0.62);
}

.equipment-quick-main {
  min-width: 0;
}

.equipment-quick-name {
  font-family: var(--font-display);
  color: var(--accent-strong);
  font-size: 0.9rem;
  line-height: 1.3;
}

.equipment-quick-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.equipment-quick-remove {
  padding: 4px 9px;
  font-size: 0.78rem;
  border-radius: 9px;
  border-color: rgba(178, 74, 62, 0.45);
  color: #efc2bb;
}

.equipment-quick-remove:hover {
  border-color: rgba(178, 74, 62, 0.75);
  color: #ffd5ce;
}

.equipment-filters {
  background: rgba(14, 11, 8, 0.75);
  border: 1px solid rgba(125, 92, 44, 0.4);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.equipment-filter-details {
  display: grid;
  gap: 0.8rem;
  margin: 0;
}

.equipment-filter-details__summary {
  display: none;
  list-style: none;
}

.equipment-filter-details__summary::-webkit-details-marker {
  display: none;
}

.equipment-filter-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(216, 180, 106, 0.42);
  background: linear-gradient(150deg, rgba(32, 24, 18, 0.96), rgba(18, 13, 10, 0.96));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  position: relative;
  padding-right: 40px;
}

.equipment-filter-summary::after {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-60%) rotate(45deg);
  transition: transform 160ms ease;
  color: var(--accent-strong);
  position: absolute;
  right: 15px;
  top: 50%;
}

.equipment-filter-details:not([open]) .equipment-filter-summary::after {
  transform: translateY(-35%) rotate(-45deg);
}

.equipment-filter-summary__copy {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.equipment-filter-summary__label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.equipment-filter-summary__meta {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.equipment-filter-summary__count {
  color: var(--accent);
  font-size: 0.82rem;
  white-space: nowrap;
}

.equipment-filter-details__body {
  display: grid;
  gap: 0.8rem;
}

.equipment-filter {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.equipment-filter span {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.equipment-filter__input {
  width: 100%;
}

.equipment-filter-count {
  color: var(--muted);
  font-size: 0.86rem;
  justify-self: end;
  white-space: nowrap;
}

.equipment-catalog-shell,
.equipment-basket-shell {
  margin-bottom: 0;
}

.equipment-catalog-groups {
  display: grid;
  gap: 0.9rem;
}

.equipment-catalog-group {
  display: grid;
  gap: 0.7rem;
}

.equipment-catalog-group__summary {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(125, 92, 44, 0.42);
  background: rgba(16, 12, 9, 0.82);
  cursor: pointer;
  position: relative;
  padding-right: 40px;
}

.equipment-catalog-group__summary::-webkit-details-marker {
  display: none;
}

.equipment-catalog-group__summary::after {
  content: "";
  width: 0.72rem;
  height: 0.72rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-60%) rotate(45deg);
  transition: transform 160ms ease;
  color: var(--accent-strong);
  position: absolute;
  right: 15px;
  top: 50%;
}

.equipment-catalog-group:not([open]) .equipment-catalog-group__summary::after {
  transform: translateY(-35%) rotate(-45deg);
}

.equipment-catalog-group__summary-copy {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.equipment-catalog-group__summary-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  color: var(--accent-strong);
}

.equipment-catalog-group__summary-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.equipment-catalog-group__body {
  display: grid;
  gap: 0.7rem;
}

.equipment-catalog-table {
  min-width: 1050px;
}

.equipment-basket-table {
  min-width: 860px;
}

.equipment-price-sub {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.equipment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.equipment-action-btn,
.equipment-remove-btn {
  padding: 6px 10px;
  font-size: 0.82rem;
  border-radius: 10px;
}

.equipment-remove-btn {
  border-color: rgba(178, 74, 62, 0.45);
  color: #efc2bb;
}

.equipment-remove-btn:hover {
  border-color: rgba(178, 74, 62, 0.75);
  color: #ffd5ce;
}

.sheet-equipment-panel {
  display: grid;
  gap: 0.9rem;
  grid-column: 1 / -1;
  align-self: stretch;
}

.sheet-skills-panel {
  display: grid;
  gap: 0.9rem;
  grid-column: 1 / -1;
}

.sheet-skills-panel__jump-link {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent-strong);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.16em;
  cursor: pointer;
}

.sheet-skills-panel__jump-link:hover {
  color: #f4dfae;
}

.sheet-skills-panel__jump-link:focus-visible {
  outline: 2px solid rgba(240, 211, 138, 0.45);
  outline-offset: 3px;
  border-radius: 4px;
}

.sheet-skills-summary {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: start;
}

.sheet-skills-summary__section {
  display: grid;
  gap: 0.65rem;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(125, 92, 44, 0.22);
  background: rgba(255, 255, 255, 0.03);
}

.sheet-skills-summary__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--accent-strong);
}

.sheet-skills-summary__list {
  gap: 0.45rem;
}

.sheet-skills-summary__item {
  align-items: flex-start;
}

.sheet-skills-summary__item .skill-grade {
  text-align: right;
}

.sheet-skills-summary__empty {
  margin: 0;
}

.sheet-equipment-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.sheet-equipment-add-btn {
  border-color: rgba(216, 180, 106, 0.44);
  color: var(--accent-strong);
}

.sheet-equipment-add-btn:hover {
  border-color: rgba(216, 180, 106, 0.72);
}

.sheet-equipment-manual-shell {
  display: grid;
  gap: 0.8rem;
}

.sheet-equipment-manual-title {
  font-family: var(--font-display);
  color: var(--accent-strong);
  font-size: 0.96rem;
}

.sheet-equipment-manual-helper {
  color: var(--muted);
  font-size: 0.84rem;
}

.sheet-equipment-manual-form {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.sheet-equipment-manual-toggle-field {
  align-self: stretch;
}

.sheet-equipment-manual-toggle {
  width: 20px;
  height: 20px;
  margin-top: 0.5rem;
}

.sheet-equipment-manual-price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  grid-column: 1 / -1;
}

.sheet-equipment-manual-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  grid-column: 1 / -1;
}

.sheet-equipment-manual-error {
  margin: 0;
}

.sheet-equipment-table {
  min-width: 960px;
}

.sheet-equipment-row--paid {
  background: rgba(216, 180, 106, 0.05);
}

.sheet-equipment-row--free {
  background: rgba(82, 112, 94, 0.06);
}

.sheet-equipment-row--manual {
  box-shadow: inset 3px 0 0 rgba(106, 156, 216, 0.34);
}

.sheet-equipment-name {
  display: grid;
  gap: 0.18rem;
}

.sheet-equipment-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sheet-equipment-toggle {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(216, 180, 106, 0.4);
  background: rgba(216, 180, 106, 0.08);
}

.sheet-equipment-toggle::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 160ms ease;
  margin-left: -2px;
}

.sheet-equipment-toggle[aria-expanded="true"]::before {
  transform: rotate(45deg);
  margin-top: -2px;
}

.sheet-equipment-toggle:hover {
  border-color: rgba(216, 180, 106, 0.7);
  background: rgba(216, 180, 106, 0.14);
}

.sheet-equipment-toggle:focus-visible {
  outline: 2px solid rgba(216, 180, 106, 0.48);
  outline-offset: 2px;
}

.sheet-equipment-toggle-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.sheet-equipment-row--package {
  box-shadow: inset 3px 0 0 rgba(216, 180, 106, 0.28);
}

.sheet-equipment-row--package-open {
  background: rgba(216, 180, 106, 0.1);
}

.sheet-equipment-row--child {
  background: rgba(125, 92, 44, 0.09);
}

.sheet-equipment-row--child-hint {
  background: rgba(125, 92, 44, 0.04);
}

.sheet-equipment-child-name {
  padding-left: 2rem !important;
  color: var(--text);
}

.sheet-equipment-package-hint-row {
  color: var(--muted);
  font-size: 0.78rem;
  padding-left: 2rem !important;
}

.sheet-equipment-kind {
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 0.88rem;
}

.sheet-equipment-action-note {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: normal;
}

.equipment-qty-input {
  width: 90px;
  text-align: center;
  font-family: var(--font-display);
}

.equipment-basket-title {
  margin-bottom: -0.25rem;
}

.equipment-basket-details {
  display: grid;
  gap: 0.75rem;
}

.equipment-basket-details__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.equipment-basket-details__summary::-webkit-details-marker {
  display: none;
}

.equipment-basket-details__summary::after {
  content: "";
  width: 0.72rem;
  height: 0.72rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
  flex: 0 0 auto;
  margin-right: 0.1rem;
}

.equipment-basket-details:not([open]) .equipment-basket-details__summary::after {
  transform: rotate(-45deg);
}

.equipment-basket-details__body {
  display: grid;
  gap: 0.75rem;
}

.equipment-package-content-details {
  display: grid;
  gap: 0.45rem;
}

.equipment-package-content-summary {
  list-style: none;
  cursor: pointer;
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 0.86rem;
}

.equipment-package-content-summary::-webkit-details-marker {
  display: none;
}

.equipment-package-content-summary::before {
  content: ">";
  display: inline-block;
  margin-right: 0.45rem;
  transform: rotate(90deg);
  transition: transform 160ms ease;
}

.equipment-package-content-details:not([open]) .equipment-package-content-summary::before {
  transform: rotate(0deg);
}

.equipment-package-content-list {
  margin-top: 0.1rem;
}

@media (max-width: 1200px) {
  .mode-choice-grid {
    grid-template-columns: 1fr;
  }

  .complex-quick-form {
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  }
}

@media (max-width: 960px) {
  .kaszt-modal {
    padding: 14px;
  }

  .kaszt-modal__dialog {
    max-height: 94vh;
  }

  .kaszt-modal__body {
    padding: 12px;
  }

  .kaszt-modal .kaszt-categories {
    grid-template-columns: 1fr;
  }

  .kaszt-modal .kaszt-categories__panel {
    max-height: 44vh;
  }

  .kaszt-categories {
    grid-template-columns: 1fr;
  }

  .kaszt-categories__nav {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .kaszt-categories__panel {
    max-height: 52vh;
  }

  .sheet-full-kaszt {
    grid-template-columns: 1fr;
  }

  .kaszt-level-control__row {
    grid-template-columns: 1fr;
  }

  .mode-switch-container {
    flex-direction: column;
    align-items: stretch;
  }

  .mode-toggle {
    justify-content: center;
    flex-wrap: wrap;
  }

  .mode-choice-copy {
    font-size: 1.08rem;
  }

  .skills-filters {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .skills-filter-count {
    justify-self: start;
  }

  .skills-percent-input {
    width: 100%;
    max-width: 120px;
  }

  .skills-repeatable-group__header {
    align-items: stretch;
  }

  .skills-repeatable-name-input,
  .skills-language-select {
    min-width: 0;
  }

  .skills-actions {
    width: 100%;
    min-width: 0;
    align-items: stretch;
  }

  .skills-actions .skills-action-btn,
  .skills-actions .skills-remove-btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

  .equipment-filters {
    grid-template-columns: 1fr;
    align-items: stretch;
    border: 0;
    background: transparent;
    padding: 0;
  }

  .weapon-filters {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .equipment-filter-count {
    justify-self: start;
  }

  .equipment-filter-details {
    position: sticky;
    top: 12px;
    z-index: 20;
  }

  .equipment-filter-details__summary {
    display: block;
  }

  .equipment-filter-details__body {
    padding: 12px;
    border-radius: 0 0 14px 14px;
    border: 1px solid rgba(125, 92, 44, 0.42);
    border-top: 0;
    background: linear-gradient(180deg, rgba(18, 13, 10, 0.98), rgba(10, 7, 6, 0.98));
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
  }

  .equipment-filter-details:not([open]) .equipment-filter-details__body {
    display: none;
  }

  .equipment-filter-summary {
    position: relative;
  }

  .equipment-catalog-groups {
    gap: 0.8rem;
  }

  .equipment-catalog-group__summary {
    padding: 11px 12px;
  }

  .weapon-filter-count {
    justify-self: start;
  }

  .weapon-top-panels {
    grid-template-columns: 1fr;
  }

  .equipment-top-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .kaszt-categories__nav {
    grid-template-columns: 1fr;
  }

  .kaszt-categories__panel {
    max-height: 46vh;
  }

  .docx-content {
    font-size: 0.98rem;
  }

  .docx-content :is(h1, h2, h3, h4) {
    overflow-wrap: anywhere;
  }

  .docx-content h1 {
    font-size: clamp(1.55rem, 6.2vw, 1.9rem);
  }

  .docx-content--reading :is(h1, h2, h3, h4, p, ul, ol) {
    min-width: 0;
    max-width: 100%;
  }

  .mode-choice-card {
    padding: 14px;
  }

  .kfp-header {
    padding: 12px;
  }

  .kfp-summary {
    grid-template-columns: 1fr;
  }

  .complex-quick-form {
    grid-template-columns: 1fr;
  }
}

.karlap-debug {
  display: grid;
  gap: 16px;
}

.karlap-debug__table-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid rgba(125, 92, 44, 0.35);
  border-radius: 10px;
  background: rgba(8, 7, 6, 0.75);
  max-height: 68vh;
}

.karlap-debug__table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
}

.karlap-debug__table th,
.karlap-debug__table td {
  border: 1px solid rgba(125, 92, 44, 0.24);
  padding: 4px 6px;
  min-width: 72px;
  font-size: 0.78rem;
  line-height: 1.25;
  vertical-align: top;
  white-space: pre-wrap;
}

.karlap-debug__axis {
  position: sticky;
  top: 0;
  background: rgba(23, 19, 15, 0.96);
  color: var(--accent);
  z-index: 2;
}

.karlap-debug__table thead th.karlap-debug__axis:first-child {
  left: 0;
  z-index: 3;
}

.karlap-debug__table tbody th.karlap-debug__axis {
  left: 0;
  z-index: 1;
}

.karlap-debug__table tbody td.is-filled {
  background: rgba(216, 180, 106, 0.14);
}

.karlap-debug__details {
  border: 1px solid rgba(125, 92, 44, 0.35);
  border-radius: 10px;
  background: rgba(8, 7, 6, 0.68);
  padding: 10px;
}

.karlap-debug__details > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.karlap-debug__values {
  width: 100%;
  border-collapse: collapse;
}

.karlap-debug__values th,
.karlap-debug__values td {
  border: 1px solid rgba(125, 92, 44, 0.24);
  padding: 6px 8px;
  text-align: left;
  font-size: 0.86rem;
  vertical-align: top;
  white-space: pre-wrap;
}
