:root {
  color-scheme: dark;
  --ink: #f8fafc;
  --muted: #aab3c2;
  --panel: rgba(12, 17, 28, .90);
  --line: rgba(255,255,255,.13);
  --accent: #f4e15b;
  --accent-ink: #111827;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, #app { width: 100%; height: 100%; margin: 0; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans JP", sans-serif; background: #0c111c; color: var(--ink); overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
.viewer { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(circle at 50% 40%, #263248, #0c111c 65%); transition: opacity .22s ease; will-change: opacity; }
.viewer-active { opacity: 1; pointer-events: auto; }
#pano { z-index: 1; }
#bufferPano { z-index: 2; }
.topbar { position: fixed; z-index: 4; top: 0; left: 0; right: 0; min-height: 68px; padding: max(14px, env(safe-area-inset-top)) 20px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: linear-gradient(to bottom, rgba(8,12,20,.82), transparent); pointer-events: none; }
.brand, .status { display: flex; align-items: center; gap: 10px; font-weight: 700; text-shadow: 0 1px 8px #000; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: var(--accent-ink); background: var(--accent); text-shadow: none; font-size: 15px; }
.status { font-size: 14px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #8e98a8; box-shadow: 0 0 0 4px rgba(142,152,168,.15); }
.status-dot.live { background: #55d98a; box-shadow: 0 0 0 4px rgba(85,217,138,.16); }
.status-dot.walking { background: var(--accent); box-shadow: 0 0 0 4px rgba(244,225,91,.18); }
.setup-panel { position: fixed; z-index: 5; inset: 0; display: grid; place-items: center; padding: 24px; overflow: auto; background: radial-gradient(circle at 75% 20%, rgba(244,225,91,.12), transparent 34%), linear-gradient(135deg, rgba(8,12,20,.95), rgba(17,24,39,.88)); }
.setup-inner { width: min(100%, 550px); padding: clamp(26px, 5vw, 46px); border: 1px solid var(--line); border-radius: 26px; background: rgba(13,18,29,.83); box-shadow: 0 26px 90px rgba(0,0,0,.38); backdrop-filter: blur(18px); }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0 0 16px; font-size: clamp(32px, 7vw, 58px); line-height: 1.06; letter-spacing: -.045em; }
.intro { color: var(--muted); margin: 0 0 28px; font-size: 16px; line-height: 1.75; }
label { display: block; margin: 18px 0 8px; font-size: 14px; font-weight: 700; }
input[type="text"], input[type="password"] { width: 100%; min-height: 52px; padding: 0 15px; color: var(--ink); background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 12px; outline: none; }
input[type="search"] { width: 100%; min-width: 0; min-height: 48px; padding: 0 14px; color: var(--ink); background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 12px; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(244,225,91,.12); }
.field-row { display: flex; gap: 8px; }
.field-row input { min-width: 0; }
.icon-button, .panel-actions button { border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: rgba(255,255,255,.06); padding: 0 15px; }
.field-note { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.setup-actions { margin-top: 26px; }
.primary-button { width: 100%; min-height: 54px; border: 0; border-radius: 14px; color: var(--accent-ink); background: var(--accent); font-weight: 800; box-shadow: 0 10px 30px rgba(244,225,91,.16); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.error { min-height: 1.4em; margin: 12px 0 0; color: #ff9b9b; font-size: 14px; }
.picker-panel { position: fixed; z-index: 5; left: 18px; top: 86px; width: min(calc(100% - 36px), 410px); max-height: calc(100vh - 104px); overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: 0 16px 60px rgba(0,0,0,.34); backdrop-filter: blur(16px); }
.picker-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.picker-head-actions { display: flex; flex-direction: column; gap: 6px; }
.picker-title-row strong { font-size: 18px; }
.picker-title-row p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.small-button { min-height: 34px; flex: 0 0 auto; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: rgba(255,255,255,.06); font-size: 13px; }
.search-row { display: flex; gap: 8px; margin-top: 15px; }
.search-button { min-width: 70px; border: 0; border-radius: 12px; color: var(--accent-ink); background: var(--accent); font-weight: 800; }
.picker-hint { margin: 12px 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.picker-panel .primary-button { min-height: 48px; }
.destination-box { margin-top: 14px; padding-top: 2px; border-top: 1px solid var(--line); }
.destination-box label { margin-top: 12px; }
.compact-row { margin-top: 0; }
.compact-row .search-button { min-width: 88px; font-size: 13px; }
.map-pick-button { width: 100%; min-height: 36px; margin-top: 7px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: rgba(255,255,255,.06); font-size: 13px; font-weight: 700; }
.map-pick-button:disabled { opacity: .45; cursor: not-allowed; }
.route-summary { margin-top: 10px; padding: 12px; border: 1px solid rgba(244,225,91,.28); border-radius: 13px; background: rgba(244,225,91,.07); }
.route-summary strong, .route-summary span { display: block; }
.route-summary span { margin-top: 3px; color: var(--accent); font-size: 14px; }
.route-summary small { display: block; margin: 8px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.route-summary small + small { margin-top: -4px; color: #dce4f1; }
.route-summary .primary-button { min-height: 42px; }
.secondary-start { width: 100%; min-height: 40px; margin-top: 9px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: rgba(255,255,255,.06); font-weight: 700; }
.secondary-start:disabled, .search-button:disabled { opacity: .45; cursor: not-allowed; }
.control-panel { position: fixed; z-index: 4; left: 50%; bottom: max(8px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 16px), 360px); padding: 9px 12px 10px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); box-shadow: 0 12px 45px rgba(0,0,0,.34); backdrop-filter: blur(16px); transition: width .22s ease, padding .22s ease, bottom .22s ease; }
.panel-toggle { position: absolute; top: -22px; left: 50%; width: 54px; height: 23px; transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 11px 11px 0 0; color: var(--ink); background: var(--panel); font-size: 18px; line-height: 1; }
.location-line { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.location-label { color: var(--ink); font-weight: 700; }
.route-progress { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 12px; }
.route-progress span { max-width: 72%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.route-progress strong { color: var(--accent); }
.main-controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 7px 0; }
.round-button { display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); color: var(--ink); background: rgba(255,255,255,.07); }
.round-button.secondary { width: 38px; height: 38px; font-size: 21px; }
.round-button.play { width: 52px; height: 52px; border: 0; color: var(--accent-ink); background: var(--accent); font-size: 20px; box-shadow: 0 7px 22px rgba(244,225,91,.20); }
.round-button:hover, .panel-actions button:hover, .icon-button:hover { background-color: rgba(255,255,255,.13); }
.round-button.play:hover { background: #ffeb62; }
.speed-control label { display: flex; justify-content: space-between; margin: 0 0 3px; font-size: 12px; }
.speed-control output { color: var(--accent); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.direction-control { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 5px 0 0; color: var(--muted); font-size: 13px; font-weight: 650; cursor: pointer; }
.direction-control input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.panel-actions { display: flex; gap: 6px; margin-top: 7px; }
.panel-actions button { flex: 1; min-height: 32px; font-size: 12px; }
.control-panel.is-collapsed { bottom: max(2px, env(safe-area-inset-bottom)); width: 82px; padding: 4px 8px 6px; border-radius: 16px 16px 10px 10px; }
.control-panel.is-collapsed .route-progress,
.control-panel.is-collapsed .location-line,
.control-panel.is-collapsed .speed-control,
.control-panel.is-collapsed .direction-control,
.control-panel.is-collapsed .panel-actions,
.control-panel.is-collapsed .round-button.secondary { display: none; }
.control-panel.is-collapsed .main-controls { margin: 0; }
.control-panel.is-collapsed .round-button.play { width: 50px; height: 50px; }
.control-panel.is-collapsed .panel-toggle { top: -20px; }
.route-mini-panel { position: fixed; z-index: 4; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); width: min(24vw, 230px); height: min(34vh, 260px); min-width: 170px; min-height: 170px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 12px 42px rgba(0,0,0,.32); }
.mini-map-title { position: absolute; z-index: 2; top: 8px; left: 8px; padding: 5px 9px; border-radius: 9px; color: var(--ink); background: rgba(12,17,28,.88); box-shadow: 0 2px 10px rgba(0,0,0,.25); font-size: 12px; font-weight: 800; pointer-events: none; }
.route-mini-map { width: 100%; height: 100%; }
.route-mini-panel.is-tour { width: min(30vw, 290px); height: min(42vh, 320px); border-color: rgba(244,225,91,.55); }
.route-mini-panel.is-tour .mini-map-title { color: var(--accent); }
.sync-panel { position: fixed; z-index: 9; top: 82px; right: 14px; width: min(calc(100% - 28px), 350px); padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: rgba(12,17,28,.96); box-shadow: 0 18px 65px rgba(0,0,0,.42); backdrop-filter: blur(18px); }
.sync-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.sync-title-row strong { font-size: 18px; }
.sync-title-row p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.sync-close { flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: rgba(255,255,255,.06); font-size: 20px; }
.sync-create { min-height: 46px; margin-top: 16px; }
.sync-divider { display: flex; align-items: center; gap: 10px; margin: 13px 0 5px; color: var(--muted); font-size: 12px; }
.sync-divider::before, .sync-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.sync-panel label { margin-top: 8px; }
.sync-panel input { text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.sync-join { min-width: 72px; border: 0; border-radius: 12px; color: var(--accent-ink); background: var(--accent); font-weight: 800; }
.sync-role { display: inline-block; margin-top: 16px; padding: 5px 9px; border-radius: 999px; color: var(--accent-ink); background: var(--accent); font-size: 12px; font-weight: 800; }
.sync-code-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 13px; color: var(--muted); font-size: 13px; }
.sync-code-row strong { color: var(--ink); font-size: 24px; letter-spacing: .14em; }
.sync-count, .sync-hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.voice-controls { margin-top: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.04); }
.voice-status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.voice-status-row strong { color: var(--ink); }
.voice-actions { display: flex; gap: 7px; margin-top: 9px; }
.voice-actions button { flex: 1; min-height: 38px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: rgba(255,255,255,.07); font-size: 12px; font-weight: 800; }
.voice-actions #voiceButton.is-live { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.voice-controls small { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.sync-actions { display: flex; gap: 7px; margin-top: 12px; }
.sync-actions button { flex: 1; min-height: 38px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: rgba(255,255,255,.06); font-size: 12px; font-weight: 700; }
.sync-panel.is-guest .sync-role { color: #092e1b; background: #55d98a; }
.control-panel.is-guest #playButton { opacity: .55; }
.guide-button { position: fixed; z-index: 7; left: 14px; bottom: max(14px, env(safe-area-inset-bottom)); min-width: 78px; min-height: 42px; padding: 0 15px; border: 1px solid rgba(244,225,91,.52); border-radius: 22px; color: var(--accent-ink); background: var(--accent); box-shadow: 0 8px 28px rgba(0,0,0,.35); font-size: 13px; font-weight: 850; }
.guide-button.is-loading { opacity: .7; cursor: wait; }
.ai-guide-panel { position: fixed; z-index: 7; left: 14px; bottom: max(66px, calc(env(safe-area-inset-bottom) + 55px)); width: min(calc(100% - 28px), 340px); max-height: min(42vh, 260px); overflow: auto; padding: 12px 13px; border: 1px solid rgba(255,255,255,.16); border-radius: 14px; color: var(--ink); background: rgba(12,17,28,.88); box-shadow: 0 12px 38px rgba(0,0,0,.32); backdrop-filter: blur(14px); }
.ai-guide-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.ai-guide-head strong { display: block; margin-top: 3px; font-size: 14px; }
.ai-guide-head-actions { display: flex; align-items: center; gap: 4px; }
.ai-guide-head-actions button { width: 30px; height: 30px; border: 0; border-radius: 9px; color: var(--ink); background: rgba(255,255,255,.07); font-size: 16px; }
.ai-guide-badge { color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.ai-guide-place { margin: 7px 0 0; color: var(--accent); font-size: 11px; font-weight: 750; }
.ai-guide-loading { margin-top: 8px; padding: 9px; border-radius: 9px; color: var(--muted); background: rgba(255,255,255,.05); text-align: center; font-size: 12px; }
.ai-guide-content { margin-top: 8px; color: #eef2f8; font-size: 12px; line-height: 1.62; white-space: pre-wrap; }
.ai-guide-sources { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); }
.ai-guide-sources strong { display: block; margin-bottom: 7px; font-size: 12px; }
.ai-guide-sources a { display: block; margin-top: 5px; overflow: hidden; color: #9fc8ff; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ai-guide-error { margin: 8px 0 0; color: #ffb3b3; font-size: 11px; line-height: 1.45; }
.ai-guide-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.ai-guide-actions button { min-height: 29px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: rgba(255,255,255,.07); font-size: 11px; font-weight: 750; }
.ai-guide-note { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.ai-guide-panel.is-collapsed { width: 158px; max-height: 44px; overflow: hidden; padding: 7px 8px 7px 11px; }
.ai-guide-panel.is-collapsed .ai-guide-head { align-items: center; }
.ai-guide-panel.is-collapsed .ai-guide-badge,
.ai-guide-panel.is-collapsed #closeAiGuide,
.ai-guide-panel.is-collapsed .ai-guide-place,
.ai-guide-panel.is-collapsed .ai-guide-loading,
.ai-guide-panel.is-collapsed .ai-guide-content,
.ai-guide-panel.is-collapsed .ai-guide-sources,
.ai-guide-panel.is-collapsed .ai-guide-error,
.ai-guide-panel.is-collapsed .ai-guide-actions,
.ai-guide-panel.is-collapsed .ai-guide-note { display: none !important; }
.ai-guide-panel.is-collapsed .ai-guide-head strong { margin: 0; font-size: 12px; white-space: nowrap; }
.toast { position: fixed; z-index: 8; top: 80px; left: 50%; transform: translateX(-50%); max-width: min(90vw, 520px); padding: 12px 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(12,17,28,.94); box-shadow: 0 8px 30px rgba(0,0,0,.3); font-size: 14px; text-align: center; }
@media (max-width: 900px) {
  .route-mini-panel { bottom: max(82px, calc(env(safe-area-inset-bottom) + 72px)); }
}
@media (max-width: 520px) {
  .topbar { padding-left: 14px; padding-right: 14px; }
  .brand { font-size: 15px; }
  .setup-panel { padding: 14px; }
  .setup-inner { padding: 25px 20px; border-radius: 20px; }
  .control-panel { bottom: max(6px, env(safe-area-inset-bottom)); }
  .picker-panel { left: 10px; top: 72px; width: calc(100% - 20px); padding: 15px; }
  .route-mini-panel { right: 8px; bottom: max(78px, calc(env(safe-area-inset-bottom) + 70px)); width: 132px; min-width: 0; height: 168px; min-height: 0; border-radius: 13px; }
  .route-mini-panel.is-tour { width: 168px; height: 220px; }
  .sync-panel { top: 72px; right: 10px; width: calc(100% - 20px); }
  .guide-button { left: 9px; bottom: max(9px, env(safe-area-inset-bottom)); }
  .ai-guide-panel { left: 9px; bottom: max(59px, calc(env(safe-area-inset-bottom) + 50px)); width: min(calc(100% - 18px), 330px); max-height: 38vh; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
