/* === Zenith Obsidian Final Style === */
:root {
    --bg-obsidian: #000000;
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-bg-hover: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-focus: rgba(255, 255, 255, 0.25);
    --glass-highlight: rgba(255, 255, 255, 0.1);
    --glass-glow: rgba(255, 255, 255, 0.05);
    --glass-blur: blur(40px) saturate(150%);
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-tertiary: rgba(255, 255, 255, 0.3);
    --font-jp: 'Inter', -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    --ease-fluid: cubic-bezier(0.2, 0, 0, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --motion-fast: 0.15s;
    --motion-normal: 0.3s;
}

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

body {
    font-family: var(--font-jp); background-color: var(--bg-obsidian); color: var(--text-primary);
    line-height: 1.6; height: 100vh; overflow: hidden; -webkit-font-smoothing: antialiased; letter-spacing: 0.02em;
    transition: background-color 0.8s ease;
}

/* Boot Screen */
.boot-screen {
    position: fixed; inset: 0; background: #000; z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.boot-logo { font-size: 64px; font-weight: 800; color: #fff; margin-bottom: 16px; letter-spacing: -2px;}
.boot-text { font-size: 11px; letter-spacing: 0.3em; color: var(--text-tertiary); margin-bottom: 32px;}
.boot-progress-track { width: 120px; height: 2px; background: rgba(255,255,255,0.1); border-radius: 1px; overflow: hidden; }
.boot-progress-fill { height: 100%; width: 0%; background: #fff; transition: width 1.2s cubic-bezier(0.8, 0, 0.2, 1); }
.boot-screen.hidden { opacity: 0; pointer-events: none; transform: scale(1.05); }

/* Zen Mode */
body.zen-mode .ambient-layer { opacity: 0; }
body.zen-mode .sidebar { opacity: 0.02; pointer-events: none; }
body.zen-mode .bento-grid > div:not(#timerCard) { opacity: 0.02; pointer-events: none; filter: blur(8px); }
body.zen-mode #timerCard { transform: scale(1.05); box-shadow: 0 0 100px rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.3); }

/* Ambient Layer */
.ambient-layer { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; overflow: hidden; pointer-events: none; background: var(--bg-obsidian); transition: opacity 0.8s; }
.orb { position: absolute; border-radius: 50%; filter: blur(140px); animation: breathe-orb 20s infinite ease-in-out alternate; }
.orb-1 { width: 50vw; height: 50vw; background: rgba(255, 255, 255, 0.07); top: -10%; left: -10%; }
.orb-2 { width: 60vw; height: 60vw; background: rgba(255, 255, 255, 0.03); bottom: -20%; right: -10%; animation-delay: -5s; }
@keyframes breathe-orb { 0% { transform: translate(0, 0) scale(1); opacity: 0.5; } 100% { transform: translate(30px, 30px) scale(1.1); opacity: 1; } }

/* Layout */
#app { display: flex; width: 100vw; height: 100vh; }
.sidebar { width: 88px; padding: 32px 0; display: flex; flex-direction: column; align-items: center; border-right: 1px solid var(--glass-border); background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); z-index: 100; transition: opacity 0.5s; }
.brand-icon { width: 44px; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; color: var(--text-primary); margin-bottom: 48px; cursor: pointer; transition: transform var(--motion-normal) var(--ease-bounce); }
.brand-icon:hover { transform: scale(1.05); }
.nav-links { display: flex; flex-direction: column; gap: 24px; width: 100%; flex: 1; }
.nav-item { width: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); cursor: pointer; position: relative; transition: color var(--motion-normal) var(--ease-fluid); }
.nav-item svg { transition: transform var(--motion-normal) var(--ease-bounce); }
.nav-item:hover { color: var(--text-primary); }
.nav-item:hover svg { transform: scale(1.15); }
.nav-item.active { color: var(--text-primary); }
.nav-item.active::after { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 2px; height: 24px; background: var(--text-primary); border-radius: 0 2px 2px 0; }
.nav-bottom { margin-top: auto; padding-bottom: 16px; }

.main-content { flex: 1; overflow-y: auto; scroll-behavior: smooth; padding: 48px; display: flex; flex-direction: column; align-items: center; scrollbar-width: none; }
.main-content::-webkit-scrollbar { display: none; }
.dashboard-container { width: 100%; max-width: 1100px; display: flex; flex-direction: column; gap: 64px; padding-bottom: 80px;}

.page { display: none; width: 100%; animation: fadeUp 0.5s var(--ease-fluid) forwards; }
.page.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* Cards */
.glass-card { background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border); border-radius: 24px; padding: 32px; transition: transform var(--motion-fast) var(--ease-fluid), background var(--motion-normal) var(--ease-fluid), border-color var(--motion-normal) var(--ease-fluid), opacity 0.5s, filter 0.5s, box-shadow 0.5s; }
.glass-card.interactive { cursor: pointer; }
.glass-card.interactive:hover { background: var(--glass-bg-hover); border-color: var(--glass-border-focus); transform: scale(0.995); }
.glass-card.interactive:active { transform: scale(0.985); }

/* Headers & Typography */
.section-header { margin-bottom: 24px; display: flex; justify-content: space-between; align-items: flex-end; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.15em; display: flex; align-items: center; gap: 12px; }
.stat-value { font-size: 36px; font-weight: 300; letter-spacing: -0.04em; line-height: 1.2; font-family: 'Inter'; }
.stat-label { font-size: 12px; color: var(--text-tertiary); margin-top: 8px; letter-spacing: 0.05em; line-height: 1.5; }
.mobile-settings-btn { display: none; cursor: pointer; }

.bento-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; }
.col-4 { grid-column: span 4; } .col-6 { grid-column: span 6; } .col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }

