:root {
  color-scheme: dark;
  --app-desktop-scale: 0.93;
  --bg: #07111f;
  --panel: #101c31;
  --panel-alt: #152540;
  --panel-border: #26405f;
  --text: #edf4ff;
  --muted: #97accb;
  --accent: #59a6ff;
  --accent-soft: #0d2c52;
  --button: #2d70d7;
  --button-text: #f8fbff;
  --good: #66d38f;
  --good-soft: rgba(33, 102, 61, 0.32);
  --bad: #ff6f7d;
  --bad-soft: rgba(111, 29, 42, 0.34);
  --warn: #ffcc70;
  --shadow: 0 18px 38px rgba(1, 8, 20, 0.42);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(89, 166, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 204, 112, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(9, 20, 36, 0.96), rgba(7, 17, 31, 1)),
    var(--bg);
  color: var(--text);
}

@media (min-width: 761px) {
  body {
    zoom: var(--app-desktop-scale);
  }
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

body.modal-open {
  overflow: hidden;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: 0.54rem 0.82rem;
  background: linear-gradient(180deg, #4188f2 0%, var(--button) 100%);
  color: var(--button-text);
  font-size: 0.88rem;
  font-weight: 600;
}

button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #79a6ff;
  outline-offset: 2px;
}

.paypal-button:focus-visible {
  outline: 2px solid #79a6ff;
  outline-offset: 2px;
}

.ghost-button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--panel-border);
}

.ghost-button.success-button {
  color: #bff0cd;
  border-color: rgba(91, 189, 125, 0.55);
  background: rgba(37, 100, 64, 0.18);
}

.ghost-button.danger-button {
  color: #ffc4cb;
  border-color: rgba(214, 106, 122, 0.55);
  background: rgba(104, 32, 44, 0.22);
}

.paypal-button {
  display: inline-flex;
  align-items: center;
  gap: 0.46rem;
  min-height: 2.22rem;
  padding: 0.54rem 0.9rem;
  border-radius: 8px;
  border: 1px solid rgba(21, 72, 149, 0.85);
  background: linear-gradient(180deg, #ffd36d 0%, #ffc439 100%);
  color: #0d2a57;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.paypal-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.compact-button {
  padding: 0.42rem 0.68rem;
}

.donation-toast[hidden] {
  display: none !important;
}

.donation-toast {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 900;
  width: min(360px, calc(100vw - 1.5rem));
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem 0.95rem;
  border: 1px solid rgba(57, 84, 119, 0.92);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(19, 31, 53, 0.97) 0%, rgba(10, 19, 33, 0.97) 100%);
  box-shadow: 0 18px 38px rgba(1, 8, 20, 0.5);
  backdrop-filter: blur(10px);
}

.donation-toast-copy {
  display: grid;
  gap: 0.24rem;
}

.donation-toast-copy strong {
  font-size: 0.98rem;
}

.donation-toast-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.donation-toast-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.donation-toast-button {
  justify-content: center;
  min-width: 6.5rem;
}

.auth-button {
  min-height: 2.12rem;
  padding: 0.42rem 0.78rem;
  border-color: rgba(89, 166, 255, 0.58);
  background: rgba(17, 44, 80, 0.86);
  color: #dfefff;
}

.auth-button.active {
  border-color: rgba(91, 189, 125, 0.65);
  background: rgba(28, 77, 52, 0.88);
  color: #d6f7e1;
}

.feedback-button {
  min-height: 2.12rem;
  padding: 0.42rem 0.78rem;
  border-color: rgba(255, 204, 112, 0.62);
  background: rgba(93, 63, 12, 0.32);
  color: #ffe3a8;
}

.setup-toast[hidden] {
  display: none !important;
}

.setup-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 920;
  width: min(380px, calc(100vw - 1.5rem));
  display: grid;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(74, 106, 145, 0.82);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(19, 31, 53, 0.98) 0%, rgba(10, 19, 33, 0.98) 100%);
  box-shadow: 0 18px 38px rgba(1, 8, 20, 0.5);
  backdrop-filter: blur(10px);
}

.setup-toast-copy {
  display: grid;
  gap: 0.26rem;
}

.setup-toast-copy strong {
  font-size: 0.98rem;
}

.setup-toast-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.setup-toast-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.auth-modal-panel {
  width: min(560px, calc(100vw - 2rem));
}

.auth-mode-switch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.auth-form {
  display: grid;
  gap: 0.75rem;
}

.auth-form textarea {
  min-height: 8rem;
  resize: vertical;
}

.feedback-modal-panel {
  width: min(620px, calc(100vw - 2rem));
  border: 1px solid rgba(96, 128, 169, 0.7);
  background:
    radial-gradient(circle at top right, rgba(255, 204, 112, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(18, 30, 51, 0.99) 0%, rgba(10, 18, 33, 0.99) 100%);
}

.feedback-form-grid {
  gap: 0.9rem;
}

.feedback-form-grid .field {
  display: grid;
  gap: 0.38rem;
}

.feedback-form-grid select,
.feedback-form-grid textarea,
.feedback-form-grid input {
  border-color: rgba(83, 111, 150, 0.82);
  background: rgba(8, 16, 30, 0.94);
}

.feedback-form-grid textarea {
  min-height: 10rem;
}

.auth-helper-link {
  color: #b9d7ff;
  font-size: 0.88rem;
  text-decoration: none;
}

.auth-helper-link:hover {
  text-decoration: underline;
}

.auth-feedback {
  margin: 0.9rem 0 0;
  font-size: 0.9rem;
  color: #b9d7ff;
}

.auth-feedback.error {
  color: #ffc4cb;
}

.auth-feedback.success {
  color: #bff0cd;
}

.auth-status-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.85rem;
  border: 1px solid rgba(74, 106, 145, 0.55);
  border-radius: 12px;
  background: rgba(12, 21, 38, 0.82);
}

.auth-status-card p {
  margin: 0;
  color: var(--muted);
}

.auth-form[hidden],
.auth-status-card[hidden],
#auth-guest-panel[hidden],
#auth-logged-in-panel[hidden] {
  display: none !important;
}

.toggle-button.active {
  color: #dfefff;
  border-color: rgba(89, 166, 255, 0.58);
  background: rgba(17, 44, 80, 0.86);
  box-shadow: 0 0 0 1px rgba(89, 166, 255, 0.2) inset;
}

.icon-button {
  min-width: 2rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid #6d3141;
  background: #421d29;
  color: #ffd3da;
}

.app-shell {
  width: min(1600px, calc(100vw - 30px));
  margin: 0 auto;
  padding: 0.55rem 0 1rem;
}

.topbar,
.panel-header,
.section-title-row,
.preset-tab-actions,
.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.topbar {
  margin-bottom: 0.75rem;
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
}

.topbar h1,
.panel-header h2,
.section-title-row h2,
.section-title-row h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 2.05rem;
}

.topbar p,
.panel-header p,
.preset-meta {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.topbar-actions,
.button-cluster,
.sun-buttons {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* Larger top-bar action buttons (overrides the compact padding here only). */
.topbar-actions button,
.topbar-actions .paypal-button {
  min-height: 2.45rem;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  font-size: 0.92rem;
  white-space: nowrap;
}

.topbar-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  max-width: 900px;
  justify-self: end;
  gap: 0.45rem;
  min-width: 0;
}

.topbar-actions > button,
.topbar-actions > .paypal-button {
  width: 100%;
  text-align: center;
  justify-content: center;
}

.topbar .topbar-loadout-group {
  min-width: 0;
}

.topbar .active-loadout-chip {
  white-space: normal;
  overflow-wrap: anywhere;
  flex-wrap: wrap;
  gap: 0.2rem 0.7rem;
}

.topbar .gear-stat-summary {
  overflow-wrap: anywhere;
}

.topbar .gear-stat-pill:not(:last-child)::after {
  content: " \00b7 ";
}

#open-combat-overlay,
#theme-toggle {
  background: #253c58;
  border: 1px solid #7d9fc8;
  color: #edf4ff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

#open-combat-overlay:hover,
#theme-toggle:hover {
  background: #314d70;
}

#open-combat-overlay {
  background: #3b3570;
  border-color: #a49be0;
}

#open-combat-overlay:hover {
  background: #4a4389;
}

#open-combat-overlay.active {
  background: #224b39;
  border-color: #81b499;
  color: #e3f6e8;
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .topbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
  }
  .topbar-actions > * {
    min-width: 0;
    text-align: center;
    justify-content: center;
  }
}

.field-sun .sun-buttons {
  width: 100%;
  flex-wrap: nowrap;
}

.preset-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.preset-dropdown summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.36rem;
  min-height: 34px;
  padding: 0.35rem 0.58rem;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(12, 24, 42, 0.96);
  color: #d7e6fb;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.preset-dropdown summary::-webkit-details-marker {
  display: none;
}

.preset-dropdown summary::after {
  content: "v";
  color: var(--muted);
  font-size: 0.72rem;
}

.sun-enchant-dropdown summary::after {
  content: none;
}

.preset-dropdown[open] summary {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.preset-dropdown.positive-dropdown summary {
  border-color: #2f7f4f;
  background: var(--good-soft);
  color: #baf4cb;
}

.preset-dropdown.negative-dropdown summary {
  border-color: #8d4150;
  background: var(--bad-soft);
  color: #ffc2ca;
}

.preset-dropdown.positive-dropdown[open] summary {
  border-color: #46b36c;
}

.preset-dropdown.negative-dropdown[open] summary {
  border-color: #d05f70;
}

.preset-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(2, minmax(70px, 1fr));
  gap: 0.34rem;
  min-width: 170px;
  padding: 0.48rem;
  border: 1px solid rgba(66, 96, 136, 0.72);
  border-radius: 12px;
  background: rgba(8, 16, 30, 0.98);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.36);
}

.preset-dropdown-menu .modifier-add-button,
.preset-dropdown-menu .sun-button {
  width: 100%;
  justify-content: center;
}

.preset-dropdown-menu .custom-form {
  grid-column: 1 / -1;
  margin-top: 0.08rem;
}

.sun-buttons .preset-dropdown-menu {
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  min-width: 214px;
}

.sun-enchant-overwrite-actions {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.36rem;
  padding-top: 0.18rem;
  border-top: 1px solid rgba(66, 96, 136, 0.42);
}

.sun-enchant-overwrite-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: center;
}

.sun-enchant-overwrite-button {
  width: 100%;
  justify-content: center;
}

.field-sun .preset-dropdown,
.field-sun .preset-dropdown summary {
  width: 100%;
}

.field-sun .preset-dropdown summary {
  min-height: 48px;
  justify-content: flex-start;
  padding-inline: 0.78rem;
  background: rgba(7, 14, 27, 0.92);
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 500;
}

.section-title-row .preset-dropdown-menu,
.single-stat-actions .preset-dropdown-menu {
  right: 0;
  left: auto;
}

/* One boxed container holding two lines: the loadout name (top) and the gear
   stat pills (bottom). */
.topbar-loadout-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.45rem 0.78rem;
  border-radius: 12px;
  border: 1px solid rgba(74, 106, 145, 0.55);
  background: rgba(12, 21, 38, 0.7);
}

.active-loadout-chip {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
  width: 100%;
  color: #eaf3ff;
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
}

