/* リセットとベース設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --secondary-color: #7C3AED;
    --background-dark: #0F172A;
    --background-light: #1E293B;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --accent-color: #F59E0B;
    --success-color: #10B981;
    --card-background: rgba(30, 41, 59, 0.8);
    --card-border: rgba(100, 116, 139, 0.2);
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, var(--background-dark) 0%, var(--background-light) 50%, var(--primary-color) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* アプリコンテナ */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ヘッダー */
.header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid var(--card-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.logo-icon {
    font-size: 2rem;
    animation: float 3s ease-in-out infinite;
}

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

.language-toggle {
    background: var(--card-background);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.language-toggle:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

/* メインコンテンツ */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* スクリーン */
.screen {
    display: none;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* ウェルカム画面 */
.welcome-content {
    background: var(--card-background);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.welcome-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-description {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 2.5rem;
}

/* セッションボタン */
.quick-sessions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.session-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 16px;
    padding: 1.5rem 1rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.session-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(79, 70, 229, 0.4);
}

.session-icon {
    font-size: 2rem;
}

.session-name {
    font-weight: 600;
}

.session-duration {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* カスタム時間設定 */
.custom-duration {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
}

.custom-duration label {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.custom-duration-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

#custom-duration-input {
    background: var(--background-light);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    width: 100px;
    text-align: center;
}

.start-custom-button {
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    padding: 0.75rem 2rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-custom-button:hover {
    background: #DC2626;
    transform: translateY(-2px);
}

/* 瞑想画面 */
.meditation-content {
    text-align: center;
}

.timer-circle {
    position: relative;
    width: 240px;
    height: 240px;
    margin: 0 auto 3rem;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle {
    transition: stroke-dashoffset 1s linear;
}

.timer-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.timer-text {
    font-size: 3rem;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
}

/* 呼吸ガイド */
.breathing-guide {
    margin-bottom: 3rem;
}

.breathing-indicator {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    border-radius: 50%;
    margin: 0 auto 1rem;
    transition: transform 4s ease-in-out;
}

.breathing-indicator.inhale {
    animation: breatheIn 4s ease-in-out;
}

.breathing-indicator.exhale {
    animation: breatheOut 4s ease-in-out;
}

@keyframes breatheIn {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.3); opacity: 1; }
}

@keyframes breatheOut {
    0% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1); opacity: 0.6; }
}

.breathing-text {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* 瞑想コントロール */
.meditation-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.control-button {
    background: var(--card-background);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-button:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

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

/* 完了画面 */
.completion-content {
    background: var(--card-background);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.completion-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: sparkle 1s ease-in-out;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.completion-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--success-color);
}

.completion-message {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 2rem;
}

/* 統計表示 */
.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--background-light);
    border-radius: 12px;
    padding: 1.5rem;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-color);
}

.return-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.return-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.4);
}

/* フッター */
.footer {
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--card-border);
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-text a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-text a:hover {
    color: var(--primary-color);
}

/* レスポンシブデザイン */
@media (max-width: 640px) {
    .header {
        padding: 1rem;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .welcome-content,
    .completion-content {
        padding: 2rem;
    }
    
    .welcome-title {
        font-size: 1.5rem;
    }
    
    .quick-sessions {
        grid-template-columns: 1fr;
    }
    
    .timer-text {
        font-size: 2.5rem;
    }
    
    .control-button {
        width: 50px;
        height: 50px;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: light) {
    :root {
        --background-dark: #F8FAFC;
        --background-light: #E2E8F0;
        --text-primary: #1E293B;
        --text-secondary: #64748B;
        --card-background: rgba(255, 255, 255, 0.9);
        --card-border: rgba(203, 213, 225, 0.5);
    }
    
    body {
        background: linear-gradient(135deg, #F8FAFC 0%, #E0E7FF 50%, #C7D2FE 100%);
    }
}

/* アクセシビリティ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* フォーカス状態 */
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}