:root {
  --bg: #07110f;
  --bg2: #0d1816;
  --panel: rgba(21, 36, 32, 0.86);
  --panel-soft: rgba(24, 41, 36, 0.72);
  --line: rgba(193, 229, 212, 0.22);
  --line-strong: rgba(193, 229, 212, 0.34);
  --text: #edf7f2;
  --muted: #afc8bf;
  --accent: #49d7a3;
  --accent-2: #ffb561;
  --danger: #ff7f7f;
  --shadow: 0 16px 60px rgba(0, 0, 0, 0.35);
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  padding-bottom: calc(5.6rem + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(circle at 12% 12%, rgba(73, 215, 163, 0.13), transparent 38%),
    radial-gradient(circle at 88% 18%, rgba(255, 181, 97, 0.15), transparent 42%),
    linear-gradient(180deg, #0a1715 0%, #10201d 42%, #091412 100%);
}

.grid-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.065;
  background-image:
    linear-gradient(rgba(255,255,255,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.12) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at center, black 50%, transparent 100%);
}

.bg-orb {
  position: fixed;
  width: 32rem;
  height: 32rem;
  border-radius: 999px;
  filter: blur(40px);
  pointer-events: none;
  opacity: 0.35;
}
.orb-a {
  left: -8rem;
  top: 6rem;
  background: radial-gradient(circle, rgba(73, 215, 163, 0.45), rgba(73, 215, 163, 0.05) 60%, transparent 70%);
}
.orb-b {
  right: -8rem;
  top: 12rem;
  background: radial-gradient(circle, rgba(255, 181, 97, 0.38), rgba(255, 181, 97, 0.05) 60%, transparent 70%);
}

.shell {
  width: min(1320px, calc(100vw - 2rem));
  margin-inline: auto;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  padding: 1.25rem 0 0.75rem;
}

.hero-copy {
  background: linear-gradient(180deg, rgba(17, 31, 27, 0.88), rgba(10, 19, 17, 0.82));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.2rem 1.1rem;
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.75rem, 2.5vw, 2.6rem);
  line-height: 1.05;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.92fr) minmax(280px, 1fr);
  gap: 1rem;
  padding: 0.6rem 0 2rem;
}

.panel {
  background: linear-gradient(180deg, var(--panel), rgba(11, 19, 17, 0.88));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.parent-panel {
  align-self: start;
}

.result-panel {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  margin: 0;
  font-size: 1rem;
}

.parent-form {
  padding: 0.95rem 1rem 1rem;
  display: grid;
  gap: 0.85rem;
}

label {
  display: grid;
  gap: 0.34rem;
  font-size: 0.88rem;
  color: var(--muted);
}

input[type="number"],
select {
  width: 100%;
  background: rgba(7, 14, 13, 0.95);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 2.6rem;
  padding: 0.5rem 0.65rem;
  font: inherit;
  outline: none;
}

select:focus,
input:focus {
  border-color: rgba(73, 215, 163, 0.55);
  box-shadow: 0 0 0 3px rgba(73, 215, 163, 0.14);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.hint-box {
  background: rgba(10, 18, 17, 0.9);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.65rem 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.hint-box strong {
  color: var(--text);
  font-weight: 600;
}

.advanced-block {
  border: 1px solid var(--line);
  background: rgba(10, 18, 17, 0.72);
  border-radius: 14px;
  padding: 0.2rem 0.7rem 0.6rem;
}

.advanced-block > summary {
  cursor: pointer;
  color: var(--text);
  padding: 0.55rem 0;
  font-weight: 500;
}

.advanced-inner {
  display: grid;
  gap: 0.85rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-size: 0.9rem;
}

.toggle-help-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
}

.toggle-help-row > .toggle-row {
  flex: 0 1 auto;
  min-width: auto;
}

.toggle-row input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.toggle-row.compact {
  font-size: 0.84rem;
  color: var(--muted);
}

.inline-help {
  position: relative;
  flex: 0 0 auto;
}

.inline-help > summary {
  list-style: none;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(9, 18, 17, 0.95);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.inline-help > summary::-webkit-details-marker {
  display: none;
}

.inline-help > summary:hover,
.inline-help[open] > summary {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line-strong));
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent) 16%, transparent),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

.inline-help-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  width: min(16.5rem, 76vw);
  z-index: 10;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(6, 12, 12, 0.97);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.spell-level-tip-list {
  display: grid;
  gap: 0.35rem;
  max-height: 14rem;
  overflow: auto;
  padding-right: 0.15rem;
}

.spell-grid {
  display: grid;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem;
  background: rgba(7, 14, 13, 0.92);
}

.spell-grid-head {
  font-size: 0.82rem;
  color: var(--muted);
}

.spell-row {
  display: grid;
  grid-template-columns: 2rem 1fr 4.1rem;
  gap: 0.45rem;
  align-items: center;
}
.spell-row > span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--muted);
}
.spell-row.spell-head {
  opacity: 0.75;
}
.spell-row.spell-head > span {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.68rem;
}
.spell-row select,
.spell-row input {
  min-height: 2.15rem;
}

.info-chip {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  color: var(--muted);
  background: rgba(9, 17, 15, 0.9);
  font-size: 0.82rem;
  line-height: 1.35;
}

.swap-btn {
  border: 1px solid rgba(73, 215, 163, 0.34);
  border-radius: 12px;
  min-height: 2.6rem;
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background:
    radial-gradient(120% 180% at 8% 0%, rgba(73, 215, 163, 0.10), transparent 55%),
    rgba(10, 18, 19, 0.92);
  box-shadow:
    0 0 0 1px rgba(73, 215, 163, 0.08),
    0 6px 18px rgba(73, 215, 163, 0.08);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}
.swap-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(120, 255, 212, 0.52);
  background:
    radial-gradient(120% 180% at 8% 0%, rgba(73, 215, 163, 0.15), transparent 58%),
    rgba(12, 22, 23, 0.96);
  box-shadow:
    0 0 0 1px rgba(73, 215, 163, 0.12),
    0 8px 20px rgba(73, 215, 163, 0.12);
}
.swap-btn:active { transform: translateY(0); }
.swap-btn:focus-visible { outline: 3px solid rgba(73,215,163,0.25); outline-offset: 2px; }

.loading-panel,
.error-panel {
  padding: 1rem;
  margin: 0.5rem 0 2rem;
}
.error-panel h2 { margin-top: 0; }
.error-panel { border-color: rgba(255,127,127,0.3); }