.loadout-level-text {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 0.75rem;
}

.finder-action-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.finder-action-button[hidden] {
  display: none !important;
}

.main-column,
.dual-grid {
  display: grid;
  gap: 0.75rem;
}

.dual-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  background: linear-gradient(180deg, rgba(19, 31, 53, 0.98) 0%, rgba(13, 23, 40, 0.98) 100%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem;
  min-width: 0;
}

.preset-rail {
  align-self: start;
  position: sticky;
  top: 0.75rem;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 1.5rem);
  overflow: hidden;
}

.preset-group + .preset-group {
  margin-top: 0.9rem;
}

.rail-results {
  margin-bottom: 0.9rem;
}

.sidebar-header {
  align-items: flex-start;
}

.panel-header {
  margin-bottom: 0.6rem;
}

.enemy-header-health-field {
  width: 72px;
  align-items: flex-end;
  margin-left: auto;
}

.enemy-header-health-field span {
  display: block;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: right;
  white-space: nowrap;
  min-width: max-content;
}

.enemy-header-health-field input {
  text-align: center;
}

.enemy-header-health-field input:disabled {
  background: rgba(27, 35, 49, 0.92);
  border-color: rgba(71, 86, 110, 0.7);
  color: #91a0b6;
  cursor: not-allowed;
  opacity: 1;
}

.setup-header {
  align-items: flex-start;
}

.setup-grid {
  display: grid;
  gap: 0.55rem;
}

.loadout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(320px, 0.66fr);
  gap: 0.75rem;
}

.spell-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.loadout-section {
  padding: 0.85rem;
  border: 1px solid rgba(54, 82, 118, 0.52);
  border-radius: var(--radius);
  background: rgba(12, 21, 38, 0.62);
}

.section-copy p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.gear-stat-summary {
  display: block;
  color: #b9cce6;
  font-size: 0.76rem;
  line-height: 1.4;
}

/* Gear stats render as plain inline text inside the loadout container (no
   individual pills), separated by a thin dot. */
.gear-stat-pill {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: #b9cce6;
  white-space: nowrap;
}

.gear-stat-pill:not(:last-child)::after {
  content: " \00b7 ";
  color: rgba(160, 180, 210, 0.55);
}

.gear-stat-pill.name {
  color: #ffffff;
  font-weight: 700;
}

.gear-stat-pill.empty {
  color: var(--muted);
}

.spell-grid {
  grid-template-columns: 1.15fr 0.72fr 0.68fr 0.68fr 0.68fr;
  align-items: end;
}

.field-wide {
  grid-column: 1 / -1;
}

.spell-entry-section {
  padding: 1rem 1.05rem 1.05rem;
  background: linear-gradient(180deg, rgba(18, 30, 52, 0.78) 0%, rgba(10, 18, 34, 0.72) 100%);
  border-color: rgba(74, 106, 145, 0.55);
}

.spell-entry-title-row {
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.spell-entry-section .field span {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.spell-entry-section input,
.spell-entry-section select {
  min-height: 48px;
  font-size: 1.02rem;
  padding-inline: 0.78rem;
}

#enemy-search {
  min-height: 45px;
  max-height: 45px;
  line-height: 1.1;
}

.spell-entry-section .section-copy h2,
.spell-entry-section .section-copy h3 {
  font-size: 1.1rem;
}

.spell-entry-section .section-copy p {
  font-size: 0.92rem;
}

.spell-entry-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.6rem;
}

.spell-entry-row {
  display: flex;
  gap: 0.7rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.spell-entry-identity .field {
  min-width: 0;
}

.field-grow {
  flex: 1 1 11rem;
  min-width: 0;
}

.field-school {
  flex: 0 0 6.2rem;
  min-width: 0;
}

.field-pips {
  flex: 0 0 4rem;
  min-width: 0;
}

.field-sun {
  flex: 0 0 8rem;
  min-width: 0;
}

.field-sun > span {
  white-space: nowrap;
}

#spell-school {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 0.55rem;
  background-image: none;
}

.spell-entry-block {
  padding: 0.72rem 0.85rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(63, 89, 124, 0.42);
  background: rgba(8, 16, 30, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.spell-entry-block-header {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.spell-entry-block-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #d5e3fb;
}

.spell-entry-block-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.spell-damage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.pip-assist-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.spell-damage-grid[hidden],
.pip-assist-grid[hidden] {
  display: none !important;
}

.pip-input-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem;
}

.pip-step-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.28rem;
}

.pip-step-button {
  min-height: 30px;
  padding: 0.24rem 0.4rem;
  font-size: 0.75rem;
}

.pip-input-row input {
  min-width: 0;
}

.spell-cost-pip-row {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.field-pips input {
  min-height: 48px;
  padding-inline: 0.72rem;
  text-align: center;
}

.spell-entry-summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-height: 2rem;
}

.spell-entry-summary-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.multi-school-block {
  border-color: rgba(111, 150, 215, 0.5);
  background: linear-gradient(180deg, rgba(11, 20, 39, 0.72) 0%, rgba(8, 16, 30, 0.52) 100%);
}

.multi-school-block[hidden],
.extra-spell-packets[hidden],
.queue-school[hidden] {
  display: none !important;
}

.extra-spell-packets {
  display: grid;
  gap: 0.5rem;
}

.extra-spell-packet {
  padding: 0.58rem 0.72rem 0.68rem;
  border-radius: 10px;
  border: 1px solid rgba(73, 106, 152, 0.52);
  background: rgba(8, 16, 30, 0.58);
  display: grid;
  gap: 0.45rem;
}

.spell-entry-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.extra-spell-packet .spell-entry-block-header {
  gap: 0.35rem;
}

.extra-spell-packet .spell-entry-block-title {
  font-size: 0.74rem;
}

.extra-spell-packet .field span {
  font-size: 0.78rem;
}

.extra-spell-packet input,
.extra-spell-packet select {
  min-height: 38px;
  padding-top: 0.48rem;
  padding-bottom: 0.48rem;
}

.spell-entry-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(12, 22, 40, 0.85);
  border: 1px solid rgba(74, 106, 145, 0.5);
  color: #eaf4ff;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
}

.spell-entry-pill em {
  font-style: normal;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.spell-entry-pill small {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}

.spell-entry-pill.total {
  border-color: rgba(95, 168, 255, 0.7);
  background: linear-gradient(180deg, rgba(28, 59, 104, 0.86) 0%, rgba(15, 34, 63, 0.92) 100%);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(95, 168, 255, 0.25) inset;
}

.spell-entry-pill.total em {
  color: rgba(213, 227, 251, 0.85);
}

.spell-entry-pill.packet em {
  color: rgba(149, 201, 255, 0.88);
}

.spell-entry-pill-button {
  cursor: pointer;
  min-height: 0;
  border-radius: 8px;
  border-color: rgba(95, 168, 255, 0.76);
  background: linear-gradient(180deg, #4188f2 0%, var(--button) 100%);
  color: var(--button-text);
  box-shadow: 0 0 0 1px rgba(95, 168, 255, 0.16) inset;
}

.spell-entry-settings-button {
  border-color: rgba(74, 106, 145, 0.6);
  background: rgba(12, 22, 40, 0.92);
  color: #eaf4ff;
  box-shadow: none;
}

.spell-damage-grid.condensed-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.spell-dot-field[hidden],
.packet-dot-field[hidden],
.field-pips[hidden] {
  display: none !important;
}

.queue-school {
  display: inline-flex;
  align-items: center;
  min-height: 1.45rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(90, 124, 170, 0.5);
  background: rgba(15, 28, 51, 0.85);
  color: #dfeeff;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sun-entry-row {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.42rem;
  margin-top: 0.2rem;
}

.sun-entry-row > span {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
}

.spell-picker-inline {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(63, 89, 124, 0.38);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
}

.spell-picker-inline .section-copy p {
  color: #dfeaff;
  font-size: 0.94rem;
  font-weight: 700;
}

.finder-section {
  display: grid;
  gap: 0.7rem;
}

.finder-panel {
  display: grid;
  gap: 0.65rem;
}

.finder-panel[hidden] {
  display: none !important;
}

.finder-panel .section-copy h2,
.finder-panel .section-copy h3 {
  font-size: 1.04rem;
}

.finder-panel .section-copy p {
  font-size: 0.92rem;
}

.finder-panel .search-block input {
  min-height: 45px;
  max-height: 45px;
  font-size: 0.94rem;
  padding-top: 0.42rem;
  padding-bottom: 0.42rem;
}

.gear-grid {
  grid-template-columns: 1.15fr repeat(5, minmax(0, 0.62fr));
  align-items: end;
}

.compact-grid {
  grid-template-columns: 1.1fr 0.5fr 0.5fr 0.5fr 0.5fr 0.6fr 0.6fr 1.45fr;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.field span {
  font-size: 0.84rem;
  color: var(--muted);
}

.sun-block {
  display: flex;
  align-items: center;
  justify-items: end;
}

.search-block {
  position: relative;
  display: grid;
  gap: 0.55rem;
}

.finder-action-group {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.enemy-search-results {
  position: absolute;
  top: calc(100% + 0.38rem);
  left: 0;
  right: 0;
  z-index: 25;
  display: grid;
  gap: 0.38rem;
  max-height: 260px;
  overflow: auto;
  padding: 0.4rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid rgba(63, 89, 124, 0.58);
  background: rgba(7, 14, 27, 0.98);
  box-shadow: 0 18px 36px rgba(2, 6, 16, 0.48);
}

.enemy-search-results[hidden] {
  display: none !important;
}

.enemy-library-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.enemy-search-item {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 0.14rem;
  padding: 0.56rem 0.64rem;
  background: rgba(8, 15, 28, 0.88);
  border: 1px solid var(--panel-border);
}

.enemy-search-item strong {
  font-size: 0.88rem;
}

.enemy-search-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.enemy-search-item-warning {
  color: #ffd27d !important;
  font-size: 0.74rem !important;
  font-weight: 700;
}

.enemy-search-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.compact-empty {
  padding: 0.62rem;
  font-size: 0.82rem;
  border-radius: calc(var(--radius) - 6px);
  background: rgba(10, 18, 33, 0.82);
}

.spell-preview-card {
  margin-top: 0.7rem;
  padding: 0.8rem;
  border: 1px solid rgba(54, 82, 118, 0.52);
  border-radius: var(--radius);
  background: rgba(12, 21, 38, 0.62);
  position: relative;
}

.spell-preview-copy {
  display: grid;
  gap: 0.2rem;
}

.spell-preview-copy strong {
  font-size: 0.96rem;
}

.spell-preview-copy span {
  color: var(--muted);
  font-size: 0.82rem;
}

.effect-label {
  font-size: inherit;
  font-weight: 700;
}

.effect-label-boost {
  color: #7df0a5;
}

.effect-label-resist {
  color: #ff8d99;
}

.effect-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  vertical-align: middle;
}

.effect-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0.1rem 0.44rem;
  border-radius: 999px;
  border: 1px solid rgba(63, 89, 124, 0.5);
  background: rgba(11, 18, 34, 0.92);
  font-size: 0.76rem;
  font-weight: 800;
  gap: 0.32rem;
}

.effect-badge.boost {
  box-shadow: 0 0 0 1px rgba(102, 211, 143, 0.14) inset;
}

.effect-badge.resist {
  box-shadow: 0 0 0 1px rgba(255, 111, 125, 0.14) inset;
}

.school-name {
  font-weight: 800;
}

.school-name.school-fire,
.effect-badge .school-name.school-fire {
  color: #ff6b4a !important;
}

.school-name.school-ice,
.effect-badge .school-name.school-ice {
  color: #8ee7ff !important;
}

.school-name.school-storm,
.effect-badge .school-name.school-storm {
  color: #b685ff !important;
}

.school-name.school-myth,
.effect-badge .school-name.school-myth {
  color: #f0d243 !important;
}

.school-name.school-life,
.effect-badge .school-name.school-life {
  color: #74e98d !important;
}

.school-name.school-death,
.effect-badge .school-name.school-death {
  color: #99d66b !important;
}

.school-name.school-balance,
.effect-badge .school-name.school-balance {
  color: #f1d27a !important;
}

.school-name.school-sun,
.effect-badge .school-name.school-sun {
  color: #ffc94e !important;
}

.school-name.school-moon,
.effect-badge .school-name.school-moon {
  color: #8ca7ff !important;
}

.school-name.school-star,
.effect-badge .school-name.school-star {
  color: #7ad9ff !important;
}

.school-name.school-shadow,
.effect-badge .school-name.school-shadow {
  color: #c18bff !important;
}

.school-name.school-none,
.effect-badge .school-name.school-none {
  color: #d5e3fb !important;
}

.effect-value.boost {
  color: #7df0a5;
  font-weight: 800;
}

.effect-value.resist {
  color: #ff8d99;
  font-weight: 800;
}

.enemy-block-stat {
  display: block;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #edf4ff !important;
  font-size: 0.82rem;
  font-weight: 400;
}

.enemy-block-stat.has-block {
  color: #edf4ff !important;
  font-weight: 400;
}

.enemy-preview-meta {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  flex-wrap: wrap;
}

.enemy-preview-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  background: rgba(11, 18, 34, 0.92);
  border: 1px solid rgba(63, 89, 124, 0.45);
  color: #d5e3fb;
  font-size: 0.76rem;
  font-weight: 700;
}

.enemy-preview-health {
  color: #ff8d99 !important;
  font-size: 0.84rem !important;
  font-weight: 700;
}

.enemy-spells {
  position: relative;
  width: 100%;
  max-width: 100%;
}

.enemy-spells-trigger {
  display: inline-block;
  color: #f4a9bf !important;
  font-size: 0.84rem;
  font-weight: 700 !important;
  cursor: help;
  text-decoration: underline dotted rgba(244, 169, 191, 0.55);
  text-underline-offset: 0.16rem;
}

.enemy-spells-trigger:focus-visible {
  outline: 2px solid #79a6ff;
  outline-offset: 2px;
}

.enemy-spells-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 0.12rem);
  z-index: 10;
  width: min(360px, calc(100vw - 2.5rem));
  padding: 0.68rem 0.78rem;
  border-radius: 12px;
  border: 1px solid rgba(74, 106, 145, 0.64);
  background: rgba(7, 14, 27, 0.97);
  box-shadow: 0 18px 34px rgba(1, 8, 20, 0.42);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 120ms ease, visibility 120ms ease, transform 120ms ease;
}

