/* ==========================================================
   よりみちナビ — UI v2 (Apple Maps inspired)
   ========================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* — Color tokens (Light) — */
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-elev: #ffffff;
    --surface-muted: #f2f2f7;
    --surface-tint: rgba(255, 255, 255, 0.78);

    --text: #1d1d1f;
    --text-secondary: #3c3c43;
    --text-tertiary: #6e6e73;
    --text-quaternary: #aeaeb2;

    --border: rgba(60, 60, 67, 0.12);
    --border-strong: rgba(60, 60, 67, 0.2);
    --divider: rgba(60, 60, 67, 0.06);

    --accent: #007aff;
    --accent-pressed: #0062cc;
    --brand: #34c759;
    --brand-pressed: #2aa84a;
    --warn: #ff9500;
    --danger: #ff3b30;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-2: 0 4px 14px rgba(0, 0, 0, 0.06);
    --shadow-3: 0 8px 28px rgba(0, 0, 0, 0.10);
    --shadow-up: 0 -6px 32px rgba(0, 0, 0, 0.08);

    /* JS で実測値に上書きされる。初期値はハンドル領域の概算 */
    --sheet-peek: 152px;
    --sheet-width-pc: 400px;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
                 "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Helvetica Neue",
                 Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--text);
    background: var(--bg);
    font-feature-settings: "palt";
    letter-spacing: -0.01em;
}

button { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Map (full screen base) ── */
#map {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: var(--bg);
}

/* ── Legend ── */
.map-legend {
    position: fixed;
    bottom: calc(var(--sheet-peek) + 14px);
    left: 14px;
    background: var(--surface-tint);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    font-size: 11px;
    font-weight: 600;
    z-index: 500;
    pointer-events: none;
    display: none;
    max-width: 170px;
    color: var(--text);
    border: 1px solid var(--border);
}
.legend-item { display: flex; align-items: center; margin-bottom: 5px; font-size: 11px; }
.legend-item:last-child { margin-bottom: 0; }
.legend-line { width: 22px; height: 4px; margin-right: 8px; border-radius: 2px; flex-shrink: 0; }

/* ── Floating GPS button ── */
.fab-container {
    position: fixed;
    right: 16px;
    bottom: calc(var(--sheet-peek) + 16px);
    z-index: 500;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.fab-container.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.85);
}
.fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-tint);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: var(--shadow-3);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s var(--ease);
}
.fab:active { transform: scale(0.92); }

/* ── Bottom sheet (mobile) / Side panel (desktop) ── */
.bottom-sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1000;
    background: var(--surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-up);
    transform: translateY(calc(100% - var(--sheet-peek)));
    transition: transform 0.42s var(--ease);
    max-height: 88dvh;
    will-change: transform;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-bottom: none;
}
.bottom-sheet.expanded { transform: translateY(0); }
.bottom-sheet.dragging { transition: none; }

/* ── Sheet handle area ── */
.sheet-handle-area {
    flex-shrink: 0;
    padding: 10px 18px 14px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(to bottom, var(--surface) 0%, var(--surface) 70%, transparent 100%);
}
.sheet-drag-bar {
    width: 38px;
    height: 5px;
    background: var(--text-quaternary);
    border-radius: 3px;
    margin: 0 auto 14px;
    opacity: 0.7;
}
.sheet-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.sheet-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--brand) 0%, #30d158 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.32);
}
.sheet-title-group { flex: 1; min-width: 0; }
.sheet-sub {
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.2;
    margin-bottom: 2px;
    font-weight: 500;
}
.sheet-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.15;
}
.sheet-expand-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--surface-muted);
    color: var(--text-tertiary);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.4s var(--ease), background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.sheet-expand-btn:active { background: var(--border); }
.bottom-sheet.expanded .sheet-expand-btn { transform: rotate(180deg); }