.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.app-footer-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 0.95rem;
  pointer-events: auto;
  backdrop-filter: blur(10px);
  box-shadow:
    0 -10px 24px rgba(0, 0, 0, 0.20),
    inset 0 1px 0 rgba(255,255,255,0.03);
}

.app-footer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  min-width: 0;
}

.app-footer-theme {
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-footer-links {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  justify-content: flex-end;
  min-width: 0;
}

.app-footer-links a {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.32rem 0.65rem;
  font-size: 0.78rem;
  background: rgba(10, 17, 16, 0.88);
}

.app-footer-links a:hover,
.app-footer-links a:focus-visible {
  border-color: var(--line-strong);
  background: rgba(13, 22, 20, 0.96);
  outline: none;
}

.credits-layout {
  display: grid;
  gap: 0.9rem;
  padding: 0.6rem 0 1rem;
}

.credits-panel {
  align-self: start;
}

.credits-list {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem 0.95rem;
}

.credits-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(11, 19, 18, 0.72);
  padding: 0.75rem 0.8rem;
}

.credits-item h3 {
  margin: 0;
  font-size: 0.92rem;
}

.credits-item p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.credits-links {
  margin: 0.55rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.3rem;
}

.credits-links li {
  color: var(--muted);
}

.credits-links a {
  color: #d6efe6;
  text-decoration-color: rgba(214, 239, 230, 0.28);
  text-underline-offset: 0.12rem;
}

.credits-links a:hover,
.credits-links a:focus-visible {
  color: #ffffff;
  text-decoration-color: rgba(255, 255, 255, 0.5);
  outline: none;
}

.credits-note-block {
  padding: 0.85rem 0.95rem 0.95rem;
  display: grid;
  gap: 0.7rem;
}

.credits-note-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.86rem;
}

.empty-state {
  padding: 1rem;
  color: var(--muted);
}

.result-hero-card {
  margin: 1rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  background:
    radial-gradient(circle at 90% 15%, rgba(255,181,97,0.09), transparent 55%),
    linear-gradient(180deg, rgba(13, 24, 22, 0.95), rgba(8, 14, 13, 0.95));
}
.result-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.result-name {
  font-size: clamp(1.2rem, 2vw, 1.75rem);
  font-weight: 700;
  line-height: 1.1;
}
.result-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.22rem;
}
.result-hero-main {
  min-width: 0;
}
.hero-trait-chips {
  margin-top: 0.45rem;
  gap: 0.38rem;
}
.hero-trait-chips .chip {
  font-size: 0.76rem;
  padding: 0.28rem 0.5rem;
}
.hero-trait-notes {
  margin-top: 0.45rem;
}
.hero-trait-notes .note-item {
  font-size: 0.76rem;
  line-height: 1.3;
  padding-left: 0.48rem;
}
.result-badges {
  display: grid;
  justify-items: end;
  gap: 0.4rem;
  align-content: start;
}

.kv-pill {
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  padding: 0.3rem 0.6rem;
  background: rgba(8, 14, 13, 0.9);
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.78rem;
}
.kv-pill strong {
  color: var(--text);
  font-weight: 700;
}
.kv-pill span { color: var(--muted); }

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  padding: 0 1rem 1rem;
}

.result-section {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(8, 14, 13, 0.88);
  padding: 0.8rem;
}
.result-section h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
}
.result-spells {
  grid-column: 1 / -1;
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  padding: 0.38rem 0.65rem;
  background: rgba(12, 24, 22, 0.85);
  font-size: 0.82rem;
}
.chip.empty { color: var(--muted); }
.chip.trait { border-color: rgba(73, 215, 163, 0.28); }

.note-list {
  display: grid;
  gap: 0.45rem;
}
.note-item {
  border-left: 2px solid rgba(73,215,163,0.55);
  padding-left: 0.6rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}
.note-item.warn { border-left-color: rgba(255,181,97,0.65); }
.note-item.error { border-left-color: rgba(255,127,127,0.7); }
.note-item strong { color: var(--text); }

.spell-card-list {
  display: grid;
  gap: 0.6rem;
}
.spell-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(12, 24, 22, 0.85);
  padding: 0.65rem 0.75rem;
  display: grid;
  gap: 0.35rem;
}
.spell-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}
.spell-card-head .spell-name {
  font-weight: 700;
}
.spell-level {
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent-2);
  font-size: 0.8rem;
}
.spell-sub {
  color: var(--muted);
  font-size: 0.82rem;
}
.spell-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.spell-tag {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0.18rem 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(6, 11, 10, 0.92);
}

.legend-list {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem 0.85rem;
}

.legend-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(12, 24, 22, 0.72);
  padding: 0.55rem 0.65rem;
}

.legend-item.is-active {
  border-color: rgba(255, 219, 87, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 219, 87, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 219, 87, 0.04), rgba(255, 219, 87, 0.02)),
    rgba(12, 24, 22, 0.72);
}

.legend-term {
  font-weight: 700;
  font-size: 0.84rem;
  line-height: 1.2;
}