/* Progress & Graphs */
.progress-track { width: 100%; height: 1px; background: var(--glass-border); position: relative; overflow: hidden; }
.progress-fill { position: absolute; top: 0; left: 0; height: 1px; background: var(--text-primary); transition: width 0.8s var(--ease-fluid); }

.activity-graph { display: flex; gap: 4px; height: 32px; align-items: flex-end; margin-top: 16px;}
.activity-cell { width: 14px; height: 14px; border-radius: 3px; background: rgba(255,255,255,0.05); transition: background 0.3s; }

/* Controls */
.btn { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-primary); padding: 12px 24px; border-radius: 100px; font-size: 13px; font-weight: 500; font-family: var(--font-jp); letter-spacing: 0.05em; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all var(--motion-fast) var(--ease-fluid); }
.btn:hover { background: var(--glass-highlight); border-color: var(--glass-border-focus); transform: scale(0.98); }
.btn:active { transform: scale(0.95); }
.btn.primary { background: var(--text-primary); color: #000; border-color: transparent; font-weight: 600; }
.btn.primary:hover { background: rgba(255,255,255,0.8); }
.btn-text { background: transparent; border: none; padding: 8px 12px; font-size: 12px; color: var(--text-secondary); }
.btn-text:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.glass-select { background: rgba(0,0,0,0.4); border: 1px solid var(--glass-border); color: var(--text-primary); padding: 6px 12px; border-radius: 8px; font-family: var(--font-jp); font-size: 12px; outline: none; cursor: pointer; transition: border-color 0.3s; }
.glass-select:focus { border-color: var(--text-primary); }

.input-text { width: 100%; background: transparent; border: none; border-bottom: 1px solid var(--glass-border); padding: 16px 0; color: var(--text-primary); font-size: 14px; font-family: var(--font-jp); transition: border-color var(--motion-normal) var(--ease-fluid); outline: none; }
.input-text::placeholder { color: var(--text-tertiary); font-weight: 300; }
.input-text:focus { border-bottom-color: var(--text-primary); }
.file-input-wrapper { position: relative; overflow: hidden; display: inline-block; cursor: pointer; }
.file-input-wrapper input[type=file] { font-size: 100px; position: absolute; left: 0; top: 0; opacity: 0; cursor: pointer; }

/* 5 Multi-Flip Clock RSS */
.rss-multi-container { display: flex; flex-direction: column; gap: 8px; }
.flip-slot { position: relative; height: 50px; perspective: 1000px; overflow: visible; border-bottom: 1px solid rgba(255,255,255,0.03); }
.flip-slot:last-child { border-bottom: none; }
.flip-item { position: absolute; width: 100%; height: 100%; top:0; left:0; opacity: 0; pointer-events: none; transform: rotateX(-90deg); transform-origin: center bottom; transition: transform 0.6s var(--ease-bounce), opacity 0.4s; background: rgba(0,0,0,0.6); border-radius: 8px; padding: 0 8px;}
.flip-item.active { opacity: 1; transform: rotateX(0); pointer-events: auto; z-index: 2; transition-delay: 0.1s;}
.flip-item.prev { transform: rotateX(90deg); transform-origin: center top; opacity: 0; z-index: 1; }

/* Routine Tasks */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item { display: flex; align-items: flex-start; gap: 16px; padding: 16px; border-radius: 16px; border: 1px solid transparent; background: transparent; cursor: pointer; transition: all var(--motion-normal) var(--ease-fluid); }
.task-item:hover { background: var(--glass-bg); border-color: var(--glass-border); }
.task-item.done { opacity: 0.4; }
.checkbox-box { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--text-secondary); flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all var(--motion-fast) var(--ease-bounce); margin-top: 2px; }
.task-item.done .checkbox-box { background: var(--text-primary); border-color: var(--text-primary); color: #000; }
.checkbox-icon { opacity: 0; width: 12px; height: 12px; transition: opacity var(--motion-fast); transform: scale(0.5); }
.task-item.done .checkbox-icon { opacity: 1; transform: scale(1); }
.task-time { font-size: 13px; font-weight: 600; width: 44px; flex-shrink: 0; color: var(--text-secondary); font-family: 'Inter'; letter-spacing: 0.05em;}
.task-body { flex: 1; display: flex; flex-direction: column; }
.task-title { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 2px; transition: color var(--motion-normal);}
.task-desc { font-size: 11px; color: var(--text-tertiary); line-height: 1.5; }
.task-item.done .task-title { text-decoration: line-through; color: var(--text-tertiary); }

.task-item-mini { padding: 8px 12px; border-radius: 12px; margin-bottom: 4px; gap: 12px; align-items: center;}
.task-item-mini .checkbox-box { width: 16px; height: 16px; border-radius: 4px; margin-top: 0;}
.task-item-mini .checkbox-icon { width: 10px; height: 10px; }
.task-item-mini .task-time { font-size: 12px; width: 40px; }
.task-item-mini .task-title { font-size: 13px; margin: 0; }
.task-item-mini .task-desc { display: none; }

.list-item { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.03); display: flex; flex-direction: column; justify-content: center; }
.list-item:last-child { border-bottom: none; }
.list-title { font-size: 13px; font-weight: 400; margin-bottom: 6px; color: var(--text-primary); line-height: 1.4; }
.list-meta { font-size: 11px; color: var(--text-tertiary); letter-spacing: 0.05em; display: flex; justify-content: space-between; align-items: center;}

