/* ==========================================================
   认知记忆学习 · 适老化样式
   大字体 / 大按钮 / 高对比度 / 柔和蓝底
   ========================================================== */
:root {
    --blue: #4a90d9;
    --blue-dark: #2f6fb0;
    --blue-light: #a8cdf0;
    --orange: #f2865a;
    --orange-dark: #e06b3d;
    --ink: #274b70;
    --ink-soft: #5c7c9c;
    --card: #ffffff;
    --bg-top: #cfe6f8;
    --bg-bottom: #eaf5fd;
    --radius: 20px;
    --shadow: 0 8px 24px rgba(47, 111, 176, 0.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    color: var(--ink);
    background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 55%, #f4fafe 100%);
    background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- 顶部蓝色导航 ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    height: 58px; padding: 0 14px;
    background: var(--blue); color: #fff;
    box-shadow: 0 2px 8px rgba(47, 111, 176, 0.25);
}
.topbar-back { font-size: 40px; line-height: 1; width: 44px; text-align: center; }
.topbar-title { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.topbar-home { font-size: 26px; width: 44px; text-align: center; opacity: 0.9; }

/* ---------- 页面主体 ---------- */
.page { max-width: 720px; margin: 0 auto; padding: 16px 16px 40px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.toolbar-title { font-size: 22px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.toolbar-right { min-width: 92px; display: flex; justify-content: flex-end; }

.sub-info { text-align: center; color: var(--ink-soft); font-size: 17px; margin: 6px 0 12px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 54px; padding: 0 22px;
    border: none; border-radius: 999px;
    font-size: 19px; font-weight: 700; color: #fff;
    cursor: pointer; transition: transform .12s, filter .12s;
    box-shadow: 0 4px 12px rgba(47, 111, 176, 0.18);
}
.btn:active { transform: scale(0.97); filter: brightness(0.95); }
.btn-primary { background: linear-gradient(135deg, #f79a6a, var(--orange)); }
.btn-secondary { background: linear-gradient(135deg, #74aee4, var(--blue)); }
.btn-green { background: linear-gradient(135deg, #6fcb9f, #42ac78); }
.btn-sm { min-height: 42px; padding: 0 16px; font-size: 16px; border-radius: 999px; }
.btn-lg { min-height: 64px; font-size: 22px; padding: 0 30px; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; gap: 14px; margin-top: 18px; }
.btn-row .btn { flex: 1; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.sound-toggle {
    min-height: 40px; padding: 0 14px; border: 1px solid var(--blue-light);
    border-radius: 999px; background: #fff; color: var(--blue-dark);
    font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.sound-toggle.muted { opacity: 0.6; }

.level-pill {
    display: inline-block; padding: 8px 16px; border-radius: 999px;
    background: #fff; color: var(--blue-dark); font-size: 17px; font-weight: 700;
    box-shadow: 0 3px 10px rgba(47, 111, 176, 0.12); white-space: nowrap;
}

/* ---------- 首页 ---------- */
.banner {
    margin: 6px 0 16px; padding: 16px 12px 12px;
    text-align: center; border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow);
}
.banner-title { font-size: 24px; font-weight: 700; color: var(--ink); }
.banner-title .accent { color: var(--orange-dark); }
.banner-tip { font-size: 16px; color: var(--ink-soft); margin-top: 6px; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.game-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 148px; padding: 14px 8px;
    border-radius: var(--radius); background: var(--card);
    box-shadow: var(--shadow); border: 2px solid rgba(168, 205, 240, 0.55);
    transition: transform .12s;
}
.game-card:active { transform: scale(0.97); }
.game-card .icon {
    width: 64px; height: 64px; margin-bottom: 10px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: #eef6fd; font-size: 38px; line-height: 1;
}
.game-card .label { font-size: 20px; font-weight: 700; color: var(--ink); }

.home-stats {
    margin-top: 18px; padding: 14px; text-align: center;
    border-radius: var(--radius); background: rgba(255,255,255,0.65);
    font-size: 16px; color: var(--ink-soft);
}
.home-stats strong { color: var(--orange-dark); font-size: 20px; }

/* ---------- 通用游戏卡片 ---------- */
.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px;
}
.instruction {
    display: inline-block; margin: 18px auto; padding: 12px 26px;
    border-radius: 14px; background: linear-gradient(135deg, #f79a7a, #ef7a62);
    color: #fff; font-size: 23px; font-weight: 700; text-align: center;
    box-shadow: 0 5px 14px rgba(239, 122, 98, 0.28);
}
.instruction-wrap { text-align: center; }
.question { font-size: 28px; font-weight: 700; text-align: center; margin: 10px 0 18px; }
.hint { font-size: 17px; color: var(--ink-soft); text-align: center; margin: 8px 0; }

/* ---------- 选择题 ---------- */
.choices { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 20px; }
.choice {
    flex: 1 1 28%; min-width: 90px; min-height: 92px;
    border: 2px solid var(--blue-light); border-radius: 18px;
    background: #fff; color: var(--ink); font-size: 34px; font-weight: 700;
    cursor: pointer; box-shadow: var(--shadow); transition: transform .12s;
}
.choice:active { transform: scale(0.96); }
.choice.correct { background: #e3f7ec; border-color: #4cb783; color: #26825a; }
.choice.wrong { background: #fdeaea; border-color: #ec8b8b; color: #c94d4d; }
.choice.text-choice { font-size: 25px; min-height: 80px; }

/* ---------- 视力追踪 ---------- */
.board {
    position: relative; width: 100%; min-height: 400px;
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden; margin-top: 6px;
}
.ball {
    position: absolute; width: 62px; height: 62px; border-radius: 50%;
    background: var(--blue); box-shadow: 0 6px 14px rgba(47, 111, 176, 0.28);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 32px; cursor: pointer;
    transition: left .65s ease-in-out, top .65s ease-in-out;
    user-select: none;
}
.ball .star { display: none; }
.ball.starred .star { display: block; }
.ball.picked { outline: 5px solid var(--orange); outline-offset: 3px; }

/* ---------- 数几何颜色 ---------- */
.shape-board { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 14px; padding: 20px 10px; }
.shape { width: 62px; height: 62px; flex: none; }
.shape.circle { border-radius: 50%; }
.shape.rect { width: 72px; height: 46px; border-radius: 4px; }
.shape.square { border-radius: 6px; }
.shape.triangle { clip-path: polygon(50% 4%, 98% 96%, 2% 96%); }
.shape.diamond { transform: rotate(45deg) scale(0.78); border-radius: 6px; }

/* ---------- 舒尔特方格 ---------- */
.grid-box { display: grid; gap: 10px; margin: 14px auto; max-width: 440px; }
.grid-cell {
    aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
    border-radius: 16px; background: #fff; border: 2px solid var(--blue-light);
    box-shadow: var(--shadow); font-size: 36px; font-weight: 700;
    color: var(--ink); cursor: pointer; transition: transform .1s;
}
.grid-cell:active { transform: scale(0.95); }
.grid-cell.done { background: #e3f7ec; border-color: #4cb783; color: #26825a; }
.grid-cell.wrong { background: #fdeaea; border-color: #ec8b8b; }

/* ---------- 对对碰 ---------- */
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 520px; margin: 16px auto; }
.memory-card {
    aspect-ratio: 1 / 1; border-radius: 14px; border: 2px solid var(--blue-light);
    background: var(--blue); color: #fff; font-size: 34px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: var(--shadow); user-select: none;
}
.memory-card.open { background: #fff; }
.memory-card.matched { background: #e3f7ec; border-color: #4cb783; }

/* ---------- 数字顺序记忆 ---------- */
.sequence {
    min-height: 100px; display: flex; align-items: center; justify-content: center;
    flex-wrap: wrap; gap: 12px; font-size: 46px; font-weight: 700; letter-spacing: 8px;
}
.seq-option {
    padding: 14px 10px; font-size: 24px; letter-spacing: 4px;
    border: 2px solid var(--blue-light); border-radius: 16px;
    background: #fff; cursor: pointer; box-shadow: var(--shadow);
}
.seq-option.correct { background: #e3f7ec; border-color: #4cb783; }
.seq-option.wrong { background: #fdeaea; border-color: #ec8b8b; }

/* ---------- 看字体选颜色 ---------- */
.color-word { font-size: 68px; font-weight: 800; text-align: center; margin: 10px 0 26px; text-shadow: 0 2px 4px rgba(0,0,0,.08); }
.color-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.color-btn {
    min-height: 76px; border-radius: 16px; border: 3px solid #fff;
    font-size: 24px; font-weight: 700; color: #fff; cursor: pointer;
    box-shadow: var(--shadow);
}
.color-btn.correct { outline: 5px solid #4cb783; }
.color-btn.wrong { outline: 5px solid #ec8b8b; }

/* ---------- 打卡日历 ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 16px 0; }
.calendar-head { text-align: center; font-size: 15px; font-weight: 700; color: var(--ink-soft); }
.calendar-day {
    aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
    border-radius: 12px; background: #f2f7fb; font-size: 16px; color: var(--ink-soft);
}
.calendar-day.checked { background: var(--orange); color: #fff; font-weight: 700; }
.calendar-day.today { outline: 2px solid var(--blue); }
.stat-row { display: flex; gap: 12px; justify-content: center; margin: 12px 0 20px; }
.stat-box {
    flex: 1; padding: 14px 6px; border-radius: 16px; background: #eef6fd;
    text-align: center; box-shadow: var(--shadow);
}
.stat-box .num { display: block; font-size: 32px; font-weight: 800; color: var(--orange-dark); }
.stat-box .label { font-size: 15px; color: var(--ink-soft); }

/* ---------- 简易量表 ---------- */
.scale-question { font-size: 24px; font-weight: 700; text-align: center; margin: 16px 0; line-height: 1.5; }
.scale-options { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.scale-option {
    min-height: 62px; border-radius: 16px; border: 2px solid var(--blue-light);
    background: #fff; color: var(--ink); font-size: 20px; font-weight: 700; cursor: pointer;
}
.scale-option.selected { background: #e3f3ff; border-color: var(--blue); }
.result-box { text-align: center; padding: 20px 10px; }
.result-score { font-size: 56px; font-weight: 800; color: var(--orange-dark); }
.result-text { font-size: 22px; font-weight: 700; margin: 8px 0; }
.disclaimer { font-size: 14px; color: var(--ink-soft); line-height: 1.6; margin-top: 12px; }

/* ---------- 通用文字居中 ---------- */
.center { text-align: center; }
.mt20 { margin-top: 20px; }
.muted { color: var(--ink-soft); }

/* ---------- 结果弹层 ---------- */
.overlay {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(39, 75, 112, 0.45);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.overlay[hidden] { display: none; }
.dialog {
    width: 100%; max-width: 420px; padding: 28px 22px;
    border-radius: 24px; background: #fff; text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.dialog h2 { margin: 0 0 8px; font-size: 28px; color: var(--ink); }
.dialog p { margin: 8px 0; font-size: 19px; color: var(--ink-soft); }
.dialog .big-score { font-size: 52px; font-weight: 800; color: var(--orange-dark); }

/* ---------- 提示气泡 ---------- */
.toast {
    position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%);
    z-index: 80; padding: 12px 24px; border-radius: 999px;
    background: rgba(39, 75, 112, 0.92); color: #fff; font-size: 18px;
    box-shadow: 0 6px 18px rgba(0,0,0,.2);
    opacity: 0; pointer-events: none; transition: opacity .2s;
    max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; }

.site-footer { padding: 10px 12px 26px; text-align: center; font-size: 13px; color: #8ba8c2; }

@media (min-width: 560px) {
    .grid { gap: 18px; }
    .game-card { min-height: 166px; }
}
