/* Grateful Journal – phone-first, no page scroll, fits one screen */

/* ============================
   ROOT / LAYOUT SHELL
   ============================ */
#root {
    width: 100%;
    height: var(--vh, 100dvh);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ============================
   PAGE LOADER (swaying tree)
   ============================ */
.page-loader {
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef6ee;
}

[data-theme="dark"] .page-loader {
    background: #0a0a0a;
}

.page-loader--transparent,
[data-theme="dark"] .page-loader--transparent,
[data-theme="liquid-glass"] .page-loader--transparent {
    background: transparent;
}

.page-loader__tree {
    transform-origin: center bottom;
    animation: tree-sway 1.8s ease-in-out infinite alternate;
}

@keyframes tree-sway {
    from { transform: rotate(-5deg); }
    to   { transform: rotate(5deg); }
}

/* ============================
   LOGIN PAGE
   ============================ */

/* ── Login page — two-panel layout ─────────────────────── */
.lp {
    height: 100dvh;
    display: grid;
    grid-template-columns: 55% 45%;
    overflow: hidden;
    background: linear-gradient(160deg, #eef6ee 0%, #dcfce7 100%);
}

/* ── Left: animated tree hero ───────────────────────────── */
.lp__hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
}

.lp__hero-words {
    text-align: center;
    z-index: 1;
}

.lp__quote {
    font-family: "Sniglet", system-ui;
    font-size: 1.625rem;
    font-weight: 700;
    color: #16a34a;
    margin: 0 0 0.4rem;
    opacity: 0;
    animation: lp-rise 0.9s ease-out 3.0s forwards;
}

.lp__subquote {
    font-size: 0.9375rem;
    color: #22c55e;
    margin: 0;
    opacity: 0;
    animation: lp-rise 0.9s ease-out 3.35s forwards;
}

/* ── Right: login panel ─────────────────────────────────── */
.lp__panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.lp__form {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    background: var(--color-surface);
    border-radius: 24px;
    border-top: 4px solid #22c55e;
    padding: 2rem 1.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.lp__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
    animation: lp-rise 0.7s ease-out 0.1s both;
}

.lp__icon {
    font-size: 3.25rem;
    line-height: 1;
    animation: lp-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s both;
}

.lp__title {
    margin: 0;
    font-size: 2.25rem;
    font-weight: 700;
    color: #22c55e;
    font-family: "Sniglet", system-ui;
    letter-spacing: -0.02em;
    text-align: center;
}

.lp__tagline {
    margin: 0;
    color: #4b505a;
    font-size: 0.9375rem;
    text-align: center;
    line-height: 1.65;
    animation: lp-rise 0.7s ease-out 0.25s both;
}

.lp__actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: lp-rise 0.7s ease-out 0.4s both;
}

.lp__privacy {
    margin: 0;
    font-size: 0.8rem;
    color: #6d727a;
    text-align: center;
}

.lp__error {
    margin: 0;
    padding: 0.625rem 0.75rem;
    color: #b91c1c;
    font-size: 0.875rem;
    background: #fef2f2;
    border-radius: 8px;
    text-align: left;
}

/* kept for other callers */
.login-card__error {
    margin: 0;
    padding: 0.625rem 0.75rem;
    color: #b91c1c;
    font-size: 0.875rem;
    background: #fef2f2;
    border-radius: 8px;
    text-align: left;
}

/* ── Tree animation ─────────────────────────────────────── */
.tree-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-svg {
    width: 100%;
    max-width: 290px;
    height: auto;
    overflow: visible;
}

.t-trunk {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: t-draw 0.95s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.t-root {
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    animation: t-draw 0.55s ease-out forwards;
}

.t-branch {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: t-draw 0.65s ease-out forwards;
}

@keyframes t-draw {
    to { stroke-dashoffset: 0; }
}

.t-leaf {
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(0);
    opacity: 0;
    animation: t-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes t-pop {
    0%   { transform: scale(0);    opacity: 0; }
    60%  { transform: scale(1.18); opacity: 1; }
    100% { transform: scale(1);    opacity: 1; }
}

.t-canopy {
    transform-origin: 140px 412px;
    animation: t-sway 5.5s ease-in-out 3.4s infinite;
}

@keyframes t-sway {
    0%, 100% { transform: rotate(0deg); }
    28%      { transform: rotate(1.8deg); }
    72%      { transform: rotate(-1.5deg); }
}

.t-particle {
    opacity: 0;
    animation: t-float linear infinite;
}

@keyframes t-float {
    0%   { transform: translateY(0) translateX(0);    opacity: 0;   }
    8%   { opacity: 0.7; }
    88%  { opacity: 0.35; }
    100% { transform: translateY(-380px) translateX(28px); opacity: 0; }
}

/* ── Login animations ───────────────────────────────────── */
@keyframes lp-rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0);    }
}

@keyframes lp-pop {
    from { opacity: 0; transform: scale(0.55); }
    to   { opacity: 1; transform: scale(1);    }
}

/* ── Login responsive — phones (≤ 640px) ───────────────── */
@media (max-width: 640px) {
    /* Stack vertically: tree hero on top, login below */
    .lp {
        grid-template-columns: 1fr;
        grid-template-rows: 56vh 1fr;
    }

    .lp__hero {
        padding: 1.5rem 1rem;
        gap: 1rem;
        justify-content: center;
    }

    /* Slightly smaller tree so it fits within the hero panel */
    .tree-svg {
        max-width: 220px;
    }

    .lp__quote {
        font-size: 1.2rem;
        margin-bottom: 0.2rem;
    }

    .lp__subquote {
        font-size: 0.8125rem;
    }

    .lp__panel {
        padding: 1.25rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
        border-left: none;
        overflow-y: auto;
        align-items: center;
    }

    .lp__form {
        max-width: 420px;
        gap: 1.25rem;
        padding: 1.75rem 1.5rem;
    }

    .lp__title {
        font-size: 1.875rem;
    }

    .lp__icon {
        font-size: 2.5rem;
    }

    .lp__tagline {
        font-size: 0.875rem;
        line-height: 1.55;
    }
}

/* ── Login responsive — small phones (≤ 390px, e.g. iPhone SE) */
@media (max-width: 390px) {
    .lp {
        grid-template-rows: 50vh 1fr;
    }

    .tree-svg {
        max-width: 190px;
    }

    .lp__quote {
        font-size: 1.05rem;
    }

    .lp__subquote {
        font-size: 0.75rem;
    }

    .lp__panel {
        padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
    }

    .lp__form {
        padding: 1.5rem 1.25rem;
    }

    .lp__title {
        font-size: 1.625rem;
    }

    .lp__icon {
        font-size: 2rem;
    }

    .lp__form {
        gap: 1rem;
    }

    .lp__tagline {
        font-size: 0.8125rem;
    }
}

.google-sign-in-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #3c4043;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 10px;
    cursor: pointer;
    transition:
        background 0.2s,
        box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.google-sign-in-btn:hover:not(:disabled) {
    background: #f8f9fa;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
}
.google-sign-in-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.google-sign-in-btn__logo {
    flex-shrink: 0;
}

.home-login-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    color: #fff;
    background: #22c55e;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
}
.home-login-link:hover {
    background: #16a34a;
}

/* ============================
   SHARED PAGE SHELL
   Pages fill #root (100dvh) as flex children – no page-level scroll
   ============================ */
.home-page,
.history-page,
.settings-page {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #eef6ee;
}

/* ============================
   HOME / WRITE PAGE
   ============================ */
.journal-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.25rem calc(88px + env(safe-area-inset-bottom));
}

.journal-container::-webkit-scrollbar {
    display: none;
}

.journal-card {
    background: var(--color-surface);
    border-radius: 20px;
    padding: 1.625rem 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.journal-date {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: #22c55e;
    text-transform: uppercase;
    font-family: "Sniglet", system-ui;
    margin: 0 0 1rem;
}

.journal-prompt {
    margin: 0 0 1.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1a1a1a;
    letter-spacing: -0.02em;
    font-family: "Sniglet", system-ui;
}

.journal-writing-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.journal-title-input {
    width: 100%;
    padding: 0 0 0.875rem;
    font-family: "Sniglet", system-ui;
    font-size: 1rem;
    font-weight: 400;
    color: #374151;
    background: transparent;
    border: none;
    border-bottom: 1px solid #e0f0e0;
    outline: none;
    transition: border-color 0.2s;
}

.journal-title-input::placeholder {
    color: #8a8480;
}
.journal-title-input:focus {
    border-bottom-color: #22c55e;
}

.journal-entry-textarea {
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 0.875rem 0;
    font-family: "Sniglet", system-ui;
    font-size: 1rem;
    line-height: 1.75;
    color: #374151;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    caret-color: #374151;
}

.journal-entry-textarea::placeholder {
    color: #8a8480;
    font-style: italic;
}

.journal-write-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.625rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    background: #22c55e;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    font-family: "Sniglet", system-ui;
    white-space: nowrap;
}

.journal-write-btn:hover:not(:disabled) {
    background: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.4);
}
.journal-write-btn:active:not(:disabled) {
    transform: translateY(0);
}
.journal-write-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Save success animations ──────────────────────────────── */

/* Card glows green on save */
.journal-card {
    position: relative;
}

