/*
 * 整包來源檔。執行期載入 public/css/memory/*.css（config/memory_styles.php）。
 * 編輯本檔後請執行：python tools/split_memory_css.py
 */
/* 失智預防懶人包（Memory 功能頁）自訂樣式（純 CSS，無 Tailwind） */

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

.memory-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
    flex-shrink: 0;
}
.memory-icon.is-spin {
    animation: memory-icon-spin 1s linear infinite;
}
@keyframes memory-icon-spin {
    to {
        transform: rotate(360deg);
    }
}

body {
    margin: 0;
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", -apple-system, BlinkMacSystemFont,
        "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    font-size: 18px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 內容不足一屏時，footer 貼視窗底（.udn-site-footer 已有 margin-top: auto） */
body > main {
    flex: 1 0 auto;
    width: 100%;
}

/* ================== 新版導覽線條圖示 ================== */
.icon-line {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ================== 首頁（新版）：Header 會員入口 ================== */
.home-login-entry {
    min-height: 40px;
    padding: 5px 6px;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #555;
    cursor: pointer;
}
.home-login-entry:hover {
    color: #D85A78;
}

/* 來源 `.toast`：置底置中。z-index 用 games.html 的 9999（全螢幕遊戲層 1000）。
   底色對齊 index3／brand-system 的 --pink-deep（#B74360）。
   顯示／隱藏靠 `.is-visible`，不依賴 Tailwind 工具類別。 */
.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(16px);
    max-width: 86%;
    padding: 12px 22px;
    border-radius: 999px;
    background: #B74360;
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast #toast-icon {
    flex-shrink: 0;
    font-size: 1em;
}
.toast #toast-icon.is-success {
    color: #4ade80;
}
.toast #toast-icon.is-warning {
    color: #fed7aa;
}

