
/* ============================================
   Travel Log｜旅程手帳 V1.0
   Leaflet 地圖及時間軸優化版
   V1.0 — 多旅程介面整合
============================================ */


/* 01. 主題設定 */

:root {
    color-scheme: dark;

    --bg: #15191f;
    --surface: #242b35;
    --surface-hover: #2e3744;
    --border: #394555;

    --text: #f1f5f9;
    --muted: #9eafc5;

    --accent: #218967;
    --accent-hover: #2ba17c;
    --accent-light: #55d3aa;

    --radius: 22px;
    --nav-height: 76px;

    --timeline-width: 126px;
    --timeline-dot: 16px;
}


/* 02. 基本設定 */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);

    font-family:
        "Microsoft JhengHei",
        "Noto Sans TC",
        "Segoe UI",
        sans-serif;

    line-height: 1.65;

    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

button,
a {
    touch-action: manipulation;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 3px;
}

a {
    color: inherit;
}

[hidden] {
    display: none !important;
}


/* 03. 頁面容器 */

.app {
    width: 100%;
    min-height: 100vh;
}

#home-page,
#trip-page {
    width: min(100%, 960px);
    margin: 0 auto;
    padding: 36px 32px 80px;
}

#trip-page {
    padding-bottom: calc(
        var(--nav-height) +
        48px +
        env(safe-area-inset-bottom, 0px)
    );
}


/* 04. 頁面標題 */

header {
    margin-bottom: 36px;
}

.version {
    margin-bottom: 8px;
    color: var(--accent-light);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1.5px;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 750;
    line-height: 1.4;
}

.subtitle {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 1rem;
}

h2 {
    margin: 0 0 20px;
    font-size: 1.4rem;
    font-weight: 700;
}


/* 05. 首頁旅程卡片 */

.trip-card {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;
    width: 100%;

    margin: 0 0 16px;
    padding: 28px 32px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);

    color: var(--text);
    text-align: left;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.trip-card-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.trip-card-title {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.trip-date {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.trip-card-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    width: 28px;
    height: 28px;

    color: var(--accent-light);
    transition: transform 0.18s ease;
}

.trip-card-arrow svg {
    width: 28px;
    height: 28px;
}

@media (hover: hover) {

    .trip-card:hover {
        background: var(--surface-hover);
        border-color: var(--accent);
    }

    .trip-card:hover .trip-card-arrow {
        transform: translateX(4px);
    }

}

.trip-card:active {
    background: var(--surface-hover);
    border-color: var(--accent);
    transform: scale(0.985);
}


/* 06. 旅程工具列 */

.trip-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
}

.back-btn {
    padding: 8px 0;
    background: transparent;
    border: none;

    color: var(--accent-light);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
}

.back-btn:hover {
    color: var(--text);
}

.settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    width: 44px;
    height: 44px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;

    color: var(--muted);

    transition: background 0.15s ease;
}

.settings-btn svg {
    width: 24px;
    height: 24px;
}

.settings-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.settings-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}


/* 07. 日期切換列 */

.date-tabs {
    position: relative;
    display: flex;
    gap: 12px;

    overflow-x: auto;
    overflow-y: hidden;

    padding: 4px 0 18px;
    margin-bottom: 28px;

    cursor: grab;
    touch-action: pan-x;

    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;

    user-select: none;
}

.date-tabs::-webkit-scrollbar {
    height: 5px;
}

.date-tabs::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.date-tabs.dragging,
.date-tabs.dragging .date-tab {
    cursor: grabbing;
}

.date-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    gap: 7px;
    min-width: 82px;
    min-height: 100px;

    padding: 12px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 17px;

    color: var(--text);

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.date-tab:hover {
    background: var(--surface-hover);
}

.date-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.date-weekday {
    color: var(--muted);
    font-size: 1rem;
}

.date-tab.active .date-weekday {
    color: #ffffff;
}

.date-number {
    font-size: 1.2rem;
    font-weight: 700;
}