.enemy-spells:hover .enemy-spells-tooltip,
.enemy-spells:focus-within .enemy-spells-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.enemy-spells-tooltip strong {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
}

.enemy-spells-tooltip ul {
  margin: 0;
  padding-left: 1.05rem;
  display: grid;
  gap: 0.22rem;
  max-height: 220px;
  overflow: auto;
}

.enemy-spells-tooltip li {
  color: #edf4ff;
  font-size: 0.76rem;
  line-height: 1.3;
}

.enemy-preview-spells-row {
  margin-top: 0.04rem;
}

#enemy-preview-health,
#enemy-preview-boosts,
#enemy-preview-resists,
#enemy-preview-block,
#enemy-preview-cheats,
.enemy-spells-trigger {
  font-size: 0.84rem;
  line-height: 1.3;
  font-weight: 700 !important;
}

.enemy-cheats.has-cheat {
  color: #ff8d99;
  font-weight: 700;
}

.enemy-preview-empty-row {
  color: #edf4ff !important;
}

.enemy-preview-missing-data {
  color: #ffd27d;
  font-style: normal;
  font-weight: 700;
}

.enemy-preview-estimate-note {
  color: #ffd27d;
  font-size: 0.76rem;
  font-style: italic;
  font-weight: 700;
}

#enemy-preview-boosts .effect-label,
#enemy-preview-resists .effect-label,
#enemy-preview-boosts .effect-badges,
#enemy-preview-resists .effect-badges,
#enemy-preview-boosts .effect-badge,
#enemy-preview-resists .effect-badge {
  font-size: 0.84rem;
}

.spell-preview-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}

.enemy-preview-top {
  display: block;
}

.enemy-preview-top strong {
  display: inline-block;
}

.enemy-name-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  max-width: 100%;
}

.enemy-wiki-link {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(95, 168, 255, 0.45);
  background: rgba(12, 22, 40, 0.7);
  color: #aecbff;
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.2;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.enemy-wiki-link:hover,
.enemy-wiki-link:focus-visible {
  background: rgba(28, 59, 104, 0.86);
  border-color: rgba(95, 168, 255, 0.85);
  color: #eaf4ff;
  outline: none;
}

.enemy-cheats-link {
  margin-left: 0.35rem;
  padding: 0.04rem 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 141, 153, 0.55);
  background: rgba(46, 14, 22, 0.72);
  color: #ffd1d6;
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.enemy-cheats-link:hover,
.enemy-cheats-link:focus-visible {
  background: rgba(96, 22, 36, 0.92);
  border-color: rgba(255, 141, 153, 0.95);
  color: #fff;
  outline: none;
}

.enemy-preview-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.8rem;
  margin-top: 0.7rem;
}

.enemy-preview-footer .spell-preview-actions {
  margin-top: 0;
}

.enemy-preview-location {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  display: grid;
  gap: 0.12rem;
  justify-items: end;
  text-align: right;
  max-width: 14.5rem;
  padding: 0.48rem 0.6rem;
  border-radius: 10px;
  background: rgba(7, 14, 27, 0.78);
  border: 1px solid rgba(63, 89, 124, 0.34);
  box-shadow: 0 8px 18px rgba(1, 8, 20, 0.18);
}

.enemy-preview-location span {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.2;
}

.school-fire { border-color: rgba(255, 107, 74, 0.42); }
.school-ice { border-color: rgba(142, 231, 255, 0.42); }
.school-storm { border-color: rgba(182, 133, 255, 0.42); }
.school-myth { border-color: rgba(240, 210, 67, 0.42); }
.school-life { border-color: rgba(116, 233, 141, 0.42); }
.school-death { border-color: rgba(153, 214, 107, 0.42); }
.school-balance { border-color: rgba(241, 210, 122, 0.42); }
.school-sun { border-color: rgba(255, 201, 78, 0.42); }
.school-moon { border-color: rgba(140, 167, 255, 0.42); }
.school-star { border-color: rgba(122, 217, 255, 0.42); }
.school-shadow { border-color: rgba(193, 139, 255, 0.42); }
.school-none { border-color: rgba(213, 227, 251, 0.28); }

.sun-button {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  padding: 0.48rem 0.78rem;
  background: rgba(7, 15, 28, 0.9);
  border: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 0.96rem;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.sun-name {
  color: inherit;
}

.sun-flat {
  color: #d9e7ff;
  font-weight: 700;
  font-size: 1rem;
}

.sun-button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #d9e7ff;
}

.inline-field {
  flex-direction: column;
}

input {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.58rem 0.72rem;
  background: rgba(7, 14, 27, 0.92);
  color: var(--text);
  min-height: 40px;
  font-size: 0.94rem;
}

select {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.58rem 0.72rem;
  background: rgba(7, 14, 27, 0.92);
  color: var(--text);
  min-height: 40px;
  font-size: 0.94rem;
}

.results-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.rail-results-strip {
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  align-items: stretch;
}

.results-strip {
  margin-top: 0.75rem;
}

.compact-results-strip {
  max-width: 520px;
  margin-left: auto;
}

.rail-results-strip .result-value {
  font-size: 1.32rem;
}

.result-tile,
.queue-item,
.preset-tab,
.empty-state,
.guide-card {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel-alt);
}

.result-tile {
  padding: 0.46rem 0.68rem;
  min-height: 58px;
  background:
    linear-gradient(180deg, rgba(22, 39, 67, 0.96), rgba(18, 31, 52, 0.96)),
    var(--panel-alt);
}

.result-tile-metrics,
.result-tile-enemy {
  display: grid;
  gap: 0.18rem;
}

.result-label {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-bottom: 0.08rem;
}

.result-value {
  display: block;
  font-size: 1.22rem;
  line-height: 1.15;
}

.result-card-head {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.result-card-head span:last-child {
  text-align: right;
}

.result-cross-card {
  position: relative;
  display: grid;
  min-height: 62px;
  padding: 0.62rem 0.96rem 0.72rem;
  border: 1px solid rgba(66, 96, 136, 0.62);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(15, 28, 48, 0.94), rgba(10, 19, 33, 0.94)),
    rgba(8, 15, 27, 0.92);
  overflow: hidden;
}

.result-cross-card::before {
  content: "";
  position: absolute;
  background: rgba(90, 120, 160, 0.45);
}

.result-cross-card::before {
  top: 0.62rem;
  bottom: 0.72rem;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
}

.result-cross-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.88rem;
  align-items: center;
  justify-items: center;
  min-height: 100%;
}

