:root {
  color-scheme: only light;
  --bg-0: #0e100b;
  --bg-1: #161a11;
  --bg-2: #202519;
  --panel: rgba(22, 25, 19, 0.92);
  --border: rgba(224, 194, 119, 0.45);
  --ink: #ead7b4;
  --muted: #d1c1a3;
  --accent: #e3c47a;
  --accent-soft: rgba(227, 196, 122, 0.25);
  --ok: #9ad3b0;
  --warn: #f0c98e;
  --bad: #e08a77;
  --glow: rgba(227, 196, 122, 0.45);
  --shadow: rgba(5, 7, 4, 0.72);
  --text-outline: 0 0 2px rgba(11, 9, 6, 0.75), 0 1px 2px rgba(11, 9, 6, 0.7);
  --text-shadow: var(--text-outline);
  --font-scale: 1;
  --fs-xxs: calc(11px * var(--font-scale));
  --fs-xs: calc(12px * var(--font-scale));
  --fs-sm: calc(13px * var(--font-scale));
  --fs-md: calc(14px * var(--font-scale));
  --fs-base: calc(16px * var(--font-scale));
  --fs-lg: calc(18px * var(--font-scale));
  --fs-xl: calc(20px * var(--font-scale));
  --font-title: "Yu Mincho", "Hiragino Mincho ProN", "MS PMincho", serif;
  --font-body: "Yu Gothic", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
}

.theme-neutral {
  --ink: #ece8de;
  --muted: #d6d2c8;
  --text-outline: 0 1px 2px rgba(8, 8, 8, 0.65);
}

.theme-warm-ivory {
  --ink: #f3ead7;
  --muted: #d9ccb4;
  --text-outline: 0 1px 2px rgba(10, 11, 7, 0.7);
}

.theme-parchment {
  --ink: #ead7b4;
  --muted: #d1c1a3;
  --text-outline: 0 0 2px rgba(11, 9, 6, 0.75), 0 1px 2px rgba(11, 9, 6, 0.7);
}

.text-style-default {
  --text-shadow: var(--text-outline);
}

.text-style-none {
  --text-shadow: none;
}

.text-style-white-accent {
  --ink: #f7f4ed;
  --muted: #efe3c9;
  --text-shadow: 0 0 2px rgba(227, 196, 122, 0.85), 0 1px 2px rgba(8, 7, 4, 0.6);
}

.text-style-white-dark {
  --ink: #f7f4ed;
  --muted: #e6dcc4;
  --text-shadow: 0 0 2px rgba(8, 8, 8, 0.75), 0 1px 2px rgba(8, 8, 8, 0.6);
}

.text-style-accent-outline {
  --text-shadow: 0 0 2px rgba(227, 196, 122, 0.9);
}

.text-size-s {
  --font-scale: 0.95;
}

.text-size-m {
  --font-scale: 1;
}

.text-size-l {
  --font-scale: 1.08;
}

.text-size-xl {
  --font-scale: 1.16;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #252b19 0%, #12160c 48%, #0b0e08 100%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 15% 10%, rgba(214, 181, 109, 0.18), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(86, 139, 104, 0.2), transparent 55%),
    radial-gradient(circle at 50% 85%, rgba(73, 104, 121, 0.16), transparent 60%);
  z-index: 0;
  filter: blur(0px);
}

.page {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0 auto;
}

.rail {
  display: contents;
}

.rail .ad-sidebar {
  width: 300px;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  text-shadow: var(--text-shadow);
}

.hero {
  padding: 24px 28px 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(27, 32, 20, 0.85), rgba(16, 18, 11, 0.95));
  box-shadow: 0 18px 40px var(--shadow);
  animation: fadeUp 0.7s ease-out;
}

.hero-badge {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  color: var(--muted);
}

.hero h1 {
  font-family: var(--font-title);
  font-size: clamp(28px, 4vw, 44px);
  margin: 14px 0 8px;
  letter-spacing: 0.08em;
}

.text-search-page .hero h1 {
  font-size: clamp(16px, 2.2vw, 22px);
  line-height: 1.4;
  letter-spacing: 0.02em;
  margin: 10px 0 8px;
}

.hero-lead {
  margin: 0 0 18px;
  color: var(--muted);
}

.hero-note {
  margin: 0 0 16px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  color: var(--accent);
}

.global-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(12, 14, 8, 0.92);
  box-shadow: 0 14px 30px rgba(6, 8, 4, 0.55);
  animation: fadeUp 0.6s ease-out;
}

.global-nav .nav-brand {
  font-family: var(--font-title);
  font-size: var(--fs-md);
  letter-spacing: 0.08em;
}