/* 08. 每日日期標題 */

#day-heading {
    margin: 12px 0 28px;
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    font-weight: 700;
}


/* 09. 每日總覽卡片 */

#daily-overview {
    margin-bottom: 28px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);

    overflow: hidden;
    overflow-wrap: anywhere;
}

.overview-header {
    display: block;
    width: 100%;
    padding: 22px 24px;

    background: transparent;
    border: none;

    color: var(--text);
    text-align: left;

    transition: background 0.15s ease;
}

.overview-header:hover {
    background: var(--surface-hover);
}

.overview-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;
    margin-bottom: 10px;
}

.overview-day {
    color: var(--accent-light);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.overview-toggle {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.overview-theme {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.5;
}

.overview-body {
    padding: 0 24px 24px;
}

.overview-summary {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.7;
    white-space: pre-wrap;
}


/* 10. 交通方式及里程標籤 */

.overview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.overview-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;

    background: #343c49;
    border: 1px solid #505e70;
    border-radius: 999px;

    color: var(--text);
    font-size: 0.85rem;
}


/* 11. 每日總覽資訊列 */

.overview-info {
    display: flex;
    align-items: flex-start;

    gap: 12px;
    padding: 16px 0;

    border-top: 1px solid var(--border);
}

.overview-info-icon {
    flex: 0 0 24px;
    font-size: 1.15rem;
    text-align: center;
}

.overview-info-content {
    flex: 1;
    min-width: 0;
}

.overview-info-label {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.8rem;
}

.overview-info-value {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.7;
    white-space: pre-wrap;
}


/* 12. 重要提醒 */

.overview-reminder {
    margin-top: 12px;
    padding: 16px;

    background: rgba(239, 184, 91, 0.08);
    border: 1px solid rgba(239, 184, 91, 0.22);
    border-radius: 14px;
}

.overview-reminder-title {
    margin-bottom: 8px;
    color: #efb85b;
    font-size: 0.9rem;
    font-weight: 700;
}

.overview-reminder-text {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
}


/* 13. 每日封面圖片 */

.overview-cover {
    display: block;
    width: 100%;
    max-height: 280px;
    margin-bottom: 20px;
    border-radius: 14px;
    object-fit: cover;
}


/* 14. 每日路線圖容器 */

#daily-route {
    margin-bottom: 28px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);

    overflow: hidden;
    overflow-wrap: anywhere;

    scroll-margin-top: 16px;
    scroll-margin-bottom: 100px;
}

.route-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;
    width: 100%;
    padding: 20px 24px;

    background: transparent;
    border: none;

    color: var(--text);
    text-align: left;
    font-size: 1.05rem;
    font-weight: 700;

    transition: background 0.15s ease;
}

.route-header:hover {
    background: var(--surface-hover);
}

.route-toggle {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 400;
}

.route-body {
    padding: 0 24px 24px;
}


/* 15. 地圖模式切換 */