.legend-desc {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

@media (max-width: 1120px) {
  .hero { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .result-panel { grid-column: auto; }
}

@media (max-width: 700px) {
  .shell { width: min(1320px, calc(100vw - 1rem)); }
  .hero { padding-top: 0.6rem; }
  .hero-copy { padding: 0.95rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .result-spells { grid-column: auto; }
  .result-hero-card { grid-template-columns: 1fr; }
  .result-badges { justify-items: start; }
  .spell-row { grid-template-columns: 1.7rem 1fr 3.7rem; }
  .app-footer-panel {
    padding: 0.75rem 0.8rem;
    align-items: flex-start;
  }
  .app-footer-copy {
    font-size: 0.74rem;
    line-height: 1.35;
  }
  .app-footer-links a {
    font-size: 0.74rem;
    padding: 0.28rem 0.55rem;
  }
  .credits-list {
    padding: 0.75rem 0.8rem 0.85rem;
    gap: 0.6rem;
  }
  .credits-item {
    padding: 0.65rem 0.7rem;
    border-radius: 12px;
  }
  .credits-item h3 {
    font-size: 0.86rem;
  }
  .credits-item p {
    font-size: 0.76rem;
  }
  .credits-links {
    gap: 0.22rem;
    padding-left: 0.9rem;
  }
  .credits-note-block {
    padding: 0.75rem 0.8rem 0.85rem;
  }
  .credits-note-block p {
    font-size: 0.8rem;
  }
  .legend-list {
    padding: 0.7rem 0.8rem 0.8rem;
    gap: 0.45rem;
  }
  .legend-item {
    padding: 0.5rem 0.55rem;
    border-radius: 10px;
  }
  .legend-term {
    font-size: 0.8rem;
  }
  .legend-desc {
    font-size: 0.74rem;
  }
}


.slim-hero {
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0.75rem 0 0.45rem;
}
.slim-hero .hero-copy {
  padding: 0.95rem 1rem 0.9rem;
}

.layout {
  grid-template-columns: 1fr;
  align-items: start;
}

.result-panel {
  grid-column: auto;
  align-self: start;
  position: static;
}

.center-panel .panel-head {
  padding-bottom: 0.65rem;
}

.center-panel .swap-btn {
  width: 100%;
}

.compact-hint {
  font-size: 0.76rem;
  line-height: 1.3;
}

.parent-form {
  padding: 0.85rem 0.9rem 0.9rem;
  gap: 0.75rem;
}

.parent-panel .advanced-block > summary {
  font-size: 0.88rem;
}

.empty-state {
  padding: 0.85rem 0.9rem;
  font-size: 0.82rem;
}

.compact-result-hero {
  margin: 0.8rem;
  margin-bottom: 0.7rem;
  padding: 0.8rem 0.9rem;
}

.compact-result-grid {
  grid-template-columns: 1fr;
  gap: 0.7rem;
  padding: 0 0.8rem 0.8rem;
}

.trait-legend-section {
  margin: 0 0.8rem 0.8rem;
  border-color: rgba(111, 255, 215, 0.20);
  background:
    linear-gradient(180deg, rgba(14, 22, 21, 0.93), rgba(11, 18, 17, 0.92));
}

.trait-legend-section h3 {
  margin-bottom: 0.35rem;
}

.trait-legend-section .legend-list {
  padding: 0.2rem 0 0;
  gap: 0.5rem;
}

.trait-legend-section .legend-item {
  border-color: rgba(255, 219, 87, 0.28);
  background: rgba(12, 24, 22, 0.72);
}

.skill-acquired-banner {
  margin: 0 0.8rem 0.7rem;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(111, 255, 215, 0.26);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(89, 255, 201, 0.15), transparent 58%),
    linear-gradient(180deg, rgba(18, 29, 38, 0.94), rgba(14, 22, 30, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 22px rgba(0, 0, 0, 0.2);
}

.skill-acquired-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(148, 255, 227, 0.9);
}

.skill-acquired-name {
  margin-top: 0.24rem;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
}

.skill-acquired-sub {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted);
}

.result-spells { grid-column: auto; }

.result-section {
  padding: 0.7rem;
}
.result-section h3 {
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
}

.note-list:empty {
  display: none;
}

.spell-card {
  padding: 0.55rem 0.65rem;
}
.spell-card .spell-tags {
  margin-top: 0.05rem;
}
.spell-tag {
  font-size: 0.68rem;
}

@media (min-width: 1121px) {
  .layout {
    grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.15fr) minmax(280px, 1fr);
  }
  .result-panel {
    position: sticky;
    top: 0.6rem;
  }
}

@media (max-width: 700px) {
  .panel-head {
    padding: 0.8rem 0.85rem 0.6rem;
  }
  .panel-head h2 {
    font-size: 0.94rem;
  }
  .parent-form {
    padding: 0.75rem 0.8rem 0.8rem;
    gap: 0.65rem;
  }
  label {
    gap: 0.26rem;
    font-size: 0.83rem;
  }
  input[type=\"number\"], select {
    min-height: 2.45rem;
    padding: 0.45rem 0.55rem;
    border-radius: 10px;
  }
  .hint-box {
    padding: 0.5rem 0.6rem;
  }
  .advanced-block {
    padding: 0.1rem 0.55rem 0.45rem;
    border-radius: 12px;
  }
  .advanced-block > summary {
    padding: 0.45rem 0;
  }
  .advanced-inner {
    gap: 0.65rem;
  }
  .toggle-row {
    gap: 0.5rem;
    font-size: 0.84rem;
  }
  .spell-grid {
    padding: 0.55rem;
    gap: 0.35rem;
  }
  .spell-grid-head {
    font-size: 0.75rem;
  }
  .result-name {
    font-size: 1.2rem;
  }
  .result-meta {
    font-size: 0.82rem;
  }
  .hero-trait-chips {
    margin-top: 0.35rem;
    gap: 0.28rem;
  }
  .hero-trait-chips .chip {
    font-size: 0.72rem;
    padding: 0.24rem 0.42rem;
  }
  .hero-trait-notes {
    margin-top: 0.35rem;
  }
  .hero-trait-notes .note-item {
    font-size: 0.72rem;
    padding-left: 0.42rem;
  }
  .kv-pill {
    font-size: 0.72rem;
    padding: 0.24rem 0.5rem;
  }
  .result-section h3 {
    font-size: 0.84rem;
  }
  .chip {
    font-size: 0.76rem;
    padding: 0.32rem 0.55rem;
  }
  .note-item {
    font-size: 0.78rem;
    padding-left: 0.5rem;
  }
  .spell-card {
    gap: 0.28rem;
  }
  .spell-sub {
    font-size: 0.76rem;
  }
  .slim-hero .hero-copy {
    padding: 0.8rem 0.85rem 0.75rem;
  }
  .compact-result-hero,
  .compact-result-grid {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .compact-result-grid {
    padding-top: 0;
    padding-bottom: 0.75rem;
  }
  .skill-acquired-banner {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
    margin-bottom: 0.6rem;
    padding: 0.7rem 0.75rem;
    border-radius: 12px;
  }
  .skill-acquired-name {
    font-size: 0.92rem;
  }
  .skill-acquired-sub {
    font-size: 0.78rem;
  }
}



.layout.layout-v2 {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "result"
    "collars";
  gap: 0.8rem;
  align-items: start;
}

.layout.layout-v2 > .result-panel {
  grid-area: result;
  grid-column: auto;
  position: relative;
  z-index: 12;
  max-height: none;
  overflow: visible;
  border-color: rgba(255, 214, 96, 0.42);
  box-shadow:
    0 0 0 1px rgba(255, 214, 96, 0.12),
    0 12px 36px rgba(255, 214, 96, 0.10),
    var(--shadow);
}

.layout.layout-v2 > .result-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid rgba(255, 214, 96, 0.20);
}

.layout.layout-v2 > .result-panel::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 2px;
  border-radius: 999px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 214, 96, 0.06), rgba(255, 214, 96, 0.95), rgba(255, 181, 97, 0.72), rgba(255, 214, 96, 0.06));
  opacity: 0.95;
}