.global-nav .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.global-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  color: var(--ink);
  text-decoration: none;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
}

.global-nav .nav-links a + a {
  padding-left: 14px;
}

.global-nav .nav-links a + a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 14px;
  background: rgba(227, 196, 122, 0.4);
}

.global-nav a:hover {
  color: var(--accent);
}

.global-nav .nav-controls {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(12, 14, 8, 0.6);
}

.global-nav .theme-select {
  min-width: 0;
  align-items: center;
}

.global-nav .theme-select select {
  min-width: 120px;
}

@media (max-width: 720px) {
  .global-nav .theme-select {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .global-nav .theme-select select {
    min-width: 90px;
    padding: 8px 8px;
    font-size: var(--fs-sm);
  }
}

.panel {
  padding: 20px 22px 24px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 16px 34px rgba(8, 10, 6, 0.5);
  backdrop-filter: blur(10px);
  animation: fadeUp 0.8s ease-out;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.panel-title {
  display: grid;
  gap: 6px;
}

.weapon-title {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: 0.08em;
}

.panel-head h2 {
  margin: 0;
  font-size: var(--fs-lg);
  letter-spacing: 0.08em;
  font-family: var(--font-title);
}

.panel-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.panel-actions.panel-actions-cta {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(227, 196, 122, 0.18);
}

.panel-actions .note {
  font-weight: 600;
  color: var(--accent);
}

.weapon-meta-sub {
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.06em;
}

.panel-actions.status {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.note {
  font-size: var(--fs-sm);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.action {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 8px 14px;
  background: rgba(214, 181, 109, 0.12);
  color: var(--ink);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.action.action-cta {
  border-radius: 10px;
  padding: 10px 18px;
  background: #0b0b0b;
  border-color: rgba(240, 215, 154, 0.65);
  color: #f7f4ed;
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
  box-shadow: 0 10px 22px rgba(5, 7, 4, 0.55);
}

input,
select,
textarea,
button {
  text-shadow: none;
}

.action:hover {
  border-color: rgba(214, 181, 109, 0.6);
  transform: translateY(-1px);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(80px, 1fr));
  gap: 12px;
}

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.mode-tab {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 6px 14px;
  background: rgba(12, 14, 8, 0.7);
  color: var(--muted);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mode-tab.is-active {
  border-color: rgba(214, 181, 109, 0.7);
  color: var(--accent);
  transform: translateY(-1px);
}

.mode-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
}

.mode-note[hidden] {
  display: none;
}

.mode-row {
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.mode-row[hidden] {
  display: none;
}

.two-hand-row {
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--fs-sm);
  letter-spacing: 0.08em;
  font-weight: 600;
}

.calc-stats .stat {
  align-items: stretch;
  text-align: center;
  gap: 4px;
}

.stat input {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  background: rgba(12, 14, 8, 0.9);
  color: var(--ink);
  font-size: var(--fs-base);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.toggle input {
  accent-color: var(--accent);
}

.select,
.search,
.field {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  color: var(--muted);
}

.select select,
.search input,
.field input {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  background: rgba(12, 14, 8, 0.9);
  color: var(--ink);
  min-width: 180px;
  font-size: var(--fs-md);
}

.search.search-compact {
  letter-spacing: 0.04em;
  gap: 4px;
}

.search.search-compact input {
  min-width: 140px;
  padding: 8px 10px;
  font-size: var(--fs-sm);
}

.calc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.calc-row .select {
  flex: 1 1 160px;
}

.calc-row .select select {
  min-width: 0;
  width: 100%;
}

.spell-picker {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 3.2fr);
  gap: 20px;
}

.spell-picker>* {
  min-width: 0;
}

#spellSelect {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px;
  background: rgba(12, 14, 8, 0.9);
  color: var(--ink);
  width: 100%;
  min-width: 0;
}

.spell-details {
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 16px 18px;
  background: rgba(16, 18, 10, 0.95);
  box-shadow: inset 0 0 0 1px rgba(214, 181, 109, 0.08);
  height: 280px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.spell-title {
  font-size: var(--fs-xl);
  font-family: var(--font-title);
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
}

.spell-sub {
  margin-top: 4px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.spell-summary {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--accent);
}

.spell-req {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--accent);
}

.spell-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-start;
}

.spell-desc {
  margin-top: 10px;
  font-size: var(--fs-sm);
  color: var(--muted);
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
  overflow-wrap: anywhere;
  min-height: 0;
}

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

.build-summary {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: 12px;
}

.build-note {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: 12px;
}

.derived-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.derived-card {
  border-radius: 14px;
  border: 1px solid rgba(214, 181, 109, 0.2);
  background: rgba(12, 14, 8, 0.65);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.derived-label {
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.06em;
}

.derived-value {
  font-size: var(--fs-xl);
  font-family: var(--font-title);
  letter-spacing: 0.06em;
}

.graph-note {
  margin: 0 0 16px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

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

.graph-card {
  border-radius: 16px;
  border: 1px solid rgba(214, 181, 109, 0.2);
  background: rgba(12, 14, 8, 0.7);
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.graph-insight {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.milestone-table {
  border-radius: 12px;
  border: 1px solid rgba(214, 181, 109, 0.2);
  background: rgba(10, 12, 7, 0.5);
  padding: 8px 10px;
  font-size: var(--fs-xxs);
}

.milestone-title {
  font-size: var(--fs-xxs);
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.milestone-table table {
  width: 100%;
  border-collapse: collapse;
}

.milestone-table td {
  padding: 3px 4px;
  text-align: left;
}

.milestone-table td:last-child {
  text-align: right;
  color: var(--ink);
}

.graph-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-md);
  letter-spacing: 0.08em;
  color: var(--ink);
}

.graph-sub {
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.08em;
}

.graph-canvas svg {
  width: 100%;
  height: auto;
  display: block;
}

.graph-canvas {
  position: relative;
}

.graph-bg {
  fill: rgba(8, 9, 5, 0.7);
}

.graph-line {
  fill: none;
  stroke: rgba(227, 196, 122, 0.85);
  stroke-width: 2.2;
}

.graph-axis {
  stroke: rgba(227, 196, 122, 0.2);
  stroke-width: 1;
}

.graph-label {
  font-size: 10px;
  fill: rgba(209, 193, 163, 0.9);
  letter-spacing: 0.02em;
}

.graph-axis-label {
  fill: rgba(209, 193, 163, 0.65);
}

.graph-tooltip {
  position: absolute;
  transform: translate(-50%, -110%);
  pointer-events: none;
  background: rgba(12, 14, 8, 0.92);
  border: 1px solid rgba(214, 181, 109, 0.35);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-xxs);
  color: var(--ink);
  letter-spacing: 0.04em;
  z-index: 1;
  white-space: nowrap;
}

.graph-tooltip-level {
  color: var(--muted);
}

.value-details {
  border-top: 1px solid rgba(214, 181, 109, 0.16);
  padding-top: 10px;
}

.value-details summary {
  cursor: pointer;
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.08em;
  list-style: none;
}

.value-details summary::-webkit-details-marker {
  display: none;
}

.value-table {
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(214, 181, 109, 0.2);
  background: rgba(10, 12, 7, 0.5);
}

.value-table.bonus-table-wrap {
  max-height: none;
  overflow: visible;
}

.value-note {
  margin-top: 8px;
  font-size: var(--fs-xxs);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.value-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-xxs);
}

.value-table th,
.value-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(214, 181, 109, 0.12);
  text-align: center;
}

.value-table th {
  color: var(--muted);
  font-weight: 600;
}

.bonus-table td.spell-cell {
  text-align: left;
}

.bonus-table th:last-child {
  text-align: left;
}

.bonus-table a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(214, 181, 109, 0.6);
  text-underline-offset: 2px;
}

.bonus-table a:hover {
  color: var(--accent);
}

.value-table tr:last-child td {
  border-bottom: none;
}

.build-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(214, 181, 109, 0.16);
}

