/* 回忆地图 · 样式 — 旅程页（右侧滑出面板）
 *
 * 电脑 / iPad：地图占左边 2/3，面板只占右边 1/3（最窄 340px）；手机端面板整页从右边滑入。
 * 面板里有三个视图：列表 #journey-content、详情 #journey-detail（时间轴）、表单 #journey-form，
 * 用面板上的 .detail-open / .form-open 切换（见 js/app/17-journey.js）。
 * 只用自己的 #journey-panel 和 #main-container.journey-open，不碰地图本身、不碰 #memory-panel、不碰底部导航栏的样式。
 */

/* ── 面板本体（默认收起） ── */
#journey-panel {
    width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    z-index: 10;
    visibility: hidden;
    background: #ffffff;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s;
    will-change: width;
}

html.dark-mode #journey-panel {
    background: #121214;
}

/* 头部也是纯色：盖过 11-apple-theme 里带透明度 + 毛玻璃的 .panel-header-container（!important） */
#journey-panel #journey-panel-header {
    background: #ffffff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

html.dark-mode #journey-panel #journey-panel-header {
    background: #121214 !important;
}

/* ── 电脑 / iPad：面板占右边 1/3（太窄的屏幕保底 340px），地图占剩下的（动画沿用原来的 0.5s） ── */
#main-container {
    --journey-w: max(33.33vw, 340px);
}

@media (min-width: 769px) {
    #main-container.journey-open #chartdiv {
        width: calc(100vw - var(--journey-w));
    }

    #main-container.journey-open #journey-panel {
        width: var(--journey-w);
        visibility: visible;
        border-left: 1px solid var(--apple-border, rgba(0, 0, 0, 0.08));
    }
}

/* ── 手机端：整页从右边滑入 ── */
@media (max-width: 768px) {
    #journey-panel {
        width: 100% !important;
        position: absolute;
        top: 0;
        left: 0;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
    }

    #main-container.journey-open #journey-panel {
        transform: translateX(0);
        visibility: visible;
    }
}

/* ── 头部：标题 + 右上角（＋ / ✕） ── */
#journey-title {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.5px;
    line-height: 1;
}

#journey-subtitle {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    margin-top: 6px;
    letter-spacing: 1px;
}

#journey-panel-header {
    flex-shrink: 0;
    justify-content: space-between;
}

/* 面板变窄了，头部左右留白收一点（盖过 11-apple-theme / 13-panel-header-fix 里的 !important） */
#journey-panel #journey-panel-header {
    padding-left: 22px !important;
    padding-right: 18px !important;
}

/* 标题：详情页里前面多一个「‹」，点标题 = 返回列表 */
#journey-title {
    display: flex;
    align-items: center;
}

#journey-back {
    display: none;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 22px;
    margin-left: -7px;
    margin-right: 2px;
}

#journey-panel.detail-open:not(.form-open) #journey-back {
    display: inline-flex;
}

#journey-panel.detail-open:not(.form-open) #journey-title {
    cursor: pointer;
}

/* 详情页里不需要「＋」（新建在列表页）；.panel-func-btn 自带 display:flex !important，所以这里也要 !important */
#journey-panel.detail-open #btn-journey-add {
    display: none !important;
}

#journey-panel-header>div:last-child {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    align-self: flex-end;
    margin-bottom: 8px;
}

/* ── 内容区（列表）：自己滚动 ── */
#journey-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 18px 60px;
    box-sizing: border-box;
}

/* ── 新建旅程表单：打开时盖住列表（默认不显示） ── */
#journey-form {
    display: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    flex-direction: column;
    gap: 18px;
    padding: 22px 22px 60px;
    box-sizing: border-box;
}

#journey-panel.form-open #journey-content,
#journey-panel.detail-open #journey-content,
#journey-panel.form-open #journey-detail {
    display: none;
}

#journey-panel.form-open #journey-form {
    display: flex;
}

#journey-form .journey-form-title {
    font-size: 17px;
    font-weight: 800;
}

#journey-form .journey-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 560px;
}

