:root {
  color-scheme: light;
  --ink: #1f2922;
  --muted: #66736c;
  --line: #dce4dd;
  --paper: #f6f8f5;
  --panel: #ffffff;
  --green: #2f7d5a;
  --gold: #c9952d;
  --red: #c94b3d;
  --blue: #2d628c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.label {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.compare-page {
  background: var(--paper);
}

.compare-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 56px auto;
}

.compare-header {
  max-width: 760px;
  margin-bottom: 28px;
}

.compare-header h1,
.dash-header h1,
.adventure-hero h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.05;
}

.compare-header p:last-child,
.adventure-hero p,
.tool-cards p {
  color: var(--muted);
  line-height: 1.8;
}

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

.compare-card {
  display: grid;
  gap: 12px;
  min-height: 260px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 44px rgba(32, 43, 36, 0.1);
}

.compare-card:hover {
  border-color: rgba(47, 125, 90, 0.45);
}

.version {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-weight: 900;
}

.compare-card h2,
.dash-panel h2,
.tool-cards h2,
.source-gallery h2 {
  margin: 0;
}

.compare-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.compare-card strong {
  align-self: end;
  color: var(--green);
}

.dashboard-version {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  background: #eef3ef;
}

.side-nav {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #1f2b24;
  color: white;
}

.side-logo {
  display: flex;
  align-items: center;
  width: max-content;
  gap: 5px;
  margin-bottom: 22px;
}

.site-logo-mark {
  display: block;
  flex: 0 0 auto;
  width: 42px;
  height: auto;
  filter: drop-shadow(0 2px 2px rgba(22, 16, 10, 0.42));
}

.side-logo-text {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.side-logo-main,
.side-logo-sub {
  display: block;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.side-logo-main {
  color: #f7fbf8;
  font-size: 28px;
}

.side-logo-sub {
  color: #d9c27a;
  font-size: 18px;
}

.side-nav nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(5px, 1.15vh, 12px);
  min-height: 0;
}

.side-nav-inline {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) auto minmax(0, 1.35fr);
  align-items: center;
  gap: 2px;
}

.side-nav-inline > span {
  color: #bfae93;
  font-weight: 800;
}

.side-nav .side-nav-inline > a {
  min-width: 0;
  padding-right: 3px;
  padding-left: 3px;
  text-align: center;
  white-space: nowrap;
}

.side-nav-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(191, 174, 147, 0.32);
}

.side-nav-pair > span {
  color: #bfae93;
  font-weight: 800;
}

.side-nav .side-nav-pair > a {
  min-width: 0;
  padding: 6px 3px;
  font-size: 16px;
  text-align: center;
  white-space: nowrap;
}

.external-link-mark {
  margin-left: 2px;
  font-size: .78em;
}

.side-nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: #cbd9d0;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.side-nav a.active,
.side-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.side-nav a:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.72);
  outline-offset: 3px;
}

@media (min-width: 901px) and (max-height: 760px) {
  .side-nav {
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .side-logo {
    margin-bottom: 12px;
  }

  .site-logo-mark {
    width: 38px;
  }

  .side-nav nav {
    gap: 5px;
  }

  .side-nav a {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .side-nav-pair {
    margin-top: 2px;
    padding-top: 7px;
  }
}

@media (min-width: 901px) and (max-height: 620px) {
  .side-nav nav {
    justify-content: flex-start;
  }
}

.dash-main {
  width: min(1120px, calc(100% - 40px));
  margin: 32px auto;
}

.dash-header,
.panel-title,
.adventure-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.dash-header {
  align-items: flex-start;
}

.dash-header > div {
  min-width: 0;
}

.header-server {
  white-space: nowrap;
}

.site-disclaimer {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.breadcrumbs a {
  color: var(--green);
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

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

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  margin-top: 24px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer a {
  color: var(--green);
  font-weight: 800;
}

.ghost-link,
.primary-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 800;
}

.ghost-link {
  border: 1px solid var(--line);
  background: white;
}

.dash-metrics,
.dash-grid,
.tool-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.dash-view {
  display: none;
}

.dash-view.active {
  display: block;
}

[data-view-panel="instances"],
[data-view-panel="runes"],
[data-view-panel="relics"] {
  margin-top: 24px;
}

.dash-metrics article,
.dash-panel,
.tool-cards article,
.hero-card,
.source-gallery {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.dash-metrics article {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.dash-metrics span,
.dash-metrics small,
.result-row span {
  color: var(--muted);
  font-size: 13px;
}

.dash-metrics strong {
  font-size: 26px;
}

.dash-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
  scroll-margin-top: 32px;
}

.dash-panel[hidden] {
  display: none;
}

.dash-panel.wide {
  grid-column: span 2;
}

.dash-panel.full {
  grid-column: 1 / -1;
}

.dash-header .equipment-data-tabs {
  margin-top: 16px;
}

#equipment-data-tabs[hidden] {
  display: none;
}

.dash-header.equipment-data-header #current-page-title {
  margin-top: 16px;
}

.sticky-filter-panel {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.pill {
  padding: 6px 10px;
  border-radius: 8px;
  background: #e7f1eb;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 8px;
  background: #e7f1eb;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.back-to-top {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(36, 118, 82, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--green);
  font: inherit;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(32, 43, 36, 0.12);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.back-to-top.visible {
  opacity: 0.82;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: white;
  opacity: 1;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font: inherit;
}

.field-note {
  display: inline;
  margin-left: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

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

.result-row div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 8px;
  background: #f5f8f5;
}

.result-row strong {
  font-size: 20px;
}

.plain-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 2;
}

.wide-input {
  margin-bottom: 4px;
}

.mini-item {
  padding: 12px;
  border-radius: 8px;
  background: #f5f8f5;
  color: var(--muted);
}

.empty-state {
  display: grid;
  gap: 8px;
  min-height: 140px;
  padding: 18px;
  border: 1px dashed #b9c7bd;
  border-radius: 8px;
  background: #fbfcfb;
  align-content: center;
}

.empty-state strong {
  font-size: 22px;
}

.empty-state p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.site-log-list {
  display: grid;
  gap: 14px;
}

.site-log-item {
  display: grid;
  grid-template-columns: minmax(116px, 0.22fr) 1fr;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.site-log-date {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
}

.site-log-date strong {
  color: var(--ink);
  font-size: 1rem;
}

.site-log-date span {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.site-log-body {
  min-width: 0;
}

.site-log-body h3 {
  margin: 0 0 8px;
  font-size: 1.04rem;
}

.site-log-body p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.7;
}

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

.data-toolbar.relic-toolbar {
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
}

.data-toolbar.star-toolbar {
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
}

.data-toolbar.monster-toolbar {
  grid-template-columns: repeat(4, minmax(140px, 1fr)) minmax(220px, 1.6fr);
}

.monster-filter-bar {
  grid-template-columns: minmax(220px, 0.8fr) repeat(2, minmax(0, 1fr));
  align-items: start;
}

.rune-cost-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.rune-cost-summary {
  margin-top: 0;
}

.view-toggle {
  display: inline-flex;
  gap: 4px;
  width: fit-content;
  padding: 4px;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6faf7;
}

.view-toggle button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.view-toggle button.active,
.view-toggle button:hover,
.view-toggle button:focus-visible {
  background: #dfeee6;
  color: var(--green);
  outline: none;
}

.rune-filter-panel {
  grid-template-columns: 1fr;
  gap: 8px;
}

.rune-filter-panel .view-toggle {
  margin: 0;
}

.rune-filter-panel .dense-form {
  grid-template-columns: 1fr;
}

.rune-filter-panel input {
  font-size: 14px;
}

.rune-mode-panel {
  display: none;
}

.rune-mode-panel.active {
  display: block;
}

.rune-gallery.rune-mode-panel.active {
  display: grid;
}

.rune-gallery {
  grid-template-columns: minmax(260px, 34%) minmax(0, 1fr);
  gap: 14px;
  min-height: 560px;
}

.rune-gallery-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 680px;
  overflow: auto;
  padding: 2px 6px 2px 2px;
}

.rune-book-group {
  display: grid;
  gap: 6px;
}

.rune-book-group-head {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid rgba(36, 118, 82, 0.25);
  border-radius: 8px;
  background: #eaf5ef;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.rune-book-group-head span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: white;
  color: var(--green);
  font-weight: 900;
}

.rune-book-group-head strong {
  overflow-wrap: anywhere;
}

.rune-book-group-head small {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.rune-book-group-items {
  display: grid;
  gap: 6px;
  margin-left: 16px;
  padding-left: 12px;
  border-left: 2px solid #d7e9df;
}

.rune-book-group-items.collapsed {
  display: none;
}

.rune-book-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 64px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.rune-book-row:hover,
.rune-book-row:focus-visible,
.rune-book-row.active {
  border-color: rgba(36, 118, 82, 0.55);
  background: #eaf5ef;
  outline: none;
}

.rune-book-row strong,
.rune-fragment-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.rune-book-row small,
.rune-fragment-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.rune-book-thumb,
.rune-fragment-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #b9d9e8;
  border-radius: 8px;
  background: linear-gradient(145deg, #f7fcff, #e2eff7);
  color: #3d78a3;
  font-weight: 800;
}

.rune-book-thumb img,
.rune-fragment-icon img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.rune-gallery-detail {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdfc, #f2f7f5);
}

.rune-book-header {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  text-align: center;
}

.rune-book-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
}

.rune-book-header p {
  margin: 0;
  color: var(--muted);
}

.rune-fragment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.rune-fragment-focus {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 92px;
  padding: 16px;
  border: 1px solid #cfe3ef;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: inset 0 0 0 2px rgba(185, 217, 232, 0.28);
}

.rune-fragment-focus .rune-fragment-icon {
  width: 58px;
  height: 58px;
  font-size: 18px;
}

.rune-fragment-focus strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.rune-fragment-focus small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.rune-fragment-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.rune-book-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.rune-book-meta section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.rune-book-meta h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
}

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

.mini-list span {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f0f6f2;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.relic-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.relic-category-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rune-tab-cards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.rune-tab-cards .instance-card {
  flex: 0 0 auto;
  min-width: 46px;
  min-height: 34px;
  padding: 7px 12px;
  place-content: center;
  text-align: center;
}

.rune-tab-cards .instance-card span,
.rune-tab-cards .instance-check {
  display: none;
}

.rune-tab-cards .instance-card strong {
  font-size: 14px;
  line-height: 1;
}

#instance-cards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

#instance-cards .instance-card {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  gap: 8px;
}

#instance-cards .instance-card span,
#instance-cards .instance-check {
  display: none;
}

#instance-cards .instance-card em,
#instance-cards .instance-card strong {
  line-height: 1;
}

#instance-cards .instance-card em {
  font-size: 15px;
}

#instance-cards .instance-card strong {
  font-size: 17px;
}

#star-category-cards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

#star-category-cards .instance-card {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
  place-content: center;
  text-align: center;
}

#star-category-cards .instance-card span,
#star-category-cards .instance-check {
  display: none;
}

#star-category-cards .instance-card strong {
  font-size: 17px;
  line-height: 1;
}

#vesper-category-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#vesper-category-cards .instance-card {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 8px 12px;
}

#vesper-category-cards .instance-card span,
#vesper-category-cards .instance-check {
  display: none;
}

#vesper-category-cards .instance-card strong {
  font-size: 14px;
  line-height: 1;
}

#relic-category-cards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

#relic-category-cards .instance-card {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px;
  place-content: center;
  text-align: center;
}

#relic-category-cards .instance-card span,
#relic-category-cards .instance-check {
  display: none;
}

#relic-category-cards .instance-card strong {
  font-size: 14px;
  line-height: 1;
}

.relic-list {
  display: grid;
  gap: 14px;
}

.relic-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.relic-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.relic-card h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 20px;
}

.relic-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.relic-type,
.relic-npc-icon {
  display: grid;
  place-items: center;
  min-width: 42px;
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 8px;
  background: #e7f4ed;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.relic-exchange {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: #f5f8f5;
}