.build-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  table-layout: fixed;
}

.build-table th,
.build-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(214, 181, 109, 0.12);
  text-align: center;
  vertical-align: top;
}

.build-table th {
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.build-table th span {
  display: block;
  line-height: 1.05;
}

.build-table td {
  font-size: var(--fs-md);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.build-table .num {
  white-space: nowrap;
}

.class-chip {
  border: none;
  background: none;
  color: var(--ink);
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-shadow: inherit;
}

.class-chip:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.rune-tip {
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(214, 181, 109, 0.35);
  background: rgba(12, 14, 8, 0.95);
  color: var(--muted);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  white-space: nowrap;
  display: none;
}

.build-table td:first-child:hover .rune-tip,
.build-table td:first-child:focus-within .rune-tip,
.build-table td.is-open .rune-tip {
  display: inline-block;
}

.build-table .stat-col {
  text-align: right;
  color: var(--accent);
}

.build-table .col-eq {
  width: 8.33%;
}




.build-table tr.is-best {
  background: rgba(134, 202, 160, 0.08);
}

.weapon-overview {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
}

.weapon-subtitle {
  margin: 0 0 2px;
  font-size: var(--fs-md);
  letter-spacing: 0.08em;
  color: var(--muted);
}

.weapon-req-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(80px, 1fr));
  gap: 10px;
}