#journey-form .journey-field>span {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.6;
    letter-spacing: 0.5px;
}

#journey-form .journey-field>input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-size: 16px;
    /* 16px 以上，iOS 点输入框时不会自动放大页面 */
    border-radius: 12px;
    background: transparent;
    color: inherit;
    outline: none;
}

#journey-form .journey-form-actions {
    display: flex;
    gap: 12px;
    max-width: 560px;
    margin-top: 6px;
}

#journey-form .journey-btn {
    flex: 1;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid rgba(128, 128, 128, 0.35);
    background: transparent;
    color: inherit;
}

#journey-form .journey-btn-primary {
    background: #1c1c1e;
    border-color: #1c1c1e;
    color: #fff;
}

html.dark-mode #journey-form .journey-btn-primary {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #111;
}

@media (max-width: 768px) {

    #journey-content,
    #journey-detail,
    #journey-form {
        padding: 18px 18px 120px;
    }
}

/* ── 选择控件：城市下拉（点输入框展开）与回忆多选列表（常开） ── */
#journey-form .journey-field>span em {
    font-style: normal;
    font-weight: 600;
    opacity: 0.8;
}

#journey-form .journey-pick-list {
    display: none;
    flex-direction: column;
    max-height: 240px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(128, 128, 128, 0.28);
    border-radius: 12px;
}

#journey-form .journey-pick-list.journey-pick-open {
    display: flex;
}

#journey-form .journey-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.12);
}

#journey-form .journey-opt:last-child {
    border-bottom: none;
}

#journey-form .journey-opt:hover {
    background: rgba(128, 128, 128, 0.10);
}

#journey-form .journey-opt.selected {
    background: rgba(128, 128, 128, 0.18);
    font-weight: 700;
}

#journey-form .journey-opt-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#journey-form .journey-opt-sub {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.5;
}

#journey-form .journey-opt-empty {
    padding: 16px 14px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.5;
    text-align: center;
}

/* 自绘的勾选框（不用原生 checkbox，避免被全局 input 样式改花） */
#journey-form .journey-check {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    box-sizing: border-box;
    border: 1.5px solid rgba(128, 128, 128, 0.5);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
}

#journey-form .journey-opt.selected .journey-check {
    background: #1c1c1e;
    border-color: #1c1c1e;
    color: #fff;
}

html.dark-mode #journey-form .journey-opt.selected .journey-check {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #111;
}


/* ── 设置面板里的开关（「显示所有旅程线」，js/theme-and-fullscreen.js 的 openSettingsPanel） ──
 * iOS 风格小开关：关 = 灰底、开 = 绿底，白色圆钮。夜间模式只换关闭时的底色。 */
.rm-switch {
    position: relative;
    flex: 0 0 auto;
    width: 40px;
    height: 24px;
    border-radius: 12px;
    background: #d1d1d6;
    transition: background-color 0.2s ease;
}

.rm-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.rm-switch.on {
    background: #34c759;
}

.rm-switch.on::after {
    transform: translateX(16px);
}

html.dark-mode .rm-switch {
    background: #48484a;
}

html.dark-mode .rm-switch.on {
    background: #30d158;
}


/* ══════════════════════════════════════════════════════════
 * 视图一：旅程列表 —— 每条左边一张矩形封面
 * ══════════════════════════════════════════════════════════ */
.journey-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid var(--apple-border, rgba(128, 128, 128, 0.2));
    border-radius: 16px;
    background: #ffffff;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.journey-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.journey-item:active {
    transform: scale(0.985);
}

.journey-item:focus-visible {
    outline: 2px solid rgba(128, 128, 128, 0.6);
    outline-offset: 2px;
}

html.dark-mode .journey-item {
    background: #1c1c1e;
    border-color: rgba(255, 255, 255, 0.10);
}

html.dark-mode .journey-item:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