.layout.layout-v2 > .collars-grid {
  grid-area: collars;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
}

.layout.layout-v2 > .collars-grid > .parent-panel {
  min-width: 0;
  position: relative;
}

.layout.layout-v2 > .collars-grid > .collar-panel {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.015),
    var(--shadow);
}

.layout.layout-v2 > .collars-grid > .collar-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid transparent;
}

.layout.layout-v2 > .collars-grid > .collar-panel::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 2px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0.75;
}

.layout.layout-v2 > .collars-grid > .collar-red {
  border-color: rgba(255, 96, 96, 0.40);
  box-shadow:
    0 0 0 1px rgba(255, 96, 96, 0.12),
    0 10px 28px rgba(255, 96, 96, 0.10),
    var(--shadow);
}

.layout.layout-v2 > .collars-grid > .collar-red::before {
  border-color: rgba(255, 96, 96, 0.20);
}

.layout.layout-v2 > .collars-grid > .collar-red::after {
  background: linear-gradient(90deg, rgba(255, 96, 96, 0.06), rgba(255, 96, 96, 0.92), rgba(255, 181, 97, 0.34), rgba(255, 96, 96, 0.06));
  opacity: 0.9;
}

.layout.layout-v2 > .collars-grid > .collar-blue {
  border-color: rgba(96, 170, 255, 0.40);
  box-shadow:
    0 0 0 1px rgba(96, 170, 255, 0.12),
    0 10px 28px rgba(96, 170, 255, 0.10),
    var(--shadow);
}

.layout.layout-v2 > .collars-grid > .collar-blue::before {
  border-color: rgba(96, 170, 255, 0.20);
}

.layout.layout-v2 > .collars-grid > .collar-blue::after {
  background: linear-gradient(90deg, rgba(96, 170, 255, 0.06), rgba(96, 170, 255, 0.92), rgba(73, 215, 163, 0.30), rgba(96, 170, 255, 0.06));
  opacity: 0.9;
}

.layout.layout-v2 > .collars-grid > .collars-toolbar {
  grid-column: 1 / -1;
  order: -1;
}

.layout.layout-v2 > .collars-grid > .collars-toolbar .collars-toolbar-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.layout.layout-v2 > .collars-grid > .collars-toolbar .swap-btn {
  width: auto;
  flex: 1 1 auto;
  min-height: 2.6rem;
}

.layout.layout-v2 > .collars-grid > .collars-toolbar .swap-help {
  flex: 0 0 auto;
}

.layout.layout-v2 > .collars-grid > .collars-toolbar .swap-help .inline-help-pop {
  width: min(19rem, 86vw);
}

.layout.layout-v2 > .collars-grid .panel-head {
  padding: 0.72rem 0.75rem 0.58rem;
  justify-content: flex-start;
}

.layout.layout-v2 > .collars-grid .panel-head h2 {
  font-size: 0.9rem;
}

.layout.layout-v2 > .collars-grid .parent-form {
  padding: 0.7rem 0.75rem 0.75rem;
  gap: 0.62rem;
}

.layout.layout-v2 > .collars-grid label {
  gap: 0.22rem;
  font-size: 0.78rem;
}

