:root {
  color-scheme: light;
  --canvas: #f2efe7;
  --surface: #fffdf9;
  --surface-soft: #f7f4ed;
  --ink: #243331;
  --ink-soft: #52625d;
  --muted: #7b8880;
  --faint: #a6afa8;
  --line: #e1ded4;
  --accent: #c66b50;
  --accent-soft: #f0d7ca;
  --river: #659a93;
  --gold: #c4a25b;
  --shadow: 0 18px 42px rgba(48, 60, 51, .12);
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-width: 320px;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.app-shell {
  display: flex;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  flex-direction: column;
  background:
    radial-gradient(circle at 9% 0%, rgba(196, 162, 91, .12), transparent 28rem),
    var(--canvas);
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  width: calc(100% - 56px);
  max-width: none;
  margin: 0 auto;
  padding: 34px 0 22px;
}

.brand-block {
  max-width: 740px;
}

.eyebrow,
.panel-kicker,
.map-heading-label,
.detail-original-label {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow-rule {
  display: block;
  width: 30px;
  height: 1px;
  background: var(--accent);
}

.brand-block h1 {
  margin: 12px 0 8px;
  color: var(--ink);
  font-family: "STSong", "Songti SC", "Noto Serif SC", serif;
  font-size: clamp(36px, 4vw, 58px);
  font-weight: 500;
  letter-spacing: -.07em;
  line-height: .98;
}

.title-mark {
  margin-left: 5px;
  color: var(--accent);
}

.brand-block p {
  max-width: 520px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.profile-stamp {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px 9px 9px;
  border: 1px solid rgba(198, 107, 80, .34);
  border-radius: 999px;
  background: rgba(255, 253, 249, .72);
}

.stamp-character {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-family: "STSong", "Songti SC", serif;
  font-size: 23px;
}

.stamp-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stamp-copy strong {
  color: var(--ink);
  font-family: "STSong", "Songti SC", serif;
  font-size: 15px;
  font-weight: 500;
}

.stamp-copy small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .12em;
}

.main-frame {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(480px, .8fr);
  gap: 20px;
  width: calc(100% - 56px);
  max-width: none;
  min-height: 0;
  margin: 0 auto 32px;
}

.map-panel,
.notes-panel {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.map-panel {
  isolation: isolate;
  background: #dbe6df;
}

#fuzhou-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #dbe6df;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  background: #dbe6df;
  font-family: inherit;
}

.leaflet-tile-pane {
  filter: saturate(.88) sepia(.04) contrast(.98) brightness(1.04);
}

.leaflet-control-zoom {
  overflow: hidden;
  margin: 0 18px 18px 0 !important;
  border: 1px solid rgba(36, 51, 49, .2) !important;
  border-radius: 10px !important;
  box-shadow: 0 7px 18px rgba(36, 51, 49, .1) !important;
}

.leaflet-control-zoom a {
  width: 32px !important;
  height: 32px !important;
  border: 0 !important;
  background: rgba(255, 253, 249, .9) !important;
  color: var(--ink) !important;
  line-height: 32px !important;
}

.leaflet-control-zoom a + a {
  border-top: 1px solid var(--line) !important;
}

.leaflet-control-attribution {
  margin: 0 12px 10px 0 !important;
  padding: 3px 6px !important;
  border-radius: 4px;
  background: rgba(255, 253, 249, .78) !important;
  color: var(--ink-soft) !important;
  font-size: 9px !important;
}

.leaflet-control-attribution a {
  color: var(--ink) !important;
}

.map-wash {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, .46) 0%, rgba(255, 253, 249, .02) 28%, rgba(255, 253, 249, .04) 70%, rgba(255, 253, 249, .44) 100%),
    radial-gradient(circle at 58% 48%, transparent 0 35%, rgba(36, 51, 49, .06) 100%);
}

.map-heading {
  position: absolute;
  top: 28px;
  left: 30px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.map-heading-label {
  color: var(--ink-soft);
  font-size: 9px;
}

.map-heading-title {
  color: var(--ink);
  font-family: "STSong", "Songti SC", serif;
  font-size: 19px;
  letter-spacing: .02em;
}

.map-coordinates {
  position: absolute;
  top: 30px;
  right: 30px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 10px;
  letter-spacing: .12em;
}

.map-status {
  position: absolute;
  bottom: 28px;
  left: 30px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(36, 51, 49, .13);
  border-radius: 999px;
  background: rgba(255, 253, 249, .78);
  color: var(--ink-soft);
  font-size: 10px;
  letter-spacing: .05em;
}

.status-light {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--river);
  box-shadow: 0 0 0 4px rgba(101, 154, 147, .16);
}