.result-cross-value {
  display: grid;
  gap: 0.02rem;
  justify-items: center;
  min-width: 0;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.result-cross-value-compact {
  font-size: 1rem;
}

.result-cross-value-tight {
  font-size: 0.92rem;
}

.result-cross-value-tiny {
  font-size: 0.84rem;
}

.result-cross-range-line,
.result-cross-range-separator {
  display: block;
}

.result-cross-range-separator {
  color: #9fb7d8;
  font-size: 0.82em;
  line-height: 0.78;
}

.result-meta {
  display: block;
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.15;
  text-align: center;
}


.result-tile-enemy .result-value,
.result-tile-enemy .result-meta {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.22;
  text-align: left;
}

.outcome-line-label,
.outcome-line-value {
  display: block;
}

.outcome-line-label {
  color: var(--muted);
  margin-bottom: 0.08rem;
  text-align: left;
}

.outcome-line-value {
  text-align: left;
}

.outcome-line-value.normal.safe {
  color: #66d38f;
}

.outcome-line-value.crit.safe,
.outcome-line-value.crit.neutral {
  color: #ffcc70;
}

.outcome-line-value.defeated {
  color: #ff6f7d;
}

.outcome-line-value.normal.neutral {
  color: #d7e6fb;
}

.result-tile-enemy {
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.result-tile-enemy.state-active {
  border-color: rgba(95, 168, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(95, 168, 255, 0.16) inset;
}

.result-tile-enemy.state-warning {
  border-color: rgba(255, 204, 112, 0.58);
  box-shadow: 0 0 0 1px rgba(255, 204, 112, 0.16) inset;
}

.result-tile-enemy.state-defeated {
  border-color: rgba(102, 211, 143, 0.58);
  box-shadow: 0 0 0 1px rgba(102, 211, 143, 0.16) inset;
}

.result-tile-enemy.state-defeated .result-value {
  color: #b9f4cb;
}

.result-tile-enemy.state-warning .result-value {
  color: var(--warn);
}

.side-section + .side-section {
  margin-top: 0.75rem;
}

.side-compact-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.52rem 0.5rem;
  align-items: start;
  justify-content: stretch;
}

.side-compact-grid > .school-stat-section,
.side-compact-grid > .paired-side-grid > .school-stat-section,
.side-compact-grid > .paired-side-grid > .compact-side-section {
  justify-self: center;
}

.caster-compact-grid {
  padding-top: 0.36rem;
}

.side-compact-grid > .paired-side-grid {
  display: contents;
}

.side-compact-grid .side-section,
.side-compact-grid .compact-side-section,
.side-compact-grid .side-section + .side-section,
.side-compact-grid .compact-side-section + .compact-side-section {
  min-width: 0;
  margin-top: 0;
}

.side-compact-grid .side-section,
.side-compact-grid .compact-side-section {
  display: grid;
  justify-items: start;
}

.side-compact-grid .section-title-row {
  align-items: start;
  gap: 0.22rem;
}

.side-compact-grid .section-title-row h3 {
  font-size: 0.82rem;
  line-height: 1.05;
  white-space: nowrap;
}

.side-compact-grid .lowered-stat-heading {
  top: 0;
  margin-bottom: 0;
}

.side-compact-grid .single-stat-row {
  margin-top: 0.24rem;
  gap: 0.3rem;
  align-items: center;
  flex-wrap: wrap;
}

.side-compact-grid .stat-row-inline,
.side-compact-grid .paired-side-grid .single-stat-row {
  flex-wrap: wrap;
  align-items: center;
}

.side-compact-grid .single-stat-actions,
.side-compact-grid .aux-stat-group,
.side-compact-grid .stat-row-inline .single-stat-actions,
.side-compact-grid .stat-row-inline .aux-stat-group,
.side-compact-grid .paired-side-grid .single-stat-row .single-stat-actions {
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-left: 0;
  white-space: normal;
}

.side-compact-grid .offset-inline-row .aux-stat-group {
  top: 0;
}

.side-compact-grid .temp-pierce-row {
  justify-content: flex-start;
}

.side-compact-grid .preset-dropdown summary {
  min-height: 32px;
  padding: 0.32rem 0.5rem;
  font-size: 0.76rem;
}

.caster-compact-grid > .side-section:nth-child(2) .preset-dropdown summary,
.enemy-compact-grid > .side-section:nth-child(2) .preset-dropdown summary {
  min-height: 36px;
  padding: 0.42rem 0.62rem;
  font-size: 0.86rem;
}

.side-compact-grid .compact-button {
  min-height: 32px;
}

.inline-modifier-section {
  grid-column: 1 / -1;
  justify-items: stretch !important;
}

.inline-modifier-section .modifier-title-row {
  display: grid;
  align-items: start;
  justify-content: start;
  text-align: left;
  width: max-content;
  gap: 0.26rem;
  margin: 0;
}

.inline-modifier-section .modifier-title-row h3 {
  justify-self: start;
}

.inline-modifier-controls {
  display: flex;
  align-items: center;
  gap: 0.34rem;
  flex-wrap: nowrap;
  width: 100%;
  justify-content: flex-start;
}

.inline-modifier-section .inline-modifier-controls {
  justify-content: flex-start;
}

.inline-modifier-section .modifier-title-row .inline-modifier-controls {
  justify-content: flex-start;
}

.inline-modifier-controls .modifier-add-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0.42rem 0.58rem;
  font-size: 0.86rem;
}

.inline-modifier-controls .inline-custom-form {
  display: grid;
  grid-template-columns: 74px auto;
  align-items: center;
  gap: 0.34rem;
  margin-top: 0;
  margin-left: 0;
}

.inline-modifier-controls .inline-custom-form input {
  min-height: 36px;
  padding: 0.4rem 0.52rem;
  font-size: 0.86rem;
  appearance: textfield;
  -moz-appearance: textfield;
}

.inline-modifier-controls .inline-custom-form input::-webkit-outer-spin-button,
.inline-modifier-controls .inline-custom-form input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.inline-modifier-controls .inline-custom-form button {
  min-height: 36px;
  padding: 0.42rem 0.58rem;
  font-size: 0.86rem;
}

.school-stat-section .uniform-compact-stat-field {
  width: 132px;
  min-width: 132px;
  max-width: 132px;
}

.school-stat-section .single-stat-field.uniform-compact-stat-field,
.side-compact-grid .school-stat-section .single-stat-field.uniform-compact-stat-field {
  flex: 0 0 132px;
  max-width: 132px;
}

.school-stat-section .single-stat-row {
  display: grid;
  grid-template-columns: 132px max-content;
  align-items: center;
}

.school-stat-section .single-stat-actions {
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.side-compact-grid > .paired-side-grid > .compact-side-section .single-stat-row {
  flex-wrap: nowrap;
}

.caster-compact-grid > .caster-aux-grid {
  display: contents;
}

.caster-compact-grid > .side-section:nth-child(1) {
  order: 1;
  grid-column: 1 / -1;
  grid-row: 1;
}

.caster-compact-grid > .side-section:nth-child(2) {
  order: 2;
  grid-column: 1 / 3;
  grid-row: 2;
  padding-left: 0.35rem;
}

.caster-compact-grid > .caster-aux-grid > .side-section:nth-child(3) {
  order: 3;
  grid-column: 3 / 5;
  grid-row: 2;
}

.caster-compact-grid > .caster-aux-grid > .side-section:nth-child(2) {
  order: 4;
  grid-column: 5 / 7;
  grid-row: 2;
}

.caster-compact-grid > .caster-aux-grid > .side-section:nth-child(1) {
  order: 5;
  grid-column: 1 / 4;
  grid-row: 3;
  justify-self: start;
  padding-right: 0;
}

.caster-compact-grid > .side-section:nth-child(3) {
  order: 5;
  grid-column: 4 / 7;
  grid-row: 3;
  justify-self: start;
  padding-left: 0.75rem;
}

.enemy-compact-grid > .side-section:nth-child(1) {
  order: 1;
  grid-column: 1 / -1;
  grid-row: 1;
}

.enemy-compact-grid > .side-section:nth-child(2) {
  order: 2;
  grid-column: 1 / 3;
  grid-row: 2;
  padding-left: 0.35rem;
}

.enemy-compact-grid > .side-section:nth-child(3) {
  order: 3;
  grid-column: 3 / 5;
  grid-row: 2;
}

.enemy-compact-grid > .enemy-aux-grid {
  display: contents;
}

.enemy-compact-grid > .enemy-aux-grid > .side-section:nth-child(2) {
  order: 4;
  grid-column: 5 / 7;
  grid-row: 2;
}

.enemy-compact-grid > .enemy-aux-grid > .side-section:nth-child(1) {
  order: 5;
  grid-column: 1 / 4;
  grid-row: 3;
  justify-self: start;
  padding-right: 0;
}

.enemy-compact-grid > .side-section:nth-child(4) {
  order: 5;
  grid-column: 4 / 7;
  grid-row: 3;
  justify-self: start;
  padding-left: 0.75rem;
}

#aura-applied-display {
  padding: 0.34rem 0.4rem;
  font-size: 0.74rem;
  line-height: 1.08;
  white-space: normal;
  text-align: center;
}

#enemy-resist-applied-display {
  padding: 0.34rem 0.4rem;
  font-size: 0.74rem;
  line-height: 1.08;
  white-space: normal;
  text-align: center;
}


.paired-side-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.compact-side-section {
  margin-top: 0.75rem;
}

.compact-side-section + .compact-side-section {
  margin-top: 0.75rem;
}

.section-title-row h2,
.section-title-row h3 {
  font-size: 0.94rem;
}

.modifier-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  align-items: start;
  gap: 0.26rem;
}

.modifier-title-row .button-cluster {
  justify-content: flex-start;
}

.modifier-add-button {
  padding: 0.36rem 0.52rem;
  background: var(--accent-soft);
  color: #b9d0ff;
  border: 1px solid #25427a;
  font-size: 0.8rem;
}

.modifier-add-button.positive-button {
  background: var(--good-soft);
  color: #baf4cb;
  border-color: #2f7f4f;
}

.modifier-add-button.negative-button {
  background: var(--bad-soft);
  color: #ffc2ca;
  border-color: #8d4150;
}

.custom-form {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.45rem;
}

.compact-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.single-stat-field {
  margin-top: 0.42rem;
  max-width: 180px;
  min-width: 0;
}

.single-stat-row {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  margin-top: 0.42rem;
  flex-wrap: wrap;
}

.single-stat-actions {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 0.34rem;
  flex-wrap: wrap;
}

.aux-stat-group {
  display: flex;
  align-items: flex-end;
  gap: 0.34rem;
  flex-wrap: wrap;
}

.compact-inline-field {
  width: 58px;
}

.uniform-compact-stat-field {
  width: 58px;
  min-width: 58px;
  max-width: 58px;
}

.single-stat-field.uniform-compact-stat-field {
  flex: 0 0 58px;
}

.uniform-compact-stat-field input {
  width: 100%;
  padding-inline: 0.34rem;
  font-size: 0.82rem;
  text-align: center;
}

.compact-inline-field input {
  min-height: 40px;
  padding-inline: 0.42rem;
}

.compact-inline-field span {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: left;
  white-space: normal;
}

@media (min-width: 761px) {
  .spell-entry-identity {
    flex-wrap: nowrap;
  }
}

.lowered-stat-heading {
  position: relative;
  top: 10px;
  margin-bottom: 2px;
}

.wide-stat-field {
  max-width: 220px;
}

.narrow-stat-field {
  max-width: 96px;
}

.ultra-narrow-stat-field {
  max-width: 74px;
}

.stat-row-inline {
  flex-wrap: nowrap;
  align-items: flex-end;
}

.offset-inline-row {
  align-items: center;
  padding-top: 0;
  margin-top: 0.08rem;
}

.top-aligned-row {
  align-items: flex-start;
}

.stat-row-inline .single-stat-field {
  flex: 0 0 58px;
  max-width: 58px;
  margin-top: 0;
}

.stat-row-inline .single-stat-field.uniform-compact-stat-field {
  flex: 0 0 58px;
  max-width: 58px;
}

.stat-row-inline .single-stat-field.wide-stat-field,
.paired-side-grid .single-stat-row .single-stat-field.wide-stat-field {
  flex-basis: 220px;
  max-width: 220px;
}

.paired-side-grid .single-stat-row .single-stat-field.ultra-narrow-stat-field {
  flex: 0 0 68px;
  max-width: 68px;
}

.stat-row-inline .single-stat-actions {
  flex-wrap: nowrap;
  white-space: nowrap;
}

.stat-row-inline .single-stat-actions .button-cluster {
  flex-wrap: nowrap;
}

.stat-row-inline .aux-stat-group {
  flex-wrap: nowrap;
  margin-left: auto;
}

