/* ==============================================
   푸쉬업 챌린지 — Airy Premium (Toss Blue)
   라이트 기본 + 다크(:root[data-theme="dark"])
   ============================================== */
:root {
    /* shadcn/ui 팔레트 (라이트) — 중성 회색 + primary=토스 블루 */
    --bg: hsl(0 0% 100%);
    --surface: hsl(0 0% 100%);
    --surface-2: hsl(240 4.8% 95.9%);
    --elevated: hsl(240 4.8% 95.9%);
    --line: hsl(240 5.9% 90%);
    --line-strong: hsl(240 5.9% 86%);

    --ink: hsl(240 10% 3.9%);
    --text: hsl(240 6% 25%);
    --muted: hsl(240 3.8% 46.1%);
    --faint: hsl(240 4% 64%);

    /* primary (토스 블루) */
    --accent: hsl(215 92% 58%);
    --accent-2: hsl(215 92% 58%);
    --accent-strong: hsl(215 90% 50%);
    --accent-ink: hsl(215 90% 48%);
    --accent-dim: hsl(215 92% 58% / 0.10);
    --accent-line: hsl(215 92% 58% / 0.40);
    --on-accent: hsl(0 0% 100%);
    --accent-grad: linear-gradient(0deg, var(--accent), var(--accent));
    --ring: hsl(215 92% 58%);

    --streak: hsl(25 95% 53%);
    --streak-dim: hsl(25 95% 53% / 0.12);
    --streak-grad: linear-gradient(0deg, var(--streak-dim), var(--streak-dim));
    --danger: hsl(0 72% 51%);

    /* 반경 (shadcn --radius: 0.5rem) */
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-xl: 14px;

    /* 그림자 (shadcn — 절제된 톤) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-accent: var(--shadow-sm);
    --glow: var(--shadow-sm);
    --accent-glow: none;
    --text-glow: none;
    --hero-glow: transparent;
    --frame-tint: none;
    --desktop-bg: hsl(240 5% 96%);

    /* 하위 호환 별칭 (HTML 인라인 var(--accent-color)) */
    --accent-color: var(--danger);
    --primary-color: var(--accent);
    --text-color: var(--text);
    --light-gray-color: var(--muted);
    --background-color: var(--bg);
    --container-bg-color: var(--surface);
}

:root[data-theme="dark"] {
    /* shadcn/ui 팔레트 (다크) */
    --bg: hsl(240 10% 3.9%);
    --surface: hsl(240 10% 3.9%);
    --surface-2: hsl(240 3.7% 15.9%);
    --elevated: hsl(240 3.7% 15.9%);
    --line: hsl(240 3.7% 15.9%);
    --line-strong: hsl(240 3.7% 22%);

    --ink: hsl(0 0% 98%);
    --text: hsl(240 5% 84%);
    --muted: hsl(240 5% 64.9%);
    --faint: hsl(240 5% 48%);

    --accent: hsl(215 90% 60%);
    --accent-2: hsl(215 90% 60%);
    --accent-strong: hsl(215 90% 66%);
    --accent-ink: hsl(215 90% 68%);
    --accent-dim: hsl(215 90% 60% / 0.16);
    --accent-line: hsl(215 90% 60% / 0.38);
    --on-accent: hsl(0 0% 100%);
    --accent-grad: linear-gradient(0deg, var(--accent), var(--accent));
    --ring: hsl(215 90% 60%);

    --streak: hsl(25 95% 60%);
    --streak-dim: hsl(25 95% 53% / 0.16);
    --streak-grad: linear-gradient(0deg, var(--streak-dim), var(--streak-dim));
    --danger: hsl(0 72% 56%);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.6);
    --shadow-accent: var(--shadow-sm);
    --glow: var(--shadow-sm);
    --accent-glow: none;
    --text-glow: none;
    --hero-glow: transparent;
    --frame-tint: none;
    --desktop-bg: hsl(240 10% 2%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color 0.3s ease;
}

/* ==============================================
   프레임
   ============================================== */
.mobile-frame {
    width: 100%;
    height: 100%;
    background-image: var(--frame-tint);
    background-color: var(--bg);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

@media screen and (min-width: 769px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
        position: static;
        height: 100vh;
        overflow: auto;
        background:
            radial-gradient(900px 500px at 50% -5%, var(--accent-dim), transparent 60%),
            var(--desktop-bg);
    }

    .mobile-frame {
        width: 400px;
        height: 860px;
        border-radius: 42px;
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--line-strong);
    }
}

/* ==============================================
   헤더
   ============================================== */
header {
    flex-shrink: 0;
    background-color: transparent;
    padding: calc(env(safe-area-inset-top) + 18px) 24px 14px;
    z-index: 10;
}

h1 {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 0;
}

h1::before {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent-grad);
    box-shadow: 0 0 14px var(--accent);
}