.skeleton { background: rgba(255,255,255,0.05); border-radius: 4px; animation: pulse-skel 1.5s infinite ease-in-out; min-height: 20px; margin-bottom: 8px; width: 100%; }
@keyframes pulse-skel { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.7; } }
.sys-msg { font-family: monospace; font-size: 11px; letter-spacing: 0.1em; color: var(--text-tertiary); }

.is-selected { border-color: var(--glass-border-focus) !important; background: rgba(255, 255, 255, 0.08) !important; box-shadow: 0 0 24px var(--glass-glow); transform: scale(1.02); position: relative; }
.is-selected svg { color: var(--text-primary) !important; opacity: 1 !important; filter: drop-shadow(0 0 4px rgba(255,255,255,0.4)); }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); z-index: 1000; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s; }
.modal-container { width: 90%; max-width: 520px; max-height: 90vh; overflow-y: auto; scrollbar-width: none; background: rgba(10,10,10,0.4); border: 1px solid var(--glass-border); border-radius: 32px; padding: 40px; box-shadow: 0 24px 64px rgba(0,0,0,0.6); transform: scale(0.96); transition: transform 0.3s var(--ease-bounce); }
.modal-overlay.show { opacity: 1; }
.modal-overlay.show .modal-container { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.selection-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 16px; padding: 16px 20px; cursor: pointer; display: flex; align-items: center; gap: 16px; transition: all var(--motion-normal) var(--ease-fluid); margin-bottom: 12px; }
.selection-card:hover { background: var(--glass-highlight); }
.selection-card svg { color: var(--text-secondary); opacity: 0.6; transition: all var(--motion-normal); }

