:root {
  --ink: #1f2119;
  --muted: #656d59;
  --paper: #f8f3e7;
  --panel: rgba(255, 252, 244, 0.92);
  --line: #d8cdb4;
  --accent: #9b3f1f;
  --accent-2: #1f6f62;
  --gold: #c08a2e;
  --warn: #8d5f11;
  --shadow: 0 18px 45px rgba(64, 48, 23, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "Noto Serif SC", "Songti SC", serif;
  background:
    radial-gradient(circle at top left, rgba(192, 138, 46, 0.22), transparent 32rem),
    radial-gradient(circle at right 18%, rgba(31, 111, 98, 0.15), transparent 30rem),
    linear-gradient(135deg, #f5ead4 0%, #fbf7ee 48%, #ebe1cc 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  background: var(--ink);
  color: #fff9ef;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #35382b;
}

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

input,
select {
  width: 100%;
  border: 1px solid #cdbf9f;
  border-radius: 12px;
  background: #fffaf0;
  color: var(--ink);
  outline: none;
}

input {
  padding: 15px 16px;
  font-size: 18px;
}

select {
  min-height: 42px;
  padding: 9px 11px;
}

input:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(31, 111, 98, 0.12);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

.shell {
  width: min(1360px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.brand-block {
  min-width: 0;
}

.hero-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex: 0 0 auto;
}

.brand-logo {
  width: 116px;
  height: 88px;
  object-fit: contain;
  opacity: 0.88;
  filter: drop-shadow(0 8px 18px rgba(64, 48, 23, 0.12));
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 4.8vw, 62px);
  line-height: 1.02;
  letter-spacing: 0;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.site-logo {
  width: 42px;
  height: 62px;
  object-fit: contain;
  flex: 0 0 auto;
  opacity: 0.9;
  filter: drop-shadow(0 7px 14px rgba(64, 48, 23, 0.12));
}

.title-row h1 {
  margin-bottom: 10px;
}

.subtitle {
  max-width: 820px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.stats {
  min-width: 214px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.46);
  box-shadow: var(--shadow);
  color: var(--accent-2);
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.search-panel,
.results-card,
.detail-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.search-panel {
  padding: 22px;
  margin-bottom: 22px;
}

.search-panel > label {
  display: block;
  margin-bottom: 10px;
  color: var(--accent);
  font-weight: 800;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.search-actions {
  display: flex;
  gap: 10px;
}

.search-actions button {
  white-space: nowrap;
}

#randomButton {
  background: var(--accent-2);
}

#randomButton:hover:not(:disabled) {
  background: #175a51;
}

.scope-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px 14px;
  margin: 16px 0 0;
  padding: 15px 16px 14px;
  border: 1px solid #d8c6a6;
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.72);
}

.scope-panel legend {
  padding: 0 8px;
  color: var(--accent);
  font-weight: 800;
}

.scope-panel label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.scope-panel input {
  width: auto;
  padding: 0;
  accent-color: var(--accent-2);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(154px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.filters label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(350px, 0.82fr) minmax(500px, 1.18fr);
  gap: 22px;
  align-items: start;
}

.results-card,
.detail-card {
  min-height: 570px;
  overflow: hidden;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.card-heading h2 {
  margin: 0;
  font-size: 20px;
}

#resultSummary {
  color: var(--muted);
  font-size: 14px;
}

.results {
  max-height: 650px;
  overflow: auto;
  padding: 8px;
}

.result-item {
  width: 100%;
  display: block;
  margin: 0 0 8px;
  padding: 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.result-item:hover,
.result-item.active {
  border-color: rgba(155, 63, 31, 0.35);
  background: #fff5df;
}

.result-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  font-size: 17px;
  font-weight: 800;
}

.result-title span:last-child {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.result-meta {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.result-snippet {
  display: block;
  margin-top: 8px;
  color: #4c493f;
  font-size: 13px;
  line-height: 1.55;
}

.badge-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.mini-badge,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(31, 111, 98, 0.12);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}

.mini-badge.warn,
.badge.warn {
  background: rgba(141, 95, 17, 0.13);
  color: var(--warn);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid rgba(216, 205, 180, 0.75);
  background: rgba(255, 250, 240, 0.62);
}

.page-numbers {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.page-button {
  min-width: 40px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(155, 63, 31, 0.22);
  border-radius: 10px;
  background: #fffaf0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.page-button:hover:not(:disabled),
.page-button.active {
  border-color: rgba(155, 63, 31, 0.42);
  background: var(--accent);
  color: #fff9ef;
}

.page-button:disabled {
  background: rgba(255, 250, 240, 0.55);
  color: var(--muted);
}

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  color: var(--muted);
  font-weight: 800;
}

.page-jump {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.page-jump input {
  width: 76px;
  min-height: 38px;
  padding: 8px 9px;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
}

.detail {
  padding: 22px;
}

.detail.empty {
  color: var(--muted);
  line-height: 1.8;
}

.detail-title {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--line);
}

.detail-title h3 {
  margin: 0 0 9px;
  font-size: 30px;
}

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

.detail-section {
  margin-top: 18px;
}

.detail-section h4 {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 16px;
  letter-spacing: 0.04em;
}

.fields {
  display: grid;
  gap: 0;
  margin: 0;
}

.field {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(216, 205, 180, 0.72);
}

.field dt {
  color: var(--accent);
  font-weight: 800;
}

.field dd {
  margin: 0;
  line-height: 1.72;
  word-break: break-word;
  white-space: pre-wrap;
}

.text-field {
  padding: 14px;
  border: 1px solid rgba(31, 111, 98, 0.16);
  border-radius: 14px;
  background: rgba(31, 111, 98, 0.06);
}

.text-field dt {
  color: var(--accent-2);
}

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

.loc-box {
  padding: 13px 14px;
  border: 1px solid rgba(155, 63, 31, 0.18);
  border-radius: 14px;
  background: rgba(255, 245, 223, 0.72);
}

.loc-box h5 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 14px;
}

.loc-box p {
  margin: 0;
  color: #4c493f;
  line-height: 1.65;
}

.plate-section {
  padding: 14px;
  border: 1px solid rgba(155, 63, 31, 0.18);
  border-radius: 14px;
  background: rgba(255, 245, 223, 0.72);
}

.plate-gallery {
  display: grid;
  gap: 14px;
}

.plate-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(216, 205, 180, 0.88);
  border-radius: 14px;
  background: #fffdfa;
}

.plate-card a {
  display: block;
  background: #f4ead8;
  cursor: zoom-in;
}

.plate-card img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
}

.plate-card figcaption {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plate-card figcaption strong {
  color: var(--accent);
  font-size: 13px;
}

.plate-neighbors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.plate-adjacent {
  color: var(--accent-2);
  font-weight: 800;
  text-decoration: none;
}

.plate-adjacent:hover {
  text-decoration: underline;
}

.plate-warning {
  padding: 12px 13px;
  border: 1px solid rgba(141, 95, 17, 0.22);
  border-radius: 12px;
  background: rgba(141, 95, 17, 0.08);
  color: var(--warn);
  line-height: 1.7;
}

.notice {
  padding: 22px;
  color: var(--muted);
  line-height: 1.8;
}

mark {
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(192, 138, 46, 0.28);
  color: inherit;
}

.viewer-open {
  overflow: hidden;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  grid-template-rows: auto 1fr;
  background: rgba(20, 21, 17, 0.92);
}

.image-viewer.open {
  display: grid;
}

.viewer-top {
  display: grid;
  background: rgba(31, 33, 25, 0.96);
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 250, 240, 0.16);
  color: #fff9ef;
}

.viewer-hint {
  padding: 8px 16px 10px;
  border-bottom: 1px solid rgba(255, 250, 240, 0.12);
  color: rgba(255, 249, 239, 0.78);
  font-size: 13px;
  line-height: 1.45;
}

.viewer-caption {
  overflow: hidden;
  color: #fff9ef;
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.viewer-actions button {
  min-width: 44px;
  min-height: 38px;
  border: 1px solid rgba(255, 250, 240, 0.22);
  border-radius: 10px;
  background: rgba(255, 250, 240, 0.1);
  color: #fff9ef;
  font-weight: 800;
}

.viewer-actions button:hover {
  background: rgba(255, 250, 240, 0.18);
}

#viewerZoomReset {
  min-width: 66px;
}

.viewer-stage {
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.viewer-stage:active {
  cursor: grabbing;
}

.viewer-stage img {
  position: absolute;
  inset: 0;
  max-width: min(92vw, 980px);
  max-height: calc(100vh - 128px);
  margin: auto;
  transform-origin: center center;
  user-select: none;
  will-change: transform;
}

@media (max-width: 980px) {
  .shell {
    width: min(100vw - 24px, 780px);
    padding-top: 20px;
  }

  .hero,
  .content-grid,
  .filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .search-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .search-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .stats {
    text-align: left;
  }

  .hero-side {
    justify-content: space-between;
    width: 100%;
  }

  .brand-logo {
    width: 88px;
    height: 68px;
  }

  .site-logo {
    width: 34px;
    height: 52px;
  }

  .field {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .page-numbers {
    order: 3;
    flex-basis: 100%;
  }

  .page-jump {
    order: 4;
    flex-basis: 100%;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  body {
    background:
      radial-gradient(circle at top left, rgba(192, 138, 46, 0.2), transparent 22rem),
      linear-gradient(135deg, #f7ecd7 0%, #fbf7ee 58%, #eee2ca 100%);
  }

  .shell {
    width: calc(100vw - 18px);
    padding: 14px 0 28px;
  }

  .hero {
    gap: 12px;
    margin-bottom: 14px;
  }

  .brand-logo {
    width: 96px;
    height: 72px;
  }

  .hero-side {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 11px;
  }

  h1 {
    margin-bottom: 4px;
    font-size: clamp(30px, 11vw, 44px);
    line-height: 1.08;
  }

  .title-row {
    gap: 9px;
  }

  .site-logo {
    width: 28px;
    height: 42px;
  }

  .subtitle {
    font-size: 14px;
  }

  .stats {
    min-width: 0;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 15px;
  }

  .search-panel,
  .results-card,
  .detail-card {
    border-radius: 14px;
  }

  .search-panel {
    padding: 14px;
    margin-bottom: 14px;
  }

  input {
    padding: 14px 15px;
    font-size: 16px;
  }

  .scope-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
  }

  .scope-panel label {
    white-space: normal;
  }

  .filters {
    gap: 10px;
    margin-top: 12px;
  }

  .card-heading {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 14px;
  }

  .results-card,
  .detail-card {
    min-height: 0;
  }

  .results {
    max-height: none;
    padding: 7px;
  }

  .result-item {
    padding: 12px;
    border-radius: 12px;
  }

  .result-title {
    gap: 8px;
    font-size: 16px;
  }

  .detail {
    padding: 14px;
  }

  .detail-title h3 {
    font-size: 24px;
  }

  .viewer-toolbar {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .viewer-hint {
    padding: 8px 12px;
  }

  .viewer-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 380px) {
  .scope-panel {
    grid-template-columns: 1fr;
  }
}
