/* ==========================================================
 *  TABLE OF CONTENTS
 * ==========================================================
 *
 *  1. RESET & BASE STYLES ....................... L35
 *  2. TYPOGRAPHY ................................ L125
 *     Utility text classes ...................... L136
 *  3. LAYOUT & CONTAINER ........................ L162
 *  4. HEADER .................................... L176
 *  5. COUNTER & DATE INPUT ...................... L209
 *     Counter display ........................... L224
 *     Confetti canvas ........................... L298
 *  6. FAB — FLOATING ACTION BUTTON .............. L320
 *  7. SECTION COMPONENT ......................... L352
 *     Collapsible sections ...................... L391
 *     Edit button ............................... L421
 *  8. EDITOR & FORMATTING TOOLBAR ............... L448
 *     Editor utilities .......................... L482
 *  9. BREATHING EXERCISE ........................ L509
 *     Breathing circle .......................... L583
 *     Breathing burger menu ..................... L637
 * 10. CONTACTS COMPONENT ........................ L752
 * 11. MODAL COMPONENT ........................... L840
 *     Modal layout variants ..................... L863
 *     Modal form elements ....................... L916
 *     Modal info / tip / warning boxes .......... L993
 *     Modal buttons ............................. L1090
 * 12. SECTION MANAGEMENT ........................ L1145
 * 13. RESPONSIVE MEDIA QUERIES .................. L1263
 *     500px breakpoint .......................... L1267
 *     380px breakpoint .......................... L1310
 *
 * ========================================================== */

/* ==========================================================
 *  1. RESET & BASE STYLES
 * ========================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* ── Colours ── */
    --color-bg: #18181b;
    --color-surface: #27272a;
    --color-surface-alt: #3f3f46;
    --color-surface-hover: #52525b;
    --color-border: #3f3f46;
    --color-border-light: #52525b;

    --color-accent: #34d399;
    --color-accent-dark: #10b981;
    --color-accent-dark-2: #178f5f;
    --color-accent-deeper: #20956a;
    --color-accent-bg: #1b5e50;

    --color-text: #e4e4e7;
    --color-text-muted: #a1a1aa;
    --color-text-subtle: #c2c2c7;
    --color-text-dim: #888;

    --color-danger: #ef4444;
    --color-warning: #fbbf24;
    --color-highlight: #60a5fa;
    --color-pink: #f472b6;

    --color-white: #ffffff;
    --color-black: #000000;

    /* Raw RGB values for rgba() usage */
    --color-accent-rgb: 52, 211, 153;
    --color-accent-dark-rgb: 16, 185, 129;
    --color-danger-rgb: 239, 68, 68;
    --color-warning-rgb: 251, 191, 36;
    --color-highlight-rgb: 96, 165, 250;
    --color-pink-rgb: 244, 114, 182;

    /* ── Surface shades ── */
    --color-surface-darker: #1e1e22;

    /* ── Border Radius ── */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    /* ── Durations ── */
    --duration-fast: 0.15s;
    --duration-base: 0.2s;
    --duration-slow: 0.3s;

    /* ── Shorthand transitions ── */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── PWA Standalone Mode ── */
@media all and (display-mode: standalone) {
    body {
        /* Safe area padding for notched phones (iOS) */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        /* Prevent pull-to-refresh overscroll in standalone mode */
        overscroll-behavior: none;
    }

    .container {
        /* Ensure the container fills the safe area */
        min-height: calc(
            100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom)
        );
    }
}

body {
    font-family: "Inter", system-ui, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    padding-bottom: 80px;
}

button {
    cursor: pointer;
}

textarea {
    width: 100%;
    background: var(--color-bg);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-lg);
    padding: 18px;
    color: var(--color-text);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.65;
    min-height: 180px;
    resize: vertical;
}

/* ==========================================================
 *  2. TYPOGRAPHY
 * ========================================================== */
h1 {
    font-size: clamp(1.4rem, 5.5vw, 2rem);
    font-weight: 680;
    letter-spacing: -0.04em;
    color: var(--color-accent);
    line-height: 1.15;
}

/* ── Utility text classes ── */
.text-muted {
    color: var(--color-text-subtle);
    font-size: 0.9rem;
}

.text-emphasis,
.text-emphasis--lg {
    font-weight: 500;
    margin-bottom: 16px;
}

.text-emphasis--lg {
    font-size: 1.05rem;
}

.text-accent {
    color: var(--color-accent);
    font-weight: 600;
}

.text-strong {
    color: var(--color-text);
    font-weight: 600;
}

