/* Optional decorative override — drop KitchenMaster.woff2 into assets/fonts/ to enable */
/*
@font-face {
    font-family: 'Kitchen Master';
    src: url('assets/fonts/KitchenMaster.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
*/

:root {
    /* Agent bubble: Noto Sans family covers all 30 i18n scripts; system fonts when offline */
    --agent-bubble-font:
        'Noto Sans', 'Noto Sans JP', 'Noto Sans SC', 'Noto Sans TC', 'Noto Sans KR',
        'Noto Sans Arabic', 'Noto Sans Thai', 'Noto Sans Devanagari', 'Noto Sans Bengali', 'Noto Sans Hebrew',
        system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
        'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI',
        'PingFang SC', 'Microsoft YaHei', 'Malgun Gothic', sans-serif;
    --primary: #0071e3; /* iOS Premium Blue */
    --danger: #ff3b30;
    --warning: #ff9500; /* Richer Warning Orange */
    --success: #34c759;
    --dark-bg: rgba(22, 22, 23, 0.85);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-color: #1d1d1f; /* Apple Off-Black */
    --text-primary: #1d1d1f; /* 本文見出し（未定義だと白文字消失するため明示定義） */
    --text-muted: #86868b; /* Apple Gray */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
    --hud-text: var(--text-color);
    --bg-color: #ffffff;
    --route-ai-color: #ff6b00;
    --route-accessible-color: #5e5ce6;
    --hud-safe-area-top: max(env(safe-area-inset-top, 10px), 10px);
    --top-status-bar-body: 42px;
    --dynamic-island-gap: 8px;
    --safe-zone-guide-gap: 10px;
    --safe-zone-guide-height: 132px;
    --safe-zone-guide-top: calc(var(--hud-safe-area-top) + var(--top-status-bar-body) + var(--safe-zone-guide-gap));
    --dynamic-island-top: calc(var(--hud-safe-area-top) + var(--top-status-bar-body) + var(--dynamic-island-gap));
    --agent-width: 72px;
    --agent-height: 72px;
    --agent-dock-offset: 160px;
    --agent-bubble-gap: 12px;
    --agent-bubble-max-height: 148px;
    --report-legend-gap: 10px;
    --bottom-dock-clearance: 94px;
    --report-legend-bottom: calc(var(--bottom-dock-clearance) + var(--report-legend-gap));
}
body.tenden-nav-active:not(.ep-mode) {
    --report-legend-bottom: calc(var(--bottom-dock-clearance) + 62px + var(--report-legend-gap));
}
body.ep-mode {
    --report-legend-bottom: calc(var(--report-legend-gap) + 4px);
}

.mode-emergency {
    --primary: #ff6b00; /* Glowing Orange Accent for Emergency */
    --glass-bg: rgba(18, 18, 20, 0.9);
    --glass-border: rgba(255, 59, 48, 0.25);
    --text-color: #ffffff;
    --text-primary: #ffffff;
    --text-muted: #ebebf5;
    --hud-text: #ffffff;
    --bg-color: #000000;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', -apple-system, sans-serif; }
h1, h2, h3, h4, h5, h6, 
.sp-header-title, 
.status-badge, 
.status-time, 
.action-btn, 
.demo-hero-title, 
.demo-step-title,
.ai-route-btn,
.short-route-btn,
.avoid-route-btn,
.acc-route-btn,
.rcb-confirm-btn,
.rcb-instruction,
.report-choice-label,
.sp-card-label,
.dialog-header h2,
.eh-title,
.evac-instruction,
.btn-flashy,
.ep-phase,
.ep-total,
.ep-time {
    font-family: 'Outfit', -apple-system, sans-serif;
    letter-spacing: -0.01em;
}
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; color: var(--text-color); }
#map { width: 100%; height: 100%; z-index: 1; }

/* Leaflet Overrides */
.leaflet-control-container .leaflet-top.leaflet-left { display: none; } /* Hide default zoom */
.leaflet-control-attribution { display: none; } /* Hide attribution for cleaner UI */

/* Utilities */
.hidden { display: none !important; }
.w-100 { width: 100%; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }

/* Glass Panel Base */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md), inset 0 1.5px 1.5px rgba(255, 255, 255, 0.25);
    color: var(--text-color);
}

/* ルート選択シートは半透明だと後ろの地図が透けて読みにくいため不透明にする */
.route-bottom-sheet.glass-panel { background: #ffffff; }
.mode-emergency .route-bottom-sheet.glass-panel { background: #16161a; }

/* Top Status Bar (Full width rectangular style) */
.top-status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: max(env(safe-area-inset-top, 10px), 10px) 16px 10px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    flex-wrap: nowrap;
    overflow: hidden;
}

.status-left, .status-right { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    flex-shrink: 0;
}

.status-badge {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.95rem; font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.status-icon { font-size: 0.85rem; font-weight: 600; opacity: 0.8; }
.elev-badge { background: rgba(0,0,0,0.05); padding: 4px 10px; border-radius: 8px; }
.mode-emergency .elev-badge { background: rgba(255,255,255,0.1); }
.coast-dist-badge { background: rgba(0,122,255,0.08); padding: 4px 10px; border-radius: 8px; color: var(--accent, #007aff); }
.mode-emergency .coast-dist-badge { background: rgba(255,255,255,0.1); color: #fff; }

/* Community Reports Legend — bottom-right (agent/bubble stack is left-only) */
.report-legend {
    position: absolute;
    left: auto;
    right: max(env(safe-area-inset-right, 12px), 12px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--report-legend-bottom));
    z-index: 885;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 8px 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    min-width: 112px;
    max-width: min(168px, calc(100vw - 24px - env(safe-area-inset-right, 0px) - env(safe-area-inset-left, 0px)));
    max-height: min(168px, calc(100% - env(safe-area-inset-top, 0px) - 120px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
}
.report-legend-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 7px;
}
.report-legend-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #333;
    letter-spacing: 0.02em;
}
.report-legend-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; line-height: 1; color: #666;
    min-width: 44px; min-height: 44px;
    margin: -10px -8px -10px 0;
    padding: 0;
    display: flex; align-items: center; justify-content: center;
    opacity: 0.7;
    -webkit-tap-highlight-color: transparent;
}
.report-legend-close:active { opacity: 1; }
.report-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    color: #333;
    margin-bottom: 4px;
}
.report-legend-item:last-child { margin-bottom: 0; }
.report-legend-dot {
    width: 11px; height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,0.9);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
@container tenden-app (max-width: 420px) {
    .report-legend {
        padding: 7px 8px;
        min-width: 108px;
        max-width: min(156px, calc(100vw - 24px - env(safe-area-inset-right, 0px) - env(safe-area-inset-left, 0px)));
    }
    .report-legend-title { font-size: 0.7rem; }
    .report-legend-item { font-size: 0.75rem; gap: 6px; margin-bottom: 3px; }
    .report-legend-dot { width: 10px; height: 10px; }
}
.slot-content { display: flex; align-items: center; gap: 6px; }

@keyframes orbBreathe {
    0%, 100% { transform: scale(0.85); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 1; }
}

/* ── TENDEN Agent (左下・HUD/FAB非重複) ──
   column-reverse stack: sprite (bottom) → bubble */
#tenden-agent {
    position: absolute;
    left: max(env(safe-area-inset-left, 28px), 28px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--agent-dock-offset));
    z-index: 880;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    width: auto;
    min-width: var(--agent-width);
    max-width: min(280px, calc(100vw - 88px));
    height: auto;
    pointer-events: none;
    overflow: visible;
    opacity: 1;
    visibility: visible;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}
/* メインアプリ: オンボーディング終了後は #app-container 直下で左下表示を保証 */
body:not(.onboarding-demo-active) #app-container > #tenden-agent {
    opacity: 1;
    visibility: visible;
}
.tenden-agent-bubble {
    position: relative;
    left: auto;
    bottom: auto;
    flex-shrink: 0;
    order: 1;
    width: 100%;
    min-width: 120px;
    max-width: min(280px, calc(100vw - 88px));
    margin-bottom: var(--agent-bubble-gap);
    padding: 0;
    border-radius: 14px;
    background: rgba(15, 15, 15, 0.94);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: #fff;
    opacity: 0;
    transform: translateY(10px) scale(0.94);
    transform-origin: left bottom;
    transition:
        opacity 0.35s ease,
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: visible;
    pointer-events: none;
    z-index: 2;
}
.tenden-agent-bubble-scroll {
    max-height: var(--agent-bubble-max-height);
    min-width: 0;
    padding: 10px 14px 12px;
    border-radius: inherit;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.tenden-agent-bubble-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}
.tenden-agent-bubble::after {
    content: '';
    position: absolute;
    left: 22px;
    bottom: -5px;
    width: 10px;
    height: 10px;
    background: rgba(15, 15, 15, 0.94);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    transform: rotate(45deg);
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    z-index: 0;
}
#tenden-agent.tenden-agent--interactive {
    pointer-events: auto;
}
.tenden-agent-bubble--interactive {
    pointer-events: auto;
}
.tenden-agent-bubble--interactive .tenden-agent-bubble-scroll {
    padding: 10px 32px 10px 12px;
}
.tenden-agent-bubble-dismiss {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s, transform 0.15s;
}
.tenden-agent-bubble-dismiss:active { transform: scale(0.92); }
.tenden-agent-bubble-dismiss.hidden { display: none; }
.tenden-agent-bubble-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    max-width: 100%;
}
.tenden-agent-bubble-actions.hidden { display: none; }
.tenden-agent-bubble-chip {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s, background 0.2s;
}
.tenden-agent-bubble-chip:active { transform: scale(0.96); }
.tenden-agent-bubble-chip.primary {
    background: rgba(0, 113, 227, 0.88);
    border-color: rgba(0, 113, 227, 0.95);
}
.tenden-agent-bubble-text {
    margin: 0;
    font-family: var(--agent-bubble-font);
    font-size: 0.92rem;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0.015em;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-feature-settings: 'kern' 1;
    font-variant-ligatures: common-ligatures;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    color: rgba(255, 255, 255, 0.96);
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.38),
        0 0 14px rgba(255, 255, 255, 0.05);
}
@container tenden-app (max-width: 420px) {
    .tenden-agent-bubble-text {
        font-size: 0.86rem;
        line-height: 1.55;
        letter-spacing: 0.01em;
    }
}
.tenden-agent-bubble--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.tenden-agent-bubble--exiting {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
    transition-duration: 0.28s;
}
.tenden-agent-bubble[data-bubble-type="info"] {
    border-left: 3px solid rgba(0, 113, 227, 0.95);
}
.tenden-agent-bubble[data-bubble-type="success"],
.tenden-agent-bubble[data-bubble-type="copied"] {
    border-left: 3px solid rgba(52, 199, 89, 0.95);
}
.tenden-agent-bubble[data-bubble-type="warning"] {
    border-left: 3px solid rgba(255, 149, 0, 0.95);
}
.tenden-agent-bubble[data-bubble-type="error"] {
    border-left: 3px solid rgba(255, 59, 48, 0.95);
}
.tenden-agent-bubble.hidden { display: none; }
.tenden-agent-visual {
    position: relative;
    flex-shrink: 0;
    order: 0;
    width: var(--agent-width);
    height: var(--agent-height);
}
.tenden-agent-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(0, 113, 227, 0.92), rgba(52, 199, 89, 0.85));
    box-shadow: 0 6px 20px rgba(0, 113, 227, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #fff;
    text-transform: uppercase;
    animation: agentIdleFloat 4s ease-in-out infinite;
}
.tenden-agent-placeholder::after {
    content: 'Agent';
}
.tenden-agent-placeholder.hidden { display: none; }
.tenden-agent-asset {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.tenden-agent-asset.is-active { opacity: 1; }
.tenden-agent-asset--image,
.tenden-agent-asset--svg {
    object-fit: contain;
    object-position: center bottom;
    transform-origin: center bottom;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.28));
}
/* Sprite animations — grouped by manifest animation type */
.tenden-agent--idle .tenden-agent-asset.is-active,
.tenden-agent--route-plan .tenden-agent-asset.is-active,
.tenden-agent--navigate .tenden-agent-asset.is-active,
.tenden-agent--ar-demo .tenden-agent-asset.is-active,
.tenden-agent--evac-active .tenden-agent-asset.is-active,
.tenden-agent--directing .tenden-agent-asset.is-active,
.tenden-agent--high-ground .tenden-agent-asset.is-active,
.tenden-agent--scout .tenden-agent-asset.is-active,
.tenden-agent--flood .tenden-agent-asset.is-active,
.tenden-agent--watch-coast .tenden-agent-asset.is-active,
.tenden-agent--thinking .tenden-agent-asset.is-active,
.tenden-agent--warn .tenden-agent-asset.is-active {
    animation: agentBob 3.4s ease-in-out infinite;
}
.tenden-agent--route-plan .tenden-agent-asset.is-active,
.tenden-agent--thinking .tenden-agent-asset.is-active {
    animation-duration: 2.6s;
}
.tenden-agent--search .tenden-agent-asset.is-active,
.tenden-agent--destination .tenden-agent-asset.is-active,
.tenden-agent--monitor .tenden-agent-asset.is-active,
.tenden-agent--safety-share .tenden-agent-asset.is-active,
.tenden-agent--synced .tenden-agent-asset.is-active,
.tenden-agent--checkin .tenden-agent-asset.is-active,
.tenden-agent--listening .tenden-agent-asset.is-active,
.tenden-agent--celebrate .tenden-agent-asset.is-active {
    animation: agentPulse 1.8s ease-in-out infinite;
}
.tenden-agent--destination .tenden-agent-asset.is-active,
.tenden-agent--synced .tenden-agent-asset.is-active,
.tenden-agent--celebrate .tenden-agent-asset.is-active {
    animation-duration: 2.8s;
}
.tenden-agent--halt .tenden-agent-asset.is-active,
.tenden-agent--broadcast .tenden-agent-asset.is-active,
.tenden-agent--urgent .tenden-agent-asset.is-active,
.tenden-agent--night-alert .tenden-agent-asset.is-active,
.tenden-agent--alert .tenden-agent-asset.is-active {
    animation: agentAlertBob 0.75s ease-in-out infinite;
}
.tenden-agent-message.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.tenden-agent--listening .tenden-agent-placeholder { animation: agentListenPulse 1.2s ease-in-out infinite; }
.tenden-agent--thinking .tenden-agent-placeholder { animation: agentThinkSpin 2.4s linear infinite; }
.tenden-agent--alert .tenden-agent-placeholder {
    background: linear-gradient(145deg, #ff3b30, #ff9500);
    animation: agentAlertShake 0.55s ease-in-out infinite;
}
.tenden-agent--celebrate .tenden-agent-placeholder { animation: agentCelebratePop 0.9s cubic-bezier(0.16, 1, 0.3, 1) infinite; }
.tenden-agent--warn .tenden-agent-placeholder {
    background: linear-gradient(145deg, #ff9500, #ffcc00);
    animation: agentWarnBlink 1.1s ease-in-out infinite;
}
.mode-emergency { --agent-dock-offset: 212px; }
body.tenden-nav-active { --agent-dock-offset: 222px; }
body.tenden-nav-active .mode-emergency { --agent-dock-offset: 222px; }
@keyframes agentIdleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
@keyframes agentListenPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 113, 227, 0.35); }
    50% { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(0, 113, 227, 0); }
}
@keyframes agentThinkSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes agentAlertShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}
@keyframes agentCelebratePop {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.12); }
}
@keyframes agentWarnBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}
@keyframes agentBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
@keyframes agentPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}
@keyframes agentAlertBob {
    0%, 100% { transform: translateY(0) scale(1); }
    35% { transform: translateY(-4px) scale(1.04); }
    70% { transform: translateY(1px) scale(0.98); }
}
@media (prefers-reduced-motion: reduce) {
    .tenden-agent-placeholder,
    .tenden-agent--listening .tenden-agent-placeholder,
    .tenden-agent--thinking .tenden-agent-placeholder,
    .tenden-agent--alert .tenden-agent-placeholder,
    .tenden-agent--celebrate .tenden-agent-placeholder,
    .tenden-agent--warn .tenden-agent-placeholder,
    .tenden-agent-asset.is-active,
    .tenden-agent--idle .tenden-agent-asset.is-active,
    .tenden-agent--search .tenden-agent-asset.is-active,
    .tenden-agent--halt .tenden-agent-asset.is-active,
    .tenden-agent--route-plan .tenden-agent-asset.is-active,
    .tenden-agent--navigate .tenden-agent-asset.is-active,
    .tenden-agent--broadcast .tenden-agent-asset.is-active,
    .tenden-agent--destination .tenden-agent-asset.is-active,
    .tenden-agent--ar-demo .tenden-agent-asset.is-active,
    .tenden-agent--evac-active .tenden-agent-asset.is-active,
    .tenden-agent--directing .tenden-agent-asset.is-active,
    .tenden-agent--high-ground .tenden-agent-asset.is-active,
    .tenden-agent--monitor .tenden-agent-asset.is-active,
    .tenden-agent--scout .tenden-agent-asset.is-active,
    .tenden-agent--safety-share .tenden-agent-asset.is-active,
    .tenden-agent--urgent .tenden-agent-asset.is-active,
    .tenden-agent--synced .tenden-agent-asset.is-active,
    .tenden-agent--night-alert .tenden-agent-asset.is-active,
    .tenden-agent--flood .tenden-agent-asset.is-active,
    .tenden-agent--checkin .tenden-agent-asset.is-active,
    .tenden-agent--watch-coast .tenden-agent-asset.is-active,
    .tenden-agent--listening .tenden-agent-asset.is-active,
    .tenden-agent--thinking .tenden-agent-asset.is-active,
    .tenden-agent--alert .tenden-agent-asset.is-active,
    .tenden-agent--warn .tenden-agent-asset.is-active,
    .tenden-agent--celebrate .tenden-agent-asset.is-active {
        animation: none !important;
    }
    .tenden-agent-bubble {
        transition: opacity 0.01ms linear;
    }
}
.tenden-agent--reduced-motion .tenden-agent-asset.is-active {
    animation: none !important;
}