/* 封面：最左边的矩形图片框（4:3），没有照片时显示一个路线小图标 */
.journey-cover {
    flex: 0 0 auto;
    width: 104px;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, #e8e8ed, #d1d1d6);
    color: rgba(60, 60, 67, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}

html.dark-mode .journey-cover {
    background: linear-gradient(135deg, #2c2c2e, #1c1c1e);
    color: rgba(255, 255, 255, 0.35);
}

.journey-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    animation: journeyFadeIn 0.4s ease both;
}

.journey-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 24px;
    /* 给右上角的删除按钮让位 */
}

.journey-name {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.journey-cities {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    opacity: 0.58;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}

.journey-meta {
    font-size: 11.5px;
    font-weight: 600;
    opacity: 0.42;
}

.journey-del-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    opacity: 0.35;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.journey-del-btn:hover,
.journey-del-btn:focus-visible {
    opacity: 1;
    color: #ff3b30;
    background: rgba(255, 59, 48, 0.12);
}

.journey-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    min-height: 240px;
    text-align: center;
    opacity: 0.45;
    padding: 0 24px;
}

.journey-empty-t {
    font-size: 17px;
    font-weight: 800;
}

.journey-empty-s {
    font-size: 13px;
    font-weight: 600;
}

@keyframes journeyFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ══════════════════════════════════════════════════════════
 * 视图二：旅程详情 —— 可编辑名称 + 城市小字 + 时间轴
 * ══════════════════════════════════════════════════════════ */
#journey-detail {
    display: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 20px 80px;
    box-sizing: border-box;
}

#journey-panel.detail-open:not(.form-open) #journey-detail {
    display: block;
}

/* 名称：看起来是大标题，点一下就能改（盖过全站 input 样式，所以带 !important） */
#journey-detail .jd-name-wrap {
    position: relative;
}

#journey-detail .jd-name {
    display: block;
    width: calc(100% + 8px);
    margin: 0 0 0 -8px;
    padding: 4px 32px 4px 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -0.4px;
    line-height: 1.25;
    color: inherit;
    text-overflow: ellipsis;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

#journey-detail .jd-name::placeholder {
    color: inherit;
    opacity: 0.88;
}

#journey-detail .jd-name:hover {
    background: rgba(128, 128, 128, 0.08) !important;
}

#journey-detail .jd-name:focus {
    background: rgba(128, 128, 128, 0.10) !important;
    border-color: rgba(128, 128, 128, 0.4) !important;
}

#journey-detail .jd-name:focus::placeholder {
    opacity: 0.35;
}

#journey-detail .jd-name-pen {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    opacity: 0.32;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

#journey-detail .jd-name:focus+.jd-name-pen {
    opacity: 0;
}

/* 名称底下的小字：这趟旅程经过的城市 */
#journey-detail .jd-cities {
    margin-top: 6px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.55;
    opacity: 0.56;
    word-break: break-all;
}

#journey-detail .jd-meta {
    margin-top: 3px;
    font-size: 11.5px;
    font-weight: 600;
    opacity: 0.4;
}

#journey-detail .jd-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

#journey-detail .jd-act {
    padding: 8px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    border-radius: 10px;
    border: 1px solid rgba(128, 128, 128, 0.32);
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#journey-detail .jd-act:hover {
    background: rgba(128, 128, 128, 0.12);
}

#journey-detail .jd-act-danger {
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.35);
}

#journey-detail .jd-act-danger:hover {
    background: rgba(255, 59, 48, 0.1);
}

#journey-detail .jd-empty {
    margin-top: 48px;
    text-align: center;
    opacity: 0.45;
}

#journey-detail .jd-empty-t {
    font-size: 16px;
    font-weight: 800;
}

#journey-detail .jd-empty-s {
    margin-top: 6px;
    font-size: 12.5px;
    font-weight: 600;
}

/* ── 时间轴：一条竖线串起每天的节点，节点下面是当天的回忆卡片 ── */
#journey-detail .jt {
    margin-top: 28px;
}

#journey-detail .jt-day {
    position: relative;
    padding: 0 0 26px 30px;
    animation: jtIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* 竖线：从本节点圆心连到下一个节点圆心 */
#journey-detail .jt-day::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 11px;
    bottom: -11px;
    width: 2px;
    border-radius: 1px;
    background: rgba(128, 128, 128, 0.26);
}

