/* 디지털 디톡스 타이머 - 명상/평화 테마 */
/* Primary: #00b894 (민트/그린) - 평화로운 다크 테마 */

/* === App Loader === */
.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #0a0a0a 0%, #1a2f1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.app-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loader-emoji {
    font-size: 48px;
    animation: loader-bounce 1s ease-in-out infinite;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00b894;
    border-radius: 50%;
    animation: loader-spin 0.8s linear infinite;
}

.loader-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    font-weight: 500;
}

@keyframes loader-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes loader-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* 터치 최적화 */
button, a, input, [role="button"], [role="link"] {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

input[type="text"], textarea {
    -webkit-user-select: text;
    user-select: text;
}

:root {
    --primary: #00b894;
    --primary-light: #55efc4;
    --primary-dark: #00a885;
    --accent: #81ecec;
    --background-start: #0a0a0a;
    --background-end: #1a2f1a;
    --surface: rgba(255, 255, 255, 0.05);
    --surface-light: rgba(255, 255, 255, 0.08);
    --text: #ecf0f1;
    --text-muted: rgba(255, 255, 255, 0.6);
    --success: #00b894;
    --warning: #ffeaa7;
    --danger: #fab1a0;
}

/* Light Mode Override */
[data-theme="light"] {
    --primary: #00b894;
    --primary-light: #55efc4;
    --primary-dark: #00a885;
    --accent: #81ecec;
    --background-start: #f5f5fa;
    --background-end: #e8e8f0;
    --surface: rgba(0, 0, 0, 0.04);
    --surface-light: rgba(0, 0, 0, 0.06);
    --text: #1a1a2e;
    --text-muted: #5a5a70;
    --success: #00b894;
    --warning: #f39c12;
    --danger: #e74c3c;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(180deg, var(--background-start) 0%, var(--background-end) 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 배경 파티클 효과 */
/* 테마 토글 - 언어 선택기 옆 */
.theme-toggle {
    position: fixed;
    top: 12px;
    right: 56px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="light"] .theme-toggle {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* 언어 선택 - 우측 상단 고정 */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-btn {
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    font-size: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lang-btn:hover {
    background: var(--surface-light);
    transform: scale(1.05);
}

.lang-menu {
    position: absolute;
    top: 52px;
    right: 0;
    background: rgba(26, 47, 26, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 184, 148, 0.3);
    border-radius: 12px;
    padding: 8px;
    min-width: 150px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.3s ease;
}

[data-theme="light"] .lang-menu {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 184, 148, 0.2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.lang-menu.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lang-option {
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    transition: background 0.2s ease;
}

.lang-option:hover {
    background: rgba(0, 184, 148, 0.2);
}

[data-theme="light"] .lang-option:hover {
    background: rgba(0, 184, 148, 0.1);
}

.lang-option.active {
    background: rgba(0, 184, 148, 0.3);
    font-weight: 600;
}

[data-theme="light"] .lang-option.active {
    background: rgba(0, 184, 148, 0.15);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, var(--primary), transparent),
        radial-gradient(2px 2px at 40px 70px, var(--accent), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(2px 2px at 130px 80px, var(--primary-light), transparent),
        radial-gradient(1px 1px at 160px 120px, #fff, transparent);
    background-size: 200px 200px;
    animation: twinkle 8s ease-in-out infinite;
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

[data-theme="light"] body::before {
    opacity: 0.15;
    background-image:
        radial-gradient(2px 2px at 20px 30px, var(--primary), transparent),
        radial-gradient(2px 2px at 40px 70px, var(--accent), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(0, 0, 0, 0.1), transparent),
        radial-gradient(2px 2px at 130px 80px, var(--primary-light), transparent),
        radial-gradient(1px 1px at 160px 120px, rgba(0, 0, 0, 0.1), transparent);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* 광고 영역 - 유리 효과 */
.ad-banner {
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px;
    text-align: center;
    border-radius: 16px;
    margin: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .ad-banner {
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.ad-placeholder {
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 1px;
}

.ad-top {
    min-height: 50px;
}

.ad-bottom {
    min-height: 60px;
    margin-top: auto;
}

/* 헤더 - 미니멀 */
header {
    text-align: center;
    padding: 30px 20px 20px;
}

header h1 {
    font-size: 1.6rem;
    font-weight: 300;
    letter-spacing: 3px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 2px;
}

/* 메인 */
main {
    flex: 1;
    padding: 0 20px 20px;
}

/* 히어로 섹션 */
.hero-section {
    text-align: center;
    margin-bottom: 32px;
    padding: 20px 0;
}

.hero-badge {
    display: inline-block;
    background: rgba(0, 184, 148, 0.2);
    border: 1px solid rgba(0, 184, 148, 0.4);
    color: var(--primary-light);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 12px;
    animation: slideUp 0.8s ease;
}

.hero-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
    letter-spacing: -0.5px;
    animation: slideUp 0.8s ease 0.1s both;
}

.hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    animation: slideUp 0.8s ease 0.2s both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 동기부여 카드 - 부드러운 그라데이션 */
.motivation-card {
    background: linear-gradient(135deg, 
        rgba(0, 184, 148, 0.2) 0%, 
        rgba(129, 236, 236, 0.1) 100%);
    padding: 25px;
    border-radius: 24px;
    text-align: center;
    margin-bottom: 30px;
    border: 1px solid rgba(0, 184, 148, 0.3);
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .motivation-card {
    background: linear-gradient(135deg, 
        rgba(0, 184, 148, 0.1) 0%, 
        rgba(129, 236, 236, 0.05) 100%);
    border: 1px solid rgba(0, 184, 148, 0.2);
}

.motivation-card::before {
    content: '🍃';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 20px;
    opacity: 0.5;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(10deg); }
}

.motivation-card p {
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    line-height: 1.8;
}

/* 시간 선택 - 원형 버튼 */
.time-selector {
    margin-bottom: 30px;
}

.time-selector-header {
    margin-bottom: 24px;
    text-align: center;
}

.time-selector h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
    color: var(--text);
    letter-spacing: 0px;
}

.time-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.time-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.time-btn {
    background: var(--surface);
    border: 1px solid rgba(0, 184, 148, 0.2);
    color: var(--text);
    padding: 20px 10px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .time-btn {
    border: 1px solid rgba(0, 184, 148, 0.15);
}

[data-theme="light"] .time-btn:hover {
    background: rgba(0, 184, 148, 0.08);
}

.time-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
    opacity: 0.3;
}

.time-btn:hover::before {
    width: 200px;
    height: 200px;
}

.time-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px) scale(0.98);
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.2);
}

.time-btn:active {
    transform: scale(0.95);
}

.time-btn.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, 
        rgba(0, 184, 148, 0.3) 0%, 
        rgba(0, 184, 148, 0.1) 100%);
    box-shadow: 0 0 30px rgba(0, 184, 148, 0.2);
}

.custom-time {
    text-align: center;
}

.custom-time input {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    padding: 15px 25px;
    border-radius: 20px;
    font-size: 1rem;
    width: 100%;
    max-width: 180px;
    text-align: center;
    transition: all 0.3s ease;
}

[data-theme="light"] .custom-time input {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.custom-time input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 184, 148, 0.2);
}

.custom-time input::placeholder {
    color: var(--text-muted);
}

/* 버튼 - 부드러운 그라데이션 */
.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    padding: 20px;
    border-radius: 24px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}

.primary-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.primary-btn:hover::after {
    left: 100%;
}

.primary-btn:hover {
    transform: translateY(-3px) scale(0.98);
    box-shadow: 0 15px 40px rgba(0, 184, 148, 0.4);
}

.primary-btn:active {
    transform: scale(0.95);
}

/* CTA 버튼 강조 */
.cta-btn {
    padding: 18px 24px;
    min-height: 56px;
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    animation: none !important;
}

.btn-icon {
    font-size: 1.3em;
}

.btn-arrow {
    opacity: 0;
    transform: translateX(-5px);
    transition: all 0.3s ease;
}

.cta-btn:hover .btn-arrow {
    opacity: 1;
    transform: translateX(5px);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 15px 40px rgba(0, 184, 148, 0.3);
    }
    50% {
        box-shadow: 0 15px 50px rgba(0, 184, 148, 0.5);
    }
}