.relic-exchange strong,
.relic-requirement strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.relic-exchange small,
.relic-requirement small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.relic-requirements {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

.relic-requirement {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 50px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.relic-requirement img,
.relic-monster-placeholder {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.relic-monster-placeholder {
  border-radius: 8px;
  background: #eef3ef;
}

.instance-card {
  display: grid;
  gap: 5px;
  position: relative;
  min-height: 98px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f5;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.instance-card:hover,
.instance-card:focus-visible {
  border-color: rgba(36, 118, 82, 0.5);
  background: #eef6f0;
  box-shadow: 0 8px 22px rgba(35, 58, 46, 0.08);
  outline: none;
}

.instance-card.selected {
  border-color: var(--green);
  background: #e7f4ed;
  box-shadow: inset 0 0 0 2px rgba(36, 118, 82, 0.22);
}

.instance-card.selected strong {
  color: var(--green);
}

.instance-check {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
}

.instance-card.selected .instance-check {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.instance-card em {
  color: var(--green);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.relic-cards article {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f5;
}

.instance-card span,
.instance-card small,
.relic-cards span,
.relic-cards small,
.data-table small {
  color: var(--muted);
  font-size: 12px;
}

.inline-detail-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.inline-detail-list li {
  position: relative;
  padding-left: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.inline-detail-list li::before {
  content: "";
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--green);
}

.relic-cards strong {
  font-size: 20px;
}

.relic-cards p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.source-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

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

.source-check-grid article {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f5;
}

.source-check-grid span {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 8px;
  background: #f0ead9;
  color: #8a641c;
  font-size: 12px;
  font-weight: 900;
}

.source-check-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.source-check-grid a {
  width: fit-content;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.monster-table-wrap {
  display: none;
}

.filter-field {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}

.filter-field legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  cursor: pointer;
}

.check-chip.all-chip {
  font: inherit;
  font-weight: 900;
}

.check-chip input {
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.check-chip.selected {
  border-color: rgba(36, 118, 82, 0.55);
  background: #e7f4ed;
  color: var(--green);
  font-weight: 800;
}

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

.monster-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 16px 0 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.monster-pagination button {
  min-width: 96px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid rgba(36, 118, 82, 0.22);
  border-radius: 8px;
  background: #edf5f0;
  color: var(--green);
  font: inherit;
  cursor: pointer;
}

.monster-pagination button:hover:not(:disabled),
.monster-pagination button:focus-visible {
  border-color: rgba(36, 118, 82, 0.55);
  background: #dceee5;
  outline: none;
}

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

.monster-card {
  position: relative;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.monster-card-head {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-right: 52px;
}

.monster-card-head strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  overflow-wrap: anywhere;
}

.monster-card-head small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.monster-card-image {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.monster-card-image.placeholder {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef3ef;
}

.monster-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.monster-tags span {
  padding: 5px 8px;
  border-radius: 6px;
  background: #edf5f0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

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

.monster-accuracy-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: -4px;
}

.monster-stats div {
  padding: 8px;
  border-radius: 8px;
  background: #f5f8f5;
}

.monster-stats dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.monster-stats dd {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.monster-drops {
  align-content: start;
}

.monster-locations {
  position: absolute;
  top: 12px;
  right: 12px;
  width: fit-content;
  min-width: 0;
}

.monster-location-trigger,
.monster-locations.empty {
  display: inline-grid;
  grid-template-columns: 28px auto;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 4px 8px 4px 4px;
  border: 1px solid rgba(36, 118, 82, 0.2);
  border-radius: 8px;
  background: #f2f7f4;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.monster-location-trigger {
  cursor: pointer;
}

.monster-location-trigger img,
.monster-locations.empty img {
  width: 28px;
  height: 28px;
}

.monster-location-trigger:hover,
.monster-location-trigger:focus-visible {
  border-color: rgba(36, 118, 82, 0.55);
  background: #e2f0e8;
  outline: none;
}

.monster-location-popover {
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: calc(100% + 8px);
  display: none;
  width: min(260px, 78vw);
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(36, 118, 82, 0.22);
  border-radius: 8px;
  background: white;
  box-shadow: 0 16px 36px rgba(24, 43, 32, 0.16);
}

.monster-locations:hover .monster-location-popover,
.monster-locations:focus-within .monster-location-popover {
  display: grid;
  gap: 6px;
}

.monster-location-popover strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.monster-location-popover button {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: #f2f6f3;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.monster-location-popover button:hover,
.monster-location-popover button:focus-visible {
  background: #dceee5;
  outline: none;
}

.monster-location-popover small,
.monster-location-popover em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.monster-map-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.monster-map-filter span {
  padding: 7px 10px;
  border-radius: 8px;
  background: #e7f4ed;
}

.monster-map-filter button {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(36, 118, 82, 0.22);
  border-radius: 8px;
  background: white;
  color: var(--green);
  font: inherit;
  cursor: pointer;
}

.monster-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.monster-chip {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.monster-avatar {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.monster-avatar.placeholder {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef3ef;
  color: var(--muted);
  font-weight: 900;
}

.monster-identity {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.equipment-identity {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 210px;
}

.equipment-thumb {
  display: grid;
  place-items: center;
  width: 56px;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf7;
}

.equipment-thumb img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.equipment-thumb.star-thumb {
  width: 76px;
  height: 76px;
  border-color: transparent;
  background: transparent;
  overflow: hidden;
}

.equipment-thumb.star-thumb img {
  width: 86px;
  height: 86px;
  margin: -5px;
}

/* Crafting cost calculator */
.crafting-cost-tabs {
  margin-bottom: 16px;
}

.crafting-cost-controls {
  padding: 16px;
  border: 1px solid #b69b72;
  background: #f4ead9;
}

.crafting-cost-selectors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.crafting-cost-selectors[hidden] {
  display: none;
}

.crafting-cost-selectors label,
.crafting-cost-selectors select {
  width: 100%;
}

.crafting-instance-part-field {
  grid-column: 1 / -1;
}

#crafting-cost-unit-note,
#crafting-cost-note.crafting-cost-note-alert {
  color: var(--red);
  font-weight: 800;
}

.crafting-feature-category-group {
  grid-column: 1 / -1;
}

.crafting-feature-category-title {
  display: block;
  margin-bottom: 10px;
  color: #2c2823;
  font-size: 18px;
}

.crafting-feature-category-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 6px;
}

.crafting-cost-route {
  margin: 16px 0 6px;
  padding: 12px 14px;
  border-left: 5px solid #704816;
  background: #e5d4b7;
  color: #2c2823;
  font-weight: 800;
  line-height: 1.6;
}

.crafting-cost-table-wrap {
  margin-top: 16px;
}

.crafting-cost-table {
  min-width: 0;
  table-layout: fixed;
}

.crafting-cost-table th:nth-child(2),
.crafting-cost-table td:nth-child(2) {
  width: 230px;
}

.crafting-cost-table th:nth-child(3),
.crafting-cost-table td:nth-child(3) {
  width: 120px;
  text-align: right;
}

.crafting-cost-table th:nth-child(4),
.crafting-cost-table td:nth-child(4) {
  width: 220px;
  text-align: right;
}

.crafting-cost-table input {
  width: 100%;
  min-width: 0;
  text-align: right;
}

.crafting-price-input {
  position: relative;
}

.crafting-price-input input {
  min-height: 68px;
  padding-bottom: 28px;
}

.crafting-price-display {
  position: absolute;
  right: 14px;
  bottom: 7px;
  left: 14px;
  color: #704816;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  pointer-events: none;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crafting-price-display[hidden] {
  display: none;
}

.crafting-cost-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  margin-top: 16px;
  padding: 16px 20px;
  border: 2px solid #704816;
  background: #5a4128;
  color: #fffdf7;
}

.crafting-cost-total span {
  font-weight: 800;
}

.crafting-cost-total strong {
  color: #fffdf7;
  font-size: 26px;
}

@media (max-width: 720px) {
  .crafting-cost-selectors {
    grid-template-columns: 1fr;
  }

  .crafting-feature-category-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .crafting-cost-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
  }

  .crafting-cost-table,
  .crafting-cost-table tbody,
  .crafting-cost-table tr,
  .crafting-cost-table td {
    display: block;
    width: 100%;
  }

  .crafting-cost-table tr[data-crafting-cost-row] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid #b69b72;
  }

  .crafting-cost-table td,
  .crafting-cost-table td:nth-child(2),
  .crafting-cost-table td:nth-child(3),
  .crafting-cost-table td:nth-child(4) {
    width: 100%;
    text-align: left;
  }

  .crafting-cost-table td:first-child {
    grid-column: 1 / -1;
  }

  .crafting-cost-table td::before {
    display: block;
    margin-bottom: 5px;
    color: #5c5348;
    content: attr(data-label);
    font-size: 15px;
    font-weight: 800;
  }

  .crafting-cost-table input {
    text-align: left;
  }

  .crafting-price-display {
    text-align: left;
  }

  .crafting-cost-total {
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
  }

  .crafting-cost-total strong {
    font-size: 22px;
  }
}

/* Client job-soul sprites are native 24px assets; avoid star-equipment upscaling. */
.equipment-thumb.soul-thumb {
  width: 42px;
  height: 42px;
  border-color: transparent;
  background: transparent;
}

.equipment-thumb.soul-thumb img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  image-rendering: pixelated;
}

.equipment-thumb.soul-thumb--official {
  width: 76px;
  height: 76px;
}

.equipment-thumb.soul-thumb--official img {
  width: 70px;
  height: 70px;
  image-rendering: auto;
}

.star-art-stack {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.star-base-stats {
  display: grid;
  gap: 5px;
  width: 88px;
}

.star-base-stats span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 7px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(47, 125, 90, 0.18);
  border-radius: 7px;
  background: #e6f4eb;
  color: #174533;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
}

.star-base-stats b {
  color: var(--green);
  font-size: 12px;
}

.star-equipment-identity {
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: start;
  min-width: 0;
}

.star-equipment-meta {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  align-items: center;
  margin-top: 4px;
}

.star-equipment-meta span,
.star-equipment-meta small,
.star-equipment-meta em {
  width: fit-content;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 6px;
  background: #edf5f0;
  color: var(--green);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.star-material-lines {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
}

.star-equipment-meta small,
.star-equipment-meta em {
  grid-column: 1 / -1;
}

.star-equipment-meta small {
  color: var(--muted);
}

.star-equipment-meta em {
  color: #426457;
}

.star-card-cell {
  display: grid;
  gap: 8px;
  min-width: 230px;
}

.star-card-preview {
  display: block;
  width: 220px;
  max-width: 100%;
  aspect-ratio: 744 / 515;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf7;
}

.star-card-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.equipment-thumb.placeholder::before {
  content: "待補";
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.lava-equipment-list {
  display: grid;
  gap: 10px;
}

.equipment-catalog-note {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

.instance-soul-enchant-critical {
  color: var(--red, #a65245);
  font-weight: 700;
}

.instance-soul-enchant-npcs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface, var(--panel));
}

.instance-soul-enchant-npc {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.instance-soul-enchant-npc + .instance-soul-enchant-npc {
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

.instance-soul-enchant-npc img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: var(--panel);
}

.instance-soul-enchant-npc strong,
.instance-soul-enchant-npc p,
.instance-soul-enchant-npc small {
  display: block;
}

.instance-soul-enchant-npc strong { margin-top: 3px; }
.instance-soul-enchant-npc p { margin: 5px 0 2px; font-weight: 700; }
.instance-soul-enchant-npc small { color: var(--muted); }

.instance-soul-enchant-table {
  min-width: 760px;
}

.instance-soul-enchant-table th:first-child,
.instance-soul-enchant-table td:first-child {
  width: 220px;
}

.instance-soul-enchant-series strong,
.instance-soul-enchant-series span {
  display: block;
}

.instance-soul-enchant-series strong {
  white-space: nowrap;
}

.instance-soul-enchant-series span {
  margin-top: 8px;
  color: var(--muted);
}

.instance-soul-enchant-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.instance-soul-enchant-details section + section {
  border-left: 1px solid var(--line);
  padding-left: 22px;
}

.instance-soul-enchant-details h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 15px;
}

@media (max-width: 720px) {
  .instance-soul-enchant-npcs { grid-template-columns: 1fr; }
  .instance-soul-enchant-npc + .instance-soul-enchant-npc { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .instance-soul-enchant-table { min-width: 680px; }
}

.lava-equipment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.lava-equipment-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  cursor: pointer;
}

.lava-equipment-item summary::marker {
  color: var(--green);
}

.lava-equipment-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lava-equipment-title-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.lava-equipment-thumb {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.lava-equipment-thumb img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.lava-equipment-title strong {
  font-size: 17px;
}

.lava-equipment-title small,
.lava-equipment-detail footer,
.lava-equipment-detail footer small {
  color: var(--muted);
}

.lava-equipment-item[open] summary {
  border-bottom: 1px solid var(--line);
}

.lava-equipment-detail {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
}

.lava-equipment-detail > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

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

.lava-effect-group {
  min-width: 0;
  padding-left: 12px;
  border-left: 3px solid #c9dfd1;
}

.lava-effect-group h3 {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 13px;
}

.lava-effect-group ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  line-height: 1.5;
}

.lava-equipment-detail footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: baseline;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.55;
}

.lava-equipment-detail footer a {
  color: var(--green);
  font-weight: 800;
}

.material-chip {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faf7;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
}

.monster-chip strong,
.monster-chip span {
  display: block;
  overflow-wrap: anywhere;
}

.monster-chip strong {
  font-size: 13px;
}

.monster-chip span {
  color: var(--muted);
  font-size: 12px;
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: white;
}

.data-table th,
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #f5f8f5;
  color: var(--muted);
  font-size: 12px;
}

.monster-table {
  min-width: 1080px;
}

.instance-equipment-table {
  min-width: 820px;
}

.instance-equipment-table th:nth-child(1),
.instance-equipment-table td:nth-child(1) {
  width: 72px;
}

.instance-equipment-table th:nth-child(2),
.instance-equipment-table td:nth-child(2) {
  width: 280px;
}

.stacked-cell {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.stacked-cell span,
.stacked-cell small {
  display: block;
  line-height: 1.45;
}

.material-stack span {
  padding: 6px 8px;
  border-radius: 6px;
  background: #eef5f0;
  color: #314139;
}

.grf-resource-section {
  display: grid;
  gap: 12px;
  padding-top: 6px;
}

.grf-resource-section h3 {
  margin: 0;
  font-size: 22px;
}

.grf-sprite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.grf-sprite-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.grf-sprite-card img {
  width: 100%;
  height: 86px;
  object-fit: contain;
  border: 1px solid rgba(28, 47, 37, 0.12);
  border-radius: 6px;
  background: #132319;
}

.grf-sprite-card strong,
.grf-sprite-card span,
.grf-sprite-card small {
  overflow-wrap: anywhere;
}

.grf-sprite-card strong {
  font-size: 13px;
}

.grf-sprite-card span,
.grf-sprite-card small {
  color: var(--muted);
  font-size: 12px;
}

.grf-sprite-card em {
  width: max-content;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  color: #1f5f45;
  background: #e6f3ec;
  font-size: 12px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.grf-sprite-card.near em {
  color: #335b8f;
  background: #e7eef8;
}

.grf-sprite-card.loose em {
  color: #74531d;
  background: #f6edda;
}

.grf-sprite-card.far em {
  color: #6a4c4c;
  background: #f1e5e2;
}

.compact-toolbar {
  grid-template-columns: minmax(180px, 260px);
  margin-bottom: 2px;
}

.data-table td strong,
.data-table td small {
  display: block;
}

.item-name-cell {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.item-name-cell img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.effect-stack {
  display: grid;
  gap: 10px;
  max-width: 720px;
}

.effect-lines {
  display: grid;
  gap: 6px;
}

.effect-lines p {
  margin: 0;
  color: #26352c;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.effect-lines p:first-child {
  font-weight: 800;
}

.star-equipment-table {
  min-width: 660px;
  table-layout: fixed;
}

.star-equipment-table th:first-child,
.star-equipment-table td:first-child {
  width: 250px;
}

.star-equipment-table th:nth-child(2),
.star-equipment-table td:nth-child(2) {
  width: auto;
}

.effect-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  max-width: none;
  color: #24342c;
  line-height: 1.6;
}

.effect-item {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #edf2ee;
}

.effect-item-wide {
  grid-column: 1 / -1;
}

.effect-value-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 16px;
  min-width: 0;
  font-size: 15px;
}

.effect-value-list > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.data-table td .effect-highlight-enchant {
  display: inline;
  color: #b13d18;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.data-table td button.effect-highlight-enchant {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.data-table td button.effect-highlight-enchant:focus-visible {
  border-radius: 2px;
  outline: 3px solid #704816;
  outline-offset: 2px;
}

.data-table td button.effect-highlight-enchant.instance-equipment-enchant-trigger {
  margin-inline-start: 0.55em;
}

.effect-highlight-enchant-phrase {
  white-space: nowrap;
}

.equipment-enchant-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(88vh, 900px);
  padding: 0;
  border: 1px solid #8d6b3f;
  border-radius: 10px;
  background: #f5e4c3;
  color: #2c2823;
  box-shadow: 0 24px 70px rgba(44, 32, 20, 0.42);
}

.equipment-enchant-dialog::backdrop {
  background: rgba(35, 27, 20, 0.72);
}

.equipment-enchant-dialog-shell {
  display: grid;
  max-height: min(88vh, 900px);
  grid-template-rows: auto minmax(0, 1fr);
}

.equipment-enchant-dialog-shell > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid #b69b72;
  background: #e5d4b7;
}

.equipment-enchant-dialog-shell h2 {
  margin: 2px 0 0;
  font-size: 25px;
}

.equipment-enchant-dialog-close {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  padding: 0;
  border: 1px solid #8d6b3f;
  border-radius: 50%;
  background: #fffaf0;
  color: #5a4128;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.equipment-enchant-dialog-close:focus-visible {
  outline: 3px solid #704816;
  outline-offset: 3px;
}

.equipment-enchant-dialog-content {
  display: grid;
  gap: 14px;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
}

.equipment-enchant-dialog-group {
  border: 1px solid #c3a575;
  background: #fffaf0;
}

.equipment-enchant-dialog-group > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #d8c39f;
  background: #f0dfbf;
}

.equipment-enchant-dialog-group h3,
.equipment-enchant-dialog-group h4 {
  margin: 0;
  color: #543817;
}

.equipment-enchant-dialog-group h3 { font-size: 20px; }
.equipment-enchant-dialog-group h4 { font-size: 17px; }
.equipment-enchant-dialog-group > header span { color: #5c5348; font-weight: 700; }

.equipment-enchant-dialog-section {
  display: grid;
  gap: 9px;
  padding: 12px 14px;
  border-bottom: 1px solid #e2cfac;
}

.equipment-enchant-dialog-section:last-child { border-bottom: 0; }

.equipment-enchant-rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.equipment-enchant-rule-chips span {
  padding: 8px 10px;
  border-left: 4px solid #8d5c1c;
  background: #f8ecd8;
}

.equipment-enchant-dialog-section ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.equipment-enchant-dialog-section li {
  position: relative;
  padding: 9px 10px 9px 26px;
  border: 1px solid #dfceb1;
  background: #fffdf7;
}

.equipment-enchant-dialog-section li::before {
  position: absolute;
  top: 0.95em;
  left: 11px;
  color: #704816;
  content: "•";
  font-weight: 800;
}

@media (max-width: 620px) {
  .equipment-enchant-dialog { width: calc(100vw - 16px); max-height: 94vh; }
  .equipment-enchant-dialog-shell { max-height: 94vh; }
  .equipment-enchant-dialog-shell > header { padding: 12px; }
  .equipment-enchant-dialog-content { padding: 10px; }
  .equipment-enchant-dialog-group > header { align-items: flex-start; flex-direction: column; }
  .equipment-enchant-rule-chips { display: grid; }
}

.effect-value-list-wide {
  grid-template-columns: 1fr;
}

.effect-item:last-child {
  border-bottom: 0;
}

.feature-craft-npc-panel {
  margin: 12px 0 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 440px));
  gap: 12px;
}

.feature-craft-npc-panel-inline {
  margin: 0;
  grid-template-columns: minmax(260px, 520px);
}

#feature-category-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-overview-pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid #c6a26d;
  border-radius: 10px;
  background: #f4ead6;
  color: #3d3124;
}

.feature-overview-pager[hidden] {
  display: none;
}

.feature-overview-pager button {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #a98958;
  border-radius: 8px;
  background: #fff7e8;
  color: #4b3826;
  font-weight: 800;
  cursor: pointer;
}

.feature-overview-pager button:hover:not(:disabled),
.feature-overview-pager button:focus-visible {
  background: #5a4128;
  color: #fff9eb;
  outline: none;
}

.feature-overview-pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.feature-overview-pager span {
  color: #4b3826;
  font-size: 15px;
  font-weight: 700;
}

.feature-craft-npc-card {
  padding: 10px;
  border: 1px solid #c6a26d;
  border-radius: 10px;
  background: #f4ead6;
}

.feature-craft-npc-info {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  color: #3d3124;
  font-size: 15px;
  line-height: 1.5;
}

.feature-craft-npc-info code {
  color: #6b5032;
  background: #fff7e8;
  border: 1px solid #dbc498;
  border-radius: 6px;
  padding: 1px 6px;
}

.feature-craft-npc-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.catalog-category-row td {
  background: #ead8b9 !important;
  border-top: 2px solid #b69b72;
  border-bottom: 1px solid #b69b72;
}

.catalog-category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #3d3124;
}

.catalog-category-heading strong {
  color: #523716;
  font-size: 20px;
}

.catalog-category-heading span {
  color: #5c5348;
  font-size: 15px;
  font-weight: 700;
}

.catalog-category-npc-row td {
  background: #f7eddb !important;
}

.effect-label {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e5f3ec;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.effect-item-base .effect-label {
  background: #f0f4f1;
  color: #64766b;
}

.effect-text {
  min-width: 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  #feature-category-cards { grid-template-columns: 1fr; }
  .effect-value-list { grid-template-columns: 1fr; }
}

.material-line {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid #edf2ee;
}

.material-line span {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 8px;
  background: #eef6f0;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.material-line strong {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  font-weight: 700;
}

.adventure-version {
  background: #f6f8f5;
}

.adventure-top {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 18px clamp(20px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 245, 0.92);
  backdrop-filter: blur(14px);
}

.adventure-top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
}

.adventure-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 340px;
  gap: 28px;
  width: min(1180px, calc(100% - 32px));
  margin: 36px auto;
  padding: clamp(32px, 6vw, 68px);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.94), rgba(231, 241, 235, 0.88)),
    url("assets/ui/refine-rate-1.png");
  background-size: cover;
  background-position: center;
  box-shadow: 0 18px 50px rgba(32, 43, 36, 0.14);
}