.journal-card--saved {
    animation: save-card-glow 0.7s ease-out forwards;
}

@keyframes save-card-glow {
    0%   { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07); }
    35%  { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35), 0 6px 32px rgba(34, 197, 94, 0.22); }
    100% { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07); }
}

/* Button pops into a checkmark */
.journal-write-btn--saved {
    pointer-events: none;
    animation: save-btn-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes save-btn-pop {
    0%   { transform: scale(0.88); }
    60%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Leaf burst particles */
.save-leaves {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
    pointer-events: none;
    z-index: 10;
}

.save-leaf {
    position: absolute;
    font-size: 1.65rem;
    line-height: 1;
    opacity: 0;
    animation: save-leaf-float 1.9s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes save-leaf-float {
    0%   {
        transform: translateY(0) translateX(0) rotate(0deg) scale(0.6);
        opacity: 0;
    }
    12%  { opacity: 1; transform: translateY(-27px) translateX(calc(var(--leaf-dx) * 0.1)) rotate(calc(var(--leaf-rot) * 0.1)) scale(1); }
    85%  { opacity: 0.5; }
    100% {
        transform: translateY(-285px) translateX(var(--leaf-dx)) rotate(var(--leaf-rot)) scale(0.4);
        opacity: 0;
    }
}

/* Affirmation quote — centered, appears after book animation */
.save-inline-quote {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0 auto;
    padding: 0.875rem 1.5rem;
    min-height: 66px;
    border-radius: 100px;
    background: #f0fdf4;
    border: 1.5px solid #bbf7d0;
    font-family: "Sniglet", system-ui;
    font-size: 1.3125rem;
    font-weight: 600;
    color: #15803d;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    opacity: 0;
    animation: save-inline-quote-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@media (max-width: 479px) {
    .save-inline-quote {
        font-size: 1rem;
        min-height: 52px;
        border-radius: 20px;
    }
}

@media (min-width: 480px) {
    .save-inline-quote {
        width: fit-content;
        white-space: nowrap;
        padding: 0 1.875rem;
    }
}

@keyframes save-inline-quote-in {
    0%   { opacity: 0; transform: scale(0.88) translateY(4px); }
    100% { opacity: 1; transform: scale(1)    translateY(0);   }
}

.journal-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    color: #6d727a;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.journal-icon-btn:hover {
    color: #4b505a;
    background: rgba(0, 0, 0, 0.05);
}

/* ============================
   SAVE BOOK ANIMATION OVERLAY
   ============================ */

.sba-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(238, 246, 238, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation:
        sba-overlay-in  0.3s ease forwards,
        sba-overlay-out 0.4s ease 2.5s forwards;
}

@keyframes sba-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes sba-overlay-out {
    to { opacity: 0; }
}

.sba-wrap {
    animation: sba-wrap-in 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes sba-wrap-in {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.sba-svg {
    width: min(280px, 74vw);
    height: auto;
    overflow: visible;
}

/* Shadow gently expands when book closes */
.sba-shadow {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: sba-shadow-grow 0.4s ease 1.95s forwards;
}
@keyframes sba-shadow-grow {
    0%   { transform: scaleX(1);    opacity: 1; }
    50%  { transform: scaleX(1.18); opacity: 1; }
    100% { transform: scaleX(1);    opacity: 1; }
}

/* Writing lines draw via stroke-dashoffset */
.sba-line {
    stroke-dasharray: 76;
    stroke-dashoffset: 76;
}
.sba-line-1 { animation: sba-line-draw 0.28s ease forwards 0.35s; }
.sba-line-2 { animation: sba-line-draw 0.28s ease forwards 0.65s; }
.sba-line-3 { animation: sba-line-draw 0.25s ease forwards 0.95s; }
.sba-line-4 { animation: sba-line-draw 0.22s ease forwards 1.2s;  }

@keyframes sba-line-draw {
    to { stroke-dashoffset: 0; }
}

/* Pen moves down through each line then flies off */
.sba-pen {
    animation: sba-pen-write 1.12s ease forwards 0.3s;
}
@keyframes sba-pen-write {
    0%   { transform: translate(208px, 42px) rotate(20deg); opacity: 1; }
    17%  { transform: translate(208px, 42px) rotate(20deg); opacity: 1; }
    28%  { transform: translate(208px, 64px) rotate(20deg); opacity: 1; }
    45%  { transform: translate(208px, 64px) rotate(20deg); opacity: 1; }
    57%  { transform: translate(198px, 86px) rotate(20deg); opacity: 1; }
    72%  { transform: translate(198px, 86px) rotate(20deg); opacity: 1; }
    82%  { transform: translate(191px, 108px) rotate(20deg); opacity: 1; }
    94%  { transform: translate(191px, 108px) rotate(20deg); opacity: 1; }
    100% { transform: translate(244px, 148px) rotate(20deg); opacity: 0; }
}

/* Left page folds toward the spine (right edge) */
.sba-left-group {
    transform-box: fill-box;
    transform-origin: 100% 50%;
    animation: sba-fold 0.42s cubic-bezier(0.4, 0, 0.9, 0.6) 1.45s forwards;
}

/* Right page folds toward the spine (left edge) */
.sba-right-group {
    transform-box: fill-box;
    transform-origin: 0% 50%;
    animation: sba-fold 0.42s cubic-bezier(0.4, 0, 0.9, 0.6) 1.57s forwards;
}

@keyframes sba-fold {
    to { transform: scaleX(0); opacity: 0; }
}

/* Spine fades as pages close */
.sba-spine {
    animation: sba-fade 0.3s ease 1.65s forwards;
}

@keyframes sba-fade {
    to { opacity: 0; }
}

/* Closed book springs in */
.sba-closed-book {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    opacity: 0;
    transform: scale(0.78);
    animation: sba-closed-in 0.48s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1.95s forwards;
}
@keyframes sba-closed-in {
    to { opacity: 1; transform: scale(1); }
}

/* Checkmark draws itself on the cover */
.sba-check {
    stroke-dasharray: 135;
    stroke-dashoffset: 135;
    animation: sba-line-draw 0.55s ease forwards 2.3s;
}

/* Dark mode */
[data-theme="dark"] .sba-overlay {
    background: rgba(10, 18, 10, 0.76);
}
[data-theme="dark"] .sba-left-group rect {
    fill: #1a2e1a;
    stroke: #2d4a2d;
}
[data-theme="dark"] .sba-left-group line {
    stroke: #2d4a2d;
}
[data-theme="dark"] .sba-right-group rect {
    fill: #162416;
    stroke: #2d4a2d;
}

/* ============================
   BOTTOM NAVIGATION — Static flex item, always at bottom
   ============================ */
.bottom-nav {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border-radius: 100px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.13), 0 1px 4px rgba(0, 0, 0, 0.07);
    padding: 6px;
    display: flex;
    align-items: center;
    gap: 2px;
    z-index: 100;
    /* prevent layout from reserving space for it */
    flex-shrink: 0;
    width: max-content;
}

.bottom-nav-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    color: #6d727a;
    transition: all 0.18s ease;
    min-height: 44px;
    font-family: "Sniglet", system-ui;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-btn svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    stroke-width: 2;
}

.bottom-nav-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.bottom-nav-avatar-placeholder {
    background: var(--color-primary, #22c55e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
}

.bottom-nav-btn-active .bottom-nav-avatar {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

.bottom-nav-btn span {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    display: none;
}

.bottom-nav-btn:hover {
    color: #4b505a;
}

.bottom-nav-btn-active {
    background: #22c55e;
    color: #fff;
    padding: 10px 18px;
}

.bottom-nav-btn span,
.bottom-nav-btn-active span {
    display: none;
}
.bottom-nav-btn-active:hover {
    background: #16a34a;
    color: #fff;
}

/* Brand element – hidden on mobile, shown in sidebar on desktop */
.bottom-nav-brand {
    display: none;
}

/* ============================
   HISTORY PAGE
   ============================ */
.history-header {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 1.25rem 0;
}

.history-header-text h1 {
    margin: 0 0 0.15rem;
    font-size: 1.625rem;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.02em;
    font-family: "Sniglet", system-ui;
}

.history-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: #4b505a;
    font-family: "Sniglet", system-ui;
}

.history-search-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    cursor: pointer;
    color: #4b505a;
    transition: all 0.2s ease;
}
.history-search-btn:hover {
    background: #f9fafb;
    color: #374151;
}

/* scrollable content area for history */
.history-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 1rem 1.25rem calc(88px + env(safe-area-inset-bottom));
}
.history-container::-webkit-scrollbar {
    display: none;
}

/* Calendar */
.calendar-card {
    background: var(--color-surface);
    border-radius: 18px;
    padding: 1.125rem 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.125rem;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.calendar-month {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    color: #1a1a1a;
    font-family: "Sniglet", system-ui;
}

.calendar-nav {
    display: flex;
    gap: 2px;
}

.calendar-nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #6d727a;
    transition: all 0.15s ease;
}
.calendar-nav-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

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

.calendar-weekday {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #6d727a;
    text-align: center;
    padding: 4px 0;
    font-family: "Sniglet", system-ui;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 400;
    color: #374151;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: "Sniglet", system-ui;
}

.calendar-day-empty {
    cursor: default;
}
.calendar-day:not(.calendar-day-empty):hover {
    background: #f0fdf4;
    color: #22c55e;
}

.calendar-day-has-entry {
    background: #dcfce7;
    color: #22c55e;
    font-weight: 600;
}
.calendar-day-has-entry:hover {
    background: #bbf7d0;
}

.calendar-day-today {
    background: #22c55e;
    color: #fff;
    font-weight: 700;
}
.calendar-day-today:hover {
    background: #16a34a;
}

.calendar-day-selected {
    box-shadow: inset 0 0 0 2px #1be62c;
}
.calendar-day-selected:not(.calendar-day-today):not(.calendar-day-has-entry) {
    background: #f0fdf4;
    color: #1be62c;
}

/* Recent Entries */
.recent-entries {
    margin-bottom: 1rem;
}

.recent-entries-title {
    margin: 0 0 0.75rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #6d727a;
    text-transform: uppercase;
    font-family: "Sniglet", system-ui;
}

.entries-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.entry-card {
    background: var(--color-surface);
    padding: 1rem 1rem 1rem 0.875rem;
    border-radius: 14px;
    border-left: 4px solid #22c55e;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}
.entry-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.09);
}

.entry-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.entry-edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 7px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #3b82f6;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
    padding: 0;
    flex-shrink: 0;
}
.entry-edit-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.entry-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 7px;
    border: 1px solid #fee2e2;
    background: #fff5f5;
    color: #ef4444;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
    padding: 0;
    flex-shrink: 0;
}
.entry-delete-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.375rem;
    gap: 0.5rem;
}

