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

/* ==================== Base ==================== */
html {
    background: var(--bg);
    background-attachment: fixed;
    min-height: 100%;
    transition: background 0.8s ease;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    font-family: 'Segoe UI', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    color: #fff;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 2rem 1rem 4rem;
}

/* ==================== Theme variables ==================== */
html.theme-midnight {
    --bg: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    --accent: #ffd200;
    --accent2: #f7971e;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-muted: #aaa;
    --particle-color: rgba(255, 210, 0, 0.3);
}

html.theme-sunset {
    --bg: linear-gradient(135deg, #1a0a2e, #6b1d5e, #e94560);
    --accent: #ff6b6b;
    --accent2: #feca57;
    --card-bg: rgba(255, 255, 255, 0.07);
    --card-border: rgba(255, 255, 255, 0.12);
    --text-muted: #cba;
    --particle-color: rgba(255, 107, 107, 0.3);
}

html.theme-ocean {
    --bg: linear-gradient(135deg, #0a1628, #1a3a5c, #0d7377);
    --accent: #00d2ff;
    --accent2: #3a7bd5;
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-muted: #8cb4c9;
    --particle-color: rgba(0, 210, 255, 0.3);
}

html.theme-forest {
    --bg: linear-gradient(135deg, #0a1a0a, #1b4332, #2d6a4f);
    --accent: #95d5b2;
    --accent2: #52b788;
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-muted: #8fae9b;
    --particle-color: rgba(149, 213, 178, 0.3);
}

/* ==================== Layout ==================== */
.container {
    text-align: center;
    position: relative;
    z-index: 1;
    max-width: 800px;
    width: 100%;
}

h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, var(--accent2), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.target-date {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* ==================== Theme switcher ==================== */
.theme-switcher {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 0.5rem;
    z-index: 100;
}

.theme-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.theme-btn:hover { transform: scale(1.2); }
.theme-btn.active { border-color: #fff; transform: scale(1.2); }
.theme-btn[data-theme="midnight"] { background: linear-gradient(135deg, #302b63, #24243e); }
.theme-btn[data-theme="sunset"] { background: linear-gradient(135deg, #6b1d5e, #e94560); }
.theme-btn[data-theme="ocean"] { background: linear-gradient(135deg, #1a3a5c, #0d7377); }
.theme-btn[data-theme="forest"] { background: linear-gradient(135deg, #1b4332, #2d6a4f); }

/* ==================== Countdown ==================== */
.countdown {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.time-block {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    min-width: 130px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.time-block:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.time-value {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(180deg, #fff, #999);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.time-label {
    font-size: 1rem;
    color: #888;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* ==================== Stats row ==================== */
.stats-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.stat-chip {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    padding: 0.6rem 1.4rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    backdrop-filter: blur(10px);
}

.stat-chip strong {
    color: var(--accent);
}

/* ==================== Progress ==================== */
.progress-section {
    margin-top: 2.5rem;
    width: 100%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.progress-bar-bg {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    height: 16px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 50px;
    background: linear-gradient(90deg, var(--accent2), var(--accent));
    transition: width 1s ease;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ==================== Milestones ==================== */
.milestones {
    display: flex;
    justify-content: space-between;
    margin-top: 0.4rem;
    padding: 0 0.2rem;
    position: relative;
}

.milestone {
    font-size: 0.7rem;
    color: #666;
    position: relative;
    transition: color 0.3s;
}

.milestone.reached {
    color: var(--accent);
}

.milestone::before {
    content: '';
    display: block;
    width: 2px;
    height: 6px;
    background: currentColor;
    margin: 2px auto 2px;
}

.progress-text {
    margin-top: 0.5rem;
    font-size: 1rem;
    color: var(--text-muted);
}

.progress-text span {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.3rem;
}

/* ==================== Daily quote ==================== */
.daily-quote {
    margin-top: 2rem;
    padding: 1.5rem 2rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
}

.daily-quote .quote-text {
    font-size: 1.15rem;
    color: #ddd;
    font-style: italic;
    line-height: 1.6;
}

.daily-quote .quote-author {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    color: var(--accent);
}

.daily-quote-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

/* ==================== Sections grid ==================== */
.sections-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.section-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    text-align: left;
}

.section-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

/* ==================== Check-in ==================== */
.checkin-btn {
    width: 100%;
    padding: 0.9rem;
    border: 2px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-size: 1.1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.checkin-btn:hover {
    background: var(--accent);
    color: #111;
}

.checkin-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #555;
    color: #555;
}

.checkin-btn:disabled:hover {
    background: transparent;
    color: #555;
}

.checkin-info {
    margin-top: 0.8rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.streak-badge {
    display: inline-block;
    background: linear-gradient(90deg, var(--accent2), var(--accent));
    color: #111;
    font-weight: 700;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.checkin-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-top: 0.8rem;
}

.cal-day {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.cal-day.checked {
    background: var(--accent);
}

.cal-day.today {
    border: 1px solid var(--accent);
}

/* ==================== Bucket list ==================== */
.bucket-input-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.bucket-input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
}

.bucket-input:focus {
    border-color: var(--accent);
}

.bucket-input::placeholder {
    color: #666;
}

.bucket-add-btn {
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: #111;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.1rem;
    font-family: inherit;
    transition: opacity 0.2s;
}

.bucket-add-btn:hover {
    opacity: 0.8;
}

.bucket-list {
    list-style: none;
    max-height: 220px;
    overflow-y: auto;
}

.bucket-list::-webkit-scrollbar {
    width: 4px;
}

.bucket-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.bucket-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
    color: #ccc;
}

.bucket-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.bucket-item.done .bucket-text {
    text-decoration: line-through;
    opacity: 0.5;
}

.bucket-text {
    flex: 1;
}

.bucket-delete {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.3rem;
    transition: color 0.2s;
}

.bucket-delete:hover {
    color: #e94560;
}

/* ==================== Fun stats ==================== */
.fun-stats {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.fun-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.fun-stat-val {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.05rem;
}

/* ==================== Mood tracker ==================== */
.mood-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.mood-btn {
    font-size: 1.8rem;
    background: none;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 0.4rem;
    cursor: pointer;
    transition: all 0.2s;
    filter: grayscale(0.5);
}

.mood-btn:hover {
    filter: grayscale(0);
    transform: scale(1.2);
}

.mood-btn.selected {
    border-color: var(--accent);
    filter: grayscale(0);
    transform: scale(1.15);
}

.mood-history {
    display: flex;
    gap: 2px;
    justify-content: center;
    margin-top: 0.8rem;
    flex-wrap: wrap;
}

.mood-dot {
    font-size: 1rem;
}

.mood-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* ==================== Message ==================== */
.message {
    margin-top: 2rem;
    font-size: 1.3rem;
    color: #ccc;
    font-style: italic;
}

/* ==================== Celebration ==================== */
.celebration h1 {
    font-size: 4rem;
    background: linear-gradient(90deg, var(--accent2), var(--accent), var(--accent2));
    background-size: 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 2s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ==================== Confetti ==================== */
.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    z-index: 1000;
    pointer-events: none;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ==================== Floating particles ==================== */
.particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 4px; height: 4px;
    background: var(--particle-color);
    border-radius: 50%;
    animation: float linear infinite;
}

@keyframes float {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ==================== Responsive ==================== */
@media (max-width: 600px) {
    body { padding: 1.5rem 0.8rem 3rem; }
    h1 { font-size: 2rem; }
    .countdown { gap: 0.8rem; }
    .time-block {
        min-width: 70px;
        padding: 1.2rem 0.8rem;
        border-radius: 14px;
    }
    .time-value { font-size: 2.5rem; }
    .time-label { font-size: 0.75rem; }
    .message { font-size: 1rem; }
    .sections-grid { grid-template-columns: 1fr; }
    .stats-row { gap: 0.5rem; }
    .stat-chip { font-size: 0.8rem; padding: 0.5rem 1rem; }
    .theme-switcher { top: 0.8rem; right: 0.8rem; }
}