#journey-detail .jt-day:last-child::before {
    display: none;
}

#journey-detail .jt-dot {
    position: absolute;
    left: 0;
    top: 4px;
    width: 14px;
    height: 14px;
    box-sizing: border-box;
    border-radius: 50%;
    background: #1c1c1e;
    box-shadow: 0 0 0 4px #f2f2f7;
    /* 描一圈和面板同色的边，把竖线「挖」出一个缺口 */
}

html.dark-mode #journey-detail .jt-dot {
    background: #f0f0f0;
    box-shadow: 0 0 0 4px #121214;
}

#journey-detail .jt-date {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

#journey-detail .jt-date-main {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.2px;
}

#journey-detail .jt-date-sub {
    font-size: 11.5px;
    font-weight: 600;
    opacity: 0.42;
}

#journey-detail .jt-day-cities {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.55;
}

#journey-detail .jt-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 9px;
    box-sizing: border-box;
    border: 1px solid var(--apple-border, rgba(128, 128, 128, 0.2));
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#journey-detail .jt-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.09);
}

#journey-detail .jt-card:active {
    transform: scale(0.988);
}

#journey-detail .jt-card:focus-visible {
    outline: 2px solid rgba(128, 128, 128, 0.6);
    outline-offset: 2px;
}

html.dark-mode #journey-detail .jt-card {
    background: #1c1c1e;
    border-color: rgba(255, 255, 255, 0.10);
}

/* 缩略图在卡片左边（方形），文字在右边 —— 一屏能看到更多回忆 */
#journey-detail .jt-photo {
    position: relative;
    flex: 0 0 auto;
    width: 92px;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    background: #e5e5ea;
    overflow: hidden;
}

html.dark-mode #journey-detail .jt-photo {
    background: #2c2c2e;
}

#journey-detail .jt-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#journey-detail .jt-photo-n {
    position: absolute;
    right: 5px;
    bottom: 5px;
    padding: 1px 7px;
    font-size: 10.5px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-radius: 10px;
}

#journey-detail .jt-text {
    flex: 1;
    min-width: 0;
    padding: 2px 4px 2px 0;
}

#journey-detail .jt-name {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.35;
    word-break: break-all;
}

#journey-detail .jt-city {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.5;
}

#journey-detail .jt-desc {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.68;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}

@keyframes jtIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

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

    #journey-detail .jt-day,
    .journey-cover img {
        animation: none;
    }

    .journey-item,
    #journey-detail .jt-card {
        transition: none;
    }
}

/* ══════════════════════════════════════════════════════════
 * 视图三：表单里的分组选择器 —— 「某天 · 某城市」一组，点标题一键全选
 * ══════════════════════════════════════════════════════════ */
#journey-form .journey-field>span em {
    font-style: normal;
}

#journey-form .journey-field-hint {
    margin-top: -2px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    opacity: 0.5;
}

#journey-form #journey-list-memories {
    max-height: 420px;
}

#journey-form .journey-group {
    flex-shrink: 0;
}

#journey-form .journey-group+.journey-group {
    border-top: 1px solid rgba(128, 128, 128, 0.18);
}

#journey-form .journey-group-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    background: #e9e9ee;
    border-bottom: 1px solid rgba(128, 128, 128, 0.14);
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease;
}

html.dark-mode #journey-form .journey-group-head {
    background: #26262a;
}

#journey-form .journey-group-head:hover {
    background: #dedee4;
}

/* 分组里的回忆行缩进一格，和上面的分组标题区分开；选中的行只淡淡着色，标题保持更深 */
#journey-form .journey-group .journey-opt {
    padding-left: 34px;
}

#journey-form .journey-group .journey-opt.selected {
    background: rgba(28, 28, 30, 0.055);
}

html.dark-mode #journey-form .journey-group .journey-opt.selected {
    background: rgba(255, 255, 255, 0.07);
}

html.dark-mode #journey-form .journey-group-head:hover {
    background: #2f2f34;
}

#journey-form .journey-group-title {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
}