.entry-date {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #4b505a;
    text-transform: uppercase;
    font-family: "Sniglet", system-ui;
}

.entry-time {
    font-size: 0.6875rem;
    color: #6d727a;
    font-family: "Sniglet", system-ui;
}

.entry-title {
    margin: 0 0 0.3rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    font-family: "Sniglet", system-ui;
}

.entry-preview {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #4b505a;
    font-family: "Sniglet", system-ui;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================
   SETTINGS PAGE
   ============================ */
.settings-header {
    flex-shrink: 0;
    padding: 1.5rem 1.25rem 0;
}

.settings-header-text h1 {
    margin: 0 0 0.2rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.02em;
    font-family: "Sniglet", system-ui;
}

.settings-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: #4b505a;
    font-family: "Sniglet", system-ui;
}

/* scrollable content area for settings */
.settings-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 1rem 1.25rem calc(88px + env(safe-area-inset-bottom));
}
.settings-container::-webkit-scrollbar {
    display: none;
}

/* Profile */
.settings-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    background: var(--color-surface);
    border-radius: 18px;
    padding: 1rem 1.125rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.settings-avatar {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.settings-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.settings-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #86efac 0%, #22c55e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.settings-profile-info {
    flex: 1;
    min-width: 0;
}

.settings-profile-name {
    margin: 0 0 0.15rem;
    font-size: 1.0625rem;
    font-weight: 700;
    color: #1a1a1a;
    font-family: "Sniglet", system-ui;
}

.settings-profile-email {
    margin: 0;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-family: "Sniglet", system-ui;
}

.settings-profile-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #fff;
    background: #22c55e;
    border-radius: 100px;
    font-family: "Sniglet", system-ui;
    text-transform: uppercase;
}

.settings-edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: #f0fdf4;
    color: #22c55e;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.settings-edit-btn:hover {
    background: #dcfce7;
}

.edit-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 1rem;
    text-align: center;
    font-family: "Sniglet", system-ui;
}

.edit-modal-avatar {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    overflow: hidden;
}

.edit-modal-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.edit-modal-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #86efac 0%, #22c55e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    font-family: "Sniglet", system-ui;
}

.edit-modal-photo-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.edit-modal-change-photo,
.edit-modal-remove-photo {
    flex: 1;
    max-width: 130px;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: "Sniglet", system-ui;
    transition: background 0.15s;
}

.edit-modal-change-photo {
    background: var(--color-accent-light, #dcfce7);
    border: 1.5px solid var(--color-primary, #22c55e);
    color: var(--color-primary, #22c55e);
}

.edit-modal-change-photo:hover {
    background: #bbf7d0;
}

.edit-modal-remove-photo {
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    color: #ef4444;
}

.edit-modal-remove-photo:hover {
    background: #fee2e2;
}

.edit-modal-save {
    flex: 1;
    padding: 0.65rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    background: #22c55e;
    color: #fff;
    transition: background 0.15s;
}

.edit-modal-save:hover:not(:disabled) {
    background: #16a34a;
}

.edit-modal-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-section {
    margin-bottom: 1rem;
}

.settings-section-title {
    margin: 0 0 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #6d727a;
    text-transform: uppercase;
    font-family: "Sniglet", system-ui;
}

.settings-card {
    background: var(--color-surface);
    border-radius: 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.125rem;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}

.settings-item-button {
    cursor: pointer;
    transition: background 0.15s ease;
}
.settings-item-button:hover {
    background: #f9fafb;
}

.settings-item-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.settings-item-icon-green {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}
.settings-item-icon-gray {
    background: rgba(107, 114, 128, 0.1);
    color: #4b505a;
}
.settings-item-icon-orange {
    background: rgba(251, 146, 60, 0.12);
    color: #f97316;
}
.settings-item-icon-blue {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}
.settings-item-icon-purple {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}

.settings-item-content {
    flex: 1;
    min-width: 0;
}

.settings-item-title {
    margin: 0 0 0.15rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1a1a1a;
    font-family: "Sniglet", system-ui;
}

.settings-item-subtitle {
    margin: 0;
    font-size: 0.75rem;
    color: #6d727a;
    font-family: "Sniglet", system-ui;
}

.settings-item-arrow {
    flex-shrink: 0;
    color: #d1d5db;
}

.settings-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 0 1.125rem;
}

/* Toggle */
.settings-toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.settings-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d1d5db;
    transition: 0.25s;
    border-radius: 100px;
}

.settings-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.25s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.settings-toggle input:checked + .settings-toggle-slider {
    background: #22c55e;
}
.settings-toggle input:checked + .settings-toggle-slider:before {
    transform: translateX(20px);
}

/* Theme dots */
.settings-theme-colors {
    display: flex;
    gap: 6px;
    margin-right: 4px;
}

.settings-theme-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.settings-theme-dot-beige {
    background: #f5f0e8;
}
.settings-theme-dot-dark {
    background: #1a1a1a;
}
.settings-theme-dot-glass {
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(209,250,229,0.7) 50%, rgba(167,243,208,0.5) 100%);
    border: 2px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.settings-theme-dot:hover:not(:disabled) {
    transform: scale(1.15);
}
.settings-theme-dot:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* See Tutorial */
.settings-tutorial-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.125rem;
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-primary, #22c55e);
    background: var(--color-surface, #fff);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: "Sniglet", system-ui;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.settings-tutorial-btn:hover {
    background: var(--color-accent-light, #dcfce7);
}

/* Clear Data */
.settings-clear-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.125rem;
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #dc2626;
    background: var(--color-surface);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: "Sniglet", system-ui;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.settings-clear-btn:hover {
    background: #fef2f2;
}

/* Sign Out */
.settings-signout-btn {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #4b505a;
    background: var(--color-surface);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: "Sniglet", system-ui;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.settings-signout-btn:hover {
    background: #f9fafb;
    color: #374151;
}

/* End-to-end encrypted badge */
.settings-enc {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    text-align: center;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: #d1d5db;
    margin: 0.75rem 0 0.5rem;
    text-transform: uppercase;
    font-family: "Sniglet", system-ui;
}

/* ============================
   ENTRY DETAIL MODAL
   ============================ */

/* Overlay – full-screen backdrop */
.entry-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
        env(safe-area-inset-bottom) env(safe-area-inset-left);
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Modal panel – bottom sheet on mobile, centred card on desktop */
.entry-modal {
    background: var(--color-surface);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.12);
    animation: modalSlideUp 0.25s ease;
    -webkit-overflow-scrolling: touch;
}

/* Header row */
.entry-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.entry-modal-meta {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.entry-modal-date {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #4b505a;
    text-transform: uppercase;
    font-family: "Sniglet", system-ui;
}

.entry-modal-time {
    font-size: 0.6875rem;
    color: #6d727a;
    font-family: "Sniglet", system-ui;
}

/* Close button */
.entry-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-min);
    height: var(--touch-min);
    border: none;
    border-radius: 50%;
    background: #f3f4f6;
    color: #4b505a;
    cursor: pointer;
    transition:
        background 0.2s,
        color 0.2s;
    flex-shrink: 0;
}
.entry-modal-close:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Title */
.entry-modal-title {
    margin: 0 0 1rem;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1a1a1a;
    font-family: "Sniglet", system-ui;
}

/* Body content */
.entry-modal-content {
    font-family: "Sniglet", system-ui;
    font-size: 1rem;
    line-height: 1.75;
    color: #374151;
}

.entry-modal-content p {
    margin: 0 0 0.75rem;
}

.entry-modal-content p:last-child {
    margin-bottom: 0;
}

.entry-modal-empty {
    color: #6d727a;
    font-style: italic;
}

/* Decrypt error state */
.entry-modal-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.875rem;
    font-family: "Sniglet", system-ui;
}