.offset-inline-row .single-stat-field,
.offset-inline-row .single-stat-actions,
.offset-inline-row .aux-stat-group {
  align-self: center;
}

.offset-inline-row .aux-stat-group {
  position: relative;
  top: -9px;
}

.caster-aux-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.55fr);
}

.enemy-aux-grid {
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
}

.enemy-aux-grid .compact-inline-field {
  width: 58px;
}

.aura-row .single-stat-field.wide-stat-field {
  flex: 0 1 280px;
  max-width: 280px;
}

.temp-pierce-row {
  justify-content: flex-end;
}

.paired-side-grid .single-stat-row {
  flex-wrap: nowrap;
  align-items: flex-end;
}

.paired-side-grid .single-stat-row .single-stat-field {
  flex: 0 0 58px;
  max-width: 58px;
  margin-top: 0;
}

.paired-side-grid .single-stat-row .single-stat-field.uniform-compact-stat-field {
  flex: 0 0 58px;
  max-width: 58px;
}

.paired-side-grid .single-stat-row .single-stat-actions {
  flex-wrap: nowrap;
  white-space: nowrap;
}

.paired-side-grid .single-stat-row .single-stat-actions .button-cluster {
  flex-wrap: nowrap;
}

.single-stat-actions .button-cluster {
  gap: 0.28rem;
}

.single-stat-actions .compact-button,
.aux-stat-group .compact-button {
  padding: 0.35rem 0.48rem;
  font-size: 0.78rem;
}

.stat-field {
  position: relative;
}

.applied-stat-display {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0.58rem 0.72rem;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(7, 14, 27, 0.92);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.applied-stat-display[hidden],
.single-stat-actions .button-cluster[hidden],
.single-stat-field input[hidden] {
  display: none !important;
}

.applied-stat-display-positive {
  color: #baf4cb;
  border-color: #2f7f4f;
  background: linear-gradient(180deg, rgba(18, 49, 30, 0.96), rgba(12, 31, 20, 0.96));
}

.applied-stat-display-negative {
  color: #ffc2ca;
  border-color: #8d4150;
  background: linear-gradient(180deg, rgba(60, 24, 31, 0.96), rgba(39, 15, 20, 0.96));
}

.stat-field::after {
  content: "";
  position: absolute;
  inset: auto 0 -6px 0;
  height: 2px;
  border-radius: 999px;
  opacity: 0.85;
}

.positive-field input {
  border-color: #2f6f4c;
  box-shadow: 0 0 0 1px rgba(102, 211, 143, 0.08) inset;
}

.positive-field::after {
  background: linear-gradient(90deg, transparent, var(--good), transparent);
}

.negative-field input {
  border-color: #7b3e4b;
  box-shadow: 0 0 0 1px rgba(255, 111, 125, 0.08) inset;
}

.negative-field::after {
  background: linear-gradient(90deg, transparent, var(--bad), transparent);
}

.queue-list,
.preset-tabs,
.guide-list {
  display: grid;
  gap: 0.45rem;
}

.preset-group {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 0 0 auto;
}

.saved-spells-group {
  flex: 1 1 auto;
  min-height: 0;
}

.spell-tabs {
  overflow: auto;
  padding-right: 0.2rem;
}

.spell-sort-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  flex-wrap: wrap;
}

.queue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.queue-item {
  padding: 0.32rem 0.38rem;
  width: auto;
  min-height: 0;
  gap: 0.28rem;
  border-radius: 999px;
}

.queue-item.positive-item {
  background: linear-gradient(180deg, rgba(28, 59, 45, 0.92), rgba(22, 42, 33, 0.92));
  border-color: rgba(90, 168, 116, 0.55);
}

.queue-item.negative-item {
  background: linear-gradient(180deg, rgba(68, 27, 37, 0.92), rgba(46, 22, 31, 0.92));
  border-color: rgba(179, 76, 92, 0.5);
}

.queue-item.dragging {
  opacity: 0.55;
}

.queue-item.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.queue-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: nowrap;
}

.queue-index,
.queue-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: #0e1730;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 0.78rem;
}

.queue-value {
  font-size: 0.84rem;
}

.queue-value.negative {
  color: #ffb5c0;
}

.queue-value.positive {
  color: #bff0cd;
}