/* ==============================================
   페이지
   ============================================== */
.page-container {
    flex-grow: 1;
    text-align: center;
    display: grid;
    position: relative;
    overflow: hidden;
}

.page {
    grid-area: 1 / 1;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
    padding: 20px 20px 40px;
    height: 100%;
    -ms-overflow-style: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.page::-webkit-scrollbar {
    display: none;
}

.page.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.page-title {
    font-size: 1.55rem;
    margin-bottom: 22px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--ink);
    text-align: left;
}

/* ==============================================
   운동 디스플레이
   ============================================== */
#workoutDisplay {
    padding-top: 12px;
}

.counter-display {
    position: relative;
    z-index: 0;
    font-size: 6.5rem;
    font-weight: 800;
    line-height: 1;
    margin: 36px 0 8px;
    color: var(--accent-ink);
    letter-spacing: -0.06em;
    font-variant-numeric: tabular-nums;
    text-shadow: var(--text-glow);
}

.counter-display::before {
    content: '';
    position: absolute;
    z-index: -1;
    width: 300px;
    height: 300px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--hero-glow);
    border-radius: 50%;
    pointer-events: none;
}

.timer-display {
    font-size: 1.35rem;
    margin: 0 0 16px;
    color: var(--muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* ==============================================
   버튼
   ============================================== */
.buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: nowrap;
    margin: 30px 0;
}

button {
    border: none;
    color: var(--ink);
    padding: 15px 20px;
    border-radius: var(--r-md);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
    flex-shrink: 1;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button:active {
    opacity: 0.9;
}

button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ring);
}

.start-workout-btn,
.end-session-btn {
    background-image: var(--accent-grad);
    color: var(--on-accent);
    box-shadow: var(--shadow-sm);
}

@media (hover: hover) {
    .start-workout-btn:hover,
    .end-session-btn:hover {
        opacity: 0.9;
    }
}

#stopTimer {
    background-color: var(--elevated);
    color: var(--ink);
}

.reset-btn {
    background-color: transparent;
    color: var(--muted);
    border: 1px solid var(--line-strong);
}

/* ==============================================
   운동 상태 / 통계 박스
   ============================================== */
.workout-status, .stats {
    margin: 22px auto;
    padding: 24px;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    text-align: left;
    width: 100%;
    max-width: 440px;
}

h3 {
    font-size: 1.05rem;
    margin-bottom: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0;
}

.stat-item span:first-child {
    font-weight: 500;
    color: var(--muted);
}

.stat-item span:last-child {
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.workout-status {
    text-align: center;
}

.current-phase {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 10px;
    color: var(--text);
    transition: color 0.15s ease;
}

.current-phase.down {
    color: var(--muted);
}

.current-phase.up {
    color: var(--accent-ink);
    text-shadow: var(--text-glow);
}

.current-phase.rest {
    color: var(--streak);
}

.progress-info {
    font-size: 1.05rem;
    color: var(--muted);
    line-height: 1.7;
}

.progress-info div span {
    color: var(--ink);
    font-weight: 700;
}

/* ==============================================
   모달
   ============================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: overlay-in 0.2s ease;
}

@keyframes overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--surface);
    padding: 28px;
    border-radius: var(--r-xl);
    width: 90%;
    max-width: 380px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
    margin: 20px;
    animation: modal-in 0.28s cubic-bezier(0.2, 0.9, 0.25, 1);
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(18px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content h2 {
    color: var(--ink);
    margin-bottom: 14px;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.modal-content p {
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.6;
}

.modal-hint {
    color: var(--muted) !important;
    font-size: 0.85rem !important;
    text-align: left !important;
    margin-bottom: 16px !important;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button {
    flex: 1;
}

#confirmDeleteBtn {
    color: #fff;
}

/* ==============================================
   결과 테이블 (편집 가능)
   ============================================== */
#resultsTable {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

#resultsTable th, #resultsTable td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

#resultsTable th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
}

#resultsTable td:first-child {
    font-weight: 700;
    color: var(--ink);
    width: 30%;
}

.result-reps-input {
    width: 100%;
    max-width: 120px;
    background-color: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.result-reps-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

#closeModalBtn {
    width: 100%;
    background-image: var(--accent-grad);
    color: var(--on-accent);
    box-shadow: var(--shadow-accent);
}

/* ==============================================
   캘린더
   ============================================== */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 8px 10px;
    box-shadow: var(--shadow-sm);
}

.calendar-header button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--muted);
    padding: 6px 14px;
    border-radius: 10px;
}

#currentMonth {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--ink);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 16px 12px;
    box-shadow: var(--shadow-md);
}