/* E2E encrypted badge */
.entry-modal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 1.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    background: var(--color-accent-light, #dcfce7);
    color: #15803d;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    font-family: "Sniglet", system-ui;
}

/* Delete confirmation modal */
.delete-confirm-modal {
    text-align: center;
    padding: 2rem 1.5rem;
}

.delete-confirm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: #fee2e2;
    color: #ef4444;
    margin: 0 auto 1rem;
}

.delete-confirm-title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    color: #111827;
    font-family: "Sniglet", system-ui;
}

.delete-confirm-body {
    color: #4b505a;
    font-size: 0.9rem;
    font-family: "Sniglet", system-ui;
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

.delete-confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.delete-confirm-cancel,
.delete-confirm-delete {
    flex: 1;
    max-width: 10rem;
    padding: 0.625rem 1rem;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-family: "Sniglet", system-ui;
    cursor: pointer;
    transition: all 0.18s ease;
    border: none;
}

.delete-confirm-cancel {
    background: #f3f4f6;
    color: #374151;
}
.delete-confirm-cancel:hover:not(:disabled) {
    background: #e5e7eb;
}

.delete-confirm-delete {
    background: #ef4444;
    color: #fff;
}
.delete-confirm-delete:hover:not(:disabled) {
    background: #dc2626;
}

.delete-confirm-cancel:disabled,
.delete-confirm-delete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Edit entry modal */
.entry-modal-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.entry-modal-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    background: #eff6ff;
    color: #3b82f6;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.entry-modal-edit:hover {
    background: #dbeafe;
    color: #2563eb;
}

.edit-entry-modal {
    padding: 1.5rem;
}

.edit-entry-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.edit-entry-title-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #111827;
    background: #f9fafb;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.edit-entry-title-input:focus {
    border-color: #6ee7b7;
    background: #fff;
}

.edit-entry-content-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-family: "Sniglet", system-ui;
    color: #374151;
    background: #f9fafb;
    outline: none;
    box-sizing: border-box;
    resize: vertical;
    line-height: 1.6;
    transition: border-color 0.2s;
}
.edit-entry-content-input:focus {
    border-color: #6ee7b7;
    background: #fff;
}
.edit-entry-content-input:disabled,
.edit-entry-title-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.edit-entry-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.edit-entry-save {
    flex: 1;
    max-width: 10rem;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    background: #10b981;
    color: #fff;
}
.edit-entry-save:hover:not(:disabled) {
    background: #059669;
}
.edit-entry-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---- Responsive: tablet+ (≥ 768px) ---- */
@media (min-width: 768px) {
    .entry-modal-overlay {
        align-items: center;
        padding: 2rem;
    }

    .entry-modal {
        border-radius: 20px;
        max-width: 560px;
        max-height: 80vh;
        padding: 1.75rem;
        animation: modalScaleIn 0.2s ease;
    }

    @keyframes modalScaleIn {
        from {
            opacity: 0;
            transform: scale(0.95);
        }
        to {
            opacity: 1;
            transform: scale(1);
        }
    }

    .entry-modal-title {
        font-size: 1.5rem;
    }
}

/* ---- Responsive: desktop (≥ 768px) ---- */
@media (min-width: 768px) {
    .entry-modal {
        max-width: 620px;
        padding: 2rem;
    }

    .entry-modal-content {
        font-size: 1.0625rem;
    }
}

/* ============================
   CONFIRM DELETE MODAL
   ============================ */
.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.15s ease;
}

.confirm-modal {
    background: #ffffff;
    border-radius: 20px;
    padding: 1.75rem;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    text-align: center;
    animation: modalScaleIn 0.2s ease;
}

.confirm-modal-icon {
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
}

.confirm-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ef4444;
    margin: 0 0 0.5rem;
}

.confirm-modal-desc {
    font-size: 0.85rem;
    color: #4b505a;
    margin: 0 0 1rem;
    line-height: 1.5;
}

.confirm-modal-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    text-align: left;
    margin: 0 0 0.375rem;
}

.confirm-modal-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s;
    margin-bottom: 1rem;
}

.confirm-modal-input:focus {
    border-color: #ef4444;
}

.confirm-modal-actions {
    display: flex;
    gap: 0.75rem;
}

.confirm-modal-cancel {
    flex: 1;
    padding: 0.65rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    background: #f3f4f6;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s;
}

.confirm-modal-cancel:hover:not(:disabled) {
    background: #e5e7eb;
}

.confirm-modal-delete {
    flex: 1;
    padding: 0.65rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    background: #ef4444;
    color: #fff;
    cursor: pointer;
    transition:
        background 0.15s,
        opacity 0.15s;
}

.confirm-modal-delete:hover:not(:disabled) {
    background: #dc2626;
}

.confirm-modal-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* iOS Install Modal */
.ios-install-modal {
    text-align: left;
}

.ios-install-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.ios-install-modal .confirm-modal-title {
    color: #1a1a1a;
    text-align: center;
}

.ios-install-subtitle {
    font-size: 0.85rem;
    color: #4b505a;
    margin: 0 0 1rem;
    text-align: center;
}

.ios-install-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ios-install-steps li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.4;
}

.ios-install-step-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================
   RESPONSIVE – DESKTOP (≥ 860px)
   Sidebar navigation + single-column content
   ============================ */
@media (min-width: 860px) {
    /* ---- Sidebar navigation ---- */
    .bottom-nav {
        position: fixed;
        left: 0;
        top: 0;
        bottom: auto;
        transform: none;
        height: 100dvh;
        width: 232px;
        border-radius: 0;
        box-shadow: none;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: 0 0.875rem 1.5rem;
        gap: 4px;
        border-top: none;
        border-right: 1px solid var(--color-border);
        background: var(--color-surface);
        z-index: 100;
    }

    /* Brand header in sidebar */
    .bottom-nav-brand {
        display: block;
        font-family: "Sniglet", system-ui;
        font-size: 1.0625rem;
        font-weight: 700;
        color: var(--color-primary);
        padding: 1.75rem calc(0.875rem + 10px) 1.25rem;
        margin: 0 -0.875rem 0.5rem;
        border-bottom: 1px solid var(--color-border);
        letter-spacing: -0.01em;
    }

    /* Nav buttons become full-width rows */
    .bottom-nav-btn {
        flex-direction: row;
        justify-content: flex-start;
        width: 100%;
        padding: 10px 14px;
        border-radius: 12px;
        min-height: 42px;
    }

    /* Always show labels in sidebar */
    .bottom-nav-btn span {
        display: inline;
    }

    .bottom-nav-avatar {
        width: 22px;
        height: 22px;
    }

    /* Active pill keeps green but full-width */
    .bottom-nav-btn-active {
        padding: 10px 14px;
    }

    /* Offset all pages for the sidebar width */
    .home-page,
    .history-page,
    .settings-page {
        margin-left: 232px;
    }

    /* ---- Write / Home page ---- */
    .journal-container {
        padding: 2.5rem 2rem;
        align-items: center;
    }

    .journal-card {
        max-width: 760px;
        width: 100%;
        align-self: center;
    }

    /* ---- History page ---- */
    .history-header {
        padding: 2rem 2.5rem 0;
    }

    .history-container {
        padding: 1.25rem 2.5rem 1.5rem;
    }

    /* ---- Settings page ---- */
    .settings-header {
        padding: 2rem 2rem 0;
        max-width: 720px;
        width: 100%;
        margin: 0 auto;
    }

    .settings-container {
        padding: 1.25rem 2rem 1.5rem;
        max-width: 720px;
        width: 100%;
        margin: 0 auto;
    }
}

/* Desktop dark theme adjustments */
@media (min-width: 860px) {
    [data-theme="dark"] .bottom-nav {
        background: var(--color-surface);
        border-right-color: rgba(74, 222, 128, 0.1);
    }

    [data-theme="dark"] .bottom-nav-brand {
        border-bottom-color: rgba(74, 222, 128, 0.1);
    }
}

/* ============================
   RESPONSIVE – WIDE DESKTOP (≥ 1100px)
   Two-column history: calendar left, entries right
   ============================ */
@media (min-width: 1100px) {
    /* Two-column layout: calendar left, entries right */
    .history-container {
        display: flex;
        flex-direction: row;
        gap: 1.5rem;
        overflow: hidden;
    }

    .calendar-card {
        flex-shrink: 0;
        width: 320px;
        align-self: flex-start;
        margin-bottom: 0;
    }

    .recent-entries {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        margin-bottom: 0;
    }

    .recent-entries::-webkit-scrollbar {
        display: none;
    }
}

/* ============================
   ALERT MESSAGES
   ============================ */
.alert-msg {
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    text-align: center;
}
.alert-msg--error {
    background-color: #fef2f2;
    color: #b91c1c;
}
.alert-msg--success {
    background-color: #f0fdf4;
    color: #15803d;
}

/* ============================
   DARK THEME
   ============================ */

/* -- Page backgrounds -- */
[data-theme="dark"] .home-page,
[data-theme="dark"] .history-page,
[data-theme="dark"] .settings-page {
    background: #0f0f0f;
}