.weapon-req {
  border-radius: 12px;
  border: 1px solid rgba(214, 181, 109, 0.2);
  background: rgba(12, 14, 8, 0.7);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-sm);
  gap: 8px;
}

.weapon-req-label {
  color: var(--muted);
  letter-spacing: 0.08em;
}

.weapon-req-value {
  font-family: var(--font-title);
  font-size: var(--fs-md);
}

.weapon-affinities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weapon-image {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(214, 181, 109, 0.25);
  background: rgba(12, 14, 8, 0.75);
  padding: 12px;
}

.weapon-scales {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scale-chip {
  border-radius: 999px;
  border: 1px solid rgba(214, 181, 109, 0.35);
  padding: 4px 10px;
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(12, 14, 8, 0.7);
}

.tag {
  border-radius: 999px;
  border: 1px solid rgba(214, 181, 109, 0.35);
  padding: 4px 10px;
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  background: rgba(12, 14, 8, 0.7);
}

.weapon-text-block {
  border-radius: 14px;
  border: 1px solid rgba(214, 181, 109, 0.2);
  background: rgba(12, 14, 8, 0.65);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.weapon-text-block h3 {
  margin: 0 0 6px;
  font-size: var(--fs-sm);
  letter-spacing: 0.08em;
  color: var(--muted);
}

.weapon-text-block p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--ink);
}

.calc-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
}

.calc-grid > * {
  min-width: 0;
}

.calc-top {
  display: grid;
  gap: 8px;
}

.calc-label {
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.08em;
  display: none;
}

.calc-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, 120px);
  gap: 8px;
  align-items: end;
}

.calc-top-row .calc-stats {
  min-width: 0;
}

.calc-top-row .select {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-top-row .select select {
  min-width: 0;
  padding: 8px 6px;
  font-size: var(--fs-sm);
  height: 36px;
}

.calc-top-toggle {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 12px;
  margin-top: 4px;
}

.calc-top-toggle .toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--fs-xs);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(214, 181, 109, 0.2);
  background: rgba(10, 12, 7, 0.35);
}

.calc-top-toggle .toggle input {
  accent-color: var(--accent);
}

.calc-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 12px;
}

.calc-main,
.calc-sub {
  display: grid;
  gap: 12px;
}

.calc-inputs {
  display: grid;
  gap: 16px;
  align-content: start;
}

.calc-block {
  display: grid;
  gap: 0;
}

.calc-block .weapon-subtitle {
  margin: 0 0 2px;
}

.calc-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(56px, 1fr));
  gap: 6px;
  min-width: 0;
  flex: 1 1 420px;
}

.calc-stats .stat input {
  padding: 8px 6px;
  font-size: var(--fs-sm);
  width: 100%;
  text-align: center;
}

.calc-stats .stat input::placeholder {
  color: var(--muted);
  opacity: 0.55;
}

.calc-stats .stat span {
  font-size: var(--fs-xs);
  line-height: 1.1;
}

.calc-stats .stat {
  align-items: stretch;
  text-align: center;
  gap: 4px;
}

.stepper-inline {
  position: relative;
  width: 100%;
}

.stepper-inline input {
  padding-left: 28px;
  padding-right: 28px;
  text-align: center;
  -moz-appearance: textfield;
  height: 36px;
}

.stepper-inline input::-webkit-outer-spin-button,
.stepper-inline input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper-inline-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(214, 181, 109, 0.35);
  background: rgba(12, 14, 8, 0.7);
  color: var(--accent);
  font-size: var(--fs-sm);
  padding: 0;
  cursor: pointer;
}

.stepper-inline-btn[data-step="-1"] {
  left: 4px;
}

.stepper-inline-btn[data-step="1"] {
  right: 4px;
}

.calc-stats .toggle {
  justify-content: center;
  gap: 6px;
  font-size: var(--fs-xxs);
  color: var(--muted);
}

.calc-stats .toggle input {
  transform: scale(1.3);
}

.toggle-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.toggle-cell > span {
  display: inline;
}

.toggle-cell .toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 0;
}

.toggle-cell .toggle span {
  display: none;
}

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

.calc-output {
  display: grid;
  gap: 12px;
}

.calc-toggle {
  display: flex;
  justify-content: flex-end;
}

.calc-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px 10px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.calc-values span {
  text-align: center;
  display: grid;
  gap: 4px;
  justify-items: center;
  line-height: 1.2;
}

.calc-values .calc-label-text {
  font-size: var(--fs-xxs);
  letter-spacing: 0.08em;
}

.derived-card {
  text-align: center;
}