/* Chronograph */
.chrono-wrapper { display: flex; flex-direction: column; align-items: center; position: relative; padding: 24px 0;}
.chrono-svg-container { position: relative; width: 280px; height: 280px; margin-bottom: 32px; transition: transform var(--motion-normal) var(--ease-bounce); }
.chrono-svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.chrono-bg { fill: none; stroke: var(--glass-border); stroke-width: 1.5; }
.chrono-progress { fill: none; stroke: var(--text-primary); stroke-width: 1.5; stroke-linecap: round; transition: stroke-dashoffset 0.1s linear;}
.chrono-display { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.chrono-time { font-size: 64px; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -0.05em; transition: opacity var(--motion-normal);}
.chrono-label { font-size: 11px; color: var(--text-secondary); letter-spacing: 0.2em; text-transform: uppercase; margin-top: 4px;}

/* Mindfulness */
.breathe-sphere { width: 180px; height: 180px; border-radius: 50%; margin: 48px auto; background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 70%); border: 1px solid rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; transition: transform 4s ease-in-out, background 4s ease-in-out, border-color 4s ease-in-out; }
.breathe-sphere.inhale { transform: scale(1.6); background: radial-gradient(circle, rgba(255,255,255,0.15), transparent 70%); border-color: rgba(255,255,255,0.4); }
.breathe-sphere.exhale { transform: scale(1); background: radial-gradient(circle, rgba(255,255,255,0.02), transparent 70%); border-color: rgba(255,255,255,0.05); }
.breathe-state { font-size: 14px; font-weight: 400; letter-spacing: 0.3em; color: var(--text-secondary); transition: color 4s; }
.breathe-sphere.inhale .breathe-state { color: var(--text-primary); }

.tag { font-size: 10px; padding: 4px 10px; background: var(--glass-highlight); color: var(--text-primary); border-radius: 100px; letter-spacing: 0.05em;}
.ai-result { background: rgba(255,255,255,0.02); padding: 20px; border-radius: 16px; border: 1px solid var(--glass-border); margin-top: 16px; font-size: 13px; line-height: 1.8; color: var(--text-secondary); white-space: pre-wrap; transition: opacity 0.5s ease;}

/* Mobile Optimization (Bottom Nav) */
@media (max-width: 1024px) { .col-4 { grid-column: span 6; } .col-8 { grid-column: span 12; } .main-content { padding: 32px; } }
@media (max-width: 768px) {
    #app { flex-direction: column-reverse; }
    .sidebar { width: 100%; height: auto; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-right: none; border-top: 1px solid var(--glass-border); flex-direction: row; justify-content: space-around; position: fixed; bottom: 0; left: 0; background: rgba(0,0,0,0.85); z-index: 999; }
    .brand-icon, .nav-bottom, .weather-widget { display: none; }
    .nav-links { flex-direction: row; justify-content: space-around; gap: 0; width: 100%; }
    .nav-item { width: 44px; height: 44px; margin: 0; }
    .nav-item.active::after { width: 20px; height: 2px; top: -12px; left: 50%; transform: translateX(-50%); border-radius: 0 0 2px 2px; }
    .main-content { padding: 24px 16px calc(100px + env(safe-area-inset-bottom)); height: 100vh;}
    .dashboard-container { gap: 48px; }
    .col-4, .col-6, .col-8, .col-12 { grid-column: span 12; }
    .chrono-svg-container { width: 240px; height: 240px; } .chrono-time { font-size: 48px; }
    .mobile-settings-btn { display: flex; }
}