/* -- Cards & surfaces -- */
[data-theme="dark"] .journal-card,
[data-theme="dark"] .calendar-card,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .settings-profile,
[data-theme="dark"] .entry-card {
    background: var(--color-surface);
    border-color: rgba(74, 222, 128, 0.12);
    box-shadow:
        0 2px 16px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(74, 222, 128, 0.06);
}

/* -- Primary text (headings) -- */
[data-theme="dark"] .journal-prompt,
[data-theme="dark"] .history-header-text h1,
[data-theme="dark"] .settings-header-text h1,
[data-theme="dark"] .entry-title,
[data-theme="dark"] .settings-profile-name,
[data-theme="dark"] .settings-item-title,
[data-theme="dark"] .calendar-month {
    color: #e8f5e8;
}

/* -- Input text -- */
[data-theme="dark"] .journal-title-input,
[data-theme="dark"] .journal-entry-textarea {
    color: #d1d5db;
}

[data-theme="dark"] .journal-title-input {
    border-bottom-color: #2a2a2a;
}

[data-theme="dark"] .journal-title-input:focus {
    border-bottom-color: #4ade80;
    box-shadow: 0 1px 0 0 rgba(74, 222, 128, 0.4);
}

/* -- Placeholder text -- */
[data-theme="dark"] .journal-title-input::placeholder,
[data-theme="dark"] .journal-entry-textarea::placeholder {
    color: #8a9e8a;
}

/* -- Muted text -- */
[data-theme="dark"] .journal-date,
[data-theme="dark"] .history-subtitle,
[data-theme="dark"] .settings-subtitle,
[data-theme="dark"] .entry-preview,
[data-theme="dark"] .entry-date,
[data-theme="dark"] .entry-time,
[data-theme="dark"] .settings-item-subtitle,
[data-theme="dark"] .settings-section-title,
[data-theme="dark"] .recent-entries-title,
[data-theme="dark"] .calendar-weekday {
    color: #a2ada2;
}

/* -- Green accent text brighter in dark -- */
[data-theme="dark"] .journal-date {
    color: #4ade80;
}

/* login page is always light — no dark overrides */

/* -- Calendar -- */
[data-theme="dark"] .calendar-day {
    color: #c8cdc8;
}

[data-theme="dark"] .calendar-day:not(.calendar-day-empty):hover {
    background: rgba(74, 222, 128, 0.12);
    color: #4ade80;
}

[data-theme="dark"] .calendar-day-has-entry {
    background: rgba(74, 222, 128, 0.18);
    color: #4ade80;
}

[data-theme="dark"] .calendar-day-has-entry:hover {
    background: rgba(74, 222, 128, 0.28);
}

[data-theme="dark"] .calendar-day-today {
    background: #22c55e;
    color: #fff;
}

[data-theme="dark"] .calendar-day-today:hover {
    background: #16a34a;
}

[data-theme="dark"] .calendar-day-selected {
    box-shadow: inset 0 0 0 2px #4ade80;
}

[data-theme="dark"]
    .calendar-day-selected:not(.calendar-day-today):not(
        .calendar-day-has-entry
    ) {
    background: rgba(74, 222, 128, 0.1);
    color: #4ade80;
}

[data-theme="dark"] .calendar-nav-btn:hover {
    background: rgba(74, 222, 128, 0.1);
    color: #4ade80;
}

/* -- Bottom nav -- */
[data-theme="dark"] .bottom-nav {
    background: #1e2320;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .bottom-nav-btn {
    color: #5a6a5a;
}

[data-theme="dark"] .bottom-nav-btn:hover {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.08);
}

[data-theme="dark"] .bottom-nav-btn-active {
    background: #22c55e;
    color: #fff;
}

[data-theme="dark"] .bottom-nav-btn-active:hover {
    background: #16a34a;
    color: #fff;
}

[data-theme="dark"] .bottom-nav-avatar-placeholder {
    background: #16a34a;
}

/* -- Write button -- */
[data-theme="dark"] .journal-write-btn {
    background: #22c55e;
    box-shadow:
        0 4px 16px rgba(74, 222, 128, 0.35),
        0 0 24px rgba(74, 222, 128, 0.1);
}

[data-theme="dark"] .journal-write-btn:hover:not(:disabled) {
    background: #16a34a;
    box-shadow:
        0 6px 24px rgba(74, 222, 128, 0.45),
        0 0 32px rgba(74, 222, 128, 0.15);
}

/* -- Save inline quote dark mode -- */
[data-theme="dark"] .save-inline-quote {
    background: #1e2a1e;
    border-color: rgba(74, 222, 128, 0.25);
    color: #4ade80;
}

/* -- Home login link -- */
[data-theme="dark"] .home-login-link {
    background: #22c55e;
    box-shadow: 0 2px 12px rgba(74, 222, 128, 0.25);
}

/* -- Entry card green accents -- */
[data-theme="dark"] .entry-card {
    border-left-color: #4ade80;
}

[data-theme="dark"] .entry-card:hover {
    box-shadow:
        0 6px 24px rgba(74, 222, 128, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.3);
    border-left-color: #22c55e;
}

/* -- Settings icon backgrounds -- */
[data-theme="dark"] .settings-item-icon-green {
    background: rgba(74, 222, 128, 0.12);
    color: #4ade80;
}

[data-theme="dark"] .settings-item-icon-gray {
    background: rgba(156, 163, 175, 0.1);
    color: #babfc7;
}

[data-theme="dark"] .settings-item-icon-orange {
    background: rgba(251, 146, 60, 0.12);
    color: #fb923c;
}

[data-theme="dark"] .settings-item-icon-blue {
    background: rgba(96, 165, 250, 0.12);
    color: #60a5fa;
}

[data-theme="dark"] .settings-item-icon-purple {
    background: rgba(167, 139, 250, 0.12);
    color: #a78bfa;
}

[data-theme="dark"] .ios-install-modal .confirm-modal-title {
    color: #e8f5e8;
}

[data-theme="dark"] .ios-install-steps li {
    color: #d1d5db;
}

[data-theme="dark"] .ios-install-step-icon {
    background: rgba(167, 139, 250, 0.12);
    color: #a78bfa;
}