#journey-form .journey-group-title b {
    font-size: 14px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
}

#journey-form .journey-group-title small {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.5;
}

#journey-form .journey-group-pill {
    flex-shrink: 0;
    padding: 4px 11px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 999px;
    border: 1px solid rgba(128, 128, 128, 0.4);
}

#journey-form .journey-group-head.selected .journey-group-pill {
    background: #1c1c1e;
    border-color: #1c1c1e;
    color: #fff;
}

html.dark-mode #journey-form .journey-group-head.selected .journey-group-pill {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #111;
}

/* 分组标题上的勾选框：全选 = 实心 ✓，部分选中 = 描边 – */
#journey-form .journey-group-head.selected .journey-check {
    background: #1c1c1e;
    border-color: #1c1c1e;
    color: #fff;
}

html.dark-mode #journey-form .journey-group-head.selected .journey-check {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #111;
}

#journey-form .journey-group-head.partial .journey-check {
    border-color: #1c1c1e;
}

html.dark-mode #journey-form .journey-group-head.partial .journey-check {
    border-color: #f0f0f0;
}

/* ═══════════════════════════════════════════════════════════
   旅程详情页：底部「回忆 / 图册」开关（和城市详情的 #city-view-toggle 同款，只在旅程详情页显示）
   电脑 / iPad：居中在右边的旅程面板下面；手机：整页居中。显隐由 17-journey.js 的 syncToggle 加减 .active
   ═══════════════════════════════════════════════════════════ */
#journey-view-toggle {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    z-index: 2147483000;
    display: flex;
    align-items: center;
    padding: 5px;
    border-radius: 50px;
    background: rgba(26, 26, 26, 0.88);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
}

#journey-view-toggle.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

@media (min-width: 769px) {
    /* 面板宽 = max(1/3 屏宽, 340px)，开关居中在面板正下方 */
    #journey-view-toggle {
        left: calc(100vw - max(33.33vw, 340px) / 2);
    }
}

@media (max-width: 768px) {
    #journey-view-toggle {
        bottom: max(30px, env(safe-area-inset-bottom, 0px) + 20px);
    }
}

#journey-toggle-slider {
    position: absolute;
    width: 70px;
    height: 34px;
    background: #fff;
    border-radius: 25px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.journey-view-toggle-btn {
    position: relative;
    width: 70px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s;
}

#journey-view-toggle[data-mode="moment"] .journey-view-toggle-btn.moment,
#journey-view-toggle[data-mode="gallery"] .journey-view-toggle-btn.gallery {
    color: #1a1a1a;
}

#journey-view-toggle[data-mode="gallery"] #journey-toggle-slider {
    transform: translateX(70px);
}

/* 回忆详情 / 大图 / 确认弹窗 / 幻灯片盖上来时，开关先收起来 */
body.detail-open #journey-view-toggle,
body:has(#confirm-overlay.active) #journey-view-toggle {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-50%) translateY(30px);
}

body.ss-mode-active #journey-view-toggle {
    display: none;
}

/* 详情页底部多留一点，别让开关盖住最后一条 */
#journey-detail {
    padding-bottom: 110px;
}

/* ── 旅程图册：两列瀑布流（卡片样式沿用城市图册的 .country-card） ── */
#journey-detail .jg-cols {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
}

#journey-detail .jg-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── 添加回忆弹窗里的「归入旅程」 ── */
#modal-overlay #in-journey {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 13px 38px 13px 15px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: #1c1c1e;
    background-color: #f2f2f7;
    border: 1.5px solid transparent;
    border-radius: 12px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    cursor: pointer;
    outline: none;
}

#modal-overlay #in-journey:focus {
    background-color: #fff;
    border-color: #1c1c1e;
    box-shadow: 0 0 0 3px rgba(28, 28, 30, 0.08);
}

html.dark-mode #modal-overlay #in-journey {
    color: #f2f2f7;
    background-color: #2c2c2e;
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark-mode #modal-overlay #in-journey:focus {
    background-color: #3a3a3c;
    border-color: rgba(255, 255, 255, 0.3);
}