.recenter-button {
  position: absolute;
  right: 28px;
  bottom: 28px;
  z-index: 2;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(36, 51, 49, .18);
  border-radius: 50%;
  background: rgba(255, 253, 249, .9);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(36, 51, 49, .1);
  transition: border-color .2s ease, color .2s ease, transform .2s ease;
}

.recenter-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(18deg);
}

.map-legend {
  position: absolute;
  right: 86px;
  bottom: 32px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  max-width: min(780px, calc(100% - 180px));
  gap: 7px 14px;
  color: var(--ink-soft);
  font-size: 10px;
}

.map-legend > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-legend .legend-item {
  white-space: nowrap;
}

.legend-mark {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 253, 249, .66);
}

.legend-category-city {
  background: #cf7b59;
}

.legend-category-place {
  background: #83aaa0;
}

.legend-category-roam {
  background: #c8a58b;
}

.legend-category-spirit {
  background: #d7b46d;
}

.legend-cluster-explain {
  color: var(--ink);
  white-space: nowrap;
}

.legend-cluster-explain b {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: var(--ink);
  font-size: 9px;
  font-weight: 700;
}

.fuzhou-marker-shell {
  border: 0;
  background: transparent;
}

.map-pin {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid #fffdf9;
  border-radius: 50% 50% 50% 4px;
  background: var(--marker-color, #a5c0b9);
  box-shadow: 0 8px 18px rgba(36, 51, 49, .22);
  color: var(--ink);
  font-family: "STSong", "Songti SC", serif;
  font-size: 15px;
  font-weight: 700;
  transform: rotate(-45deg);
  transition: transform .2s ease, box-shadow .2s ease;
}

.map-pin span {
  transform: rotate(45deg);
}

.map-pin.cover-river,
.map-pin.cover-paper {
  background: var(--marker-color, #d9bd73);
}

.map-pin.cover-moss {
  background: var(--marker-color, #8db5a5);
}

.map-pin.cover-cinnabar,
.map-pin.cover-clay {
  background: var(--marker-color, #d68164);
}

.map-pin.cover-ink {
  background: var(--marker-color, #a5c0b9);
}

.map-pin.is-selected {
  box-shadow: 0 0 0 7px rgba(198, 107, 80, .2), 0 10px 24px rgba(36, 51, 49, .25);
  transform: rotate(-45deg) scale(1.12);
}

.map-pin.is-cluster {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  transform: rotate(0deg);
}

.map-pin.is-cluster span {
  transform: rotate(0deg);
}

.map-pin.is-cluster.is-selected {
  transform: scale(1.12);
}

.notes-panel {
  display: flex;
  flex-direction: column;
  padding: 28px 24px 18px;
  background: var(--surface);
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 20px;
}

.panel-kicker {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
}

.panel-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: "STSong", "Songti SC", serif;
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -.04em;
}

.note-count {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.note-count strong {
  color: var(--ink);
  font-family: "STSong", "Songti SC", serif;
  font-size: 28px;
  font-weight: 500;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
}

.search-shell:focus-within {
  border-color: rgba(198, 107, 80, .58);
  background: var(--surface);
}

.search-shell input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.search-shell input::placeholder {
  color: var(--faint);
}

.search-shell button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.search-shell button:hover {
  color: var(--accent);
}

.category-row {
  display: flex;
  gap: 7px;
  padding: 18px 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-row::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.category-chip:hover {
  border-color: rgba(198, 107, 80, .4);
  color: var(--accent);
}

.category-chip.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fffdf9;
}

.results-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 26px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .04em;
}

.results-line button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 10px;
}

.results-note {
  color: var(--faint);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.note-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 10px 0 16px;
  overflow-y: auto;
  scrollbar-color: #cfd5cf transparent;
  scrollbar-width: thin;
}

.note-card {
  display: grid;
  grid-template-columns: 182px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(48, 60, 51, .045);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.note-card:hover {
  border-color: rgba(198, 107, 80, .38);
  box-shadow: 0 10px 22px rgba(48, 60, 51, .1);
  transform: translateY(-1px);
}

.note-card.is-selected {
  border-color: rgba(198, 107, 80, .72);
  box-shadow: 0 10px 24px rgba(198, 107, 80, .12);
}

.note-image-frame {
  position: relative;
  overflow: hidden;
  background: #e4e6da;
}

.note-cover {
  min-height: 176px;
  border-radius: 8px;
}

.note-image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #e4e6da;
}

.note-carousel {
  position: relative;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}

.note-carousel:active {
  cursor: grabbing;
}

.note-carousel-stage {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: inherit;
  place-items: center;
  overflow: hidden;
  border-radius: inherit;
  background: #e4e6da;
}

.note-carousel-stage img {
  object-fit: contain;
}

.note-carousel-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 253, 249, .78);
  border-radius: 50%;
  background: rgba(36, 51, 49, .42);
  color: #fffdf9;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity .2s ease, background .2s ease;
}

.note-carousel:hover .note-carousel-arrow,
.note-carousel:focus-within .note-carousel-arrow {
  opacity: 1;
}

.note-carousel-arrow:hover {
  background: rgba(198, 107, 80, .88);
}

.note-carousel-arrow.is-prev {
  left: 9px;
}

.note-carousel-arrow.is-next {
  right: 9px;
}

.note-carousel-page {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 2;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(36, 51, 49, .5);
  color: #fffdf9;
  font-size: 9px;
  letter-spacing: .04em;
}

.note-carousel-dots {
  position: absolute;
  right: 50%;
  bottom: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 5px;
  border-radius: 999px;
  background: rgba(36, 51, 49, .38);
  transform: translateX(50%);
}

.note-carousel-dots i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 253, 249, .58);
}