.calc-values strong {
  color: var(--ink);
  font-weight: 600;
  font-size: var(--fs-md);
  white-space: pre-line;
}

.calc-values strong[data-grade]::before {
  content: attr(data-grade);
  display: block;
  font-size: var(--fs-sm);
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 600;
  opacity: 0.9;
}

.calc-values strong[data-grade] {
  color: var(--ink);
  font-size: var(--fs-xs);
  opacity: 0.9;
}

@media (min-width: 860px) {
  .calc-values {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

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

.calc-main,
.calc-sub {
  display: grid;
  gap: 12px;
}

.calc-panels .derived-card,
.calc-panels .weapon-text-block {
  min-height: 140px;
}

.calc-panels .weapon-text-block {
  margin-bottom: 0;
}


.affinity-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(214, 181, 109, 0.16);
}

.affinity-filter {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 8px 4px 0;
  flex-wrap: wrap;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  border: 1px solid rgba(214, 181, 109, 0.3);
  background: transparent;
  color: rgba(238, 225, 197, 0.9);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: var(--fs-xxs);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.filter-btn.is-active {
  background: rgba(214, 181, 109, 0.2);
  border-color: rgba(214, 181, 109, 0.6);
}

.filter-btn-secondary {
  border-style: dashed;
}

.affinity-table.hide-empty .empty-col {
  display: none;
}

.affinity-table.hide-empty {
  min-width: 0;
  table-layout: auto;
}

.affinity-table-wrap.no-scroll {
  overflow-x: visible;
}

.affinity-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  font-size: var(--fs-xxs);
}

.affinity-table th,
.affinity-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(214, 181, 109, 0.12);
  text-align: center;
}

.affinity-table th {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  font-size: var(--fs-xxs);
}

.affinity-table td.affinity-name {
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.translation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.list-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(214, 181, 109, 0.25);
  background: rgba(10, 12, 7, 0.35);
}

.weapon-list-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: var(--fs-xs);
  table-layout: fixed;
}

.weapon-list-table th,
.weapon-list-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(214, 181, 109, 0.18);
  text-align: left;
  vertical-align: middle;
}

.weapon-list-table th {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  background: rgba(12, 14, 8, 0.85);
}

.weapon-list-table th.th-sort {
  cursor: pointer;
  user-select: none;
}

.weapon-list-table .sort-indicator {
  font-size: var(--fs-xxs);
  color: var(--accent);
  margin-left: 6px;
}

.weapon-list-table td.num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.weapon-list-table:not(.weapon-calculator-table) th:first-child,
.weapon-list-table:not(.weapon-calculator-table) td:first-child {
  width: 26%;
}

.weapon-list-table:not(.weapon-calculator-table) th:nth-child(2),
.weapon-list-table:not(.weapon-calculator-table) td:nth-child(2),
.weapon-list-table:not(.weapon-calculator-table) th:nth-child(5),
.weapon-list-table:not(.weapon-calculator-table) td:nth-child(5) {
  width: 12%;
}

.weapon-list-table:not(.weapon-calculator-table) th:nth-child(3),
.weapon-list-table:not(.weapon-calculator-table) td:nth-child(3),
.weapon-list-table:not(.weapon-calculator-table) th:nth-child(4),
.weapon-list-table:not(.weapon-calculator-table) td:nth-child(4) {
  width: 25%;
}

.weapon-list-table th + th,
.weapon-list-table td + td {
  border-left: 1px solid rgba(214, 181, 109, 0.1);
}

.weapon-cell {
  min-width: 0;
}

.weapon-calculator-table {
  table-layout: fixed;
  width: max-content;
  min-width: 720px;
}

.weapon-calculator-table th,
.weapon-calculator-table td {
  text-align: center;
}

.weapon-calculator-table th[data-column="name"],
.weapon-calculator-table td[data-column="name"] {
  text-align: left;
}

.weapon-calculator-table th.th-sort {
  cursor: pointer;
}

.weapon-calculator-table th[data-column="name"],
.weapon-calculator-table td[data-column="name"] {
  width: 220px;
}

.weapon-calculator-table th[data-column="type"],
.weapon-calculator-table td[data-column="type"],
.weapon-calculator-table th[data-column="affinity"],
.weapon-calculator-table td[data-column="affinity"] {
  width: 80px;
}

.weapon-calculator-table th[data-column="total"],
.weapon-calculator-table td[data-column="total"] {
  width: 72px;
}

.weapon-calculator-table td.num {
  width: 60px;
}

