/* --- Twilight Wellness Design System --- */

:root {
    --bg-dark: #070b14;
    --bg-card: rgba(15, 22, 38, 0.65);
    --bg-card-hover: rgba(22, 32, 54, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(0, 242, 254, 0.4);
    
    /* Colors */
    --primary: #ff7b00; /* Sunset Orange */
    --primary-glow: rgba(255, 123, 0, 0.35);
    --secondary: #00f2fe; /* Neon Cyan */
    --secondary-glow: rgba(0, 242, 254, 0.35);
    
    /* Category Colors */
    --cat-morning: #f59e0b; /* Amber */
    --cat-daytime: #06b6d4; /* Cyan */
    --cat-evening: #8b5cf6; /* Purple */
    --cat-presleep: #ec4899; /* Pink */
    
    /* Text Colors */
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --text-muted: #64748b;
    
    /* Interface */
    --shadow-glow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
    --shadow-inset: inset 0 2px 4px 0 rgba(255, 255, 255, 0.05);
    --glass-blur: blur(20px);
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- Background Twinkle Star & Glow Animation --- */
.space-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #0c1527 0%, #060912 100%);
}

.twinkle-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #fff;
    border-radius: 50%;
    opacity: 0.3;
}
.star-1 { top: 20%; left: 30%; animation: twinkle 3s infinite alternate; }
.star-2 { top: 60%; left: 15%; animation: twinkle 4s infinite alternate 1s; }
.star-3 { top: 40%; left: 80%; animation: twinkle 5s infinite alternate 2s; }

.nebula-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
}
.glow-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
    animation: pulseGlow 8s infinite alternate;
}
.glow-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    left: -150px;
    animation: pulseGlow 12s infinite alternate 2s;
}

@keyframes twinkle {
    0% { opacity: 0.2; transform: scale(0.8); }
    100% { opacity: 0.8; transform: scale(1.2); box-shadow: 0 0 8px #fff; }
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.1; }
    100% { transform: scale(1.2); opacity: 0.2; }
}

/* --- Scrollbar Customization --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* --- Main Layout Container --- */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Header Section --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-glow);
}

/* --- Guide Banner --- */
.guide-banner {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 20px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: var(--transition-smooth);
}

.guide-banner:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
}

.guide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.guide-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--secondary);
    text-shadow: 0 0 6px var(--secondary-glow);
}

.guide-arrow {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.guide-header.open .guide-arrow {
    transform: rotate(180deg);
}

.guide-body {
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 16px;
    display: block;
}

.guide-body.hidden {
    display: none;
}

.guide-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.guide-step {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 14px;
    position: relative;
}

.step-num {
    width: 24px;
    height: 24px;
    background: var(--secondary-glow);
    border: 1px solid var(--secondary);
    border-radius: 50%;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    box-shadow: 0 0 8px var(--secondary-glow);
}

.guide-step h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.guide-step p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    font-size: 32px;
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.4));
}

.logo-text h1 {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-main) 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.logo-operator {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 3px;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.live-clock {
    font-family: 'Inter', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-inset);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 360px 1fr 380px;
    gap: 20px;
    flex: 1;
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Cards (Panes) --- */
.grid-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-glow), var(--shadow-inset);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: var(--transition-smooth);
}

.grid-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 12px;
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-icon {
    font-size: 1.3rem;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

/* --- Left pane: Calendar Area --- */
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

#calendar-month-year {
    font-size: 0.95rem;
    font-weight: 700;
    min-width: 90px;
    text-align: center;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.calendar-day-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-sub);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.calendar-day-cell:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    transform: translateY(-2px);
}