#modal-overlay #in-journey-new {
    margin-top: 10px;
}

#modal-overlay #in-journey-new input {
    margin-top: 0;
    margin-bottom: 10px;
}

#modal-overlay .in-journey-row {
    display: flex;
    gap: 10px;
}

#modal-overlay .in-journey-row input {
    flex: 1;
    min-width: 0;
    margin-bottom: 0 !important;
}

@media (max-width: 480px) {
    #modal-overlay .in-journey-row {
        flex-direction: column;
    }

    #modal-overlay .in-journey-row input {
        margin-bottom: 10px !important;
    }
}


/* ═══════════════════════════════════════════════════════════
   时间轴并入旅程：底部「旅程 / 时间轴」切换（和城市列表的 #country-view-toggle 同款）
   只在旅程列表页、时间轴页出现；显隐 / 当前项由 js/app/19-journey-tabs.js 设置 .active 和 data-mode
   ═══════════════════════════════════════════════════════════ */
#journey-tab-toggle {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    z-index: 2147483000;
    display: flex;
    align-items: center;
    padding: 5px;
    border-radius: 50px;
    background: rgba(26, 26, 26, 0.88);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.35s, left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#journey-tab-toggle.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

@media (min-width: 769px) {
    /* 旅程面板宽 = max(1/3 屏宽, 340px)；时间轴面板宽 = 2/3 屏宽。开关居中在当前面板正下方 */
    #journey-tab-toggle[data-mode="journey"] {
        left: calc(100vw - max(33.33vw, 340px) / 2);
    }

    #journey-tab-toggle[data-mode="timeline"] {
        left: 66.67vw;
    }
}

@media (max-width: 768px) {
    #journey-tab-toggle {
        bottom: max(30px, env(safe-area-inset-bottom, 0px) + 20px);
    }
}

#journey-tab-slider {
    position: absolute;
    width: 70px;
    height: 34px;
    background: #fff;
    border-radius: 25px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.journey-tab-btn {
    position: relative;
    width: 70px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s;
    -webkit-tap-highlight-color: transparent;
}

#journey-tab-toggle[data-mode="journey"] .journey-tab-btn.journey,
#journey-tab-toggle[data-mode="timeline"] .journey-tab-btn.timeline {
    color: #1a1a1a;
}

#journey-tab-toggle[data-mode="timeline"] #journey-tab-slider {
    transform: translateX(70px);
}

/* 回忆详情 / 大图 / 弹窗 / 那年今日 / 幻灯片盖上来时，开关先收起来 */
body.detail-open #journey-tab-toggle,
body:has(#confirm-overlay.active) #journey-tab-toggle,
body:has(#otd-overlay.active) #journey-tab-toggle {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-50%) translateY(30px);
}

body.ss-mode-active #journey-tab-toggle {
    display: none;
}

/* 列表页底部多留一点，别让开关盖住最后一条；
   上内边距收到 8px（吸顶的月份标题用 --journey-list-pt 抵消它，见 .journey-month-head），第一个月标题自带 12px 上内边距，静止时位置和原来一致 */
#journey-content {
    --journey-list-pt: 8px;
    padding-top: var(--journey-list-pt);
    padding-bottom: 110px;
}

/* ── 时间轴也是旅程的一部分：背景同样是不透明纯白（夜间模式沿用原来的深色） ── */
html:not(.dark-mode) #memory-panel.timeline-mode {
    background: #ffffff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

html:not(.dark-mode) #memory-panel.timeline-mode .panel-header-container {
    background: #ffffff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}


/* ══════════════════════════════════════════════════════════
 * 旅程列表按「开始的年月」分组（从晚到早）+ 时间跳转器
 * ══════════════════════════════════════════════════════════ */

/* 每个月一组，标题吸顶：不透明底色，卡片从下面滑过时不会透出来；左右用负边距铺满整个列表宽度 */
.journey-month {
    position: relative;
}