/* Model area demo — compact exit chip above bottom dock */
.model-area-dismiss-chip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(env(safe-area-inset-bottom, 12px) + 158px);
    z-index: 961;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 159, 10, 0.94);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 6px 22px rgba(255, 159, 10, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    animation: coastChipIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.model-area-dismiss-chip:active {
    transform: translateX(-50%) scale(0.96);
}
.model-area-dismiss-chip.hidden { display: none; }
.model-area-dismiss-chip svg {
    flex-shrink: 0;
    opacity: 0.92;
}
.coast-dist-dismiss-chip:not(.hidden) ~ .model-area-dismiss-chip:not(.hidden) {
    bottom: calc(env(safe-area-inset-bottom, 12px) + 168px);
}
body.tenden-nav-active .model-area-dismiss-chip,
body.ep-mode .model-area-dismiss-chip {
    bottom: calc(env(safe-area-inset-bottom, 12px) + 188px);
}
body.tenden-nav-active .coast-dist-dismiss-chip:not(.hidden) ~ .model-area-dismiss-chip:not(.hidden),
body.ep-mode .coast-dist-dismiss-chip:not(.hidden) ~ .model-area-dismiss-chip:not(.hidden) {
    bottom: calc(env(safe-area-inset-bottom, 12px) + 198px);
}
.mode-emergency .model-area-dismiss-chip {
    background: rgba(255, 149, 0, 0.88);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Coast distance mode — floating dismiss chip above bottom dock */
.coast-dist-dismiss-chip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(env(safe-area-inset-bottom, 12px) + 118px);
    z-index: 960;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #ff375f;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 6px 22px rgba(255, 55, 95, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    animation: coastChipIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.coast-dist-dismiss-chip:active {
    transform: translateX(-50%) scale(0.96);
}
.coast-dist-dismiss-chip.hidden { display: none; }
.coast-dist-dismiss-chip svg {
    flex-shrink: 0;
    opacity: 0.9;
}
.mode-emergency .coast-dist-dismiss-chip {
    background: rgba(28, 28, 30, 0.92);
    color: #ff6b8a;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
body.tenden-nav-active .coast-dist-dismiss-chip,
body.ep-mode .coast-dist-dismiss-chip {
    bottom: calc(env(safe-area-inset-bottom, 12px) + 148px);
}
@keyframes coastChipIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.94); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.status-time { font-size: 1.05rem; font-weight: 700; margin: 0 6px; font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; gap: 3px; }
.status-time .status-icon { font-size: 0.85rem; font-weight: 600; opacity: 0.72; }
.hud-time-warn-icon { display: none; font-size: 0.82em; line-height: 1; flex-shrink: 0; }
.status-time.hud-time--watch { color: var(--warning); }
.status-time.hud-time--watch .hud-time-warn-icon { display: inline; }
.status-time.hud-time--danger,
.status-time.hud-time--emergency { color: var(--danger); }
.status-time.hud-time--danger .hud-time-warn-icon,
.status-time.hud-time--emergency .hud-time-warn-icon { display: inline; animation: hudTimeWarnPulse 1.4s ease-in-out infinite; }
.mode-emergency .status-time.hud-time--watch { color: #ffb340; }
.mode-emergency .status-time.hud-time--danger,
.mode-emergency .status-time.hud-time--emergency { color: #ff6961; }
@keyframes hudTimeWarnPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(0.92); }
}

/* HUD tsunami alert chip (JMA P2P code 552) */
.hud-tsunami-chip {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
    -webkit-tap-highlight-color: transparent;
}
.hud-tsunami-chip:active { opacity: 0.82; }
.hud-tsunami-chip--checking { color: var(--text-muted); background: rgba(0, 0, 0, 0.04); }
.hud-tsunami-chip--safe {
    color: #1f8f3b;
    background: rgba(52, 199, 89, 0.14);
    border-color: rgba(52, 199, 89, 0.28);
}
.hud-tsunami-chip--watch {
    color: #a86200;
    background: rgba(255, 149, 0, 0.16);
    border-color: rgba(255, 149, 0, 0.32);
}
.hud-tsunami-chip--danger {
    color: #fff;
    background: linear-gradient(135deg, rgba(215, 38, 38, 0.85), rgba(230, 126, 34, 0.9));
    border-color: rgba(231, 76, 60, 0.45);
    animation: danger-pulse 2s infinite alternate;
}
.mode-emergency .hud-tsunami-chip--safe { color: #5be584; background: rgba(52, 199, 89, 0.18); }
.mode-emergency .hud-tsunami-chip--watch { color: #ffb340; background: rgba(255, 149, 0, 0.2); }

.inundation-depth-badge {
    background: rgba(175, 82, 222, 0.08);
    padding: 4px 10px;
    border-radius: 8px;
    color: #8e44ad;
}
.inundation-depth-badge.depth-outside {
    background: rgba(0, 0, 0, 0.035);
    color: var(--text-muted);
}
.inundation-depth-badge.depth-in-zone {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.18);
    color: #c0392b;
}
.mode-emergency .inundation-depth-badge { background: rgba(255, 255, 255, 0.08); color: #fff; }
.mode-emergency .inundation-depth-badge.depth-in-zone {
    background: rgba(255, 59, 48, 0.22);
    border-color: rgba(255, 59, 48, 0.35);
    color: #ff8a80;
}

/* P2P Status */
.p2p-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

/* Right FABs */
.map-action-fabs {
    position: absolute;
    top: 90px;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    z-index: 900;
}
.fab-container {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 8px;
    position: relative;
    pointer-events: none;
}
.fab-container > * {
    pointer-events: auto;
}
.fab-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    color: var(--text-color);
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; 
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}
.fab-btn svg { width: 20px; height: 20px; }
.fab-btn:active { transform: scale(0.92); }
.fab-btn.fab-active { 
    background: rgba(0,113,227,0.15); 
    color: #0071e3; 
    border-color: rgba(0,113,227,0.35); 
    box-shadow: 0 4px 12px rgba(0,113,227,0.18);
}
.fab-danger { 
    color: var(--danger); 
    border-color: rgba(255,59,48,0.25); 
}

/* Premium visible labels next to circular FAB buttons */
.fab-label {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    font-size: 11px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 10px;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    opacity: 0.85;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Hover behaviors for premium micro-interactions */
.fab-container:hover .fab-label {
    opacity: 1;
    transform: translateX(-4px) scale(1.03);
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.25);
}
.fab-container:hover .fab-btn {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    background: var(--glass-bg);
}
.fab-container:active .fab-label,
.fab-container:active .fab-btn {
    transform: scale(0.95);
}

/* ── Side Panel ─────────────────────────────────────────────────────────── */
.side-panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.side-panel-backdrop.open { opacity: 1; }

.side-panel {
    position: fixed;
    top: 0; right: 0;
    height: 100%;
    width: min(310px, 86vw);
    z-index: 1600;
    background: linear-gradient(180deg, #08081e 0%, #010114 60%, #000010 100%);
    border-left: 1px solid rgba(255,255,255,0.07);
    box-shadow: -12px 0 40px rgba(0,0,0,0.6);
    transform: translateX(110%);
    transition: transform 0.42s cubic-bezier(0.34,1.2,0.64,1);
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow-y: auto;
}
.side-panel.open { transform: translateX(0); }

.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 20px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sp-header-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: white;
    letter-spacing: 0.06em;
}
.sp-header-sub {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.35);
    margin-top: 1px;
    letter-spacing: 0.04em;
}
.sp-close-btn {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.7);
    transition: background 0.15s;
}
.sp-close-btn:active { background: rgba(255,255,255,0.2); }

.side-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px 14px 24px;
}
.sp-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 18px 8px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    cursor: pointer;
    color: white;
    position: relative;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.04);
}
.sp-card:hover {
    transform: translateY(-2px) scale(1.02);
}
.sp-card:active { 
    transform: scale(0.96) translateY(0); 
}
.sp-card-full {
    grid-column: 1 / -1;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding-right: 44px !important;
}
.sp-card-full::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 14px;
    background-color: rgba(255, 255, 255, 0.3);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M1 1l5 6-5 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M1 1l5 6-5 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
    transition: transform 0.22s, background-color 0.22s;
}
.sp-card-full:hover::after {
    background-color: rgba(255, 255, 255, 0.85);
    transform: translateY(-50%) translateX(2px);
}
.sp-card-icon {
    width: 50px; height: 50px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    flex-shrink: 0;
}
.sp-card-full .sp-card-icon { width: 44px; height: 44px; border-radius: 12px; }
.sp-card-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    text-align: center;
    line-height: 1.3;
}
.sp-card-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.sp-card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Outfit', -apple-system, sans-serif;
    letter-spacing: 0.01em;
    text-align: left;
}
.sp-card-subtitle {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.42);
    font-weight: 500;
    text-align: left;
}

/* Card specific premium styling */
.sp-card[data-trigger="btn-toggle-layers"] {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.12) 0%, rgba(94, 92, 230, 0.04) 100%);
    border-color: rgba(0, 122, 255, 0.2);
}
.sp-card[data-trigger="btn-toggle-layers"]:hover {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.18) 0%, rgba(94, 92, 230, 0.06) 100%);
    border-color: rgba(0, 122, 255, 0.35);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.15);
}

.sp-card[data-trigger="btn-focus-model"] {
    background: linear-gradient(135deg, rgba(94, 92, 230, 0.12) 0%, rgba(191, 90, 242, 0.04) 100%);
    border-color: rgba(94, 92, 230, 0.2);
}
.sp-card[data-trigger="btn-focus-model"]:hover {
    background: linear-gradient(135deg, rgba(94, 92, 230, 0.18) 0%, rgba(191, 90, 242, 0.06) 100%);
    border-color: rgba(94, 92, 230, 0.35);
    box-shadow: 0 4px 16px rgba(94, 92, 230, 0.15);
}

.sp-card[data-trigger="btn-settings"] {
    background: linear-gradient(135deg, rgba(72, 72, 74, 0.15) 0%, rgba(99, 99, 102, 0.05) 100%);
    border-color: rgba(99, 99, 102, 0.2);
}
.sp-card[data-trigger="btn-settings"]:hover {
    background: linear-gradient(135deg, rgba(72, 72, 74, 0.22) 0%, rgba(99, 99, 102, 0.08) 100%);
    border-color: rgba(99, 99, 102, 0.35);
}

.sp-card#sp-quake-card {
    background: linear-gradient(135deg, rgba(255, 107, 0, 0.12) 0%, rgba(255, 59, 48, 0.04) 100%);
    border-color: rgba(255, 59, 48, 0.2);
}
.sp-card#sp-quake-card:hover {
    background: linear-gradient(135deg, rgba(255, 107, 0, 0.18) 0%, rgba(255, 59, 48, 0.06) 100%);
    border-color: rgba(255, 59, 48, 0.35);
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.15);
}

.sp-card[data-trigger="btn-coastline-dist"] {
    background: linear-gradient(135deg, rgba(255, 55, 95, 0.12) 0%, rgba(255, 59, 48, 0.04) 100%);
    border-color: rgba(255, 55, 95, 0.2);
}
.sp-card[data-trigger="btn-coastline-dist"]:hover {
    background: linear-gradient(135deg, rgba(255, 55, 95, 0.18) 0%, rgba(255, 59, 48, 0.06) 100%);
    border-color: rgba(255, 55, 95, 0.35);
    box-shadow: 0 4px 16px rgba(255, 55, 95, 0.15);
}

.sp-card#sp-report-card {
    background: linear-gradient(135deg, rgba(255, 159, 10, 0.12) 0%, rgba(255, 107, 0, 0.04) 100%);
    border-color: rgba(255, 159, 10, 0.2);
}
.sp-card#sp-report-card:hover {
    background: linear-gradient(135deg, rgba(255, 159, 10, 0.18) 0%, rgba(255, 107, 0, 0.06) 100%);
    border-color: rgba(255, 159, 10, 0.35);
    box-shadow: 0 4px 16px rgba(255, 159, 10, 0.15);
}

/* Full width card premium styling */
.sp-card-full#sp-ai-card {
    background: linear-gradient(135deg, rgba(255, 110, 0, 0.15) 0%, rgba(255, 159, 10, 0.05) 100%) !important;
    border-color: rgba(255, 110, 0, 0.25) !important;
}
.sp-card-full#sp-ai-card:hover {
    background: linear-gradient(135deg, rgba(255, 110, 0, 0.22) 0%, rgba(255, 159, 10, 0.08) 100%) !important;
    border-color: rgba(255, 110, 0, 0.45) !important;
    box-shadow: 0 8px 24px rgba(255, 110, 0, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
}

.sp-card-full#sp-share-card {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.15) 0%, rgba(36, 138, 61, 0.05) 100%) !important;
    border-color: rgba(52, 199, 89, 0.25) !important;
}
.sp-card-full#sp-share-card:hover {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.22) 0%, rgba(36, 138, 61, 0.08) 100%) !important;
    border-color: rgba(52, 199, 89, 0.45) !important;
    box-shadow: 0 8px 24px rgba(52, 199, 89, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
}

#sp-announcements-card {
    background: linear-gradient(135deg, rgba(94, 92, 230, 0.15) 0%, rgba(0, 113, 227, 0.05) 100%) !important;
    border-color: rgba(94, 92, 230, 0.25) !important;
}
#sp-announcements-card:hover {
    background: linear-gradient(135deg, rgba(94, 92, 230, 0.22) 0%, rgba(0, 113, 227, 0.08) 100%) !important;
    border-color: rgba(94, 92, 230, 0.45) !important;
    box-shadow: 0 8px 24px rgba(94, 92, 230, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
}

/* Emergency-mode highlight for the coastline-distance FAB inside the "more" menu */
#fab-coastline-container.fab-highlight .fab-btn {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    box-shadow: 0 0 12px rgba(255,59,48,0.5);
}
#fab-coastline-container.fab-highlight .fab-label {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    opacity: 1;
}


/* Bottom Sheet */
.bottom-sheet {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    border-radius: 24px 24px 0 0;
    padding: 6px 10px calc(env(safe-area-inset-bottom, 12px) + 10px);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1), max-height 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-bottom: none;
    max-height: 50vh;
    overflow: visible;
}
.bottom-sheet.panel-expanded {
    max-height: 85vh;
    overflow-y: auto;
}