/* -- Settings buttons -- */
[data-theme="dark"] .settings-tutorial-btn {
    background: var(--color-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .settings-tutorial-btn:hover {
    background: rgba(74, 222, 128, 0.08);
}

[data-theme="dark"] .settings-clear-btn {
    background: var(--color-surface);
    color: #f87171;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .settings-clear-btn:hover {
    background: rgba(239, 68, 68, 0.08);
}

[data-theme="dark"] .settings-signout-btn {
    background: var(--color-surface);
    color: #babfc7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .settings-signout-btn:hover {
    background: rgba(74, 222, 128, 0.06);
    color: #d1d5db;
}

/* -- Settings profile badge -- */
[data-theme="dark"] .settings-profile-badge {
    background: #16a34a;
    color: #fff;
}

[data-theme="dark"] .settings-edit-btn {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

[data-theme="dark"] .settings-edit-btn:hover {
    background: rgba(34, 197, 94, 0.25);
}

[data-theme="dark"] .edit-modal-title {
    color: #e8f5e8;
}

/* -- Settings divider -- */
[data-theme="dark"] .settings-divider {
    background: #2a2a2a;
}

/* -- Settings item hover -- */
[data-theme="dark"] .settings-item-button:hover {
    background: rgba(74, 222, 128, 0.06);
}

/* -- Settings toggle -- */
[data-theme="dark"] .settings-toggle-slider {
    background: #333;
}

[data-theme="dark"] .settings-toggle input:checked + .settings-toggle-slider {
    background: #22c55e;
}

/* -- Settings theme dot -- */
[data-theme="dark"] .settings-theme-dot {
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .settings-theme-dot-active {
    border-color: #4ade80;
    box-shadow: 0 0 0 2px #4ade80;
}

/* -- Settings enc -- */
[data-theme="dark"] .settings-enc {
    color: #3a3a3a;
}

/* -- History search button -- */
[data-theme="dark"] .history-search-btn {
    background: var(--color-surface);
    border-color: #2a2a2a;
    color: #a2ada2;
}

[data-theme="dark"] .history-search-btn:hover {
    background: rgba(74, 222, 128, 0.08);
    border-color: #4ade80;
    color: #4ade80;
}

/* -- Page loader -- */

/* -- Alert messages -- */
[data-theme="dark"] .alert-msg--error {
    background-color: rgba(185, 28, 28, 0.18);
    color: #fca5a5;
}
[data-theme="dark"] .alert-msg--success {
    background-color: rgba(21, 128, 61, 0.18);
    color: #86efac;
}

/* -- Icon btn hover -- */
[data-theme="dark"] .journal-icon-btn:hover {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

/* -- Entry modal -- */
[data-theme="dark"] .entry-modal {
    background: var(--color-surface);
    border-top-color: #4ade80;
    box-shadow:
        0 -4px 32px rgba(0, 0, 0, 0.5),
        0 -1px 0 rgba(74, 222, 128, 0.2);
}

[data-theme="dark"] .entry-modal-title {
    color: #e8f5e8;
}

[data-theme="dark"] .entry-modal-content {
    color: #c8cdc8;
}

[data-theme="dark"] .entry-modal-date {
    color: #a2ada2;
}

[data-theme="dark"] .entry-modal-time {
    color: #5a6a5a;
}

[data-theme="dark"] .entry-modal-close {
    background: #252525;
    color: #a2ada2;
}

[data-theme="dark"] .entry-modal-close:hover {
    background: rgba(74, 222, 128, 0.12);
    color: #4ade80;
}

[data-theme="dark"] .entry-modal-badge {
    background: rgba(74, 222, 128, 0.12);
    color: #4ade80;
}

[data-theme="dark"] .entry-modal-error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

[data-theme="dark"] .entry-edit-btn {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}
[data-theme="dark"] .entry-edit-btn:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] .entry-modal-edit {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
}
[data-theme="dark"] .entry-modal-edit:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

[data-theme="dark"] .entry-delete-btn {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}
[data-theme="dark"] .entry-delete-btn:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.35);
}

[data-theme="dark"] .edit-entry-title-input,
[data-theme="dark"] .edit-entry-content-input {
    background: #1a1a1a;
    border-color: #2d2d2d;
    color: #e8f5e8;
}
[data-theme="dark"] .edit-entry-title-input:focus,
[data-theme="dark"] .edit-entry-content-input:focus {
    border-color: #4ade80;
    background: #151515;
}

[data-theme="dark"] .delete-confirm-modal {
    background: var(--color-surface);
}
[data-theme="dark"] .delete-confirm-title {
    color: #e8f5e8;
}
[data-theme="dark"] .delete-confirm-body {
    color: #a2ada2;
}
[data-theme="dark"] .delete-confirm-cancel {
    background: #252525;
    color: #c8cdc8;
}
[data-theme="dark"] .delete-confirm-cancel:hover:not(:disabled) {
    background: #303030;
}

[data-theme="dark"] .entry-modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

/* -- Confirm delete modal -- */
[data-theme="dark"] .confirm-modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .confirm-modal {
    background: #1e1e1e;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .confirm-modal-title {
    color: #f87171;
}

[data-theme="dark"] .confirm-modal-desc {
    color: #a2ada2;
}

[data-theme="dark"] .confirm-modal-label {
    color: #c8cdc8;
}

[data-theme="dark"] .confirm-modal-input {
    background: #111;
    border-color: #2a2a2a;
    color: #d1d5db;
}

[data-theme="dark"] .confirm-modal-input:focus {
    border-color: #ef4444;
    background: #151515;
}

[data-theme="dark"] .confirm-modal-cancel {
    background: #252525;
    color: #babfc7;
}

[data-theme="dark"] .confirm-modal-cancel:hover:not(:disabled) {
    background: #333;
}

/* ── Reminder Modal ────────────────────────────────────────────── */

.reminder-modal-overlay {
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.reminder-modal {
    background: #ffffff;
    max-width: 340px;
    width: 100%;
    border-radius: 24px;
    max-height: none;
    overflow: visible;
    padding: 1.25rem 1.25rem 1.5rem;
}

[data-theme="dark"] .reminder-modal-overlay {
    background: rgba(0, 0, 0, 0.88);
}

[data-theme="dark"] .reminder-modal {
    background: #1c1c1e;
}

/* ── Clock Time Picker ─────────────────────────────────────────── */

.clock-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0;
}

.clock-picker__display {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.clock-picker__seg {
    background: var(--color-surface-alt, #f3f4f6);
    border: none;
    border-radius: 10px;
    font-size: 2.25rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--color-text, #111827);
    width: 3rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
    padding: 0;
}

.clock-picker__seg--active {
    background: var(--color-primary, #22c55e);
    color: #fff;
}

.clock-picker__colon {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text, #111827);
    line-height: 1;
    padding: 0 0.1rem;
    user-select: none;
}

.clock-picker__ampm {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

.clock-picker__ampm-btn {
    background: var(--color-surface-alt, #f3f4f6);
    border: 1.5px solid transparent;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--color-text-muted, #4b505a);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    letter-spacing: 0.03em;
}

.clock-picker__ampm-btn--active {
    background: var(--color-primary, #22c55e);
    color: #fff;
    border-color: var(--color-primary, #22c55e);
}

.clock-picker__face {
    width: 180px;
    height: 180px;
    display: block;
    border-radius: 50%;
    overflow: visible;
}

.clock-picker__bg {
    fill: var(--color-surface-alt, #f3f4f6);
}

.clock-picker__sector {
    fill: rgba(34, 197, 94, 0.12);
}

.clock-picker__hand {
    stroke: var(--color-primary, #22c55e);
    stroke-width: 2.5;
    stroke-linecap: round;
}

.clock-picker__center-dot {
    fill: var(--color-primary, #22c55e);
}

.clock-picker__hand-tip {
    fill: var(--color-primary, #22c55e);
}

.clock-picker__num {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    fill: var(--color-text, #111827);
    user-select: none;
    pointer-events: none;
}

.clock-picker__num--selected {
    fill: #fff;
    font-weight: 700;
}

.clock-picker__tick {
    stroke: var(--color-text-muted, #6d727a);
    stroke-width: 1.5;
    opacity: 0.4;
}

.clock-picker__modes {
    display: flex;
    gap: 0.5rem;
}

.clock-picker__mode-btn {
    background: none;
    border: 1.5px solid var(--color-border, #e5e7eb);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--color-text-muted, #4b505a);
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.clock-picker__mode-btn--active {
    background: var(--color-primary, #22c55e);
    border-color: var(--color-primary, #22c55e);
    color: #fff;
}

/* Dark mode overrides */
[data-theme="dark"] .clock-picker__seg {
    background: #2a2a2a;
    color: #f9fafb;
}

[data-theme="dark"] .clock-picker__seg--active {
    background: var(--color-primary, #4ade80);
    color: #111;
}

[data-theme="dark"] .clock-picker__colon {
    color: #f9fafb;
}

[data-theme="dark"] .clock-picker__ampm-btn {
    background: #2a2a2a;
    color: #babfc7;
}

[data-theme="dark"] .clock-picker__ampm-btn--active {
    background: var(--color-primary, #4ade80);
    color: #111;
    border-color: var(--color-primary, #4ade80);
}

[data-theme="dark"] .clock-picker__bg {
    fill: #2a2a2a;
}

[data-theme="dark"] .clock-picker__sector {
    fill: rgba(74, 222, 128, 0.12);
}

[data-theme="dark"] .clock-picker__hand {
    stroke: #4ade80;
}

[data-theme="dark"] .clock-picker__center-dot {
    fill: #4ade80;
}

[data-theme="dark"] .clock-picker__hand-tip {
    fill: #4ade80;
}

[data-theme="dark"] .clock-picker__num {
    fill: #d1d5db;
}

[data-theme="dark"] .clock-picker__num--selected {
    fill: #111;
}

[data-theme="dark"] .clock-picker__tick {
    stroke: #4b5563;
}

[data-theme="dark"] .clock-picker__mode-btn {
    border-color: #333;
    color: #babfc7;
}

/* ============================
   LIQUID GLASS THEME
   ============================ */

/* -- Pages must be transparent so body background shows through -- */
[data-theme="liquid-glass"] .home-page,
[data-theme="liquid-glass"] .history-page,
[data-theme="liquid-glass"] .settings-page {
    background: transparent;
}

/* -- Glass surface applied to all card/surface elements -- */
[data-theme="liquid-glass"] .journal-card,
[data-theme="liquid-glass"] .calendar-card,
[data-theme="liquid-glass"] .entry-card,
[data-theme="liquid-glass"] .entry-modal,
[data-theme="liquid-glass"] .settings-profile,
[data-theme="liquid-glass"] .settings-card,
[data-theme="liquid-glass"] .settings-tutorial-btn,
[data-theme="liquid-glass"] .settings-clear-btn,
[data-theme="liquid-glass"] .settings-signout-btn,
[data-theme="liquid-glass"] .bottom-nav,
[data-theme="liquid-glass"] .lp__form {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* -- Unified shadow (no individual overrides needed) -- */
[data-theme="liquid-glass"] .journal-card,
[data-theme="liquid-glass"] .calendar-card,
[data-theme="liquid-glass"] .entry-card,
[data-theme="liquid-glass"] .settings-profile,
[data-theme="liquid-glass"] .settings-card {
    box-shadow: var(--glass-shadow);
}

/* -- Bottom nav glass -- */
[data-theme="liquid-glass"] .bottom-nav {
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.5), 0 -8px 32px rgba(0, 0, 0, 0.1);
}

/* -- Text colors — dark & crisp for readability on glass -- */
[data-theme="liquid-glass"] .journal-prompt,
[data-theme="liquid-glass"] .settings-header-text h1,
[data-theme="liquid-glass"] .history-header-text h1,
[data-theme="liquid-glass"] .settings-profile-name,
[data-theme="liquid-glass"] .settings-item-title,
[data-theme="liquid-glass"] .calendar-month,
[data-theme="liquid-glass"] .entry-title {
    color: #0f172a;
}

[data-theme="liquid-glass"] .journal-date {
    color: #16a34a;
}

[data-theme="liquid-glass"] .settings-subtitle,
[data-theme="liquid-glass"] .history-subtitle,
[data-theme="liquid-glass"] .settings-item-subtitle,
[data-theme="liquid-glass"] .settings-section-title,
[data-theme="liquid-glass"] .entry-preview,
[data-theme="liquid-glass"] .entry-date,
[data-theme="liquid-glass"] .entry-time,
[data-theme="liquid-glass"] .recent-entries-title,
[data-theme="liquid-glass"] .calendar-weekday {
    color: #334155;
}

[data-theme="liquid-glass"] .journal-title-input,
[data-theme="liquid-glass"] .journal-entry-textarea {
    color: #1e293b;
}

[data-theme="liquid-glass"] .journal-title-input::placeholder,
[data-theme="liquid-glass"] .journal-entry-textarea::placeholder {
    color: rgba(30, 41, 59, 0.65);
}

[data-theme="liquid-glass"] .journal-title-input {
    border-bottom-color: rgba(255, 255, 255, 0.4);
}

[data-theme="liquid-glass"] .journal-title-input:focus {
    border-bottom-color: #16a34a;
}

/* -- Settings buttons text -- */
[data-theme="liquid-glass"] .settings-tutorial-btn {
    color: #0f172a;
}

[data-theme="liquid-glass"] .settings-clear-btn {
    color: #b91c1c;
}

[data-theme="liquid-glass"] .settings-signout-btn {
    color: #475569;
}

/* -- Settings buttons hover -- */
[data-theme="liquid-glass"] .settings-tutorial-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}
[data-theme="liquid-glass"] .settings-clear-btn:hover {
    background: rgba(254, 202, 202, 0.35);
}
[data-theme="liquid-glass"] .settings-signout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #1e293b;
}

/* -- Settings item hover -- */
[data-theme="liquid-glass"] .settings-item-button:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* -- Settings divider -- */
[data-theme="liquid-glass"] .settings-divider {
    background: rgba(255, 255, 255, 0.45);
}

/* -- Settings theme dot -- */
[data-theme="liquid-glass"] .settings-theme-dot {
    border-color: rgba(0, 0, 0, 0.12);
}
[data-theme="liquid-glass"] .settings-theme-dot-active {
    border-color: #16a34a;
    box-shadow: 0 0 0 2px #16a34a;
}

/* -- Settings icon backgrounds -- */
[data-theme="liquid-glass"] .settings-item-icon-green {
    background: rgba(34, 197, 94, 0.2);
    color: #15803d;
}
[data-theme="liquid-glass"] .settings-item-icon-gray {
    background: rgba(100, 116, 139, 0.18);
    color: #475569;
}
[data-theme="liquid-glass"] .settings-item-icon-orange {
    background: rgba(251, 146, 60, 0.2);
    color: #c2410c;
}
[data-theme="liquid-glass"] .settings-item-icon-blue {
    background: rgba(59, 130, 246, 0.18);
    color: #1d4ed8;
}
[data-theme="liquid-glass"] .settings-item-icon-purple {
    background: rgba(139, 92, 246, 0.18);
    color: #6d28d9;
}

/* -- Settings misc -- */
[data-theme="liquid-glass"] .settings-toggle-slider {
    background: rgba(0, 0, 0, 0.2);
}
[data-theme="liquid-glass"] .settings-toggle input:checked + .settings-toggle-slider {
    background: #16a34a;
}
[data-theme="liquid-glass"] .settings-item-arrow {
    color: #334155;
}
[data-theme="liquid-glass"] .settings-enc {
    color: rgba(15, 23, 42, 0.65);
}
[data-theme="liquid-glass"] .settings-edit-btn {
    background: rgba(34, 197, 94, 0.2);
    color: #15803d;
}

/* -- Calendar -- */
[data-theme="liquid-glass"] .calendar-day {
    color: #334155;
}
[data-theme="liquid-glass"] .calendar-day:not(.calendar-day-empty):hover {
    background: rgba(255, 255, 255, 0.4);
    color: #0f172a;
}
[data-theme="liquid-glass"] .calendar-day-has-entry {
    background: rgba(34, 197, 94, 0.22);
    color: #15803d;
}
[data-theme="liquid-glass"] .calendar-day-today {
    background: #16a34a;
    color: #fff;
}
[data-theme="liquid-glass"] .calendar-nav-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    color: #0f172a;
}

/* -- Entry card -- */
[data-theme="liquid-glass"] .entry-card {
    border-left-color: rgba(22, 163, 74, 0.5);
}
[data-theme="liquid-glass"] .entry-card:hover {
    background: rgba(255, 255, 255, 0.28);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

/* -- Entry modal -- */
[data-theme="liquid-glass"] .entry-modal {
    border-top-color: #16a34a;
}
[data-theme="liquid-glass"] .entry-modal-title {
    color: #0f172a;
}
[data-theme="liquid-glass"] .entry-modal-content {
    color: #1e293b;
}
[data-theme="liquid-glass"] .entry-modal-date,
[data-theme="liquid-glass"] .entry-modal-time {
    color: #475569;
}
[data-theme="liquid-glass"] .entry-modal-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #15803d;
}
[data-theme="liquid-glass"] .entry-modal-close {
    background: rgba(255, 255, 255, 0.35);
    color: #475569;
}
[data-theme="liquid-glass"] .entry-modal-close:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #0f172a;
}

/* -- Confirm/modal overlays -- */
[data-theme="liquid-glass"] .confirm-modal-overlay,
[data-theme="liquid-glass"] .entry-modal-overlay {
    background: rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* -- Modal boxes always opaque -- */
[data-theme="liquid-glass"] .confirm-modal,
[data-theme="liquid-glass"] .bg-modal {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* -- Bottom nav -- */
[data-theme="liquid-glass"] .bottom-nav-btn {
    color: #475569;
}
[data-theme="liquid-glass"] .bottom-nav-btn:hover {
    color: #15803d;
    background: rgba(255, 255, 255, 0.3);
}
[data-theme="liquid-glass"] .bottom-nav-btn-active {
    background: #16a34a;
    color: #fff;
}

/* -- Write button -- */
[data-theme="liquid-glass"] .journal-write-btn {
    background: #16a34a;
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.35);
}
[data-theme="liquid-glass"] .journal-write-btn:hover:not(:disabled) {
    background: #15803d;
    box-shadow: 0 6px 24px rgba(22, 163, 74, 0.45);
}

/* -- Desktop sidebar nav glass -- */
@media (min-width: 860px) {
    [data-theme="liquid-glass"] .bottom-nav {
        background: var(--glass-bg);
        border-right-color: rgba(255, 255, 255, 0.4);
    }
    [data-theme="liquid-glass"] .bottom-nav-brand {
        border-bottom-color: rgba(255, 255, 255, 0.4);
    }
}

[data-theme="dark"] .clock-picker__mode-btn--active {
    background: #4ade80;
    border-color: #4ade80;
    color: #111;
}

/* ── End Clock Time Picker ─────────────────────────────────────── */

/* -- Login page — light mode only, no dark theme overrides -- */

/* -- Google sign-in btn -- */
[data-theme="dark"] .google-sign-in-btn {
    background: #252525;
    border-color: #333;
    color: #d1d5db;
}

[data-theme="dark"] .google-sign-in-btn:hover:not(:disabled) {
    background: #2a2a2a;
    border-color: rgba(74, 222, 128, 0.3);
    box-shadow: 0 1px 8px rgba(74, 222, 128, 0.1);
}

/* ============================
   WELCOME MODAL
   ============================ */
.welcome-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
    animation: welcome-fade-in 0.3s ease;
}

@keyframes welcome-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes welcome-slide-up {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.welcome-modal {
    background: var(--color-surface, #ffffff);
    border-radius: 20px;
    padding: 2.5rem 2rem 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: welcome-slide-up 0.35s ease;
}

.welcome-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    background: var(--color-accent-light, #dcfce7);
    border-radius: 50%;
    color: var(--color-primary, #22c55e);
}

.welcome-modal-title {
    font-family: "Sniglet", system-ui;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--color-text, #1a1a1a);
    margin: 0 0 0.75rem;
}

.welcome-modal-text {
    font-family: "Sniglet", system-ui;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-text-muted, #4b505a);
    margin: 0 0 1.75rem;
}

.welcome-modal-btn {
    font-family: "Sniglet", system-ui;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: var(--color-primary, #22c55e);
    border: none;
    border-radius: 14px;
    padding: 0.875rem 2rem;
    width: 100%;
    cursor: pointer;
    transition:
        background 0.15s,
        transform 0.15s;
}

.welcome-modal-btn:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

.welcome-modal-btn:active {
    transform: translateY(0);
}

.welcome-modal-skip {
    font-family: "Sniglet", system-ui;
    font-size: 0.8125rem;
    color: var(--color-text-muted, #4b505a);
    background: none;
    border: none;
    cursor: pointer;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    transition: color 0.15s;
}

.welcome-modal-skip:hover {
    color: var(--color-text, #1a1a1a);
}

/* ============================
   DRIVER.JS TOUR CUSTOMIZATION
   ============================ */
.gj-tour-popover {
    font-family: "Sniglet", system-ui !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2) !important;
}

.gj-tour-popover .driver-popover-title {
    font-family: "Sniglet", system-ui !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: var(--color-text, #1a1a1a) !important;
}

.gj-tour-popover .driver-popover-description {
    font-family: "Sniglet", system-ui !important;
    font-size: 0.85rem !important;
    line-height: 1.55 !important;
    color: var(--color-text-muted, #4b505a) !important;
}

.gj-tour-popover .driver-popover-progress-text {
    font-family: "Sniglet", system-ui !important;
    font-size: 0.75rem !important;
    color: var(--color-text-muted, #4b505a) !important;
}

.gj-tour-popover .driver-popover-navigation-btns button {
    font-family: "Sniglet", system-ui !important;
    border-radius: 10px !important;
    font-size: 0.825rem !important;
    padding: 0.4rem 1rem !important;
    font-weight: 600 !important;
}

@keyframes tour-btn-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.96); }
}

.gj-tour-popover .driver-popover-next-btn {
    background: var(--color-primary, #22c55e) !important;
    color: #fff !important;
    border: none !important;
    text-shadow: none !important;
    animation: tour-btn-pulse 1.2s ease-in-out infinite !important;
}

.gj-tour-popover .driver-popover-prev-btn {
    color: var(--color-text-muted, #4b505a) !important;
    border: 1px solid var(--color-border, #d4e8d4) !important;
    background: transparent !important;
}

.gj-tour-popover .driver-popover-close-btn {
    color: var(--color-text-muted, #4b505a) !important;
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
}

.gj-tour-popover .driver-popover-close-btn:focus,
.gj-tour-popover .driver-popover-close-btn:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* -- Dark theme: welcome modal -- */
[data-theme="dark"] .welcome-modal {
    background: #1a1a1a;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* -- Dark theme: driver.js -- */
[data-theme="dark"] .gj-tour-popover {
    background: #1a1a1a !important;
    border: 1px solid rgba(74, 222, 128, 0.12) !important;
}

[data-theme="dark"] .gj-tour-popover .driver-popover-title {
    color: #e8f5e8 !important;
}

[data-theme="dark"] .gj-tour-popover .driver-popover-description {
    color: #a2ada2 !important;
}

[data-theme="dark"] .gj-tour-popover .driver-popover-prev-btn {
    border-color: rgba(74, 222, 128, 0.15) !important;
    color: #a2ada2 !important;
}

[data-theme="dark"] .gj-tour-popover .driver-popover-close-btn {
    color: #a2ada2 !important;
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* ============================
   STATIC PAGES (Privacy, About)
   ============================ */
.static-page {
    min-height: 100dvh;
    background: linear-gradient(160deg, #eef6ee 0%, #dcfce7 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.static-page__header {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid rgba(34, 197, 94, 0.2);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.static-page__logo {
    font-family: "Sniglet", system-ui;
    font-size: 1.125rem;
    font-weight: 700;
    color: #16a34a;
    text-decoration: none;
}

.static-page__content {
    flex: 1;
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
    color: #1a2e1a;
}

.static-page__content h1 {
    font-family: "Sniglet", system-ui;
    font-size: 2rem;
    font-weight: 700;
    color: #16a34a;
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

.static-page__content h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #15803d;
    margin: 2rem 0 0.75rem;
}

.static-page__content p {
    line-height: 1.7;
    margin: 0 0 1rem;
    color: #374151;
}

.static-page__content ul {
    padding-left: 1.25rem;
    margin: 0 0 1rem;
    color: #374151;
}

.static-page__content li {
    line-height: 1.7;
    margin-bottom: 0.4rem;
}

.static-page__content a {
    color: #16a34a;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.static-page__updated {
    font-size: 0.875rem;
    color: #4b505a;
    margin-bottom: 1.75rem !important;
}

.static-page__tagline {
    font-size: 1.0625rem;
    color: #22c55e;
    font-weight: 500;
    margin-bottom: 1.75rem !important;
}

.static-page__footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(34, 197, 94, 0.2);
    background: rgba(255, 255, 255, 0.4);
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.875rem;
}

.static-page__footer a {
    color: #16a34a;
    text-decoration: none;
}

.static-page__footer a:hover {
    text-decoration: underline;
}

.static-page__footer span {
    color: #6d727a;
}

/* ============================
   CUSTOM BACKGROUND IMAGE
   ============================ */
body.gj-has-bg .home-page,
body.gj-has-bg .history-page,
body.gj-has-bg .settings-page {
    background: transparent;
}

[data-theme="dark"] body.gj-has-bg .home-page,
[data-theme="dark"] body.gj-has-bg .history-page,
[data-theme="dark"] body.gj-has-bg .settings-page {
    background: transparent;
}

/* ============================
   BACKGROUND GALLERY MODAL
   ============================ */

.bg-modal {
    background: #ffffff;
    border-radius: 20px;
    padding: 1.5rem;
    width: min(440px, calc(100vw - 2rem));
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
}

/* 4-column fixed grid — no scroll */
.bg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Base tile — aspect-ratio set via inline style to match screen */
.bg-grid-tile {
    border-radius: 10px;
    border: 2.5px solid transparent;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    padding: 0;
    width: 100%;
    transition: border-color 0.15s, transform 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
}

.bg-grid-tile:hover:not(:disabled) {
    transform: scale(1.04);
}

.bg-grid-tile--active {
    border-color: var(--color-primary, #22c55e) !important;
}

/* "+" upload tile */
.bg-grid-add {
    border: 2px dashed var(--color-border, #d4e8d4);
    background: var(--color-accent-light, #dcfce7);
    color: var(--color-text-muted, #4b505a);
}

.bg-grid-add:hover:not(:disabled) {
    border-color: var(--color-primary, #22c55e);
    color: var(--color-primary, #22c55e);
}

/* Empty placeholder tile */
.bg-grid-empty {
    background: var(--color-accent-light, #dcfce7);
    border: 2px dashed var(--color-border, #d4e8d4);
    opacity: 0.4;
    cursor: default;
}

/* Thumbnail image fills the tile */
.bg-gallery-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

/* Active checkmark badge */
.bg-gallery-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary, #22c55e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Wrapper holds tile + delete button as siblings */
.bg-grid-wrapper {
    position: relative;
}

.bg-grid-wrapper .bg-grid-tile {
    width: 100%;
}

/* Delete (×) button — top-right corner of the image */
.bg-tile-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Revert to default button */
.bg-default-btn {
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    border: 1.5px solid var(--color-border, #d4e8d4);
    background: transparent;
    color: var(--color-text-muted, #4b505a);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-bottom: 0.5rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.bg-default-btn:hover:not(:disabled) {
    background: var(--color-accent-light, #dcfce7);
    border-color: var(--color-primary, #22c55e);
    color: var(--color-primary-hover, #16a34a);
}

/* Close button */
.bg-close-btn {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.7rem;
    border-radius: 12px;
    border: 1.5px solid var(--color-border, #d4e8d4);
    background: transparent;
    color: var(--color-text, #1a1a1a);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.bg-close-btn:hover {
    background: var(--color-accent-light, #dcfce7);
}

/* ============================
   FULLSCREEN IMAGE CROPPER
   ============================ */

.cropper-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: #000;
    display: flex;
    flex-direction: column;
    touch-action: none;
}

.cropper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: rgba(0, 0, 0, 0.85);
    flex-shrink: 0;
    gap: 1rem;
}

.cropper-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    flex: 1;
    text-align: center;
}

.cropper-cancel-btn {
    background: none;
    border: none;
    color: #6d727a;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    min-width: 60px;
}

.cropper-apply-btn {
    background: #22c55e;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.35rem 1rem;
    border-radius: 8px;
    min-width: 60px;
}

.cropper-apply-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cropper-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.cropper-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* Dark area outside crop box via box-shadow */
.cropper-shade {
    position: absolute;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.52);
    box-sizing: border-box;
}

/* Crop box border */
.cropper-box {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-sizing: border-box;
    cursor: move;
    touch-action: none;
}

/* Rule-of-thirds grid */
.cropper-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(255,255,255,0.22) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.22) 1px, transparent 1px);
    background-size: 33.333% 33.333%;
    pointer-events: none;
}

/* Resize handles */
.cropper-handle {
    position: absolute;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 3px;
    touch-action: none;
    z-index: 1;
}

.cropper-handle-tl { top: -4px;  left: -4px;  cursor: nw-resize; }
.cropper-handle-tr { top: -4px;  right: -4px; cursor: ne-resize; }
.cropper-handle-bl { bottom: -4px; left: -4px;  cursor: sw-resize; }
.cropper-handle-br { bottom: -4px; right: -4px; cursor: se-resize; }

.cropper-hint {
    text-align: center;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.72rem;
    padding: 0.45rem;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.7);
    margin: 0;
}

/* ============================
   DARK THEME — bg gallery
   ============================ */

[data-theme="dark"] .bg-modal {
    background: #1a1a1a;
}

[data-theme="dark"] .bg-grid-add {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    color: #babfc7;
}

[data-theme="dark"] .bg-grid-add:hover:not(:disabled) {
    border-color: #4ade80;
    color: #4ade80;
}

[data-theme="dark"] .bg-grid-empty {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .bg-default-btn {
    border-color: rgba(255, 255, 255, 0.12);
    color: #babfc7;
}

[data-theme="dark"] .bg-default-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.06);
    border-color: #4ade80;
    color: #4ade80;
}

[data-theme="dark"] .bg-close-btn {
    border-color: rgba(255, 255, 255, 0.12);
    color: #e8f5e8;
}

[data-theme="dark"] .bg-close-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}