/* ── Mode switch (segmented control) ── */
.mode-switch {
    display: flex;
    background: var(--surface-muted);
    padding: 3px;
    border-radius: 11px;
    gap: 0;
}
.mode-switch label {
    flex: 1;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.mode-switch input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.mode-switch span {
    display: block;
    padding: 8px 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 9px;
    transition: background 0.22s var(--ease), color 0.22s var(--ease),
                box-shadow 0.22s var(--ease);
    white-space: nowrap;
}
.mode-switch input[type="radio"]:checked + span {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-1), 0 0 0 0.5px var(--border-strong);
    font-weight: 700;
}
.mode-switch input[type="radio"]:focus-visible + span {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── Sheet content ── */
.sheet-content {
    flex: 1;
    min-height: 0;
    /* 最下部の padding には iPhone PWA のホームインジケータ領域を含める */
    padding: 4px 18px calc(32px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.section { margin-bottom: 20px; }
.section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* ── Input group ── */
.input-group { display: flex; gap: 8px; align-items: center; }
.input-group input,
select {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 16px;
    outline: none;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
    min-width: 0;
    background: var(--surface-muted);
    color: var(--text);
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
}
.input-group input:focus,
select:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}
.input-group input::placeholder { color: var(--text-quaternary); }

select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='1 1.5 6 6.5 11 1.5'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}

/* ── Icon button ── */
.btn-icon {
    width: 46px;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s var(--ease);
    -webkit-tap-highlight-color: transparent;
    color: var(--text);
}
.btn-icon:hover { background: var(--surface); }
.btn-icon:active { background: var(--border); transform: scale(0.94); }

/* ── Generate CTA ── */
.btn-generate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 54px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
    box-shadow: 0 2px 12px rgba(0, 122, 255, 0.28);
    letter-spacing: -0.2px;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s var(--ease), background 0.15s, box-shadow 0.15s;
}
.btn-generate:hover { background: var(--accent-pressed); }
.btn-generate:active { transform: scale(0.98); }
.btn-generate:disabled {
    background: var(--text-quaternary);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}
.btn-generate .spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.35);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Filter chips ── */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.filter-chip:active { transform: scale(0.96); }
.filter-chip.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.25);
}

/* ── Search suggestions ── */
.search-suggestions {
    margin-top: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-2);
}
.suggestion-item {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--divider);
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--surface-muted); }
.suggestion-item:active { background: var(--border); }
.suggestion-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}
.suggestion-addr {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 2px;
}
.suggestion-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}
.suggestion-badge.local { background: rgba(52, 199, 89, 0.15); color: var(--brand); }
.suggestion-badge.osm   { background: rgba(0, 122, 255, 0.15); color: var(--accent); }

.hint-text {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
    padding-left: 2px;
    line-height: 1.45;
}

/* ── Detour slider (行き先指定モード) ── */
.detour-control {
    margin-top: 16px;
    padding: 12px 14px 10px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.detour-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.detour-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -0.1px;
}
.detour-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.1px;
}
.detour-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border-strong);
    border-radius: 999px;
    outline: none;
    margin: 6px 0 2px;
    cursor: pointer;
}
.detour-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: var(--accent);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 122, 255, 0.35);
    cursor: pointer;
    transition: transform 0.1s var(--ease);
}
.detour-slider::-webkit-slider-thumb:active { transform: scale(1.1); }
.detour-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--accent);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 122, 255, 0.35);
    cursor: pointer;
}
.detour-slider:focus-visible::-webkit-slider-thumb {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.detour-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    color: var(--text-tertiary);
    padding: 0 2px;
    margin-top: 4px;
}

/* ── Route info card (shown after route generation) ── */
.route-card {
    margin: 0 0 18px;
    padding: 16px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: none;
    animation: cardSlideIn 0.34s var(--ease);
}
.route-card.active { display: block; }
@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.route-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.1px;
}
.route-card-title-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent);
}
.route-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.route-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.route-stat-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.route-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.4px;
    font-variant-numeric: tabular-nums;
}
.route-stat-unit {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-left: 2px;
}