.layout.layout-v2 > .collars-grid input[type="number"],
.layout.layout-v2 > .collars-grid select {
  min-height: 2.35rem;
  padding: 0.42rem 0.5rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.layout.layout-v2 > .collars-grid .grid-2 {
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.layout.layout-v2 > .collars-grid .stats-row {
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.layout.layout-v2 > .collars-grid .compact-hint {
  font-size: 0.72rem;
  line-height: 1.25;
  padding: 0.48rem 0.55rem;
}

.layout.layout-v2 > .collars-grid .advanced-block {
  padding: 0.08rem 0.5rem 0.42rem;
  border-radius: 12px;
}

.layout.layout-v2 > .collars-grid .advanced-block > summary {
  padding: 0.42rem 0;
  font-size: 0.82rem;
}

.layout.layout-v2 > .collars-grid .advanced-inner {
  gap: 0.6rem;
}

.layout.layout-v2 > .collars-grid .toggle-row {
  gap: 0.42rem;
  font-size: 0.78rem;
}

.layout.layout-v2 > .collars-grid .spell-grid {
  padding: 0.5rem;
  gap: 0.3rem;
}

.layout.layout-v2 > .collars-grid .spell-grid-head {
  font-size: 0.72rem;
}

.layout.layout-v2 > .collars-grid .spell-row {
  grid-template-columns: 1.4rem 1fr 3.4rem;
  gap: 0.35rem;
}

.layout.layout-v2 > .collars-grid .spell-row > span {
  font-size: 0.66rem;
}

.layout.layout-v2 > .collars-grid .spell-row select,
.layout.layout-v2 > .collars-grid .spell-row input {
  min-height: 2rem;
}

@media (max-width: 420px) {
  .layout.layout-v2 > .collars-grid {
    gap: 0.55rem;
  }
  .layout.layout-v2 > .collars-grid .panel-head {
    padding: 0.65rem 0.62rem 0.5rem;
  }
  .layout.layout-v2 > .collars-grid .panel-head h2 {
    font-size: 0.82rem;
  }
  .layout.layout-v2 > .collars-grid .parent-form {
    padding: 0.62rem;
  }
  .layout.layout-v2 > .collars-grid label {
    font-size: 0.74rem;
  }
  .layout.layout-v2 > .collars-grid input[type="number"],
  .layout.layout-v2 > .collars-grid select {
    min-height: 2.2rem;
    font-size: 0.84rem;
    padding: 0.38rem 0.45rem;
  }
  .layout.layout-v2 > .collars-grid .compact-hint {
    font-size: 0.68rem;
  }
  .layout.layout-v2 > .collars-grid .spell-row {
    grid-template-columns: 1.15rem 1fr 3rem;
  }
}

@media (max-width: 700px) {
  .layout.layout-v2 > .result-panel > .panel-head {
    display: none;
  }

  .layout.layout-v2 .compact-result-hero {
    margin: 0.65rem;
    margin-bottom: 0.55rem;
    padding: 0.62rem 0.68rem;
    gap: 0.45rem;
  }

  .layout.layout-v2 .result-hero-card {
    grid-template-columns: 1fr;
  }

  .layout.layout-v2 .result-label {
    font-size: 0.72rem;
  }

  .layout.layout-v2 .result-name {
    font-size: 1.06rem;
  }

  .layout.layout-v2 .result-meta {
    margin-top: 0.16rem;
    font-size: 0.76rem;
  }

  .layout.layout-v2 .hero-trait-chips {
    margin-top: 0.28rem;
    gap: 0.22rem;
  }

  .layout.layout-v2 .hero-trait-chips .chip {
    font-size: 0.68rem;
    padding: 0.2rem 0.38rem;
    border-radius: 999px;
  }

  .layout.layout-v2 .hero-trait-notes {
    margin-top: 0.28rem;
  }

  .layout.layout-v2 .hero-trait-notes .note-item {
    font-size: 0.68rem;
    padding-left: 0.38rem;
  }

  .layout.layout-v2 .result-badges {
    width: 100%;
    justify-items: stretch;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.3rem;
  }

  .layout.layout-v2 .result-badges .kv-pill {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    justify-items: start;
    gap: 0.06rem;
    border-radius: 10px;
    padding: 0.24rem 0.4rem;
    min-width: 0;
  }

  .layout.layout-v2 .result-badges .kv-pill span {
    font-size: 0.62rem;
    line-height: 1.05;
  }

  .layout.layout-v2 .result-badges .kv-pill strong {
    font-size: 0.78rem;
    line-height: 1.05;
  }

  .layout.layout-v2 .result-badges .kv-pill-traits,
  .layout.layout-v2 .result-badges .kv-pill-spells {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
  }

  .layout.layout-v2 .result-badges .kv-pill-traits span,
  .layout.layout-v2 .result-badges .kv-pill-spells span {
    font-size: 0.66rem;
    line-height: 1;
    white-space: nowrap;
  }

  .layout.layout-v2 .result-badges .kv-pill-traits strong,
  .layout.layout-v2 .result-badges .kv-pill-spells strong {
    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;
    margin-left: auto;
  }

  .layout.layout-v2 > .collars-grid > .collars-toolbar .swap-btn {
    min-height: 2.45rem;
  }
}

@media (min-width: 900px) {
  .layout.layout-v2 {
    grid-template-columns: minmax(0, 1.06fr) minmax(360px, 0.94fr);
    grid-template-areas: "collars result";
    gap: 1rem;
  }

  .layout.layout-v2 > .result-panel {
    position: sticky;
    top: 0.6rem;
    max-height: calc(100vh - 1.2rem);
    overflow: auto;
    overscroll-behavior: contain;
  }

  .layout.layout-v2 > .collars-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .layout.layout-v2 > .collars-grid > .collars-toolbar {
    order: initial;
    grid-column: auto;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .layout.layout-v2 > .collars-grid > .collars-toolbar .collars-toolbar-row {
    width: 70%;
    max-width: 420px;
    min-width: 260px;
  }

  .layout.layout-v2 > .collars-grid > .collars-toolbar .swap-btn {
    width: auto;
    max-width: none;
    min-width: 0;
    min-height: 2.05rem;
    padding: 0.48rem 0.7rem;
    font-size: 0.88rem;
  }

  .layout.layout-v2 > .collars-grid .grid-2 {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .layout.layout-v2 > .collars-grid .stats-row {
    grid-template-columns: minmax(0, 1.1fr) minmax(88px, 0.8fr) minmax(110px, 0.95fr);
    gap: 0.75rem;
    align-items: end;
  }

  .layout.layout-v2 > .collars-grid label {
    font-size: 0.86rem;
  }

  .layout.layout-v2 > .collars-grid .compact-hint {
    font-size: 0.76rem;
  }

  .layout.layout-v2 > .collars-grid .spell-row {
    grid-template-columns: 1.8rem 1fr 4rem;
  }
}


.theme-toggle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(73, 215, 163, 0.34);
  background:
    radial-gradient(120% 180% at 10% 0%, rgba(73, 215, 163, 0.12), transparent 58%),
    rgba(12, 20, 19, 0.92);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  line-height: 1;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(73, 215, 163, 0.08),
    0 8px 20px rgba(73, 215, 163, 0.08);
}

.app-footer-theme .theme-toggle-button {
  min-height: 2.05rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
}

.theme-toggle-button:hover,
.theme-toggle-button:focus-visible {
  border-color: rgba(73, 215, 163, 0.52);
  background:
    radial-gradient(120% 180% at 10% 0%, rgba(73, 215, 163, 0.18), transparent 60%),
    rgba(14, 23, 22, 0.96);
  box-shadow:
    0 0 0 1px rgba(73, 215, 163, 0.12),
    0 10px 22px rgba(73, 215, 163, 0.12);
  outline: none;
}

@media (max-width: 700px) {
  .theme-toggle-button {
    min-height: 2.2rem;
    padding: 0.46rem 0.7rem;
    font-size: 0.78rem;
  }

  
  body,
  html[data-theme="light"] body {
    padding-bottom: 0;
  }

  .app-footer {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    padding-bottom: 0.75rem;
    pointer-events: auto;
  }

  .app-footer-panel {
    grid-template-columns: auto auto;
    justify-content: center;
    justify-items: center;
    text-align: center;
    gap: 0.45rem 0.55rem;
    padding: 0.62rem 0.7rem;
    backdrop-filter: none;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.03),
      0 8px 18px rgba(0, 0, 0, 0.14);
  }

  .app-footer-copy {
    display: none;
  }

  .app-footer-theme {
    width: auto;
  }

  .app-footer-theme .theme-toggle-button {
    min-height: 2.05rem;
    padding: 0.42rem 0.7rem;
    font-size: 0.74rem;
  }

  .app-footer-links {
    justify-content: center;
    gap: 0.45rem;
  }

  .app-footer-links a {
    font-size: 0.74rem;
    padding: 0.3rem 0.55rem;
  }

}


html[data-theme="dark"] body select option {
  color: #eaf4f0;
  background: #10201d;
}

html[data-theme="dark"] body select optgroup {
  color: #d7f3e8;
  background: #17312c;
  font-style: normal;
  font-weight: 700;
}

html[data-theme="dark"] body select option:checked,
html[data-theme="dark"] body select option:hover {
  color: #f4fffb;
  background: #1f3e37;
}


html[data-theme="light"] {
  --bg: #eef4ff;
  --bg2: #f7fbff;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-soft: rgba(247, 251, 255, 0.92);
  --line: rgba(47, 76, 144, 0.15);
  --line-strong: rgba(47, 76, 144, 0.28);
  --text: #17253f;
  --muted: #4c6288;
  --accent: #0eb17b;
  --accent-2: #f0a229;
  --danger: #e95367;
  --shadow: 0 14px 32px rgba(27, 45, 90, 0.12);
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 12% 12%, rgba(14, 177, 123, 0.10), transparent 38%),
    radial-gradient(circle at 88% 18%, rgba(240, 162, 41, 0.13), transparent 42%),
    linear-gradient(180deg, #f7fbff 0%, #eff4ff 42%, #eaf1ff 100%);
}

html[data-theme="light"] body .grid-noise {
  opacity: 0.05;
  background-image:
    linear-gradient(rgba(28, 54, 110, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 54, 110, 0.10) 1px, transparent 1px);
}

html[data-theme="light"] body .orb-a {
  background: radial-gradient(circle, rgba(14, 177, 123, 0.25), rgba(14, 177, 123, 0.03) 60%, transparent 70%);
  opacity: 0.26;
}

html[data-theme="light"] body .orb-b {
  background: radial-gradient(circle, rgba(240, 162, 41, 0.24), rgba(240, 162, 41, 0.03) 60%, transparent 70%);
  opacity: 0.24;
}

html[data-theme="light"] body .hero-copy,
html[data-theme="light"] body .panel,
html[data-theme="light"] body .loading-panel,
html[data-theme="light"] body .error-panel,
html[data-theme="light"] body .app-footer-panel,
html[data-theme="light"] body .credits-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247, 251, 255, 0.96));
  border-color: rgba(47, 76, 144, 0.15);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.92),
    0 12px 26px rgba(27, 45, 90, 0.10);
}