.secondary-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
    padding: 16px;
    min-height: 56px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.secondary-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(250, 177, 160, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(250, 177, 160, 0.2);
}

.secondary-btn:active {
    transform: scale(0.97);
}

/* 통계 미리보기 - 글래스모피즘 */
.stats-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    padding: 25px 15px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .stats-review {
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
}

/* 타이머 화면 - 중앙 집중 */
.timer-display {
    display: flex;
    justify-content: center;
    margin: 40px 0;
    perspective: 1000px;
}

.timer-ring {
    position: relative;
    width: 280px;
    height: 280px;
}

.progress-ring {
    transform: rotate(-90deg);
    filter: drop-shadow(0 0 20px rgba(0, 184, 148, 0.3));
}

.progress-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 8;
}

.progress-ring-circle {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 816.81;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
    filter: drop-shadow(0 0 10px var(--primary));
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4.5rem;
    font-weight: 200;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    letter-spacing: -2px;
}

.timer-colon {
    animation: pulse 1s ease-in-out infinite;
    margin: 0 2px;
}

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

.timer-message {
    text-align: center;
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 35px;
    font-weight: 300;
    letter-spacing: 0.5px;
    transition: opacity 0.3s ease;
}

/* 호흡 가이드 - 부드러운 원 */
.breathing-guide {
    text-align: center;
    margin-bottom: 35px;
}