.queue-kind {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.summary-column {
  min-width: 0;
}

.order-side-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.guide-card {
  padding: 0.8rem;
  background:
    linear-gradient(180deg, rgba(21, 37, 64, 0.96), rgba(16, 28, 49, 0.96)),
    var(--panel-alt);
}

.guide-layout {
  display: grid;
  gap: 0.75rem;
}

.guide-card-header {
  margin-bottom: 0.7rem;
}

.guide-card-header h3 {
  margin: 0;
  font-size: 1rem;
}

.guide-card-header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.guide-table-wrap {
  overflow-x: auto;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.guide-table th,
.guide-table td {
  padding: 0.58rem 0.56rem;
  border-bottom: 1px solid rgba(63, 89, 124, 0.45);
  text-align: left;
  vertical-align: top;
}

.guide-table th {
  color: #c9d9f6;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.guide-table tbody tr:hover {
  background: rgba(88, 130, 200, 0.08);
}

.guide-table tbody tr:last-child td {
  border-bottom: 0;
}

.guide-code {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  background: rgba(10, 19, 35, 0.92);
  border: 1px solid rgba(68, 97, 136, 0.65);
  color: #d5e3fb;
  font-size: 0.74rem;
  font-weight: 700;
}

.percent-positive,
.percent-negative,
.percent-neutral,
.text-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.16rem 0.46rem;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.percent-positive {
  background: rgba(37, 100, 64, 0.34);
  border: 1px solid rgba(91, 189, 125, 0.45);
  color: #bff0cd;
}

.percent-negative {
  background: rgba(104, 32, 44, 0.34);
  border: 1px solid rgba(214, 106, 122, 0.45);
  color: #ffc4cb;
}

.percent-neutral,
.text-badge {
  background: rgba(14, 25, 43, 0.92);
  border: 1px solid rgba(65, 94, 131, 0.55);
  color: #d5e3fb;
}

.text-badge.warn {
  color: #ffe0a3;
  border-color: rgba(255, 204, 112, 0.45);
}

.guide-note {
  color: var(--muted);
}

.guide-apply-button {
  padding: 0.36rem 0.56rem;
  font-size: 0.78rem;
}

.guide-apply-group {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.guide-inline-action {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.preset-tab {
  padding: 0.45rem;
}

.spell-tabs .preset-tab {
  padding: 0.32rem;
}

.preset-tab.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.preset-tab-button {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 0.12rem;
  padding: 0.58rem 0.62rem;
  background: rgba(10, 16, 31, 0.85);
  border: 1px solid var(--panel-border);
  min-width: 0;
}

.preset-tab-button strong {
  font-size: 0.9rem;
}

.spell-tabs .preset-tab-button {
  padding: 0.46rem 0.54rem;
  user-select: none;
}

.spell-tabs .preset-tab-button strong {
  font-size: 0.84rem;
}

.spell-tabs .preset-meta {
  font-size: 0.78rem;
}

.preset-submeta {
  color: #9dc0eb;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
}

.spell-preset-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8.4rem;
  gap: 0.38rem;
  align-items: stretch;
}

.spell-compare-panel {
  display: grid;
  gap: 0.14rem;
  align-content: start;
  padding: 0.42rem 0.48rem;
  border-radius: 10px;
  border: 1px solid rgba(74, 106, 145, 0.46);
  background: linear-gradient(180deg, rgba(10, 18, 33, 0.96), rgba(8, 15, 28, 0.96));
  min-width: 0;
  user-select: none;
}

.spell-compare-head,
.spell-compare-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem;
  align-items: start;
}

.spell-compare-head span {
  color: #a9bedc;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.spell-compare-value-normal,
.spell-compare-value-crit,
.spell-compare-meta-normal,
.spell-compare-meta-crit,
.spell-compare-percent-normal,
.spell-compare-percent-crit {
  display: block;
  min-width: 0;
}

.spell-compare-value-normal,
.spell-compare-value-crit {
  color: #eef6ff;
  font-size: 0.9rem;
  line-height: 1.05;
}

.spell-compare-meta-normal,
.spell-compare-meta-crit {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.15;
}

.spell-compare-percent-normal,
.spell-compare-percent-crit {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.1;
}

.spell-compare-panel.compare-better {
  border-color: rgba(102, 211, 143, 0.58);
  background: linear-gradient(180deg, rgba(12, 34, 22, 0.98), rgba(10, 24, 17, 0.98));
}

.spell-compare-panel.compare-worse {
  border-color: rgba(255, 111, 125, 0.48);
  background: linear-gradient(180deg, rgba(42, 14, 21, 0.98), rgba(25, 10, 14, 0.98));
}

.spell-compare-panel.compare-selected {
  border-color: rgba(89, 166, 255, 0.58);
  background: linear-gradient(180deg, rgba(14, 28, 51, 0.98), rgba(10, 19, 34, 0.98));
}

.compare-rate-better {
  color: #bff0cd;
}

.compare-rate-worse {
  color: #ffbfc7;
}

.compare-rate-selected {
  color: #bfd7ff;
}

.spell-preset-card .preset-tab-actions {
  margin-top: 0.35rem;
}

.spell-preset-card .preset-tab-actions button {
  padding: 0.34rem 0.52rem;
  font-size: 0.76rem;
  user-select: none;
}

.saved-title-row {
  margin-bottom: 0.4rem;
}

.damage-title-row {
  justify-content: flex-start;
  gap: 1.2rem;
}

.damage-title-row h2,
.damage-title-row h3 {
  font-size: 1.08rem;
}

.exact-range-toggle {
  margin-left: auto;
  white-space: nowrap;
}

.preset-tab-actions {
  margin-top: 0.45rem;
}

.empty-state {
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.guide-accordion {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: rgba(10, 18, 33, 0.72);
  overflow: hidden;
}

.guide-accordion summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.62rem;
  cursor: pointer;
  padding: 0.88rem 1rem;
  font-weight: 700;
  color: var(--text);
}

.guide-accordion summary::before {
  content: ">";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.8rem;
  color: var(--accent);
}

.guide-accordion summary::-webkit-details-marker {
  display: none;
}

.guide-accordion[open] summary::before {
  content: "v";
}

.guide-accordion[open] summary {
  border-bottom: 1px solid rgba(63, 89, 124, 0.45);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(3, 8, 18, 0.72);
  backdrop-filter: blur(6px);
}

.modal-panel {
  width: min(760px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: linear-gradient(180deg, rgba(19, 31, 53, 0.99) 0%, rgba(13, 23, 40, 0.99) 100%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.modal-header,
.modal-actions,
.modal-loadout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.modal-header {
  margin-bottom: 0.8rem;
}

.modal-header h2 {
  margin: 0;
}

.modal-actions {
  margin-top: 0.8rem;
}

.loadout-modal-actions {
  margin-bottom: 0.65rem;
}

.modal-list {
  display: grid;
  gap: 0.55rem;
}

.modal-loadout-item {
  padding: 0.6rem;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: rgba(12, 21, 38, 0.8);
}

.modal-loadout-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.loadout-select-button {
  flex: 1;
  text-align: left;
  display: grid;
  gap: 0.14rem;
  padding: 0.58rem 0.62rem;
  background: rgba(8, 15, 28, 0.88);
  border: 1px solid var(--panel-border);
}

.loadout-select-button strong {
  font-size: 0.92rem;
}

.loadout-select-button span {
  color: var(--muted);
  font-size: 0.8rem;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: 1.15fr repeat(5, minmax(0, 0.62fr));
  gap: 0.7rem;
}

.modal-panel-compact {
  width: min(560px, calc(100vw - 2rem));
}

.modal-copy {
  margin: 0 0 0.9rem;
  color: var(--muted);
}

.overlay-help-panel .modal-actions {
  align-items: stretch;
  flex-wrap: wrap;
}

.overlay-help-steps {
  display: grid;
  gap: 0.55rem;
  margin: 0.8rem 0 1rem;
}

.overlay-help-steps div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: center;
  padding: 0.68rem 0.75rem;
  border: 1px solid rgba(68, 97, 136, 0.5);
  border-radius: var(--radius);
  background: rgba(10, 18, 34, 0.84);
}

.overlay-help-steps strong {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: rgba(74, 154, 255, 0.18);
  color: var(--accent);
}

.button-link-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: 0.48rem 0.8rem;
  border: 1px solid rgba(90, 169, 255, 0.55);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(45, 117, 207, 0.98), rgba(32, 91, 164, 0.98));
  color: #f8fbff;
  font-weight: 800;
  text-decoration: none;
}

.button-link-primary[hidden] {
  display: none;
}

.settings-stack {
  display: grid;
  gap: 0.85rem;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(68, 97, 136, 0.5);
  border-radius: 14px;
  background: rgba(10, 18, 34, 0.84);
}

.settings-row strong,
.settings-row p {
  margin: 0;
}

.settings-row p {
  margin-top: 0.22rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.choice-button {
  justify-content: flex-start;
  text-align: left;
  min-height: 0;
  padding: 0.66rem 0.78rem;
  background: rgba(10, 18, 34, 0.88);
  border: 1px solid rgba(68, 97, 136, 0.5);
}

@media (max-width: 1180px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .preset-rail {
    position: static;
    max-height: none;
  }
}

@media (max-width: 1080px) {
  .loadout-grid,
  .spell-layout,
  .dual-grid,
  .summary-grid,
  .paired-side-grid,
  .modal-form-grid {
    grid-template-columns: 1fr;
  }

  .spell-grid,
  .gear-grid,
  .compact-grid,
  .spell-damage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .spell-preset-top {
    grid-template-columns: minmax(0, 1fr);
  }

  .results-inline {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  body {
    zoom: 1;
  }

  .app-shell {
    width: min(100vw - 0.5rem, 100%);
    padding-top: 0.4rem;
  }

  .topbar,
  .panel-header,
  .section-title-row,
  .queue-item,
  .modal-header,
  .modal-actions,
  .modal-loadout-item {
    flex-direction: column;
    align-items: stretch;
  }

  .enemy-header-health-field {
    width: 72px;
    margin-left: 0;
    align-items: flex-start;
  }

  .enemy-header-health-field span {
    display: block;
    text-align: left;
    white-space: nowrap;
    min-width: max-content;
  }

  .enemy-header-health-field input {
    text-align: center;
  }

  .topbar-actions,
  .button-cluster,
  .preset-tab-actions,
  .sun-buttons {
    justify-content: flex-start;
  }

  .donation-toast {
    right: 0.75rem;
    bottom: 0.75rem;
    width: calc(100vw - 1.5rem);
  }

  .setup-toast {
    right: 0.75rem;
    bottom: 0.75rem;
    width: calc(100vw - 1.5rem);
  }


  .sun-block {
    justify-content: flex-start;
  }

  .gear-stat-summary {
    justify-content: flex-start;
  }

  .compact-grid,
  .spell-grid,
  .gear-grid,
  .compact-form,
  .results-inline,
  .modal-form-grid,
  .spell-damage-grid {
    grid-template-columns: 1fr;
  }

  .result-cross-card {
    min-height: 88px;
  }

  .spell-preset-top {
    grid-template-columns: 1fr;
  }

  .spell-picker-inline {
    align-items: stretch;
    flex-direction: column;
  }

  .enemy-preview-top {
    padding-right: 0;
  }

  .enemy-preview-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .enemy-preview-location {
    position: static;
    max-width: none;
    justify-items: start;
    text-align: left;
    margin-top: 0.6rem;
  }

  .single-stat-row {
    flex-direction: column;
    align-items: stretch;
  }
}
.usage-privacy {
  max-width: 980px;
  margin: 12px auto 24px;
  padding: 0 16px;
  color: var(--muted, #b8c6d9);
  font-size: 12px;
  line-height: 1.5;
}
.usage-privacy summary { cursor: pointer; }
.usage-privacy label { display: flex; align-items: center; gap: 8px; }

@media (max-width: 760px) {
  .inline-modifier-section .modifier-title-row {
    width: 100%;
  }

  .inline-modifier-controls {
    flex-wrap: wrap;
  }

  .school-stat-section .single-stat-row {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }
}

/* ==== Light theme (default). Generated by build-light-theme.py; dark mode = [data-theme="dark"] ==== */
.starter-spells-row {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.8rem;
}

.starter-spells-row[hidden] {
  display: none;
}

.starter-badge {
  display: inline-block;
  padding: 0.04rem 0.4rem;
  border: 1px solid rgba(255, 204, 112, 0.55);
  border-radius: 999px;
  background: rgba(93, 63, 12, 0.32);
  color: #ffe3a8;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

:root:not([data-theme="dark"]) {
  color-scheme: light;
  --bg: #9ba7b1;
  --panel: #d3d8dc;
  --panel-alt: #c4cdd3;
  --panel-border: #a4afb7;
  --text: #25313d;
  --muted: #52606a;
  --accent: #2563c9;
  --accent-soft: #bacbda;
  --button: #2d6fd6;
  --button-text: #f7f9fb;
  --good: #1d743f;
  --good-soft: rgba(25, 132, 74, 0.12);
  --bad: #c42a40;
  --bad-soft: rgba(196, 42, 64, 0.1);
  --warn: #a5650a;
  --shadow: 0 10px 26px rgba(28, 50, 88, 0.12);
}

:root:not([data-theme="dark"]) body {
  background: radial-gradient(circle at top left, rgba(185, 191, 196, 0.18), transparent 38%), linear-gradient(180deg, #aab3ba, #8f9ca6);
  background-attachment: fixed;
}

:root:not([data-theme="dark"]) button:focus-visible,
:root:not([data-theme="dark"]) input:focus-visible,
:root:not([data-theme="dark"]) .paypal-button:focus-visible,
:root:not([data-theme="dark"]) .enemy-spells-trigger:focus-visible {
  outline-color: #2563c9;
}

:root:not([data-theme="dark"]) .ghost-button.success-button {
  color: #16683b;
  border-color: rgba(25, 132, 74, 0.45);
  background: rgba(25, 132, 74, 0.08);
}

:root:not([data-theme="dark"]) .ghost-button.danger-button {
  color: #a8233a;
  border-color: rgba(196, 42, 64, 0.42);
  background: rgba(196, 42, 64, 0.07);
}

:root:not([data-theme="dark"]) .paypal-button {
  border-color: rgba(176, 124, 12, 0.55);
}

:root:not([data-theme="dark"]) .donation-toast,
:root:not([data-theme="dark"]) .setup-toast {
  border-color: rgba(70, 100, 145, 0.42);
  background: linear-gradient(180deg, #dce0e2 0%, #d3d9dd 100%);
  box-shadow: 0 16px 34px rgba(28, 50, 88, 0.18);
}

:root:not([data-theme="dark"]) .auth-button,
:root:not([data-theme="dark"]) .toggle-button.active {
  border-color: rgba(37, 99, 201, 0.45);
  background: #ccd3d8;
  color: #1f56b3;
}

:root:not([data-theme="dark"]) .toggle-button.active {
  box-shadow: 0 0 0 1px rgba(37, 99, 201, 0.14) inset;
}

:root:not([data-theme="dark"]) .auth-button.active {
  border-color: rgba(25, 132, 74, 0.5);
  background: #c7d9cc;
  color: #16683b;
}

:root:not([data-theme="dark"]) .feedback-button {
  border-color: rgba(176, 124, 12, 0.5);
  background: #dfd1b0;
  color: #71470b;
}

:root:not([data-theme="dark"]) .feedback-modal-panel {
  border-color: rgba(70, 100, 145, 0.35);
  background: radial-gradient(circle at top right, rgba(255, 204, 112, 0.16), transparent 28%), linear-gradient(180deg, #dce0e2 0%, #d3d9dd 100%);
}

:root:not([data-theme="dark"]) .feedback-form-grid select,
:root:not([data-theme="dark"]) .feedback-form-grid textarea,
:root:not([data-theme="dark"]) .feedback-form-grid input {
  border-color: rgba(70, 100, 145, 0.42);
  background: #dce0e2;
  color: #25313d;
}

:root:not([data-theme="dark"]) .auth-helper-link,
:root:not([data-theme="dark"]) .auth-feedback {
  color: #1f56b3;
}

:root:not([data-theme="dark"]) .auth-feedback.error {
  color: #a8233a;
}

:root:not([data-theme="dark"]) .auth-feedback.success {
  color: #16683b;
}

:root:not([data-theme="dark"]) .auth-status-card {
  border-color: rgba(70, 100, 145, 0.28);
  background: #d3d9dd;
}

:root:not([data-theme="dark"]) .icon-button {
  border-color: rgba(196, 42, 64, 0.4);
  background: #e0c9cc;
  color: #a8233a;
}

:root:not([data-theme="dark"]) .preset-dropdown summary {
  background: #dce0e2;
  color: #3d4a55;
}

:root:not([data-theme="dark"]) .preset-dropdown[open] summary {
  background: var(--accent-soft);
}

:root:not([data-theme="dark"]) .preset-dropdown.positive-dropdown summary {
  border-color: rgba(25, 132, 74, 0.5);
  background: var(--good-soft);
  color: #16683b;
}

:root:not([data-theme="dark"]) .preset-dropdown.negative-dropdown summary {
  border-color: rgba(196, 42, 64, 0.45);
  background: var(--bad-soft);
  color: #a8233a;
}

:root:not([data-theme="dark"]) .preset-dropdown.positive-dropdown[open] summary {
  border-color: #1d743f;
}

:root:not([data-theme="dark"]) .preset-dropdown.negative-dropdown[open] summary {
  border-color: #c42a40;
}

:root:not([data-theme="dark"]) .preset-dropdown-menu {
  border-color: rgba(70, 100, 145, 0.42);
  background: #dce0e2;
  box-shadow: 0 16px 34px rgba(28, 50, 88, 0.16);
}

:root:not([data-theme="dark"]) .sun-enchant-overwrite-actions {
  border-top-color: rgba(70, 100, 145, 0.28);
}

:root:not([data-theme="dark"]) .field-sun .preset-dropdown summary {
  background: #dce0e2;
}

:root:not([data-theme="dark"]) .topbar-loadout-group {
  border-color: rgba(70, 100, 145, 0.28);
  background: rgba(222, 226, 228, 0.78);
}

:root:not([data-theme="dark"]) .active-loadout-chip {
  color: #25313d;
}

:root:not([data-theme="dark"]) .panel {
  background: linear-gradient(180deg, #dce0e2 0%, #d3d9dd 100%);
  box-shadow: var(--shadow);
}

:root:not([data-theme="dark"]) .enemy-header-health-field input:disabled {
  background: #ccd3d8;
  border-color: rgba(110, 125, 150, 0.4);
  color: #58646e;
}

:root:not([data-theme="dark"]) .loadout-section,
:root:not([data-theme="dark"]) .spell-preview-card {
  border-color: rgba(70, 100, 145, 0.28);
  background: #d3d9dd;
}

:root:not([data-theme="dark"]) .gear-stat-summary,
:root:not([data-theme="dark"]) .gear-stat-pill {
  color: #3d4a55;
}

:root:not([data-theme="dark"]) .gear-stat-pill:not(:last-child)::after {
  color: rgba(70, 100, 145, 0.5);
}

:root:not([data-theme="dark"]) .gear-stat-pill.name {
  color: #25313d;
}

:root:not([data-theme="dark"]) .gear-stat-pill.empty {
  color: var(--muted);
}

:root:not([data-theme="dark"]) .spell-entry-section {
  background: linear-gradient(180deg, #dce0e2 0%, #d3d9dd 100%);
  border-color: rgba(70, 100, 145, 0.28);
}

:root:not([data-theme="dark"]) .spell-entry-block,
:root:not([data-theme="dark"]) .extra-spell-packet {
  border-color: rgba(70, 100, 145, 0.28);
  background: rgba(222, 226, 228, 0.85);
}

:root:not([data-theme="dark"]) .spell-entry-block-title {
  color: #3d4a55;
}

:root:not([data-theme="dark"]) .multi-school-block {
  border-color: rgba(37, 99, 201, 0.32);
  background: linear-gradient(180deg, #d3d9dd 0%, #dce0e2 100%);
}

:root:not([data-theme="dark"]) .spell-entry-pill {
  background: #dce0e2;
  border-color: rgba(70, 100, 145, 0.42);
  color: #25313d;
}

:root:not([data-theme="dark"]) .spell-entry-pill-button {
  border-color: rgba(37, 99, 201, 0.7);
  background: linear-gradient(180deg, #4188f2 0%, var(--button) 100%);
  color: var(--button-text);
}

:root:not([data-theme="dark"]) .spell-entry-settings-button {
  background: #dce0e2;
  border-color: rgba(70, 100, 145, 0.42);
  color: #25313d;
}

:root:not([data-theme="dark"]) .spell-entry-pill.total {
  border-color: rgba(37, 99, 201, 0.5);
  background: linear-gradient(180deg, #ccd3d8 0%, #ccd3d8 100%);
  color: #10264d;
  box-shadow: none;
}

:root:not([data-theme="dark"]) .spell-entry-pill.total em {
  color: rgba(16, 38, 77, 0.72);
}

:root:not([data-theme="dark"]) .spell-entry-pill.packet em {
  color: #1f56b3;
}

:root:not([data-theme="dark"]) .queue-school {
  border-color: rgba(70, 100, 145, 0.42);
  background: #d3d9dd;
  color: #3d4a55;
}

:root:not([data-theme="dark"]) .spell-picker-inline {
  border-top-color: rgba(70, 100, 145, 0.28);
}

:root:not([data-theme="dark"]) .spell-picker-inline .section-copy p {
  color: #3d4a55;
}

:root:not([data-theme="dark"]) .enemy-search-results {
  border-color: rgba(70, 100, 145, 0.42);
  background: #dce0e2;
  box-shadow: 0 18px 36px rgba(28, 50, 88, 0.16);
}

:root:not([data-theme="dark"]) .enemy-search-item {
  background: #d3d9dd;
  color: #25313d;
}

:root:not([data-theme="dark"]) .enemy-search-item-warning {
  color: #71470b !important;
}

:root:not([data-theme="dark"]) .compact-empty {
  background: #d3d9dd;
}

:root:not([data-theme="dark"]) .effect-label-boost,
:root:not([data-theme="dark"]) .effect-value.boost {
  color: #16683b;
}

:root:not([data-theme="dark"]) .effect-label-resist,
:root:not([data-theme="dark"]) .effect-value.resist,
:root:not([data-theme="dark"]) .enemy-cheats.has-cheat {
  color: #a8233a;
}

:root:not([data-theme="dark"]) .effect-badge,
:root:not([data-theme="dark"]) .enemy-preview-meta span {
  border-color: rgba(70, 100, 145, 0.28);
  background: #dce0e2;
}

:root:not([data-theme="dark"]) .enemy-preview-meta span {
  color: #3d4a55;
}

:root:not([data-theme="dark"]) .effect-badge.boost {
  box-shadow: 0 0 0 1px rgba(25, 132, 74, 0.14) inset;
}

:root:not([data-theme="dark"]) .effect-badge.resist {
  box-shadow: 0 0 0 1px rgba(196, 42, 64, 0.14) inset;
}

:root:not([data-theme="dark"]) .enemy-block-stat,
:root:not([data-theme="dark"]) .enemy-block-stat.has-block,
:root:not([data-theme="dark"]) .enemy-preview-empty-row {
  color: #25313d !important;
}

:root:not([data-theme="dark"]) .enemy-preview-health {
  color: #a8233a !important;
}

:root:not([data-theme="dark"]) .enemy-spells-trigger {
  color: #96255d !important;
  text-decoration-color: rgba(168, 48, 106, 0.5);
}

:root:not([data-theme="dark"]) .enemy-spells-tooltip {
  border-color: rgba(70, 100, 145, 0.42);
  background: #dce0e2;
  box-shadow: 0 18px 34px rgba(28, 50, 88, 0.18);
}

:root:not([data-theme="dark"]) .enemy-spells-tooltip li {
  color: #25313d;
}

:root:not([data-theme="dark"]) .enemy-preview-missing-data,
:root:not([data-theme="dark"]) .enemy-preview-estimate-note {
  color: #71470b;
}

:root:not([data-theme="dark"]) .enemy-wiki-link {
  border-color: rgba(37, 99, 201, 0.4);
  background: #d3d9dd;
  color: #1f56b3;
}

:root:not([data-theme="dark"]) .enemy-wiki-link:hover,
:root:not([data-theme="dark"]) .enemy-wiki-link:focus-visible {
  background: #ccd3d8;
  border-color: rgba(37, 99, 201, 0.7);
  color: #123f8a;
}

:root:not([data-theme="dark"]) .enemy-cheats-link {
  border-color: rgba(196, 42, 64, 0.4);
  background: #e2cfd0;
  color: #a8233a;
}

:root:not([data-theme="dark"]) .enemy-cheats-link:hover,
:root:not([data-theme="dark"]) .enemy-cheats-link:focus-visible {
  background: #dcbcc1;
  border-color: rgba(196, 42, 64, 0.75);
  color: #861a2c;
}

:root:not([data-theme="dark"]) .enemy-preview-location {
  background: rgba(222, 226, 228, 0.85);
  border-color: rgba(70, 100, 145, 0.28);
  box-shadow: 0 8px 18px rgba(28, 50, 88, 0.08);
}

:root:not([data-theme="dark"]) .sun-button {
  background: #dce0e2;
}

:root:not([data-theme="dark"]) .sun-flat,
:root:not([data-theme="dark"]) .sun-button.active {
  color: #3d4a55;
}

:root:not([data-theme="dark"]) .sun-button.active {
  background: var(--accent-soft);
}

:root:not([data-theme="dark"]) input,
:root:not([data-theme="dark"]) select,
:root:not([data-theme="dark"]) .applied-stat-display {
  background: #dce0e2;
}

:root:not([data-theme="dark"]) .result-tile {
  background: linear-gradient(180deg, #dce0e2, #d3d9dd), var(--panel-alt);
}

:root:not([data-theme="dark"]) .result-cross-card {
  border-color: rgba(70, 100, 145, 0.42);
  background: linear-gradient(180deg, #dce0e2, #d3d9dd);
}

:root:not([data-theme="dark"]) .result-cross-card::before {
  background: rgba(70, 100, 145, 0.3);
}

:root:not([data-theme="dark"]) .result-cross-range-separator {
  color: #586773;
}

:root:not([data-theme="dark"]) .outcome-line-value.normal.safe {
  color: #16683b;
}

:root:not([data-theme="dark"]) .outcome-line-value.crit.safe,
:root:not([data-theme="dark"]) .outcome-line-value.crit.neutral {
  color: #71470b;
}

:root:not([data-theme="dark"]) .outcome-line-value.defeated {
  color: #a8233a;
}

:root:not([data-theme="dark"]) .outcome-line-value.normal.neutral {
  color: #3d4a55;
}

:root:not([data-theme="dark"]) .result-tile-enemy.state-active {
  border-color: rgba(37, 99, 201, 0.45);
  box-shadow: 0 0 0 1px rgba(37, 99, 201, 0.12) inset;
}

:root:not([data-theme="dark"]) .result-tile-enemy.state-warning {
  border-color: rgba(176, 124, 12, 0.5);
  box-shadow: 0 0 0 1px rgba(176, 124, 12, 0.12) inset;
}

:root:not([data-theme="dark"]) .result-tile-enemy.state-defeated {
  border-color: rgba(25, 132, 74, 0.5);
  box-shadow: 0 0 0 1px rgba(25, 132, 74, 0.12) inset;
}

:root:not([data-theme="dark"]) .result-tile-enemy.state-defeated .result-value {
  color: #16683b;
}

:root:not([data-theme="dark"]) .modifier-add-button {
  color: #1f56b3;
  border-color: rgba(37, 99, 201, 0.4);
}

:root:not([data-theme="dark"]) .modifier-add-button.positive-button,
:root:not([data-theme="dark"]) .applied-stat-display-positive {
  color: #16683b;
  border-color: rgba(25, 132, 74, 0.45);
}

:root:not([data-theme="dark"]) .modifier-add-button.negative-button,
:root:not([data-theme="dark"]) .applied-stat-display-negative {
  color: #a8233a;
  border-color: rgba(196, 42, 64, 0.42);
}

:root:not([data-theme="dark"]) .applied-stat-display-positive {
  background: linear-gradient(180deg, #d0dfd3, #c6d9cb);
}

:root:not([data-theme="dark"]) .applied-stat-display-negative {
  background: linear-gradient(180deg, #e3d1d3, #dfc6ca);
}

:root:not([data-theme="dark"]) .positive-field input {
  border-color: rgba(25, 132, 74, 0.45);
  box-shadow: 0 0 0 1px rgba(25, 132, 74, 0.06) inset;
}

:root:not([data-theme="dark"]) .negative-field input {
  border-color: rgba(196, 42, 64, 0.4);
  box-shadow: 0 0 0 1px rgba(196, 42, 64, 0.06) inset;
}

:root:not([data-theme="dark"]) .queue-item.positive-item {
  background: linear-gradient(180deg, #ceded2, #c6d8cd);
  border-color: rgba(25, 132, 74, 0.4);
}

:root:not([data-theme="dark"]) .queue-item.negative-item {
  background: linear-gradient(180deg, #e4d1d4, #dfc8cc);
  border-color: rgba(196, 42, 64, 0.36);
}

:root:not([data-theme="dark"]) .queue-index,
:root:not([data-theme="dark"]) .queue-count {
  background: #ccd3d8;
  color: #3d4a55;
}

:root:not([data-theme="dark"]) .queue-value.negative {
  color: #a8233a;
}

:root:not([data-theme="dark"]) .queue-value.positive {
  color: #16683b;
}

:root:not([data-theme="dark"]) .guide-card {
  background: linear-gradient(180deg, #dce0e2, #d3d9dd), var(--panel-alt);
}

:root:not([data-theme="dark"]) .guide-table th,
:root:not([data-theme="dark"]) .guide-table td {
  border-bottom-color: rgba(70, 100, 145, 0.28);
}

:root:not([data-theme="dark"]) .guide-table th {
  color: #3d4a55;
}

:root:not([data-theme="dark"]) .guide-table tbody tr:hover {
  background: rgba(37, 99, 201, 0.06);
}

:root:not([data-theme="dark"]) .guide-code {
  background: #d3d9dd;
  border-color: rgba(70, 100, 145, 0.42);
  color: #25313d;
}

:root:not([data-theme="dark"]) .percent-positive {
  background: rgba(25, 132, 74, 0.1);
  border-color: rgba(25, 132, 74, 0.38);
  color: #16683b;
}

:root:not([data-theme="dark"]) .percent-negative {
  background: rgba(196, 42, 64, 0.08);
  border-color: rgba(196, 42, 64, 0.36);
  color: #a8233a;
}

:root:not([data-theme="dark"]) .percent-neutral,
:root:not([data-theme="dark"]) .text-badge {
  background: #d3d9dd;
  border-color: rgba(70, 100, 145, 0.42);
  color: #3d4a55;
}

:root:not([data-theme="dark"]) .text-badge.warn {
  color: #71470b;
  border-color: rgba(176, 124, 12, 0.45);
}

:root:not([data-theme="dark"]) .preset-tab-button {
  background: #dce0e2;
  color: #25313d;
}

:root:not([data-theme="dark"]) .preset-submeta {
  color: #1f56b3;
}

:root:not([data-theme="dark"]) .spell-compare-panel {
  border-color: rgba(70, 100, 145, 0.28);
  background: linear-gradient(180deg, #dce0e2, #d3d9dd);
}

:root:not([data-theme="dark"]) .spell-compare-head span {
  color: #52616f;
}

:root:not([data-theme="dark"]) .spell-compare-value-normal,
:root:not([data-theme="dark"]) .spell-compare-value-crit {
  color: #25313d;
}

:root:not([data-theme="dark"]) .spell-compare-panel.compare-better {
  border-color: rgba(25, 132, 74, 0.5);
  background: linear-gradient(180deg, #cfdfd4, #c9dbcf);
}

:root:not([data-theme="dark"]) .spell-compare-panel.compare-worse {
  border-color: rgba(196, 42, 64, 0.42);
  background: linear-gradient(180deg, #e3d2d5, #decacf);
}

:root:not([data-theme="dark"]) .spell-compare-panel.compare-selected {
  border-color: rgba(37, 99, 201, 0.5);
  background: linear-gradient(180deg, #d3d9dd, #ccd3d8);
}

:root:not([data-theme="dark"]) .compare-rate-better {
  color: #16683b;
}

:root:not([data-theme="dark"]) .compare-rate-worse {
  color: #a8233a;
}

:root:not([data-theme="dark"]) .compare-rate-selected {
  color: #1f56b3;
}

:root:not([data-theme="dark"]) .guide-accordion {
  background: #d3d9dd;
}

:root:not([data-theme="dark"]) .guide-accordion[open] summary {
  border-bottom-color: rgba(70, 100, 145, 0.28);
}

:root:not([data-theme="dark"]) .modal-backdrop {
  background: rgba(22, 36, 59, 0.45);
}

:root:not([data-theme="dark"]) .modal-panel {
  background: linear-gradient(180deg, #dce0e2 0%, #d3d9dd 100%);
}

:root:not([data-theme="dark"]) .modal-loadout-item {
  background: #d3d9dd;
}

:root:not([data-theme="dark"]) .loadout-select-button {
  background: #dce0e2;
  color: #25313d;
}

:root:not([data-theme="dark"]) .overlay-help-steps div,
:root:not([data-theme="dark"]) .settings-row,
:root:not([data-theme="dark"]) .choice-button {
  border-color: rgba(70, 100, 145, 0.42);
  background: #d3d9dd;
}

:root:not([data-theme="dark"]) .choice-button {
  color: #25313d;
}

:root:not([data-theme="dark"]) .overlay-help-steps strong {
  background: rgba(37, 99, 201, 0.12);
}

:root:not([data-theme="dark"]) .usage-privacy {
  color: var(--muted);
}

:root:not([data-theme="dark"]) .school-name.school-fire,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-fire {
  color: #ae3216 !important;
}

:root:not([data-theme="dark"]) .school-fire {
  border-color: rgba(204, 59, 23, 0.42);
}

:root:not([data-theme="dark"]) .school-name.school-ice,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-ice {
  color: #096a8c !important;
}

:root:not([data-theme="dark"]) .school-ice {
  border-color: rgba(11, 127, 166, 0.42);
}

:root:not([data-theme="dark"]) .school-name.school-storm,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-storm {
  color: #6f35cc !important;
}

:root:not([data-theme="dark"]) .school-storm {
  border-color: rgba(111, 53, 204, 0.42);
}

:root:not([data-theme="dark"]) .school-name.school-myth,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-myth {
  color: #725800 !important;
}

:root:not([data-theme="dark"]) .school-myth {
  border-color: rgba(138, 109, 0, 0.42);
}

:root:not([data-theme="dark"]) .school-name.school-life,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-life {
  color: #176a31 !important;
}

:root:not([data-theme="dark"]) .school-life {
  border-color: rgba(20, 135, 58, 0.42);
}

:root:not([data-theme="dark"]) .school-name.school-death,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-death {
  color: #42651c !important;
}

:root:not([data-theme="dark"]) .school-death {
  border-color: rgba(74, 122, 28, 0.42);
}

:root:not([data-theme="dark"]) .school-name.school-balance,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-balance {
  color: #795506 !important;
}

:root:not([data-theme="dark"]) .school-balance {
  border-color: rgba(148, 108, 6, 0.42);
}

:root:not([data-theme="dark"]) .school-name.school-sun,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-sun {
  color: #795000 !important;
}

:root:not([data-theme="dark"]) .school-sun {
  border-color: rgba(168, 111, 0, 0.42);
}

:root:not([data-theme="dark"]) .school-name.school-moon,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-moon {
  color: #3f58c8 !important;
}

:root:not([data-theme="dark"]) .school-moon {
  border-color: rgba(63, 88, 200, 0.42);
}

:root:not([data-theme="dark"]) .school-name.school-star,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-star {
  color: #08698b !important;
}

:root:not([data-theme="dark"]) .school-star {
  border-color: rgba(10, 122, 166, 0.42);
}

:root:not([data-theme="dark"]) .school-name.school-shadow,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-shadow {
  color: #7d3cc6 !important;
}

:root:not([data-theme="dark"]) .school-shadow {
  border-color: rgba(125, 60, 198, 0.42);
}

:root:not([data-theme="dark"]) .school-name.school-none,
:root:not([data-theme="dark"]) .effect-badge .school-name.school-none {
  color: #42526b !important;
}

:root:not([data-theme="dark"]) .school-none {
  border-color: rgba(66, 82, 107, 0.42);
}

:root:not([data-theme="dark"]) .starter-badge {
  border-color: rgba(176, 124, 12, 0.45);
  background: #dfd1b0;
  color: #71470b;
}

:root:not([data-theme="dark"]) .panel {
  background: linear-gradient(180deg, #d6dade, #cbd1d5);
}

:root:not([data-theme="dark"]) .spell-entry-section {
  background: linear-gradient(180deg, #d7d5cf, #cbc9c3);
}

:root:not([data-theme="dark"]) .finder-panel {
  background: linear-gradient(180deg, #ccd6da, #c2cdd2);
}

:root:not([data-theme="dark"]) .result-tile,
:root:not([data-theme="dark"]) .result-cross-card {
  background: linear-gradient(180deg, #dcd5c7, #cec8bc);
}

:root:not([data-theme="dark"]) .topbar-loadout-group {
  background: #d2cec4;
}

:root:not([data-theme="dark"]) input,
:root:not([data-theme="dark"]) select,
:root:not([data-theme="dark"]) .feedback-form-grid input,
:root:not([data-theme="dark"]) .feedback-form-grid select,
:root:not([data-theme="dark"]) .feedback-form-grid textarea {
  background: #e1e4e5;
}

:root:not([data-theme="dark"]) input::placeholder,
:root:not([data-theme="dark"]) textarea::placeholder {
  color: #5e6973;
  opacity: 1;
}

/* ==== End light theme ==== */
:root:not([data-theme="dark"]) #open-combat-overlay,
:root:not([data-theme="dark"]) #theme-toggle {
  background: #496681;
  border-color: #2f465d;
  color: #f5f8fc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 3px rgba(31, 46, 61, 0.16);
}

:root:not([data-theme="dark"]) #open-combat-overlay:hover,
:root:not([data-theme="dark"]) #theme-toggle:hover {
  background: #3c5873;
}

:root:not([data-theme="dark"]) #open-combat-overlay {
  background: #5a5196;
  border-color: #3b3470;
}

:root:not([data-theme="dark"]) #open-combat-overlay:hover {
  background: #4b4383;
}

:root:not([data-theme="dark"]) #open-combat-overlay.active {
  background: #bed7c9;
  border-color: #52745d;
  color: #214e32;
}

/* Guided tour */
.tour-active .setup-toast {
  display: none;
}

.tour-spotlight {
  position: fixed;
  z-index: 1050;
  border: 2px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 0 0 4px rgba(89, 166, 255, 0.28);
  pointer-events: none;
  transition: left 0.2s ease, top 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.tour-spotlight-dim {
  box-shadow: 0 0 0 4px rgba(89, 166, 255, 0.28), 0 0 0 9999px rgba(3, 9, 18, 0.5);
}

.tour-spotlight[hidden] {
  display: none;
}

.tour-card {
  position: fixed;
  z-index: 1100;
  width: min(380px, calc(100vw - 24px));
  display: grid;
  gap: 0.55rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 18px 44px rgba(1, 8, 20, 0.5);
}

.tour-card-centered {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.tour-card h2 {
  margin: 0;
  font-size: 1.12rem;
}

.tour-progress {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tour-body {
  color: var(--text);
  font-size: 0.93rem;
  line-height: 1.45;
}

.tour-body ul {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 0.45rem;
  padding-left: 1.1rem;
}

.tour-wait {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

.tour-wait-done {
  color: var(--good);
  font-style: normal;
  font-weight: 800;
}

.tour-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.tour-actions .tour-end-link {
  margin-left: auto;
}

.tour-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .tour-card,
  .tour-card-centered {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    width: auto;
    max-height: 48vh;
    overflow-y: auto;
    transform: none;
  }

  .tour-card.tour-card-top {
    top: 12px;
    bottom: auto;
  }
}