html[data-theme="light"] body .panel-head {
  background: linear-gradient(180deg, rgba(244,248,255,0.96), rgba(236,243,255,0.96));
  border-bottom-color: rgba(47, 76, 144, 0.10);
}

html[data-theme="light"] body .eyebrow {
  color: #1f7d5c;
}

html[data-theme="light"] body .hero h1,
html[data-theme="light"] body .panel-head h2,
html[data-theme="light"] body .credits-item h3 {
  color: #1a2f57;
}

html[data-theme="light"] body label {
  color: #344b76;
}

html[data-theme="light"] body .hint-box,
html[data-theme="light"] body .advanced-block,
html[data-theme="light"] body .spell-grid,
html[data-theme="light"] body .result-section,
html[data-theme="light"] body .trait-legend-section,
html[data-theme="light"] body .spell-card,
html[data-theme="light"] body .legend-item,
html[data-theme="light"] body .empty-state,
html[data-theme="light"] body .credits-item {
  background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(248, 251, 255, 0.97));
  border-color: rgba(47, 76, 144, 0.13);
}

html[data-theme="light"] body .empty-state {
  color: var(--muted);
}

html[data-theme="light"] body .inline-help > summary {
  background: rgba(255,255,255,0.98);
  color: #173058;
  border-color: rgba(47, 76, 144, 0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92);
}

html[data-theme="light"] body .inline-help-pop {
  background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(248, 251, 255, 0.99));
  border-color: rgba(47, 76, 144, 0.16);
  color: #556a90;
  box-shadow: 0 12px 20px rgba(27, 45, 90, 0.10);
}

html[data-theme="light"] body .compact-result-hero,
html[data-theme="light"] body .result-hero-card {
  background:
    radial-gradient(circle at 92% 12%, rgba(240, 162, 41, 0.12), transparent 56%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247, 251, 255, 0.98));
  border-color: rgba(47, 76, 144, 0.16);
}

html[data-theme="light"] body .result-label,
html[data-theme="light"] body .skill-acquired-label {
  color: #4a628d;
}

html[data-theme="light"] body .result-name,
html[data-theme="light"] body .skill-acquired-name {
  color: #152846;
}

html[data-theme="light"] body .result-meta,
html[data-theme="light"] body .spell-sub,
html[data-theme="light"] body .skill-acquired-sub,
html[data-theme="light"] body .legend-desc,
html[data-theme="light"] body .credits-note-block p,
html[data-theme="light"] body .credits-item p,
html[data-theme="light"] body .app-footer-copy,
html[data-theme="light"] body .credits-links li {
  color: #556a90;
}

html[data-theme="light"] body .hero-trait-chips .chip,
html[data-theme="light"] body .chip {
  background: rgba(255,255,255,0.96);
  border-color: rgba(47, 76, 144, 0.16);
  color: #20365c;
}

html[data-theme="light"] body .note-item {
  color: #556a90;
  border-left-color: rgba(14, 177, 123, 0.55);
}

html[data-theme="light"] body .note-item.warn {
  border-left-color: rgba(240, 162, 41, 0.65);
}

html[data-theme="light"] body .note-item.error {
  border-left-color: rgba(233, 77, 96, 0.68);
}

html[data-theme="light"] body .note-item strong {
  color: #183055;
}

html[data-theme="light"] body .result-badges .kv-pill {
  background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(247, 251, 255, 0.99));
  border-color: rgba(47, 76, 144, 0.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.95);
}

html[data-theme="light"] body .result-badges .kv-pill span {
  color: #536a91;
}

html[data-theme="light"] body .result-badges .kv-pill strong {
  color: #183056;
}

html[data-theme="light"] body .skill-acquired-banner {
  border-color: rgba(14, 177, 123, 0.24);
  background:
    radial-gradient(110% 160% at 0% 0%, rgba(14, 177, 123, 0.10), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246, 252, 249, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.96),
    0 10px 20px rgba(27, 45, 90, 0.06);
}

html[data-theme="light"] body .spell-card .spell-name {
  color: #173058;
}

html[data-theme="light"] body .spell-level {
  color: #2f61dc;
}

html[data-theme="light"] body .spell-tag {
  color: #556a90;
  border-color: rgba(47, 76, 144, 0.14);
  background: rgba(255,255,255,0.96);
}

html[data-theme="light"] body .result-section h3,
html[data-theme="light"] body .trait-legend-section h3,
html[data-theme="light"] body .legend-term {
  color: #203864;
}

html[data-theme="light"] body input[type="number"],
html[data-theme="light"] body select {
  background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(249,252,255,0.99));
  border: 1px solid rgba(66, 100, 170, 0.22);
  color: #16243e;
  color-scheme: light;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset 0 0 0 1px rgba(255,255,255,0.45);
}