.route-mode-bar {
    display: flex;
    gap: 6px;

    margin-bottom: 12px;
    padding: 4px;

    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.route-mode-btn {
    flex: 1;
    min-width: 0;
    min-height: 38px;
    padding: 8px 10px;

    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;

    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.route-mode-btn:hover {
    background: var(--surface-hover);
}

.route-mode-btn.active {
    background: var(--accent);
    color: #ffffff;
}

.route-mode-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.route-map-status {
    margin: 10px 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.6;
}


/* 16. Leaflet 地圖容器 */

.leaflet-map,
.route-leaflet-map {
    position: relative;
    z-index: 0;
    isolation: isolate;

    display: block;
    width: 100%;
    height: 440px;

    background: #192129;
    border: 1px solid var(--border);
    border-radius: 14px;

    overflow: hidden;
}

.leaflet-container {
    font-family: inherit;
    color-scheme: light;
    overflow-wrap: normal;
}

.leaflet-container img {
    max-width: none !important;
}

.leaflet-container .leaflet-control-zoom {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.leaflet-container .leaflet-control-zoom a {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.leaflet-container .leaflet-control-zoom a:hover {
    background: var(--surface-hover);
}

.leaflet-container .leaflet-control-zoom a.leaflet-disabled {
    color: #657080;
}

.leaflet-container .leaflet-control-attribution {
    background: rgba(21, 25, 31, 0.88);
    color: #e2e8f0;
    font-size: 10px;
}

.leaflet-container .leaflet-control-attribution a {
    color: #8ee4c7;
}

.leaflet-container .leaflet-control-scale-line {
    background: rgba(21, 25, 31, 0.8);
    color: #ffffff;
    border-color: #dce6ef;
}


/* 17. Leaflet 景點編號 */

.route-leaflet-icon {
    background: transparent;
    border: none;
}

.route-map-marker,
.leaflet-route-marker {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    background: var(--accent);
    border: 2px solid #ffffff;
    border-radius: 50%;

    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;

    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);

    transition:
        background 0.15s ease,
        box-shadow 0.15s ease;
}

.route-map-marker:hover,
.leaflet-route-marker:hover,
.route-map-marker.selected,
.leaflet-route-marker.selected,
.route-map-marker.active,
.leaflet-route-marker.active {
    background: #d28b28;
    border-color: #ffffff;

    box-shadow:
        0 0 0 3px rgba(229, 169, 78, 0.35),
        0 2px 6px rgba(0, 0, 0, 0.45);
}

.route-map-marker:focus-visible,
.leaflet-route-marker:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}


/* 18. Leaflet 景點資訊視窗 */

.leaflet-container .leaflet-popup-content-wrapper,
.leaflet-container .leaflet-popup-tip {
    background: var(--surface);
    color: var(--text);
}

.leaflet-container .leaflet-popup-content-wrapper {
    border: 1px solid var(--border);
    border-radius: 12px;
}

.leaflet-container .leaflet-popup-content {
    margin: 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.leaflet-container .leaflet-popup-close-button {
    color: var(--muted);
}

.route-popup-title {
    margin-bottom: 6px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
}

.route-popup-time {
    color: var(--accent-light);
    font-size: 0.8rem;
    font-weight: 600;
}

.route-popup-button {
    display: block;
    width: 100%;
    min-height: 38px;

    margin-top: 10px;
    padding: 8px 12px;

    background: var(--accent);
    border: none;
    border-radius: 8px;

    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

.route-popup-button:hover {
    background: var(--accent-hover);
}

.route-map-tooltip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;

    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}


/* 19. 地圖控制按鈕 */

.route-map-tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.route-fit-btn {
    min-height: 36px;
    padding: 6px 12px;

    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 8px;

    color: var(--text);
    font-size: 0.8rem;
}

.route-fit-btn:hover {
    border-color: var(--accent-light);
}


/* 20. SVG 離線備援路線圖 */

.route-map {
    display: block;
    width: 100%;
    height: auto;

    background: #192129;
    border: 1px solid var(--border);
    border-radius: 14px;

    overflow: hidden;
}

.route-grid {
    stroke: #303c48;
    stroke-width: 0.6;
}

.route-line {
    fill: none;
    stroke: var(--accent-light);
    stroke-width: 2;
    stroke-dasharray: 5 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.route-point {
    cursor: pointer;
    outline: none;
}

.route-point circle {
    fill: var(--accent);
    stroke: var(--accent-light);
    stroke-width: 1.5;

    transition:
        fill 0.15s ease,
        stroke 0.15s ease;
}

.route-point text {
    fill: #ffffff;
    font-size: 10px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.route-point:hover circle,
.route-point:focus circle,
.route-point:active circle,
.route-point.selected circle,
.route-point.active circle {
    fill: #d28b28;
    stroke: #ffffff;
}

.route-label {
    fill: #dce6ef;
    font-size: 9px;

    paint-order: stroke;
    stroke: #192129;
    stroke-width: 3px;
    stroke-linejoin: round;

    pointer-events: none;
}

.route-north {
    fill: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.route-caption {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.6;
}


/* 21. 路線景點清單 */

.route-stop-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 8px;
    margin-top: 14px;
}

.route-stop-button {
    display: flex;
    align-items: center;
    gap: 8px;

    min-width: 0;
    min-height: 44px;
    padding: 9px 10px;

    background: #303946;
    border: 1px solid var(--border);
    border-radius: 10px;

    color: var(--text);
    text-align: left;
    font-size: 0.85rem;

    overflow-wrap: anywhere;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.route-stop-button:hover,
.route-stop-button:active,
.route-stop-button.selected,
.route-stop-button.active {
    border-color: var(--accent-light);
    background: var(--surface-hover);
}

.route-stop-button > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}


/* 22. 景點流水編號 */

.route-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    min-width: 26px;
    height: 26px;
    padding: 0 5px;

    background: var(--accent);
    border-radius: 999px;

    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
}


/* 23. 詳細行程標題 */

#detail-heading {
    margin: 28px 0 22px;
    font-size: 1.2rem;
    font-weight: 700;
}


/* ============================================
   24. 詳細行程時間軸
   v1.0.8 時間水平及垂直置中
============================================ */

.timeline {
    position: relative;

    display: flex;
    flex-direction: column;

    gap: 18px;
}

.timeline:has(.timeline-item)::before {
    position: absolute;

    top: 14px;
    bottom: 14px;
    left: 9px;

    width: 2px;

    background: var(--border);

    content: "";
}

.timeline-item {
    display: grid;

    grid-template-columns:
        var(--timeline-width)
        minmax(0, 1fr);

    align-items: stretch;

    gap: 16px;

    scroll-margin-top: 24px;
    scroll-margin-bottom: 100px;
}


/* 時間欄位 */

.timeline-time {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;
    padding: 0 4px 0 26px;

    color: var(--accent-light);
    font-size: 1rem;
    font-weight: 700;

    text-align: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}


/* 時間軸圓點 */

.timeline-time::before {
    position: absolute;

    top: 50%;
    left: 10px;

    width: var(--timeline-dot);
    height: var(--timeline-dot);

    box-sizing: border-box;

    background: var(--accent);
    border: 3px solid var(--bg);
    border-radius: 50%;

    box-shadow: 0 0 0 2px var(--accent);

    transform: translate(-50%, -50%);

    content: "";
}


/* ============================================
   25. 詳細行程卡片
   v1.0.8 右側獨立編號欄位
============================================ */

.timeline-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;

    min-width: 0;
    padding: 22px 24px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);

    overflow-wrap: anywhere;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


/* 有路線編號的卡片 */

.timeline-content.has-route-number,
.timeline-content:has(.timeline-route-column) {
    grid-template-columns:
        minmax(0, 1fr)
        48px;

    column-gap: 14px;
    padding-right: 14px;
}


/* 行程文字區域 */

.timeline-main {
    min-width: 0;
    align-self: center;
}


/* 右側編號區域 */

.timeline-route-column {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;
    padding-left: 10px;

    border-left: 1px solid var(--border);
}


/* 可點擊的路線編號 */

.timeline-route-button,
.timeline-route-column .route-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    flex-shrink: 0;

    padding: 0;

    background: var(--accent);
    border: 1px solid transparent;
    border-radius: 50%;

    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.timeline-route-button:hover,
.timeline-route-column .route-number:hover {
    background: var(--accent-hover);
    border-color: var(--accent-light);
}

.timeline-route-button:active {
    transform: scale(0.92);
}

.timeline-route-button.selected,
.timeline-route-button.active {
    background: #d28b28;
    border-color: #ffffff;
}


/* 舊版編號相容設定 */

.timeline-route-number {
    margin: 0;
    vertical-align: middle;
}


/* 行程標題 */

.timeline-content h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.5;
}

.timeline-content h3:last-child {
    margin-bottom: 0;
}


/* 行程說明 */

.timeline-description {
    margin: 8px 0 0;

    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.7;

    white-space: pre-wrap;
}

.timeline-main > :first-child {
    margin-top: 0;
}

.timeline-main > :last-child {
    margin-bottom: 0;
}

.status-message {
    margin: 0;
    padding: 20px;
    color: var(--muted);
    text-align: center;
}


/* 地圖與行程連動高亮 */

.timeline-item.route-highlight .timeline-content {
    border-color: var(--accent-light);

    box-shadow:
        0 0 0 2px rgba(85, 211, 170, 0.2);
}


/* 26. Google Maps 膠囊標籤 */

.map-detail {
    margin: 12px 0 0;
}

.map-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    max-width: 100%;
    padding: 7px 13px;

    background: #343c49;
    border: 1px solid #505e70;
    border-radius: 999px;

    color: #e2e8f0;
    font-size: 0.88rem;
    line-height: 1.5;
}

