:root {
  color-scheme: dark;
  font: 16px/1.6 Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #f4ecdc;
  background: #13110e;
  --quiet: #c8bca7;
  --line: #443929;
  --gold: #efd29b;
  --panel: #1c1813;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: 2px solid #f1d39e; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p, ul { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.15; letter-spacing: -.035em; }
h2 { font-size: 1.18rem; line-height: 1.35; }
main { width: min(1260px, calc(100% - 48px)); margin-inline: auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 64px; padding-inline: max(24px, calc((100vw - 1260px) / 2)); border-bottom: 1px solid var(--line); }
.top > a { display: flex; align-items: center; gap: 8px; min-height: 44px; white-space: nowrap; }
.top .brand { color: #f4ecdc; font-weight: 650; letter-spacing: .21em; }
.top a:last-child { color: var(--quiet); font-size: .88rem; }
main { margin-block: 38px 60px; }
.heading { margin-bottom: 22px; }
.heading p { color: var(--quiet); margin-top: 9px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.sign-in { padding: 22px; width: min(100%, 520px); }
.sign-in .button { margin-top: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: 9px; border: 1px solid var(--gold); color: #20190f; background: var(--gold); font-weight: 650; }
.button:hover { background: #fae4b7; }
.button.secondary { color: var(--gold); border-color: #6c5739; background: #241e15; }
.button.secondary:hover { background: #362b1b; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 5px; }
#photo-import-help { margin: 4px 0 8px; }
#photo-status:not(:empty) { margin-bottom: 5px; }
#photo-status, #photo-sync-status, .legacy-sync p { font-size: .88rem; color: var(--quiet); }
#photo-status[data-state="error"], #photo-sync-status[data-state="error"], #photo-detail-status { color: #f5bcaa; }
#photo-sync-status { margin-bottom: 13px; }
.legacy-sync { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 14px; padding: 5px 12px; }
.legacy-sync p { flex: 1 1 240px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 265px); align-items: start; gap: 14px; }
.workspace > section { min-width: 0; }
.map { position: relative; width: 100%; border-radius: 21px; border: 1px solid #65736c; aspect-ratio: 1.55; min-height: 280px; background: #9fd2ed; overflow: hidden; touch-action: pan-y; cursor: grab; }
.map-provider { margin: 5px 3px 0; }
.map.is-dragging { cursor: grabbing; }
.map.has-basemap { touch-action: auto; }
.map > canvas, #photo-basemap, #photo-map-pins { position: absolute; inset: 0; width: 100%; height: 100%; }
#photo-basemap { z-index: 1; opacity: 0; pointer-events: none; }
.map.has-basemap #photo-basemap { opacity: 1; pointer-events: auto; }
#photo-map-pins { z-index: 2; pointer-events: none; }
.map-pin { --pin-size: clamp(58px, 12vw, 83px); position: absolute; display: grid; place-items: center; z-index: 1; transform: translate(-50%, calc(-100% - 5px)); width: var(--pin-size); height: var(--pin-size); pointer-events: auto; isolation: isolate; padding: 0; border: 3px solid #fff; border-radius: 16px; color: #fff; background: linear-gradient(145deg,#739eac,#3c5960); box-shadow: 0 3px 9px #19404f66; }
.map-pin::before { content: ""; position: absolute; z-index: -1; width: 11px; height: 11px; right: calc(50% - 6px); bottom: -7px; transform: rotate(45deg); border-radius: 2px; background: #fff; }
.map-pin img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 13px; object-fit: cover; }
.map-pin-count { position: absolute; inset: auto 0 0; padding: 11px 5px 2px; text-align: left; font-size: .84rem; font-weight: 700; line-height: 1.1; border-radius: 0 0 12px 12px; background: linear-gradient(transparent,#081419c9); }
.map-pin-placeholder { width: 19px; height: 15px; border: 1.5px solid #e8f5f7; border-radius: 3px; box-shadow: 3px -3px 0 -1px #c6e2e8; margin-bottom: 7px; }
.map-pin:focus-visible, .map-pin:hover, .map-pin[aria-pressed="true"] { z-index: 3; outline: 2px solid #186981; outline-offset: 2px; }
.map-controls { position: absolute; z-index: 5; right: 10px; top: 10px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #4a6f783d; border-radius: 13px; background: #f2fbf4eb; }
.map-controls button { padding-inline: 8px; min-width: 42px; min-height: 42px; border: 0; border-bottom: 1px solid #4a6f783d; color: #163a43; background: transparent; font-size: .78rem; }
.map-controls button:last-child { border-bottom: 0; }
.map-controls button:hover { background: #fff; }
.map-hint { position: absolute; left: 15px; top: 13px; right: 15px; width: fit-content; max-width: calc(100% - 30px); padding: 5px 10px; border-radius: 7px; background: #171611e8; color: var(--quiet); font-size: .82rem; pointer-events: none; }
.locations { padding: 15px; }
#location-empty { margin-top: 9px; color: var(--quiet); font-size: .9rem; }
#photo-location-list { padding: 5px 0 0; list-style: none; max-height: 290px; overflow: auto; }
.location { width: 100%; display: flex; justify-content: space-between; align-items: baseline; text-align: left; padding: 9px 10px; color: #f4ecdc; gap: 12px; border: 1px solid transparent; border-bottom-color: #42382b; border-radius: 7px; background: transparent; }
.location > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.location > small { color: var(--quiet); white-space: nowrap; }
.location:hover, .location[aria-pressed="true"] { background: #302719; border-color: #675339; }
#photo-unlocated { margin-top: 6px; }
.collection { margin-top: 14px; padding: clamp(14px, 3vw, 24px); }
.collection h2 { overflow-wrap: anywhere; }
.collection-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; }
#collection-info { color: var(--quiet); font-size: .88rem; margin-top: 6px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 165px), 1fr)); gap: 12px; list-style: none; padding: 0; margin-top: 14px; }
.photo-grid li { min-width: 0; }
.photo-card { width: 100%; padding: 0 0 8px; border: 1px solid var(--line); border-radius: 10px; background: #211d17; text-align: left; overflow: hidden; }
.photo-card:hover { border-color: #bca67b; }
.photo-card img, .photo-placeholder { display: block; width: 100%; aspect-ratio: 1.35; background: #30281c; object-fit: cover; }
.photo-placeholder { display: grid; place-items: center; color: var(--quiet); font-size: .8rem; }
.photo-name, .photo-time { display: block; padding-inline: 8px; overflow-wrap: anywhere; }
.photo-name { font-size: .88rem; margin-top: 6px; }
.photo-time { font-size: .76rem; color: var(--quiet); }
.photo-dialog { width: min(calc(100% - 28px), 530px); max-height: calc(100% - 28px); padding: clamp(14px, 4vw, 24px); border: 1px solid #6c5739; border-radius: 16px; color: inherit; background: var(--panel); overflow: auto; }
.photo-dialog::backdrop { background: #0a0807c9; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dialog-heading h2 { padding-top: 6px; overflow-wrap: anywhere; }
.quiet { color: var(--gold); border: 0; background: transparent; min-height: 44px; padding-inline: 6px; white-space: nowrap; }
.quiet:hover { text-decoration: underline; }
#photo-detail-preview { display: block; width: 100%; max-height: 230px; object-fit: contain; background: #232019; border-radius: 8px; margin-bottom: 12px; }
#photo-detail-no-preview { color: var(--quiet); margin-bottom: 10px; }
#photo-edit { display: grid; gap: 9px; }
#photo-edit label { display: grid; gap: 4px; min-width: 0; font-size: .88rem; }
#photo-edit input { width: 100%; min-height: 44px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; color: #f4ecdc; background: #14120e; }
.coordinate-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.field-note { color: var(--quiet); font-size: .8rem; }
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.batch-controls, .batch-pages { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.batch-controls { margin-top: 8px; }
.batch-controls label, .batch-row { display: flex; align-items: center; min-height: 44px; gap: 9px; cursor: pointer; }
.batch-controls input, .batch-row input { flex: none; width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--gold); }
#photo-batch-items { max-height: min(43vh, 320px); margin: 3px 0 5px; padding: 0; list-style: none; overflow: auto; border-block: 1px solid var(--line); }
.batch-row { padding: 5px 8px; overflow-wrap: anywhere; }
.batch-row:hover { background: #2b2318; }
#photo-batch-note:not(:empty) { margin-top: 7px; }
.batch-actions { margin-top: 14px; }
@media (max-width: 700px) {
  main { width: calc(100% - 28px); margin-top: 24px; }
  .top { padding-inline: 14px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .map { min-height: clamp(350px, 66svh, 590px); }
}