/* ── Route spots list (dropdown) ── */
.route-spots-list {
    margin-top: 14px;
    border-top: 1px solid var(--divider);
    padding-top: 12px;
}
.route-spots-list > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: background 0.12s;
}
.route-spots-list > summary:hover { background: var(--surface-muted); }
.route-spots-list > summary::-webkit-details-marker { display: none; }
.route-spots-list > summary::after {
    content: "▾";
    font-size: 11px;
    color: var(--text-tertiary);
    transition: transform 0.22s var(--ease);
}
.route-spots-list[open] > summary::after { transform: rotate(180deg); }
.route-spots-list[open] > summary { background: var(--surface-muted); }

.route-spots-items {
    margin-top: 8px;
    max-height: 320px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 2px;
    animation: cardSlideIn 0.28s var(--ease);
}
.route-spot-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.12s, transform 0.1s var(--ease), border-color 0.12s;
    -webkit-tap-highlight-color: transparent;
    text-align: left;
    width: 100%;
    font-family: inherit;
}
.route-spot-row:hover {
    background: var(--surface-muted);
    border-color: var(--border-strong);
}
.route-spot-row:active { transform: scale(0.98); }
.route-spot-row:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.route-spot-emoji {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.route-spot-info {
    flex: 1;
    min-width: 0;
}
.route-spot-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.1px;
}
.route-spot-cat {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
    font-weight: 500;
}
.route-spot-chevron {
    color: var(--text-quaternary);
    font-size: 13px;
    flex-shrink: 0;
}
.route-spots-empty {
    font-size: 12.5px;
    color: var(--text-tertiary);
    text-align: center;
    padding: 20px 12px;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

/* ── Legal links footer ── */
.legal-links {
    margin-top: 14px !important;
    font-size: 11.5px;
    color: var(--text-tertiary);
    text-align: center;
    line-height: 1.7;
}
.legal-links a {
    color: var(--text-tertiary);
    margin: 0 6px;
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-underline-offset: 3px;
}
.legal-links a:hover { color: var(--text); }
.legal-disclaimer {
    margin-top: 6px;
    color: var(--text-quaternary);
    font-size: 10.5px;
}

/* ==========================================================
   Toast notifications
   ========================================================== */
.toast-stack {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 14px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: min(420px, calc(100vw - 28px));
}
.toast {
    pointer-events: auto;
    background: var(--surface-tint);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: var(--shadow-3);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: toastIn 0.32s var(--ease);
    line-height: 1.45;
}
.toast.leaving { animation: toastOut 0.22s var(--ease) forwards; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-14px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateY(-14px) scale(0.96); }
}
.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
}
.toast-info  .toast-icon { background: var(--accent); }
.toast-error .toast-icon { background: var(--danger); }
.toast-success .toast-icon { background: var(--brand); }
.toast-warn  .toast-icon { background: var(--warn); }
.toast-body { flex: 1; min-width: 0; }

/* ==========================================================
   Skeleton loader (for route generation)
   ========================================================== */
.route-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 800;
    background: rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.route-loading-overlay.active {
    display: flex;
    animation: fadeIn 0.2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.route-loading-pill {
    background: var(--surface-tint);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    box-shadow: var(--shadow-3);
    display: flex;
    align-items: center;
    gap: 10px;
}
.route-loading-pill .spinner {
    width: 16px; height: 16px;
    border: 2.2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* シマー：POI読み込み中の地図上シマー（控えめ） */
.poi-loading-shimmer {
    position: fixed;
    top: env(safe-area-inset-top, 12px);
    left: 14px;
    z-index: 500;
    background: var(--surface-tint);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    box-shadow: var(--shadow-2);
    display: none;
    align-items: center;
    gap: 8px;
}
.poi-loading-shimmer.active { display: inline-flex; }
.poi-loading-shimmer .pulse-dot {
    width: 8px; height: 8px;
    background: var(--brand);
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.4); }
}

/* ==========================================================
   POI Markers
   ========================================================== */