.adventure-hero h1 {
  max-width: 820px;
}

.adventure-hero p {
  max-width: 680px;
}

.primary-link {
  margin-top: 18px;
  background: var(--green);
  color: white;
}

.hero-card {
  align-self: end;
  display: grid;
  gap: 10px;
  padding: 22px;
}

.hero-card span {
  color: var(--muted);
}

.hero-card strong {
  font-size: 30px;
}

.hero-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.tool-cards,
.source-gallery {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto;
}

.tool-cards article {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.icon-box {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 8px;
  background: #e7f1eb;
  color: var(--green);
  font-weight: 900;
}

.quick-result {
  padding: 12px;
  border-radius: 8px;
  background: #1f2b24;
  color: white;
  font-weight: 800;
}

.quick-result.muted {
  background: #eef3ef;
  color: var(--muted);
}

.source-gallery {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  padding: 22px;
}

.source-gallery img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  object-position: top left;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.seo-entry-panel {
  margin-top: 18px;
}

.seo-entry-lead {
  max-width: 880px;
  color: var(--muted);
  line-height: 1.8;
}

.seo-entry-grid,
.seo-link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.seo-entry-grid a,
.seo-link-grid a {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.seo-entry-grid strong,
.seo-link-grid strong {
  color: var(--ink);
}

.seo-entry-grid span,
.seo-link-grid span {
  color: var(--muted);
  line-height: 1.6;
}

.legal-page {
  background: var(--paper);
}

.legal-shell {
  display: grid;
  gap: 18px;
  width: min(860px, calc(100% - 32px));
  margin: 40px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.compact-legal-shell {
  width: min(680px, calc(100% - 32px));
}

.legal-back {
  width: fit-content;
  color: var(--green);
  font-weight: 800;
}

.legal-shell h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
}

.legal-shell h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.legal-shell p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.legal-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.legal-action {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef7f1;
  color: var(--green);
  font-weight: 800;
}

.legal-action.disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.legal-lead {
  font-size: 18px;
}

.legal-shell section {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.legal-shell .seo-link-grid {
  margin-top: 4px;
}

.legal-updated {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.quest-page {
  max-width: 1040px;
}

.quest-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  border-top: 0;
}

.quest-summary article,
.quest-region {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.quest-summary article {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.quest-summary span,
.quest-location-meta span,
.quest-source-note {
  color: var(--muted);
}

.quest-summary strong {
  font-size: 30px;
}

.quest-toolbar,
.quest-region header,
.quest-location {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.quest-toolbar a {
  color: var(--green);
  font-weight: 800;
}

.quest-region-list {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.quest-region {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.quest-region h3 {
  margin: 0;
  font-size: 28px;
}

.quest-region header > strong {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 8px;
  background: #e7f1eb;
  color: var(--green);
}

.quest-location-list {
  display: grid;
  gap: 12px;
}

.quest-location {
  padding: 14px;
  border-radius: 8px;
  background: #f7faf7;
}

.quest-location-meta {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.quest-location-meta em {
  color: var(--green);
  font-style: normal;
  font-weight: 800;
}

.quest-location ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.quest-location-body {
  display: grid;
  flex: 1;
  gap: 12px;
  min-width: 0;
}

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

.quest-image-grid a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.quest-image-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.quest-warning {
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #fbf7ec;
  color: #705423;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .monster-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .seo-entry-grid,
  .seo-link-grid {
    grid-template-columns: 1fr;
  }

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

  .quest-summary {
    grid-template-columns: 1fr;
  }

  .quest-toolbar,
  .quest-region header,
  .quest-location {
    display: grid;
  }

  .quest-location-meta {
    min-width: 0;
  }

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

@media (max-width: 1180px) {
  .rune-filter-panel {
    grid-template-columns: auto minmax(180px, 1fr);
    align-items: end;
  }

  .rune-filter-panel label {
    gap: 0;
    font-size: 0;
  }

  .rune-filter-panel input {
    min-height: 34px;
    padding: 6px 9px;
  }

  .rune-filter-panel .rune-tab-cards {
    grid-column: 1 / -1;
    align-self: end;
  }
}

@media (max-width: 760px) {
  .rune-filter-panel {
    grid-template-columns: auto minmax(150px, 1fr);
  }

  .rune-filter-panel .rune-tab-cards {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .compare-grid,
  .dash-metrics,
  .dash-grid,
  .tool-cards,
  .adventure-hero,
  .source-gallery {
    grid-template-columns: 1fr;
  }

  .dashboard-version {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    height: auto;
    padding: 20px 16px 16px;
  }

  .side-logo {
    margin-bottom: 16px;
  }

  .site-logo-mark {
    width: 38px;
  }

  .side-nav nav {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .side-nav a {
    flex: 0 0 auto;
    min-width: 96px;
    padding: 12px 14px;
    text-align: center;
    white-space: nowrap;
  }

  .side-nav-inline {
    flex: 0 0 228px;
    width: 228px;
    grid-template-columns: minmax(72px, 0.9fr) auto minmax(112px, 1.35fr);
  }

  .side-nav .side-nav-inline > a {
    min-width: 0;
    padding: 12px 10px;
  }

  .dash-header {
    flex-wrap: wrap;
  }

  .header-server {
    width: 100%;
    text-align: left;
  }

  .dense-form,
  .result-row,
  .data-toolbar,
  .data-toolbar.relic-toolbar,
  .data-toolbar.star-toolbar,
  .data-toolbar.monster-toolbar,
  .instance-cards,
  .relic-cards,
  .rune-gallery,
  .rune-book-meta,
  .source-check-grid,
  .monster-grid,
  .monster-card-grid {
    grid-template-columns: 1fr;
  }

  .site-log-item {
    grid-template-columns: 1fr;
  }

  .site-log-date {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .rune-filter-panel .dense-form {
    grid-template-columns: 1fr;
  }

  .star-equipment-table {
    min-width: 600px;
  }

  .star-equipment-table th:first-child,
  .star-equipment-table td:first-child {
    width: 240px;
  }

  .star-equipment-identity {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .star-base-stats {
    width: 88px;
  }

  .star-base-stats span {
    min-height: 25px;
    padding: 3px 7px;
    font-size: 15px;
  }

  .equipment-thumb.star-thumb {
    width: 64px;
    height: 64px;
  }

  .equipment-thumb.star-thumb img {
    width: 74px;
    height: 74px;
  }

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

  .dash-panel.wide {
    grid-column: auto;
  }

}

/* Temple codex theme: local preview layer replacing the alchemist palette. */
:root {
  color-scheme: light;
  --ink: #302d29;
  --muted: #686158;
  --line: #cbbda7;
  --paper: #eee9de;
  --panel: #fbf7ee;
  --green: #6c7655;
  --gold: #9a7133;
  --red: #a65245;
  --blue: #476f7b;
}

body {
  background: #eee9de;
  background-image: linear-gradient(90deg, rgba(132, 107, 63, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
}

.dashboard-version,
.legal-page { background: transparent; }

.side-nav {
  background: linear-gradient(180deg, #473d2e 0%, #2e2921 100%);
  border-right: 1px solid #b79b64;
  color: #f8f1df;
}

.side-logo-main { color: #fbf5e8; font-family: Georgia, "Noto Serif TC", serif; }
.side-logo-sub, .label, .breadcrumbs a, .site-footer a, .ghost-link, .primary-link,
.pill, .source-badge, .instance-card em { color: var(--gold); }

.dash-header h1, .compare-header h1, .adventure-hero h1, .library-header h1,
.dash-panel > .panel-title h2, .library-section h2, .quest-region h3 {
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  letter-spacing: -0.025em;
}

.dash-panel, .dash-metrics article, .tool-cards article, .hero-card, .source-gallery,
.relic-card, .library-index, .library-section, .quest-summary article, .quest-region {
  border-color: var(--line);
  border-radius: 3px;
  background: #fbf7ee;
  box-shadow: inset 0 0 0 5px #f4ecdc, 0 12px 24px rgba(74, 55, 31, 0.08);
}

.dash-panel > .panel-title, .library-section-head, .quest-region header {
  padding-bottom: 12px;
  border-bottom: 1px solid #d8c8ac;
}

.site-log-item, .relic-exchange, .relic-requirement, .source-note, .result-row div,
.mini-list span, .data-table, .data-table th, input, select {
  border-color: var(--line);
  background: #fffaf0;
  color: var(--ink);
}

.site-log-item, .instance-card, .relic-cards article, .monster-card, .monster-chip,
.quest-location { border-color: var(--line); border-radius: 3px; background: #f8f1e4; }

.site-log-date span, .pill, .source-badge, .relic-type, .relic-npc-icon,
.instance-card.selected, .view-toggle button.active, .view-toggle button:hover {
  background: #eee1c6;
  color: #735222;
}

.view-toggle { border-color: var(--line); border-radius: 3px; background: #f5eddd; }
.view-toggle button { border-radius: 2px; color: var(--muted); }

.instance-card:hover, .instance-card:focus-visible {
  border-color: var(--gold);
  background: #fff8e9;
  box-shadow: 0 7px 16px rgba(93, 67, 29, 0.12);
}

.instance-card.selected { border-color: var(--gold); box-shadow: inset 0 0 0 1px #c7a56c; }
.instance-card.selected strong, .data-table th { color: #735222; }
.inline-detail-list li::before { background: var(--gold); }
.data-table td { border-bottom-color: #ddcfb8; }
.data-table tr:hover td { background: #f5ead7; }

.back-to-top, .monster-pagination button {
  border-color: #b79860;
  background: #fbf3e3;
  color: #765423;
}

:focus-visible { outline: 2px solid #a97b36; outline-offset: 3px; }

/* Alchemist's ledger theme: shared visual layer for the data pages. */
:root {
  --ink: #edf0e8;
  --muted: #bac5ba;
  --line: #415244;
  --paper: #101713;
  --panel: #19231c;
  --green: #8dbd8a;
  --gold: #e1b85b;
  --red: #ed8978;
  --blue: #8fc2d5;
}

body {
  background: #101713;
  background-image: radial-gradient(circle at top right, rgba(96, 126, 83, 0.18), transparent 34rem);
}

.dashboard-version,
.legal-page {
  background: transparent;
}

.side-nav {
  background: linear-gradient(180deg, #1d362a 0%, #101f18 58%, #0b1510 100%);
  border-right: 1px solid rgba(225, 184, 91, 0.25);
}

.side-logo-sub,
.label,
.breadcrumbs a,
.site-footer a,
.ghost-link,
.primary-link,
.pill,
.source-badge,
.instance-card em {
  color: var(--gold);
}

.dash-header h1,
.compare-header h1,
.adventure-hero h1,
.library-header h1 {
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  letter-spacing: -0.035em;
}

.dash-panel,
.dash-metrics article,
.tool-cards article,
.hero-card,
.source-gallery,
.relic-card,
.library-index,
.library-section,
.quest-summary article,
.quest-region {
  border-color: var(--line);
  background: linear-gradient(145deg, #1d2820, #172019);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.14);
}

.dash-panel,
.library-section,
.quest-region {
  border-radius: 5px;
}

.dash-panel > .panel-title,
.library-section-head,
.quest-region header {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(225, 184, 91, 0.22);
}

.dash-panel > .panel-title h2,
.library-section h2,
.quest-region h3 {
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
}

.site-log-item,
.relic-exchange,
.relic-requirement,
.source-note,
.result-row div,
.mini-list span,
.data-table,
.data-table th,
input,
select {
  border-color: var(--line);
  background: #121a15;
  color: var(--ink);
}

.site-log-item {
  border-radius: 5px;
}

.site-log-date span,
.pill,
.source-badge,
.relic-type,
.relic-npc-icon,
.instance-card.selected,
.view-toggle button.active,
.view-toggle button:hover {
  background: #293c2e;
  color: #f1d689;
}

.view-toggle {
  border-color: var(--line);
  border-radius: 4px;
  background: #101713;
}

.view-toggle button {
  border-radius: 3px;
  color: var(--muted);
}

.instance-card,
.relic-cards article,
.monster-card,
.monster-chip,
.quest-location {
  border-color: var(--line);
  border-radius: 5px;
  background: #162019;
}

.instance-card:hover,
.instance-card:focus-visible {
  border-color: var(--gold);
  background: #213025;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
}

.instance-card.selected {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(225, 184, 91, 0.35);
}

.instance-card.selected strong {
  color: #f1d689;
}

.inline-detail-list li::before {
  background: var(--gold);
}

.data-table th {
  color: #f1d689;
}

.data-table td {
  border-bottom-color: var(--line);
}

.data-table tr:hover td {
  background: #1b2920;
}

.back-to-top,
.monster-pagination button {
  border-color: rgba(225, 184, 91, 0.48);
  background: #1b2a20;
  color: #f1d689;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.minimal-version {
  background: #fbfcfb;
}

.minimal-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  width: min(1040px, calc(100% - 28px));
  margin: 28px auto 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.minimal-header h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
}

.minimal-header a {
  color: var(--green);
  font-weight: 800;
}

.minimal-main {
  display: grid;
  gap: 16px;
  width: min(1040px, calc(100% - 28px));
  margin: 0 auto 48px;
}

.minimal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.minimal-tabs a {
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.minimal-tabs a.active,
.minimal-tabs a:hover {
  background: #eef3ef;
  color: var(--ink);
}

.minimal-tool,
.minimal-split article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.minimal-tool {
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.minimal-title h2,
.minimal-split h2 {
  margin: 0;
}

.minimal-title span {
  color: var(--muted);
  font-size: 13px;
}

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

.minimal-form button {
  align-self: end;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.minimal-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-radius: 8px;
  background: #1f2b24;
  color: white;
}

.minimal-result strong {
  font-size: clamp(26px, 4vw, 38px);
}

.minimal-result span {
  color: #cbd9d0;
}

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

.minimal-table th,
.minimal-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.minimal-table th {
  color: var(--muted);
  font-size: 13px;
}

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

.minimal-split article {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.minimal-split p {
  margin: 0;
  color: var(--muted);
}

.library-version {
  background: #f3f1ec;
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  margin: 34px auto 22px;
}

.library-header h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 60px);
}

.library-header p:last-child {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.7;
}

.library-main {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 56px;
}

.library-index,
.library-section {
  border: 1px solid #d8d0c0;
  border-radius: 8px;
  background: #fffdf8;
}

.library-index {
  position: sticky;
  top: 18px;
  align-self: start;
  display: grid;
  gap: 8px;
  padding: 18px;
}

.library-index strong {
  margin-bottom: 8px;
}

.library-index a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.library-index a.active,
.library-index a:hover {
  background: #efe8d7;
  color: var(--ink);
}

.library-content {
  display: grid;
  gap: 16px;
}

.library-section {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.library-section h2 {
  margin: 0;
}

.library-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.library-section.warning {
  border-color: #e2c37a;
  background: #fff8e7;
}

.library-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.note-grid div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 8px;
  background: #f5f0e6;
}

.note-grid span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .minimal-header,
  .minimal-result,
  .library-header,
  .library-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .minimal-form,
  .minimal-split,
  .library-main,
  .note-grid {
    grid-template-columns: 1fr;
  }

  .library-index {
    position: static;
  }
}

/* Temple codex final precedence for the standalone library and tool layouts. */
.minimal-version,
.library-version { background: #eee9de; color: var(--ink); }

.minimal-header,
.library-header { border-bottom-color: #cbbda7; }

.minimal-tabs,
.minimal-tool,
.minimal-split article,
.library-index,
.library-section {
  border-color: #cbbda7;
  border-radius: 3px;
  background: #fbf7ee;
  box-shadow: inset 0 0 0 5px #f4ecdc, 0 12px 24px rgba(74, 55, 31, 0.08);
}

.minimal-tabs a.active,
.minimal-tabs a:hover,
.library-index a.active,
.library-index a:hover,
.note-grid div {
  background: #eee1c6;
  color: #735222;
}

.minimal-form button {
  border: 1px solid #765423;
  border-radius: 3px;
  background: #765423;
  color: #fff9ed;
}

.minimal-result {
  border: 1px solid #5e4b2b;
  border-radius: 3px;
  background: #423927;
  color: #fff7e5;
}

.minimal-result span { color: #e6d8bd; }
.library-section.warning { border-color: #c18c44; background: #fff3d6; }

/* Temple codex final precedence: this must remain after every theme layer. */
:root {
  color-scheme: light;
  --ink: #302d29;
  --muted: #686158;
  --line: #cbbda7;
  --paper: #eee9de;
  --panel: #fbf7ee;
  --green: #6c7655;
  --gold: #9a7133;
  --red: #a65245;
  --blue: #476f7b;
}

body { background: #eee9de; background-image: linear-gradient(90deg, rgba(132, 107, 63, 0.035) 1px, transparent 1px); background-size: 32px 32px; }
.dashboard-version, .legal-page { background: transparent; }
.side-nav { background: linear-gradient(180deg, #473d2e 0%, #2e2921 100%); border-right-color: #b79b64; color: #f8f1df; }
.side-logo-main { color: #fbf5e8; font-family: Georgia, "Noto Serif TC", serif; }
.side-logo-sub, .label, .breadcrumbs a, .site-footer a, .ghost-link, .primary-link, .pill, .source-badge, .instance-card em { color: #9a7133; }

.dash-header h1, .compare-header h1, .adventure-hero h1, .library-header h1,
.dash-panel > .panel-title h2, .library-section h2, .quest-region h3 { font-family: Georgia, "Times New Roman", "Noto Serif TC", serif; letter-spacing: -0.025em; }

.dash-panel, .dash-metrics article, .tool-cards article, .hero-card, .source-gallery, .relic-card,
.library-index, .library-section, .quest-summary article, .quest-region {
  border-color: #cbbda7; border-radius: 3px; background: #fbf7ee;
  box-shadow: inset 0 0 0 5px #f4ecdc, 0 12px 24px rgba(74, 55, 31, 0.08);
}
.dash-panel > .panel-title, .library-section-head, .quest-region header { padding-bottom: 12px; border-bottom-color: #d8c8ac; }

.site-log-item, .relic-exchange, .relic-requirement, .source-note, .result-row div, .mini-list span,
.data-table, .data-table th, input, select { border-color: #cbbda7; background: #fffaf0; color: #302d29; }
.site-log-item, .instance-card, .relic-cards article, .monster-card, .monster-chip, .quest-location { border-color: #cbbda7; border-radius: 3px; background: #f8f1e4; }

.site-log-date span, .pill, .source-badge, .relic-type, .relic-npc-icon, .instance-card.selected,
.view-toggle button.active, .view-toggle button:hover { background: #eee1c6; color: #735222; }
.view-toggle { border-color: #cbbda7; border-radius: 3px; background: #f5eddd; }
.view-toggle button { border-radius: 2px; color: #686158; }
.instance-card:hover, .instance-card:focus-visible { border-color: #9a7133; background: #fff8e9; box-shadow: 0 7px 16px rgba(93, 67, 29, 0.12); }
.instance-card.selected { border-color: #9a7133; box-shadow: inset 0 0 0 1px #c7a56c; }
.instance-card.selected strong, .data-table th { color: #735222; }
.inline-detail-list li::before { background: #9a7133; }
.data-table td { border-bottom-color: #ddcfb8; }
.data-table tr:hover td { background: #f5ead7; }
.back-to-top, .monster-pagination button { border-color: #b79860; background: #fbf3e3; color: #765423; }
:focus-visible { outline: 2px solid #a97b36; outline-offset: 3px; }

/* Temple codex contrast tuning: improve readability without losing the parchment palette. */
:root {
  --ink: #2c2823;
  --muted: #5c5348;
  --line: #b69b72;
  --paper: #e6ddca;
  --panel: #fffdf7;
  --gold: #7a531b;
}

body { background: #e6ddca; }

.dash-panel,
.dash-metrics article,
.tool-cards article,
.hero-card,
.source-gallery,
.relic-card,
.library-index,
.library-section,
.quest-summary article,
.quest-region {
  background: #fffdf7;
  border-color: #b69b72;
}

.view-toggle {
  background: #ded0b8;
  border-color: #a98958;
  padding: 5px;
}

.view-toggle button { color: #45372a; }

.view-toggle button.active {
  background: #5a4128;
  color: #fff9eb;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset;
}

.view-toggle button:hover:not(.active) {
  background: #f4ead9;
  color: #3c2e22;
}

.site-log-item,
.instance-card,
.relic-cards article,
.monster-card,
.monster-chip,
.quest-location,
#instance-cards .instance-card,
#vesper-category-cards .instance-card,
#star-category-cards .instance-card,
#relic-category-cards .instance-card {
  background: #fffdf7;
  border-color: #b69b72;
  color: #3c2e22;
}

.instance-card.selected,
#instance-cards .instance-card.selected,
#vesper-category-cards .instance-card.selected,
#star-category-cards .instance-card.selected,
#relic-category-cards .instance-card.selected {
  background: #5a4128;
  border-color: #5a4128;
  color: #fff9eb;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset;
}

.instance-card.selected strong,
.instance-card.selected span,
.instance-card.selected em { color: inherit; }

input,
select,
textarea {
  background: #fffdf7;
  border-color: #a98958;
  color: #2c2823;
}

input::placeholder,
textarea::placeholder { color: #6c5b48; opacity: 1; }

.data-table th {
  background: #e5d4b7;
  border-color: #b69b72;
  color: #523716;
}

.data-table td {
  background: #fffdf7;
  border-color: #d6c3a3;
}

.data-table tbody tr:nth-child(even) td { background: #faf4e8; }
.data-table tbody tr:hover td { background: #f1dfbf; }

/* Shared compact filters for the non-instance equipment catalogues. */
#update-equipment-cards,
#vesper-category-cards,
#temporal-category-cards,
#other-category-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#update-equipment-cards .instance-card,
#vesper-category-cards .instance-card,
#temporal-category-cards .instance-card,
#other-category-cards .instance-card {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
}

#update-equipment-cards .instance-card span,
#update-equipment-cards .instance-check,
#vesper-category-cards .instance-card span,
#vesper-category-cards .instance-check,
#temporal-category-cards .instance-card span,
#temporal-category-cards .instance-check,
#other-category-cards .instance-card span,
#other-category-cards .instance-check {
  display: none;
}

#update-equipment-cards .instance-card strong,
#vesper-category-cards .instance-card strong,
#temporal-category-cards .instance-card strong,
#other-category-cards .instance-card strong {
  font-size: 17px;
  line-height: 1;
}

#update-equipment-cards .instance-card em,
#vesper-category-cards .instance-card em,
#temporal-category-cards .instance-card em,
#other-category-cards .instance-card em {
  font-size: 15px;
}

/* Site-wide readable temple layer: shared by current and future public pages. */
:root {
  --green: #4f5b3d;
  --gold: #704816;
  --red: #843c32;
  --blue: #365d68;
}

body {
  color: var(--ink);
  line-height: 1.6;
}

.label,
.side-logo-sub,
.breadcrumbs a,
.ghost-link,
.primary-link,
.instance-card em {
  color: var(--gold);
}

.muted,
.field-note,
.data-count,
.equipment-catalog-note,
.legal-shell p,
.legal-updated,
.quest-source-note,
.rune-book-row small,
.rune-book-header p,
.relic-card p,
.relic-exchange small,
.relic-requirement small,
.lava-equipment-title small,
.lava-equipment-detail > p,
.lava-equipment-detail footer,
.data-table small {
  color: var(--muted);
}

.side-nav nav a {
  border-left: 4px solid transparent;
  color: #e8dfd0;
}

.side-nav nav a:hover,
.side-nav nav a:focus-visible {
  border-left-color: #d1ad6b;
  background: #5b4c39;
  color: #fffaf0;
}

.side-nav nav a.active {
  border-left-color: #8d5c1c;
  background: #f2e5cd;
  color: #2c2823;
  box-shadow: inset 0 0 0 1px rgba(112, 72, 22, 0.24);
}

.side-nav nav .side-nav-pair > a {
  border-left: 0;
}

.side-nav nav .side-nav-inline > a {
  border-left: 0;
}

.side-nav .side-logo-sub {
  color: #e1bd79;
}

.legal-shell {
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 14px 32px rgba(74, 55, 31, 0.1);
}

.result-row div,
.site-log-item,
.seo-entry-grid a,
.seo-link-grid a,
.source-card,
.instance-ability-item,
.rune-book-group-head,
.rune-book-row,
.rune-gallery-detail,
.rune-book-meta section,
.relic-exchange,
.relic-requirement,
.lava-equipment-item,
.empty-state,
.quest-location {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.mini-list span,
.rune-book-meta section,
.relic-exchange,
.relic-requirement,
.lava-effect-group {
  border-color: #c9ae82;
  background: #f4ead9;
}

.site-log-date span,
.pill,
.source-badge,
.relic-type,
.relic-npc-icon,
.data-count {
  border: 1px solid #b38d55;
  background: #e5d4b7;
  color: #523716;
}

.seo-entry-grid a:hover,
.seo-link-grid a:hover,
.rune-book-group-head:hover,
.rune-book-row:hover,
.rune-book-row:focus-visible {
  border-color: #8d642c;
  background: #f1dfbf;
  color: var(--ink);
}

.rune-book-row.active,
.check-chip.selected {
  border-color: #5a4128;
  background: #5a4128;
  color: #fff9eb;
}

.rune-book-row.active strong,
.rune-book-row.active small,
.check-chip.selected strong,
.check-chip.selected span {
  color: inherit;
}

.rune-book-group-items {
  border-left-color: #a98958;
}

.rune-book-thumb,
.rune-fragment-icon,
.lava-equipment-thumb,
.quest-image-grid a {
  border-color: var(--line);
  background: #fffdf7;
}

.lava-effect-group {
  padding: 10px 12px;
  border-left: 4px solid #8d642c;
  border-radius: 3px;
}

.lava-effect-group h3 {
  color: #5f3f14;
  font-size: 14px;
}

.effect-item {
  border-bottom-color: #d6c3a3;
}

.effect-label,
.effect-item-base .effect-label {
  background: #6b5032;
  color: #fff9eb;
}

.quest-region header > strong {
  border: 1px solid #b38d55;
  background: #e5d4b7;
  color: #523716;
}

.quest-warning {
  border-left-color: #8d5c1c;
  background: #fff0c7;
  color: #5a3c0b;
}

.legal-back,
.quest-toolbar a,
.lava-equipment-detail footer a {
  color: var(--gold);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.legal-action {
  border: 1px solid #5a4128;
  background: #5a4128;
  color: #fff9eb;
}

.legal-action:hover,
.legal-action:focus-visible {
  background: #3f2d1c;
  color: #fffdf7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #704816;
  box-shadow: 0 0 0 3px rgba(112, 72, 22, 0.2);
}

:focus-visible {
  outline: 3px solid #7a4d12;
  outline-offset: 3px;
}

/* Readable responsive guardrails for shared layouts. */
.field-note,
.lava-equipment-detail footer small {
  font-size: 12px;
}

@media (max-width: 900px) {
  .dashboard-version,
  .side-nav,
  .side-nav nav,
  .dash-main,
  .dash-header,
  .dash-view,
  .dash-panel,
  .panel-title,
  .sticky-filter-panel {
    min-width: 0;
    max-width: 100%;
  }

  .side-nav,
  .dash-main {
    width: 100%;
  }

  .side-nav {
    overflow: hidden;
  }

  .side-nav nav {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .side-nav-pair {
    flex: 0 0 188px;
    width: 188px;
  }

  .side-nav-inline {
    flex: 0 0 228px;
    width: 228px;
  }

  .view-toggle {
    max-width: 100%;
    overflow-x: auto;
  }

  .equipment-data-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .data-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
}

.quest-level-group {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid #b69b72;
  border-radius: 3px;
  background: #fffdf7;
  box-shadow: inset 0 0 0 5px #f4ecdc, 0 12px 24px rgba(74, 55, 31, 0.08);
}

.quest-level-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #d8c8ac;
}

.quest-level-heading h3 { margin: 0; font-size: 30px; }
.quest-level-heading > strong { color: #735222; }
.quest-level-region-list { display: grid; gap: 16px; }
.quest-level-toggle { margin: 16px 0; }
.quest-location-separator { color: #8d5c1c; font-size: 32px; font-weight: 900; line-height: 1; text-align: center; text-shadow: 0 2px 0 #fff0c7; }
.quest-overview { margin: 18px 0; }
.quest-overview a, .quest-overview img { display: block; }
.quest-overview a { overflow: hidden; border: 1px solid #b69b72; background: #fffdf7; box-shadow: 0 12px 24px rgba(74, 55, 31, 0.1); }
.quest-overview img { width: 100%; height: auto; }
.quest-overview figcaption { margin-top: 8px; color: #735222; font-weight: 800; text-align: center; }

@media (max-width: 720px) {
  .quest-level-heading { display: grid; }
}

/* Relic page hierarchy: make card, exchange, and requirements visibly distinct. */
.relic-list {
  gap: 18px;
}

.relic-card {
  padding: 20px;
  border: 1px solid #a98958;
  background: #fffaf0;
  box-shadow: 0 8px 20px rgba(74, 55, 31, 0.08);
}

.relic-card-head {
  padding-bottom: 14px;
  border-bottom: 1px solid #d6c3a3;
}

.relic-card .relic-type,
.relic-card .relic-npc-icon {
  border-color: #5a4128;
  background: #5a4128;
  color: #fff9eb;
}

.relic-exchange {
  border-color: #a98958;
  background: #e5d4b7;
}

.relic-requirements {
  padding: 12px;
  border: 1px solid #c9ae82;
  border-radius: 4px;
  background: #f1e3cb;
}

.relic-requirement {
  min-height: 64px;
  border-color: #b69b72;
  background: #fffdf7;
}

@media (max-width: 560px) {
  .relic-card {
    padding: 16px;
  }

  .relic-requirements {
    padding: 8px;
  }
}

/* Refinement calculator hierarchy: settings first, outcomes second. */
.refine-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

.refine-form-group {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid #c9ae82;
  border-radius: 4px;
  background: #f3e7d1;
}

.refine-form-group legend {
  padding: 0 8px;
  color: #5a4128;
  font-weight: 800;
  letter-spacing: .04em;
}

.refine-form-group .dense-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.refine-market-settings .dense-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.refine-market-settings.is-basic-target .dense-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.refine-equipment-settings.is-normal-material-hidden .dense-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#refine-normal-field[hidden],
#refine-enriched-price[hidden],
#refine-token-note[hidden] {
  display: none;
}

.refine-optional-material-field {
  min-width: 0;
}

.refine-optional-material-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  font-weight: 700;
}

.refine-enable-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  cursor: pointer;
}

.refine-enable-switch input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.refine-enable-switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  border: 1px solid #9f8868;
  border-radius: 999px;
  background: #d8cbb7;
  transition: background .16s ease, border-color .16s ease;
}

.refine-enable-switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fffaf0;
  box-shadow: 0 1px 3px rgba(62, 43, 24, .28);
  content: "";
  transition: transform .16s ease;
}

.refine-enable-switch input:checked + .refine-enable-switch-track {
  border-color: #8d5c1c;
  background: #8d5c1c;
}

.refine-enable-switch input:checked + .refine-enable-switch-track::after {
  transform: translateX(18px);
}

.refine-enable-switch input:focus-visible + .refine-enable-switch-track {
  outline: 3px solid rgba(141, 92, 28, .25);
  outline-offset: 2px;
}

.refine-enable-switch small {
  color: #6d5942;
  font-size: 13px;
  font-weight: 800;
}

.refine-token-note {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding: 15px 17px;
  border: 1px solid #c49a58;
  border-left: 4px solid #a87528;
  border-radius: 4px;
  background: #fff7e4;
  color: #4a3520;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.5;
}

.refine-token-note strong {
  color: #8c3d22;
  font-size: 19px;
  font-weight: 950;
}

.refine-token-location {
  color: #76501f;
  font-size: 17px;
  font-weight: 900;
}

.refine-form-group .refine-goal-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.refine-form-group label {
  color: #4a3a29;
  font-weight: 750;
}

.refine-form-group select,
.refine-form-group input {
  min-height: 44px;
  border-color: #9e7a47;
  background: #fffdf7;
}

.refine-results {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #c9ae82;
}

.refine-results h3 {
  margin: 0 0 12px;
  color: #4a3520;
  font-size: 18px;
}

.refine-results .result-row div {
  min-height: 104px;
  padding: 16px;
  border: 1px solid #a98958;
  background: #fffaf0;
  box-shadow: 0 6px 16px rgba(74, 55, 31, .06);
}

.refine-results .result-row span {
  color: #574a3c;
  font-weight: 750;
}

.refine-results .result-row strong {
  align-self: end;
  color: #302419;
  font-size: clamp(22px, 2.2vw, 30px);
}

.refine-cost-lead {
  max-width: 860px;
  margin: 6px 0 0;
  color: #65513b;
  line-height: 1.7;
}

.refine-cost-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  padding: 12px 15px;
  border: 1px solid #c49a58;
  border-left: 5px solid #8c3d22;
  border-radius: 8px;
  background: #fff0c7;
  color: #5a3c0b;
  line-height: 1.55;
}

.refine-cost-notice strong {
  flex: 0 0 auto;
  color: #8c3d22;
  font-weight: 950;
}

@media (max-width: 700px) {
  .refine-cost-notice {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

.refine-cost-form .refine-form-group .dense-form {
  align-items: end;
}

.refine-exchange-field {
  grid-column: 1 / -1;
}

.refine-field-heading {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.refine-field-heading .field-note {
  margin-left: 0;
  color: var(--red);
  font-weight: 800;
}

.refine-money-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 8px;
  margin-top: 7px;
}

.refine-money-input select {
  width: 100%;
}

.refine-price-field {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}

.refine-money-input small,
.refine-price-field small {
  grid-column: 1 / -1;
  min-height: 18px;
  color: #704816;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.refine-results-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.refine-results-heading h3 {
  margin: 0;
}

.refine-results-heading span {
  color: #65513b;
  font-size: 13px;
  font-weight: 700;
}

.refine-cost-cards {
  display: grid;
  gap: 14px;
}

.refine-community-credit {
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid #c9ae82;
  border-left: 4px solid #a87528;
  border-radius: 4px;
  background: #f3e7d1;
  color: #4a3a29;
}

.refine-community-credit strong {
  color: #76501f;
}

.refine-community-credit p {
  margin: 4px 0 0;
  line-height: 1.6;
}

.refine-cost-card {
  overflow: hidden;
  border: 1px solid #b69b72;
  border-radius: 8px;
  background: #fffdf7;
  box-shadow: 0 6px 16px rgba(74, 55, 31, .06);
}

.refine-cost-card--target {
  border-color: #704816;
  box-shadow: 0 0 0 2px rgba(112, 72, 22, .12), 0 8px 20px rgba(74, 55, 31, .1);
}

.refine-cost-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid #c9ae82;
  background: #e5d4b7;
}

.refine-cost-card > header div {
  display: grid;
  gap: 2px;
}

.refine-cost-card > header span {
  color: #704816;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
}

.refine-cost-card > header h4 {
  margin: 0;
  color: #302419;
  font-size: 24px;
}

.refine-cost-card > header > strong {
  color: #4a3520;
  font-size: clamp(18px, 2vw, 25px);
  text-align: right;
}

.refine-upgrade-plan {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #8b6a3d;
  background: #4a3520;
  color: #fff8e8;
}

.refine-upgrade-plan strong {
  align-self: start;
  padding: 6px 10px;
  border: 1px solid #e7c47e;
  border-radius: 999px;
  background: #f1d28e;
  color: #3a2918;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: .04em;
}

.refine-upgrade-steps {
  display: grid;
  gap: 5px;
}

.refine-upgrade-steps span {
  position: relative;
  padding-left: 20px;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.5;
}

.refine-upgrade-steps span::before {
  position: absolute;
  left: 0;
  color: #f1d28e;
  content: "➜";
}

.refine-upgrade-steps b {
  display: inline-block;
  min-width: 84px;
  margin-right: 8px;
  color: #f1d28e;
  font-size: 16px;
  font-weight: 950;
}

.refine-step-token-count {
  display: inline-block;
  margin-left: 8px;
  color: #ffd98b;
  font-style: normal;
  font-weight: 950;
}

.refine-upgrade-steps .refine-token-total {
  margin-top: 5px;
  padding: 8px 12px 8px 32px;
  border: 1px solid #e7c47e;
  border-radius: 4px;
  background: #fff3cf;
  color: #6f321e;
  font-size: 17px;
  font-weight: 950;
}

.refine-upgrade-steps .refine-token-total::before {
  left: 11px;
  color: #9b541f;
}

.refine-upgrade-steps .refine-token-total b {
  color: #6f321e;
}

.refine-cost-materials {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.refine-cost-materials li {
  display: grid;
  grid-template-columns: 54px minmax(180px, 1fr) minmax(96px, .35fr) minmax(220px, .75fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 10px 18px;
  border-bottom: 1px solid #e1d2ba;
}

.refine-cost-materials li:last-child {
  border-bottom: 0;
}

.refine-material-icon {
  display: grid;
  width: 48px;
  height: 48px;
  overflow: hidden;
  place-items: center;
}

.refine-material-icon img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: auto;
}

.refine-material-icon--fee {
  border: 2px solid #704816;
  border-radius: 50%;
  color: #704816;
  font-size: 20px;
  font-weight: 950;
}

.refine-material-name {
  display: grid;
  gap: 3px;
}

.refine-material-name strong {
  color: #302419;
  font-size: 16px;
}

.refine-material-name small {
  color: #76634c;
  font-size: 12px;
}

.refine-material-quantity,
.refine-material-cost {
  color: #4a3520;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.refine-material-cost {
  font-size: 15px;
}

@media (max-width: 900px) {
  .refine-form-group .dense-form,
  .refine-equipment-settings.is-normal-material-hidden .dense-form,
  .refine-market-settings .dense-form,
  .refine-market-settings.is-basic-target .dense-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .refine-form-group .dense-form,
  .refine-form-group .refine-goal-fields,
  .refine-equipment-settings.is-normal-material-hidden .dense-form,
  .refine-market-settings .dense-form,
  .refine-market-settings.is-basic-target .dense-form {
    grid-template-columns: 1fr;
  }

  .refine-results .result-row div {
    min-height: 88px;
  }

  .refine-results-heading,
  .refine-cost-card > header {
    display: grid;
  }

  .refine-cost-card > header > strong {
    text-align: left;
  }

  .refine-upgrade-plan {
    grid-template-columns: 1fr;
  }

  .refine-upgrade-plan strong {
    width: fit-content;
  }

  .refine-cost-materials li {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .refine-material-quantity,
  .refine-material-cost {
    grid-column: 2;
    text-align: left;
  }
}

/* Quest page hierarchy: summary, region, and each NPC stop stay distinct. */
[data-view-panel="quests"] .quest-level-toggle {
  margin: 18px 0;
}

[data-view-panel="quests"] .quest-level-toggle button[aria-selected="true"] {
  border-color: #5a4128;
  background: #5a4128;
  color: #fff9eb;
}

[data-view-panel="quests"] .quest-summary article {
  min-height: 112px;
  border: 1px solid #a98958;
  background: #fffaf0;
  box-shadow: 0 6px 16px rgba(74, 55, 31, .06);
}

[data-view-panel="quests"] .quest-summary span {
  color: #574a3c;
  font-weight: 750;
}

[data-view-panel="quests"] .quest-summary strong {
  align-self: end;
  color: #302419;
  font-size: 34px;
}

[data-view-panel="quests"] .quest-level-group {
  border-color: #a98958;
  background: #f1e3cb;
}

[data-view-panel="quests"] .quest-level-heading {
  border-bottom-color: #b69b72;
}

[data-view-panel="quests"] .quest-level-heading > strong,
[data-view-panel="quests"] .quest-region header > strong {
  border: 1px solid #9e7a47;
  background: #e5d4b7;
  color: #4a3520;
}

[data-view-panel="quests"] .quest-region {
  border-color: #a98958;
  background: #fffaf0;
  box-shadow: 0 8px 20px rgba(74, 55, 31, .08);
}

[data-view-panel="quests"] .quest-location {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #b69b72;
  background: #fffdf7;
}

[data-view-panel="quests"] .quest-location-meta {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(160px, max-content);
  align-items: center;
  gap: 8px 18px;
  min-width: 0;
  padding: 12px 16px;
  border-right: 0;
  border-bottom: 1px solid #c9ae82;
  background: #e5d4b7;
}

[data-view-panel="quests"] .quest-location-meta strong {
  color: #302419;
  font-size: 18px;
}

[data-view-panel="quests"] .quest-location-meta span {
  color: #65513b;
}

[data-view-panel="quests"] .quest-location-meta em {
  color: #5a4128;
}

[data-view-panel="quests"] .quest-location-body {
  padding: 16px;
  background: #fffdf7;
}

[data-view-panel="quests"] .quest-location li {
  color: #302d29;
  font-size: 16px;
  line-height: 1.75;
}

[data-view-panel="quests"] .quest-location li::marker {
  color: #704816;
}

[data-view-panel="quests"] .quest-image-grid img {
  border-color: #9e7a47;
  background: #f3e7d1;
}

[data-view-panel="quests"] .quest-image-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

[data-view-panel="quests"] .quest-location-separator {
  color: #704816;
  font-size: 24px;
  font-weight: 900;
}

[data-view-panel="quests"] .quest-warning {
  border: 1px solid #c29958;
  background: #f1e3cb;
  color: #4a3520;
}

@media (max-width: 720px) {
  [data-view-panel="quests"] .quest-location,
  [data-view-panel="quests"] .quest-location-meta {
    grid-template-columns: 1fr;
  }

  [data-view-panel="quests"] .quest-location-meta {
    gap: 4px;
  }
}

/* Official log: group repeated dates and keep each announcement visually light. */
[data-view-panel="log"] .site-log-list {
  gap: 20px;
}

.site-log-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 18px auto 0;
}

.site-log-pagination[hidden] {
  display: none;
}

.site-log-pagination button {
  min-width: 118px;
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid #704816;
  border-radius: 5px;
  background: #fffdf7;
  color: #302419;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
}

.site-log-page-numbers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-log-page-numbers button {
  width: 44px;
  min-width: 44px;
  padding-inline: 8px;
  border: 0;
  background: transparent;
}

.site-log-page-numbers button[aria-current="page"] {
  background: #654425;
  color: #fffdf7;
}

.site-log-page-ellipsis {
  display: inline-flex;
  width: 16px;
  justify-content: center;
  color: #5c5348;
  font-weight: 800;
}

.site-log-pagination button:hover:not(:disabled),
.site-log-pagination button:focus-visible {
  border-color: #8c6331;
  background: #f1e3cb;
}

.site-log-pagination button:disabled {
  border-color: #b9aa92;
  background: #e8dfcf;
  color: #756c60;
  cursor: not-allowed;
}

@media (max-width: 620px) {
  .site-log-pagination {
    flex-wrap: wrap;
    gap: 10px;
  }

  .site-log-pagination > button {
    flex: 1 1 120px;
  }

  .site-log-page-numbers {
    order: -1;
    flex: 1 0 100%;
    justify-content: center;
  }
}

.site-log-day {
  overflow: hidden;
  border: 1px solid #b69b72;
  border-radius: 4px;
  background: #fffdf7;
  box-shadow: 0 8px 20px rgba(74, 55, 31, .06);
}

.site-log-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #c9ae82;
  background: #e5d4b7;
}

.site-log-day-head strong {
  color: #302419;
  font-size: 18px;
}

.site-log-day-head span {
  color: #65513b;
  font-size: 13px;
  font-weight: 750;
}

.site-log-day-events {
  display: grid;
}

[data-view-panel="log"] .site-log-item {
  display: block;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #dfd1b9;
  border-radius: 0;
  background: #fffdf7;
  box-shadow: none;
}

[data-view-panel="log"] .site-log-item:last-child {
  border-bottom: 0;
}

[data-view-panel="log"] .site-log-body {
  padding: 18px;
}

.site-log-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.site-log-heading span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid #9e7a47;
  border-radius: 3px;
  background: #f1e3cb;
  color: #4a3520;
  font-size: 12px;
  font-weight: 800;
}

.site-log-heading h3 {
  margin: 0;
  color: #302d29;
  font-size: 18px;
}

/* Hugel quests: long-form field notes, grouped by prerequisite and daily routes. */
[data-view-panel="quests"] .hugel-quest-section {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  padding: 20px;
  border: 1px solid #a98958;
  background: #f1e3cb;
  box-shadow: inset 0 0 0 5px #f4ecdc, 0 12px 24px rgba(74, 55, 31, .08);
}

[data-view-panel="quests"] .hugel-quest-section > header,
[data-view-panel="quests"] .hugel-quest-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

[data-view-panel="quests"] .hugel-quest-section > header {
  padding-bottom: 12px;
  border-bottom: 1px solid #b69b72;
}

[data-view-panel="quests"] .hugel-quest-section h3,
[data-view-panel="quests"] .hugel-quest-card h4 {
  margin: 0;
  color: #302419;
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
}

[data-view-panel="quests"] .hugel-quest-section h3 { font-size: 30px; }
[data-view-panel="quests"] .hugel-quest-section p,
[data-view-panel="quests"] .hugel-quest-card header p { margin: 6px 0 0; color: #65513b; }

[data-view-panel="quests"] .hugel-quest-section > header > strong,
[data-view-panel="quests"] .hugel-quest-card > header > strong {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid #9e7a47;
  background: #e5d4b7;
  color: #4a3520;
  font-weight: 800;
}

[data-view-panel="quests"] .hugel-quest-list { display: grid; gap: 14px; }

[data-view-panel="quests"] .hugel-quest-card {
  display: grid;
  gap: 14px;
  padding: 17px;
  border: 1px solid #b69b72;
  background: #fffdf7;
  --hugel-flow-color: #8d5c1c;
  --hugel-flow-wash: #f7ead6;
}

[data-view-panel="quests"] .hugel-quest-card--token { --hugel-flow-color: #9b6b17; --hugel-flow-wash: #fff1ca; }
[data-view-panel="quests"] .hugel-quest-card--pride { --hugel-flow-color: #a65435; --hugel-flow-wash: #fde3d7; }
[data-view-panel="quests"] .hugel-quest-card--house { --hugel-flow-color: #70528a; --hugel-flow-wash: #eee2f4; }
[data-view-panel="quests"] .hugel-quest-card--delivery { --hugel-flow-color: #2d6f86; --hugel-flow-wash: #dceff3; }
[data-view-panel="quests"] .hugel-quest-card--festival { --hugel-flow-color: #9a4963; --hugel-flow-wash: #f7dfe7; }

[data-view-panel="quests"] .hugel-quest-card h4 { font-size: 22px; }

[data-view-panel="quests"] .hugel-quest-flow { display: grid; gap: 8px; }

[data-view-panel="quests"] .hugel-quest-flow-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid #c3a980;
  border-left: 5px solid var(--hugel-flow-color);
  background: linear-gradient(90deg, var(--hugel-flow-wash), #fffdf7 36%);
}

[data-view-panel="quests"] .hugel-quest-flow-step-number {
  display: grid;
  place-items: center;
  align-self: start;
  min-height: 32px;
  border-radius: 50%;
  background: var(--hugel-flow-color);
  color: #fffdf7;
  font-weight: 900;
}

[data-view-panel="quests"] .hugel-quest-flow-step-body { min-width: 0; }
[data-view-panel="quests"] .hugel-quest-flow-step-body p { margin: 0; color: #302d29; font-size: 17px; line-height: 1.75; }

[data-view-panel="quests"] .hugel-quest-flow-arrow {
  display: grid;
  place-items: center;
  min-height: 24px;
  color: var(--hugel-flow-color);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 0 #fffdf7;
}

[data-view-panel="quests"] .hugel-quest-flow-arrow--branch { min-height: 18px; }

[data-view-panel="quests"] .hugel-quest-flow-branches {
  padding: 14px;
  border: 1px dashed var(--hugel-flow-color);
  background: color-mix(in srgb, var(--hugel-flow-wash) 62%, #fffdf7);
}

[data-view-panel="quests"] .hugel-quest-flow-branches-label {
  margin: 0;
  color: var(--hugel-flow-color);
  font-weight: 900;
  text-align: center;
}

[data-view-panel="quests"] .hugel-quest-flow-branch-arrows {
  display: grid;
  grid-template-columns: repeat(var(--hugel-branch-count, 4), 1fr);
  margin: 2px 8px 4px;
  color: var(--hugel-flow-color);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

[data-view-panel="quests"] .hugel-quest-flow-branch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

[data-view-panel="quests"] .hugel-quest-flow-branch {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--hugel-flow-color) 58%, #fffdf7);
  background: #fffdf7;
}

[data-view-panel="quests"] .hugel-quest-flow-branch h5 {
  margin: 0 0 3px;
  color: var(--hugel-flow-color);
  font-size: 18px;
}

[data-view-panel="quests"] .hugel-quest-flow-branch p { margin: 0; color: #302d29; font-size: 16px; line-height: 1.65; }

[data-view-panel="quests"] .hugel-quest-flow-branch .hugel-quest-flow-images { margin-top: 10px; }

[data-view-panel="quests"] .hugel-quest-flow-branch .hugel-quest-flow-image-card { width: 100%; max-width: none; }

[data-view-panel="quests"] .hugel-quest-flow-arrow--merge {
  gap: 2px;
  min-height: 36px;
  font-size: 30px;
}

[data-view-panel="quests"] .hugel-quest-flow-arrow--merge span { font-size: 13px; font-weight: 800; }

[data-view-panel="quests"] .hugel-quest-flow-images {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

[data-view-panel="quests"] .hugel-quest-flow-image-arrow {
  color: var(--hugel-flow-color);
  font-size: 29px;
  font-weight: 900;
  line-height: 1;
}

[data-view-panel="quests"] .hugel-quest-flow-image-card {
  display: grid;
  align-content: start;
  gap: 7px;
  width: min(100%, 208px);
  min-width: 0;
}

[data-view-panel="quests"] .hugel-quest-flow-image {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 5px;
  border: 1px solid var(--hugel-flow-color);
  background: #fffdf7;
  color: #5a4128;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  cursor: zoom-in;
}

[data-view-panel="quests"] .hugel-quest-flow-image:hover,
[data-view-panel="quests"] .hugel-quest-flow-image:focus-visible {
  outline: 3px solid #e5bb58;
  outline-offset: 2px;
}

[data-view-panel="quests"] .hugel-quest-flow-image img {
  display: block;
  width: 100%;
  height: 118px;
  object-fit: cover;
  object-position: center;
}

[data-view-panel="quests"] .quest-navi-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}

[data-view-panel="quests"] .quest-navi-row code {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid #b69b72;
  background: #f3e7d1;
  color: #3f2d1d;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

[data-view-panel="quests"] .quest-navi-copy-slot {
  display: grid;
  width: 62px;
  min-height: 44px;
}

[data-view-panel="quests"] .quest-navi-copy,
[data-view-panel="quests"] .quest-navi-copied {
  grid-area: 1 / 1;
  width: 100%;
  min-height: 44px;
  border: 1px solid #8c6937;
}

[data-view-panel="quests"] .quest-navi-copy {
  display: grid;
  place-items: center;
  padding: 0;
  background: #5a4128;
  color: #fff9eb;
  cursor: pointer;
}

[data-view-panel="quests"] .quest-navi-copy:hover,
[data-view-panel="quests"] .quest-navi-copy:focus-visible {
  outline: 3px solid #e5bb58;
  outline-offset: 2px;
  background: #704816;
}

[data-view-panel="quests"] .quest-navi-copy svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

[data-view-panel="quests"] .quest-navi-copied {
  display: grid;
  place-items: center;
  padding: 3px;
  background: #e4efdc;
  color: #245c2d;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

[data-view-panel="quests"] .quest-navi-copy-slot [hidden] { display: none; }

.quest-image-lightbox {
  width: min(92vw, 1120px);
  max-height: 92vh;
  padding: 14px;
  border: 2px solid #8c6937;
  background: #fffaf0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.quest-image-lightbox::backdrop { background: rgba(30, 22, 14, .76); }
.quest-image-lightbox img { display: block; width: auto; max-width: 100%; max-height: calc(92vh - 88px); margin: 0 auto; }
.quest-image-lightbox p { margin: 10px 42px 0 0; color: #45372a; font-weight: 800; }

.quest-image-lightbox-close {
  float: right;
  width: 36px;
  height: 36px;
  border: 1px solid #8c6937;
  background: #5a4128;
  color: #fff9eb;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 720px) {
  [data-view-panel="quests"] .hugel-quest-section,
  [data-view-panel="quests"] .hugel-quest-card { padding: 14px; }
  [data-view-panel="quests"] .hugel-quest-section > header,
  [data-view-panel="quests"] .hugel-quest-card > header { display: grid; }
  [data-view-panel="quests"] .hugel-quest-section h3 { font-size: 26px; }
  [data-view-panel="quests"] .hugel-quest-card h4 { font-size: 20px; }
  [data-view-panel="quests"] .hugel-quest-flow-step { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 10px; }
  [data-view-panel="quests"] .hugel-quest-flow-step-body p { font-size: 16px; }
  [data-view-panel="quests"] .hugel-quest-flow-branches { padding: 10px; }
  [data-view-panel="quests"] .hugel-quest-flow-branch-grid { grid-template-columns: 1fr; }
  [data-view-panel="quests"] .hugel-quest-flow-branch-arrows { display: none; }
  [data-view-panel="quests"] .hugel-quest-flow-image-card { width: 100%; }
  [data-view-panel="quests"] .hugel-quest-flow-image-arrow { width: 100%; text-align: center; transform: rotate(90deg); }
  [data-view-panel="quests"] .hugel-quest-flow-image img { height: auto; max-height: 220px; }
}

[data-view-panel="log"] .site-log-body p a,
[data-view-panel="log"] .site-log-links a {
  color: #0b57b7;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

[data-view-panel="log"] .site-log-body p a:hover,
[data-view-panel="log"] .site-log-body p a:focus-visible,
[data-view-panel="log"] .site-log-links a:hover,
[data-view-panel="log"] .site-log-links a:focus-visible {
  color: #073f86;
  background: #e7f0ff;
  outline: 2px solid #7aa7e8;
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .effect-value-list {
    grid-template-columns: 1fr;
  }
}

.site-log-links {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding-left: 22px;
  color: #574a3c;
}

.site-log-links li {
  padding-left: 2px;
  line-height: 1.55;
}

.site-log-links li::marker {
  color: #704816;
}

.site-log-details {
  display: grid;
  gap: 5px;
  margin: 12px 0 0;
  padding-left: 20px;
  color: #574a3c;
}

.site-log-details li {
  line-height: 1.65;
}

.site-log-details li::marker {
  color: #704816;
}

@media (max-width: 560px) {
  .site-log-heading {
    display: grid;
  }

  .site-log-heading span {
    width: fit-content;
  }
}

/* About page: editorial rows instead of stacked content cards. */
.about-shell {
  width: min(920px, calc(100% - 32px));
  gap: 0;
}

.about-shell > .legal-back {
  margin-bottom: 28px;
}

.about-hero {
  padding-bottom: 26px;
}

.about-kicker {
  display: block;
  margin-bottom: 8px;
  color: #704816;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .12em;
}

.about-hero .legal-lead {
  max-width: 720px;
  margin-top: 14px;
  color: #574a3c;
}

.about-section-list {
  border-top: 1px solid #c9ae82;
}

.about-section-list > section {
  display: grid;
  grid-template-columns: minmax(140px, 190px) minmax(0, 1fr);
  gap: 28px;
  padding: 24px 0;
  border-top: 0;
  border-bottom: 1px solid #dfd1b9;
}

.about-section-list h2 {
  color: #302419;
}

.about-section-list p {
  color: #574a3c;
}

.about-section-list .about-report {
  margin: 22px 0;
  padding: 20px;
  border-bottom: 0;
  border-radius: 4px;
  background: #f1e3cb;
}

.about-report > div {
  display: grid;
  gap: 12px;
}

.about-report .legal-action {
  margin-top: 0;
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  padding: 18px 0;
  border-top: 1px solid #c9ae82;
}

.about-links a {
  color: #704816;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.about-shell .legal-updated {
  padding-top: 14px;
}

@media (max-width: 640px) {
  .about-shell {
    margin: 16px auto;
  }

  .about-section-list > section {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* In-app about view keeps the dashboard shell instead of opening a new page. */
.about-panel .about-intro {
  max-width: 760px;
  margin: 18px 0 24px;
  color: #574a3c;
  font-size: 18px;
  line-height: 1.8;
}

.about-panel .about-section-list p {
  margin: 0;
  line-height: 1.8;
}

.about-panel .about-links {
  margin-top: 4px;
}

.about-panel .legal-updated {
  margin: 0;
  color: #6c5b48;
  font-size: 12px;
}

/* Site-wide comfortable type scale for dense data and interactive controls. */
body {
  font-size: 18px;
  font-weight: 500;
}

.side-nav a {
  font-size: 19px;
}

.label {
  font-size: 14px;
}

label {
  font-size: 16px;
}

input,
select {
  min-height: 44px;
  font-size: 17px;
}

.view-toggle button {
  min-height: 44px;
  font-size: 17px;
}

.field-note,
.data-count,
.equipment-catalog-note,
.quest-source-note,
.legal-updated,
.relic-exchange small,
.relic-requirement small,
.rune-book-row small,
.rune-book-header p,
.lava-equipment-title small,
.lava-equipment-detail footer small,
.data-table small {
  font-size: 15px;
}

.instance-card span,
.instance-card small,
.relic-cards span,
.relic-cards small,
.mini-list span {
  font-size: 15px;
}

.data-table {
  font-size: 17px;
}

.data-table th {
  font-size: 15px;
}

.check-chip {
  min-height: 40px;
  padding: 7px 11px;
  font-size: 16px;
}

.pill,
.source-badge,
.relic-type,
.relic-npc-icon,
.site-log-heading span,
.site-log-day-head span {
  font-size: 15px;
}

.about-panel .legal-updated {
  font-size: 15px;
}

.instance-card strong {
  font-size: 18px;
}

.instance-card em {
  font-size: 16px;
}

.legal-lead,
.about-panel .about-intro,
.refine-results h3,
[data-view-panel="quests"] .quest-location-meta strong,
.site-log-day-head strong,
.site-log-heading h3,
.lava-equipment-title strong,
.monster-card-head strong,
.rune-fragment-focus strong,
.side-logo-sub {
  font-size: 19px;
}

@media (max-width: 560px) {
  body {
    font-size: 17px;
  }

  .side-nav a {
    font-size: 18px;
  }
}

.forging-affix-panel {
  margin: 22px 0;
}

.forging-affix-image {
  display: block;
  width: min(100%, 766px);
  height: auto;
  border: 1px solid var(--border, #b69b72);
  background: #fff;
}

.enchant-stone-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.enchant-stone-overview section {
  display: grid;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--line, #b69b72);
  border-radius: 8px;
  background: var(--soft, #f4ead9);
}

.enchant-stone-overview strong {
  color: #704816;
  font-size: 25px;
  line-height: 1.1;
}

.enchant-stone-overview span {
  color: #5c5348;
  font-size: 15px;
}

.enchant-stone-search-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 220px);
  gap: 12px;
}

.enchant-stone-category-tabs {
  margin-top: 12px;
}

.enchant-stone-category-tabs button span {
  display: inline-block;
  min-width: 25px;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.72);
  color: #5a4128;
  font-size: 14px;
}

.enchant-stone-category-tabs button.active span {
  background: #fffdf7;
}

.enchant-stone-table-wrap {
  margin-top: 18px;
}

.enchant-stone-table {
  min-width: 660px;
}

.enchant-stone-table th:first-child,
.enchant-stone-table td:first-child {
  width: 270px;
}

.enchant-stone-identity {
  display: grid;
  align-content: start;
  gap: 9px;
}

.enchant-stone-identity > strong {
  color: #2c2823;
  font-size: 18px;
  line-height: 1.4;
}

.enchant-stone-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.enchant-stone-kind,
.enchant-stone-slot {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid #b69b72;
  border-radius: 999px;
  background: #e5d4b7;
  color: #5a4128;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.enchant-stone-slot {
  background: #5a4128;
  color: #fffdf7;
}

.enchant-stone-table .effect-item {
  padding: 3px 0;
  border-bottom: 0;
}

.enchant-stone-table .effect-value-list {
  grid-template-columns: 1fr;
  gap: 5px;
  color: #2c2823;
  font-size: 17px;
}

.enchant-stone-table .effect-value-list > span {
  position: relative;
  padding-left: 17px;
}

.enchant-stone-table .effect-value-list > span::before {
  position: absolute;
  left: 1px;
  content: "•";
  color: #704816;
  font-weight: 800;
}

.enchant-stone-box-row td {
  background: #f4ead9;
}

.enchant-stone-box-contents details {
  min-width: 0;
}

.enchant-stone-box-contents summary {
  min-height: 44px;
  color: #5a4128;
  cursor: pointer;
  font-size: 17px;
  font-weight: 800;
  line-height: 44px;
}

.enchant-stone-box-contents summary:focus-visible {
  outline: 3px solid #704816;
  outline-offset: 3px;
}

.enchant-stone-box-contents ul {
  columns: 2;
  column-gap: 28px;
  margin: 7px 0 3px;
  padding-left: 22px;
}

.enchant-stone-box-contents li {
  break-inside: avoid;
  margin-bottom: 5px;
}

@media (max-width: 900px) {
  .enchant-stone-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .enchant-stone-category-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    overflow: visible;
  }

  .enchant-stone-category-tabs button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 7px 8px;
    white-space: normal;
    line-height: 1.25;
  }
}

@media (max-width: 620px) {
  .enchant-stone-overview,
  .enchant-stone-search-row {
    grid-template-columns: 1fr;
  }

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

  .enchant-stone-category-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .enchant-stone-table {
    min-width: 0;
  }

  .enchant-stone-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
  }

  .enchant-stone-table,
  .enchant-stone-table tbody,
  .enchant-stone-table tr,
  .enchant-stone-table td {
    display: block;
    width: 100%;
  }

  .enchant-stone-table tr {
    border-bottom: 1px solid #b69b72;
  }

  .enchant-stone-table td:first-child {
    width: 100%;
    padding-bottom: 7px;
    border-bottom: 0;
  }

  .enchant-stone-table td:last-child {
    padding-top: 4px;
  }

  .enchant-stone-identity {
    gap: 7px;
  }

  .enchant-stone-box-contents ul {
    columns: 1;
  }
}

/* Keep the calculator's four columns within the content panel. */
.crafting-cost-table {
  min-width: 0 !important;
  table-layout: fixed;
}

#crafting-feature-route-field[hidden] {
  display: none;
}

.crafting-feature-category-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.crafting-feature-category-cards .instance-card {
  min-height: 82px;
  padding: 12px 42px 12px 14px;
}

@media (max-width: 720px) {
  .crafting-feature-category-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

.crafting-price-input input[type="number"] {
  min-height: 68px;
  padding-bottom: 28px;
}

.quest-hugel-category-toggle[hidden] {
  display: none;
}

#quest-source-note .quest-guild-recruitment {
  color: #1559b7;
}

#quest-source-note.quest-source-note--abyss {
  padding: 18px 20px;
  border: 1px solid #b69b72;
  border-left: 5px solid #704816;
  background: #f4ead9;
  color: #2c2823;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.7;
  white-space: pre-line;
}
