:root {
    --bg: #faf9f7;
    --text: #1a1a1a;
    --subtle: #b5b0a9;
    --muted: #d4cfc8;
    --faint: #f0eeeb;
    --line: rgba(26, 26, 26, 0.07);
    --line-warm: rgba(26, 26, 26, 0.14);
    --warm: #c4a882;
    --warm-soft: #d4b892;
    --warm-faint: rgba(196, 168, 130, 0.07);
    --warm-glow: rgba(196, 168, 130, 0.25);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

[data-theme="dark"] {
    --bg: #111110;
    --text: #e8e5e1;
    --subtle: #5a5652;
    --muted: #3a3835;
    --faint: #1a1918;
    --line: rgba(255, 255, 255, 0.06);
    --line-warm: rgba(255, 255, 255, 0.12);
    --warm: #c4a882;
    --warm-soft: #b49872;
    --warm-faint: rgba(196, 168, 130, 0.05);
    --warm-glow: rgba(196, 168, 130, 0.15);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(196, 168, 130, 0.15);
}

[data-theme="dark"] ::selection {
    background: rgba(196, 168, 130, 0.2);
}

html {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.7;
    font-weight: 300;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 0 28px;
    -ms-overflow-style: none;
    scrollbar-width: none;
    transition: background-color 0.6s ease, color 0.6s ease;
}

body::-webkit-scrollbar {
    display: none;
}


/* ── layout ── */

.container {
    width: 100%;
    max-width: 460px;
    padding: 16vh 0 14vh;
    position: relative;
}


/* ── staggered reveal ── */

.reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 1s ease, transform 1s ease;
}

.reveal.show {
    opacity: 1;
    transform: translateY(0);
}


/* ── header ── */

.header {
    margin-bottom: 6vh;
}

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

.title {
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.08em;
    transition: color 0.5s ease;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 8px;
}

.date {
    font-size: 12px;
    font-weight: 300;
    color: var(--subtle);
    letter-spacing: 0.02em;
    transition: color 0.5s ease;
}

.dot {
    font-size: 12px;
    color: var(--muted);
    margin: 0 6px;
    transition: color 0.5s ease;
}

.greeting {
    font-size: 12px;
    font-weight: 300;
    color: var(--subtle);
    letter-spacing: 0.02em;
    transition: color 0.5s ease;
}


/* ── theme toggle (✦ sparkle) ── */

.toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    outline: none;
    font-size: 14px;
    line-height: 1;
    color: var(--muted);
    transition: color 0.4s ease, transform 0.3s ease, text-shadow 0.4s ease;
    flex-shrink: 0;
    -webkit-text-stroke: 0;
}

.toggle:hover {
    color: var(--warm);
    transform: scale(1.2) rotate(15deg);
    text-shadow: 0 0 8px var(--warm-glow);
}

.toggle:active {
    transform: scale(0.85) rotate(-10deg);
}

/* light mode: outline-ish (faded) */
/* dark mode: filled (bright) */
[data-theme="dark"] .toggle {
    color: var(--warm);
    text-shadow: 0 0 6px var(--warm-glow);
}

[data-theme="dark"] .toggle:hover {
    color: var(--warm-soft);
    text-shadow: 0 0 12px var(--warm-glow);
}


/* ── alive section ── */

.alive {
    margin-bottom: 5vh;
}

.pulse {
    font-size: 15px;
    font-weight: 300;
    letter-spacing: 0.02em;
    font-style: italic;
    color: var(--subtle);
    animation: breathe 6s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 0.7; }
}


/* ── journal input ── */

.journal {
    margin-bottom: 36px;
}

.input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font);
    font-size: 16px;
    font-weight: 300;
    line-height: 1.7;
    color: var(--text);
    caret-color: var(--warm);
    padding: 0;
    letter-spacing: 0.01em;
    transition: color 0.5s ease;
}

.input::placeholder {
    color: var(--subtle);
    font-weight: 300;
    opacity: 1;
    transition: opacity 0.5s ease, color 0.5s ease;
}

.input:focus::placeholder {
    color: var(--muted);
}

.input.cycling::placeholder {
    opacity: 0;
}

.line {
    height: 1px;
    background: var(--line);
    margin-top: 12px;
    transition: background-color 0.6s ease;
}

.input:focus ~ .line {
    background: var(--line-warm);
}


/* ── blessing count (below input) ── */

.count {
    font-size: 11px;
    font-weight: 300;
    color: var(--muted);
    letter-spacing: 0.04em;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.6s ease, color 0.5s ease, transform 0.3s ease;
    transform: translateY(2px);
}

.count.visible {
    opacity: 1;
    transform: translateY(0);
}

.count.pulse-count {
    animation: countPulse 0.4s ease;
}

@keyframes countPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}


/* ── entries ── */

.entries {
    display: flex;
    flex-direction: column;
}

.entry {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    font-size: 15px;
    font-weight: 300;
    line-height: 1.65;
    letter-spacing: 0.01em;
    padding: 13px 0 12px;
    border-bottom: 1px solid var(--line);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.8s ease, transform 0.8s ease, color 0.5s ease, border-color 0.5s ease;
    cursor: default;
}

.entry:last-child {
    border-bottom: 1px solid var(--line);
}

.entry.show {
    transform: translateY(0);
}

/* warm glow for freshly added entries */
.entry.fresh {
    animation: freshGlow 2s ease forwards;
}

@keyframes freshGlow {
    0% { color: var(--warm-soft); }
    100% { color: var(--text); }
}

.entry.removing {
    opacity: 0 !important;
    transform: translateY(-4px);
    filter: blur(3px);
    transition: all 2s ease;
}

.entry-text {
    flex: 1;
    min-width: 0;
}

.entry-time {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.02em;
    transition: color 0.5s ease;
    white-space: nowrap;
}


/* ── empty state ── */

.empty-state {
    font-size: 13px;
    font-weight: 300;
    color: var(--subtle);
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 1s ease;
    line-height: 1.8;
    padding: 16px 0;
    text-align: center;
}

.empty-state.visible {
    opacity: 0.45;
}


/* ── reset note ── */

.reset-note {
    font-size: 11px;
    font-weight: 300;
    color: var(--muted);
    letter-spacing: 0.03em;
    text-align: center;
    margin-top: 48px;
    transition: color 0.5s ease;
}


/* ── milestone toast ── */

.milestone {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 300;
    color: var(--warm);
    letter-spacing: 0.03em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease, transform 0.6s ease;
    z-index: 100;
    white-space: nowrap;
}

.milestone.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* ── sparkle canvas ── */

.sparkle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99;
}


/* ── mobile ── */

@media (max-width: 600px) {
    body {
        padding: 0 24px;
    }

    .container {
        padding: 12vh 0 8vh;
    }

    .header {
        margin-bottom: 5vh;
    }

    .alive {
        margin-bottom: 4vh;
    }

    .entry {
        padding: 11px 0 10px;
    }

    .reset-note {
        margin-top: 36px;
    }
}