.calendar-day-cell.other-month {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

.calendar-day-cell.today {
    border: 1.5px solid var(--secondary);
    color: var(--secondary);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.calendar-day-cell.selected {
    background: linear-gradient(135deg, rgba(255, 123, 0, 0.2) 0%, rgba(0, 242, 254, 0.2) 100%);
    border: 1.5px solid var(--text-main);
    color: var(--text-main);
}

/* Completion Indicators inside Calendar */
.day-progress-ring {
    position: absolute;
    bottom: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: transparent;
    transition: var(--transition-smooth);
}

.day-progress-ring.completed-0 { background: transparent; }
.day-progress-ring.completed-low { background: #ef4444; box-shadow: 0 0 4px #ef4444; }
.day-progress-ring.completed-mid { background: var(--primary); box-shadow: 0 0 4px var(--primary); }
.day-progress-ring.completed-full { background: #22c55e; box-shadow: 0 0 6px #22c55e; }

.calendar-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.legend-dot.color-0 { background: rgba(255, 255, 255, 0.1); }
.legend-dot.color-half { background: var(--primary); }
.legend-dot.color-full { background: #22c55e; }

/* --- Center pane: Checklist Area --- */
.date-badge {
    background: linear-gradient(135deg, var(--primary) 0%, #ff5100 100%);
    color: #fff;
    font-family: 'Inter', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 10px var(--primary-glow);
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-sub);
}

#progress-percent-label {
    color: var(--secondary);
    text-shadow: 0 0 8px var(--secondary-glow);
}

.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 4px;
    width: 0;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px var(--secondary-glow);
}

.checklist-wrapper {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.checklist-timeline {
    position: relative;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Timeline Vertical Line */
.checklist-timeline::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 4px;
    width: 2px;
    background: rgba(255, 255, 255, 0.05);
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-sub {
    font-size: 0.8rem;
    margin-top: 8px;
}

/* Timeline Card */
.timeline-card-item {
    position: relative;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.timeline-bullet {
    position: absolute;
    left: -20px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--bg-dark);
    z-index: 1;
    transition: var(--transition-smooth);
}

.timeline-card-item.checked .timeline-bullet {
    background: var(--secondary);
    box-shadow: 0 0 8px var(--secondary);
}

.task-time-label {
    min-width: 50px;
    font-family: 'Inter', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--secondary);
    padding-top: 10px;
    text-align: right;
}

/* The actual Card containing Checkbox & Info */
.task-check-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.task-check-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-focus);
    transform: translateX(4px);
}

.timeline-card-item.checked .task-check-card {
    background: rgba(0, 242, 254, 0.03);
    border-color: rgba(0, 242, 254, 0.15);
}

/* Custom Checkbox Design */
.checkbox-box {
    position: relative;
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-muted);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    background: rgba(0, 0, 0, 0.2);
}

.checkbox-box::after {
    content: '✓';
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--bg-dark);
    opacity: 0;
    transform: scale(0.6) rotate(-20deg);
    transition: var(--transition-smooth);
}

.timeline-card-item.checked .checkbox-box {
    border-color: var(--secondary);
    background: var(--secondary);
    box-shadow: 0 0 8px var(--secondary-glow);
}

.timeline-card-item.checked .checkbox-box::after {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Task Info Text */
.task-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    transition: var(--transition-smooth);
}

.timeline-card-item.checked .task-card-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Category Badge */
.category-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    width: fit-content;
}

.category-tag.morning { background: rgba(245, 158, 11, 0.15); color: var(--cat-morning); border: 1px solid rgba(245, 158, 11, 0.2); }
.category-tag.daytime { background: rgba(6, 182, 212, 0.15); color: var(--cat-daytime); border: 1px solid rgba(6, 182, 212, 0.2); }
.category-tag.evening { background: rgba(139, 92, 246, 0.15); color: var(--cat-evening); border: 1px solid rgba(139, 92, 246, 0.2); }
.category-tag.presleep { background: rgba(236, 72, 153, 0.15); color: var(--cat-presleep); border: 1px solid rgba(236, 72, 153, 0.2); }

.info-help-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.info-help-btn:hover {
    color: var(--secondary);
    background: rgba(255, 255, 255, 0.05);
}

/* --- Right pane: Editor Area --- */
.tab-header {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 10px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--secondary);
    border-bottom-color: var(--secondary);
}

