/* Campus guide layout, animation and responsive styles. */
[hidden] { display: none !important; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.app-shell { height: 100dvh; min-height: 700px; }
.page { width: 100%; padding: 20px 24px 12px; }
.guide-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 0 2px 20px; }
.guide-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.guide-heading h1 { margin: 5px 0 0; color: var(--heading); font-size: clamp(22px, 2.1vw, 32px); font-weight: 650; letter-spacing: .02em; }
.workspace { grid-template-columns: 224px minmax(0, 1fr) 280px; }
.directory, .detail { height: 100%; }
.zone-list { display: flex; flex-direction: column; gap: 6px; align-content: start; }
.zone-button { flex-shrink: 0; min-height: 62px; padding: 10px; }
.zone-button strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.zone-button small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 155px; }
.zone-search { display: grid; gap: 8px; padding: 16px 12px 10px; color: var(--muted); font-size: 11px; }
.zone-search input { width: 100%; min-height: 42px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--ink); }
.tour-controls { display: flex; gap: 5px; padding: 12px 10px 4px; }
.tour-controls button { flex: 1; min-height: 44px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--heading); font-size: 11px; cursor: pointer; }
.tour-controls #tour-start { background: var(--green); color: var(--on-green); flex: 1.5; border-color: var(--green); }
.tour-timing { margin: 8px 12px 0; }
.tour-timing-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.tour-progress { height: 3px; overflow: hidden; background: var(--green-soft); border-radius: 3px; }
.tour-progress > span { display: block; width: 100%; height: 100%; background: var(--amber); transform-origin: left; transform: scaleX(var(--tour-progress, 0)); }
.tour-motion { display: flex; align-items: center; gap: 6px; margin: 6px 12px 0; min-height: 36px; font-size: 11px; color: var(--muted); cursor: pointer; }
.tour-motion input { accent-color: var(--green); }
.tour-story { position: absolute; z-index: 530; left: 22px; bottom: 22px; width: min(330px, calc(100% - 44px)); padding: 15px; color: var(--heading); background: var(--surface-strong); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.tour-story-content { position: relative; min-width: 0; }
.tour-story-kicker { color: var(--muted); font-size: 10px; letter-spacing: .05em; }
.tour-story-title { margin: 9px 0 5px; font-size: 20px; line-height: 1.4; overflow-wrap: anywhere; }
.tour-story-description { margin: 0; font-size: 12px; line-height: 1.8; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tour-story-photo { display: none; padding: 0; width: 88px; height: 88px; border: 0; border-radius: 6px; overflow: hidden; cursor: zoom-in; background: var(--green-soft); }
.tour-story-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tour-story-controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.tour-story-controls > span { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.tour-story-controls button { min-height: 40px; padding: 5px 8px; flex-shrink: 0; color: var(--green); background: transparent; border: 0; border-radius: 5px; font-size: 12px; cursor: pointer; }
.tour-story-controls button:hover { background: var(--green-soft); }
.tour-story .tour-progress { margin-top: 5px; }
body.touring .map-legend { display: none; }
body.touring .detail-content { animation: none; }
body.touring .scene-open img { transition: none; }
body.touring .scene-open:hover img, body.tour-reduced .scene-open:hover img { transform: none; }
body.tour-reduced .detail-content { animation: none; }
body.admin-editing .tour-timing, body.admin-editing .tour-motion { display: none; }
/* 园区切换 */
.campus-switch { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 2px 16px; }
.campus-chip { min-height: 38px; padding: 6px 14px; color: var(--green); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 650; transition: background .2s ease, color .2s ease, border-color .2s ease; }
.campus-chip:hover { background: var(--green-soft); }
.campus-chip[aria-pressed="true"] { color: var(--on-green); background: var(--green); border-color: var(--green); }
/* 分类筛选与目录补充 */
.zone-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.tag-chip { min-height: 30px; padding: 4px 10px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 11px; }
.tag-chip:hover { color: var(--green); background: var(--green-soft); border-color: var(--line-strong); }
.tag-chip[aria-pressed="true"] { color: var(--on-green); background: var(--green); border-color: var(--green); }
.zone-button strong { display: flex; align-items: center; gap: 6px; }
.zone-photos { color: var(--green); font-size: 10px; font-style: normal; white-space: nowrap; }
.zone-tags { display: block; margin-top: 3px; max-width: 155px; overflow: hidden; color: var(--muted); font-size: 10px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.marker-count { min-width: 18px; height: 18px; padding: 0 4px; color: var(--on-green); background: var(--green); border-radius: 999px; font-size: 10px; line-height: 18px; text-align: center; }
/* 详情：分类、相册、操作 */
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.detail-tags span { padding: 3px 9px; color: var(--green); background: var(--green-soft); border: 1px solid var(--line-strong); border-radius: 999px; font-size: 11px; }
.detail-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 16px; }
.detail-actions .detail-locate { flex: 1; }
.detail-voice { flex: 0 0 auto; min-height: 44px; padding: 0 14px; color: var(--green); background: var(--green-soft); border: 1px solid var(--line-strong); border-radius: 6px; cursor: pointer; font-size: 12px; }
.detail-voice:hover { background: var(--surface-2); }
.scene-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.scene-thumb { width: 62px; height: 46px; padding: 0; overflow: hidden; background: var(--green-soft); border: 1px solid var(--line-strong); border-radius: 6px; cursor: zoom-in; }
.scene-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.scene-thumb:hover, .scene-thumb:focus-visible { border-color: var(--green); }
.tour-story-tags { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.tour-story-count { position: absolute; right: 0; bottom: 0; padding: 2px 6px; color: var(--on-green); background: var(--green); font-size: 10px; }
/* 大图分页 */
.photo-stage { display: flex; align-items: center; justify-content: center; min-height: 0; }
.photo-stage img { flex: 1 1 auto; width: auto; max-width: 100%; }
.photo-nav { position: absolute; top: 50%; z-index: 2; width: 44px; height: 64px; padding: 0; transform: translateY(-50%); color: var(--heading); background: var(--surface-strong); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 26px; line-height: 1; }
.photo-nav:hover { background: var(--field); }
#photo-prev { left: 8px; }
#photo-next { right: 8px; }
.photo-count { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
/* 管理台：园区、分类、多图 */
.admin-section-title { margin: 18px 0 8px; color: var(--heading); font-size: 12px; letter-spacing: .06em; }
.admin-campus-switch { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.admin-campus-switch .campus-chip { min-height: 34px; padding: 5px 11px; font-size: 11px; }
.admin-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.admin-inline button { min-height: 42px; padding: 0 14px; color: var(--green); background: var(--green-soft); border: 1px solid var(--line-strong); border-radius: 7px; cursor: pointer; font-size: 12px; }
.admin-campus-map-state { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-option { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px; color: var(--green); background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 999px; font-size: 11px; font-weight: 400; cursor: pointer; }
.tag-option input { width: 15px; height: 15px; accent-color: var(--green); }
.tag-option:has(input:checked) { color: var(--on-green); background: var(--green); border-color: var(--green); }
.tag-option:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.admin-photo-grid { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.admin-photo-cell { position: relative; }
.admin-photo-cell button { position: absolute; right: 3px; bottom: 3px; min-height: 0; padding: 3px 6px; color: var(--brand-ink); background: var(--backdrop); border: 0; border-radius: 4px; cursor: pointer; font-size: 10px; }
.admin-photo-note { width: 100%; }
/* 打印用的整园目录只在纸上出现 */
.print-sheet { display: none; }
@media print {
  .campus-switch, .zone-filters { display: none; }
}

/* Fullscreen keeps the entire guide and its dialogs; only the site header hides. */
html:fullscreen { width: 100%; height: 100%; overflow: auto; background: var(--paper); }
html:fullscreen .app-shell > .topbar { display: none; }
html:fullscreen .app-shell { min-height: 100dvh; }
html:fullscreen .page { max-width: none; }
.directory-note { margin: 10px 14px 16px; font-size: 11px; line-height: 1.8; }
.map-card { min-height: 360px; isolation: isolate; }
.map-card, .map-viewport, .leaflet-container { background: var(--map-bg) !important; }
.map-canvas { touch-action: none; overscroll-behavior: contain; }
.map-canvas.leaflet-grab { cursor: grab; }
.map-canvas.leaflet-drag-target, .map-canvas.map-interacting { cursor: grabbing; }
.map-canvas .leaflet-tile-container { pointer-events: none; }
.map-canvas.map-interacting .map-marker { transition: none; box-shadow: none; }
.map-canvas.map-interacting .map-marker:hover { transform: translate(-50%, -50%); }
.map-canvas.map-interacting .marker-halo { visibility: hidden; }
.map-controls { gap: 6px; }
.map-control-btn { min-width: 44px; min-height: 44px; }
.map-toolbar { right: 78px; width: fit-content; max-width: calc(100% - 100px); line-height: 1.5; }
.map-hint { top: auto; bottom: 48px; width: max-content; max-width: calc(100% - 32px); white-space: normal; text-align: center; }
.map-marker { min-height: 34px; gap: 6px; padding: 4px 8px 4px 4px; }
.marker-pin { position: relative; display: grid; place-items: center; min-width: 24px; width: 24px; height: 24px; font-size: 10px; }
.marker-halo { position: absolute; inset: -6px; border: 2px solid var(--amber); border-radius: 50%; opacity: 0; pointer-events: none; }
body.touring .map-marker[aria-current="true"] .marker-halo { will-change: transform, opacity; }
body.touring .scene-open img, body.touring .tour-story-photo img { will-change: transform; }
body.tour-reduced .scene-open img, body.tour-reduced .tour-story-photo img { will-change: auto; }
.marker-pin svg, .zone-index svg, .admin-zone-dot svg { display: block; width: 18px; height: 18px; fill: var(--green); }
.map-marker[aria-current="true"] .marker-pin svg { fill: #fff; }
.marker-label { display: inline-block; max-width: 110px; opacity: 1; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.map-marker[data-location="true"]::after { content: '当前位置'; }
.campus-marker-anchor { border: 0; background: transparent; }
.draft-pin { width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 7px #c9a45c44; animation: draft-arrival .5s ease-out; }
.draft-pin span { width: 8px; height: 8px; border-radius: 50%; background: var(--panel); }
.fallback-map { width: 100%; height: 100%; object-fit: contain; }
.detail-body { padding: 22px 18px; }
.detail-number { display: inline-flex; align-items: center; gap: 6px; }
.detail-number svg { width: 18px; height: 18px; fill: currentColor; }
.detail-body h3 { font-size: clamp(21px, 2vw, 29px); line-height: 1.35; overflow-wrap: anywhere; }
.detail-lead { font-size: 14px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-content { animation: detail-arrival .32s ease-out; }
.detail-welcome p { color: var(--muted); font-size: 13px; line-height: 1.9; }
.detail-welcome h3 { margin: 22px 0; }
.scene-open { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: var(--green-soft); cursor: zoom-in; }
.scene-open img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; transition: transform .4s ease; }
.scene-open:hover img { transform: scale(1.04); }
.scene-open span { position: absolute; bottom: 10px; left: 10px; color: #fff; font-size: 11px; padding: 5px 8px; background: #21483dd9; border-radius: 4px; }
.scene-empty { padding: 40px 12px; text-align: center; color: var(--muted); background: var(--green-soft); font-size: 12px; border-radius: 8px; }
.location-note { margin: 16px 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.detail-locate { width: 100%; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--green); background: var(--panel); cursor: pointer; }
.launch-notice { padding: 12px 16px; margin-bottom: 14px; font-size: 13px; line-height: 1.8; background: var(--amber-soft); color: var(--heading); border-radius: 8px; }
.admin-entry { padding: 8px 14px; min-height: 40px; color: #fff; border: 1px solid #ffffff55; border-radius: 6px; font-size: 12px; }
.admin-config-btn { min-height: 42px; border-radius: 6px; cursor: pointer; }
.admin-error { font-size: 13px; line-height: 1.6; position: sticky; bottom: 0; background: var(--panel); padding: 10px 0 0; }
.admin-preview { margin-bottom: 16px; }
.admin-zone-delete, .admin-zone-pick, .admin-batch-delete { min-height: 40px; }
.admin-zone-row { grid-template-columns: 18px minmax(0, 1fr) auto auto; }
.admin-zone-pick { display: flex; align-items: center; gap: 8px; }
.admin-zone-pick > span:last-child { min-width: 0; }
.admin-zone-pick small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.admin-zone-dot { display: grid; place-items: center; flex: 0 0 24px; }
.admin-zone-order { display: inline-flex; gap: 3px; }
.admin-zone-move { width: 30px; min-height: 36px; padding: 0; color: var(--green); background: var(--green-soft); border: 1px solid var(--line-strong); border-radius: 5px; cursor: pointer; }
.admin-zone-row input { width: 18px; height: 18px; accent-color: var(--green); }
.admin-close { min-width: 40px; min-height: 40px; }
.admin-position-readout span { display: block; margin-top: 6px; }
.admin-position-current[aria-pressed="true"] { background: var(--amber-soft); }
body.admin-editing .workspace { grid-template-columns: 180px minmax(0, 1fr); }
body.admin-editing .guide-heading > p { display: none; }
body.admin-editing .tour-controls { display: none; }
.app-message { position: fixed; z-index: 2000; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); padding: 14px 20px; color: var(--brand-ink); background: var(--brand); border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; line-height: 1.6; pointer-events: none; }
.photo-dialog { width: min(1100px, 94vw); max-height: 94dvh; padding: 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--panel); }
.photo-dialog::backdrop { background: #17211fe8; backdrop-filter: blur(6px); }
.photo-dialog header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 14px; }
.photo-dialog h2 { margin: 0; font-size: 18px; }
.photo-dialog button { min-height: 44px; background: var(--green-soft); border: 0; border-radius: 6px; padding: 8px 14px; color: var(--heading); cursor: pointer; }
.photo-dialog img { display: block; width: 100%; max-height: 78dvh; object-fit: contain; }
@keyframes draft-arrival { from { transform: scale(.6); box-shadow: 0 0 0 20px #c9a45c00; } to { transform: scale(1); box-shadow: 0 0 0 7px #c9a45c44; } }
@keyframes detail-arrival { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1180px) {
  .tour-story-content:has(.tour-story-photo:not([hidden])) { padding-right: 90px; min-height: 78px; }
  .tour-story-photo { display: block; width: 78px; height: 78px; position: absolute; top: 0; right: 0; }
  .app-shell { height: auto; min-height: 100dvh; }
  .workspace { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: minmax(490px, 65dvh) auto; }
  .detail { grid-column: 1 / -1; }
  .detail-content { display: grid; grid-template-columns: 1fr 280px; gap: 8px 24px; }
  .detail-content .scene-gallery, .detail-content .scene-empty { grid-column: 2; grid-row: 1 / 6; }
  .detail-content .detail-actions { grid-column: 1 / -1; }
  .detail-content h3, .detail-content p { margin: 4px 0; }
  body.admin-editing .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(480px, 75dvh); }
  body.admin-editing .directory { display: none; }
}
@media (max-width: 760px) {
  .tour-story { left: 14px; bottom: 14px; width: calc(100% - 28px); padding: 10px 12px; }
  .tour-story-title { font-size: 17px; margin-top: 5px; }
  .tour-story-description { font-size: 11px; }
  .tour-story-controls button { min-height: 44px; }
  .tour-motion { min-height: 44px; }
  .page { padding: 14px 10px; }
  .guide-heading { padding: 0 4px 14px; }
  .guide-heading > p { display: none; }
  .guide-heading h1 { font-size: 24px; }
  .workspace { display: flex; flex-direction: column; }
  .map-card { order: 0; height: 56dvh; min-height: 360px; flex: none; }
  .map-viewport { min-height: 0; height: 100%; }
  .directory { order: 1; height: auto; }
  .detail { order: 2; height: auto; }
  .zone-list { display: grid; grid-template-columns: 1fr 1fr; max-height: 220px; }
  .zone-button { min-width: 0; }
  .zone-button small { max-width: 110px; }
  .tour-controls { padding-bottom: 12px; }
  .detail-content { display: block; }
  .detail-content h3, .detail-content p { margin-bottom: 16px; }
  .marker-label { max-width: 80px; font-size: 11px; }
  .map-marker { min-height: 40px; }
  body.admin-editing .guide-heading { display: none; }
  body.admin-editing .map-card { height: 42dvh; min-height: 240px; }
  body.admin-editing .app-shell { min-height: 100dvh; }
  body.admin-editing .directory { display: none; }
  .admin-overlay.is-editor .admin-card { height: 46dvh; max-height: 46dvh; }
  .admin-overlay.is-editor .admin-body { height: 100%; max-height: none; }
  .admin-card-head { padding: 10px 14px; }
  .admin-head-copy span { display: none; }
  .admin-config-row, .admin-actions { grid-template-columns: 1fr 1fr; }
  .admin-actions .admin-save { grid-column: 1 / -1; }
  .map-toolbar { font-size: 10px; }
  .map-hint { font-size: 11px; bottom: 46px; }
  .brand { gap: 8px; flex: 1 1 auto; min-width: 0; }
  .brand img { width: 110px; }
  .brand-copy { min-width: 0; }
  .brand-copy strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar { flex: 0 0 auto; flex-wrap: wrap; gap: 8px; min-height: 70px; }
  .topbar-meta { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .campus-switch { gap: 6px; margin-bottom: 12px; }
  .campus-chip { min-height: 40px; }
  .zone-filters { padding: 0 10px 10px; }
  .photo-nav { width: 40px; height: 52px; font-size: 22px; }
  /* 全览缩放下 19 个名称会互相压住，小屏只保留选中点和当前位置的文字。 */
  .marker-label { max-width: 0; opacity: 0; }
  .map-marker[aria-current="true"] .marker-label, .map-marker[data-location="true"] .marker-label, .map-marker.is-draft .marker-label { max-width: 90px; opacity: 1; }
  .map-marker { padding: 4px 6px 4px 4px; }
  .topbar-meta .status-dot { display: none; }
  .admin-entry { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