/* ==========================================================
 *  3. LAYOUT & CONTAINER
 * ========================================================== */
.container {
    max-width: 660px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Main content area ── */
#main-content {
    margin-top: 32px;
}

/* ==========================================================
 *  4. HEADER
 * ========================================================== */
header {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-content {
    padding: 8px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Logo SVG: fixed size until the narrow breakpoint */
header svg[width="64"] {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

/* ── Logo wrapper ── */
.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==========================================================
 *  5. COUNTER & DATE INPUT
 * ========================================================== */
.counter {
    background: var(--color-surface);
    border: 1px solid rgba(var(--color-accent-rgb), 0.25);
    border-radius: var(--radius-lg);
    padding: 8px 16px;
    text-align: center;
    line-height: 1.2;
    transition:
        border-color var(--duration-slow),
        box-shadow var(--duration-slow);
}

/* ── Anniversary celebration ── */
.counter.celebration {
    animation: counterGlow 2s ease-in-out infinite;
}

@keyframes counterGlow {
    0%,
    100% {
        border-color: rgba(var(--color-accent-rgb), 0.5);
        box-shadow: 0 0 15px rgba(var(--color-accent-rgb), 0.3);
    }
    25% {
        border-color: var(--color-warning);
        box-shadow: 0 0 20px rgba(var(--color-warning-rgb), 0.5);
    }
    50% {
        border-color: var(--color-pink);
        box-shadow: 0 0 25px rgba(var(--color-pink-rgb), 0.5);
    }
    75% {
        border-color: var(--color-highlight);
        box-shadow: 0 0 20px rgba(var(--color-highlight-rgb), 0.5);
    }
}

/* ── Counter sub-elements ── */
#days-count {
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
}

.counter-label {
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--color-accent);
    font-weight: 500;
}

.counter-bottom-row {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

.counter-since {
    font-size: 0.7rem;
    color: var(--color-text-dim);
}

.celebration-badge {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-warning);
    animation: badgePop 0.5s ease-out;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── Confetti canvas ── */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.date-input {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    padding: 2px 6px;
    font-family: inherit;
    font-size: 0.75rem;
    max-width: 130px;
}

/* ==========================================================
 *  6. FAB — FLOATING ACTION BUTTON
 * ========================================================== */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--color-accent-deeper);
    color: var(--color-white);
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 10px 30px -10px rgba(var(--color-accent-rgb), 0.6);
    z-index: 100;
    border: none;
    cursor: pointer;
    transition:
        background var(--duration-base),
        transform var(--duration-fast),
        box-shadow var(--duration-base);
}

.fab:hover {
    background: var(--color-accent-dark-2);
    transform: scale(1.08);
    box-shadow: 0 16px 38px -10px rgba(var(--color-accent-rgb), 0.8);
}

/* ==========================================================
 *  7. SECTION COMPONENT
 * ========================================================== */
.section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    margin-bottom: 28px;
    overflow: hidden;
}

.section-header {
    background: linear-gradient(
        135deg,
        var(--color-accent-dark),
        var(--color-accent)
    );
    color: white;
    padding: 16px 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-content {
    padding: 24px;
}

.content-display {
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: 18px;
    min-height: 160px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Collapsible sections */
.collapsible-section .section-header {
    cursor: pointer;
    user-select: none;
}

.collapsible-section .section-header:hover {
    filter: brightness(1.08);
}

.collapse-icon {
    font-size: 1.8rem;
    transition: transform 0.3s ease;
    margin-left: 8px;
    display: inline-block;
}

.collapse-icon.open {
    transform: rotate(90deg);
}

.collapsible-section .section-header:hover .collapse-icon:not(.open) {
    transform: rotate(90deg);
    opacity: 0.9;
}

.collapsible-section .section-header:hover .collapse-icon.open {
    opacity: 0.85;
}

/* Edit button inside section headers */
.edit-btn {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all var(--duration-base);
    flex-shrink: 0;
}

.edit-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.edit-btn svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================
 *  8. EDITOR & FORMATTING TOOLBAR
 * ========================================================== */
#editor-textarea {
    background: var(--color-bg);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-lg);
    padding: 20px;
    color: var(--color-text);
    font-family: inherit;
    font-size: 1.05rem;
    line-height: 1.7;
}

.format-btn {
    padding: 5px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition:
        background var(--duration-fast),
        color var(--duration-fast),
        border-color var(--duration-fast);
}

.format-btn:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
    border-color: var(--color-border-light);
}

