/* =====================================================================
   七十有慶，揮汗開跑  —  活潑風格（藍 ‧ 橘 ‧ 紅）
   ===================================================================== */
:root {
    --mcu-blue: #1554c0;
    --mcu-blue-deep: #0b2f73;
    --mcu-blue-soft: #e8f0ff;
    --mcu-orange: #ff8a1f;
    --mcu-orange-deep: #e86a00;
    --mcu-orange-soft: #fff1e3;
    --mcu-red: #e8384f;
    --mcu-red-deep: #c21d35;
    --mcu-red-soft: #ffe9ec;
    --ink: #1c2540;
    --ink-soft: #5b6685;
    --line: #e3e8f3;
    --bg: #f4f7fe;
    --card: #ffffff;
    --gray: #a3acc2;
    --radius: 20px;
    --shadow: 0 10px 30px -12px rgba(21, 84, 192, .28);
    --shadow-sm: 0 4px 14px -6px rgba(28, 37, 64, .18);
    --grad-hero: linear-gradient(135deg, #1554c0 0%, #2a6df0 45%, #ff8a1f 100%);
    --grad-go: linear-gradient(135deg, #ff8a1f 0%, #e8384f 100%);
    --font-num: "Baloo 2", "Noto Sans TC", system-ui, sans-serif;
}

* { -webkit-tap-highlight-color: transparent; }

html, body { overflow-x: hidden; }

body {
    font-family: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 100% 0, rgba(255, 138, 31, .10) 0, transparent 38%),
        radial-gradient(circle at 0 30%, rgba(21, 84, 192, .08) 0, transparent 40%),
        var(--bg);
    min-height: 100vh;
}

a { color: var(--mcu-blue); }
.min-w-0 { min-width: 0; }
.num { font-family: var(--font-num); font-weight: 800; }

/* ---------- 測試模式橫幅 ---------- */
.fake-banner {
    background: repeating-linear-gradient(-45deg, #ffd23f 0 14px, #ffdf6e 14px 28px);
    color: #5a3b00;
    font-size: .85rem;
    font-weight: 700;
    text-align: center;
    padding: 6px 12px;
}

/* ---------- 頁首 ---------- */
.app-header {
    position: sticky; top: 0; z-index: 1020;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(160%) blur(10px);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--line);
}
.app-header::after { /* 三色跑道線 */
    content: ""; display: block; height: 4px;
    background: linear-gradient(90deg, var(--mcu-blue) 0 33.3%, var(--mcu-orange) 33.3% 66.6%, var(--mcu-red) 66.6% 100%);
}
.app-header .container { min-height: 60px; gap: 12px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-logo { height: 42px; width: auto; flex: 0 0 auto; }
.brand-badge {
    width: 42px; height: 42px; border-radius: 14px;
    display: grid; place-items: center;
    font-family: var(--font-num); font-weight: 800; font-size: 1.25rem; color: #fff;
    background: var(--grad-go);
    box-shadow: 0 6px 14px -6px rgba(232, 56, 79, .7);
    transform: rotate(-6deg);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 1.05rem; letter-spacing: .06em; }
.brand-text small { font-size: .78rem; color: var(--mcu-orange-deep); font-weight: 700; letter-spacing: .2em; }

.nav-links a {
    text-decoration: none; color: var(--ink-soft); font-weight: 700;
    padding: 10px 16px; border-radius: 999px; min-height: 44px;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background .15s, color .15s;
}
.nav-links a:hover { background: var(--mcu-blue-soft); color: var(--mcu-blue); }
.nav-links a.active { background: var(--mcu-blue); color: #fff; }

.user-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--mcu-orange-soft); color: var(--mcu-orange-deep);
    font-weight: 700; font-size: .9rem;
    padding: 6px 12px; border-radius: 999px;
    max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 主內容 ---------- */
.app-main { padding-top: 20px; padding-bottom: 110px; }
@media (min-width: 768px) { .app-main { padding-bottom: 48px; } }

.app-footer {
    text-align: center; color: var(--ink-soft); font-size: .8rem;
    padding: 0 16px 100px;
}
@media (min-width: 768px) { .app-footer { padding-bottom: 28px; } }

/* ---------- 手機底部導覽 ---------- */
.tabbar {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 1030;
    display: flex; justify-content: space-around;
    background: #fff; border-radius: 22px;
    box-shadow: 0 12px 30px -10px rgba(11, 47, 115, .45);
    padding: 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom) / 2);
}
.tabbar a {
    flex: 1; min-height: 52px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    text-decoration: none; color: var(--gray); font-size: .75rem; font-weight: 700;
    border-radius: 16px;
}
.tabbar a i { font-size: 1.3rem; }
.tabbar a.active { color: var(--mcu-blue); background: var(--mcu-blue-soft); }
.tabbar a.tab-out.active, .tabbar a.tab-out:active { color: var(--mcu-red); }

