/* Gorgon's Vault — layout and feature-panel styles. */

:root {
  /* WCAG 3.5:1 minimum contrast for text/background. */
  --bg: #1a1b26;
  --surface: #24283b;
  --text: #c0caf5;
  --muted: #8b94b8; /* brightened from #565f89 for 3.5:1+ on --bg */
  --accent: #7aa2f7;
  --love: #f7768e;
  --like: #9ece6a;
  --border: #3b4261;
}

* {
  box-sizing: border-box;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  z-index: 1000;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0.5rem;
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .skip-link {
    transition: none;
  }
}

/* Keyboard focus visible for interactive elements (no outline on mouse click). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 1rem 1.5rem;
  line-height: 1.5;
  min-height: 100vh;
}

header.site-header {
  position: relative;
  margin-bottom: 1.5rem;
}

header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.75rem;
  font-weight: 700;
}

.header-feedback-link {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
}

.header-feedback-link:hover {
  text-decoration: underline;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

main {
  max-width: min(80vw, 96rem);
  margin: 0 auto;
}

section {
  margin-bottom: 1.75rem;
}

section h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
}

.data-load .file-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.data-load label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.data-load label span {
  font-size: 0.9rem;
  color: var(--muted);
}

.data-load input[type="file"] {
  padding: 0.4rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.data-load input[type="file"]::file-selector-button {
  margin-right: 0.5rem;
  padding: 0.3rem 0.5rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.data-load .example-files-note {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.75rem 0 0.35rem 0;
}

.data-load .example-files-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.data-load .example-btn {
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  min-height: 36px;
}

.status {
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.4em;
}

/* Center controls/headers above outputs (not the outputs themselves) */
.selectors {
  text-align: center;
}

.selectors h2 {
  margin-left: auto;
  margin-right: auto;
}

.selectors .dropdowns {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  justify-content: center;
}

.selectors label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.selectors label span {
  font-size: 0.9rem;
  color: var(--muted);
}

.selectors select {
  padding: 0.5rem 0.65rem;
  min-width: 12rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
}

.selectors select:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.results h2 {
  margin-bottom: 0.5rem;
}

.npc-favor {
  margin-bottom: 1rem;
}