.map-chip-icon {
    flex-shrink: 0;
}

.map-chip-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.map-chip-link {
    display: inline-block;
    max-width: 100%;
    text-decoration: none;
}

.map-chip-link:hover .map-chip {
    background: #405064;
}


/* 27. 功能頁面 */

.feature-panel {
    min-width: 0;
}

.placeholder-card {
    padding: 44px 24px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);

    text-align: center;
}

.placeholder-icon {
    margin-bottom: 14px;
    font-size: 2.5rem;
}

.placeholder-card h3 {
    margin: 0 0 10px;
    font-size: 1.3rem;
}

.placeholder-card p {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 0.95rem;
}

.sheet-label {
    display: inline-block;
    padding: 6px 12px;

    background: #343c49;
    border: 1px solid #505e70;
    border-radius: 999px;

    color: var(--muted);
    font-size: 0.8rem;
}


/* 28. 旅程設定 */

.settings-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);

    overflow: hidden;
}

.setting-row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);

    gap: 20px;
    padding: 20px 24px;

    border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    color: var(--muted);
    font-size: 0.95rem;
}

.setting-value {
    min-width: 0;

    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.settings-notice {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}


/* 29. 底部導覽列 */

.bottom-nav {
    position: fixed;

    right: 0;
    bottom: 0;
    left: 0;

    z-index: 100;

    padding-bottom:
        env(safe-area-inset-bottom, 0px);

    background: rgba(27, 33, 41, 0.97);
    border-top: 1px solid var(--border);

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.bottom-nav-inner {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));

    gap: 6px;

    width: min(100%, 960px);
    min-height: var(--nav-height);

    margin: 0 auto;
    padding: 8px 32px;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 4px;
    padding: 7px 8px;

    background: transparent;
    border: none;
    border-radius: 12px;

    color: var(--muted);

    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.nav-btn svg {
    width: 24px;
    height: 24px;
}

.nav-btn span {
    font-size: 0.85rem;
    font-weight: 700;
}

.nav-btn:hover {
    background: var(--surface-hover);
}

.nav-btn.active {
    background: rgba(33, 137, 103, 0.15);
    color: var(--accent-light);
}


/* ============================================
   30. 手機版響應式配置
============================================ */

@media (max-width: 600px) {

    :root {
        --nav-height: 68px;
        --timeline-width: 76px;
        --timeline-dot: 14px;
    }

    #home-page,
    #trip-page {
        padding: 24px 16px 64px;
    }

    #trip-page {
        padding-bottom: calc(
            var(--nav-height) +
            32px +
            env(safe-area-inset-bottom, 0px)
        );
    }

    header {
        margin-bottom: 28px;
    }


    /* 首頁 */

    .trip-card {
        gap: 12px;
        padding: 22px 20px;
        border-radius: 20px;
    }

    .trip-card-content {
        gap: 8px;
    }

    .trip-card-title {
        font-size: 1.25rem;
    }

    .trip-date {
        font-size: 0.85rem;
    }

    .trip-card-arrow,
    .trip-card-arrow svg {
        width: 24px;
        height: 24px;
    }


    /* 工具列 */

    .trip-toolbar {
        margin-bottom: 24px;
    }

    .back-btn {
        font-size: 0.9rem;
    }

    .settings-btn {
        width: 42px;
        height: 42px;
    }


    /* 日期切換 */

    .date-tabs {
        gap: 9px;
        margin-bottom: 22px;
    }

    .date-tab {
        min-width: 76px;
        min-height: 88px;
        padding: 10px;
        border-radius: 15px;
    }

    .date-weekday {
        font-size: 0.9rem;
    }

    .date-number {
        font-size: 1.1rem;
    }

    #day-heading {
        margin: 10px 0 22px;
    }


    /* 每日總覽 */

    #daily-overview {
        margin-bottom: 24px;
        border-radius: 18px;
    }

    .overview-header {
        padding: 18px 16px;
    }

    .overview-topline {
        gap: 8px;
        margin-bottom: 8px;
    }

    .overview-day,
    .overview-toggle {
        font-size: 0.8rem;
    }

    .overview-theme {
        font-size: 1.2rem;
    }

    .overview-body {
        padding: 0 16px 18px;
    }

    .overview-summary {
        font-size: 0.9rem;
        margin-bottom: 16px;
    }

    .overview-tags {
        gap: 6px;
        margin-bottom: 14px;
    }

    .overview-tag {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .overview-info {
        gap: 10px;
        padding: 14px 0;
    }

    .overview-info-icon {
        flex-basis: 22px;
        font-size: 1rem;
    }

    .overview-info-label {
        font-size: 0.78rem;
    }

    .overview-info-value {
        font-size: 0.9rem;
    }

    .overview-reminder {
        padding: 14px;
        border-radius: 12px;
    }

    .overview-reminder-title,
    .overview-reminder-text {
        font-size: 0.85rem;
    }

    .overview-cover {
        max-height: 220px;
        margin-bottom: 16px;
        border-radius: 12px;
    }


    /* 每日路線圖 */

    #daily-route {
        margin-bottom: 24px;
        border-radius: 18px;
    }

    .route-header {
        padding: 18px 16px;
        font-size: 1rem;
    }

    .route-toggle {
        font-size: 0.8rem;
    }

    .route-body {
        padding: 0 12px 16px;
    }

    .route-mode-bar {
        gap: 4px;
    }

    .route-mode-btn {
        padding: 8px 5px;
        font-size: 0.78rem;
    }

    .leaflet-map,
    .route-leaflet-map {
        height: clamp(280px, 85vw, 380px);
        border-radius: 12px;
    }

    .route-map {
        border-radius: 12px;
    }

    .route-caption {
        font-size: 0.75rem;
        line-height: 1.65;
    }

    .route-stop-list {
        grid-template-columns: 1fr;
        gap: 7px;
        margin-top: 12px;
    }

    .route-stop-button {
        font-size: 0.8rem;
        padding: 9px 10px;
    }

    .route-number {
        min-width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }


    /* 詳細行程時間軸 */

    #detail-heading {
        margin: 24px 0 18px;
        font-size: 1.1rem;
    }

    .timeline {
        gap: 14px;
    }

    .timeline:has(.timeline-item)::before {
        left: 7px;
    }

    .timeline-item {
        gap: 8px;
    }

    .timeline-time {
        padding: 0 2px 0 22px;
        font-size: 0.85rem;
    }

    .timeline-time::before {
        left: 8px;
        border-width: 2px;
    }


    /* 行程卡片 */

    .timeline-content {
        padding: 16px 13px;
        border-radius: 18px;
    }

    .timeline-content.has-route-number,
    .timeline-content:has(.timeline-route-column) {
        grid-template-columns:
            minmax(0, 1fr)
            34px;

        column-gap: 8px;
        padding-right: 8px;
    }

    .timeline-route-column {
        padding-left: 6px;
    }

    .timeline-route-button,
    .timeline-route-column .route-number {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .timeline-content h3 {
        font-size: 1.05rem;
    }

    .timeline-description {
        font-size: 0.87rem;
    }


    /* Google Maps 標籤 */

    .map-chip {
        gap: 6px;
        padding: 6px 10px;
        font-size: 0.8rem;
    }


    /* 功能頁面 */

    .placeholder-card {
        padding: 36px 20px;
        border-radius: 18px;
    }


    /* 旅程設定 */

    .settings-list {
        border-radius: 18px;
    }

    .setting-row {
        grid-template-columns: 95px minmax(0, 1fr);
        gap: 12px;
        padding: 17px 16px;
    }

    .setting-label,
    .setting-value {
        font-size: 0.9rem;
    }


    /* 底部導覽 */

    .bottom-nav-inner {
        padding: 6px 12px;
        gap: 4px;
    }

    .nav-btn {
        padding: 6px 4px;
    }

    .nav-btn svg {
        width: 23px;
        height: 23px;
    }

    .nav-btn span {
        font-size: 0.78rem;
    }

}