/* ── Editor utilities ── */
.format-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.editor-actions {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#editor-title {
    margin: 0;
    color: var(--color-accent);
}

#editor-status {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--color-accent);
}

/* ==========================================================
 *  9. BREATHING EXERCISE
 * ========================================================== */
.breathing-section {
    position: relative;
    background: linear-gradient(
        135deg,
        rgba(var(--color-accent-dark-rgb), 0.08),
        rgba(var(--color-accent-rgb), 0.04)
    );
    margin-bottom: 24px;
    border: 1px solid rgba(var(--color-accent-rgb), 0.3);
    border-radius: var(--radius-xl);
    padding: 40px 24px 8px;
    text-align: center;
    transition: all var(--duration-slow) ease;
}

/* Overlay for smooth fade of the intense background */
.breathing-section::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        rgba(var(--color-accent-dark-rgb), 0.28),
        rgba(var(--color-accent-rgb), 0.18)
    );
    opacity: 0;
    transition: opacity var(--duration-slow) ease;
    pointer-events: none;
    z-index: 0;
}

.breathing-section:not(.active):hover {
    border-color: rgba(var(--color-accent-rgb), 0.55);
    box-shadow: 0 0 28px -8px rgba(var(--color-accent-rgb), 0.2);
}

.breathing-section.active #breathing-btn-text {
    color: var(--color-accent-dark);
}

/* Ensure breathing section content sits above the overlay */
.breathing-section > * {
    position: relative;
    z-index: 1;
}

.breathing-section.intense::before {
    opacity: 1;
}

/* Button wrapping the whole breathing circle area */
.breathing-circle-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.breathing-circle-btn:hover #breathing-btn-text {
    color: var(--color-accent);
}

#breathing-btn-text {
    transition: all 0.3s ease;
}

/* Breathing circle */
.breathing-circle {
    --breath-duration: 4s;
    --breath-cycle: 16s;
    width: 148px;
    height: 148px;
    border-radius: var(--radius-full);
    border: 7px solid rgba(var(--color-accent-rgb), 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--breath-duration) var(--ease);
    box-shadow: 0 10px 40px -10px rgba(var(--color-accent-rgb), 0.4);
    background: rgba(255, 255, 255, 0.06);
}

.breathing-circle::before,
.breathing-circle::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    animation: pulse var(--breath-cycle) infinite ease-in-out;
}

.breathing-circle::before {
    background: radial-gradient(
        circle,
        rgba(var(--color-accent-rgb), 0.25) 0%,
        transparent 70%
    );
}

.breathing-circle::after {
    background: radial-gradient(
        circle,
        rgba(var(--color-accent-rgb), 0.25) 20%,
        transparent 70%
    );
}

.breathing-circle.in {
    transform: scale(1.28);
    border-color: var(--color-accent);
    box-shadow: 0 15px 50px -5px rgba(var(--color-accent-rgb), 0.6);
}

.breathing-circle.out {
    transform: scale(0.62);
    border-color: rgba(var(--color-accent-rgb), 0.35);
}

/* Breathing burger dropdown */
.breathing-burger-wrapper {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
}

.breathing-burger-btn {
    width: 36px;
    height: 36px;
    color: var(--color-accent);
    background: rgba(var(--color-accent-rgb), 0.08);
    border: 1px solid rgba(var(--color-accent-rgb), 0.25);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 6px;
    transition:
        background var(--duration-base),
        border-color var(--duration-base),
        box-shadow var(--duration-base);
}

.breathing-burger-btn:hover {
    background: rgba(var(--color-accent-rgb), 0.18);
    border-color: rgba(var(--color-accent-rgb), 0.45);
    box-shadow: 0 4px 14px -4px rgba(var(--color-accent-rgb), 0.3);
}

.breathing-burger-btn svg {
    width: 24px;
    height: 24px;
}

.context-menu {
    position: absolute;
    top: 44px;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(var(--color-black), 0.5);
    min-width: 200px;
    overflow: hidden;
    z-index: 20;
    animation: contextFadeIn var(--duration-fast) ease;
}

@keyframes contextFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.context-menu-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 14px 18px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    cursor: pointer;
    text-align: left;
    transition: background var(--duration-fast);
}

.context-menu-item:last-child {
    border-bottom: none;
}

.context-menu-item:hover {
    background: rgba(var(--color-accent-rgb), 0.1);
}

.context-menu-item.active {
    background: rgba(var(--color-accent-rgb), 0.18);
}

.context-menu-item.active .context-menu-item-title {
    color: var(--color-accent);
}