.passing-shelter-container {
    z-index: 500;
    pointer-events: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.bottom-sheet-handle {
    width: 36px; height: 4px;
    background: rgba(120,120,120,0.3);
    border-radius: 2px;
    margin: 0 auto 8px;
}
.mode-emergency .bottom-sheet-handle { background: rgba(255,255,255,0.3); }

/* ── Bottom dock (trunk + sub-sheet) ── */
.bottom-dock-wrap {
    position: relative;
}
.bottom-dock-trunks {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 4px;
    padding: 4px 2px 0;
}
.trunk-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 1px;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    max-width: 64px;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease;
}
.trunk-item:active { transform: scale(0.94); }
.trunk-item.active .trunk-icon {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.trunk-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}
.trunk-label {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 0.58rem;
    font-weight: 700;
    color: rgba(28, 28, 30, 0.88);
    text-align: center;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.02em;
}
.mode-emergency .trunk-label { color: rgba(255, 255, 255, 0.9); }
.trunk-icon svg {
    display: block;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
.trunk-icon-evac {
    background: linear-gradient(145deg, #ff9f0a 0%, #ff5e00 100%);
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
}
.trunk-icon-evac .trunk-evac-logo {
    display: block;
    width: 58%;
    height: 58%;
    object-fit: contain;
}
.trunk-icon-quake { background: linear-gradient(145deg, #ff6b00 0%, #ff3b30 100%); }
.trunk-icon-map { background: linear-gradient(145deg, #007aff 0%, #5e5ce6 100%); }
.trunk-icon-community { background: linear-gradient(145deg, #34c759 0%, #30b0c7 100%); }
.trunk-icon-learn { background: linear-gradient(145deg, #ff9f0a 0%, #ff5e00 100%); }
.trunk-icon-more { background: linear-gradient(145deg, #8e8e93 0%, #636366 100%); }

/* Sub-sheet popover above trunks */
.dock-sub-sheet {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 4px;
    right: 4px;
    border-radius: 20px;
    padding: 12px 14px 14px;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    transform-origin: bottom center;
    transform: translateY(8px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.22s ease;
}
.dock-sub-sheet:not(.hidden) {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}
.dock-sub-sheet.dock-sub-guard .dock-item {
    pointer-events: none;
}
.dock-sub-sheet.hidden { display: block; }
.dock-sub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 2px;
}
.dock-sub-title {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(28, 28, 30, 0.9);
    letter-spacing: -0.02em;
}
.mode-emergency .dock-sub-title { color: rgba(255, 255, 255, 0.92); }
.dock-sub-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(120, 120, 128, 0.12);
    color: rgba(60, 60, 67, 0.7);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.mode-emergency .dock-sub-close {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.75);
}
.dock-sub-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px 6px;
}
.dock-sub-panel[data-trunk="map"],
.dock-sub-panel[data-trunk="more"] {
    grid-template-columns: repeat(3, 1fr);
}
.dock-sub-panel[data-trunk="quake"] {
    grid-template-columns: repeat(2, 1fr);
}
.dock-sub-panel[data-trunk="community"],
.dock-sub-panel[data-trunk="learn"] {
    grid-template-columns: repeat(2, 1fr);
}
.dock-sub-panel[hidden] { display: none !important; }

/* Root action items inside sub-sheet */
.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 2px 0;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease;
}
.dock-item:active { transform: scale(0.94); }
.dock-item.dock-coast-active .dock-icon-coast {
    background: linear-gradient(135deg, #ff375f 0%, #ff3b30 100%);
    box-shadow: 0 0 0 2px rgba(255, 55, 95, 0.45), 0 4px 12px rgba(255, 59, 48, 0.35);
    animation: coastActivePulse 2.2s ease-in-out infinite;
}
@keyframes coastActivePulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255, 55, 95, 0.5), 0 4px 12px rgba(255, 59, 48, 0.35); }
    50%      { box-shadow: 0 0 0 7px rgba(255, 55, 95, 0.22), 0 4px 14px rgba(255, 59, 48, 0.4); }
}
.dock-item.dock-coast-active .dock-label {
    color: #ff375f;
    font-weight: 700;
}
.dock-item.dock-coast-active .dock-label::after {
    content: attr(data-coast-hint);
    display: block;
    font-size: 0.52rem;
    font-weight: 600;
    opacity: 0.85;
    line-height: 1.1;
    margin-top: 1px;
}
.sp-card.dock-coast-active .sp-card-label {
    color: #ff375f;
    font-weight: 700;
}
.dock-item.dock-toggle-active .dock-label {
    font-weight: 700;
}
.dock-item.dock-toggle-active.dock-toggle-p2p .dock-icon-p2p {
    background: linear-gradient(145deg, #ff453a 0%, #bf5af2 100%);
    box-shadow: 0 0 0 2px rgba(191, 90, 242, 0.45), 0 4px 12px rgba(255, 69, 58, 0.35);
}
.dock-item.dock-toggle-active.dock-toggle-p2p .dock-label {
    color: #bf5af2;
}
.dock-item.dock-toggle-active.dock-toggle-hazard .dock-icon-hazard {
    background: linear-gradient(145deg, #0a84ff 0%, #64d2ff 100%);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.45), 0 4px 12px rgba(10, 132, 255, 0.35);
}
.dock-item.dock-toggle-active.dock-toggle-hazard .dock-label {
    color: #0a84ff;
}
.dock-item:not(.dock-toggle-active).dock-toggle-p2p .dock-icon-p2p,
.dock-item:not(.dock-toggle-active).dock-toggle-hazard .dock-icon-hazard {
    opacity: 0.55;
    filter: grayscale(0.35);
}
.dock-item:not(.dock-toggle-active).dock-toggle-p2p .dock-label,
.dock-item:not(.dock-toggle-active).dock-toggle-hazard .dock-label {
    opacity: 0.65;
}
.sp-card.dock-coast-active {
    border-color: rgba(255, 55, 95, 0.55);
    box-shadow: 0 4px 16px rgba(255, 55, 95, 0.25);
}
.dock-item.hidden { display: none !important; }
.dock-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease;
}
.dock-item:hover .dock-icon {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.dock-label {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 0.64rem;
    font-weight: 600;
    color: rgba(28, 28, 30, 0.82);
    text-align: center;
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.01em;
}
.mode-emergency .dock-label { color: rgba(255, 255, 255, 0.88); }
.dock-icon-drill { background: linear-gradient(145deg, #ff9f0a 0%, #ff6a00 100%); }
.dock-icon-real  { background: linear-gradient(145deg, #ff6961 0%, #e0271d 100%); }
.dock-icon-gps   { background: linear-gradient(145deg, #30d158 0%, #248a3d 100%); }
.dock-icon-layers { background: linear-gradient(145deg, #007aff 0%, #5e5ce6 100%); }
.dock-icon-model { background: linear-gradient(145deg, #5e5ce6 0%, #bf5af2 100%); }
.dock-icon-settings { background: linear-gradient(145deg, #636366 0%, #48484a 100%); }
.dock-icon-quake { background: linear-gradient(145deg, #ff6b00 0%, #ff3b30 100%); }
.dock-icon-tsunami { background: linear-gradient(145deg, #007aff 0%, #30b0c7 100%); }
.dock-icon-earthquake { background: linear-gradient(145deg, #ff6b00 0%, #ff3b30 100%); }
.dock-icon-p2p { background: linear-gradient(145deg, #ff453a 0%, #bf5af2 100%); }
.dock-icon-hazard { background: linear-gradient(145deg, #007aff 0%, #30b0c7 100%); }
.dock-icon-coast { background: linear-gradient(145deg, #ff375f 0%, #ff3b30 100%); }
.dock-icon-report { background: linear-gradient(145deg, #ff9f0a 0%, #ff6b00 100%); }
.dock-icon-ai { background: linear-gradient(145deg, #ff9f0a 0%, #ff5e00 100%); }
.dock-icon-demo { background: linear-gradient(145deg, #5e5ce6 0%, #007aff 100%); }
.dock-icon-guide { background: linear-gradient(145deg, #ff3b30 0%, #ff6b00 100%); }
.dock-icon-note { background: linear-gradient(145deg, #41c9b4 0%, #2ecc71 100%); }
.dock-icon-research { background: linear-gradient(145deg, #0a84ff 0%, #5e5ce6 100%); }
.dock-icon-promo { background: linear-gradient(145deg, #ff6482 0%, #ff375f 100%); }
.dock-icon-portal { background: linear-gradient(145deg, #5856d6 0%, #007aff 100%); }
a.dock-item.dock-learn-external {
    text-decoration: none;
    color: inherit;
}
.dock-icon-ann { background: linear-gradient(145deg, #5e5ce6 0%, #007aff 100%); }
.dock-icon-share { background: linear-gradient(145deg, #34c759 0%, #248a3d 100%); }
.dock-icon-app-share { background: linear-gradient(145deg, #5e5ce6 0%, #007aff 100%); }
.dock-icon-menu { background: linear-gradient(145deg, #8e8e93 0%, #636366 100%); }
.dock-ann-badge {
    position: absolute;
    top: 0;
    right: calc(50% - 28px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #ff3b30;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(255, 59, 48, 0.45);
}
.dock-ann-badge.hidden { display: none !important; }

/* Buttons inside Bottom Sheet */
.action-btn {
    border: none; border-radius: 16px;
    font-weight: 700; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.action-btn::after {
    content: '';
    position: absolute;
    top: 0; left: -150%;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}
.action-btn:hover::after {
    left: 150%;
}
.action-btn:active { transform: scale(0.955); opacity: 0.92; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.btn-large { width: 100%; padding: 16px; font-size: 1.05rem; }

.primary-btn {
    background: linear-gradient(135deg, #0071e3 0%, #007bf2 100%);
    color: white;
    border: 1px solid rgba(0, 113, 227, 0.2);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.22);
}

/* ── モード選択タブ（体験 / 本番）── */
.mode-tabs { display: flex; gap: 10px; }
.mode-tab {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 70px; padding: 12px 8px;
    border: none; border-radius: 18px;
    color: #fff; cursor: pointer;
    position: relative; overflow: hidden;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    transition: transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}
.mode-tab:active { transform: scale(0.97); }
.mode-tab .mode-tab-title { font-size: 1.02rem; font-weight: 800; line-height: 1.15; }
.mode-tab .mode-tab-sub { font-size: 0.66rem; font-weight: 600; opacity: 0.92; letter-spacing: 0.01em; }
.mode-tab svg { stroke: #fff; }
.mode-tab-drill { background: linear-gradient(135deg, #ff8a00 0%, #ff6a00 100%); }
.mode-tab-real  { background: linear-gradient(135deg, #ff453a 0%, #e0271d 100%); }
/* 本番タブは少し控えめ（体験を主に） */
.mode-tab-real { flex: 0.82; }
.primary-btn:hover {
    box-shadow: 0 6px 16px rgba(0, 113, 227, 0.3);
}

.secondary-btn { 
    background: rgba(0, 113, 227, 0.08); 
    color: #0071e3; 
    border: 1px solid rgba(0, 113, 227, 0.15); 
}
.secondary-btn:hover {
    background: rgba(0, 113, 227, 0.12);
}

.mode-emergency .secondary-btn { 
    background: rgba(255,255,255,0.08); 
    color: white; 
    border-color: rgba(255,255,255,0.15); 
}
.mode-emergency .secondary-btn:hover {
    background: rgba(255,255,255,0.12);
}

.sos-btn { 
    background: linear-gradient(135deg, #ff3b30 0%, #ff453a 100%); 
    color: white; 
    border: 1px solid rgba(255, 59, 48, 0.2);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.22);
}
.sos-btn:hover {
    box-shadow: 0 6px 16px rgba(255, 59, 48, 0.32);
}

.outline-btn { 
    background: transparent; 
    color: var(--text-color); 
    border: 1px solid var(--glass-border); 
    padding: 12px; 
}

/* Primary "practice evacuation" CTA — inviting, not alarming.
   Calm breathing glow (no scale jolt) reads as "tap me", warm coral gradient
   feels approachable rather than like a live alert. */
.btn-flashy {
    background: linear-gradient(135deg, #ff9500 0%, #ff5e00 100%);
    box-shadow: 0 6px 18px rgba(255, 94, 58, 0.24);
    animation: pulse-flashy 2.8s ease-in-out infinite;
    color: white;
}
@keyframes pulse-flashy {
    0%, 100% { box-shadow: 0 6px 18px rgba(255, 94, 58, 0.24); }
    50%      { box-shadow: 0 10px 28px rgba(255, 94, 58, 0.44); }
}
.btn-flashy:active { transform: scale(0.97); }


/* ── PWA Floating Toast ── */
@keyframes pwaToastIn  { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
@keyframes pwaToastOut { from { opacity:1; transform:translateY(0); }    to { opacity:0; transform:translateY(-8px); } }
.pwa-toast {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2100;
    background: rgba(30,30,40,0.88);
    color: rgba(255,255,255,0.92);
    font-size: 0.75rem;
    line-height: 1.45;
    padding: 8px 14px;
    border-radius: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    white-space: nowrap;
    pointer-events: none;
    animation: pwaToastIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}
.pwa-toast.hidden { display: none; }
.pwa-toast.dismissing { animation: pwaToastOut 0.3s ease forwards; }
/* PWA toggle row */
.pwa-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,122,255,0.06);
    border: 1px solid rgba(0,122,255,0.14);
    border-radius: 12px;
    padding: 12px 14px;
}
.pwa-toggle-info { flex: 1; }
.pwa-toggle-status {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}
.pwa-toggle-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.dev-notice-settings {
    font-size: 0.82rem;
    color: var(--text-muted);
    background: rgba(255,149,0,0.07);
    border: 1px solid rgba(255,149,0,0.2);
    border-radius: 10px;
    padding: 10px 12px;
    line-height: 1.6;
}
.dev-notice-settings strong { color: var(--warning); }

/* ── Developer Announcements ── */
/* 通知バッジは親カード(#sp-announcements-card)基準で右上角に置く */
#sp-announcements-card { position: relative; }
.sp-ann-badge {
    font-size: 0.64rem; font-weight: 800;
    background: #ff3b30; color: #fff;
    min-width: 18px; height: 18px; line-height: 18px; text-align: center;
    border-radius: 9px; padding: 0 5px;
    position: absolute;
    top: 8px;
    right: 8px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(255, 59, 48, 0.3);
    z-index: 5;
}
/* overlay */
.dev-ann-overlay {
    position: fixed; inset: 0; z-index: 2200;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: flex-end;
    transition: opacity 0.25s;
}
.dev-ann-overlay.hidden { display: none; }
.dev-ann-overlay.active { opacity: 1; }
/* お知らせシートは常にダーク固定（暗いシート前提のデザインのため、アプリのモードに依存させない） */
.dev-ann-sheet {
    width: 100%; max-height: 82vh; overflow-y: auto;
    background: #16161c;
    border-radius: 20px 20px 0 0;
    padding: 0 0 env(safe-area-inset-bottom, 16px);
    transform: translateY(0);
}
.dev-ann-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 20px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky; top: 0;
    background: #16161c;
}
.dev-ann-title { font-size: 1rem; font-weight: 700; color: #f5f5f7; }
.dev-ann-close {
    background: none; border: none; color: rgba(235,235,245,0.55);
    font-size: 1.3rem; cursor: pointer; padding: 4px 8px; line-height: 1;
}
.dev-ann-list { padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.ann-item {
    background: rgba(255,255,255,0.06);
    border-radius: 14px; padding: 14px 16px;
    border-left: 3px solid transparent;
}
.ann-item.active   { border-left-color: #0a84ff; }
.ann-item.resolved { border-left-color: #34c759; opacity: 0.6; }
.ann-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.ann-badge {
    font-size: 0.65rem; font-weight: 700; padding: 2px 8px;
    border-radius: 6px; letter-spacing: 0.02em;
}
.ann-badge.active   { background: rgba(10,132,255,0.22); color: #5aa9ff; }
.ann-badge.resolved { background: rgba(52,199,89,0.22); color: #4cd167; }
.ann-cat  { font-size: 0.72rem; color: rgba(235,235,245,0.62); font-weight: 600; }
.ann-date { font-size: 0.7rem; color: rgba(235,235,245,0.42); margin-left: auto; }
.ann-title { font-size: 0.92rem; font-weight: 700; color: #f5f5f7; margin-bottom: 4px; line-height: 1.4; }
.ann-body  { font-size: 0.8rem; color: rgba(235,235,245,0.72); line-height: 1.55; }

/* Startup notice popup */
@keyframes snSlideUp { from { opacity:0; transform:translateY(24px) scale(0.97); } to { opacity:1; transform:none; } }
.startup-notice {
    position: fixed; inset: 0; z-index: 2300;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.startup-notice.hidden { display: none; }
/* スタートアップ通知も常にダーク固定 */
.sn-card {
    background: #1c1c24;
    border-radius: 20px; padding: 22px 20px 18px;
    width: 100%; max-width: 360px;
    animation: snSlideUp 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
    border: 1px solid rgba(255,255,255,0.1);
}
.sn-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.sn-icon { color: #5aa9ff; display: flex; align-items: center; }
.sn-title { font-size: 1rem; font-weight: 700; color: #f5f5f7; }
.sn-sub   { font-size: 0.75rem; color: rgba(235,235,245,0.6); margin-top: 2px; }
.sn-body  { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.sn-item  {
    background: rgba(255,255,255,0.06);
    border-radius: 12px; padding: 12px 14px;
    border-left: 3px solid #0a84ff;
}
.sn-item-cat   { font-size: 0.68rem; color: #5aa9ff; font-weight: 700; margin-bottom: 3px; letter-spacing: 0.02em; }
.sn-item-title { font-size: 0.85rem; font-weight: 700; color: #f5f5f7; margin-bottom: 4px; line-height: 1.4; }
.sn-item-body  { font-size: 0.78rem; color: rgba(235,235,245,0.72); line-height: 1.55; }
.sn-close-btn {
    width: 100%; padding: 13px;
    background: rgba(0,122,255,0.15); color: #4da3ff;
    border: 1.5px solid rgba(0,122,255,0.3);
    border-radius: 14px; font-size: 0.95rem; font-weight: 700;
    cursor: pointer; transition: background 0.2s;
}
.sn-close-btn:active { background: rgba(0,122,255,0.25); }

/* ── Community Report Card (bottom sheet) ── */
.community-report-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(255, 159, 10, 0.14) 0%, rgba(255, 149, 0, 0.05) 100%);
    border: 1px solid rgba(255, 159, 10, 0.32);
    border-radius: 18px;
    cursor: default;
    box-shadow: 0 4px 16px rgba(255, 159, 10, 0.06), inset 0 1px 1px rgba(255, 255, 255, 0.08);
}
.crc-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.crc-icon { font-size: 1.5rem; flex-shrink: 0; }
.crc-text { min-width: 0; }
.crc-title { font-size: 0.88rem; font-weight: 700; color: var(--text-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crc-sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }
.crc-action-btn {
    flex-shrink: 0;
    padding: 9px 14px;
    background: #ff9f0a;
    color: white;
    border: none; border-radius: 12px;
    font-size: 0.85rem; font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s, background 0.15s;
    white-space: nowrap;
}
.crc-action-btn:active { transform: scale(0.95); background: #e08c00; }

/* ── Report location mode confirm bar ── */
.report-confirm-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1200;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--glass-border);
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 10px;
    animation: slideUpBar 0.25s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes slideUpBar {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.rcb-instruction {
    font-size: 0.88rem; font-weight: 600;
    color: var(--text-color); text-align: center;
}
.rcb-actions { display: flex; gap: 10px; }
.rcb-cancel-btn {
    flex: 1; padding: 13px;
    background: rgba(0,0,0,0.06);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    font-size: 0.9rem; font-weight: 600;
    color: var(--text-muted); cursor: pointer;
}
.rcb-confirm-btn {
    flex: 2; padding: 13px;
    background: #ff9f0a; color: white;
    border: none; border-radius: 14px;
    font-size: 0.9rem; font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s;
}
.rcb-confirm-btn:active { transform: scale(0.97); }

/* ── 情報共有 選択画面 ── */
.report-choice-dialog {
    max-width: 320px;
    width: 92%;
    padding: 0;
    text-align: left;
    overflow: hidden;
}
.report-choice-dialog .report-choice-header {
    padding: 16px 18px 8px;
    border-bottom: none;
    background: transparent;
    position: static;
}
.report-choice-dialog .report-choice-header h2 {
    font-size: 1.08rem;
    font-weight: 800;
    margin: 0;
}
.report-choice-dialog .close-btn {
    font-size: 1.5rem;
    line-height: 1;
    opacity: 0.55;
    padding: 0 2px;
}
.report-choice-dialog .close-btn:hover { opacity: 0.85; }
.report-choice-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 16px 18px;
}
.report-choice-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 56px;
    padding: 12px 16px;
    margin: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.report-choice-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.16);
}
.report-choice-btn:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.05);
}
.report-choice-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.report-choice-icon--view {
    background: linear-gradient(135deg, #5e5ce6, #007aff);
    box-shadow: 0 4px 12px rgba(94, 92, 230, 0.28);
}
.report-choice-icon--submit {
    background: linear-gradient(135deg, #ff9f0a, #ff6b00);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.25);
}
.report-choice-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.25;
}

/* ── アプリ共有 QR ── */
.app-share-dialog {
    max-width: 340px;
    width: 92%;
    text-align: center;
}
.app-share-dialog .dialog-header {
    justify-content: center;
    position: relative;
    padding-right: 36px;
}
.app-share-dialog .dialog-header h2 {
    font-size: 1.08rem;
    font-weight: 800;
    margin: 0;
}
.app-share-dialog .close-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}
.app-share-desc {
    font-size: 0.86rem;
    line-height: 1.5;
    opacity: 0.88;
    margin: 0 0 14px;
    text-align: center;
}
.app-share-qr-wrap {
    display: flex;
    justify-content: center;
    margin: 0 auto 12px;
    padding: 14px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    width: fit-content;
    max-width: 100%;
}
.app-share-qr {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    min-height: 180px;
}
.app-share-qr svg,
.app-share-qr canvas,
.app-share-qr img {
    display: block;
    width: 200px;
    height: 200px;
    max-width: 100%;
}
.app-share-url {
    font-size: 0.72rem;
    word-break: break-all;
    opacity: 0.65;
    margin: 0 0 14px;
    line-height: 1.35;
}
.app-share-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── モデル地区ダイアログ ── */
.model-area-dialog {
    max-width: 340px;
    width: 92%;
    text-align: center;
    padding: 28px 22px 22px;
    position: relative;
    overflow: visible;
}
.model-area-close {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 2;
    font-size: 1.6rem;
    opacity: 0.55;
    transition: opacity 0.2s;
}
.model-area-close:hover { opacity: 0.85; }
.model-area-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
}
.overlay.active .model-area-hero {
    animation: modelAreaFadeUp 0.4s 0.05s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.model-area-hero-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #5e5ce6 0%, #007aff 55%, #bf5af2 100%);
    box-shadow: 0 8px 24px rgba(94, 92, 230, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.25);
}
.model-area-hero-tag {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(94, 92, 230, 0.1);
    border: 1px solid rgba(94, 92, 230, 0.18);
    padding: 4px 12px;
    border-radius: 999px;
}
.model-area-title {
    font-size: 1.22rem;
    font-weight: 800;
    line-height: 1.35;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
    color: var(--text-color);
    opacity: 0;
    transform: translateY(8px);
}
.overlay.active .model-area-title {
    animation: modelAreaFadeUp 0.4s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.model-area-subtitle {
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin: 0 0 18px;
    opacity: 0;
    transform: translateY(8px);
}
.overlay.active .model-area-subtitle {
    animation: modelAreaFadeUp 0.4s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.model-area-chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    text-align: left;
}
.model-area-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    opacity: 0;
    transform: translateY(8px);
}
.overlay.active .model-area-chip:nth-child(1) {
    animation: modelAreaFadeUp 0.38s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.overlay.active .model-area-chip:nth-child(2) {
    animation: modelAreaFadeUp 0.38s 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.overlay.active .model-area-chip:nth-child(3) {
    animation: modelAreaFadeUp 0.38s 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.model-area-chip-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.model-area-chip-icon--route { background: linear-gradient(135deg, #ff9f0a, #ff6b00); }
.model-area-chip-icon--ai    { background: linear-gradient(135deg, #5e5ce6, #007aff); }
.model-area-chip-icon--pin   { background: linear-gradient(135deg, #30d158, #34c759); }
.model-area-more-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0 auto 6px;
    padding: 6px 10px;
    background: none;
    border: none;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.model-area-more-toggle:hover { opacity: 1; }
.model-area-more-chevron {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.model-area-more-toggle[aria-expanded="true"] .model-area-more-chevron {
    transform: rotate(180deg);
}
.model-area-more-panel {
    text-align: left;
    font-size: 0.76rem;
    line-height: 1.65;
    color: var(--text-muted);
    background: rgba(0, 113, 227, 0.05);
    border-left: 3px solid rgba(0, 113, 227, 0.35);
    border-radius: 0 10px 10px 0;
    padding: 10px 12px;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s ease,
                padding 0.3s ease,
                margin 0.3s ease;
}
.model-area-more-panel:not(.expanded) {
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}
.model-area-more-panel.expanded {
    max-height: 200px;
    opacity: 1;
    margin-bottom: 16px;
}
.model-area-more-panel p { margin: 0; }
.model-area-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.model-area-cta-primary {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #ff9f0a 0%, #ff6b00 100%);
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.32);
    transition: transform 0.12s, box-shadow 0.2s;
}
.model-area-cta-primary:hover {
    box-shadow: 0 8px 24px rgba(255, 107, 0, 0.4);
}
.model-area-cta-primary:active { transform: scale(0.97); }
.model-area-cta-secondary {
    width: 100%;
    padding: 13px 20px;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    transition: background 0.2s, transform 0.12s;
}
.model-area-cta-secondary:hover {
    background: rgba(0, 0, 0, 0.04);
}
.model-area-cta-secondary:active { transform: scale(0.98); }
.model-area-footnote {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.75;
    margin: 0;
    line-height: 1.45;
}
@keyframes modelAreaFadeUp {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Community Report Intro Overlay ── */
.report-intro-dialog { max-width: 340px; width: 92%; text-align: center; }
.report-intro-emoji { font-size: 3rem; margin-bottom: 10px; }
.report-intro-title { font-size: 1.15rem; font-weight: 700; line-height: 1.45; margin-bottom: 12px; }
.report-intro-desc {
    font-size: 0.88rem; color: var(--text-muted);
    line-height: 1.65; margin-bottom: 20px; text-align: left;
}

/* ── Community Report Modal ── */
.report-dialog { max-width: 360px; width: 92%; }
.report-categories {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.report-cat-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: rgba(0,0,0,0.04);
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 14px;
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.report-cat-btn.selected {
    background: rgba(255,159,10,0.12);
    border-color: rgba(255,159,10,0.5);
    color: #c87000;
}
.report-cat-btn:active { transform: scale(0.97); }
.report-cat-icon { font-size: 1.2rem; }
.report-comment-textarea {
    width: 100%;
    min-height: 70px;
    padding: 10px 12px;
    border: 1.5px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-color);
    background: rgba(0,0,0,0.03);
    resize: none;
    outline: none;
    margin-bottom: 10px;
    transition: border-color 0.15s;
}
.report-comment-textarea:focus { border-color: #ff9f0a; }
.report-submit-btn { margin-bottom: 6px; }
.report-submit-btn:not(:disabled) { background: #ff9f0a; }
.report-privacy-note {
    font-size: 0.76rem;
    color: var(--text-muted);
    text-align: center;
    padding: 2px 0;
}

/* Emergency Mode Content */
.emergency-mode-actions {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.12) 0%, rgba(18, 18, 20, 0.85) 100%);
    border: 1.5px solid rgba(255, 59, 48, 0.35);
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    position: relative;
    overflow: hidden;
}
.emergency-mode-actions::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 1.5px;
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.5), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    animation: bannerPulseBorder 3s ease-in-out infinite;
}
@keyframes bannerPulseBorder {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}
.emergency-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    cursor: pointer; 
    padding-bottom: 0px; 
}
.eh-title { 
    font-size: 1.15rem; 
    font-weight: 800; 
    color: #ff453a !important; /* Premium iOS Red */
    display: flex;
    align-items: center;
    gap: 6px;
}
.evac-instruction { 
    font-size: 0.95rem; 
    font-weight: 600; 
    margin-bottom: 8px; 
    color: var(--text-color);
}
#disaster-details { 
    font-size: 0.82rem !important; 
    color: var(--text-muted) !important; 
    border-top: 1px solid rgba(255, 59, 48, 0.15) !important; 
    padding-top: 12px !important; 
    margin-top: 10px !important; 
    line-height: 1.5 !important;
}
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-grid .sos-btn { grid-column: span 2; padding: 14px; font-size: 1.1rem; }
.action-grid .secondary-btn { padding: 12px; }

/* Primary evacuation CTA — gentle organic pulse, distinct from the orange "start drill" flashy button */
.evac-primary-btn {
    background: linear-gradient(135deg, #0071e3 0%, #34c759 100%) !important;
    border: 1px solid rgba(0, 113, 227, 0.2) !important;
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.35) !important;
    animation: evacPulse 2.4s ease-in-out infinite !important;
    font-weight: 700 !important;
}
@keyframes evacPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(0, 113, 227, 0.35); }
    50% { transform: scale(1.015); box-shadow: 0 6px 20px rgba(52, 199, 89, 0.5); }
}

/* "More" panel toggle — subtle entry point to secondary evacuation actions */
.panel-more-toggle {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-color);
    opacity: 0.65;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.panel-more-toggle:active { opacity: 1; }
.panel-more-toggle[aria-expanded="true"] .panel-more-chevron {
    transform: rotate(180deg);
}

/* Secondary action menu — rubbery spring expand */
.panel-more-menu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.panel-more-menu.expanded {
    max-height: 320px;
    opacity: 1;
}

/* Subtle text-link styling for the "end drill" action */
.text-link-btn {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-color);
    opacity: 0.55;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    text-decoration: underline;
    padding: 10px;
    margin-top: 4px;
    cursor: pointer;
}
.text-link-btn:active { opacity: 0.9; }

/* Overlays (Dialogs) */
.overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; 
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
}
.overlay.active { opacity: 1; visibility: visible; }
/* ルート選択シートは背後の地図に両ルート（AI/要配慮者）を描いて見比べさせるため、
   標準オーバーレイより薄く透過させる。 */
#route-overlay {
    background: rgba(0,0,0,0.12);
    backdrop-filter: blur(0.5px);
    -webkit-backdrop-filter: blur(0.5px);
}
#route-overlay.overlay.active {
    pointer-events: none;
}
#route-overlay .route-bottom-sheet {
    pointer-events: auto;
}
.overlay .dialog {
    transform: scale(0.92);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.overlay.active .dialog {
    transform: scale(1);
}
.dialog {
    width: 90%; max-width: 360px;
    padding: 24px; border-radius: 24px;
    text-align: center;
}
.dialog-icon { margin-bottom: 16px; }
/* Friendly circular icon badge — reads as guidance, not failure */
.dialog-icon-badge {
    width: 68px; height: 68px;
    margin: 4px auto 18px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    background: radial-gradient(circle at 50% 38%, rgba(0,122,255,0.18), rgba(0,122,255,0.08));
    box-shadow: 0 0 0 6px rgba(0,122,255,0.06), inset 0 1px 1px rgba(255,255,255,0.4);
    animation: dialogIconPop 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes dialogIconPop {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.dialog h2 { font-size: 1.3rem; margin-bottom: 12px; }
.dialog p { font-size: 0.95rem; opacity: 0.8; margin-bottom: 24px; line-height: 1.5; }
.dialog.dialog-compact { padding: 20px 22px; }
.dialog.dialog-compact .dialog-icon { margin-bottom: 10px; }
.dialog.dialog-compact .dialog-icon svg { width: 40px; height: 40px; }
.dialog.dialog-compact h2 { font-size: 1.15rem; margin-bottom: 8px; }
.dialog.dialog-compact p { font-size: 0.88rem; line-height: 1.4; margin-bottom: 16px; }

/* Privacy Warning Notice */
.privacy-warning-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(52, 199, 89, 0.08); /* Translucent iOS success-green for security */
    border: 1px solid rgba(52, 199, 89, 0.25);
    padding: 12px 14px;
    border-radius: 16px;
    margin-bottom: 20px;
    text-align: left;
}
.mode-emergency .privacy-warning-box {
    background: rgba(52, 199, 89, 0.12);
    border-color: rgba(52, 199, 89, 0.35);
}
.privacy-icon {
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}
.privacy-text {
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--text-color);
    opacity: 0.9;
}


/* Settings / Scenarios */
.settings-dialog, .scenario-dialog {
    text-align: left;
    /* 画面の85%を最大高さとし、スクロール可能にする */
    max-height: 85svh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* ヘッダーとフッターを固定するため */
    padding: 0; /* 内部で管理 */
}
/* ヘッダー（タイトル＋閉じるボタン）は常に最上部に固定 */
.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 0;
    background: var(--glass-bg);
    border-radius: 24px 24px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}
.dialog-header h2 { margin: 0; }
/* 設定コンテンツエリアだけスクロール */
.settings-dialog .settings-scroll-body,
.settings-dialog > :not(.dialog-header) {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 24px 24px;
    flex: 1;
}
.close-btn {
    background: none; border: none; font-size: 1.8rem;
    color: var(--text-muted); cursor: pointer; line-height: 1;
    padding: 0 4px; flex-shrink: 0;
}
.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 8px; }
.form-control { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--glass-border); background: rgba(0,0,0,0.05); color: var(--text-color); font-size: 1rem; }
.mode-emergency .form-control { background: rgba(255,255,255,0.05); }

/* Toggles - Premium iOS Settings Card Style */
.toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 18px;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.toggle-group:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}
.toggle-group:last-child {
    margin-bottom: 0;
}
.toggle-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.toggle-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}
.toggle-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    margin-left: 12px;
    min-width: 0;
    text-align: left;
}
.toggle-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
}
.toggle-subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 500;
    line-height: 1.2;
}
.toggle-switch {
    width: 44px;
    height: 24px;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    outline: none;
    transition: 0.3s;
    flex-shrink: 0;
}
.mode-emergency .toggle-switch {
    background: #39393d;
}
.toggle-switch:checked {
    background: var(--success);
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.toggle-switch:checked::after {
    left: 22px;
}

/* Premium Guide Card Style */
.guide-card {
    position: relative;
    padding: 18px 20px !important;
    border-radius: 20px !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s, border-color 0.25s !important;
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.06);
    text-align: left;
}
.guide-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
    border-color: rgba(255, 255, 255, 0.18) !important;
}
.guide-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.guide-card-icon-container {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.guide-scroll-content {
    overflow-y: auto;
    flex: 1;
    padding: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.guide-intro {
    margin: 0 0 2px !important;
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    opacity: 0.88;
    line-height: 1.45;
}
.guide-card-title {
    font-size: 1.12rem !important;
    font-weight: 800 !important;
    margin: 0 !important;
    line-height: 1.35 !important;
    letter-spacing: -0.01em;
}
.guide-card-desc {
    font-size: 0.8rem !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    opacity: 0.82;
    font-weight: 400;
}
.guide-source-note {
    margin: 4px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
    font-size: 0.72rem;
    line-height: 1.55;
    opacity: 0.65;
    text-align: left;
}
.guide-source-note a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.guide-source-note a:hover {
    opacity: 0.85;
}

/* ── Safe Zone Preparedness Guide (legacy panel — agent bubble に移行) ── */
#safe-zone-guide {
    display: none !important;
}


/* Scenarios */
.dialog-subtitle { font-size: 0.85rem; opacity: 0.8; margin-bottom: 20px; }
.scenario-list { display: flex; flex-direction: column; gap: 12px; text-align: left; max-height: 60vh; overflow-y: auto; }
.scenario-option-btn { padding: 16px; border-radius: 16px; border: 1px solid var(--glass-border); cursor: pointer; text-align: left; transition: 0.2s; background: rgba(255,255,255,0.5); }
.mode-emergency .scenario-option-btn { background: rgba(0,0,0,0.3); }
.sc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 1rem; }
.sc-body { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }
.s-warning .badge { background: var(--warning); color: #fff; padding: 2px 6px; border-radius: 6px; font-size: 0.75rem; }
.s-warning { border-left: 4px solid var(--warning); }
.s-info .badge { background: var(--primary); color: #fff; padding: 2px 6px; border-radius: 6px; font-size: 0.75rem; }
.s-info { border-left: 4px solid var(--primary); }

/* Route buttons */
.route-option-btn {
    text-align:left; padding:16px; border-radius:16px; border:2px solid var(--glass-border);
    background:rgba(255,255,255,0.4); cursor:pointer; width:100%;
    transition: transform 0.12s cubic-bezier(0.2,0,0,1), box-shadow 0.12s ease, opacity 0.12s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
/* タップ/クリック時のプレスアニメーション */
.route-option-btn:active,
.route-option-btn.pressed {
    transform: scale(0.95) !important;
    opacity: 0.82 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15) !important;
    transition: transform 0.08s ease, opacity 0.08s ease !important;
}
.route-option-btn:hover:not(:active) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.mode-emergency .route-option-btn { background:rgba(0,0,0,0.2); }

/* ── AIモデル推奨ルート ヒーローカード ── */
.ai-route-btn {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px !important;
    border-radius: 16px;
    border: none !important;
    width: 100%;
    cursor: pointer;
    background: linear-gradient(125deg, #ff7a18 0%, #ff5e3a 48%, #ff3d77 100%);
    box-shadow: 0 8px 24px rgba(255,94,58,0.40);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: transform 0.12s cubic-bezier(0.2,0,0,1), box-shadow 0.2s ease;
}
.ai-route-btn .ai-route-glow {
    position: absolute;
    top: -40%; left: -20%;
    width: 60%; height: 180%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-18deg);
    animation: aiRouteShimmer 3.2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes aiRouteShimmer {
    0%   { left: -30%; }
    55%  { left: 130%; }
    100% { left: 130%; }
}
.ai-route-btn.active {
    /* [2026-06-21] scale(1.02)を撤去：選択時にアイコン位置が数px視覚的にずれる原因だったため、
       拡大ではなく枠線(box-shadow)のみで選択状態を示す。 */
    box-shadow: 0 0 0 3px rgba(255,255,255,0.55), 0 10px 28px rgba(255,94,58,0.55);
}
.ai-route-btn.pressed { transform: scale(0.96) !important; }
.ai-route-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,0.22);
    border: 1px solid rgba(255,255,255,0.35);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ai-route-badge {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #ff5e3a;
    background: #fff;
    padding: 2px 7px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    white-space: nowrap;   /* バッジ文字の折り返しを防ぐ */
}

/* ── 要配慮者ルート ヒーローカード（AIルートと同格の存在感・色のみ藍色系） ── */
.acc-route-btn {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px !important;
    border-radius: 16px;
    border: none !important;
    width: 100%;
    cursor: pointer;
    background: linear-gradient(125deg, #6a5cff 0%, #5e5ce6 48%, #8a63d2 100%);
    box-shadow: 0 8px 24px rgba(94,92,230,0.40);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: transform 0.12s cubic-bezier(0.2,0,0,1), box-shadow 0.2s ease;
}
.acc-route-btn .ai-route-glow {
    position: absolute;
    top: -40%; left: -20%;
    width: 60%; height: 180%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-18deg);
    animation: aiRouteShimmer 3.2s ease-in-out infinite;
    pointer-events: none;
}
.acc-route-btn.active {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.55), 0 10px 28px rgba(94,92,230,0.55);
}
.acc-route-btn.pressed { transform: scale(0.96) !important; }

/* ── フォールバック時：最短ルート ヒーローカード（青系グラデーション） ── */
.short-route-btn {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px !important;
    border-radius: 16px;
    border: none !important;
    width: 100%;
    cursor: pointer;
    background: linear-gradient(125deg, #0a84ff 0%, #0071e3 48%, #005bb5 100%);
    box-shadow: 0 8px 24px rgba(0, 113, 227, 0.40);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: transform 0.12s cubic-bezier(0.2,0,0,1), box-shadow 0.2s ease;
}
.short-route-btn .ai-route-glow {
    position: absolute;
    top: -40%; left: -20%;
    width: 60%; height: 180%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-18deg);
    animation: aiRouteShimmer 3.2s ease-in-out infinite;
    pointer-events: none;
}
.short-route-btn.active {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.55), 0 10px 28px rgba(0, 113, 227, 0.55);
}
.short-route-btn.pressed { transform: scale(0.96) !important; }

/* ── フォールバック時：混雑回避ルート ヒーローカード（緑系グラデーション） ── */
.avoid-route-btn {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px !important;
    border-radius: 16px;
    border: none !important;
    width: 100%;
    cursor: pointer;
    background: linear-gradient(125deg, #30d158 0%, #34c759 48%, #248a3d 100%);
    box-shadow: 0 8px 24px rgba(52, 199, 89, 0.40);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: transform 0.12s cubic-bezier(0.2,0,0,1), box-shadow 0.2s ease;
}
.avoid-route-btn .ai-route-glow {
    position: absolute;
    top: -40%; left: -20%;
    width: 60%; height: 180%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-18deg);
    animation: aiRouteShimmer 3.2s ease-in-out infinite;
    pointer-events: none;
}
.avoid-route-btn.active {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.55), 0 10px 28px rgba(52, 199, 89, 0.55);
}
.avoid-route-btn.pressed { transform: scale(0.96) !important; }

.acc-route-badge {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #5e5ce6;
    background: #fff;
    padding: 2px 7px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    white-space: nowrap;   /* バッジ文字の折り返しを防ぐ */
}

/* Crosshair target */
#crosshair-target { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1000; width: 80px; height: 80px; pointer-events: none; }

/* Route Label Pill on Map（自動幅でテキストのはみ出しを防止）。
   LeafletはdivIconの外側divにtransform:translate3d()を直接インライン指定するため、
   中心寄せは内側の別要素(position:absolute+transform)で行う(外側に重ねがけしない)。 */
.route-label-container { width: 0 !important; height: 0 !important; }
.route-label-pill {
    position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
    display: inline-block;
    background: #00bbff;
    color: white;
    font-weight: bold;
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    border: 2px solid white;
}
/* 予習再生中はマップ上のルートラベル類を隠す（道が見えなくなるため。誘導は専用UIで行う） */
body.ep-mode .route-label-container,
body.ep-mode .blocked-point-container,
body.ep-mode .route-dest-label,
body.ep-mode .route-branch-marker { display: none !important; }

/* Flash Screen */
#flash-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: white; z-index: 9999; opacity: 0; pointer-events: none; transition: opacity 0.5s ease; }
#flash-overlay.flash { opacity: 1; transition: none; }

/* Shelter Markers */
.shelter-marker { background: none; border: none; }
/* 種別カスタムアイコン画像（丸く切り抜き済みの青丸＋白絵） */
.shelter-marker-img {
    width: 34px; height: 34px; display: block;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}

/* Active route destination shelter/hill pin — subtle edge glow */
.shelter-marker-destination {
    position: relative;
    overflow: visible;
}
.shelter-marker-destination::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 34px; height: 34px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    box-sizing: border-box;
}
.shelter-marker-destination-primary::after {
    border: 2px solid rgba(0, 113, 227, 0.75);
    animation: shelterDestRingPrimary 2.4s infinite ease-out;
}
.shelter-marker-destination-secondary::after {
    border: 2px solid rgba(255, 149, 0, 0.85);
    animation: shelterDestRingSecondary 2.4s infinite ease-out;
}
.shelter-marker-destination-primary .shelter-marker-img {
    animation: shelterDestGlowPrimary 2.4s infinite ease-in-out;
}
.shelter-marker-destination-secondary .shelter-marker-img {
    animation: shelterDestGlowSecondary 2.4s infinite ease-in-out;
}
@keyframes shelterDestRingPrimary {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.9; }
    50% { transform: translate(-50%, -50%) scale(1.18); opacity: 0.35; }
}
@keyframes shelterDestRingSecondary {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.22); opacity: 0.4; }
}
@keyframes shelterDestGlowPrimary {
    0%, 100% { box-shadow: 0 3px 10px rgba(0,0,0,0.35), 0 0 6px rgba(0, 113, 227, 0.35); }
    50% { box-shadow: 0 3px 10px rgba(0,0,0,0.35), 0 0 12px rgba(0, 113, 227, 0.55); }
}
@keyframes shelterDestGlowSecondary {
    0%, 100% { box-shadow: 0 3px 10px rgba(0,0,0,0.35), 0 0 8px rgba(255, 149, 0, 0.45); }
    50% { box-shadow: 0 3px 10px rgba(0,0,0,0.35), 0 0 14px rgba(255, 149, 0, 0.7); }
}

/* User Marker */
/* 予習再生中は現在地ピンを非表示（JSでも除去するが、再描画時の保険） */
body.ep-mode .user-marker-container { display: none !important; }

.user-marker-container { background: none; border: none; }
.user-marker-inner {
    width: 24px; height: 24px;
    background: #007aff;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,122,255,0.4);
    position: relative;
}
.user-marker-inner::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100%; height: 100%;
    border-radius: 50%;
    background: #007aff;
    opacity: 0.4;
    animation: userPulse 2s infinite ease-out;
}
@keyframes userPulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

.user-marker-arrow {
    position: absolute;
    top: -38px;
    left: -38px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at 50% 50%, rgba(0, 122, 255, 0.45) 0%, rgba(0, 122, 255, 0.15) 35%, rgba(0, 122, 255, 0) 70%);
    clip-path: polygon(50% 50%, 20% 0%, 80% 0%); /* 60-degree radar beam cone pointing straight up */
    transform-origin: 50% 50%;
    transform: rotate(0deg);
    pointer-events: none;
    display: none; /* Hidden until compass orientation is loaded */
    z-index: -1;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    filter: drop-shadow(0 0 4px rgba(0, 122, 255, 0.5));
}
.user-marker-arrow::after {
    content: '';
    position: absolute;
    top: 29px; /* Positioned perfectly behind the top edge of the 24px inner circle */
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 10px solid #007aff; /* Core blue color */
    filter: drop-shadow(0 -1.5px 0px #ffffff); /* Apple-like thin white boundary line */
    z-index: 10;
}


/* Ensure easy-touch target heights for settings panel on mobile devices */
.settings-dialog .form-group.flex-group {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}
.switch-container {
    width: 52px;
    height: 32px;
    min-width: 52px;
}
.switch-container input {
    width: 100%;
    height: 100%;
}

.settings-version-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.06);
    font-size: 0.88rem;
    color: var(--text-muted);
}
.settings-version-footer strong {
    color: var(--text-color);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.about-body {
    text-align: center;
}
.about-brand-mark img {
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.22);
}
.about-desc {
    margin: 16px 0 20px;
    line-height: 1.65;
    font-size: 0.95rem;
    color: var(--text-muted);
}
.about-version-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.92rem;
    color: var(--text-muted);
}
.about-version-row strong {
    font-size: 1.05rem;
    color: var(--primary);
}
.about-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.about-link-btn {
    text-decoration: none;
    justify-content: center;
}

/* Route Animation */
@keyframes routePulse {
    0% { stroke-width: 6; opacity: 1; filter: drop-shadow(0 0 8px rgba(0,187,255,0.4)); }
    50% { stroke-width: 10; opacity: 0.8; filter: drop-shadow(0 0 16px rgba(0,187,255,0.8)); }
    100% { stroke-width: 6; opacity: 1; filter: drop-shadow(0 0 8px rgba(0,187,255,0.4)); }
}
.animated-route { animation: routePulse 2.5s infinite; }

/* Status Badges */
.tsunami-status-danger {
    background: linear-gradient(135deg, rgba(215, 38, 38, 0.45), rgba(230, 126, 34, 0.55)) !important;
    border-color: rgba(231, 76, 60, 0.45) !important;
    color: white !important;
    box-shadow: 0 4px 16px rgba(215, 38, 38, 0.25) !important;
    animation: danger-pulse 2s infinite alternate;
}
@keyframes danger-pulse {
    0% { box-shadow: 0 4px 16px rgba(215, 38, 38, 0.25); }
    100% { box-shadow: 0 8px 24px rgba(215, 38, 38, 0.5); }
}

/* Custom Flex Group for settings toggles */
.flex-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}
.flex-group:last-child {
    border-bottom: none;
}
.flex-group label {
    margin-bottom: 0 !important;
}

/* Apple-style switch styling */
.switch-container {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}
.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(120, 120, 128, 0.16);
    transition: .3s;
    border-radius: 20px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
input:checked + .slider {
    background-color: var(--success);
}
input:checked + .slider:before {
    transform: translateX(20px);
}

/* Share Dialog Textarea & line styling */
.share-textarea {
    width: 100%;
    height: 110px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.04);
    color: var(--text-color);
    font-size: 0.85rem;
    line-height: 1.4;
    resize: none;
    font-family: inherit;
    outline: none;
}
.mode-emergency .share-textarea {
    background: rgba(255,255,255,0.04);
}
.share-line-btn {
    background: #06C755;
    color: white;
}
.share-line-btn:hover {
    background: #05b34c;
    box-shadow: 0 4px 12px rgba(6, 199, 85, 0.3);
}

/* Communication & GPS Accuracy badges */
.network-badge, .gps-badge {
    background: rgba(0,0,0,0.05);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.mode-emergency .network-badge, .mode-emergency .gps-badge {
    background: rgba(255,255,255,0.1);
}

.network-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background-color: var(--success);
    box-shadow: 0 0 6px var(--success);
    flex-shrink: 0;
}
.network-offline .network-dot {
    background-color: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

.gps-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background-color: var(--primary);
    box-shadow: 0 0 6px var(--primary);
    flex-shrink: 0;
}
.gps-low-accuracy .gps-dot {
    background-color: var(--warning);
    box-shadow: 0 0 6px var(--warning);
}

/* Tsunami Guide Dialog Custom styles */
.guide-dialog {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.guide-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
}
.guide-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.hud-label-short,
.gps-label-short { display: none; }

/* Top bar compact layout — container width covers real phones & desktop phone mock (420px) */
@container tenden-app (max-width: 768px) {
    #app-container {
        --top-status-bar-body: 84px;
    }
    .top-status-bar {
        padding: max(env(safe-area-inset-top, 10px), 10px) 10px 8px 10px;
        display: flex;
        flex-direction: column;
        gap: 5px;
        overflow: visible;
        flex-wrap: nowrap;
    }
    .status-badge .status-icon.hud-label-full,
    .gps-badge .gps-label-full,
    .status-time .hud-label-full { display: none !important; }
    .status-badge .status-icon.hud-label-short,
    .gps-badge .gps-label-short,
    .status-time .hud-label-short { display: inline !important; }

    .map-action-fabs {
        top: 128px;
    }
    .status-left {
        display: flex;
        align-items: center;
        width: 100%;
        gap: 6px;
        min-width: 0;
        justify-content: space-between;
        flex-wrap: nowrap;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        padding-bottom: 4px;
    }
    .mode-emergency .status-left {
        border-bottom-color: rgba(255, 255, 255, 0.08);
    }
    .status-right {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 3px;
        padding-top: 0;
        width: 100%;
        min-width: 0;
    }
    #tsunami-status-box {
        flex: 0 1 auto;
        min-width: 0;
        max-width: 100%;
    }
    #tsunami-status-box.dash-info-card {
        font-size: 0.82rem;
        padding: 4px 10px 4px 9px !important;
    }
    .status-time {
        font-size: 0.88rem;
        font-weight: 700;
        margin: 0 2px;
        flex-shrink: 0;
    }
    .status-time .status-icon.hud-label-short {
        font-size: 0.72rem;
        opacity: 0.65;
        font-weight: 600;
    }
    .status-badge {
        font-size: 0.82rem;
        gap: 4px;
        min-width: 0;
    }
    .status-badge .status-icon:not(.hud-label-full) {
        display: inline !important;
        font-size: 0.72rem;
        opacity: 0.65;
    }
    .status-right .status-badge {
        justify-content: center;
        font-size: 0.78rem;
    }
    .network-badge, .gps-badge, .elev-badge, .inundation-depth-badge {
        padding: 4px 8px;
        font-size: 0.78rem;
        border-radius: 6px;
        background: rgba(0, 0, 0, 0.04);
    }
    .mode-emergency .network-badge,
    .mode-emergency .gps-badge,
    .mode-emergency .elev-badge,
    .mode-emergency .inundation-depth-badge {
        background: rgba(255, 255, 255, 0.08);
    }

    /* Elevation + coast distance + inundation depth are glanceable safety numbers */
    .elev-badge, .coast-dist-badge, .inundation-depth-badge {
        padding: 4px 8px !important;
        border-radius: 10px !important;
        border: 1px solid rgba(0,0,0,0.05);
    }
    .elev-badge { background: rgba(0,0,0,0.045) !important; }
    .coast-dist-badge {
        background: rgba(0,122,255,0.08) !important;
        border-color: rgba(0,122,255,0.14) !important;
        color: var(--primary);
    }
    .elev-badge .status-icon,
    .coast-dist-badge .status-icon,
    .inundation-depth-badge .status-icon {
        opacity: 0.55;
        font-weight: 600;
        font-size: 0.68rem;
    }
    .elev-badge strong, .coast-dist-badge strong, .inundation-depth-badge strong {
        font-weight: 700;
        font-variant-numeric: tabular-nums;
    }

    /* GPS is diagnostic, not a safety metric — keep it light and quiet */
    .gps-badge {
        padding: 4px 7px !important;
        background: rgba(0,0,0,0.035) !important;
        border-radius: 10px !important;
        opacity: 0.92;
    }
    .gps-badge strong { font-weight: 600; font-size: 0.76rem; }

    .network-badge {
        padding: 4px 8px !important;
        border-radius: 10px !important;
        flex-shrink: 0;
    }
    .network-badge strong { font-weight: 600; font-size: 0.78rem; }

    .mode-emergency .elev-badge,
    .mode-emergency .coast-dist-badge,
    .mode-emergency .gps-badge,
    .mode-emergency .inundation-depth-badge {
        background: rgba(255,255,255,0.08) !important;
        border-color: rgba(255,255,255,0.10);
    }

    #hud-tsunami-chip {
        font-size: 0.68rem;
        padding: 3px 7px;
        max-width: 34%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #hud-tsunami-chip strong {
        font-weight: 700;
        font-size: inherit;
    }
}

@container tenden-app (max-width: 400px) {
    .top-status-bar {
        padding-left: 8px;
        padding-right: 8px;
        gap: 6px;
    }
    .status-left, .status-right { gap: 5px; }
    .status-right { gap: 5px; }
    #tsunami-status-box.dash-info-card {
        font-size: 0.76rem;
        padding: 3px 8px 3px 7px !important;
    }
    .status-time { font-size: 0.82rem; }
    .status-right .status-badge { font-size: 0.68rem; padding: 3px 4px !important; }
    #hud-tsunami-chip { font-size: 0.64rem; padding: 3px 6px; max-width: 32%; }
    .network-badge strong { font-size: 0.72rem; }
}

/* ==========================================================================
   STATUS BAR CLARITY REFRESH
   The top bar's job, in priority order: (1) am I in the flood zone?
   (2) how high am I / how far from the coast? (3) device status.
   ========================================================================== */

/* ── Tier 1 · Inundation verdict — the hero safety signal ────────────────── */
/* Pre-verdict "判定中…" state: a calm neutral pill with a breathing dot so the
   first-load moment looks intentional rather than like truncated plain text. */
#tsunami-status-box.status-badge {
    background: rgba(0,0,0,0.05);
    padding: 5px 12px 5px 10px;
    border-radius: 999px;
    gap: 6px;
}
#tsunami-status-box.status-badge::before {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    animation: orbBreathe 1.3s ease-in-out infinite;
}
.mode-emergency #tsunami-status-box.status-badge { background: rgba(255,255,255,0.10); }

/* JS swaps this box's class to .dash-info-card + .tsunami-status-safe/danger
   once a verdict is known (it starts as a plain .status-badge "判定中…"). */
#tsunami-status-box.dash-info-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px 5px 11px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    border: 1px solid transparent;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
/* Once a verdict shows, the "浸水予測:" prefix is redundant with "浸水想定 外/内" */
#tsunami-status-box.dash-info-card .status-icon { display: none !important; }
#tsunami-status-box.dash-info-card strong { font-weight: 700; letter-spacing: 0.01em; }

/* Leading verdict glyph, tinted by the pill's text colour via mask alpha */
#tsunami-status-box.dash-info-card::before {
    content: '';
    width: 15px; height: 15px;
    flex-shrink: 0;
    background: currentColor;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center;
    -webkit-mask-size: contain; mask-size: contain;
}

/* SAFE — calm, reassuring green with a check */
#tsunami-status-box.tsunami-status-safe {
    background: linear-gradient(135deg, rgba(52,199,89,0.15), rgba(48,209,88,0.24)) !important;
    border-color: rgba(52,199,89,0.40) !important;
    color: #1f8f3b !important;
    box-shadow: 0 1px 3px rgba(52,199,89,0.18) !important;
    animation: none !important;
}
#tsunami-status-box.tsunami-status-safe::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M20%206L9%2017l-5-5'%20fill='none'%20stroke='black'%20stroke-width='2.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M20%206L9%2017l-5-5'%20fill='none'%20stroke='black'%20stroke-width='2.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* DANGER — keep the existing red gradient/pulse, just round it and add a triangle */
#tsunami-status-box.tsunami-status-danger {
    border-radius: 999px !important;
    padding: 5px 13px 5px 11px !important;
}
#tsunami-status-box.tsunami-status-danger::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M12%203l10%2017H2z'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linejoin='round'/%3E%3Cpath%20d='M12%209v5'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'/%3E%3Cpath%20d='M12%2017.4v.2'%20stroke='black'%20stroke-width='2.3'%20stroke-linecap='round'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M12%203l10%2017H2z'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linejoin='round'/%3E%3Cpath%20d='M12%209v5'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'/%3E%3Cpath%20d='M12%2017.4v.2'%20stroke='black'%20stroke-width='2.3'%20stroke-linecap='round'/%3E%3C/svg%3E");
}
.mode-emergency #tsunami-status-box.tsunami-status-safe { color: #5be584 !important; }

/* (Compact HUD chip styling lives in @container tenden-app block above) */

/* ==========================================================================
   5螟ｧ繝励Ξ繝溘い繝繝ｻ繝・じ繧､繝ｳ繝ｻ繧ｷ繧ｹ繝・Β繝ｻ繧｢繝・・繝・・繝・
   ========================================================================== */

/* 1. 豬∽ｽ薙Δ繝ｼ繝輔ぅ繝ｳ繧ｰ繝ｻ繝・・繝樒ｧｻ陦後い繝九Γ繝ｼ繧ｷ繝ｧ繝ｳ */
body, .top-status-bar, .bottom-sheet, .dialog, .fab-btn, .action-btn, select, button, input, textarea {
    transition: background-color 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                color 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                backdrop-filter 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                -webkit-backdrop-filter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2. 繝阪が繝ｳ繝ｻ繝ｫ繝溘リ繧ｹ逋ｺ蜈峨☆繧句､夐㍾逋ｺ蜈蛾∩髮｣繝ｫ繝ｼ繝・*/
.route-glow-base {
    animation: neonPulse 2.5s infinite ease-in-out;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.8s;
}
@keyframes neonPulse {
    0% { opacity: 0.35; stroke-width: 10; filter: drop-shadow(0 0 3px currentColor); }
    50% { opacity: 0.75; stroke-width: 13; filter: drop-shadow(0 0 14px currentColor); }
    100% { opacity: 0.35; stroke-width: 10; filter: drop-shadow(0 0 3px currentColor); }
}

.route-glow-core {
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 10 12;
    animation: routeFlow 25s linear infinite;
    transition: stroke 0.8s;
}
@keyframes routeFlow {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -500; }
}

/* 3. Dynamic Island — 非表示（通知は #tenden-agent 吹き出しに一本化） */
#dynamic-island {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: var(--dynamic-island-top);
    z-index: 1050; /* Above map/HUD cards, below modals */
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
    color: #ffffff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform, opacity, width, height;
    transition:
        top 0.45s cubic-bezier(0.16, 1, 0.3, 1),
        width 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.25),
        height 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.25),
        padding 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.25),
        border-radius 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.25),
        opacity 0.45s ease,
        transform 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.25);
}

.dynamic-island-collapsed {
    width: 60px;
    height: 30px;
    border-radius: 15px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) scale(0.55) translateY(-16px);
}

.dynamic-island-expanded {
    width: 340px;
    max-width: 90vw;
    height: auto;
    min-height: 48px;
    padding: 10px 18px;
    border-radius: 24px;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1) translateY(0);
}

.dynamic-island-exiting {
    width: 340px;
    max-width: 90vw;
    min-height: 48px;
    padding: 10px 18px;
    border-radius: 24px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) scale(0.94) translateY(-12px);
    transition:
        opacity 0.45s ease,
        transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.island-content {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.island-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}
.dynamic-island-expanded .island-icon {
    animation:
        islandIconPop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.25) forwards,
        scalePulse 1.5s infinite alternate ease-in-out 0.55s;
}
@keyframes islandIconPop {
    0% { transform: scale(0.35); opacity: 0; }
    65% { transform: scale(1.18); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes scalePulse {
    0% { transform: scale(0.92); }
    100% { transform: scale(1.08); }
}

.island-text {
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    line-height: 1.45;
    color: #ffffff;
    width: 100%;
}

/* 4. オンボーディング：全画面白背景（標準オーバーレイの暗幕・ぼかしは使わない） */
#onboarding-overlay.overlay {
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
}
#onboarding-overlay.overlay.active {
    position: fixed !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    z-index: 20000;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    pointer-events: auto !important;
    -webkit-user-select: none;
    touch-action: manipulation;
    background: #ffffff !important;
    overflow: hidden;
}
#onboarding-overlay.overlay::before,
#onboarding-overlay.overlay.active::before {
    display: none;
}

/* オンボーディング中: エージェントを画面上部中央に固定（吹き出し→スプライト） */
body.onboarding-demo-active {
    --onboarding-safe-top: max(env(safe-area-inset-top, 58px), 58px);
    --onboarding-step0-content-offset: 36px;
    --onboarding-agent-bubble-cap: min(var(--agent-bubble-max-height), 112px);
    --onboarding-agent-zone: calc(
        var(--agent-height) +
        var(--agent-bubble-gap) +
        var(--onboarding-agent-bubble-cap) +
        20px
    );
    /* step0: スプライト上端を safe-area 上端〜アプリアイコン上端の中央に */
    --onboarding-agent-top: calc(
        var(--onboarding-safe-top) +
        var(--onboarding-agent-zone) +
        var(--onboarding-step0-content-offset) -
        var(--agent-height)
    );
}
body.onboarding-demo-active #onboarding-overlay {
    position: fixed !important;
}
body.onboarding-demo-active #onboarding-overlay #tenden-agent,
body.onboarding-demo-active #onboarding-overlay #tenden-agent.tenden-agent--onboarding {
    position: absolute;
    left: 50%;
    top: var(--onboarding-agent-top);
    right: auto;
    bottom: auto;
    transform: translateX(-50%);
    z-index: 6;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    align-items: center;
    width: max-content;
    min-width: 0;
    max-width: min(320px, calc(100% - 32px));
    --agent-dock-offset: 0px;
}
body.onboarding-demo-active #onboarding-overlay #tenden-agent .tenden-agent-bubble {
    width: min(320px, calc(100vw - 48px));
    max-width: min(320px, calc(100vw - 48px));
    transform-origin: center bottom;
}
body.onboarding-demo-active #onboarding-overlay #tenden-agent .tenden-agent-bubble::after {
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}
body.onboarding-demo-active #onboarding-overlay #tenden-agent .tenden-agent-bubble--visible {
    transform: translateY(0) scale(1);
}
body.onboarding-demo-active #onboarding-overlay #tenden-agent .tenden-agent-bubble--exiting {
    transform: translateY(-6px) scale(0.96);
}
body.onboarding-demo-active .demo-nav,
body.onboarding-demo-active .demo-cta-area {
    margin-left: 0;
    width: 100%;
    align-self: stretch;
}
body.onboarding-demo-active .demo-overlay-inner {
    padding-top: calc(
        var(--onboarding-agent-top) +
        var(--onboarding-agent-zone)
    );
    padding-bottom: max(env(safe-area-inset-bottom, 16px), 16px);
}
/* Steps 1–3: agent at top — step 0 keeps logo-centered sprite positioning */
body.onboarding-demo-active:has(#demo-step-1.active),
body.onboarding-demo-active:has(#demo-step-2.active),
body.onboarding-demo-active:has(#demo-step-3.active) {
    --onboarding-agent-top: var(--onboarding-safe-top);
    --onboarding-agent-bubble-cap: min(var(--agent-bubble-max-height), 96px);
    --onboarding-agent-zone: calc(
        var(--agent-height) +
        var(--agent-bubble-gap) +
        var(--onboarding-agent-bubble-cap) +
        14px
    );
    --onboarding-step-gap: 8px;
}
body.onboarding-demo-active:has(#demo-step-1.active) .demo-overlay-inner,
body.onboarding-demo-active:has(#demo-step-2.active) .demo-overlay-inner,
body.onboarding-demo-active:has(#demo-step-3.active) .demo-overlay-inner {
    padding-top: calc(var(--onboarding-safe-top) + var(--onboarding-agent-zone) + 2px);
}
body.onboarding-demo-active:has(#demo-step-1.active) .demo-overlay-inner,
body.onboarding-demo-active:has(#demo-step-2.active) .demo-overlay-inner,
body.onboarding-demo-active:has(#demo-step-3.active) .demo-overlay-inner {
    padding-bottom: max(env(safe-area-inset-bottom, 10px), 10px);
}
body.onboarding-demo-active:has(#demo-step-1.active) .demo-step.active,
body.onboarding-demo-active:has(#demo-step-2.active) .demo-step.active,
body.onboarding-demo-active:has(#demo-step-3.active) .demo-step.active {
    overflow: hidden;
    gap: var(--onboarding-step-gap, 8px);
    min-height: 0;
}
/* Agent bubble carries copy on steps 2–3 — hide duplicate headings */
body.onboarding-demo-active #demo-step-2.active .demo-step-title,
body.onboarding-demo-active #demo-step-2.active .demo-step-desc,
body.onboarding-demo-active #demo-step-3.active .demo-step-title,
body.onboarding-demo-active #demo-step-3.active .demo-step-desc {
    display: none;
}
body.onboarding-demo-active:has(#demo-step-1.active) .demo-alert-box {
    padding: 14px 16px;
    gap: 4px;
    flex-shrink: 0;
}
body.onboarding-demo-active:has(#demo-step-1.active) .demo-quake-visual {
    flex: 1 1 auto;
    min-height: 100px;
    height: clamp(110px, 20vh, 160px);
    flex-shrink: 1;
}
body.onboarding-demo-active:has(#demo-step-2.active) .demo-routes-visual {
    flex: 0 0 auto;
    min-height: auto;
    overflow: hidden;
    display: block;
    padding: 10px 12px 8px;
    box-sizing: border-box;
}
body.onboarding-demo-active:has(#demo-step-2.active) .demo-routes-svg {
    max-height: clamp(148px, 28vh, 196px);
    width: 100%;
    height: auto;
    flex-shrink: 0;
}
body.onboarding-demo-active:has(#demo-step-2.active) .demo-route-legend {
    flex-shrink: 0;
}
body.onboarding-demo-active:has(#demo-step-3.active) .demo-flow-visual {
    flex: 1 1 auto;
    min-height: clamp(96px, 18vh, 130px);
    height: auto;
    max-height: clamp(140px, 28vh, 200px);
    flex-shrink: 1;
}
body.onboarding-demo-active .demo-nav,
body.onboarding-demo-active .demo-cta-area {
    padding-top: 8px;
    gap: 6px;
    flex-shrink: 0;
}
body.onboarding-demo-active .demo-btn-primary,
body.onboarding-demo-active .demo-btn-use {
    padding: 12px 14px;
}
body.onboarding-demo-active .demo-btn-secondary {
    padding: 11px 14px;
}
body.onboarding-demo-active .demo-btn-ghost,
body.onboarding-demo-active .demo-link {
    padding: 6px 10px;
}
body.onboarding-demo-active .demo-overlay-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 4;
}
body.onboarding-demo-active .demo-overlay-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body.onboarding-demo-active .demo-agent-strip {
    display: none;
    height: 0;
    flex-shrink: 0;
    pointer-events: none;
}
body.onboarding-demo-active .demo-dots {
    padding-left: 0;
    margin-top: 0;
    padding-bottom: 0;
    position: relative;
    z-index: 4;
}
body.onboarding-demo-active #demo-step-0.active {
    justify-content: center;
    padding-top: var(--onboarding-step0-content-offset);
}
body.onboarding-demo-active #demo-step-0.active .demo-nav {
    margin-top: auto;
    padding-top: 12px;
}
body.onboarding-demo-active .demo-step.active {
    position: relative;
    z-index: 1;
    overflow: hidden;
}
body.onboarding-demo-active #demo-step-0.active {
    overflow: hidden;
}
@media (max-height: 680px) {
    body.onboarding-demo-active {
        --onboarding-safe-top: max(env(safe-area-inset-top, 46px), 46px);
        --onboarding-step0-content-offset: 12px;
        --onboarding-agent-bubble-cap: min(var(--agent-bubble-max-height), 88px);
    }
    body.onboarding-demo-active:has(#demo-step-0.active) {
        --onboarding-step0-content-offset: 8px;
        --onboarding-agent-bubble-cap: min(var(--agent-bubble-max-height), 72px);
        --onboarding-agent-zone: calc(
            var(--agent-height) +
            var(--agent-bubble-gap) +
            var(--onboarding-agent-bubble-cap) +
            10px
        );
        --onboarding-agent-top: calc(
            var(--onboarding-safe-top) +
            var(--onboarding-agent-zone) +
            var(--onboarding-step0-content-offset) -
            var(--agent-height)
        );
    }
    body.onboarding-demo-active #demo-step-0.active {
        padding-top: 8px;
        gap: 8px;
    }
    body.onboarding-demo-active #demo-step-0.active .demo-logo-gif {
        width: 60px;
        height: 60px;
    }
    body.onboarding-demo-active #demo-step-0.active .demo-wave-wrap {
        height: 22px;
        margin: 0;
    }
    body.onboarding-demo-active #demo-step-0.active .demo-hero-sub {
        font-size: 12px;
        line-height: 1.4;
    }
    body.onboarding-demo-active #demo-step-0.active .demo-nav {
        padding-top: 6px;
        gap: 6px;
    }
    body.onboarding-demo-active #onboarding-overlay #tenden-agent .tenden-agent-bubble-scroll {
        max-height: 88px;
    }
    body.onboarding-demo-active:has(#demo-step-1.active),
    body.onboarding-demo-active:has(#demo-step-2.active),
    body.onboarding-demo-active:has(#demo-step-3.active) {
        --onboarding-agent-bubble-cap: min(var(--agent-bubble-max-height), 80px);
        --onboarding-agent-zone: calc(
            var(--agent-height) +
            var(--agent-bubble-gap) +
            var(--onboarding-agent-bubble-cap) +
            10px
        );
        --onboarding-step-gap: 6px;
    }
    body.onboarding-demo-active:has(#demo-step-1.active) .demo-quake-visual {
        height: clamp(96px, 18vh, 130px);
        min-height: 88px;
    }
    body.onboarding-demo-active:has(#demo-step-1.active) .demo-alert-box {
        padding: 10px 14px;
    }
    body.onboarding-demo-active:has(#demo-step-1.active) .demo-alert-drill-notice {
        font-size: 10px;
    }
    body.onboarding-demo-active:has(#demo-step-2.active) .demo-routes-svg {
        max-height: clamp(132px, 26vh, 168px);
    }
    body.onboarding-demo-active:has(#demo-step-3.active) .demo-flow-visual {
        min-height: 80px;
        max-height: clamp(110px, 24vh, 150px);
    }
    body.onboarding-demo-active .demo-nav,
    body.onboarding-demo-active .demo-cta-area {
        padding-top: 6px;
        gap: 5px;
    }
    body.onboarding-demo-active .demo-btn-primary,
    body.onboarding-demo-active .demo-btn-use {
        padding: 10px 12px;
        font-size: 14px;
    }
    body.onboarding-demo-active .demo-btn-secondary {
        padding: 9px 12px;
        font-size: 13px;
    }
    body.onboarding-demo-active .demo-overlay-footer {
        padding-top: 4px;
    }
}

@keyframes onboardAuroraDrift {
    0% { transform: scale(1) translate(0, 0); }
    50% { transform: scale(1.08) translate(2%, -3%); }
    100% { transform: scale(0.96) translate(-3%, 2%); }
}


.demo-overlay-inner {
    width: 100%;
    height: 100%;
    min-height: 100%;
    max-height: none;
    background: #ffffff;
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding:
        max(env(safe-area-inset-top, 16px), 16px)
        max(env(safe-area-inset-right, 20px), 20px)
        max(env(safe-area-inset-bottom, 16px), 16px)
        max(env(safe-area-inset-left, 20px), 20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    flex: 1;
    min-height: 0;
}

.demo-overlay-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.demo-overlay-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.demo-agent-strip {
    display: none;
}

.fab-btn, .action-btn {
    position: relative;
    overflow: hidden;
}

.fab-btn::after, .action-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0) 30%, 
        rgba(255, 255, 255, 0.28) 50%, 
        rgba(255, 255, 255, 0) 70%
    );
    transform: rotate(-45deg) translate(-100%, -100%);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.fab-btn:hover::after, .action-btn:hover::after {
    transform: rotate(-45deg) translate(100%, 100%);
}

/* 5. 蝨ｰ蝗ｳ・・eaflet・峨Ξ繧､繝､繝ｼ蛻・崛譎ゅ・縲梧ｵ∽ｽ薙ヵ繧ｧ繝ｼ繝峨€榊柑譫・*/
.leaflet-tile {
    transition: opacity 0.6s ease-in-out !important;
}





/* Demo Steps */
.demo-step {
    display: none;
    flex-direction: column;
    gap: 12px;
    animation: demoFadeIn 0.4s ease-out;
    flex: 1;
}
.demo-step.active {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

@keyframes demoFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Spring step reveal — replaces demoFadeIn for .active */
@keyframes demoStepReveal {
    0%   { opacity:0; transform:translateY(18px) scale(0.97); }
    60%  { opacity:1; }
    100% { opacity:1; transform:translateY(0) scale(1.0); }
}
.demo-step.active {
    animation: demoStepReveal 0.45s cubic-bezier(0.16,1,0.3,1) both;
}

/* Step 0: Hero */
.demo-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}
.demo-logo-gif {
    width: 76px;
    height: 76px;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0,40,90,0.28), 0 0 0 1px rgba(255,255,255,0.06) inset;
    animation: demoLogoFloat 3.5s ease-in-out infinite alternate;
}
@keyframes demoLogoFloat {
    0%   { transform: translateY(0); box-shadow: 0 8px 24px rgba(0,40,90,0.28); }
    100% { transform: translateY(-5px); box-shadow: 0 14px 30px rgba(0,40,90,0.34); }
}
.demo-hero-title {
    font-size: clamp(20px, 5vw, 26px);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: #1c1c1e;
    text-align: center;
}
.demo-hero-sub {
    font-size: 13px;
    color: #86868b;
    text-align: center;
    line-height: 1.5;
}

/* Step 1: Earthquake alert */
.demo-scenario-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #86868b;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.demo-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff3b30;
    animation: pulseDot 1.2s ease-in-out infinite;
}
@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}

.demo-alert-box {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.12) 0%, rgba(255, 69, 58, 0.04) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(255, 59, 48, 0.28);
    border-radius: 20px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 8px 28px rgba(255, 59, 48, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.1);
}
.demo-alert-icon {
    font-size: 24px;
    line-height: 1;
    margin-bottom: 2px;
}
.demo-alert-title {
    font-size: 17px;
    font-weight: 700;
    color: #ff3b30;
    line-height: 1.3;
}
.demo-alert-drill-notice {
    font-size: 11px;
    font-weight: 600;
    color: rgba(60, 60, 67, 0.62);
    line-height: 1.4;
    letter-spacing: 0.01em;
    margin: -1px 0 0;
}
.demo-alert-desc {
    font-size: 13px;
    color: #1c1c1e;
    line-height: 1.5;
    opacity: 0.85;
}

/* Step 2-3: Generic step heading */
.demo-step-title {
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 700;
    color: #1c1c1e;
    line-height: 1.3;
}
.demo-step-desc {
    font-size: 13px;
    color: #86868b;
    line-height: 1.55;
}

/* Canvas (kept for backward compat — no longer rendered) */
.demo-canvas { display: none; }

/* ── Step 0: SVG flowing wave ── */
.demo-wave-wrap {
    width: 100%;
    height: 32px;
    margin: -2px 0 2px;
    overflow: hidden;
}
.demo-hero-wave { width: 100%; height: 100%; display: block; }
@keyframes waveFlow { to { stroke-dashoffset: -680; } }
.wave-path { stroke-dasharray: 680; }
.wave-path-1 { animation: waveFlow 4.5s linear infinite; }
.wave-path-2 { animation: waveFlow 6.0s linear infinite reverse; }

/* ── Step 1: Earthquake map + flood-risk location marker ── */
.demo-quake-visual {
    width: 100%;
    height: clamp(140px, 22vh, 180px);
    flex-shrink: 0;
    border: 1px solid rgba(255,59,48,0.12);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    background: #f5f5f7;
}
#demo-quake-map {
    width: 100%;
    height: 100%;
}
.demo-quake-visual .quake-eta-pill {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.demo-quake-marker.leaflet-div-icon {
    background: transparent;
    border: none;
}
.demo-quake-marker .demo-flood-marker {
    width: 56px;
    height: 56px;
}
.demo-flood-marker {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.flood-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(255,59,48,0.45);
    width: 18px;
    height: 18px;
    animation: floodPulse 2.8s ease-out infinite;
}
.flood-ring-1 { animation-delay: 0s; }
.flood-ring-2 { animation-delay: 0.9s; }
@keyframes floodPulse {
    0%   { transform: scale(0.6); opacity: 0.85; }
    75%  { opacity: 0; }
    100% { transform: scale(3.2); opacity: 0; }
}
.flood-pin {
    width: 16px;
    height: 16px;
    background: #ff3b30;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(255,59,48,0.45);
    z-index: 1;
}
.quake-eta-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,59,48,0.07);
    border: 1px solid rgba(255,59,48,0.18);
    padding: 7px 16px;
    border-radius: 99px;
    font-size: 12.5px;
    font-weight: 600;
    color: #cc2222;
}

/* ── Step 2: SVG route draw animation ── */
.demo-routes-visual {
    width: 100%;
    flex-shrink: 0;
    border-radius: 14px;
    background: #f5f5f7;
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
    padding: 10px 12px 8px;
    box-sizing: border-box;
}
.demo-routes-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}
.demo-route-svg-path {
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
}
#demo-step-2.active .demo-route-svg-path {
    animation: routeDraw 1.0s cubic-bezier(0.16,1,0.3,1) var(--route-delay,0s) both;
}
@keyframes routeDraw {
    from { stroke-dashoffset: 320; }
    to   { stroke-dashoffset: 0; }
}

/* ── Step 3: People flow SVG ── */
.demo-flow-visual {
    width: 100%;
    max-width: 100%;
    min-height: 200px;
    height: clamp(200px, 42vw, 260px);
    border-radius: 14px;
    background: linear-gradient(160deg, #e8f4f0 0%, #eaf0f8 100%);
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
    flex-shrink: 0;
}
.demo-flow-svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    display: block;
}

/* Route legend */
.demo-route-legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.legend-item {
    font-size: 11px;
    font-weight: 500;
    color: #1c1c1e;
    padding: 4px 10px;
    background: rgba(0,0,0,0.04);
    border-radius: 99px;
    border: 1px solid rgba(0,0,0,0.06);
}
.legend-item.legend-ai {
    color: var(--route-ai-color);
}
.legend-item.legend-purple {
    color: var(--route-accessible-color);
}

/* Navigation buttons */
.demo-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
    flex-shrink: 0;
}

.demo-btn-primary {
    width: 100%;
    padding: 14px;
    background: #007aff;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.demo-btn-primary:active {
    transform: scale(0.98);
    background: #0071e3;
}

.demo-btn-secondary {
    width: 100%;
    padding: 13px;
    background: transparent;
    color: #007aff;
    border: 1.5px solid rgba(0,122,255,0.25);
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.demo-btn-secondary:active {
    background: rgba(0,122,255,0.06);
}

.demo-btn-ghost {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: #86868b;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: color 0.2s;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.demo-btn-ghost:active { color: #1c1c1e; }

.demo-btn-use {
    background: linear-gradient(135deg, #007aff, #5e5ce6);
    font-size: 15px;
    padding: 16px;
}

.demo-link {
    font-size: 12px;
    color: #86868b;
    text-decoration: none;
}

.demo-cta-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
    flex-shrink: 0;
}

/* Step indicator dots */
.demo-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    flex-shrink: 0;
}
.demo-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    cursor: pointer;
}
.demo-dot.active {
    background: #007aff;
    width: 18px;
    border-radius: 3px;
}

/* 笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
   APP CONTAINER WRAPPER
   笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏 */
#app-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    container-type: inline-size;
    container-name: tenden-app;
}

/* 笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
   DESKTOP VIEWPORT SIMULATOR (Premium Smartphone Mockup)
   笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏 */
@media (min-width: 769px) {
    body {
        background: #111214 !important; /* Premium dark background surrounding the phone */
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    #app-container {
        width: 420px !important;
        height: 88vh !important;
        max-height: 880px !important;
        border-radius: 40px !important;
        border: 12px solid #2d3135 !important; /* Solid smartphone outer bezel frame */
        box-shadow: 0 25px 65px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255,255,255,0.05) !important;
        position: relative !important;
        overflow: hidden !important;
        background: var(--bg-color) !important;
    }
    
    /* Center and restrict key components cleanly inside the simulated frame parent width, avoiding any Leaflet mouse offset clicks */
    #map, 
    .top-status-bar, 
    .bottom-sheet, 
    .overlay, 
    #splash-screen,
    #flash-overlay {
        max-width: 100% !important;
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }
    
    /* Ensure positioned layers align exactly relative to their centered smartphone frame parent (#app-container) */
    .top-status-bar {
        position: absolute !important;
        top: 0 !important;
    }
    
    .bottom-sheet {
        position: absolute !important;
        bottom: 0 !important;
    }
    
    .overlay {
        position: absolute !important;
        height: 100% !important;
    }
    
    #onboarding-overlay.overlay,
    #onboarding-overlay.overlay.active {
        position: absolute !important;
        height: 100% !important;
        align-items: stretch !important;
        background: #ffffff !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        overflow: hidden !important;
    }

    body.onboarding-demo-active #onboarding-overlay #tenden-agent {
        transform: translateX(-50%) !important;
    }
    
    /* Floating action buttons aligned cleanly to the right side of the device screen */
    .map-action-fabs {
        right: 16px !important;
    }
    
    /* Center Dynamic Island below HUD inside phone frame */
    #dynamic-island {
        left: 50% !important;
        right: auto !important;
        max-width: calc(100% - 32px) !important;
        transform: translateX(-50%) !important;
    }
    #dynamic-island.dynamic-island-collapsed {
        transform: translateX(-50%) scale(0.55) translateY(-16px) !important;
    }
    #dynamic-island.dynamic-island-expanded {
        width: calc(100% - 32px) !important;
        transform: translateX(-50%) scale(1) translateY(0) !important;
    }
    #dynamic-island.dynamic-island-exiting {
        width: calc(100% - 32px) !important;
        transform: translateX(-50%) scale(0.94) translateY(-12px) !important;
    }
}

/* 笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武
   COASTAL PROXIMITY LINE NEON VECTOR & SHORELINE RIPPLE STYLES
   笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武 */
.coastal-proximity-line {
    animation: strokePulse 2s infinite linear;
    filter: drop-shadow(0 0 8px #ff2d55);
    cursor: pointer;
    pointer-events: stroke;
}
.coastal-proximity-hit {
    cursor: pointer;
    pointer-events: stroke;
}
@keyframes strokePulse {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -16; }
}

.shoreline-badge {
    position: absolute;
    bottom: 18px;
    background: rgba(255, 45, 85, 0.9);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    cursor: pointer;
}
.shoreline-tap-hint {
    font-size: 8px;
    font-weight: 600;
    opacity: 0.88;
    letter-spacing: 0.02em;
}

/* ── 地震・津波情報パネル ─────────────────────────────── */
.sp-eq-section {
    padding: 14px 14px 10px;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin-top: 4px;
}
.sp-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}
.sp-section-title {
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--text-secondary, #8e8e93);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 5px;
}
.sp-eq-refresh-btn {
    background: none;
    border: none;
    color: var(--text-tertiary, #636366);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.sp-eq-refresh-btn:active { color: var(--accent, #007aff); }
.sp-eq-updated {
    font-size: 0.67rem;
    color: var(--text-tertiary, #636366);
    display: block;
    margin-bottom: 8px;
}
/* 津波警報バナー */
.sp-tsunami-alert-panel {
    background: rgba(255,59,48,0.1);
    border: 1.5px solid rgba(255,59,48,0.4);
    border-radius: 10px;
    padding: 9px 11px;
    margin-bottom: 8px;
    animation: tsAlertPulse 2s ease-in-out infinite;
}
@keyframes tsAlertPulse {
    0%, 100% { border-color: rgba(255,59,48,0.4); }
    50%       { border-color: rgba(255,59,48,0.85); }
}
.sp-tsunami-grade {
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 3px;
}
.sp-tsunami-areas {
    font-size: 0.72rem;
    color: var(--text-secondary, #8e8e93);
    line-height: 1.5;
}
/* ── 津波危険性ステータス（大きく明示・色＋アイコン＋文言） ── */
.quake-ts-status {
    display: flex; align-items: flex-start; gap: 13px;
    margin: 8px 16px 6px;
    padding: 15px 16px;
    border-radius: 16px;
    border: 2px solid transparent;
}
.quake-ts-body { flex: 1; min-width: 0; }
.quake-ts-icon {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.quake-ts-text { min-width: 0; }
.quake-ts-main { font-size: 1.18rem; font-weight: 800; line-height: 1.25; }
.quake-ts-sub  { font-size: 0.82rem; line-height: 1.5; margin-top: 3px; color: rgba(255,255,255,0.85); }
.quake-ts-safe   { background: rgba(48,209,88,0.13);  border-color: rgba(48,209,88,0.5); }
.quake-ts-safe   .quake-ts-icon { background: #30b14f; }
.quake-ts-safe   .quake-ts-main { color: #5fe07b; }
.quake-ts-watch  { background: rgba(255,159,10,0.16); border-color: rgba(255,159,10,0.6); }
.quake-ts-watch  .quake-ts-icon { background: #ff9f0a; }
.quake-ts-watch  .quake-ts-main { color: #ffbf57; }
.quake-ts-danger { background: rgba(255,59,48,0.18);  border-color: rgba(255,59,48,0.75); animation: tsAlertPulse 1.5s ease-in-out infinite; }
.quake-ts-danger .quake-ts-icon { background: #ff3b30; }
.quake-ts-danger .quake-ts-main { color: #ff6a60; }
.quake-ts-map-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 10px; padding: 9px 12px; width: 100%; box-sizing: border-box;
    border-radius: 10px; font-size: 0.82rem; font-weight: 700; line-height: 1.35;
    text-decoration: none; border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.12); color: #fff;
    transition: background 0.15s, transform 0.15s;
}
.quake-ts-map-btn:active { background: rgba(255,255,255,0.22); transform: scale(0.98); }
.quake-ts-watch .quake-ts-map-btn {
    background: rgba(255,159,10,0.22); border-color: rgba(255,159,10,0.55); color: #ffe0a3;
}
.quake-ts-watch .quake-ts-map-btn:active { background: rgba(255,159,10,0.35); }
.quake-ts-danger .quake-ts-map-btn {
    background: rgba(255,59,48,0.28); border-color: rgba(255,59,48,0.65); color: #ffb4ae;
}
.quake-ts-danger .quake-ts-map-btn:active { background: rgba(255,59,48,0.42); }

.quake-list-label {
    font-size: 0.82rem; font-weight: 700; color: rgba(255,255,255,0.55);
    padding: 10px 18px 4px; letter-spacing: 0.02em;
}

/* ── 津波予報区リスト（code 552 海岸別） ── */
.quake-ts-issue-time {
    font-size: 0.68rem; color: rgba(255,255,255,0.45);
    padding: 0 18px 4px;
}
.quake-ts-area-list {
    padding: 4px 14px 8px;
    display: flex; flex-direction: column; gap: 6px;
    max-height: 200px; overflow-y: auto;
}
.quake-ts-area-empty {
    font-size: 0.82rem; color: rgba(255,255,255,0.55);
    padding: 10px 4px; text-align: center; line-height: 1.45;
}
.quake-ts-area-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    border-left: 3px solid rgba(255,255,255,0.2);
}
.quake-ts-area-item.ts-grade-major { border-left-color: #ff3b30; background: rgba(255,59,48,0.1); }
.quake-ts-area-item.ts-grade-warning { border-left-color: #ff6a00; background: rgba(255,106,0,0.08); }
.quake-ts-area-item.ts-grade-watch { border-left-color: #ff9f0a; background: rgba(255,159,10,0.08); }
.quake-ts-area-item.ts-from-eq { border-left-color: #ff9f0a; }
.quake-ts-area-grade {
    flex-shrink: 0; font-size: 0.68rem; font-weight: 800;
    padding: 3px 7px; border-radius: 6px; line-height: 1.3;
    max-width: 5.5em; text-align: center;
}
.ts-grade-major .quake-ts-area-grade { background: rgba(255,59,48,0.35); color: #ffb4ae; }
.ts-grade-warning .quake-ts-area-grade { background: rgba(255,106,0,0.3); color: #ffc899; }
.ts-grade-watch .quake-ts-area-grade,
.ts-from-eq .quake-ts-area-grade { background: rgba(255,159,10,0.28); color: #ffe0a3; }
.ts-grade-unknown .quake-ts-area-grade { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.7); }
.quake-ts-area-body { flex: 1; min-width: 0; }
.quake-ts-area-name { font-size: 0.9rem; font-weight: 700; color: #fff; line-height: 1.35; }
.quake-ts-area-meta { font-size: 0.72rem; color: rgba(255,255,255,0.62); margin-top: 3px; line-height: 1.45; }

/* ── 地震カード（大きく・高コントラスト） ── */
.eq-card {
    display: flex; align-items: center; gap: 13px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 14px;
    padding: 13px 14px;
}
.eq-card-mag { flex-shrink: 0; min-width: 62px; text-align: center; }
.eq-card-mag .eq-mag-num { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.eq-card-body { flex: 1; min-width: 0; }
.eq-card-place { font-size: 0.98rem; font-weight: 700; color: #fff; line-height: 1.3; margin-bottom: 4px; }
.eq-card-meta  { font-size: 0.8rem; color: rgba(255,255,255,0.7); margin-top: 2px; }
.eq-card-fields { margin: 0; padding: 0; display: grid; gap: 3px; }
.eq-field-row { display: flex; gap: 8px; font-size: 0.76rem; line-height: 1.4; }
.eq-field-row dt { flex-shrink: 0; min-width: 4.8em; color: rgba(255,255,255,0.48); font-weight: 500; }
.eq-field-row dd { margin: 0; color: rgba(255,255,255,0.88); flex: 1; min-width: 0; word-break: break-word; }
.eq-card-ts { font-size: 0.78rem; font-weight: 700; margin-top: 5px; display: flex; align-items: center; gap: 6px; }
.eq-card-ts .eq-ts-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.eq-card.eq-ts-none   .eq-card-ts { color: #5fe07b; }
.eq-card.eq-ts-none   .eq-ts-dot { background: #30d158; }
.eq-card.eq-ts-minor  .eq-card-ts { color: #ffd60a; }
.eq-card.eq-ts-minor  .eq-ts-dot { background: #ffd60a; }
.eq-card.eq-ts-danger .eq-card-ts { color: #ff6a60; }
.eq-card.eq-ts-danger .eq-ts-dot { background: #ff3b30; }
.eq-card.eq-ts-danger { border-color: rgba(255,59,48,0.4); }
.eq-card-time { flex-shrink: 0; font-size: 0.74rem; color: rgba(255,255,255,0.5); align-self: flex-start; padding-top: 2px; }

/* 地震リスト（旧スタイル・互換用） */
.sp-eq-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 2px;
}
.sp-eq-placeholder {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    padding: 16px 0;
    text-align: center;
}
.sp-eq-item {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-left: 3px solid #3a3a3c;
    border-radius: 9px;
    padding: 8px 10px 7px;
}
.sp-eq-row1 {
    display: flex;
    align-items: baseline;
    gap: 7px;
    margin-bottom: 3px;
}
.sp-eq-mag {
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 38px;
    letter-spacing: -0.02em;
}
.sp-eq-place {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary, #fff);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-eq-row2 {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}
.sp-eq-meta {
    font-size: 0.7rem;
    color: var(--text-secondary, #8e8e93);
}
.sp-eq-ts-badge {
    font-size: 0.63rem;
    font-weight: 700;
    color: #000;
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}
.sp-eq-time {
    font-size: 0.67rem;
    color: var(--text-tertiary, #636366);
}

/* ── 地震・津波情報オーバーレイ ─────────────────────────── */
/* This sheet's contents are styled for a dark surface (white text, white-alpha
   borders, colour-coded magnitudes). It is opened from the dark side panel, so
   render it dark — overriding the light .glass-panel it also carries — otherwise
   the place names (var(--text-primary,#fff)) are white-on-white and invisible. */
.quake-sheet {
    width: 100%;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
    padding: 0 0 env(safe-area-inset-bottom, 16px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: sheetSlideUp 0.38s cubic-bezier(0.16,1,0.3,1) both;
    background: linear-gradient(180deg, #0c0c22 0%, #06061a 60%, #030312 100%) !important;
    border: none !important;
    border-top: 1px solid rgba(255,255,255,0.08) !important;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.6) !important;
    color: #fff;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.quake-sheet .close-btn { color: rgba(255,255,255,0.65); }
.quake-sheet .close-btn:active { color: #fff; }
@keyframes sheetSlideUp {
    from { transform: translateY(100%); opacity: 0.5; }
    to   { transform: translateY(0);    opacity: 1;   }
}
.quake-sheet-handle {
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,0.22);
    border-radius: 2px;
    margin: 10px auto 4px;
    flex-shrink: 0;
}
.quake-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px 8px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.quake-sheet-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.quake-sheet-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.quake-refresh-btn {
    background: rgba(255,255,255,0.07);
    border: none;
    color: var(--text-secondary, #8e8e93);
    cursor: pointer;
    padding: 7px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    transition: background 0.15s, color 0.15s;
}
.quake-refresh-btn:active { background: rgba(0,122,255,0.18); color: var(--accent,#007aff); }
.quake-updated {
    font-size: 0.68rem;
    color: var(--text-tertiary, #636366);
    padding: 4px 18px 0;
    flex-shrink: 0;
}
.quake-sheet-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
#quake-overlay[data-focus="tsunami"] .quake-focus-earthquake { display: none; }
#quake-overlay[data-focus="earthquake"] .quake-focus-tsunami { display: none; }
.quake-focus-section + .quake-focus-section {
    border-top: 1px solid rgba(255,255,255,0.07);
    margin-top: 4px;
    padding-top: 4px;
}
.quake-action-block {
    padding: 8px 14px 16px;
}
.quake-action-list {
    margin: 6px 0 10px;
    padding-left: 1.15rem;
    font-size: 0.82rem;
    line-height: 1.55;
    color: rgba(255,255,255,0.82);
}
.quake-action-list li + li { margin-top: 6px; }
.quake-action-btn {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,159,10,0.35);
    background: rgba(255,159,10,0.12);
    color: #ffbf57;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}
.quake-action-btn:active {
    background: rgba(255,159,10,0.22);
    transform: scale(0.98);
}
.quake-source-note {
    margin: 10px 0 0;
    font-size: 0.68rem;
    line-height: 1.45;
    color: rgba(255,255,255,0.42);
}
.quake-eq-actions { padding-bottom: 4px; }
.quake-eq-list {
    flex: none;
    overflow-y: visible;
    padding: 10px 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-item.error { color: #ff3b30; background: rgba(255,59,48,0.1); }

/* ── 事前避難体験（追体験）プレイバック ─────────────────────────── */
.evac-playback {
    position: absolute;
    left: 0; right: 0;
    bottom: 0;
    z-index: 1400;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 12px calc(env(safe-area-inset-bottom, 12px) + 12px);
    pointer-events: none;
}
.evac-playback.hidden { display: none !important; }
.evac-playback > * { pointer-events: auto; }

/* 時系列混雑のライブ凡例（その時刻に混雑しているエッジ数を表示） */
.ep-cong-legend {
    align-self: center;
    display: inline-flex; align-items: center; gap: 12px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--glass-bg);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    font-size: 0.72rem; font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    animation: epCautionIn 0.3s cubic-bezier(0.16,1,0.3,1);
}
.ep-cong-legend.hidden { display: none; }
.ep-cong-legend .epl-title { opacity: 0.7; font-weight: 700; }
.ep-cong-legend .epl-item { display: inline-flex; align-items: center; gap: 5px; }
.ep-cong-legend .epl-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ep-cong-legend .epl-mid  { background: #ff9f0a; }
.ep-cong-legend .epl-high { background: #ff3b30; }
.ep-cong-legend .epl-num { font-variant-numeric: tabular-nums; }

/* ルート計算中のローディング */
.route-loading {
    position: fixed; inset: 0; z-index: 2350;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.route-loading.hidden { display: none; }
.route-loading .rl-card {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 26px 30px;
    border-radius: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    animation: epCautionIn 0.3s cubic-bezier(0.16,1,0.3,1);
}
.route-loading .rl-title { font-size: 0.95rem; font-weight: 700; color: var(--text-color); }
.route-loading .rl-sub { font-size: 0.76rem; color: var(--text-muted); }

/* TENDEN 共通ローディング要素（ブランドGIF）。
   ローディングを要する箇所は必ずこの .tenden-loader（GIF）を使う。
   ※起動時のスプラッシュ(#splash-screen)はこれとは別物・差し替えない。 */
.tenden-loader {
    width: 92px; height: 92px;
    border-radius: 18px;
    object-fit: cover;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    background: #f4530a;
}
.tenden-loader.sm { width: 56px; height: 56px; border-radius: 12px; }
/* 任意の処理用フルスクリーン・ローディングオーバーレイ（JS: showTendenLoading/hideTendenLoading） */
.tenden-loading-overlay {
    position: fixed; inset: 0; z-index: 2360;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    animation: epCautionIn 0.25s cubic-bezier(0.16,1,0.3,1);
}
.tenden-loading-overlay.hidden { display: none; }
.tenden-loading-overlay .tenden-loader-msg {
    font-size: 0.92rem; font-weight: 700; color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* 注意点カード（マーカー進行に同期して内容が変わる） */
.ep-caution {
    align-self: stretch;
    background: var(--glass-bg);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--primary);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: 11px 14px;
    color: var(--text-color);
    transition: border-left-color 0.3s ease, opacity 0.25s ease;
    animation: epCautionIn 0.3s cubic-bezier(0.16,1,0.3,1);
}
@keyframes epCautionIn { from { opacity:0; transform: translateY(6px);} to {opacity:1; transform:none;} }
.ep-caution.level-danger  { border-left-color: var(--danger); }
.ep-caution.level-warning { border-left-color: var(--warning); }
.ep-caution.level-safe    { border-left-color: var(--success); }
.ep-caution-head {
    display: flex; align-items: center; gap: 7px;
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em;
    margin-bottom: 3px;
}
.ep-caution-head .ep-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.ep-caution.level-danger  .ep-dot { background: var(--danger); }
.ep-caution.level-warning .ep-dot { background: var(--warning); }
.ep-caution.level-safe    .ep-dot { background: var(--success); }
.ep-caution-body { font-size: 0.85rem; line-height: 1.5; opacity: 0.92; }
/* 定型ボード（フェーズ／メモ／今いる道） */
.ep-caution.board { padding: 12px 15px; }
.ep-board-phase {
    display: flex; align-items: center; gap: 7px;
    font-size: 0.82rem; font-weight: 700; letter-spacing: 0.02em;
}
.ep-board-phase .ep-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.ep-caution.level-danger  .ep-dot { background: var(--danger); }
.ep-caution.level-warning .ep-dot { background: var(--warning); }
.ep-caution.level-safe    .ep-dot { background: var(--success); }
.ep-board-note { font-size: 0.82rem; line-height: 1.5; opacity: 0.9; margin: 5px 0 8px; }
.ep-board-status {
    display: flex; align-items: center; gap: 8px;
    padding-top: 8px; border-top: 1px solid var(--glass-border);
    font-size: 0.76rem;
}
.ep-board-status .ep-board-k { color: var(--text-muted); font-weight: 600; }
.epc-here {
    font-weight: 700; padding: 2px 11px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 5px;
}
.epc-here::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.epc-here.epc-ok  { color: #1f9d52; background: rgba(52,199,89,0.14); }
.epc-here.epc-mid { color: #c47800; background: rgba(255,159,10,0.16); }
.epc-here.epc-hi  { color: #d8392f; background: rgba(255,59,48,0.16); }

/* 地図上の混雑吹き出し */
.ep-bubble {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 5px 10px 6px; border-radius: 11px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
    color: #fff; text-align: center; white-space: nowrap;
    font-family: 'Inter', -apple-system, sans-serif;
}
.ep-bubble b { font-size: 0.72rem; font-weight: 800; }
.ep-bubble span { font-size: 0.6rem; opacity: 0.92; font-weight: 600; }
.ep-bubble::after {
    content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
    border-left: 6px solid transparent; border-right: 6px solid transparent;
    border-top: 7px solid currentColor;
}
.ep-bubble.hi  { background: #ff3b30; }
.ep-bubble.hi::after  { color: #ff3b30; }
.ep-bubble.mid { background: #ff9f0a; }
.ep-bubble.mid::after { color: #ff9f0a; }

/* 分岐選択（Stage 4：高台 vs 避難所）— 画面中央の大きな選択オーバーレイ */
.ep-branch {
    position: fixed; inset: 0; z-index: 1600;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.ep-branch.hidden { display: none; }
.ep-branch-inner {
    width: 100%; max-width: 380px;
    display: flex; flex-direction: column;
    animation: epBranchIn 0.34s cubic-bezier(0.16,1,0.3,1);
}
@keyframes epBranchIn { from { opacity:0; transform: translateY(14px) scale(0.96);} to {opacity:1; transform:none;} }
.ep-branch-head {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    font-size: 1.15rem; font-weight: 800; letter-spacing: 0.01em;
    color: #fff; text-align: center;
}
.ep-branch-head svg { color: #ffd60a; }
.ep-branch-sub { font-size: 0.85rem; color: rgba(255,255,255,0.85); margin: 8px 0 18px; line-height: 1.5; text-align: center; }
.ep-branch-opt {
    width: 100%; text-align: left;
    display: flex; flex-direction: column; gap: 4px;
    padding: 18px 20px;
    margin-bottom: 12px;
    border-radius: 18px;
    border: 2px solid transparent;
    background: #fff;
    color: #1d1d1f;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(0,0,0,0.28);
    transition: transform 0.12s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.ep-branch-opt:active { transform: scale(0.97); }
.ep-branch-opt.highland { border-color: #0a84ff; }
.ep-branch-opt.shelter  { border-color: #ff9500; }
.ep-branch-opt-head { font-size: 1.15rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.ep-branch-opt.highland .ep-branch-opt-head { color: #0a6adf; }
.ep-branch-opt.highland .ep-branch-opt-head::before { content: '▲'; font-size: 0.9rem; }
.ep-branch-opt.shelter  .ep-branch-opt-head { color: #d97800; }
.ep-branch-opt.shelter  .ep-branch-opt-head::before { content: '■'; font-size: 0.8rem; }
.ep-branch-opt-desc { font-size: 0.8rem; line-height: 1.5; opacity: 0.7; }

/* 再生バー */
.ep-bar {
    display: flex; align-items: center; gap: 12px;
    border-radius: 16px;
    padding: 10px 14px;
    box-shadow: var(--shadow-lg);
}
.ep-btn {
    flex-shrink: 0;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.05);
    color: var(--text-color);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.mode-emergency .ep-btn { background: rgba(255,255,255,0.12); }
.ep-btn:active { transform: scale(0.9); }
.ep-play-btn { background: var(--primary); color: #fff; width: 44px; height: 44px; }
.ep-play-btn:active { background: var(--primary); }
.ep-track-wrap { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.ep-scrub {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 5px; border-radius: 3px;
    background: rgba(0,0,0,0.12);
    outline: none; cursor: pointer;
}
.mode-emergency .ep-scrub { background: rgba(255,255,255,0.18); }
.ep-scrub::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}
.ep-scrub::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--primary); border: 2px solid #fff; cursor: pointer;
}
.ep-labels {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.7rem; font-weight: 600; color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.ep-labels #ep-phase { color: var(--primary); font-weight: 700; }

/* 歩行マーカー（Googleマップ風：白い丸＋進行方向を指す矢印） */
.ep-walker {
    width: 40px; height: 40px;
    position: relative;
}
.ep-walker-dot {
    position: absolute; top: 50%; left: 50%; z-index: 1;
    width: 34px; height: 34px; border-radius: 50%;
    background: #ffffff; border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    transform: translate(-50%, -50%);
}
.ep-walker-cone {
    position: absolute; top: 50%; left: 50%; z-index: 2;
    width: 0; height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 20px solid var(--primary);
    transform-origin: 50% 65%;
    transform: translate(-50%, -56%);
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25));
}

/* 追体験再生中はボトムシート（緊急バナー）を隠す */
body.ep-mode .bottom-sheet { display: none !important; }

/* ── Premium Additional Styles (Tip Card, Chevron alignments) ── */
.tip-card {
    margin-top: 18px !important;
    padding: 14px 16px !important;
    border-radius: 16px !important;
    background: rgba(255, 149, 0, 0.07) !important;
    border: 1px solid rgba(255, 149, 0, 0.22) !important;
    box-shadow: 0 4px 15px rgba(255, 149, 0, 0.04), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
    font-size: 0.82rem !important;
    line-height: 1.5 !important;
    opacity: 0.95 !important;
}
.tip-card span {
    font-weight: 700;
}

/* ── Premium High-Contrast Evacuation HUD Cards (Post-Route Selection White-based) ── */
.ep-bar, .ep-caution, .emergency-mode-actions, #evacuation-banner {
    background: #ffffff !important;
    color: #1c1c1e !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15) !important;
}

/* ── 緊急バナーをコンパクトにしてマップの視認性を確保 ── */
.emergency-mode-actions { padding: 13px 14px !important; margin-bottom: 10px !important; border-radius: 18px !important; }
.emergency-mode-actions .eh-title { font-size: 1.0rem !important; }
.emergency-mode-actions #disaster-details {
    font-size: 0.78rem !important; padding-top: 7px !important; margin-top: 7px !important; line-height: 1.45 !important;
}
.emergency-mode-actions #i18n-evac-desc { display: none !important; }  /* disaster-details と重複するため省略 */
.emergency-mode-actions .btn-large { padding: 12px !important; font-size: 1.0rem !important; }
.emergency-mode-actions .mt-10 { margin-top: 8px !important; }
.emergency-mode-actions .panel-more-toggle { padding: 6px !important; font-size: 0.82rem !important; }

/* Ensure text inside evacuation banners/playback remains fully visible (dark text on white) */
.ep-bar *, .ep-caution *, .emergency-mode-actions *, #evacuation-banner * {
    color: #1c1c1e !important;
}
/* 警報タイトルは赤で強調（*の暗文字強制を上書き） */
#evacuation-banner .eh-title, #evacuation-banner .eh-title * { color: #ff3b30 !important; }
/* 塗りつぶしボタン（予習/避難進行/SOS）は文字を白で統一して視認性を確保 */
#evacuation-banner .primary-btn, #evacuation-banner .primary-btn *,
#evacuation-banner .evac-primary-btn, #evacuation-banner .evac-primary-btn *,
#evacuation-banner .sos-btn, #evacuation-banner .sos-btn *,
.emergency-mode-actions .primary-btn, .emergency-mode-actions .primary-btn *,
.emergency-mode-actions .evac-primary-btn, .emergency-mode-actions .evac-primary-btn *,
.emergency-mode-actions .sos-btn, .emergency-mode-actions .sos-btn * {
    color: #ffffff !important;
}
/* 予習(再生)ボタンはAIスマートルートと同じオレンジで目立たせる */
#evacuation-banner #btn-evac-playback,
.emergency-mode-actions #btn-evac-playback {
    background: linear-gradient(135deg, #ff7a18 0%, #ff5e3a 100%) !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(255, 94, 58, 0.35) !important;
}
#evacuation-banner #btn-evac-playback, #evacuation-banner #btn-evac-playback *,
.emergency-mode-actions #btn-evac-playback, .emergency-mode-actions #btn-evac-playback * {
    color: #ffffff !important;
}

/* Retain status badge specific colors */
.ep-caution.level-danger { border-left: 5px solid var(--danger) !important; }
.ep-caution.level-warning { border-left: 5px solid var(--warning) !important; }
.ep-caution.level-safe { border-left: 5px solid var(--success) !important; }
.ep-caution.level-danger .ep-dot { background: var(--danger) !important; }
.ep-caution.level-warning .ep-dot { background: var(--warning) !important; }
.ep-caution.level-safe .ep-dot { background: var(--success) !important; }

/* Pulse animations on light backgrounds */
.emergency-mode-actions::before {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.1), transparent) !important;
}

/* Adjust playback tracker and buttons on white base */
.mode-emergency .ep-btn {
    background: rgba(0, 0, 0, 0.06) !important;
    color: #1c1c1e !important;
}
.mode-emergency .ep-btn:active {
    background: rgba(0, 0, 0, 0.12) !important;
}
.ep-play-btn {
    background: var(--primary) !important;
    color: #ffffff !important;
}
.ep-play-btn * {
    color: #ffffff !important;
}
.ep-scrub {
    background: rgba(0, 0, 0, 0.15) !important;
}
.mode-emergency .ep-scrub {
    background: rgba(0, 0, 0, 0.15) !important;
}
.ep-scrub::-webkit-slider-thumb {
    background: var(--primary) !important;
    border: 2px solid #ffffff !important;
}
.ep-labels #ep-phase {
    color: var(--primary) !important;
    font-weight: 700 !important;
}

/* 避難バナー内ボタンは縦並び（再生→訓練終了） */
#evacuation-banner.emergency-mode-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
#evacuation-banner .btn-large,
#evacuation-banner .end-drill-btn {
    width: 100%;
    min-height: 44px;
    flex-shrink: 0;
}

/* 訓練終了ボタン（セカンダリ・アウトライン） */
.end-drill-btn {
    width: 100%;
    margin-top: 10px;
    justify-content: center;
    color: #636366;
    background: #ffffff;
    border: 1px solid rgba(60, 60, 67, 0.29);
    min-height: 44px;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(60, 60, 67, 0.12);
    position: relative;
    z-index: 2;
    box-shadow: none;
}
#evacuation-banner .end-drill-btn,
#evacuation-banner .end-drill-btn * {
    color: #636366 !important;
}
#evacuation-banner .end-drill-btn svg {
    stroke: #636366;
}

/* ルート選択/計算オーバーレイ表示中のみ前面に固定（通常はバナー内フロー） */
body.tenden-nav-active:not(.ep-mode):has(#route-overlay.overlay.active) #btn-reset-alert.end-drill-btn,
body.tenden-nav-active:not(.ep-mode):has(#route-loading:not(.hidden)) #btn-reset-alert.end-drill-btn {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 12px) + 10px);
    width: auto;
    margin: 0;
    z-index: 2450;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
    background: #ffffff;
    border: 1px solid rgba(60, 60, 67, 0.29);
}
body.tenden-nav-active:not(.ep-mode) #evacuation-banner:not(.hidden) {
    position: relative;
    z-index: 2100;
    pointer-events: auto;
}
.ep-ctrl-btn.ep-end-drill {
    color: #ff3b30 !important;
    border: 1px solid rgba(255, 59, 48, 0.35);
    background: rgba(255, 59, 48, 0.08);
}
.ep-ctrl-btn.ep-end-drill svg { stroke: #ff3b30 !important; }

/* 予習ナビ情報チップ（避難先まで残り距離・避難完了までの時間）Googleマップ風の上部バナー */
.ep-navinfo {
    position: fixed; top: calc(env(safe-area-inset-top, 0px) + 96px); left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 14px;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 16px; padding: 8px 18px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.22); z-index: 1100; white-space: nowrap;
}
.ep-navinfo.hidden { display: none; }
.ep-navinfo-dist { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.ep-navinfo-dist span { font-size: 1.2rem; font-weight: 800; color: var(--text-color); }
.ep-navinfo-dist small { font-size: 0.6rem; font-weight: 600; color: var(--text-muted); }
.ep-navinfo-eta { font-size: 0.78rem; color: var(--text-muted); border-left: 1px solid var(--glass-border); padding-left: 14px; line-height: 1.1; }
.ep-navinfo-eta > [data-i18n="epNavEtaLabel"] { font-size: 0.72rem; }
.ep-navinfo-eta span { font-weight: 800; color: var(--primary); font-size: 0.95rem; }

/* 予習：シミュ由来の一言インサイト（混雑×AI分散の知見） */
.ep-board-insight {
    font-size: 0.74rem; line-height: 1.5; color: var(--primary);
    background: rgba(0,113,227,0.07); border-radius: 8px;
    padding: 6px 9px; margin: 6px 0 2px;
}
.mode-emergency .ep-board-insight { color: #9ecbff; background: rgba(255,255,255,0.08); }

/* みんなのレポート：ピンの常設ラベル（クリーンなピル・種別色） */
.leaflet-tooltip.report-tip {
    background: rgba(28,28,30,0.92); color: #fff; border: none;
    border-radius: 10px; padding: 2px 8px; font-size: 11px; font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3); white-space: nowrap;
}
.leaflet-tooltip.report-tip::before { display: none; }
.report-tip-danger { background: rgba(255,59,48,0.95); }
.report-tip-sign_needed { background: rgba(255,159,10,0.95); }
.report-tip-crowded { background: rgba(94,92,230,0.95); }
.report-tip-shelter_info { background: rgba(52,199,89,0.95); }

/* 避難ナビ操作群（コンパス・最初に戻る・ルート変更・ピンを差し直す・安否共有）左側に縦配置。
   体験/本番モードの避難誘導中(body.tenden-nav-active)・予習再生中(body.ep-mode)にのみ表示し、
   その間は右側の既存FAB(現在地/モデル地区/レポート/メニュー)を隠す（操作の二重化を避ける）。
   右側は既存FABがあるため、ナビ操作群は左側に置いて干渉を避ける。 */
.ep-nav-controls {
    position: fixed; left: 12px; top: calc(env(safe-area-inset-top, 0px) + 150px);
    display: none; flex-direction: column; gap: 10px; z-index: 1100;
}
body.ep-mode .ep-nav-controls, body.tenden-nav-active .ep-nav-controls, body.model-area-demo .ep-nav-controls { display: flex; }
/* 「最初に戻る」は再生位置の巻き戻しなので予習再生中のみ意味を持つ */
.ep-restart-only { display: none; }
body.ep-mode .ep-restart-only { display: flex; }
body.ep-mode .map-action-fabs, body.tenden-nav-active .map-action-fabs { display: none !important; }
.ep-compass {
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    position: relative; display: flex; align-items: center; justify-content: center;
}
.ep-compass-title {
    position: absolute; font-size: 7px; font-weight: 800; color: var(--text-muted);
    opacity: 0.65; pointer-events: none; letter-spacing: 0.04em;
}
body.model-area-demo #ep-compass { border-color: rgba(255, 159, 10, 0.45); }
/* 北固定コンパス（地図が北上のため針は常に上=N） */
.ep-compass-lbl { position: absolute; font-size: 8px; font-weight: 800; color: var(--text-muted); }
.ep-compass-lbl.ep-c-n { top: 2px; left: 50%; transform: translateX(-50%); color: var(--danger); }
.ep-compass-lbl.ep-c-s { bottom: 2px; left: 50%; transform: translateX(-50%); }
.ep-compass-lbl.ep-c-e { right: 3px; top: 50%; transform: translateY(-50%); }
.ep-compass-lbl.ep-c-w { left: 3px; top: 50%; transform: translateY(-50%); }
.ep-compass-needle { position: relative; width: 0; height: 26px; }
.ep-compass-needle i { position: absolute; left: 50%; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; transform: translateX(-50%); }
.ep-needle-n { top: 0; border-bottom: 13px solid var(--danger); }
.ep-needle-s { bottom: 0; border-top: 13px solid #c7c7cc; }
.ep-ctrl-btn {
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    box-shadow: 0 4px 14px rgba(0,0,0,0.2); color: var(--text-color);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.ep-ctrl-btn:active { transform: scale(0.94); }

/* ナビチップ内の混雑/標高サブ表示 */
#ep-nav-cong { color: var(--text-muted); font-weight: 600; }
#ep-nav-elev { display: block; font-size: 0.6rem; font-weight: 600; color: var(--text-muted); margin-top: 1px; }

/* 予習：目的地名のミニラベル（「第一目標」等の表記なし。ピン直上を避け上にオフセット） */
.route-dest-mini { width: 0 !important; height: 0 !important; }
.route-dest-mini-pill {
    position: absolute; left: 0; top: -16px; transform: translate(-50%, -100%);
    background: #1d1d1f; color: #fff; font-size: 0.72rem; font-weight: 700;
    padding: 3px 9px; border-radius: 10px; white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

/* ルート選択カード：簡潔テンプレート（アイコン＋名前＋短いキーワード＋分数を1行で揺れなく整列） */
.route-card-row { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; width: 100%; }
.route-card-text { flex: 1; min-width: 0; text-align: left; }
.route-card-name { font-size: 1rem; font-weight: 800; color: #fff; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-card-kw { font-size: 0.74rem; color: rgba(255,255,255,0.85); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 所要時間：ルート名の長さに関係なく常に右端の固定幅スロットに大きく表示 */
.route-card-time { flex-shrink: 0; min-width: 56px; text-align: right; font-size: 1.6rem; font-weight: 800; color: #fff; line-height: 1; }
.route-card-time small { font-size: 0.85rem; font-weight: 700; margin-left: 2px; }

/* ルート選択シートは背面の地図がイメージできる程度の高さに留める（覆い過ぎを防止） */
.route-bottom-sheet { max-height: 50vh; overflow-y: auto; }