.tab-content {
    display: none;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    overflow-y: auto;
}

.tab-content.active-content {
    display: flex;
}

.section-intro h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}
.section-intro p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Editor Timeline view */
.timeline-editor-wrapper {
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
    padding-right: 4px;
}

.model-timeline-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.model-time-row {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.model-time-tag {
    font-family: 'Inter', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-sub);
    min-width: 45px;
}

.model-task-tags {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.task-tag-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-sub);
}

.task-tag-pill.morning { border-color: rgba(245, 158, 11, 0.3); color: #fff; background: rgba(245, 158, 11, 0.08); }
.task-tag-pill.daytime { border-color: rgba(6, 182, 212, 0.3); color: #fff; background: rgba(6, 182, 212, 0.08); }
.task-tag-pill.evening { border-color: rgba(139, 92, 246, 0.3); color: #fff; background: rgba(139, 92, 246, 0.08); }
.task-tag-pill.presleep { border-color: rgba(236, 72, 153, 0.3); color: #fff; background: rgba(236, 72, 153, 0.08); }

.task-pill-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
}
.task-pill-remove:hover {
    color: #ef4444;
}

.btn-add-to-hour {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}
.btn-add-to-hour:hover {
    color: var(--secondary);
    border-color: var(--secondary);
    background: rgba(0, 242, 254, 0.05);
}

/* Card sub-blocks inside Tabs */
.card-sub-block {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 14px;
}

.task-add-form h4 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-sub);
    margin-bottom: 8px;
}

.form-row {
    margin-bottom: 8px;
}
.form-row:last-child {
    margin-bottom: 0;
}

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

/* Form Inputs styling */
input[type="text"], select {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 0.8rem;
    outline: none;
    transition: var(--transition-smooth);
}

input[type="text"]:focus, select:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 8px var(--secondary-glow);
}

/* Task list master styling */
.task-master-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-tabs-mini {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px;
    border-radius: 6px;
}

.mini-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.mini-tab.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: var(--shadow-inset);
}

.task-master-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
}

.master-task-item {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
}

.master-task-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.master-task-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-delete-task {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
}
.btn-delete-task:hover {
    color: #ef4444;
}

/* --- Common Button Styles --- */
.btn {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary) 0%, #ff5100 100%);
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
}
.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--primary-glow);
}

.secondary-btn {
    background: linear-gradient(135deg, var(--secondary) 0%, #00d2fe 100%);
    color: var(--bg-dark);
    box-shadow: 0 4px 12px var(--secondary-glow);
}
.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--secondary-glow);
}

.outline-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-sub);
}
.outline-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--text-sub);
    color: var(--text-main);
}

.danger-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}
.danger-btn:hover {
    background: #ef4444;
    color: #fff;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}
.icon-btn:hover {
    color: var(--secondary);
    border-color: var(--secondary);
    background: rgba(0, 242, 254, 0.05);
}

.nav-arrow-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 6px;
    transition: var(--transition-smooth);
}
.nav-arrow-btn:hover {
    color: var(--secondary);
}

/* Utilities */
.font-sm { font-size: 0.8rem; }
.font-xs { font-size: 0.65rem; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 10px; }
.flex-1 { flex: 1; }

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    width: 90%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}
.modal-close-btn:hover {
    color: var(--text-main);
}

.modal-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 14px;
}
.modal-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.modal-section h4 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-sub);
    margin-bottom: 10px;
}

/* Switch Container */
.switch-container {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}
.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}
.switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-sub);
    transition: .4s;
    border-radius: 50%;
}
input:checked + .switch-slider {
    background-color: var(--secondary-glow);
    border-color: var(--secondary);
}
input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: var(--secondary);
}

/* Danger Section inside modal */
.danger-section {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.1);
    border-radius: 12px;
    padding: 12px;
}