.note-carousel-dots i.is-active {
  background: #fffdf9;
  transform: scale(1.35);
}

.note-carousel-dots b {
  color: #fffdf9;
  font-size: 9px;
  font-weight: 400;
  line-height: 1;
}

.cover-image-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(25, 37, 34, .02) 45%, rgba(25, 37, 34, .28) 100%);
}

.cover-placeholder {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: inherit;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .35), transparent 48%),
    #e8e5d9;
  color: var(--ink);
}

.cover-placeholder .placeholder-index {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: .14em;
}

.cover-placeholder strong {
  font-family: "STSong", "Songti SC", serif;
  font-size: 16px;
  font-weight: 500;
}

.cover-placeholder small {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
}

.note-cover .cover-placeholder small {
  display: none;
}

.cover-river .cover-placeholder {
  background: #dceae5;
}

.cover-moss .cover-placeholder {
  background: #e4eddf;
}

.cover-cinnabar .cover-placeholder,
.cover-clay .cover-placeholder {
  background: #f2e0d7;
}

.cover-paper .cover-placeholder {
  background: #f0e8d1;
}

.cover-ink .cover-placeholder {
  background: #dce9e5;
}

.cover-index {
  position: absolute;
  top: 8px;
  left: 9px;
  z-index: 1;
  color: rgba(36, 51, 49, .76);
  font-size: 9px;
  letter-spacing: .1em;
}

.note-image-frame img ~ .cover-index,
.note-image-frame img ~ .cover-label {
  color: #fffdf9;
  text-shadow: 0 1px 3px rgba(25, 37, 34, .4);
}

.cover-label {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 1;
  color: var(--ink);
  font-family: "STSong", "Songti SC", serif;
  font-size: 18px;
  writing-mode: vertical-rl;
}

.note-card-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 2px 1px 1px 0;
}

.note-card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.note-card-meta > span:not(.category-dot):not(.meta-separator) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.meta-separator {
  color: var(--faint);
}

.note-card h3 {
  margin: 8px 0 5px;
  color: var(--ink);
  font-family: "STSong", "Songti SC", serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
}

.note-card p {
  display: block;
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.bookmark-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  margin: -4px -4px -4px 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.bookmark-button:hover,
.bookmark-button.is-saved {
  color: var(--accent);
}

.empty-state {
  display: flex;
  flex: 1;
  min-height: 240px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  color: var(--accent);
}

.empty-state strong {
  color: var(--ink);
  font-family: "STSong", "Songti SC", serif;
  font-size: 18px;
  font-weight: 500;
}

.empty-state p {
  margin: 0;
  font-size: 11px;
}

.empty-state button {
  margin-top: 4px;
  padding: 8px 12px;
  border: 1px solid rgba(198, 107, 80, .52);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 11px;
}

.panel-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .02em;
}

