:root {
  --bg: #07111f;
  --panel: rgba(7, 17, 31, .78);
  --panel-strong: rgba(8, 20, 36, .95);
  --line: rgba(255, 255, 255, .14);
  --text: #f7fbff;
  --muted: #a8b7c8;
  --accent: #58d5ff;
  --accent-2: #2f80ff;
  --shadow: 0 22px 60px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html, body, #app, #cesiumContainer { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }

#cesiumContainer { position: fixed; inset: 0; }
.map-vignette { position: fixed; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(3,9,17,.45) 0%, transparent 28%, transparent 65%, rgba(3,9,17,.52) 100%); z-index: 2; }
.glass { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }

.topbar { position: fixed; z-index: 10; top: 14px; left: 16px; right: 16px; height: 58px; border-radius: 15px; display: flex; align-items: center; justify-content: space-between; padding: 9px 12px 9px 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark, .loading-logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; letter-spacing: -.04em; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #03111c; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 13px; }
.brand span { color: var(--muted); font-size: 10px; margin-top: 2px; }
nav { display: flex; gap: 6px; }
.nav-button { border: 0; color: var(--muted); background: transparent; padding: 9px 13px; border-radius: 10px; font-size: 13px; font-weight: 750; }
.nav-button:hover, .nav-button.active { color: white; background: rgba(255,255,255,.09); }

.intro-card { position: fixed; z-index: 9; left: 24px; top: 92px; width: min(355px, calc(100vw - 48px)); padding: 18px; border-radius: 17px; transition: opacity .3s ease, transform .3s ease; }
.intro-card.hidden { opacity: 0; transform: translateY(-12px); pointer-events: none; }
.eyebrow { display: block; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.intro-card h1 { font-size: clamp(25px, 2.55vw, 34px); line-height: 1.02; letter-spacing: -.035em; margin: 9px 0 11px; }
.intro-card p, .token-card p, .detail-content p { color: var(--muted); line-height: 1.55; margin: 0; font-size: 13px; }
.intro-actions, .panel-actions { display: flex; gap: 9px; margin-top: 16px; }
.primary-button, .ghost-button { border-radius: 10px; padding: 10px 14px; border: 1px solid transparent; font-weight: 750; font-size: 12px; }
.primary-button { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #03111c; }
.ghost-button { background: rgba(255,255,255,.06); border-color: var(--line); color: white; }
.primary-button:hover, .ghost-button:hover { transform: translateY(-1px); }

.location-list { position: fixed; z-index: 9; left: 16px; bottom: 14px; width: 240px; max-height: 48vh; border-radius: 16px; padding: 14px; overflow: hidden; }
.section-head { display: flex; justify-content: space-between; align-items: start; }
.section-head h2 { margin: 5px 0 0; font-size: 16px; }
.location-items { margin-top: 11px; display: grid; gap: 7px; max-height: calc(48vh - 70px); overflow: auto; padding-right: 4px; }
.location-item { width: 100%; border: 1px solid transparent; background: rgba(255,255,255,.045); color: white; border-radius: 12px; padding: 9px; display: flex; align-items: center; text-align: left; gap: 9px; }
.location-item:hover, .location-item.active { background: rgba(88,213,255,.11); border-color: rgba(88,213,255,.4); }
.location-index { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: rgba(88,213,255,.13); color: var(--accent); }
.location-copy { flex: 1; min-width: 0; }
.location-copy strong, .location-copy span { display: block; }
.location-copy strong { font-size: 12px; }
.location-copy span { color: var(--muted); margin-top: 2px; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.location-arrow { color: var(--accent); }
.mobile-close, .mobile-list-button { display: none; }

.detail-panel { position: fixed; z-index: 20; top: 86px; right: 16px; bottom: 14px; width: min(360px, calc(100vw - 32px)); border-radius: 18px; overflow: hidden; background: var(--panel-strong); border: 1px solid var(--line); box-shadow: var(--shadow); transform: translateX(calc(100% + 40px)); transition: transform .36s cubic-bezier(.2,.75,.2,1); }
.detail-panel.open { transform: translateX(0); }
.detail-media { height: 35%; min-height: 180px; position: relative; overflow: hidden; }
.detail-media img, .detail-media video, .detail-media iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }
.detail-media-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(7,17,31,.92)); }
.close-panel, .video-close, .token-close, .icon-button { border: 0; color: white; background: rgba(2,10,18,.62); width: 34px; height: 34px; border-radius: 50%; font-size: 20px; }
.close-panel { position: absolute; top: 14px; right: 14px; }
.play-button { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%); border: 1px solid rgba(255,255,255,.45); width: 56px; height: 56px; border-radius: 50%; background: rgba(4,15,27,.55); color: white; backdrop-filter: blur(10px); }
.play-button.hidden { display: none; }
.play-button span { margin-left: 4px; font-size: 20px; }
.media-caption { position: absolute; left: 20px; bottom: 16px; font-size: 10px; letter-spacing: .15em; font-weight: 800; }
.detail-content { height: 65%; overflow-y: auto; padding: 18px; }
.detail-content h2 { margin: 6px 0 9px; font-size: 25px; letter-spacing: -.025em; }
.meta-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; margin-top: 20px; }
.meta-grid div { padding: 12px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.meta-grid span, .meta-grid strong { display: block; }
.meta-grid span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.meta-grid strong { font-size: 12px; margin-top: 6px; }
.panel-actions { flex-direction: column; }

.status-pill { position: fixed; z-index: 8; left: 50%; transform: translateX(-50%); bottom: 14px; border-radius: 100px; padding: 9px 13px; font-size: 10px; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #4de29a; box-shadow: 0 0 0 5px rgba(77,226,154,.12); }
.compass { position: fixed; z-index: 8; right: 18px; bottom: 16px; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: var(--muted); }
.compass span { position: absolute; top: 7px; }
.compass-arrow { color: var(--accent); transform: translateY(5px); }

.token-card { position: fixed; z-index: 30; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(620px, calc(100vw - 36px)); padding: 20px; border-radius: 20px; transition: opacity .25s, transform .25s; }
.token-card.hidden { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }
.token-card h3 { margin: 7px 0; }
.token-card p { font-size: 12px; padding-right: 30px; }
.token-row { display: flex; gap: 8px; margin-top: 14px; }
.token-row input { flex: 1; min-width: 0; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: white; border-radius: 12px; padding: 12px 14px; outline: none; }
.token-row input:focus { border-color: var(--accent); }
.token-close { position: absolute; right: 12px; top: 12px; }

.video-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(1,6,11,.78); opacity: 0; pointer-events: none; transition: opacity .2s; padding: 20px; }
.video-modal.open { opacity: 1; pointer-events: auto; }
.video-dialog { position: relative; width: min(900px, 100%); border-radius: 22px; overflow: hidden; background: #081523; border: 1px solid var(--line); box-shadow: var(--shadow); }
.video-dialog video, .video-dialog iframe { display: block; width: 100%; aspect-ratio: 16/9; background: black; border: 0; }
.video-dialog video[hidden], .video-dialog iframe[hidden] { display: none; }
.video-close { position: absolute; right: 12px; top: 12px; z-index: 2; }
.video-info { padding: 18px 20px; }
.video-info h3 { margin: 7px 0 0; }
.location-empty { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.loading-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 16px; background: #06101d; transition: opacity .5s, visibility .5s; }
.loading-screen.hidden { opacity: 0; visibility: hidden; }
.loading-logo { width: 62px; height: 62px; font-size: 20px; }
.loading-bar { width: 180px; height: 3px; background: rgba(255,255,255,.1); overflow: hidden; border-radius: 99px; }
.loading-bar span { display: block; width: 45%; height: 100%; background: var(--accent); animation: loading 1.2s ease-in-out infinite; }
.loading-screen p { color: var(--muted); font-size: 12px; }
@keyframes loading { from { transform: translateX(-110%); } to { transform: translateX(240%); } }

.cesium-viewer-bottom, .cesium-viewer-toolbar, .cesium-viewer-animationContainer, .cesium-viewer-timelineContainer, .cesium-viewer-fullscreenContainer { display: none !important; }
.cesium-widget-credits { opacity: .68; }

.topbar, .intro-card, .location-list, .status-pill, .compass {
  transition: opacity .45s ease, transform .45s ease;
}

body.opening-camera .topbar,
body.opening-camera .intro-card,
body.opening-camera .location-list,
body.opening-camera .status-pill,
body.opening-camera .compass {
  opacity: 0;
  pointer-events: none;
}

body.opening-camera .topbar,
body.opening-camera .intro-card,
body.opening-camera .location-list {
  transform: translateY(-10px);
}

@media (max-width: 760px) {
  .topbar { top: 10px; left: 10px; right: 10px; height: 62px; border-radius: 16px; }
  .brand span, nav .nav-button:first-child { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .intro-card { left: 14px; top: 88px; width: calc(100vw - 28px); padding: 20px; }
  .intro-card h1 { font-size: 30px; }
  .location-list { z-index: 25; left: 10px; right: 10px; bottom: 10px; width: auto; max-height: 62vh; transform: translateY(calc(100% + 24px)); transition: transform .3s; }
  .location-list.open { transform: translateY(0); }
  .mobile-close { display: block; }
  .mobile-list-button { display: block; position: fixed; z-index: 12; left: 14px; bottom: 16px; border-radius: 14px; border: 1px solid var(--line); color: white; padding: 12px 14px; }
  .detail-panel { top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; height: 76vh; transform: translateY(calc(100% + 30px)); }
  .detail-panel.open { transform: translateY(0); }
  .detail-media { height: 36%; min-height: 180px; }
  .detail-content { height: 64%; }
  .status-pill { display: none; }
  .compass { right: 14px; bottom: 16px; }
  .token-card { bottom: 10px; padding: 18px; }
  .token-row { flex-direction: column; }
}