.breath-circle {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, 
        rgba(0, 184, 148, 0.4) 0%, 
        rgba(0, 184, 148, 0.1) 50%,
        transparent 70%);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: breathe 8s ease-in-out infinite;
    box-shadow: 
        0 0 40px rgba(0, 184, 148, 0.3),
        inset 0 0 30px rgba(0, 184, 148, 0.2);
}

@keyframes breathe {
    0%, 100% { 
        transform: scale(0.8); 
        opacity: 0.5;
        box-shadow: 0 0 20px rgba(0, 184, 148, 0.2);
    }
    50% { 
        transform: scale(1.3); 
        opacity: 1;
        box-shadow: 0 0 60px rgba(0, 184, 148, 0.5);
    }
}

.breath-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 1px;
}

/* 완료 화면 - 축하 효과 */
.complete-content {
    text-align: center;
    padding: 50px 0;
}

.complete-icon {
    font-size: 6rem;
    margin-bottom: 25px;
    animation: celebrate 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes celebrate {
    0% { transform: scale(0) rotate(-20deg); }
    50% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.complete-content h2 {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.complete-content p {
    color: var(--text-muted);
    margin-bottom: 35px;
    font-weight: 300;
}

.session-result {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    background: var(--surface);
    padding: 25px;
    border-radius: 24px;
    margin-bottom: 35px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .session-result {
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.result-item {
    text-align: center;
}

.result-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-value {
    font-size: 1.8rem;
    font-weight: 500;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 전면 광고 */
.interstitial-ad {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.interstitial-ad.active {
    display: flex;
}

.interstitial-content {
    background: var(--surface-light);
    backdrop-filter: blur(20px);
    padding: 50px;
    border-radius: 32px;
    text-align: center;
    max-width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.interstitial-content .ad-placeholder {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 25px;
    color: var(--text);
}

#close-ad-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    padding: 14px 35px;
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

#close-ad-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    color: var(--text-muted);
}

#close-ad-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 184, 148, 0.3);
}

/* 액션 버튼들 */
.action-buttons {
    margin-top: 20px;
}

.history-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(0, 184, 148, 0.2) 0%, rgba(0, 184, 148, 0.1) 100%);
    border: 2px solid rgba(0, 184, 148, 0.4);
    color: var(--primary-light);
    padding: 16px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.history-btn:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(0, 184, 148, 0.3) 0%, rgba(0, 184, 148, 0.2) 100%);
    box-shadow: 0 10px 30px rgba(0, 184, 148, 0.3);
    transform: translateY(-2px);
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(180deg, var(--background-start) 0%, var(--background-end) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

[data-theme="light"] .modal-content {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--background-start);
    z-index: 1;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 1px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.history-content-body {
    padding: 30px;
}

/* 배지 섹션 */
.badges-section {
    margin-bottom: 30px;
}

.badges-section h3, .history-section h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 15px;
    color: var(--primary-light);
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.badge {
    background: var(--surface);
    padding: 15px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

[data-theme="light"] .badge {
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.badge.unlocked {
    border-color: rgba(255, 215, 0, 0.3);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 193, 7, 0.05) 100%);
}

.badge.locked {
    opacity: 0.4;
}

.badge.unlocked:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.2);
}

.badge-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.badge-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.badge-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* 히스토리 섹션 */
.history-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: var(--surface);
    padding: 15px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

[data-theme="light"] .history-item {
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.history-item:hover {
    background: var(--surface-light);
    border-color: rgba(255, 255, 255, 0.1);
}

.history-icon {
    font-size: 1.5rem;
}

.history-info {
    flex: 1;
}

.history-date {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.history-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 0.95rem;
}

/* 반응형 */
@media (max-width: 380px) {
    .timer-text {
        font-size: 3.5rem;
    }

    .timer-ring {
        width: 240px;
        height: 240px;
    }

    .progress-ring {
        width: 240px;
        height: 240px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-content {
        max-width: 95%;
    }
}

/* 스크롤바 커스텀 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

/* 선택 색상 */
::selection {
    background: var(--primary);
    color: white;
}

/* 프리미엄 버튼 */
.premium-section {
    margin-bottom: 20px;
    text-align: center;
}

.premium-btn {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #5a4000;
    border: none;
    padding: 16px 28px;
    min-height: 56px;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    margin-bottom: 20px;
}

.premium-btn:hover {
    transform: scale(0.97) translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
}

.premium-btn:active {
    transform: scale(0.95);
}

.premium-badge {
    background: rgba(90, 64, 0, 0.2);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 800;
}

/* 프리미엄 분석 콘텐츠 */
.premium-analysis-content {
    padding: 10px 0;
}

.premium-level-section {
    text-align: center;
    margin-bottom: 25px;
}

.premium-level-badge {
    font-size: 1.4rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.premium-level-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.premium-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.premium-stat-card {
    background: var(--surface);
    padding: 18px 12px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.premium-stat-card .premium-stat-value {
    font-size: 1.4rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.premium-stat-card .premium-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.premium-block {
    background: var(--surface);
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.premium-block h4 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 15px;
    color: var(--primary-light);
}

/* 요일별 패턴 차트 */
.day-pattern {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 100px;
    margin-bottom: 12px;
    padding: 0 10px;
}

.day-bar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
}

.day-bar {
    width: 20px;
    min-height: 4px;
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
}

.day-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.pattern-note {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.pattern-note strong {
    color: var(--primary-light);
}

.premium-tips-list {
    list-style: none;
    padding: 0;
}

.premium-tips-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
}

.premium-tips-list li:last-child {
    border-bottom: none;
}

.premium-tips-list li::before {
    content: '💡 ';
}

.total-time-display {
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.time-note {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 주간 활동 히트맵 */
.weekly-heatmap {
    margin-top: 20px;
    padding: 20px;
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .weekly-heatmap {
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.heatmap-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.heatmap-day {
    text-align: center;
}

.heatmap-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.heatmap-cell {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
    position: relative;
}

.heatmap-cell.level-1 {
    background: rgba(0, 184, 148, 0.15);
    border-color: rgba(0, 184, 148, 0.2);
    color: var(--primary-light);
}

.heatmap-cell.level-2 {
    background: rgba(0, 184, 148, 0.3);
    border-color: rgba(0, 184, 148, 0.4);
    color: #fff;
}

.heatmap-cell.level-3 {
    background: rgba(0, 184, 148, 0.5);
    border-color: rgba(0, 184, 148, 0.6);
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 184, 148, 0.2);
}

.heatmap-cell.today {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(0, 184, 148, 0.3);
}

.heatmap-streak {
    text-align: center;
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--primary-light);
    font-weight: 500;
}

/* Recommendations Section */
.recommendations-section { margin: 24px 0 0; padding: 0 16px; }
.rec-title { font-size: 15px; font-weight: 700; color: rgba(255,255,255,0.65); margin-bottom: 16px; text-align: center; letter-spacing: 0.5px; }
.rec-grid { display: flex; flex-direction: column; gap: 12px; }
.rec-card { display: flex; align-items: center; gap: 14px; padding: 16px; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12); border-radius: 16px; text-decoration: none; color: #fff; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); min-height: 60px; }
.rec-card:hover { background: rgba(255,255,255,0.12); transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0, 184, 148, 0.2); }
.rec-card:active { transform: scale(0.98); }
.rec-icon { font-size: 32px; flex-shrink: 0; }
.rec-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rec-name { font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.9); }
.rec-desc { font-size: 12px; color: rgba(255,255,255,0.7); }

/* Game Footer */
.game-footer {
  text-align: center;
  padding: 20px 0;
  margin-top: 20px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  font-size: 13px;
  padding: 12px 0;
  transition: color 0.2s;
}

.back-link:hover {
  color: rgba(255,255,255,0.7);
}

/* 타이머 추천 섹션 */
.timer-recommendation {
  margin: 30px 0;
  animation: slideUp 0.8s ease 0.3s both;
}

.rec-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(85, 239, 196, 0.15) 0%, rgba(0, 184, 148, 0.1) 100%);
  border: 2px solid rgba(0, 184, 148, 0.3);
  border-radius: 20px;
  text-decoration: none;
  color: #55efc4;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 56px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

[data-theme="light"] .rec-link {
  background: linear-gradient(135deg, rgba(85, 239, 196, 0.08) 0%, rgba(0, 184, 148, 0.05) 100%);
  border: 2px solid rgba(0, 184, 148, 0.2);
  color: var(--primary-dark);
}

.rec-link:hover {
  border-color: var(--primary-light);
  background: linear-gradient(135deg, rgba(85, 239, 196, 0.25) 0%, rgba(0, 184, 148, 0.2) 100%);
  box-shadow: 0 10px 35px rgba(0, 184, 148, 0.3);
  transform: translateY(-2px);
}

.rec-link:active {
  transform: scale(0.98);
}

.rec-emoji {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.rec-text {
  flex: 1;
  text-align: center;
  font-size: 1rem;
}

.rec-arrow {
  font-size: 1.2rem;
  opacity: 0;
  transform: translateX(-5px);
  transition: all 0.3s ease;
}

.rec-link:hover .rec-arrow {
  opacity: 1;
  transform: translateX(5px);
}

/* 타이머 버튼 섹션 */
.timer-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timer-action-btn {
  min-height: 56px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 20px;
  transition: all 0.3s ease;
}

.pause-btn {
  background: linear-gradient(135deg, rgba(255, 234, 167, 0.3) 0%, rgba(255, 193, 7, 0.2) 100%);
  border: 2px solid rgba(255, 193, 7, 0.4);
  color: #ffeb99;
  cursor: pointer;
}

.pause-btn:hover {
  border-color: #ffeb99;
  background: linear-gradient(135deg, rgba(255, 234, 167, 0.4) 0%, rgba(255, 193, 7, 0.3) 100%);
  box-shadow: 0 10px 30px rgba(255, 193, 7, 0.2);
  transform: translateY(-2px);
}

.pause-btn:active {
  transform: scale(0.97);
}

/* Confetti 클래스 (JS에서 사용) */
@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background: #ffd700;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999;
  animation: confetti-fall 2s ease-in forwards;
}

/* === Accessibility Improvements === */

/* Focus Visible for All Interactive Elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid #00b894;
    outline-offset: 2px;
}

/* Ensure minimum touch target size (44px) */
button,
a[href],
input[type="button"],
input[type="submit"],
[role="button"] {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #00b894;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Modal accessibility */
[role="dialog"] {
    z-index: 1000;
}

.modal-close:focus-visible {
    outline: 3px solid #00b894;
    outline-offset: -2px;
}

/* Timer display accessibility */
[role="timer"] {
    font-size: 48px;
    font-weight: bold;
    font-feature-settings: 'tnum';
}

/* Time button accessibility */
.time-btn {
    min-height: 48px;
    font-size: 16px;
    padding: 12px 16px;
}

.time-btn:focus-visible {
    outline: 3px solid #00b894;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .breathing-guide {
        animation: none !important;
    }

    .confetti {
        animation: none !important;
    }

    .pulse,
    [class*="bounce"],
    [class*="slide"],
    [class*="fade"] {
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: more) {
    button {
        border: 2px solid #00b894;
    }

    .timer-text {
        color: #ffffff;
        text-shadow: 0 0 2px #00b894;
    }
}

/* Color contrast improvements */
.subtitle {
    font-size: 16px;
    line-height: 1.5;
}

.time-hint {
    min-contrast-ratio: 4.5:1;
    font-size: 14px;
}

.rec-card:focus-visible {
    outline: 3px solid #00b894;
    outline-offset: 4px;
}

/* Light mode - recommendations & footer */
[data-theme="light"] .rec-card {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .rec-card:hover {
    background: rgba(0,0,0,0.06);
}

[data-theme="light"] .rec-title {
    color: rgba(26,26,46,0.5);
}

[data-theme="light"] .rec-name {
    color: #1a1a2e;
}

[data-theme="light"] .rec-desc {
    color: #555;
}

[data-theme="light"] .back-link {
    color: rgba(26,26,46,0.4);
}

[data-theme="light"] .back-link:hover {
    color: rgba(26,26,46,0.7);
}

[data-theme="light"] .loader-text {
    color: #333;
}