html[data-theme="light"] body input[type="number"]:focus,
html[data-theme="light"] body select:focus {
  border-color: rgba(47, 112, 255, 0.42);
  box-shadow:
    0 0 0 2px rgba(47, 112, 255, 0.14),
    inset 0 0 0 1px rgba(47, 112, 255, 0.06);
}

html[data-theme="light"] body select option {
  color: #13203a;
  background: #ffffff;
}

html[data-theme="light"] body select optgroup {
  color: #173a75;
  background: #dce9ff;
  font-style: normal;
  font-weight: 700;
}

html[data-theme="light"] body select option:checked,
html[data-theme="light"] body select option:hover {
  color: #10203c;
  background: #d1e3ff;
}

html[data-theme="light"] body .layout.layout-v2 > .result-panel {
  border-color: rgba(240, 162, 41, 0.42);
  box-shadow:
    0 0 0 1px rgba(240, 162, 41, 0.14),
    0 14px 28px rgba(240, 162, 41, 0.12),
    var(--shadow);
}

html[data-theme="light"] body .layout.layout-v2 > .result-panel::before {
  border-color: rgba(240, 162, 41, 0.30);
}

html[data-theme="light"] body .layout.layout-v2 > .result-panel::after {
  background: linear-gradient(90deg, rgba(255, 214, 120, 0.98), rgba(240, 162, 41, 0.92));
  opacity: 0.95;
}

html[data-theme="light"] body .layout.layout-v2 > .collars-grid > .collar-panel {
  overflow: hidden;
}

html[data-theme="light"] body .layout.layout-v2 > .collars-grid > .collar-panel > .panel-head {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

html[data-theme="light"] body .layout.layout-v2 > .collars-grid > .collar-red {
  border-color: rgba(233, 77, 96, 0.38);
  box-shadow:
    0 0 0 1px rgba(233, 77, 96, 0.12),
    0 14px 26px rgba(233, 77, 96, 0.10),
    var(--shadow);
}

html[data-theme="light"] body .layout.layout-v2 > .collars-grid > .collar-red::before {
  border-color: rgba(233, 77, 96, 0.26);
}

html[data-theme="light"] body .layout.layout-v2 > .collars-grid > .collar-red::after {
  background: linear-gradient(90deg, rgba(255, 148, 160, 0.95), rgba(233, 77, 96, 0.92));
  opacity: 0.92;
}

html[data-theme="light"] body .layout.layout-v2 > .collars-grid > .collar-blue {
  border-color: rgba(50, 116, 243, 0.38);
  box-shadow:
    0 0 0 1px rgba(50, 116, 243, 0.12),
    0 14px 26px rgba(50, 116, 243, 0.10),
    var(--shadow);
}

html[data-theme="light"] body .layout.layout-v2 > .collars-grid > .collar-blue::before {
  border-color: rgba(50, 116, 243, 0.26);
}

html[data-theme="light"] body .layout.layout-v2 > .collars-grid > .collar-blue::after {
  background: linear-gradient(90deg, rgba(132, 178, 255, 0.95), rgba(50, 116, 243, 0.92));
  opacity: 0.92;
}

html[data-theme="light"] body .theme-toggle-button {
  border-color: rgba(47, 112, 255, 0.28);
  background:
    radial-gradient(120% 180% at 10% 0%, rgba(47, 112, 255, 0.10), transparent 58%),
    rgba(255, 255, 255, 0.95);
  color: #1b3e84;
  box-shadow:
    0 0 0 1px rgba(47, 112, 255, 0.06),
    0 8px 18px rgba(47, 112, 255, 0.08);
}

html[data-theme="light"] body .theme-toggle-button:hover,
html[data-theme="light"] body .theme-toggle-button:focus-visible {
  border-color: rgba(47, 112, 255, 0.42);
  background:
    radial-gradient(120% 180% at 10% 0%, rgba(47, 112, 255, 0.16), transparent 60%),
    rgba(255, 255, 255, 0.98);
  box-shadow:
    0 0 0 1px rgba(47, 112, 255, 0.10),
    0 10px 20px rgba(47, 112, 255, 0.10);
}

html[data-theme="light"] body .swap-btn {
  border-color: rgba(240, 162, 41, 0.34);
  color: #8a4f0f;
  background:
    radial-gradient(120% 180% at 10% 0%, rgba(240, 162, 41, 0.10), transparent 58%),
    rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 0 1px rgba(240, 162, 41, 0.06),
    0 8px 18px rgba(240, 162, 41, 0.08);
}

html[data-theme="light"] body .swap-btn:hover,
html[data-theme="light"] body .swap-btn:focus-visible {
  border-color: rgba(240, 162, 41, 0.50);
  box-shadow:
    0 0 0 1px rgba(240, 162, 41, 0.10),
    0 10px 20px rgba(240, 162, 41, 0.10);
}

html[data-theme="light"] body .credits-links a,
html[data-theme="light"] body .app-footer-links a,
html[data-theme="light"] body .app-footer a {
  color: #214eaa;
  text-decoration-color: rgba(33, 78, 170, 0.28);
  border-color: rgba(47, 76, 144, 0.18);
  background: rgba(255, 255, 255, 0.96);
}

html[data-theme="light"] body .credits-links a:hover,
html[data-theme="light"] body .credits-links a:focus-visible,
html[data-theme="light"] body .app-footer-links a:hover,
html[data-theme="light"] body .app-footer-links a:focus-visible,
html[data-theme="light"] body .app-footer a:hover,
html[data-theme="light"] body .app-footer a:focus-visible {
  color: #163b83;
  text-decoration-color: rgba(22, 59, 131, 0.42);
  border-color: rgba(47, 76, 144, 0.28);
  background: rgba(248, 251, 255, 0.98);
}

@media (max-width: 700px) {
  body,
  html[data-theme="light"] body {
    padding-bottom: 0;
  }
}


.hero-subtle {
  margin: 0.5rem 0 0;
  color: var(--muted);
  max-width: 70ch;
  font-size: 0.92rem;
  line-height: 1.45;
}

.reverse-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  grid-template-areas:
    "base base"
    "target result";
  gap: 1rem;
  padding: 0.6rem 0 2rem;
}

.reverse-target-panel,
.reverse-result-panel {
  align-self: start;
}

.reverse-target-panel { grid-area: target; }
.reverse-result-panel { grid-area: result; }
.reverse-base-skills-panel { grid-area: base; align-self: start; }

