:root {
  color-scheme: dark;
  --bg: #202428;
  --panel: #2c3237;
  --panel-raised: #343b41;
  --panel-soft: #3a4249;
  --ink: #eef2f4;
  --muted: #b7c1c9;
  --line: #4a545c;
  --navy: #2e78b8;
  --link: #8dccff;
  --teal: #2f7f7b;
  --gold: #a46d12;
  --red: #d16a62;
  --soft-blue: #404a53;
  --soft-green: #344942;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 48px);
  background: linear-gradient(90deg, #123d63, #2f5d62);
  color: #fff;
  border-bottom: 4px solid #d89b32;
}

.eyebrow {
  margin: 0 0 4px;
  color: #f4d592;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}

.source-meta {
  max-width: 420px;
  color: #d9e4ee;
  font-size: 13px;
  text-align: right;
}

.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 6px;
  padding: 8px 14px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.back-button.light {
  border-color: var(--line);
  background: var(--panel-raised);
  color: var(--link);
}

.back-button.light:hover {
  background: var(--soft-blue);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.info-page {
  display: grid;
  gap: 18px;
  max-width: 920px;
}

.info-page p {
  max-width: 78ch;
  margin: 0 0 12px;
  color: #dce3e8;
  line-height: 1.6;
}

.info-page p:last-child {
  margin-bottom: 0;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 30px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 8px;
}

.site-footer a {
  color: var(--link);
  font-weight: 700;
  text-decoration: none;
}

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

.site-footer p {
  margin: 0;
}

.filters,
.results-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) 110px 110px minmax(190px, 1fr) minmax(180px, 0.9fr);
  gap: 14px;
  padding: 16px;
  align-items: end;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: #d7dde3;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #69747d;
  border-radius: 6px;
  background: #242a2f;
  color: var(--ink);
  padding: 7px 9px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(47, 127, 123, 0.24);
  outline-offset: 1px;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.toggles {
  grid-column: 1 / -2;
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 8px 14px;
  padding-top: 2px;
}

.toggles label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: #dce3e8;
  font-size: 13px;
  font-weight: 600;
}

.toggles input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--teal);
}

.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.contact-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.hidden-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.form-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.form-status.success {
  color: #96d9ad;
}

.form-status.error {
  color: #e29b95;
}

button:disabled {
  cursor: wait;
  opacity: 0.66;
}

button {
  min-height: 38px;
  border: 1px solid var(--navy);
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #0f314e;
}

button.secondary {
  background: var(--panel-raised);
  color: var(--link);
}

button.secondary:hover {
  background: var(--soft-blue);
}

.results-panel {
  margin-top: 18px;
  overflow: hidden;
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-raised);
  color: #dce3e8;
}

.results-bar span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.table-wrap {
  overflow: auto;
}

.load-more-row {
  display: flex;
  justify-content: center;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel-raised);
}

.compact-wrap {
  margin: 0 -2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--soft-blue);
  color: #edf3f7;
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:nth-child(even) {
  background: #30373d;
}

tbody tr:hover {
  background: var(--soft-green);
}

.results-table {
  table-layout: fixed;
  min-width: 820px;
}

.results-table th:nth-child(1),
.results-table td:nth-child(1) {
  width: 20%;
}

.results-table th:nth-child(2),
.results-table td:nth-child(2) {
  width: 76px;
  white-space: nowrap;
}

.results-table th:nth-child(3),
.results-table td:nth-child(3) {
  width: 18%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.results-table th:nth-child(4),
.results-table td:nth-child(4) {
  width: 78px;
  white-space: nowrap;
}

.results-table th:nth-child(5),
.results-table td:nth-child(5) {
  width: 13%;
}

.results-table th:nth-child(6),
.results-table td:nth-child(6) {
  width: 96px;
}

.results-table th:nth-child(7),
.results-table td:nth-child(7) {
  width: 15%;
}

.mob-link {
  color: var(--link);
  font-weight: 700;
  text-decoration: none;
}

.mob-link:hover {
  text-decoration: underline;
}

.stat-link {
  color: var(--link);
  text-decoration: none;
}

.stat-link:hover {
  text-decoration: underline;
}

.subtle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #404952;
  color: #e4ebef;
  font-size: 12px;
  font-weight: 700;
}

.pill.nm {
  background: #4e3332;
  color: var(--red);
}

.pill.fish {
  background: #28454a;
  color: #92dce7;
}

.pill.horizon {
  background: #394269;
  color: #c4d0ff;
}

.pill.flag {
  background: #4e4029;
  color: #e4b86a;
}

.pill.target {
  background: #2f4939;
  color: #96d9ad;
}

.pill.charm {
  background: #3a3f5d;
  color: #bdc8ff;
}

.pill.review {
  background: #4c452f;
  color: #e0c475;
}

.pill.no-charm,
.pill.charm-no {
  background: #4d3636;
  color: #e29b95;
}

.pill.charm-yes {
  background: #2f4939;
  color: #96d9ad;
}

.pill.charm-unknown {
  background: #474f57;
  color: #d2dce3;
}

.empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
}

.detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.primary-detail {
  grid-column: 1 / -1;
}