.journey-month-head {
    position: sticky;
    /* sticky 的 top 是从滚动容器的「内边距里面」算起的：容器有 8px 上内边距，top:0 会停在离顶部 8px 的地方，
       上面露出一条缝（卡片从缝里透出来）。用等值的负数抵消，让标题贴死在头部分隔线下面 */
    top: calc(-1 * var(--journey-list-pt, 8px));
    z-index: 3;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 -18px 8px;
    padding: 12px 18px 8px;
    background: #ffffff;
}

html.dark-mode .journey-month-head {
    background: #121214;
}

.journey-month-title {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.journey-month-count {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.45;
}

.journey-month:first-child .journey-month-head {
    padding-top: 12px;   /* 和其它月份一样：吸顶时标题不会因为换成另一个月而上下跳 */
}

.journey-tail {
    height: 0;
    pointer-events: none;
}

/* 跳转到某个月后，那个月的第一张卡片闪一下 */
@keyframes journey-flash-kf {
    0% { box-shadow: 0 0 0 0 rgba(128, 128, 128, 0.55); }
    40% { box-shadow: 0 0 0 5px rgba(128, 128, 128, 0.28); }
    100% { box-shadow: 0 0 0 0 rgba(128, 128, 128, 0); }
}

.journey-item.journey-flash {
    animation: journey-flash-kf 1.4s ease-out 0.35s 1;
}

/* ── 头部的日历按钮：没有旅程 / 在详情页 / 在表单里时不显示（.panel-func-btn 自带 display:flex !important） ── */
#btn-journey-jump.journey-jump-off,
#journey-panel.detail-open #btn-journey-jump,
#journey-panel.form-open #btn-journey-jump {
    display: none !important;
}

#btn-journey-jump[aria-expanded="true"] {
    background: rgba(0, 0, 0, 0.08) !important;
    border-color: rgba(0, 0, 0, 0.22) !important;
}

html.dark-mode #btn-journey-jump[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
}

/* ── 跳转弹层：盖在列表上方，top 由 JS 按头部高度设置 ── */
#journey-jump-pop {
    display: none;
    position: absolute;
    right: 12px;
    z-index: 30;
    width: min(320px, calc(100% - 24px));
    box-sizing: border-box;
    padding: 14px;
    border: 1px solid var(--apple-border, rgba(128, 128, 128, 0.22));
    border-radius: 18px;
    background: #ffffff;
    color: inherit;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16);
}

html.dark-mode #journey-jump-pop {
    background: #1c1c1e;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}

#journey-jump-pop.open {
    display: block;
    animation: journey-jump-in 0.18s ease-out;
}

@keyframes journey-jump-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

#journey-panel.detail-open #journey-jump-pop,
#journey-panel.form-open #journey-jump-pop {
    display: none !important;
}

.journey-jump-title {
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    opacity: 0.5;
}