.reverse-base-skills-body {
  padding-top: 0.35rem;
}

.reverse-base-skills-list {
  margin-top: 0.15rem;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.base-skill-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(10, 18, 17, 0.56);
}

.base-skill-table th,
.base-skill-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0.45rem;
  font-size: 0.77rem;
  line-height: 1.25;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.base-skill-table thead th {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: color-mix(in srgb, var(--muted) 88%, white 6%);
  background: rgba(7, 14, 13, 0.94);
  font-weight: 700;
}

.base-skill-table tbody th {
  width: 4.2rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  background: rgba(8, 16, 15, 0.86);
  font-weight: 700;
}

.base-skill-table tbody td {
  color: var(--muted);
  background: rgba(10, 18, 17, 0.44);
}

.base-skill-table tr > *:last-child {
  border-right: none;
}

.base-skill-table tbody tr:last-child > * {
  border-bottom: none;
}

.reverse-target-panel .swap-btn {
  width: 100%;
}

.reverse-spell-goals-grid .spell-row {
  grid-template-columns: 32px 1fr;
}

.reverse-spell-goals-grid .spell-row select {
  min-width: 0;
}

.reverse-target-skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(9, 17, 16, 0.52);
  padding: 0.45rem 0.5rem;
}

.reverse-target-skill-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.reverse-target-skill-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reverse-target-skill-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 15, 14, 0.65);
  color: var(--text);
  padding: 0.18rem 0.45rem;
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 100%;
}

.reverse-target-skill-action {
  border: 1px solid rgba(73, 215, 163, 0.32);
  background: linear-gradient(180deg, rgba(12, 30, 26, 0.96), rgba(9, 20, 18, 0.96));
  color: var(--text);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, background 120ms ease;
}

.reverse-target-skill-action:hover:not(:disabled),
.reverse-target-skill-action:focus-visible:not(:disabled) {
  border-color: rgba(73, 215, 163, 0.55);
  background: linear-gradient(180deg, rgba(15, 36, 31, 0.98), rgba(11, 24, 21, 0.98));
}

.reverse-target-skill-action:active:not(:disabled) {
  transform: translateY(1px);
}

.reverse-target-skill-action:disabled {
  cursor: default;
  opacity: 0.72;
}

.reverse-summary-panel .reverse-summary-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.55rem;
}

.reverse-summary-block {
  display: grid;
  gap: 0.5rem;
}

.reverse-route-list {
  display: grid;
  gap: 0.85rem;
}

.reverse-partial-route {
  display: grid;
  gap: 0.55rem;
}

.reverse-partial-route-title {
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
}

.reverse-route-card {
  border: 1px solid var(--line);
  background: rgba(10, 18, 17, 0.65);
  border-radius: 14px;
  padding: 0.8rem;
  display: grid;
  gap: 0.7rem;
}

.reverse-step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.reverse-step-item {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.65rem;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 17, 16, 0.52);
  padding: 0.65rem;
}

.reverse-step-setup .reverse-step-title {
  color: color-mix(in srgb, var(--accent) 72%, white 8%);
}

.reverse-step-index {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-weight: 700;
  background: rgba(15, 26, 24, 0.85);
}

.reverse-step-body {
  display: grid;
  gap: 0.35rem;
}

.reverse-step-title {
  color: var(--text);
  font-weight: 600;
}

.reverse-step-sub {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

@media (max-width: 1000px) {
  .reverse-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "result"
      "base"
      "target";
  }

  .reverse-result-panel {
    order: 1;
  }

  .reverse-base-skills-panel {
    order: 2;
  }

  .reverse-target-panel {
    order: 3;
  }

  .base-skill-table th,
  .base-skill-table td {
    padding: 0.35rem 0.38rem;
    font-size: 0.72rem;
  }

  .base-skill-table thead th {
    font-size: 0.61rem;
  }

  .base-skill-table tbody th {
    width: 3.5rem;
    font-size: 0.68rem;
  }

  .reverse-target-skill-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .reverse-target-skill-action {
    justify-self: start;
  }

}

@media (max-width: 700px) {
  .hero-subtle {
    font-size: 0.88rem;
  }

  .reverse-step-item {
    grid-template-columns: 1.7rem 1fr;
    gap: 0.5rem;
  }

  .reverse-step-index {
    width: 1.7rem;
    height: 1.7rem;
    font-size: 0.82rem;
  }
}

html[data-theme="light"] body .reverse-route-card,
html[data-theme="light"] body .reverse-step-item {
  background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(248, 251, 255, 0.97));
  border-color: rgba(47, 76, 144, 0.13);
}

html[data-theme="light"] body .base-skill-table {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248, 251, 255, 0.98));
  border-color: rgba(47, 76, 144, 0.13);
}

html[data-theme="light"] body .base-skill-table th,
html[data-theme="light"] body .base-skill-table td {
  border-color: rgba(47, 76, 144, 0.13);
}

html[data-theme="light"] body .base-skill-table thead th {
  color: #203864;
  background: rgba(244, 248, 255, 0.96);
}

html[data-theme="light"] body .base-skill-table tbody th {
  color: #173058;
  background: rgba(250, 252, 255, 0.98);
}

html[data-theme="light"] body .base-skill-table tbody td {
  color: #556a90;
  background: rgba(255, 255, 255, 0.97);
}

html[data-theme="light"] body .reverse-target-skill-row {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248, 251, 255, 0.98));
  border-color: rgba(47, 76, 144, 0.13);
}

html[data-theme="light"] body .reverse-target-skill-label {
  color: #556a90;
}

html[data-theme="light"] body .reverse-target-skill-chip {
  color: #173058;
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(47, 76, 144, 0.18);
}

html[data-theme="light"] body .reverse-target-skill-action {
  color: #173058;
  background: linear-gradient(180deg, rgba(253, 255, 252, 0.99), rgba(245, 252, 248, 0.99));
  border-color: rgba(40, 154, 116, 0.28);
}

html[data-theme="light"] body .reverse-target-skill-action:hover:not(:disabled),
html[data-theme="light"] body .reverse-target-skill-action:focus-visible:not(:disabled) {
  border-color: rgba(40, 154, 116, 0.42);
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(247, 253, 250, 1));
}

html[data-theme="light"] body .reverse-partial-route-title {
  color: #203864;
}

html[data-theme="light"] body .reverse-step-index {
  background: rgba(255,255,255,0.97);
  color: #173058;
  border-color: rgba(47, 76, 144, 0.22);
}