.weapon-calculator-table .weapon-cell-inner {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.weapon-calculator-table .weapon-cell a {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weapon-calculator-table .affinity-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(214, 181, 109, 0.35);
  font-size: var(--fs-xxs);
  letter-spacing: 0.06em;
  color: var(--accent);
  white-space: nowrap;
  flex: 0 0 auto;
}

.weapon-cell-inner {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.weapon-cell img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid rgba(214, 181, 109, 0.2);
  background: rgba(12, 14, 8, 0.7);
}

.weapon-cell a {
  color: var(--ink);
  display: block;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  opacity: 1;
  visibility: visible;
}

.weapon-cell a:hover {
  color: var(--accent);
}

.weapon-list-table td.req-cell,
.weapon-list-table td.scale-cell {
  font-size: var(--fs-xxs);
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
}

.list-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.list-filter .filter-label {
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.08em;
}

.list-filter-input {
  align-items: center;
  gap: 10px;
}

.filter-input {
  width: 90px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 6px 8px;
  background: rgba(12, 14, 8, 0.9);
  color: var(--ink);
  font-size: var(--fs-sm);
}

.weapon-list-table .stat-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-right: 6px;
  min-width: 26px;
}

.weapon-list-table .stat-stack:last-child {
  margin-right: 0;
}

.weapon-list-table .stat-label {
  font-size: var(--fs-xxs);
  color: var(--muted);
}

.weapon-list-table .stat-value {
  font-size: var(--fs-xs);
  color: var(--ink);
  font-weight: 600;
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
  }

.link-grid .action {
    font-weight: 500;
  }