.calendar-day, .calendar-date {
    text-align: center;
    font-size: 0.9rem;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-day {
    font-weight: 700;
    color: var(--faint);
    font-size: 0.76rem;
    aspect-ratio: auto;
    padding-bottom: 6px;
}

.calendar-date {
    cursor: pointer;
    position: relative;
    border-radius: 50%;
    font-weight: 600;
    color: var(--text);
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.calendar-date:active {
    transform: scale(0.9);
}

.calendar-date.other-month {
    color: transparent;
    pointer-events: none;
}

.calendar-date.has-record::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: var(--accent);
}

.calendar-date.selected {
    background-image: var(--accent-grad);
    color: var(--on-accent);
    box-shadow: var(--shadow-accent);
}

.calendar-date.selected.has-record::after {
    background-color: var(--on-accent);
}

#recordDetails {
    margin-top: 14px;
    padding: 20px;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    min-height: 100px;
    text-align: left;
    box-shadow: var(--shadow-md);
}

#recordDetails h4 {
    font-size: 0.95rem;
    color: var(--accent-ink);
    margin-bottom: 10px;
    font-weight: 700;
}

#recordDetails div {
    color: var(--text);
    padding: 5px 0;
    font-variant-numeric: tabular-nums;
}

.delete-record-btn {
    display: block;
    width: fit-content;
    margin-left: auto;
    margin-top: 16px;
    background-color: var(--surface-2);
    color: var(--danger);
    border: 1px solid var(--line);
    padding: 9px 14px;
    border-radius: var(--r-sm);
    font-size: 0.8rem;
}

/* ==============================================
   하단 네비게이션
   ============================================== */
.bottom-nav {
    flex-shrink: 0;
    display: flex;
    background-color: var(--surface);
    border-top: 1px solid var(--line);
    z-index: 10;
    padding: 8px 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.nav-btn {
    flex: 1;
    padding: 8px 0 7px;
    background: none;
    border: none;
    color: var(--faint);
    font-weight: 600;
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

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

.nav-btn.active {
    color: var(--accent-ink);
    font-weight: 700;
}

/* ==============================================
   코스 카드
   ============================================== */
.course-card {
    position: relative;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px 44px 20px 20px;
    margin-bottom: 12px;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.16s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.course-card::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 24px;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--faint);
    border-bottom: 2px solid var(--faint);
    transform: rotate(-45deg);
    transition: border-color 0.2s ease;
}

.course-card:active {
    transform: scale(0.99);
}

@media (hover: hover) {
    .course-card:hover {
        border-color: var(--accent-line);
        background-color: var(--surface-2);
    }
    .course-card:hover::after {
        border-color: var(--accent);
    }
}

.course-card h3 {
    margin-bottom: 6px;
    font-size: 1.14rem;
}

.course-card p {
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.5;
}

/* ==============================================
   주차별 타임라인
   ============================================== */
.week-container {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-left: 20px;
    position: relative;
}

.week-timeline {
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: -20px;
    width: 2px;
    background-color: var(--line-strong);
}

.week-container:last-child .week-timeline {
    display: none;
}

.week-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--bg);
    border: 3px solid var(--accent);
    flex-shrink: 0;
    margin-right: 16px;
    z-index: 1;
    box-shadow: 0 0 0 4px var(--accent-dim);
}

.week-content {
    flex-grow: 1;
}

.week-title {
    font-weight: 700;
    text-align: left;
    margin-bottom: 12px;
    color: var(--ink);
}

.day-buttons {
    display: flex;
    gap: 8px;
}

.day-btn {
    flex: 1;
    padding: 15px 8px;
    border-radius: var(--r-md);
    background-color: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.12s ease, background-color 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.day-btn:active {
    transform: scale(0.96);
}

.day-btn.final-test {
    background-image: var(--accent-grad);
    color: var(--on-accent);
    border-color: transparent;
    flex-grow: 2;
    box-shadow: var(--shadow-accent);
}

.day-btn.done {
    background-color: var(--accent-dim);
    border-color: var(--accent-line);
    color: var(--accent-ink);
}

.day-btn.final-test.done {
    background-image: linear-gradient(135deg, var(--accent-strong), var(--accent));
    color: var(--on-accent);
}

/* ==============================================
   운동 전 모달
   ============================================== */
#preWorkoutModal .modal-content {
    text-align: left;
}

#workoutSummary {
    margin-bottom: 4px;
    background-color: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 18px;
}

#workoutSummary h3 {
    margin-bottom: 10px;
}

#workoutGoal div {
    color: var(--text);
    padding: 3px 0;
}

#workoutSummary strong {
    color: var(--accent-ink);
    font-weight: 800;
}

#workoutSummary p {
    color: var(--muted);
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    line-height: 1.5;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 0;
}

.setting-row label {
    font-weight: 600;
    color: var(--text);
}