.home-avatar-button {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.home-avatar {
    width: 36px;
    height: 36px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid #E4B8C4;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFE8EE;
    color: #B74360;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    transition: border-color 0.2s;
}
.home-avatar-button:hover .home-avatar {
    border-color: #FB6C8A;
}

.home-header-account {
    position: relative;
    flex-shrink: 0;
}

.home-login-icon {
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.home-login-icon svg {
    display: block;
    width: 24px;
    height: 24px;
}

#user-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    width: 9rem;
    padding: 6px 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    z-index: 50;
    font-size: 14px;
}
#user-menu.is-open {
    display: block;
}
.home-user-menu-logout {
    width: 100%;
    padding: 8px 16px;
    border: 0;
    background: transparent;
    color: #475569;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}
.home-screening-card picture {
    display: block;
    width: 100%;
}
.home-screening-card .home-screening-image {
    display: block;
    width: 100%;
    object-fit: cover;
}

/* ================== 首頁 index3.html（2026-09-18 版本） ================== */
html {
    scroll-behavior: smooth;
}
body {
    margin: 0;
    background: linear-gradient(180deg, #FFFDFD 0%, #FFF9FA 42%, #FFF8FA 100%);
    color: #3A2D31;
}

.memory-header {
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    border-bottom: 1px solid #F2DCE2;
    background: rgba(255, 253, 253, 0.97);
}
.home-header-inner {
    width: 100%;
    max-width: 1180px;
    height: 64px;
    margin: auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
}
.home-logo {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.home-logo-image-link {
    flex-shrink: 0;
    line-height: 0;
    text-decoration: none;
}
.home-logo-image-link img {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
}
.home-logo-title-wrap {
    position: relative;
    min-width: 0;
    flex: 1 1 auto;
    padding-top: 2px;
    padding-right: 1.65em;
}
.home-logo-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
}
.home-logo-title:hover,
.home-logo-title:focus-visible {
    text-decoration: none;
    opacity: 0.85;
}
.home-logo-udn {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: #8a8587;
    text-decoration: none;
}
.home-logo-udn:hover {
    color: #524345;
    text-decoration: underline;
}
.home-desktop-nav {
    margin-left: auto;
    margin-right: 24px;
    display: flex;
    align-items: center;
    gap: 29px;
}
.home-desktop-nav a {
    padding: 8px 2px 6px;
    border-bottom: 1px solid transparent;
    color: #686466;
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
}
.home-desktop-nav a:hover {
    border-bottom-color: #FB6C8A;
    color: #D85A78;
}
.home-desktop-nav a.active {
    border-bottom-color: #FB6C8A;
    color: #B74360;
}
.home-header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.home-login-text {
    display: inline;
    font-weight: 700;
}
/* 來源 brand-system.css：`.login-text, .login-entry { font-size: 15px !important }` */
.home-login-text,
.home-login-entry {
    font-size: 15px !important;
}

.home-live-area {
    padding: 0 24px;
    overflow: hidden;
    border-bottom: 1px solid #F4D6DE;
    background: linear-gradient(90deg, #FFF1F4 0%, #FFE8EE 52%, #FFF4F6 100%);
}
.home-live-bar {
    width: 100%;
    max-width: 1180px;
    min-height: 45px;
    margin: auto;
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 14px;
}
.home-live-bar > .home-live-avatars img,
.home-live-bar > .home-live-avatars > span,
.home-live-bar > .flex img,
.home-live-bar > .flex > span {
    width: 34px;
    height: 34px;
    margin-left: -7px;
    border: 2px solid #fff;
    border-radius: 50%;
    object-fit: cover;
}
.home-live-bar > .home-live-avatars img:first-child,
.home-live-bar > .flex img:first-child {
    margin-left: 0;
}
.home-live-bar > .home-live-avatars > span,
.home-live-bar > .flex > span {
    display: grid;
    place-items: center;
    background: #FB6C8A;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    box-sizing: border-box;
}
.home-live-avatars {
    display: flex;
    flex-shrink: 0;
}
.home-marquee {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}
.home-marquee-track strong {
    margin-right: 8px;
    color: #B74360;
    font-size: 16px;
}
.home-marquee-track span {
    margin-right: 100px;
    color: #806F73;
    font-size: 16px;
}

.home-main {
    width: 100%;
    max-width: 1180px;
    margin: auto;
    padding: 30px 24px 95px;
}
.home-task-section {
    margin-bottom: 18px;
    padding: 32px 34px 26px;
}
.home-task-heading {
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.home-task-heading-copy {
    min-width: 0;
}
.home-task-date {
    display: block;
    margin-bottom: 7px;
    color: #B74360;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.02em;
}
.home-task-donut {
    width: 94px;
    height: 94px;
    flex-basis: 94px;
}
.home-task-donut-center {
    gap: 4px;
}
.home-task-donut-center strong {
    color: #B74360;
    font-size: 29px;
    font-weight: 800;
}
.home-task-donut-count span {
    color: #75676B;
    font-size: 15px;
    font-weight: 700;
}
.home-task-goal-label {
    display: block;
    color: #75676B;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
.home-task-featured {
    position: relative;
    z-index: 1;
    grid-template-columns: 88px minmax(0, 1fr) auto;
    gap: 18px;
    padding: 20px;
}
/* 圖片尺寸要與上面 grid 第一欄同寬，一起放在這裡維護；
   不能寫在 memory-home.css（載入順序在後），否則會蓋掉下方 ≤600px 的 72px 覆寫，圖片溢出欄位壓到文字 */
.home-task-icon-photo {
    width: 88px;
    height: 88px;
}
.home-task-featured h3 {
    margin: 0 0 3px;
    font-size: 22px;
    line-height: 1.45;
    font-weight: 700;
}
.home-task-featured p {
    margin: 0;
    color: #75676B;
    font-size: 18px;
    line-height: 1.6;
}
/* 主卡的「15 分鐘」在 h3 裡，字重跟著標題走粗體；次卡的是獨立 span，維持一般字重 */
.home-task-time {
    color: #6F6669;
    font-size: 15px;
    white-space: nowrap;
}
.home-task-choice-label {
    position: relative;
    z-index: 1;
    margin: 18px 0 9px;
    color: #3A2D31;
    font-size: 18px;
    font-weight: 800;
}
.home-task-secondary {
    min-height: 76px;
}
.home-task-secondary h3 {
    margin: 0 0 2px;
    font-size: 17px;
    line-height: 1.4;
    font-weight: 700;
}
.home-task-secondary .home-task-action-btn {
    min-width: 102px;
    min-height: 42px;
    padding: 8px 14px;
}
.home-task-featured .home-task-action-btn {
    min-width: 108px;
    min-height: 46px;
    width: auto;
    grid-column: auto;
    border-radius: 10px;
    font-size: 18px;
}
.home-task-action-btn {
    font-size: 17px;
}

/* 來源 .screening-section 把 .section 的 padding-top 歸零，只留下方 38px */
.home-screening-section {
    padding: 0 0 38px;
}
.home-screening-section h2 {
    margin: 0 0 20px;
    font-size: 22px;
    line-height: 1.4;
    font-weight: 800;
}
.home-screening-card {
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(183, 67, 96, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.home-screening-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(183, 67, 96, 0.14);
}

.home-mobile-nav {
    display: none;
}
.home-nav-icon {
    width: 31px;
    height: 25px;
    display: grid;
    place-items: center;
}
.home-nav-icon .icon-line {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.udn-site-footer {
    width: 100%;
    margin-top: auto;
    flex-shrink: 0;
    border-top: 1px solid #F0D9E0;
    background: #FDF5F7;
    font-family: inherit;
}
.udn-site-footer .footer-note {
    width: 100%;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(240, 213, 221, 0.7);
    background: #FDF5F7;
}
.udn-site-footer .footer-note__wrapper {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 0;
    color: #3A2D31;
    font-size: 15px;
    line-height: 1.8;
}
.udn-site-footer a {
    color: #3A2D31;
    text-decoration: none;
    transition: color 0.2s ease;
    word-break: keep-all;
}
.udn-site-footer a:hover {
    color: #B74360;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.udn-site-footer .footer-note__link {
    position: relative;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
}
.udn-site-footer .footer-note__link:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: 1px;
    height: 0.85em;
    transform: translateY(-50%);
    background: #C4B1B7;
}
.udn-site-footer .footer-word {
    width: 100%;
    padding: 14px 16px;
    background: #B74360;
    color: #fff;
    text-align: center;
    font-size: 13px;
    letter-spacing: 0.04em;
}

@media (max-width: 899px) {
    .home-desktop-nav {
        display: none;
    }
    .home-header-actions {
        margin-left: auto;
    }
    .home-mobile-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        height: 68px;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        border-top: 1px solid #F0D5DD;
        background: rgba(255, 252, 253, 0.98);
        box-shadow: 0 -6px 20px rgba(183, 67, 96, 0.06);
        backdrop-filter: blur(8px);
    }
    /* 來源 ai.html：有置底導覽列時 toast 上移，避免被擋住。
       601–899 與 ≤600 兩段都是 bottom:80px。 */
    .toast {
        bottom: 80px;
    }
    .home-mobile-nav a {
        position: relative;
        min-height: 48px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        color: #7B7074;
        font-size: 16px;
        font-weight: 700;
        text-decoration: none;
    }
    .home-mobile-nav a.active {
        color: #B74360;
        font-weight: 800;
    }
    /* 來源把 active 的圖示換成亮粉，文字維持深粉，兩者不同色 */
    .home-mobile-nav a.active .home-nav-icon {
        color: #FB6C8A;
    }
    .home-mobile-nav a.active::before {
        content: "";
        position: absolute;
        top: 0;
        left: 50%;
        width: 34px;
        height: 4px;
        transform: translateX(-50%);
        border-radius: 0 0 8px 8px;
        background: #FB6C8A;
    }
    .udn-site-footer {
        padding-bottom: 68px;
    }
    .udn-site-footer .footer-note__link {
        padding: 0 8px;
    }
}

@media (max-width: 600px) {
    .home-header-inner {
        height: 55px;
        padding: 0 14px;
    }
    .home-logo-title {
        font-size: 22px;
    }
    .home-header-actions {
        gap: 4px;
    }
    .home-login-text {
        display: none;
    }
    .home-live-area {
        padding: 0 11px;
    }
    .home-main {
        padding: 18px 15px 84px;
    }
    .home-task-section {
        padding: 20px 16px 16px;
        border-radius: 16px;
    }
    .home-task-heading {
        margin-bottom: 18px;
        gap: 12px;
        align-items: flex-start;
    }
    .home-task-date {
        font-size: 16px;
    }
    /* 圓環內「今日目標」4 字 nowrap。內圈直徑 = 外徑 − inset × 2 = 70px，
       字級要讓四個字小於內圈，才不會壓到環上或和「0/2」擠在一起 */
    .home-task-donut {
        width: 86px;
        height: 86px;
        flex-basis: 86px;
    }
    .home-task-donut::before {
        inset: 8px;
    }
    .home-task-donut-center strong {
        font-size: 22px;
    }
    .home-task-donut-count span {
        font-size: 13px;
    }
    .home-task-goal-label {
        font-size: 13px;
    }
    .home-task-featured {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 13px;
        padding: 16px;
        border-radius: 14px;
    }
    .home-task-icon-photo {
        width: 72px;
        height: 72px;
    }
    .home-task-featured h3 {
        font-size: 20px;
    }
    .home-task-featured p,
    .home-task-time,
    .home-task-action-btn {
        font-size: 16px;
    }
    /* 主卡按鈕字級不跟著降：來源 .task-featured .task-action-button 的 18px 優先權高於上面那條 */
    .home-task-featured .home-task-action-btn {
        grid-column: 1 / -1;
        width: 100%;
        margin-top: 1px;
    }
    .home-task-choice-label {
        margin: 17px 0 8px;
        font-size: 16px;
    }
    .home-task-secondary-grid {
        border-radius: 13px;
    }
    .home-task-secondary {
        grid-template-columns: 44px minmax(0, 1fr) auto;
        min-height: 78px;
        padding: 13px 12px;
        gap: 10px;
    }
    .home-task-icon {
        width: 44px;
        height: 44px;
    }
    .home-task-secondary h3,
    .home-task-secondary .home-task-time,
    .home-task-secondary .home-task-action-btn {
        font-size: 16px;
    }
    .home-task-secondary .home-task-action-btn {
        min-width: 100px;
        padding: 8px 10px;
    }
    .home-screening-section {
        padding: 0 0 24px;
    }
    .home-screening-section h2 {
        font-size: 22px;