.panel-footer svg {
  flex: 0 0 auto;
  color: var(--river);
}

.panel-footer code {
  color: var(--ink-soft);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 9px;
}

.mobile-nav {
  display: none;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: auto;
  background: rgba(36, 51, 49, .32);
  backdrop-filter: blur(4px);
}

.detail-sheet {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  grid-template-columns: minmax(520px, .95fr) minmax(620px, 1.05fr);
  width: min(1800px, calc(100vw - 40px));
  height: min(920px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid rgba(36, 51, 49, .15);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(36, 51, 49, .25);
  transform: translate(-50%, -50%);
  animation: sheet-in .25s ease both;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 16px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(36, 51, 49, .16);
  border-radius: 50%;
  background: rgba(255, 253, 249, .9);
  color: var(--ink);
  cursor: pointer;
}

.sheet-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-image {
  min-width: 0;
  min-height: 0;
  border-radius: 20px 0 0 20px;
}

.detail-gallery {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  background: #e4e6da;
}

.detail-gallery-main {
  position: relative;
  min-height: 0;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  touch-action: pan-y;
  overscroll-behavior: contain;
  cursor: grab;
  user-select: none;
}

.detail-gallery-main:active {
  cursor: grabbing;
}

.detail-gallery-main img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #e4e6da;
}

.detail-gallery-main .cover-placeholder {
  height: 100%;
}

.detail-gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 253, 249, .82);
  border-radius: 50%;
  background: rgba(36, 51, 49, .44);
  color: #fffdf9;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  opacity: .88;
  transform: translateY(-50%);
  transition: background .2s ease, opacity .2s ease, transform .2s ease;
}

.detail-gallery-arrow:hover,
.detail-gallery-arrow:focus-visible {
  background: rgba(198, 107, 80, .9);
  opacity: 1;
}

.detail-gallery-arrow.is-prev {
  left: 18px;
}

.detail-gallery-arrow.is-next {
  right: 18px;
}

.detail-gallery-page {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  padding: 5px 8px;
  border: 1px solid rgba(255, 253, 249, .45);
  border-radius: 999px;
  background: rgba(36, 51, 49, .52);
  color: #fffdf9;
  font-size: 10px;
  letter-spacing: .04em;
}

.detail-gallery-hint {
  position: absolute;
  right: 50%;
  bottom: 16px;
  z-index: 2;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(36, 51, 49, .42);
  color: rgba(255, 253, 249, .88);
  font-size: 9px;
  transform: translateX(50%);
}

.detail-gallery-thumbs {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  max-width: 100%;
  padding: 0 18px 18px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.detail-gallery-thumbs::-webkit-scrollbar {
  display: none;
}

.detail-thumb {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 52px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 253, 249, .72);
  border-radius: 7px;
  background: #d7ded7;
  cursor: pointer;
  opacity: .72;
  transition: border-color .2s ease, opacity .2s ease, transform .2s ease;
}

.detail-thumb:hover,
.detail-thumb.is-active {
  border-color: var(--accent);
  opacity: 1;
  transform: translateY(-2px);
}

.detail-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-image .cover-placeholder {
  align-items: flex-start;
  justify-content: flex-end;
  padding: 34px;
}

.detail-image .cover-placeholder strong {
  font-size: 28px;
}

.detail-image .cover-placeholder small {
  max-width: 180px;
  font-size: 10px;
}

.detail-image .cover-index {
  top: 30px;
  left: 34px;
  font-size: 11px;
}

.detail-image .cover-label {
  right: 34px;
  bottom: 34px;
  font-size: 36px;
}

.detail-content {
  min-width: 0;
  overflow-y: auto;
  padding: 56px 64px 48px;
  background: var(--surface);
}

.detail-original-label {
  margin-bottom: 28px;
  color: var(--accent);
  font-size: 10px;
}

.detail-kicker,
.detail-place,
.detail-actions {
  display: flex;
  align-items: center;
}