.detail-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.detail-heading h2,
.detail-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.name-row h2 {
  margin: 0;
}

.behavior-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.behavior-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #5f7486;
  border-radius: 999px;
  background: #334757;
  color: #d6ecff;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.detail-heading p {
  margin: 0;
  color: var(--muted);
}

.compact-heading {
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.spawn-map-panel .compact-heading h2 {
  margin: 0;
}

.spawn-density-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: #c5d0d8;
  font-size: 12px;
  font-weight: 700;
}

.spawn-density-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.legend-dot.density-low {
  background: #2f8a4a;
}

.legend-dot.density-mid {
  background: #0a5f9e;
}

.legend-dot.density-high {
  background: #9d2f2f;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0;
}

.stat-grid.three {
  grid-template-columns: repeat(3, minmax(130px, 1fr));
}

.stat-grid div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-raised);
  padding: 12px;
}

.stat-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.stat-grid dd {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.stat-note {
  display: block;
  max-width: 360px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
}

.drop-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.drop-section:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.drop-section h3 {
  margin: 0 0 8px;
  color: #dce3e8;
  font-size: 13px;
  text-transform: uppercase;
}

.drop-section p {
  margin: 0;
}

.compact-table {
  min-width: 0;
}

.compact-table th,
.compact-table td {
  padding: 8px 10px;
}

.drops-table {
  min-width: 520px;
}

.drops-table th:nth-child(n+3),
.drops-table td:nth-child(n+3) {
  text-align: center;
  width: 52px;
}

.spawn-map-panel.wide-panel {
  grid-column: 1 / -1;
}

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

.notes-list li + li {
  margin-top: 4px;
}

.spawn-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 512px));
  gap: 16px;
  align-items: start;
}

.spawn-map {
  margin: 0;
}

.spawn-map-frame {
  position: relative;
  width: min(100%, 512px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #252b30;
}

.spawn-map-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
}

.spawn-raster-overlay,
.spawn-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.spawn-raster-overlay {
  object-fit: contain;
}

.spawn-area {
  fill: rgba(61, 168, 222, 0.26);
  stroke: rgba(18, 96, 143, 0.8);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spawn-area-fill {
  stroke: none;
}

.spawn-area-border {
  fill: none;
}

.spawn-dot {
  fill: #0a5f9e;
  fill-opacity: 0.7;
  stroke: #063a61;
  stroke-opacity: 0.7;
  stroke-width: 0.25;
  vector-effect: non-scaling-stroke;
}

.spawn-dot.density-low {
  fill: #2f8a4a;
  stroke: #1f5e32;
}

.spawn-dot.density-high {
  fill: #9d2f2f;
  stroke: #671e1e;
}

.spawn-map figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.item-sources-table {
  table-layout: fixed;
}

.item-sources-table th:nth-child(1),
.item-sources-table td:nth-child(1) {
  width: 92px;
}

.item-sources-table th:nth-child(2),
.item-sources-table td:nth-child(2) {
  width: 32%;
}

.item-sources-table th:nth-child(3),
.item-sources-table td:nth-child(3) {
  width: 36%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.item-sources-table th:nth-child(4),
.item-sources-table td:nth-child(4) {
  width: 110px;
  white-space: nowrap;
}

.zone-filters {
  grid-template-columns: repeat(5, minmax(112px, 1fr));
}

.zone-filter-toggles {
  grid-column: 1 / 4;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
}

.zone-filters .actions {
  grid-column: 4 / -1;
  align-self: end;
}

.zone-table {
  table-layout: fixed;
  min-width: 880px;
}

.zone-table th:nth-child(1),
.zone-table td:nth-child(1) {
  width: 22%;
}

.zone-table th:nth-child(2),
.zone-table td:nth-child(2) {
  width: 86px;
  white-space: nowrap;
}

.zone-table th:nth-child(3),
.zone-table td:nth-child(3) {
  width: 16%;
}

.zone-table th:nth-child(4),
.zone-table td:nth-child(4) {
  width: 84px;
  white-space: nowrap;
}

.zone-table th:nth-child(5),
.zone-table td:nth-child(5) {
  width: 96px;
}

.zone-table th:nth-child(6),
.zone-table td:nth-child(6) {
  width: 18%;
}

.zone-table th:nth-child(7),
.zone-table td:nth-child(7) {
  width: 120px;
}

.inline {
  display: inline;
  margin-left: 4px;
}

.audit-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.audit-stats {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.audit-card h2 {
  margin-bottom: 14px;
}

.audit-table {
  min-width: 760px;
}

@media (max-width: 980px) {
  .app-header {
    align-items: start;
    flex-direction: column;
  }

  .source-meta {
    text-align: left;
  }

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

  .wide,
  .toggles,
  .actions {
    grid-column: 1 / -1;
  }

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

  .zone-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .zone-filter-toggles,
  .zone-filters .actions {
    grid-column: 1 / -1;
  }

  .zone-filters .actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  main {
    width: min(100% - 20px, 1180px);
    margin-top: 14px;
  }

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

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

  .results-bar {
    align-items: start;
    flex-direction: column;
  }

  .results-bar span {
    text-align: left;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

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