.poi-icon-wrapper {
    background: none !important;
    border: none !important;
}
.poi-emoji-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    border: 2px solid rgba(255, 255, 255, 0.95);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transform: scale(var(--poi-scale, 1));
    transform-origin: center center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.poi-emoji-marker:hover,
.poi-emoji-marker:active {
    transform: scale(calc(var(--poi-scale, 1) * 1.22));
    transition: transform 0.14s var(--ease);
}

/* 出発地・目的地ピン */
.pin-icon-wrapper {
    background: none !important;
    border: none !important;
}
.endpoint-pin {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.32));
    transition: transform 0.12s var(--ease);
    cursor: pointer;
}
.endpoint-pin:hover { transform: translateY(-2px) scale(1.04); }

/* 出発地・目的地のポップアップ */
.endpoint-leaflet-popup .leaflet-popup-content-wrapper {
    padding: 0 !important;
    border-radius: var(--radius-md) !important;
    background: var(--surface) !important;
    box-shadow: var(--shadow-3) !important;
    border: 1px solid var(--border);
    overflow: hidden;
}
.endpoint-leaflet-popup .leaflet-popup-content {
    margin: 0 !important;
    padding: 11px 16px 11px 11px;
    width: auto !important;
    min-width: 150px;
    line-height: 1.35;
    color: var(--text);
}
.endpoint-leaflet-popup .leaflet-popup-tip {
    background: var(--surface) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.endpoint-popup {
    display: flex;
    align-items: center;
    gap: 11px;
}
.endpoint-popup-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.endpoint-popup-icon.start { background: rgba(0, 122, 255, 0.13); }
.endpoint-popup-icon.dest  { background: rgba(255, 59, 48, 0.13); }
.endpoint-popup-body { min-width: 0; flex: 1; }
.endpoint-popup-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.endpoint-popup-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
    font-weight: 500;
}