.setting-row input {
    background-color: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    padding: 11px 12px;
    color: var(--ink);
    font-size: 1rem;
    width: 88px;
    text-align: center;
    font-weight: 700;
}

.setting-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

#preWorkoutStartBtn {
    width: 100%;
    margin-top: 10px;
}

/* ==============================================
   자유 코스 설정 (중앙 정렬)
   ============================================== */
#counterPageTitle {
    text-align: center;
}

#freeCourseSetup {
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px;
    margin: 0 auto 24px;
    max-width: 440px;
    box-shadow: var(--shadow-md);
}

.set-list-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 0 10px;
}

.set-list-header span:first-child {
    flex-basis: 20%;
    text-align: left;
}

.set-list-header span:last-child {
    flex-basis: 80%;
    text-align: center;
}

.set-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.set-number {
    font-weight: 800;
    color: var(--accent-ink);
    margin-right: 10px;
    flex-basis: 20%;
    text-align: left;
    padding-left: 10px;
}

.set-reps-input {
    flex-basis: 80%;
    padding: 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    font-size: 1rem;
    text-align: center;
    font-weight: 700;
    width: 100%;
    background-color: var(--surface-2);
    color: var(--ink);
}

.set-reps-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.set-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
}

.set-controls button {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: var(--r-sm);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#addSetBtn {
    color: var(--accent-ink);
}

#removeSetBtn {
    color: var(--muted);
}

/* ==============================================
   홈 / 통계 요약 카드
   ============================================== */
.home-summary, .stats-summary {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.summary-card {
    flex: 1;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 18px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-md);
}

.summary-card.streak {
    background-image: var(--streak-grad);
    border-color: rgba(255, 122, 61, 0.26);
}

.summary-value {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.summary-card.streak .summary-value {
    color: var(--streak);
}

.summary-label {
    font-size: 0.74rem;
    color: var(--muted);
    font-weight: 600;
}

/* ==============================================
   코스 진행률 바
   ============================================== */
.course-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.course-progress-bar {
    flex-grow: 1;
    height: 8px;
    background-color: var(--surface-2);
    border-radius: 99px;
    overflow: hidden;
}

.course-progress-fill {
    height: 100%;
    background-image: var(--accent-grad);
    border-radius: 99px;
    box-shadow: var(--accent-glow);
    transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.course-progress-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ==============================================
   막대그래프
   ============================================== */
.chart-section {
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px 18px 16px;
    margin-bottom: 14px;
    text-align: left;
    box-shadow: var(--shadow-md);
}

.chart-section h3 {
    margin-bottom: 20px;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    height: 170px;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.bar-value {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text);
    height: 16px;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.bar-track {
    flex-grow: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.bar {
    width: 62%;
    max-width: 30px;
    background-image: linear-gradient(to top, var(--accent) 0%, var(--accent-2) 100%);
    border-radius: 8px 8px 4px 4px;
    min-height: 0;
    box-shadow: var(--accent-glow);
    transition: height 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bar-label {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 600;
    margin-top: 8px;
    white-space: nowrap;
}

/* ==============================================
   설정 화면
   ============================================== */
.settings-group {
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 4px 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
}

.settings-group:has(.danger-btn) {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    margin-top: 6px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 0;
    border-bottom: 1px solid var(--line);
}

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

.settings-label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
}

.settings-title {
    font-weight: 700;
    color: var(--ink);
    font-size: 0.98rem;
}

.settings-desc {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.4;
}

.settings-row input[type="number"] {
    background-color: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    color: var(--ink);
    font-size: 1rem;
    width: 78px;
    text-align: center;
    font-weight: 700;
    flex-shrink: 0;
}

.settings-row input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* 토글 스위치 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-track {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background-color: var(--elevated);
    border: 1px solid var(--line-strong);
    border-radius: 99px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

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

.switch input:checked + .switch-track {
    background-image: var(--accent-grad);
    border-color: transparent;
}

.switch input:checked + .switch-track::before {
    transform: translateX(20px);
}

.danger-btn {
    width: 100%;
    background-color: transparent;
    color: var(--danger);
    border: 1px solid rgba(224, 73, 47, 0.4);
}

@media (hover: hover) {
    .danger-btn:hover {
        background-color: rgba(224, 73, 47, 0.08);
    }
}

/* ==============================================
   직접 카운트 모드 — 세트 개수 입력
   ============================================== */
#manualRepEntry {
    margin-top: 18px;
    text-align: center;
}

#manualRepEntry label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--ink);
    font-size: 1rem;
}

.manual-rep-input-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

#manualRepInput {
    width: 90px;
    padding: 12px;
    font-size: 1.3rem;
    font-weight: 800;
    text-align: center;
    color: var(--ink);
    background: var(--surface);
    border: 2px solid var(--accent-line);
    border-radius: var(--radius);
}

#manualRepConfirmBtn {
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}