/* 年份：一排小胶囊，年份多了可以横向滑 */
.journey-jump-years {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.journey-jump-years::-webkit-scrollbar {
    display: none;
}

.journey-jump-year {
    flex: 0 0 auto;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    color: inherit;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.journey-jump-year.active {
    background: #1c1c1e;
    border-color: #1c1c1e;
    color: #fff;
}

html.dark-mode .journey-jump-year.active {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #111;
}

/* 12 个月：4 × 3；没有旅程的月份灰掉不能点，有旅程的右上角小字是这个月有几段 */
.journey-jump-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.journey-jump-month {
    position: relative;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: inherit;
    border: 1px solid rgba(128, 128, 128, 0.28);
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.journey-jump-month:not(.empty):hover {
    background: rgba(128, 128, 128, 0.14);
}

.journey-jump-month:not(.empty):active {
    transform: scale(0.95);
}

.journey-jump-month.empty {
    opacity: 0.28;
    cursor: default;
    border-style: dashed;
}

.journey-jump-month.current {
    border-color: #1c1c1e;
    box-shadow: inset 0 0 0 1px #1c1c1e;
}

html.dark-mode .journey-jump-month.current {
    border-color: #f0f0f0;
    box-shadow: inset 0 0 0 1px #f0f0f0;
}

.journey-jump-n {
    position: absolute;
    top: 3px;
    right: 6px;
    font-size: 10px;
    font-weight: 700;
    opacity: 0.5;
}

.journey-jump-unknown {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    color: inherit;
    border: 1px dashed rgba(128, 128, 128, 0.4);
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
}


/* ── 旅程 ⇄ 时间轴 切换动画（class 由 js/app/19-journey-tabs.js 在切换期间临时添加） ──
 * jt-anim  切换进行中
 * jt-fwd   旅程 → 时间轴        jt-back  时间轴 → 旅程
 * jt-hold  【手机】把两页按在起点：class 已经改完、目的页内容在屏幕外渲染，但先不动；渲染完才松手开始滑
 * jt-nt    动画结束时关掉过渡，让两个面板瞬间回到各自的收起位置
 * 下面「通用」这段手机 / 电脑都生效；「手机」「电脑」各管各的。 */

/* ── 通用：切换期间去掉记忆面板 / 头部的毛玻璃（每帧重算模糊是最贵的操作之一） ── */
#main-container.jt-anim #memory-panel,
#main-container.jt-anim #memory-panel .panel-header-container,
#main-container.jt-anim #journey-panel,
#main-container.jt-anim #journey-panel .panel-header-container {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

/* ── 手机：左右翻页 ── */
@media (max-width: 768px) {

    #main-container.jt-anim #journey-panel,
    #main-container.jt-anim #memory-panel {
        visibility: visible !important;
        transition: transform 0.46s cubic-bezier(0.32, 0.72, 0, 1) !important;
        will-change: transform;                  /* jt-hold 期间就提升成独立图层，动画第一帧不用再临时建 */
    }

    /* 旅程 → 时间轴：旅程往左滑出 */
    #main-container.jt-fwd:not(.journey-open) #journey-panel {
        transform: translateX(-100%);
    }

    /* 按住起点（不动）：盖过上面的目的态，且没有过渡；松手后（移除 jt-hold）才从起点滑向终点 */
    #main-container.jt-hold #journey-panel,
    #main-container.jt-hold #memory-panel {
        transition: none !important;
    }

    #main-container.jt-hold.jt-fwd #journey-panel   { transform: translateX(0); }
    #main-container.jt-hold.jt-fwd #memory-panel    { transform: translateX(100%); }
    #main-container.jt-hold.jt-back #journey-panel  { transform: translateX(-100%); }
    #main-container.jt-hold.jt-back #memory-panel   { transform: translateX(0); }

    #main-container.jt-nt #journey-panel,
    #main-container.jt-nt #memory-panel {
        transition: none !important;
    }
}

/* ── 电脑 / iPad：宽度过渡照旧，但切换期间让面板里的内容保持「最终宽度」 ──
 * 面板宽度 0 → 2/3（或 1/3 → 0）逐帧变化时，里面几十张卡片的文字、图片会逐帧重新排版，这是电脑端卡的主因。
 * 把内容的最小宽度钉在最终宽度上，面板变窄只是把内容裁掉（overflow 已隐藏），不再重排；
 * 内容比面板宽期间不能出现横向滚动条，所以记忆面板临时 overflow-x:hidden。 */
@media (min-width: 769px) {

    #main-container.jt-anim #memory-panel {
        overflow-x: hidden !important;
    }

    #main-container.jt-anim #memory-panel > #panel-header,
    #main-container.jt-anim #memory-panel > #waterfall-list {
        min-width: calc(66.67vw - 24px);
        box-sizing: border-box;
    }

    #main-container.jt-anim #journey-panel > #journey-panel-header,
    #main-container.jt-anim #journey-panel > #journey-content {
        min-width: calc(var(--journey-w) - 2px);
        box-sizing: border-box;
    }

    #main-container.jt-nt #journey-panel,
    #main-container.jt-nt #memory-panel {
        transition: none !important;
    }
}


/* ── 回忆详情页：「所在旅程」按钮（样式沿用 .detail-meta-info span，这里只管长名字） ── */
.detail-meta-info .detail-journey-link {
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