/* 現在地マーカー（パルス） */
.gps-marker {
    position: relative;
    width: 18px; height: 18px;
}
.gps-marker::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(10, 132, 255, 0.35);
    animation: gpsPulse 2s ease-out infinite;
}
.gps-marker::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #0a84ff;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
@keyframes gpsPulse {
    0% { transform: scale(0.6); opacity: 0.8; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* ==========================================================
   POI Popup
   ========================================================== */
.poi-leaflet-popup .leaflet-popup-content-wrapper {
    padding: 0 !important;
    border-radius: var(--radius-lg) !important;
    overflow: hidden;
    box-shadow: var(--shadow-3) !important;
    background: var(--surface) !important;
    border: 1px solid var(--border);
}
.poi-leaflet-popup .leaflet-popup-content {
    margin: 0 !important;
    width: 240px !important;
    line-height: 1.45;
    color: var(--text);
}
.poi-leaflet-popup .leaflet-popup-tip {
    box-shadow: none;
    background: var(--surface) !important;
}
.poi-leaflet-popup .leaflet-popup-close-button {
    color: rgba(255, 255, 255, 0.95) !important;
    font-size: 20px !important;
    top: 8px !important;
    right: 10px !important;
    font-weight: 300 !important;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
    width: 28px; height: 28px;
    line-height: 28px !important;
    text-align: center;
    border-radius: 50%;
    background: rgba(0,0,0,0.25);
    transition: background 0.15s;
}
.poi-leaflet-popup .leaflet-popup-close-button:hover {
    background: rgba(0,0,0,0.45) !important;
}

.poi-popup-header {
    padding: 18px 16px 14px;
    text-align: center;
}
.poi-popup-emoji {
    font-size: 36px;
    display: block;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}
.poi-popup-body {
    padding: 14px 16px 16px;
    background: var(--surface);
}
.poi-popup-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}
.poi-popup-tags {
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.poi-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid;
    letter-spacing: 0.1px;
}

.poi-popup-photo-wrap {
    position: relative;
    height: 130px;
    overflow: hidden;
    background: var(--surface-muted);
    cursor: zoom-in;
}
.poi-popup-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s var(--ease);
}
.poi-popup-photo-wrap:hover .poi-popup-photo { transform: scale(1.05); }
.poi-popup-photo-badge {
    position: absolute;
    bottom: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.poi-popup-photo-zoom-hint {
    position: absolute;
    bottom: 10px;
    left: 12px;
    font-size: 14px;
    opacity: 0.85;
    pointer-events: none;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.poi-popup-info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
}
.poi-info-icon { font-size: 13px; flex-shrink: 0; margin-top: 2px; }
.hours-list { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.hours-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 11.5px;
    line-height: 1.55;
}
.hours-day { color: var(--text-tertiary); font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.hours-time { color: var(--text-secondary); }
.hours-today .hours-day,
.hours-today .hours-time { color: var(--text); font-weight: 700; }
details.hours-other { margin-top: 4px; }
details.hours-other > summary {
    list-style: none;
    font-size: 11px;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
details.hours-other > summary::after { content: " ▾"; font-size: 10px; }
details.hours-other[open] > summary::after { content: " ▴"; }
details.hours-other > summary::-webkit-details-marker { display: none; }
details.hours-other[open] > summary { color: var(--text-secondary); margin-bottom: 2px; }

.poi-popup-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
}
.poi-popup-powered {
    font-size: 10px;
    color: var(--text-quaternary);
    text-align: right;
    margin-top: 8px;
    letter-spacing: 0.1px;
}

/* ==========================================================
   Lightbox
   ========================================================== */
.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s var(--ease);
}
.photo-lightbox.active { opacity: 1; pointer-events: all; }
.lightbox-img {
    max-width: 94vw;
    max-height: 84vh;
    border-radius: 12px;
    object-fit: contain;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
    transform: scale(0.92);
    transition: transform 0.24s var(--ease);
    pointer-events: none;
}
.photo-lightbox.active .lightbox-img { transform: scale(1); }
.lightbox-close {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 18px);
    right: 18px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.16);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s var(--ease);
    backdrop-filter: blur(10px);
}
.lightbox-close:hover { background: rgba(255,255,255,0.28); }
.lightbox-close:active { transform: scale(0.92); }

/* ==========================================================
   Legend emoji
   ========================================================== */
.legend-emoji {
    font-size: 14px;
    margin-right: 7px;
    line-height: 1;
    display: inline-block;
    width: 18px;
    text-align: center;
}

/* ==========================================================
   レスポンシブ：PC（サイドパネル化）
   ========================================================== */
@media (min-width: 900px) {
    .bottom-sheet {
        left: 16px;
        right: auto;
        top: 16px;
        bottom: 16px;
        width: var(--sheet-width-pc);
        max-height: none;
        border-radius: var(--radius-xl);
        transform: none !important;
        box-shadow: var(--shadow-3);
        border: 1px solid var(--border);
    }
    .bottom-sheet.expanded { transform: none !important; }

    .sheet-handle-area { padding: 22px 22px 16px; cursor: default; }
    .sheet-drag-bar { display: none; }
    .sheet-expand-btn { display: none; }
    .sheet-header { margin-bottom: 18px; }
    .sheet-title { font-size: 22px; }
    .sheet-sub { font-size: 12px; }
    .sheet-logo { width: 48px; height: 48px; border-radius: 15px; font-size: 28px; }

    .sheet-content { padding: 6px 22px 32px; }

    .fab-container {
        right: 24px;
        bottom: 24px;
    }
    .map-legend {
        left: calc(var(--sheet-width-pc) + 32px);
        bottom: 24px;
    }

    /* マップは右側に寄らせる */
    #map {
        left: calc(var(--sheet-width-pc) + 32px);
    }
}

/* PC のさらに大きい画面 */
@media (min-width: 1280px) {
    :root { --sheet-width-pc: 420px; }
}

/* キーボードナビゲーションのみアウトラインを出す */
:focus:not(:focus-visible) { outline: none; }