.npc-favor .favor-level {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.npc-wiki-link {
  color: var(--accent, #0a7ea4);
  text-decoration: underline;
}

.npc-wiki-link:hover {
  text-decoration: none;
}

.npc-favor .favor-unknown {
  font-weight: normal;
  color: var(--muted);
}

.results h2 {
  text-align: center;
}

.results .no-matches {
  text-align: center;
}

.results-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}

.results-list .city-group {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0; /* Grid gap controls spacing. */
}

.city-group {
  margin-bottom: 1.5rem;
}

.city-group:last-child {
  margin-bottom: 0;
}

.city-heading {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.vault-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.results-list .vault-block {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0.5rem 0 0;
}

.results-list .vault-block:first-of-type {
  padding-top: 0;
}

.vault-block .vault-city {
  margin: 0 0 0.25rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.vault-block .vault-name {
  margin: 0 0 0.75rem 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.vault-block h3:last-of-type {
  margin-bottom: 0.75rem;
}

.desire-section {
  margin-bottom: 0.75rem;
}

.desire-section:last-child {
  margin-bottom: 0;
}

.desire-section h4 {
  margin: 0 0 0.4rem 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.desire-section.love h4 {
  color: var(--love);
}

.desire-section.like h4 {
  color: var(--like);
}

.desire-section ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.desire-section li {
  margin: 0.2rem 0;
  font-size: 0.9rem;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.item-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.item-text {
  flex: 1;
}


.no-matches {
  color: var(--muted);
  font-style: italic;
  margin: 0;
}

.cdn-error {
  background: var(--surface);
  border: 1px solid var(--love);
  border-radius: 8px;
  padding: 1rem;
}

.cdn-error h2 {
  color: var(--love);
  margin-top: 0;
}

.cdn-error code {
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.cdn-error a {
  color: var(--accent);
}

footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

footer p {
  margin: 0;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Feature tabs — 44px+ touch targets, mobile-friendly */
.feature-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.feature-tabs .tab {
  min-height: 44px;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
  border-radius: 6px 6px 0 0;
}

.feature-tabs .tab:hover {
  color: var(--text);
  background: var(--surface);
}

.feature-tabs .tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.feature-tabs .tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.feature-panel {
  display: block;
}

.feature-panel.hidden {
  display: none;
}

.panel-desc {
  margin: 0 0 1rem 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.intro-panel .intro-content {
  max-width: 42rem;
}

.intro-panel .intro-content h2 {
  margin-top: 0;
}

.intro-panel .intro-content h3 {
  margin: 1.5rem 0 0.5rem 0;
  font-size: 1.1rem;
}

.intro-panel .intro-tab-list {
  margin: 0 0 1rem 0;
  padding-left: 1.5rem;
}

.intro-panel .intro-tab-list li {
  margin-bottom: 0.5rem;
}

.primary-btn {
  min-height: 44px;
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-btn {
  min-height: 44px;
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.secondary-btn:hover {
  background: var(--border);
  color: var(--text);
}

.secondary-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Storage Saver results */
.storage-saver-results {
  margin-top: 1rem;
}

.storage-saver-total {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent, #0a7ea4);
  padding: 0.75rem 0;
}

.storage-saver-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.storage-saver-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.storage-saver-item-header .item-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.storage-saver-item h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.storage-saver-item .save-count {
  font-size: 0.9rem;
  color: var(--like);
  margin-bottom: 0.5rem;
}

.storage-saver-item ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.storage-saver-item li {
  margin: 0.2rem 0;
}

.storage-saver-results .no-duplicates {
  color: var(--muted);
  font-style: italic;
}

.storage-saver-tip {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.25rem;
  margin-bottom: 1rem;
}

/* Storage Saver: center header/controls above results */
.storage-saver > h2,
.storage-saver > .panel-desc,
.storage-saver > .storage-saver-tip,
.storage-saver > .storage-saver-trip-note,
.storage-saver > .status {
  text-align: center;
}

.storage-saver-trip-note {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.storage-saver-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.storage-saver-results .storage-saver-total {
  grid-column: 1 / -1;
}

.trip-plan-tab-link {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-weight: 600;
  color: var(--accent, #0a7ea4);
  cursor: pointer;
  text-decoration: underline;
}

.trip-plan-tab-link:hover {
  text-decoration: none;
}

/* Trip plan: center header/controls above output */
.trip-planner-panel > h2,
.trip-planner-panel .trip-planner-desc,
.trip-planner-panel .trip-planner-stops,
.trip-planner-panel .trip-planner-actions {
  text-align: center;
  justify-content: center;
}

.trip-planner-panel .trip-planner-stops {
  justify-content: center;
}

.trip-planner-panel .trip-planner-desc {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.trip-planner-desc {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.trip-planner-stops {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.trip-planner-stop {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.trip-planner-stops label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.trip-planner-stops select {
  min-width: 10rem;
}

.trip-planner-remove-stop {
  flex-shrink: 0;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.trip-planner-remove-stop:hover {
  color: var(--text);
  background: var(--bg);
}

.trip-planner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.trip-planner-output {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.trip-planner-output .trip-planner-total {
  grid-column: 1 / -1;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent, #0a7ea4);
  padding: 0.75rem 0;
  margin: 0;
}

.trip-planner-output .trip-planner-leg {
  min-width: 0;
}

.trip-planner-output .trip-planner-empty {
  grid-column: 1 / -1;
}

.trip-planner-output h4 {
  margin: 1rem 0 0.5rem 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-left: 3px solid var(--accent, #0a7ea4);
  border-radius: 0 4px 4px 0;
}

.trip-planner-output h4:first-child {
  margin-top: 0;
}

.trip-planner-output ul {
  margin: 0 0 0.75rem 0;
  padding-left: 1.25rem;
}

.trip-planner-output li {
  margin: 0.2rem 0;
}

.trip-planner-output .trip-planner-empty {
  color: var(--muted);
  margin: 0;
}

.trip-planner-output .trip-planner-subhead {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0.5rem 0 0.25rem 0;
}

.trip-planner-output .trip-planner-vault-group {
  margin: 0.75rem 0 0 0;
}

.trip-planner-output .trip-planner-vault-group:first-of-type {
  margin-top: 0.25rem;
}

.trip-planner-output .trip-planner-vault-heading {
  font-weight: 600;
  font-size: 1rem;
  margin: 0 0 0.25rem 0;
  color: var(--text);
}

.trip-planner-output .trip-planner-vault-heading .npc-wiki-link {
  font-weight: 600;
}

.trip-planner-output .trip-planner-list {
  list-style: none;
  padding-left: 0;
  margin: 0 0 0.75rem 0;
}

.trip-planner-output .trip-planner-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
}

.trip-planner-output .trip-planner-item .item-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

@media (max-width: 72rem) {
  .results-list,
  .storage-saver-results,
  .trip-planner-output,
  .whats-this-for-match-list,
  .quest-turnins-results {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 48rem) {
  .results-list,
  .storage-saver-results,
  .trip-planner-output,
  .whats-this-for-match-list,
  .quest-turnins-results {
    grid-template-columns: 1fr;
  }
}

/* Full Inventory: center header/controls above output */
.full-inventory-panel > h2,
.full-inventory-panel .panel-desc {
  text-align: center;
}

.full-inventory-panel .full-inventory-controls {
  justify-content: center;
}

.full-inventory-panel .panel-desc {
  margin-bottom: 0.5rem;
}

.full-inventory-controls {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.full-inventory-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.full-inventory-controls label span {
  font-size: 0.9rem;
  color: var(--muted);
}

.full-inventory-controls select,
.full-inventory-controls input[type="search"] {
  padding: 0.5rem 0.65rem;
  min-width: 12rem;
  max-width: 20rem;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
}

.full-inventory-controls input[type="search"] {
  cursor: text;
  min-width: 14rem;
}

.full-inventory-name-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.full-inventory-item-name {
  font-weight: 600;
}

.full-inventory-description {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.35;
}

.full-inventory-effect-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.full-inventory-effect-descs {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: normal;
}

.full-inventory-mod-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.full-inventory-mod-descs {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: normal;
}

.effect-inline-icon {
  width: 1.25em;
  height: 1.25em;
  vertical-align: middle;
  display: inline-block;
}

.full-inventory-locations {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.full-inventory-location-line {
  font-size: 0.9rem;
}

.full-inventory-empty-category {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.full-inventory-results {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1rem;
}

.full-inventory-section {
  margin-bottom: 0;
}

.full-inventory-category-heading {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.full-inventory-table-wrap {
  overflow-x: auto;
}

.full-inventory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.full-inventory-table th,
.full-inventory-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.full-inventory-table thead th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.full-inventory-icon-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.full-inventory-icon-cell .full-inventory-rarity-badge {
  font-size: 0.8rem;
  padding: 0.15rem 0.35rem;
}

.full-inventory-skill-reqs {
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--muted);
  text-align: center;
  max-width: 5.5rem;
  word-break: break-word;
}

.full-inventory-table .item-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  vertical-align: middle;
}

.full-inventory-table td:nth-child(2) {
  max-width: 20rem;
  word-break: break-word;
}

.full-inventory-table td:last-child {
  max-width: 24rem;
  word-break: break-word;
}

.full-inventory-rarity-badge {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.full-inventory-rarity-badge.rarity-uncommon { background: rgba(76, 175, 80, 0.2); color: #81c784; }
.full-inventory-rarity-badge.rarity-rare { background: rgba(33, 150, 243, 0.2); color: #64b5f6; }
.full-inventory-rarity-badge.rarity-exceptional { background: rgba(156, 39, 176, 0.2); color: #ce93d8; }
.full-inventory-rarity-badge.rarity-epic { background: rgba(233, 30, 99, 0.2); color: #f48fb1; }
.full-inventory-rarity-badge.rarity-legendary { background: rgba(255, 152, 0, 0.25); color: #ffb74d; }

.full-inventory-mod-line-content {
  display: inline;
}

.full-inventory-mod-rarity-badge {
  display: inline-block;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-right: 0.2rem;
}

.full-inventory-mod-rarity-badge.rarity-uncommon { background: rgba(76, 175, 80, 0.2); color: #81c784; }
.full-inventory-mod-rarity-badge.rarity-rare { background: rgba(33, 150, 243, 0.2); color: #64b5f6; }
.full-inventory-mod-rarity-badge.rarity-exceptional { background: rgba(156, 39, 176, 0.2); color: #ce93d8; }
.full-inventory-mod-rarity-badge.rarity-epic { background: rgba(233, 30, 99, 0.2); color: #f48fb1; }
.full-inventory-mod-rarity-badge.rarity-legendary { background: rgba(255, 152, 0, 0.25); color: #ffb74d; }

@media (max-width: 48rem) {
  .full-inventory-table thead {
    display: none;
  }

  .full-inventory-table,
  .full-inventory-table tbody,
  .full-inventory-table tr,
  .full-inventory-table td {
    display: block;
  }

  .full-inventory-table tr {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .full-inventory-table td {
    padding: 0.35rem 0;
    border-bottom: none;
  }

  .full-inventory-table td:not(:first-child)::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    font-size: 0.8rem;
    display: block;
    margin-bottom: 0.15rem;
  }

  .full-inventory-table td:first-child {
    padding-bottom: 0.5rem;
  }

  .full-inventory-table td:first-child::before {
    content: none;
  }

  .full-inventory-table .item-icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
  }
}

/* Mod Finder: center header/controls above output */
.mod-finder-panel > h2,
.mod-finder-panel .panel-desc {
  text-align: center;
}

.mod-finder-panel .mod-finder-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mod-finder-panel .panel-desc {
  color: var(--muted);
  margin: 0 0 1rem 0;
  font-size: 0.95rem;
}

.mod-finder-controls {
  margin-bottom: 1.25rem;
}

.mod-finder-row-selectors {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mod-finder-row-selectors label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mod-finder-row-selectors label span {
  font-size: 0.9rem;
  color: var(--muted);
}

.mod-finder-row-selectors select {
  min-width: 10rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}

.mod-finder-slot-filter {
  margin: 0;
  padding: 0.5rem 0;
  border: none;
}

.mod-finder-slot-filter legend {
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.mod-finder-slot-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.mod-finder-slot-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.full-inventory-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.full-inventory-slot-filter {
  margin: 0;
  padding: 0;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.full-inventory-slot-filter legend {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: normal;
}

.full-inventory-slot-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  min-height: 44px;
  align-items: center;
}

.full-inventory-slot-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}

.mod-finder-results {
  margin-top: 1rem;
}

.mod-finder-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 768px) {
  .mod-finder-results-grid {
    grid-template-columns: 1fr;
  }
}

.mod-finder-slot-section {
  margin-bottom: 0;
  min-width: 0;
}

.mod-finder-slot-section h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

.mod-finder-mod-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mod-finder-mod-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.mod-finder-mod-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}

.mod-finder-mod-content {
  flex: 1;
  min-width: 0;
}

.mod-finder-mod-item:last-child {
  border-bottom: none;
}

.mod-finder-mod-content {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}

.mod-finder-mod-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.mod-finder-rarity-badge {
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.mod-finder-rarity-badge.rarity-uncommon { background: rgba(76, 175, 80, 0.2); color: #81c784; }
.mod-finder-rarity-badge.rarity-rare { background: rgba(33, 150, 243, 0.2); color: #64b5f6; }
.mod-finder-rarity-badge.rarity-exceptional { background: rgba(156, 39, 176, 0.2); color: #ce93d8; }
.mod-finder-rarity-badge.rarity-epic { background: rgba(233, 30, 99, 0.2); color: #f48fb1; }
.mod-finder-rarity-badge.rarity-legendary { background: rgba(255, 152, 0, 0.25); color: #ffb74d; }

.mod-finder-mod-effect {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.15rem 0 0 0;
  width: 100%;
}

.mod-finder-mod-effect .effect-inline-icon {
  vertical-align: middle;
  margin-right: 0.15rem;
}

@media (max-width: 640px) {
  .mod-finder-skill-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.back-to-top:hover {
  filter: brightness(1.1);
}

.back-to-top:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Item lookup links (clickable item names) */
.item-lookup-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.item-lookup-link:hover {
  text-decoration: none;
}

.item-row .item-lookup-link {
  font-weight: inherit;
}

.storage-saver-item-name.item-lookup-link {
  font-size: inherit;
  font-weight: 600;
}

/* What's this for? panel: center header/controls above output */
.whats-this-for-panel > h2,
.whats-this-for-panel .panel-desc,
.whats-this-for-panel > label {
  text-align: center;
}

.whats-this-for-panel > label {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.whats-this-for-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.whats-this-for-panel label span {
  font-size: 0.9rem;
  color: var(--muted);
}

.whats-this-for-panel input[type="search"] {
  padding: 0.5rem 0.65rem;
  min-width: 14rem;
  max-width: 24rem;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
}

.whats-this-for-results {
  margin-top: 1rem;
}

.whats-this-for-hint,
.whats-this-for-empty {
  color: var(--muted);
  margin: 0;
}

.whats-this-for-picker p {
  margin: 0 0 0.5rem 0;
}

.whats-this-for-match-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem 1rem;
}

.whats-this-for-match-list li {
  margin: 0;
}

/* Quest Turn-ins panel */
.quest-turnins-panel .panel-desc {
  text-align: center;
}

.quest-turnins-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
  justify-content: center;
}

.quest-turnins-filter-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.quest-turnins-controls label:has(select) {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.quest-turnins-controls label span:first-of-type {
  font-size: 0.9rem;
  color: var(--muted);
  margin-right: 0.35rem;
}

.quest-turnins-controls .quest-turnins-filter-row span {
  font-size: inherit;
  color: inherit;
  margin-right: 0;
}

.quest-turnins-controls select {
  padding: 0.5rem 0.65rem;
  min-width: 12rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
}

.quest-turnins-controls select:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.quest-turnins-map {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.25rem 0;
}

.quest-turnins-map-unknown {
  font-style: italic;
}

.quest-turnins-results {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.quest-turnins-quest {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  min-width: 0;
}

.quest-turnins-quest-name {
  margin: 0 0 0.35rem 0;
  font-size: 1.1rem;
}

.quest-turnins-npc {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.quest-turnins-npc .npc-wiki-link {
  font-weight: 600;
  color: var(--accent, #0a7ea4);
}

.quest-turnins-favor {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.quest-turnins-favor-unknown {
  font-style: italic;
}

.quest-turnins-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 0.95rem;
}

.quest-turnins-item {
  margin: 0.35rem 0;
}

.quest-turnins-item.item-row {
  margin-left: 0;
}

.quest-turnins-item .item-lookup-link {
  font-weight: 600;
}

.quest-turnins-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.quest-turnins-rewards-subhead {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0.5rem 0 0.25rem 0;
}

.quest-turnins-rewards-list {
  list-style: none;
  padding-left: 0;
  margin: 0 0 0.75rem 0;
}

.quest-turnins-reward-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.2rem 0;
}

.quest-turnins-rewards-list .quest-turnins-reward-item .item-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.quest-turnins-rewards-list .quest-turnins-reward-item .item-lookup-link {
  font-weight: 600;
}

.item-used-for-item-name {
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0 0 0.5rem 0;
}

.item-used-for-used-in {
  margin: 0.5rem 0 0.25rem 0;
  font-size: 0.95rem;
}

.item-used-for-empty {
  color: var(--muted);
  margin: 0.5rem 0 0 0;
}

.item-used-for-recipe-list {
  margin: 0.5rem 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-used-for-recipe-block {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
}

.item-used-for-recipe-name-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.item-used-for-recipe-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.item-used-for-recipe-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.item-used-for-recipe-ingredients,
.item-used-for-recipe-results {
  font-size: 0.9rem;
  margin-left: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.item-used-for-recipe-label {
  color: var(--muted);
  flex-shrink: 0;
}

.item-used-for-icon-name {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}

.item-used-for-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: middle;
}

/* Item used-for modal */
body.modal-open {
  overflow: hidden;
}

.item-used-for-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Modal [hidden]: display:none overrides .item-used-for-modal's display:flex so it stays hidden. */
.item-used-for-modal[hidden] {
  display: none !important;
}

.item-used-for-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.item-used-for-modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  max-width: 32rem;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.item-used-for-modal-title {
  margin: 0 0 1rem 0;
  font-size: 1.15rem;
}

.item-used-for-modal-body {
  margin-bottom: 1rem;
}

.item-used-for-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.item-used-for-open-tab-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.item-used-for-open-tab-link:hover {
  text-decoration: none;
}