.detail-kicker {
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.detail-content h2 {
  margin: 12px 0 10px;
  color: var(--ink);
  font-family: "STSong", "Songti SC", serif;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -.06em;
  line-height: 1.15;
}

.detail-place {
  gap: 6px;
  color: var(--ink-soft);
  font-size: 11px;
}

.detail-place svg {
  color: var(--accent);
}

.detail-location-note {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.7;
}

.approx-badge {
  margin-left: 3px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
}

.detail-body {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.detail-body p {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-family: "STSong", "Songti SC", serif;
  font-size: 16px;
  line-height: 1.95;
}

.detail-body p:last-child {
  margin-bottom: 0;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 26px;
}

.detail-tags span {
  color: var(--muted);
  font-size: 10px;
}

.detail-actions {
  gap: 8px;
  margin-top: 30px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 13px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.action-button.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fffdf9;
}

.action-button.primary:hover,
.action-button.primary.is-saved {
  background: #d57d64;
}

.action-button.secondary {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
}

.action-button.secondary:hover {
  border-color: rgba(198, 107, 80, .42);
  color: var(--accent);
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 30;
  padding: 10px 14px;
  border: 1px solid rgba(36, 51, 49, .14);
  border-radius: 999px;
  background: rgba(255, 253, 249, .96);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(36, 51, 49, .16);
  font-size: 11px;
  transform: translateX(-50%);
}

@media (max-width: 960px) {
  .topbar,
  .main-frame {
    width: calc(100% - 32px);
    max-width: 720px;
  }

  .topbar {
    align-items: flex-start;
    padding-top: 30px;
  }

  .main-frame {
    grid-template-columns: 1fr;
    min-height: 0;
    margin-bottom: 22px;
  }

  .map-panel,
  .notes-panel {
    min-height: 0;
    height: 100%;
  }

  .main-frame .mobile-hidden {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 5px;
    border: 1px solid rgba(36, 51, 49, .14);
    border-radius: 14px;
    background: rgba(255, 253, 249, .94);
    box-shadow: 0 14px 34px rgba(36, 51, 49, .14);
    backdrop-filter: blur(16px);
  }

  .mobile-nav button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 11px;
  }

  .mobile-nav button.is-active {
    background: var(--accent);
    color: #fffdf9;
  }
}

@media (max-width: 700px) {
  .detail-sheet {
    grid-template-columns: 1fr;
    width: min(560px, calc(100vw - 28px));
    height: min(760px, calc(100vh - 28px));
  }

  .detail-image {
    min-height: 250px;
    max-height: 42vh;
    border-radius: 20px 20px 0 0;
  }

  .detail-image .cover-placeholder {
    padding: 24px;
  }

  .detail-image .cover-index {
    top: 22px;
    left: 24px;
  }

  .detail-image .cover-label {
    right: 24px;
    bottom: 24px;
    font-size: 28px;
  }

  .detail-content {
    padding: 28px 24px 30px;
  }
}

@media (max-width: 560px) {
  .topbar {
    width: calc(100% - 28px);
    padding: 24px 0 18px;
  }

  .brand-block h1 {
    font-size: 37px;
  }

  .brand-block p {
    font-size: 12px;
  }

  .profile-stamp {
    display: none;
  }

  .main-frame {
    width: 100%;
    min-height: 0;
    margin: 0;
  }

  .map-panel,
  .notes-panel {
    min-height: 0;
    height: 100%;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .map-heading {
    top: 22px;
    left: 20px;
  }

  .map-coordinates {
    top: 23px;
    right: 20px;
  }

  .map-status {
    bottom: 82px;
    left: 20px;
  }

  .map-legend {
    right: 20px;
    bottom: 82px;
    max-width: calc(100% - 110px);
    gap: 6px 10px;
  }

  .recenter-button {
    right: 20px;
    bottom: 26px;
  }

  .notes-panel {
    padding: 22px 16px 82px;
  }

  .note-card {
    grid-template-columns: 98px minmax(0, 1fr);
  }

  .detail-sheet {
    width: 100%;
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }

  .detail-image {
    min-height: 220px;
    max-height: 34vh;
    border-radius: 18px 18px 0 0;
  }

  .detail-content h2 {
    font-size: 28px;
  }

  .detail-body p {
    font-size: 14px;
  }

  .toast {
    bottom: 78px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