/* 31. 小尺寸手機配置 */

@media (max-width: 360px) {

    :root {
        --timeline-width: 70px;
        --timeline-dot: 12px;
    }

    #home-page,
    #trip-page {
        padding-left: 12px;
        padding-right: 12px;
    }

    .date-tab {
        min-width: 68px;
    }

    .timeline-item {
        gap: 6px;
    }

    .timeline-time {
        padding-left: 19px;
        font-size: 0.8rem;
    }

    .timeline-content {
        padding: 14px 10px;
    }

    .timeline-content.has-route-number,
    .timeline-content:has(.timeline-route-column) {
        grid-template-columns:
            minmax(0, 1fr)
            30px;

        column-gap: 6px;
        padding-right: 6px;
    }

    .timeline-route-column {
        padding-left: 5px;
    }

    .timeline-route-button,
    .timeline-route-column .route-number {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }

    .route-body {
        padding-left: 10px;
        padding-right: 10px;
    }

    .route-mode-btn {
        font-size: 0.72rem;
    }

    .setting-row {
        grid-template-columns: 85px minmax(0, 1fr);
    }

}


/* 32. 減少動態效果 */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

}

/* 33. V1.0 多旅程首頁及全域設定 */
#home-page .home-header, #app-settings-page .home-header {display:flex;align-items:flex-start;justify-content:space-between;gap:16px;}
#home-page .home-header-content, #app-settings-page .home-header-content {flex:1;min-width:0;}
#home-page .home-header h1, #app-settings-page .home-header h1 {font-size:clamp(2rem,5vw,2.8rem);line-height:1.4;margin:0;}
#home-page .home-brand-lockup {display:inline-flex;flex-direction:column;align-items:flex-start;font-size:clamp(2rem,5vw,2.8rem);width:4em;max-width:100%;}
#home-page .home-brand-lockup h1 {white-space:nowrap;}
#home-page svg.home-brand {display:block;width:100%;max-width:4em;height:auto;margin:2px 0 0;color:var(--accent-light);}
#home-page .home-brand text {font-weight:600;}
#home-page .home-header .settings-btn, #app-settings-page .home-header .settings-btn {flex-shrink:0;margin:0;width:44px;height:44px;}
.home-section-heading {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:20px;}
.home-section-heading h2 {margin:0;}
.trip-count {color:var(--muted);font-size:.9rem;white-space:nowrap;}
.trip-list {display:grid;gap:16px;}
.trip-list .trip-card {margin:0;}
.trip-card-meta {display:flex;align-items:center;justify-content:space-between;gap:12px;}
.trip-card-region {color:var(--accent-light);font-size:.85rem;font-weight:700;letter-spacing:1px;}
.trip-card-status {color:var(--muted);font-size:.85rem;}
.home-status {color:var(--muted);text-align:center;padding:20px;}
.home-sync {display:flex;flex-direction:column;align-items:center;gap:8px;margin-top:28px;}
#sync-trips-btn {display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:44px;padding:8px 16px;border:0;border-radius:12px;background:transparent;color:var(--muted);font-size:.95rem;}
#sync-trips-btn svg {display:block;width:20px;height:20px;flex:0 0 20px;color:var(--accent-light);}
#sync-trips-btn:hover {background:var(--surface);color:var(--text);}
#sync-trips-btn:disabled {opacity:.55;cursor:wait;}
.home-sync-info {margin:0;color:var(--muted);font-size:.85rem;text-align:center;overflow-wrap:anywhere;}
#app-settings-page {width:min(100%,960px);margin:0 auto;padding:36px 32px 80px;}
.app-settings-section {margin-bottom:28px;}
.app-settings-section h2 {margin-bottom:14px;}
.app-settings-card {padding:22px 24px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);min-width:0;}
.app-settings-card h3 {margin:0 0 10px;font-size:1.1rem;}
.app-settings-card .settings-notice {margin:0 0 16px;white-space:pre-line;overflow-wrap:anywhere;}
#api-settings-form {display:flex;flex-direction:column;gap:10px;}
#api-settings-form label {color:var(--muted);font-size:.9rem;}
#api-url-input {width:100%;min-width:0;padding:12px;border:1px solid var(--border);border-radius:10px;background:var(--bg);color:var(--text);font:inherit;font-size:16px;}
#api-url-input:focus {outline:2px solid var(--accent-light);outline-offset:2px;}
#save-api-btn, #app-settings-page .danger-btn {width:100%;min-height:44px;padding:10px 16px;border:1px solid transparent;border-radius:12px;font-weight:700;}
#save-api-btn {background:var(--accent);color:#fff;}
#save-api-btn:hover {background:var(--accent-hover);}
#save-api-btn:disabled {opacity:.55;cursor:wait;}
#app-settings-page .danger-btn {background:var(--surface-hover);border-color:var(--border);color:#f0a0a0;}
.setting-status {margin:0;color:var(--muted);font-size:.85rem;overflow-wrap:anywhere;}
.setting-status:empty {display:none;}
.setting-status.success {color:var(--accent-light);}
.setting-status.error {color:#f0a0a0;}
.app-settings-card .settings-list {margin:0;}
/* 時間及圓點對齊行程首行，右側編號維持置中 */
.timeline-item {--first-line:1.8rem;--card-top:22px;}
.timeline-item:not(:has(.timeline-main > h3:first-child)) {--first-line:1.615rem;}
.timeline-item:has(.timeline-main > .map-detail:first-child) {--first-line:calc(1.32rem + 16px);}
.timeline-main {align-self:start;}
.timeline-time {align-self:start;line-height:var(--first-line);padding-top:calc(var(--card-top) + 1px);}
.timeline-time::before {top:calc(var(--card-top) + 1px + var(--first-line)/2);}
@media(max-width:600px) {
 #app-settings-page {padding:24px 16px 80px;}
 #home-page .home-header,#app-settings-page .home-header {gap:12px;}
 .app-settings-card {padding:16px;}
 .timeline-item {--card-top:16px;--first-line:1.575rem;}
 .timeline-item:not(:has(.timeline-main > h3:first-child)) {--first-line:1.479rem;}
 .timeline-item:has(.timeline-main > .map-detail:first-child) {--first-line:calc(1.2rem + 14px);}
}
@media(max-width:360px) {
 #app-settings-page {padding-left:12px;padding-right:12px;}
 .timeline-item {--card-top:14px;}
}

/* ============================================
   TRAVEL_LOG_ABOUT_COMPACT
============================================ */

#app-settings-page .app-about-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

#app-settings-page .app-about-name,
#app-settings-page .app-about-version {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

#app-settings-page .app-about-name {
    text-align: left;
}

#app-settings-page .app-about-version {
    text-align: right;
    white-space: nowrap;
}