.context-menu-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.context-menu-item-desc {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.context-menu-item-simple {
    display: block;
    padding: 10px 16px;
    font-weight: 500;
    font-size: 0.95rem;
}

.context-menu-item-simple.active {
    color: var(--color-accent);
}

/* ==========================================================
 * 10. CONTACTS COMPONENT
 * ========================================================== */
.contact-item {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 14px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    transition: all var(--duration-base) ease;
}

.contact-item.dragging {
    opacity: 0.4;
    transform: scale(0.98);
}

.add-contact {
    width: 100%;
    padding: 14px;
    background: var(--color-surface-alt);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition:
        background var(--duration-base),
        transform var(--duration-fast);
}

.add-contact:hover {
    background: var(--color-surface-hover);
    transform: scale(1.02);
}

/* ── Contact item buttons ── */
.contact-call-btn {
    background: var(--color-accent);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    text-decoration: none;
    transition:
        background var(--duration-base),
        transform var(--duration-fast);
}

.contact-call-btn:hover {
    background: var(--color-accent-dark);
    transform: scale(1.08);
}

.contact-delete-btn {
    background: var(--color-danger);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition:
        filter var(--duration-fast),
        transform var(--duration-fast);
}

.contact-delete-btn:hover {
    filter: brightness(1.2);
    transform: scale(1.08);
}

.contact-delete-btn svg {
    width: 28px;
    height: 28px;
}

/* ==========================================================
 * 11. MODAL COMPONENT
 * ========================================================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
}

/* Modal layout variants */
.modal-content--column {
    display: flex;
    flex-direction: column;
}

.modal-content--full {
    max-width: 500px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

.modal-content--narrow {
    max-width: 400px;
}

.modal-content--wide {
    max-width: 560px;
    width: 95%;
}

.modal-scroll-area {
    flex: 1;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-footer {
    flex-shrink: 0;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.modal-footer--dark {
    padding: 16px 24px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.modal-btn-full {
    width: 100%;
    font-size: 1.05rem;
}

/* ── Modal form elements ── */
.modal-label {
    display: block;
    margin-bottom: 8px;
    color: var(--color-text-muted);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    cursor: pointer;
}

/* ── Custom checkboxes ── */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--color-bg);
    border: 2px solid var(--color-border-light);
    border-radius: 5px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--duration-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

input[type="checkbox"]:hover {
    border-color: var(--color-accent);
    background: var(--color-surface);
}

input[type="checkbox"]:checked {
    background: var(--color-accent);
    border-color: var(--color-accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2318181b' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: 14px;
    background-position: center;
    background-repeat: no-repeat;
}

input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

input[type="checkbox"]:checked:hover {
    background-color: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2318181b' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: 14px;
    background-position: center;
    background-repeat: no-repeat;
}

.form-group {
    margin: 20px 0;
}

#icon-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    justify-items: center;
}

.modal-input + .modal-input {
    margin-top: 12px;
}

/* Modal info / tip / warning boxes */
.info-box {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.info-box a,
.highlight-box a,
.tip-box a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--duration-fast);
}

.info-box a:hover,
.highlight-box a:hover,
.tip-box a:hover {
    color: var(--color-accent-dark);
    text-decoration: underline;
}

.tip-box {
    background: var(--color-accent-bg);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--color-accent-dark);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.tip-box .text-accent {
    color: var(--color-white);
}

.warning-box {
    background: var(--color-surface-alt);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
    border-left: 4px solid var(--color-danger);
}

.highlight-box {
    background: var(--color-surface-alt);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
    border-left: 4px solid var(--color-accent);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.modal-h2 {
    color: var(--color-accent);
    margin-bottom: 24px;
    font-size: 1.5rem;
}

.modal-h3 {
    color: var(--color-accent);
    margin-bottom: 16px;
    margin-top: 24px;
    font-weight: 600;
}

.modal-list {
    margin-bottom: 20px;
    padding-left: 20px;
    color: var(--color-text-subtle);
}

.modal-list li {
    margin-bottom: 8px;
}

#confirm-message {
    color: var(--color-text);
    line-height: 1.6;
    margin: 0;
    font-size: 1.05rem;
}

.scroll-content {
    padding: 4px 24px;
    overflow-y: auto;
    flex: 1;
}

.scroll-content--padded {
    padding: 32px 4px;
    overflow-y: auto;
    flex: 1;
}

.modal-title {
    margin-bottom: 20px;
    color: var(--color-accent);
}

.modal-input {
    width: 100%;
    padding: 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: 1rem;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* ── Modal buttons ── */
.modal-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    cursor: pointer;
}

.modal-btn-secondary {
    background: var(--color-surface-alt);
    transition:
        background var(--duration-base),
        transform var(--duration-fast);
}

.modal-btn-secondary:hover {
    background: var(--color-surface-hover);
    transform: scale(1.02);
}

.modal-btn-primary {
    background: var(--color-accent);
    font-weight: 600;
    transition:
        background var(--duration-base),
        transform var(--duration-fast);
}

.modal-btn-primary:hover {
    background: var(--color-accent-dark);
    transform: scale(1.02);
}

.modal-save-btn {
    padding: 12px 28px;
    background: var(--color-accent);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.02rem;
    cursor: pointer;
    transition:
        background var(--duration-base),
        transform var(--duration-fast);
}

.modal-save-btn:hover {
    background: var(--color-accent-dark);
    transform: scale(1.05);
}

/* ==========================================================
 * 12. SECTION MANAGEMENT (add / reorder / delete)
 * ========================================================== */
.section-actions {
    display: flex;
    gap: 12px;
    margin: 28px 0 16px 0;
}

.action-btn {
    flex: 1;
    padding: 8px;
    background: var(--color-surface-alt);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-weight: 500;
    font-size: 1.02rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition:
        background var(--duration-base),
        transform var(--duration-fast);
}

.action-btn:hover {
    background: var(--color-surface-hover);
    transform: scale(1.02);
}

/* ── Icon-only action buttons (plus, info) ── */
.action-btn-icon {
    flex: 0 0 auto;
    width: 56px;
    padding: 14px 0;
}

.action-btn span {
    display: flex;
}

#icon-gear {
    margin-right: 6px;
}

.section-manage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-surface-darker);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: grab;
    user-select: none;
    transition: all var(--duration-base);
    border: 1px solid var(--color-border);
}