/* ---------- 按鈕 ---------- */
.btn { min-height: 44px; border-radius: 14px; font-weight: 700; }
.btn-go {
    color: #fff; border: 0;
    background: var(--grad-go);
    box-shadow: 0 8px 18px -8px rgba(232, 56, 79, .8);
    transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn-go:hover, .btn-go:focus { color: #fff; filter: brightness(1.05); transform: translateY(-1px); }
.btn-go:active { transform: translateY(1px) scale(.98); }
.btn-blue { color: #fff; background: var(--mcu-blue); border: 0; }
.btn-blue:hover, .btn-blue:focus { color: #fff; background: var(--mcu-blue-deep); }
.btn-ghost { color: var(--mcu-blue); background: var(--mcu-blue-soft); border: 0; }
.btn-ghost:hover { color: var(--mcu-blue-deep); background: #d9e6ff; }

/* ---------- 首頁 Hero ---------- */
.hero {
    position: relative; overflow: hidden;
    color: #fff; border-radius: 28px;
    background: var(--grad-hero);
    padding: 24px 22px 22px;
    box-shadow: var(--shadow);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { width: 220px; height: 220px; right: -60px; top: -80px; background: rgba(255, 255, 255, .14); }
.hero::after { width: 140px; height: 140px; right: 70px; bottom: -90px; background: rgba(232, 56, 79, .45); }
.hero-stripes {
    position: absolute; inset: auto -20px 18px auto; width: 160px; height: 46px; opacity: .25;
    background: repeating-linear-gradient(-60deg, #fff 0 8px, transparent 8px 18px);
    pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero-hello { font-size: .95rem; opacity: .9; font-weight: 500; }
.hero-name { font-size: 1.6rem; font-weight: 900; margin: 2px 0 14px; word-break: break-all; }
.hero-score { display: flex; align-items: flex-end; gap: 10px; }
.hero-score .big { font-family: var(--font-num); font-size: 3.6rem; line-height: .9; font-weight: 800; }
.hero-score .of { font-family: var(--font-num); font-size: 1.4rem; font-weight: 700; opacity: .85; padding-bottom: 6px; }
.hero-score .lbl { padding-bottom: 10px; font-weight: 700; }

.seg-bar { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin-top: 16px; }
.seg-bar span { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .28); }
.seg-bar span.on { background: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }
.seg-bar span.now { background: #ffd23f; animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.hero-today {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255, 255, 255, .18); border-radius: 999px;
    padding: 4px 12px; font-size: .82rem; font-weight: 700; margin-top: 14px;
}

/* ---------- 規則小卡 ---------- */
.rule-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; margin: 18px -2px 6px; scrollbar-width: none; }
.rule-strip::-webkit-scrollbar { display: none; }
.rule-chip {
    flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
    background: #fff; border-radius: 16px; padding: 10px 14px;
    box-shadow: var(--shadow-sm); font-size: .88rem; font-weight: 700; white-space: nowrap;
}
.rule-chip i { font-size: 1.15rem; }
.rule-chip.c-blue i { color: var(--mcu-blue); }
.rule-chip.c-orange i { color: var(--mcu-orange); }
.rule-chip.c-red i { color: var(--mcu-red); }

.section-title { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.15rem; margin: 18px 0 12px; }
.section-title::before { content: ""; width: 8px; height: 22px; border-radius: 4px; background: var(--grad-go); }

/* ---------- 週卡片 ---------- */
.week-card {
    position: relative; height: 100%;
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 16px 14px;
    display: flex; flex-direction: column; gap: 12px;
    border-top: 6px solid var(--gray);
    transition: transform .15s, box-shadow .15s;
}
.week-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.week-card-top { display: flex; align-items: center; gap: 12px; }
.week-no {
    flex: 0 0 auto; width: 56px; height: 56px; border-radius: 16px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #eef1f8; color: var(--ink-soft);
    font-family: var(--font-num); line-height: 1;
}
.week-no small { font-size: .62rem; font-weight: 700; letter-spacing: .12em; }
.week-no span { font-size: 1.6rem; font-weight: 800; }
.week-range { font-weight: 800; font-size: .98rem; }
.week-deadline { font-size: .8rem; color: var(--ink-soft); }
.status-pill {
    flex: 0 0 auto;
    font-size: .78rem; font-weight: 800; border-radius: 999px; padding: 5px 10px;
    background: #eef1f8; color: var(--ink-soft); white-space: nowrap;
}
.week-card-body { display: flex; align-items: center; justify-content: space-between; }
.dots { display: flex; gap: 8px; }
.dots i {
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center; font-style: normal; font-size: .9rem;
    border: 2px dashed #cfd6e6; color: transparent;
}
.dots i.on { border: 0; background: var(--grad-go); color: #fff; box-shadow: 0 4px 10px -4px rgba(232, 56, 79, .8); }
.dots i.on::before { content: "\2714"; font-weight: 900; }
.week-count { font-family: var(--font-num); font-weight: 800; font-size: 1.1rem; color: var(--ink-soft); }
.week-count b { font-size: 1.6rem; color: var(--ink); }
.week-hint { font-size: .85rem; color: var(--ink-soft); font-weight: 700; display: flex; align-items: center; gap: 6px; min-height: 44px; }
.week-card .btn { width: 100%; }

.now-ribbon {
    position: absolute; top: -6px; right: 16px;
    background: var(--mcu-orange); color: #fff;
    font-size: .7rem; font-weight: 900; letter-spacing: .1em;
    padding: 4px 10px 5px; border-radius: 0 0 10px 10px;
}

/* 狀態色 */
.st-open { border-top-color: var(--mcu-orange); }
.st-open .week-no { background: var(--mcu-orange-soft); color: var(--mcu-orange-deep); }
.st-open .status-pill { background: var(--mcu-orange); color: #fff; }

.st-grace { border-top-color: var(--mcu-red); }
.st-grace .week-no { background: var(--mcu-red-soft); color: var(--mcu-red-deep); }
.st-grace .status-pill { background: var(--mcu-red); color: #fff; animation: pulse 1.8s ease-in-out infinite; }

.st-done { border-top-color: var(--mcu-blue); background: linear-gradient(160deg, #fff 55%, var(--mcu-blue-soft) 100%); }
.st-done .week-no { background: var(--mcu-blue); color: #fff; }
.st-done .status-pill { background: var(--mcu-blue); color: #fff; }
.st-done .dots i.on { background: var(--mcu-blue); box-shadow: 0 4px 10px -4px rgba(21, 84, 192, .8); }
.st-done .week-hint { color: var(--mcu-blue); }

.st-wait { opacity: .78; }
.st-closed { opacity: .62; }
.st-closed .week-card-top, .st-closed .week-card-body { filter: grayscale(.6); }

/* ---------- 成功提示（含彩帶） ---------- */
.flash {
    position: relative; overflow: hidden;
    display: flex; align-items: center; gap: 14px;
    background: #fff; border-radius: 20px; padding: 16px 18px; margin-bottom: 16px;
    box-shadow: var(--shadow); border-left: 8px solid var(--mcu-orange);
    animation: pop .5s cubic-bezier(.2, 1.6, .4, 1);
}
.flash.done { border-left-color: var(--mcu-blue); }
.flash-icon {
    flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%;
    display: grid; place-items: center; color: #fff; font-size: 1.5rem;
    background: var(--grad-go);
}
.flash.done .flash-icon { background: var(--mcu-blue); }
.flash b { font-size: 1.05rem; }
.flash small { display: block; color: var(--ink-soft); }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti span {
    position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; opacity: 0;
    animation: fall 1.8s ease-in forwards;
}
@keyframes fall {
    0% { transform: translateY(0) rotate(0); opacity: 1; }
    100% { transform: translateY(120px) rotate(540deg); opacity: 0; }
}
@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- 一般卡片 / 表單 ---------- */
.panel {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 18px;
}
.back-link {
    display: inline-flex; align-items: center; gap: 4px; min-height: 44px;
    text-decoration: none; font-weight: 700; color: var(--ink-soft);
}
.back-link:hover { color: var(--mcu-blue); }

.upload-hero {
    position: relative; overflow: hidden;
    display: flex; align-items: center; gap: 14px;
    background: var(--grad-hero); color: #fff;
    border-radius: 24px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.upload-hero .week-no { width: 64px; height: 64px; background: rgba(255, 255, 255, .2); color: #fff; }
.upload-hero h1 { font-size: 1.25rem; font-weight: 900; margin: 0 0 4px; }
.upload-hero .meta { font-size: .85rem; opacity: .95; }
.upload-hero .hero-count { margin-left: auto; text-align: center; font-family: var(--font-num); }
.upload-hero .hero-count b { font-size: 2.2rem; line-height: 1; }
.upload-hero .hero-count span { font-size: 1rem; opacity: .85; }
@media (max-width: 420px) {
    .upload-hero { flex-wrap: wrap; }
    .upload-hero .hero-count { margin-left: 78px; text-align: left; }
}

.step { margin-bottom: 18px; }
.step-label { display: flex; align-items: center; gap: 10px; font-weight: 900; margin-bottom: 10px; }
.step-label .n {
    width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
    display: grid; place-items: center; font-family: var(--font-num); font-weight: 800; font-size: .95rem;
    color: #fff; background: var(--mcu-blue);
}
.step-label .n.orange { background: var(--mcu-orange); }
.step-label .n.red { background: var(--mcu-red); }
.step-label small { font-weight: 500; color: var(--ink-soft); }

.form-control, .form-select { min-height: 48px; border-radius: 14px; border: 2px solid var(--line); font-size: 1rem; }
.form-control:focus, .form-select:focus { border-color: var(--mcu-blue); box-shadow: 0 0 0 4px rgba(21, 84, 192, .15); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--mcu-red); }
.input-group-lg > .form-control { font-family: var(--font-num); font-weight: 800; font-size: 1.4rem; }
.input-group-text { border-radius: 14px; border: 2px solid var(--line); background: var(--mcu-blue-soft); color: var(--mcu-blue); font-weight: 800; min-width: 72px; justify-content: center; }
.field-msg { font-size: .85rem; margin-top: 6px; min-height: 1.2em; color: var(--ink-soft); }
.field-msg.err { color: var(--mcu-red); font-weight: 700; }

/* 日期快選 */
.day-chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 10px; }
.day-chip {
    border: 2px solid var(--line); background: #fff; border-radius: 14px;
    min-height: 58px; padding: 4px 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-weight: 800; color: var(--ink); line-height: 1.15;
    transition: transform .1s, background .15s, border-color .15s;
}
.day-chip small { font-size: .68rem; color: var(--ink-soft); font-weight: 700; }
.day-chip span { font-family: var(--font-num); font-size: 1rem; }
.day-chip:not(:disabled):active { transform: scale(.94); }
.day-chip.sel { border-color: var(--mcu-blue); background: var(--mcu-blue); color: #fff; }
.day-chip.sel small { color: rgba(255, 255, 255, .85); }
.day-chip.used { background: var(--mcu-orange-soft); border-color: transparent; color: var(--mcu-orange-deep); }
.day-chip.used small { color: var(--mcu-orange-deep); }
.day-chip:disabled { cursor: not-allowed; }
.day-chip.future { opacity: .4; }

/* 分類大按鈕 */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cat-btn {
    border: 2px solid var(--line); background: #fff; border-radius: 18px;
    min-height: 104px; padding: 10px 4px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: var(--ink); transition: transform .1s, box-shadow .15s, background .15s;
}
.cat-btn i { font-size: 1.9rem; }
.cat-btn b { font-size: .95rem; }
.cat-btn small { font-size: .74rem; color: var(--ink-soft); font-weight: 700; }
.cat-btn:active { transform: scale(.95); }
.cat-btn.cat-steps i { color: var(--mcu-blue); }
.cat-btn.cat-time i { color: var(--mcu-orange); }
.cat-btn.cat-dist i { color: var(--mcu-red); }
.cat-btn.sel { color: #fff; border-color: transparent; }
.cat-btn.sel i, .cat-btn.sel small { color: #fff; }
.cat-btn.cat-steps.sel { background: var(--mcu-blue); box-shadow: 0 10px 20px -10px var(--mcu-blue); }
.cat-btn.cat-time.sel { background: var(--mcu-orange); box-shadow: 0 10px 20px -10px var(--mcu-orange); }
.cat-btn.cat-dist.sel { background: var(--mcu-red); box-shadow: 0 10px 20px -10px var(--mcu-red); }

/* 照片 */
.photo-drop {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    min-height: 150px; border-radius: 20px; padding: 16px; text-align: center;
    border: 3px dashed #c7d3ee; background: #f8faff; color: var(--ink-soft); cursor: pointer;
    transition: border-color .15s, background .15s;
}
.photo-drop:hover { border-color: var(--mcu-blue); background: var(--mcu-blue-soft); }
.photo-drop i { font-size: 2.4rem; color: var(--mcu-blue); }
.photo-drop b { color: var(--ink); }
.photo-drop input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.photo-drop.has-photo { border-style: solid; border-color: var(--mcu-orange); background: #fff; }
.photo-preview { max-width: 100%; max-height: 280px; border-radius: 14px; object-fit: contain; }

.btn-submit { width: 100%; min-height: 58px; font-size: 1.15rem; border-radius: 18px; }

.alert-mcu {
    display: flex; gap: 10px; align-items: flex-start;
    border-radius: 16px; padding: 14px 16px; font-weight: 700; margin-bottom: 16px;
}
.alert-mcu i { font-size: 1.2rem; }
.alert-mcu.red { background: var(--mcu-red-soft); color: var(--mcu-red-deep); }
.alert-mcu.blue { background: var(--mcu-blue-soft); color: var(--mcu-blue-deep); }
.alert-mcu.orange { background: var(--mcu-orange-soft); color: #9a4600; }

.closed-box { text-align: center; padding: 34px 20px; }
.closed-box .ic {
    width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 12px;
    display: grid; place-items: center; font-size: 2.2rem; color: #fff; background: var(--grad-go);
}
.closed-box.done .ic { background: var(--mcu-blue); }

/* 上傳中遮罩 */
.uploading {
    position: fixed; inset: 0; z-index: 2000; display: none;
    align-items: center; justify-content: center; flex-direction: column; gap: 14px;
    background: rgba(11, 47, 115, .7); color: #fff; font-weight: 800;
}
.uploading.show { display: flex; }
.runner { font-size: 3rem; animation: run .5s ease-in-out infinite alternate; }
@keyframes run { from { transform: translateX(-14px) rotate(-6deg); } to { transform: translateX(14px) rotate(6deg); } }

/* ---------- 我的紀錄 ---------- */
.rec-week { margin-bottom: 18px; }
.rec-week-head {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border-radius: 18px 18px 0 0; padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}
.rec-week-head .week-no { width: 48px; height: 48px; }
.rec-week-head .t b { display: block; }
.rec-week-head .t small { color: var(--ink-soft); }
.rec-week-head .badge-x { margin-left: auto; }
.rec-week-body { background: #fff; border-radius: 0 0 18px 18px; box-shadow: var(--shadow-sm); padding: 6px 14px 10px; }
.rec-week.done .week-no { background: var(--mcu-blue); color: #fff; }
.rec-week.part .week-no { background: var(--mcu-orange-soft); color: var(--mcu-orange-deep); }

.badge-x { font-weight: 800; font-size: .8rem; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.badge-x.done { background: var(--mcu-blue); color: #fff; }
.badge-x.part { background: var(--mcu-orange-soft); color: var(--mcu-orange-deep); }
.badge-x.none { background: #eef1f8; color: var(--ink-soft); }

.rec-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.rec-item:last-child { border-bottom: 0; }
.thumb {
    flex: 0 0 auto; width: 72px; height: 72px; border-radius: 14px; overflow: hidden;
    background: #eef1f8; display: grid; place-items: center; border: 0; padding: 0;
    color: var(--ink-soft); text-decoration: none; font-size: .7rem; font-weight: 700; text-align: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb i { font-size: 1.4rem; display: block; }
.rec-info { min-width: 0; flex: 1; }
.rec-info .d { font-weight: 800; }
.rec-info .v { font-family: var(--font-num); font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.rec-info .v small { font-family: "Noto Sans TC", sans-serif; font-size: .8rem; color: var(--ink-soft); font-weight: 700; }
.rec-info .c { font-size: .76rem; color: var(--ink-soft); }
.cat-tag { display: inline-block; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-right: 4px; }
.cat-tag.cat-steps { background: var(--mcu-blue-soft); color: var(--mcu-blue); }
.cat-tag.cat-time { background: var(--mcu-orange-soft); color: var(--mcu-orange-deep); }
.cat-tag.cat-dist { background: var(--mcu-red-soft); color: var(--mcu-red-deep); }

.rec-table { margin: 0; }
.rec-table th { font-size: .8rem; color: var(--ink-soft); font-weight: 800; border-bottom-width: 2px; }
.rec-table td { vertical-align: middle; }
.rec-table .thumb { width: 56px; height: 56px; }
.empty-week { color: var(--ink-soft); font-size: .9rem; padding: 12px 0; }

.photo-modal .modal-content { border-radius: 22px; overflow: hidden; border: 0; }
.photo-modal img { width: 100%; max-height: 80vh; object-fit: contain; background: #111; }

/* ---------- 登入頁 ---------- */
.login-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 85% 12%, rgba(255, 138, 31, .55) 0, transparent 30%),
        radial-gradient(circle at 10% 90%, rgba(232, 56, 79, .55) 0, transparent 32%),
        linear-gradient(160deg, #0b2f73 0%, #1554c0 55%, #2a6df0 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 24px 16px;
}
.login-wrap { width: 100%; max-width: 440px; position: relative; }
.login-track { /* 跑道斜線裝飾 */
    position: fixed; left: -10%; right: -10%; bottom: 8%; height: 70px; opacity: .14; pointer-events: none;
    background: repeating-linear-gradient(-60deg, #fff 0 10px, transparent 10px 26px);
    transform: rotate(-8deg);
}
.login-brand { text-align: center; color: #fff; margin-bottom: 18px; }
.login-logo {
    display: inline-block; background: #fff; border-radius: 28px; padding: 14px 20px;
    box-shadow: 0 16px 30px -12px rgba(11, 47, 115, .7);
    animation: bob-logo 2.6s ease-in-out infinite;
}
.login-logo img { display: block; width: 150px; height: auto; }
@keyframes bob-logo { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.login-badge {
    display: inline-grid; place-items: center; width: 96px; height: 96px; border-radius: 30px;
    background: var(--grad-go); font-family: var(--font-num); font-weight: 800; font-size: 3rem; color: #fff;
    box-shadow: 0 16px 30px -12px rgba(232, 56, 79, .9);
    transform: rotate(-8deg); animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: rotate(-8deg) translateY(0); } 50% { transform: rotate(-4deg) translateY(-6px); } }
.login-brand h1 { font-weight: 900; font-size: 1.85rem; margin: 16px 0 4px; letter-spacing: .08em; }
.login-brand h1 em { font-style: normal; color: #ffb25e; }
.login-brand p { opacity: .9; margin: 0; font-weight: 500; }
.login-card {
    background: #fff; border-radius: 26px; padding: 24px 20px;
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
}
.login-card .form-label { font-weight: 800; }
.login-card .input-icon { position: relative; }
.login-card .input-icon i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gray); font-size: 1.15rem; }
.login-card .input-icon .form-control { padding-left: 42px; }
.login-note { font-size: .82rem; color: var(--ink-soft); background: var(--mcu-blue-soft); border-radius: 12px; padding: 10px 12px; }
.login-rules { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.login-rules span {
    background: rgba(255, 255, 255, .16); color: #fff; border-radius: 999px;
    padding: 6px 12px; font-size: .8rem; font-weight: 700;
}
.login-rules span b { color: #ffd23f; font-family: var(--font-num); }

/* ---------- 錯誤頁 ---------- */
.err-code {
    display: inline-block; font-family: ui-monospace, Consolas, monospace; font-size: 1.4rem; font-weight: 800;
    letter-spacing: .2em; background: var(--mcu-orange-soft); color: var(--mcu-orange-deep);
    padding: 8px 18px; border-radius: 14px; user-select: all;
}

/* ---------- 紀念證書 ---------- */
.cert-teaser {
    display: flex; align-items: center; gap: 12px; margin-top: 14px;
    background: #fff; border-radius: 18px; padding: 12px 14px; min-height: 64px;
    box-shadow: var(--shadow-sm); text-decoration: none; color: var(--ink);
    border-left: 6px solid #edbe3a;
}
.cert-teaser .ic {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
    display: grid; place-items: center; font-size: 1.3rem; color: #fff;
    background: linear-gradient(135deg, #f2c94c, #d4a017);
}
.cert-teaser .tx { flex: 1; min-width: 0; }
.cert-teaser .tx b { display: block; }
.cert-teaser .tx small { color: var(--ink-soft); font-weight: 700; }
.cert-teaser > .bi-chevron-right { color: var(--gray); }

.lv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 768px) { .lv-grid { grid-template-columns: repeat(4, 1fr); } }
.lv-card {
    --lv: #8c9aad; --lv-dark: #3e4b5c; --lv-light: #eef2f7;
    position: relative; text-align: center;
    background: #fff; border-radius: 20px; padding: 16px 12px 14px;
    box-shadow: var(--shadow-sm); border-top: 6px solid var(--lv);
}
.lv-bronze { --lv: #b8733a; --lv-dark: #6e3a12; --lv-light: #f7e4d0; }
.lv-silver { --lv: #8c9aad; --lv-dark: #3e4b5c; --lv-light: #eef2f7; }
.lv-gold { --lv: #d4a017; --lv-dark: #7a5600; --lv-light: #fff3c4; }
.lv-diamond { --lv: #8a3fd1; --lv-dark: #3d0e74; --lv-light: #f1e6ff; }
.lv-medal {
    width: 66px; height: 66px; margin: 0 auto 8px; border-radius: 50%;
    display: grid; place-items: center;
    background: radial-gradient(circle at 35% 30%, var(--lv-light), var(--lv) 75%);
    border: 4px solid var(--lv-dark); color: var(--lv-dark); font-weight: 900;
}
.lv-diamond .lv-medal { background: radial-gradient(circle at 35% 30%, #c9a2ff, #7b3fe0 55%, #3d7bff 100%); border-color: #f2c94c; color: #fff; font-size: .82rem; }
.lv-title { font-weight: 900; color: var(--lv-dark); font-size: .98rem; }
.lv-req { font-size: .8rem; color: var(--ink-soft); }
.lv-bar { height: 8px; border-radius: 6px; background: #eef1f8; overflow: hidden; margin: 10px 4px 6px; }
.lv-bar span { display: block; height: 100%; border-radius: 6px; background: var(--lv); }
.lv-state { font-size: .8rem; font-weight: 800; color: var(--ink-soft); }
.lv-card.on .lv-state { color: var(--lv-dark); }
.lv-card.off .lv-medal { filter: grayscale(.85); opacity: .55; }
.lv-card.off .lv-title { opacity: .7; }
.lv-top {
    position: absolute; top: -6px; right: 12px;
    background: var(--grad-go); color: #fff; font-size: .68rem; font-weight: 900;
    padding: 4px 8px 5px; border-radius: 0 0 10px 10px;
}
.cert-download { text-align: center; }
.cert-preview { width: 100%; height: auto; border-radius: 12px; box-shadow: var(--shadow); }
@media (min-width: 768px) { .cert-preview { width: 70%; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   管理後台
   ===================================================================== */
.nav-admin { color: var(--mcu-orange-deep) !important; }
.nav-admin.active { color: #fff !important; }

.admin-head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 4px; }
.admin-head h1 { font-size: 1.4rem; font-weight: 900; margin: 0; }
.admin-head h1 i { color: var(--mcu-blue); }
.admin-asof { color: var(--ink-soft); font-size: .85rem; font-weight: 700; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 992px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-tile {
    --c: var(--mcu-blue); --c-soft: var(--mcu-blue-soft);
    position: relative; overflow: hidden;
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 16px 16px 14px; border-top: 5px solid var(--c);
    min-width: 0;
}
.stat-tile.c-orange { --c: var(--mcu-orange); --c-soft: var(--mcu-orange-soft); }
.stat-tile.c-red { --c: var(--mcu-red); --c-soft: var(--mcu-red-soft); }
.stat-tile.c-green { --c: #1a9d6b; --c-soft: #e3f7ef; }
.stat-ic {
    position: absolute; right: 12px; top: 12px;
    width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center; font-size: 1.25rem;
    background: var(--c-soft); color: var(--c);
}
.stat-lbl { font-weight: 800; color: var(--ink-soft); font-size: .9rem; }
.stat-val {
    font-family: var(--font-num); font-weight: 800; color: var(--ink);
    font-size: clamp(1.5rem, 5.2vw, 2.1rem); line-height: 1.15; margin-top: 6px;
    overflow-wrap: anywhere;
}
.stat-val small { font-family: "Noto Sans TC", sans-serif; font-size: .85rem; font-weight: 700; color: var(--ink-soft); margin-left: 4px; }
.stat-sub { font-size: .78rem; color: var(--ink-soft); margin-top: 4px; }

.week-range-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.week-range-form > div { flex: 1 1 220px; min-width: 0; }
.week-range-form .tilde { font-weight: 900; color: var(--ink-soft); padding-bottom: 12px; }
.week-range-form .btn { min-height: 48px; }
@media (max-width: 575px) {
    .week-range-form .tilde { display: none; }
    .week-range-form .btn { width: 100%; }
}

.export-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.export-row > .min-w-0 { flex: 1 1 280px; }
@media (max-width: 575px) { .export-row .btn { width: 100%; } }

/* =====================================================================
   排行榜
   ===================================================================== */
.rank-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 992px) { .rank-grid { grid-template-columns: repeat(3, 1fr); } }

.rank-board {
    --c: var(--mcu-blue); --c-soft: var(--mcu-blue-soft);
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm);
    overflow: hidden; min-width: 0;
}
.rank-board.cat-time { --c: var(--mcu-orange); --c-soft: var(--mcu-orange-soft); }
.rank-board.cat-dist { --c: var(--mcu-red); --c-soft: var(--mcu-red-soft); }

.rank-head {
    display: flex; align-items: center; gap: 8px;
    background: var(--c); color: #fff; padding: 12px 16px;
}
.rank-head i { font-size: 1.3rem; }
.rank-head b { font-size: 1.05rem; }
.rank-head small { margin-left: auto; font-weight: 700; opacity: .85; }

.rank-empty { color: var(--ink-soft); padding: 18px 16px; text-align: center; font-weight: 700; }

.rank-list { list-style: none; margin: 0; padding: 6px 14px 10px; }
.rank-list li {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px dashed var(--line); min-width: 0;
}
.rank-list li:last-child { border-bottom: 0; }
.rank-list .medal {
    flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    font-family: var(--font-num); font-weight: 800; font-size: 1.1rem;
    background: #eef1f8; color: var(--ink-soft);
}
.rank-list .r1 .medal { background: linear-gradient(135deg, #ffd85a, #f5a700); color: #5a3b00; box-shadow: 0 6px 12px -6px #f5a700; }
.rank-list .r2 .medal { background: linear-gradient(135deg, #eef2f8, #b7c0d1); color: #3d465c; }
.rank-list .r3 .medal { background: linear-gradient(135deg, #f3c39a, #c97b3e); color: #4a2508; }
.rank-list .nm { flex: 1 1 auto; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .tot { flex: 0 0 auto; color: var(--c); white-space: nowrap; }
.rank-list .tot .num { font-size: 1.2rem; }
.rank-list .tot small { color: var(--ink-soft); font-weight: 700; }

@media (min-width: 992px) { .stat-grid.stat-grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 575px) { .stat-grid.stat-grid-3 { grid-template-columns: 1fr; } }