.panel-subhead {
    margin: 16px 0 8px;
    font-size: var(--fs-sm);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

.weapon-type-grid .action {
    background: rgba(214, 181, 109, 0.28);
    border-color: rgba(214, 181, 109, 0.5);
    color: var(--text);
    font-size: var(--fs-sm);
    font-weight: 600;
    padding: 9px 12px;
  }

.weapon-type-link {
    text-decoration: underline;
    text-underline-offset: 2px;
  }

.weapon-type-link:hover {
    color: var(--accent);
  }

.weapon-calculator {
    display: grid;
    gap: 16px;
  }

.text-search-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.text-search-theme {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.text-search-theme-label {
  font-size: var(--fs-xxs);
  color: var(--muted);
  letter-spacing: 0.08em;
}

.text-search-theme-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.text-search-theme-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(12, 14, 8, 0.55);
  color: var(--text);
  font-size: var(--fs-xxs);
  cursor: pointer;
}

.text-search-theme-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.text-search-top {
  position: fixed;
  right: 22px;
  bottom: 140px;
  z-index: 100000;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: #ffffff;
  color: #1b1b1b;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.text-search-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}

@media screen and (max-width: 599px) {
  .text-search-top {
    right: 12px;
    bottom: 110px;
  }
}

.text-search-page.theme-light {
  color-scheme: light;
  --bg-0: #f7f5ef;
  --bg-1: #ffffff;
  --bg-2: #f1ede4;
  --panel: rgba(255, 255, 255, 0.92);
  --border: rgba(120, 96, 48, 0.25);
  --ink: #1c1b18;
  --muted: #5d564b;
  --accent: #9b6a2c;
  --accent-soft: rgba(155, 106, 44, 0.2);
  --shadow: rgba(0, 0, 0, 0.08);
  --text-outline: none;
  --text-shadow: none;
}

.text-search-page.theme-dark {
  color-scheme: dark;
  --bg-0: #0b0b0b;
  --bg-1: #111111;
  --bg-2: #171717;
  --panel: rgba(16, 16, 16, 0.94);
  --border: rgba(200, 200, 200, 0.2);
  --ink: #f3f3f3;
  --muted: #bcbcbc;
  --accent: #d3b36f;
  --accent-soft: rgba(211, 179, 111, 0.22);
  --shadow: rgba(0, 0, 0, 0.75);
  --text-outline: none;
  --text-shadow: none;
}

.text-search-page.theme-light .text-result {
  background: #ffffff;
}

.text-search-page.theme-light .panel {
  background: #ffffff;
}

.text-search-page.theme-light .text-compare {
  border-top: 1px solid rgba(120, 96, 48, 0.25);
}

.text-search-page.theme-light .text-result-compare {
  background: #1b1b1b;
  color: #ffffff;
}

.text-search-tab {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(12, 14, 8, 0.6);
  color: var(--muted);
  font-size: var(--fs-xxs);
  letter-spacing: 0.06em;
  padding: 6px 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.text-search-tab:hover {
  color: var(--text);
  border-color: rgba(214, 181, 109, 0.6);
}

.text-search-tab.is-active {
  background: #0b0b0b;
  color: var(--ink);
  border-color: rgba(214, 181, 109, 0.65);
}

.text-search-tab:focus-visible {
  outline: 2px solid rgba(214, 181, 109, 0.7);
  outline-offset: 2px;
}

.text-search-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.text-search-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.text-result {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  background: rgba(12, 14, 8, 0.65);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.text-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-xs);
  color: var(--text);
  letter-spacing: 0.02em;
}

.text-result-compare {
  border-radius: 999px;
  border: 1px solid rgba(214, 181, 109, 0.75);
  background: #0b0b0b;
  color: #f7f4ed;
  font-size: var(--fs-xxs);
  padding: 4px 10px;
  cursor: pointer;
}

.text-result-compare:disabled {
  opacity: 0.6;
  cursor: wait;
}

.text-compare {
  margin-top: 12px;
  border-top: 1px solid rgba(214, 181, 109, 0.35);
  border-radius: 0;
  background: transparent;
  padding: 12px 0 0;
  color: var(--ink);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.text-compare-title {
  margin-top: 0;
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.text-compare-body {
  margin-top: 6px;
  white-space: pre-wrap;
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.text-result-cat {
  font-weight: 600;
  color: var(--muted);
  font-size: var(--fs-xxs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  order: 2;
}

.text-result-id {
  font-weight: 600;
  color: var(--ink);
  order: 1;
}

.text-result-tag {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 2px 6px;
  font-size: 10px;
  color: var(--accent);
}

.text-result-body summary {
  cursor: pointer;
  color: var(--ink);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.text-result-body summary::-webkit-details-marker {
  display: none;
}

.text-result-full {
  margin-top: 8px;
  color: var(--ink);
  font-size: var(--fs-sm);
  line-height: 1.6;
  white-space: pre-wrap;
}

.calculator-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
  }

.calculator-toolbar .select {
    min-width: 160px;
  }

.filter-stack {
    display: grid;
    gap: 8px;
  }

.filter-stack .filter-buttons {
    gap: 10px;
  }

.results-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: var(--fs-xs);
    color: var(--muted);
  }

.weapon-calculator-table th,
.weapon-calculator-table td {
    white-space: nowrap;
  }

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: var(--fs-xs);
    color: var(--muted);
    margin: 12px 0 18px;
  }

.breadcrumb a {
    color: var(--muted);
    text-decoration: none;
  }

.breadcrumb a:hover {
    color: var(--accent);
  }

.breadcrumb span[aria-current="page"] {
    color: var(--text);
    font-weight: 600;
  }
.lang-card {
  border-radius: 12px;
  border: 1px solid rgba(214, 181, 109, 0.2);
  background: rgba(10, 12, 7, 0.6);
  padding: 10px 12px;
  font-size: var(--fs-sm);
}

.lang-card p {
  margin: 0;
  color: var(--muted);
}

.lang-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(214, 181, 109, 0.35);
  font-size: var(--fs-xxs);
  letter-spacing: 0.08em;
  color: var(--accent);
}

.list-panel {
  border-radius: 16px;
  border: 1px solid rgba(214, 181, 109, 0.2);
  padding: 12px 14px 14px;
  background: rgba(12, 14, 8, 0.7);
  min-height: 260px;
}

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

.list-head h3 {
  margin: 0;
  font-size: var(--fs-md);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.list-head span {
  font-size: var(--fs-xs);
  color: var(--accent);
}

.list-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 6px;
}

.spell-entry {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(214, 181, 109, 0.22);
  background: rgba(14, 16, 9, 0.9);
  color: var(--ink);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.spell-entry:hover {
  border-color: rgba(214, 181, 109, 0.5);
  transform: translateY(-1px);
}

.spell-entry strong {
  display: block;
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
}

.spell-entry span {
  display: block;
  margin-top: 4px;
  font-size: var(--fs-xxs);
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-xxs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.status-met {
  background: rgba(134, 202, 160, 0.15);
  color: var(--ok);
  border-color: rgba(134, 202, 160, 0.4);
}

.status-met-two {
  background: rgba(224, 185, 120, 0.18);
  color: var(--warn);
  border-color: rgba(224, 185, 120, 0.4);
}

.status-missing {
  background: rgba(216, 116, 98, 0.18);
  color: var(--bad);
  border-color: rgba(216, 116, 98, 0.4);
}

.ad-panel {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ad-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
}

.ad-inline-sp {
  display: none;
}

#creative {
  pointer-events: none !important;
}

#creative a,
#creative a * {
  pointer-events: auto !important;
}

#creative a {
  position: relative;
  z-index: 1;
}

.ad-layer {
  position: relative;
  z-index: 2;
}

.ad-video {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 4;
  display: none;
}

.ad-sidebar {
  width: 300px;
  position: fixed;
  top: 100px;
  bottom: 20px;
  z-index: 10;
  display: none;
  /* Hidden by default, shown in media query */
  pointer-events: none;
  /* Allow click-through on transparent areas */
}

/* Re-enable pointer events for actual content inside sidebar */
.ad-sidebar>* {
  pointer-events: auto;
}

.ad-sidebar.ad-left {
  left: 16px !important;
  right: auto !important;
}

.ad-sidebar.ad-right {
  right: 16px !important;
  left: auto !important;
}

/* Override Bance ad inline positioning */
.ad-sidebar.ad-left #floating_left,
.ad-sidebar.ad-left [id^="floating_"] {
  left: 0 !important;
  right: auto !important;
  position: relative !important;
}

.ad-sidebar.ad-right #floating_right,
.ad-sidebar.ad-right [id^="floating_"] {
  right: 0 !important;
  left: auto !important;
  position: relative !important;
}

.ad-overlay {
  display: none;
}

.footer-menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(12, 14, 8, 0.7);
}

.footer-menu .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-menu a {
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
}

.footer-menu a:hover {
  color: var(--accent);
}

.foot {
  display: none;
}

.tool-index .action {
  background: #0b0b0b;
  border-color: rgba(240, 215, 154, 0.6);
  color: #f7f4ed;
}

.tool-index .action:hover {
  border-color: rgba(240, 215, 154, 0.9);
  transform: translateY(-1px);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .stat-grid {
    grid-template-columns: repeat(4, minmax(80px, 1fr));
  }

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

  .calc-panels {
    grid-template-columns: 1fr;
  }

  .calc-top-row {
    grid-template-columns: 1fr;
  }

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

  .weapon-req-grid {
    grid-template-columns: repeat(3, minmax(80px, 1fr));
  }

  .spell-picker {
    grid-template-columns: 1fr;
  }

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

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

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

@media (max-width: 820px) {
  .calc-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 32px 16px 60px;
  }

  .global-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .global-nav .nav-links {
    width: 100%;
  }

  .global-nav .nav-controls {
    width: 100%;
  }

  .global-nav .theme-select {
    flex: 1 1 0;
  }

  .global-nav .nav-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
  }

  .global-nav .theme-select span {
    white-space: nowrap;
  }

  .global-nav .theme-select select {
    width: 100%;
  }

  .footer-menu {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }

  .weapon-req-grid {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }

  .hero-meta {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .build-table-wrap {
    text-align: left;
  }

  .build-table {
    display: inline-table;
    width: max-content;
    min-width: 0;
  }

  .build-table th,
  .build-table td {
    padding: 6px 8px;
  }

  .weapon-calculator-table th[data-column="name"],
  .weapon-calculator-table td[data-column="name"] {
    width: 160px;
  }

  .weapon-calculator-table th[data-column="type"],
  .weapon-calculator-table td[data-column="type"] {
    width: 70px;
  }

  .weapon-calculator-table th[data-column="total"],
  .weapon-calculator-table td[data-column="total"] {
    width: 64px;
  }

  .weapon-calculator-table td.num {
    width: 52px;
  }

  .weapon-calculator-table .weapon-cell a {
    max-width: 150px;
  }
}

@media (max-width: 420px) {
  .calc-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stepper-inline input {
    padding-left: 24px;
    padding-right: 24px;
  }

  .stepper-inline-btn {
    width: 20px;
    height: 20px;
    font-size: var(--fs-xs);
  }
}

@media (max-width: 600px) {
  .ad-inline-sp {
    display: flex;
  }

  .ad-inline-pc {
    display: none;
  }

  .ad-overlay {
    display: block;
  }
}

@media (min-width: 601px) {
  .ad-inline-pc {
    display: flex;
  }
}

@media (min-width: 1100px) {
  .ad-video {
    display: block;
  }
}

@media (min-width: 1200px) {
  .page {
    padding-left: 320px;
  }

  .shell {
    max-width: calc(100vw - 320px - 48px);
  }
}

@media (min-width: 1400px) {

  /* Show ads and adjust layout */
  .ad-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 300px;
  }

  .ad-sidebar.ad-left {
    align-items: flex-start;
  }

  .ad-sidebar.ad-right {
    align-items: flex-end;
  }

  /* Shrink shell to fit between sidebars */
  .shell {
    max-width: calc(100vw - 640px - 48px);
    /* 300*2 + gaps */
  }

  /* Ensure page has padding to avoid visual clash if shell is wide */
  .page {
    padding-left: 320px;
    padding-right: 320px;
  }
}

@media (min-width: 1960px) {

  /* On very large screens, cap the shell width back to original 1280px */
  .shell {
    max-width: 1280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