.section-manage-item:active {
    cursor: grabbing;
}

.section-manage-item:hover {
    background: rgba(var(--color-accent-rgb), 0.09);
    border: 1px solid rgba(var(--color-accent-rgb), 0.2);
}

.section-manage-item.dragging {
    opacity: 0.4;
    transform: scale(0.98);
}

.add-section-btn {
    width: 100%;
    padding: 16px;
    background: var(--color-surface-alt);
    border: 2px dashed var(--color-border-light);
    color: var(--color-text-muted);
    font-weight: 500;
    border-radius: var(--radius-lg);
    cursor: pointer;
    margin: 20px 0 40px 0;
    transition: all var(--duration-base);
}

.add-section-btn:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-accent);
    color: var(--color-text);
    transform: scale(1.02);
}

.manage-item-btn {
    min-width: 32px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    transition:
        filter var(--duration-fast),
        transform var(--duration-fast);
}

.manage-item-btn:hover {
    filter: brightness(1.2);
    transform: scale(1.08);
}

.manage-item-btn svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================
 * 13. RESPONSIVE MEDIA QUERIES
 * ========================================================== */

/* --- 500px breakpoint --- */
@media (max-width: 500px) {
    /* Counter compact */
    #counter-wrapper .counter {
        padding: 6px 12px;
        border-radius: var(--radius-md);
    }

    #counter-wrapper .counter div:first-child {
        font-size: 0.6rem !important;
        letter-spacing: 0.5px !important;
    }

    #days-count {
        font-size: 1.6rem;
    }

    /* Rearrange the bottom row of the counter to be a single line */
    #counter-wrapper .counter > div:last-child {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }

    #counter-wrapper .counter span {
        font-size: 0.6rem !important;
    }

    .date-input {
        max-width: 100px;
        font-size: 0.7rem;
    }

    /* Section action buttons compact */
    .section-actions {
        gap: 8px;
    }

    .action-btn {
        font-size: 0.85rem;
        padding: 10px 8px;
    }
}

/* --- 380px breakpoint --- */
@media (max-width: 380px) {
    .container {
        padding: 0 12px;
    }

    /* Shrink logo */
    header svg[width="64"] {
        width: 40px;
        height: 40px;
    }

    h1 {
        font-size: 1.2rem;
    }

    /* Counter compact */
    #counter-wrapper .counter {
        padding: 4px 8px;
    }

    #days-count {
        font-size: 1.3rem;
    }

    .date-input {
        max-width: 90px;
    }

    /* Action buttons tight */
    .action-btn {
        font-size: 0.78rem;
        padding: 8px 6px;
    }
}