/* --- Popovers --- */
.popover-card {
    position: absolute;
    z-index: 150;
    width: 280px;
    background: rgba(18, 25, 41, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: opacity 0.2s ease-out;
}

.popover-card.hidden {
    opacity: 0;
    pointer-events: none;
}

.popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popover-close-btn {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
}

#popover-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
}

#popover-desc {
    font-size: 0.75rem;
    color: var(--text-sub);
    line-height: 1.45;
}

/* --- Footer --- */
.app-footer {
    text-align: center;
    padding: 16px 24px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.footer-notice {
    margin: 0;
    line-height: 1.5;
}

.footer-legal {
    display: flex;
    gap: 12px;
    align-items: center;
}

.footer-legal a {
    color: var(--text-sub);
    text-decoration: none;
    transition: var(--transition-smooth);
}

.footer-legal a:hover {
    color: var(--secondary);
    text-shadow: 0 0 8px var(--secondary-glow);
}

.footer-separator {
    color: rgba(255, 255, 255, 0.1);
}

.footer-copyright {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 200;
}

/* --- Responsive Adjustments for Tablets and Mobile --- */
@media (max-width: 768px) {
    .app-container {
        padding: 12px;
        gap: 12px;
    }

    .app-header {
        flex-direction: column;
        gap: 12px;
        align-items: center;
        padding: 12px 16px;
        text-align: center;
    }

    .header-logo {
        flex-direction: column;
        gap: 4px;
    }

    .logo-text h1 {
        font-size: 1.15rem;
    }

    .logo-subtitle {
        font-size: 0.7rem;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        gap: 12px;
    }

    .live-clock {
        font-size: 0.95rem;
        padding: 5px 10px;
    }

    .guide-banner {
        padding: 12px 16px;
    }

    .guide-title {
        font-size: 0.8rem;
    }

    .guide-steps-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .grid-card {
        padding: 16px;
        gap: 16px;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .card-header h2 {
        font-size: 1rem;
    }

    .calendar-weekdays {
        font-size: 0.7rem;
    }

    .calendar-day-cell {
        font-size: 0.75rem;
    }

    .calendar-legend {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 12px;
        font-size: 0.7rem;
    }

    .checklist-timeline {
        padding-left: 12px;
    }

    .checklist-timeline::before {
        left: 4px;
    }

    .timeline-bullet {
        left: -12px;
    }

    .timeline-card-item {
        gap: 10px;
    }

    .task-time-label {
        min-width: 40px;
        font-size: 0.8rem;
        padding-top: 8px;
    }

    .task-check-card {
        padding: 10px 12px;
        gap: 10px;
    }

    .task-card-title {
        font-size: 0.8rem;
    }

    .info-help-btn {
        font-size: 0.85rem;
        padding: 2px;
    }

    .tab-btn {
        padding: 8px;
        font-size: 0.8rem;
    }

    .model-time-row {
        padding: 8px 10px;
        gap: 8px;
    }

    .model-time-tag {
        min-width: 40px;
        font-size: 0.8rem;
    }

    .task-tag-pill {
        padding: 3px 6px;
        font-size: 0.7rem;
        gap: 4px;
    }

    .btn-add-to-hour {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }

    .modal-content {
        padding: 16px;
        gap: 16px;
        max-height: 85vh;
        overflow-y: auto;
    }

    .modal-content h3 {
        font-size: 1.1rem;
    }

    .modal-section h4 {
        font-size: 0.85rem;
    }

    .settings-row label {
        font-size: 0.8rem;
    }

    .popover-card {
        width: 260px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 8px;
        gap: 8px;
    }

    .grid-card {
        padding: 12px;
        border-radius: 12px;
    }

    .card-header h2 {
        font-size: 0.95rem;
    }

    .calendar-days-grid {
        gap: 3px;
    }

    .calendar-day-cell {
        border-radius: 6px;
    }

    .task-check-card {
        flex-direction: row;
        align-items: center;
        padding: 8px 10px;
    }

    .category-tag {
        font-size: 0.6rem;
        padding: 1px 4px;
    }
}
