:root {
    --bg: #f5f0e8;
    --paper: #faf7f2;
    --wood: #c4a882;
    --dark: #8b6f4e;
    --knob: #6b5139;
    --ink: #3d3530;
    --ink-light: #7a6a60;
    --accent: #a8896c;
    --accent-soft: #d4b896;
    --green: #7a9e87;
    --green-bg: #edf4ef;
    --red: #b06060;
    --line: #e8e0d4;
    --tag: #ede8df;
    --scrim: rgba(61, 53, 48, .52);
}

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

body {
    background: var(--bg);
    font-family: 'Jost', sans-serif;
    font-weight: 300;
    color: var(--ink);
    min-height: 100vh;
    overflow-x: hidden;
}

header {
    position: relative;
    text-align: center;
    padding: 52px 24px 36px;
}

header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 300;
    letter-spacing: .04em;
}

header p {
    margin-top: 10px;
    font-size: .85rem;
    color: var(--ink-light);
    max-width: 380px;
    margin-inline: auto;
    line-height: 1.7;
}

.lang-switch {
    position: absolute;
    top: 18px;
    right: 22px;
    font-size: .72rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lang-switch button {
    background: none;
    border: none;
    color: var(--ink-light);
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
    padding: 4px 6px;
    transition: color .2s;
}

.lang-switch button.is-active {
    color: var(--accent);
}

.lang-switch button:hover {
    color: var(--accent);
}

.lang-switch span {
    color: var(--accent-soft);
}

.page-wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px 80px;
}

/* ── BOX ── */
.box-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 44px;
}

.box {
    width: 200px;
    height: 130px;
    position: relative;
    cursor: pointer;
    transition: transform .2s;
}

.box:hover {
    transform: translateY(-3px);
}

.box:hover .box-lid {
    transform: rotate(-22deg);
}

.box-slips {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 50px;
    pointer-events: none;
    z-index: 5;
}

.box-slip {
    position: absolute;
    bottom: 0;
    width: 44px;
    height: 54px;
    background: var(--paper);
    border-radius: 3px 3px 0 0;
    border: 1px solid var(--line);
    border-bottom: none;
    box-shadow: 0 -2px 6px rgba(61, 53, 48, .08);
    transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), opacity .3s;
}

.box-slip:nth-child(1) {
    left: 0;
    transform: rotate(-7deg);
    transform-origin: bottom center;
}

.box-slip:nth-child(2) {
    left: 43px;
    transform: rotate(-1deg);
    transform-origin: bottom center;
    z-index: 2;
}

.box-slip:nth-child(3) {
    left: 86px;
    transform: rotate(6deg);
    transform-origin: bottom center;
}

.box:hover .box-slip:nth-child(1) {
    transform: rotate(-12deg) translateY(-4px);
}

.box:hover .box-slip:nth-child(2) {
    transform: rotate(-1deg) translateY(-7px);
}

.box:hover .box-slip:nth-child(3) {
    transform: rotate(11deg) translateY(-4px);
}

.slip-ruled-line {
    position: absolute;
    left: 6px;
    right: 6px;
    height: 1px;
    background: var(--line);
}

.slip-ruled-line:nth-child(1) {
    top: 10px;
}

.slip-ruled-line:nth-child(2) {
    top: 18px;
}

.slip-ruled-line:nth-child(3) {
    top: 26px;
}

.box-slip.is-hidden {
    opacity: 0;
    transform: rotate(0) translateY(10px) !important;
}

.box-body {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 80px;
    background: linear-gradient(160deg, var(--wood), var(--dark));
    border-radius: 4px 4px 6px 6px;
    box-shadow: 0 6px 20px rgba(107, 81, 57, .35), inset 0 1px 0 rgba(255, 255, 255, .15);
    z-index: 3;
}

.box-body::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 10px;
    border-radius: 10px;
    background: var(--knob);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .3);
}

.box-lid {
    position: absolute;
    bottom: 76px;
    left: 50%;
    transform: translateX(-50%);
    width: 168px;
    height: 28px;
    background: linear-gradient(160deg, var(--accent-soft), var(--wood));
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(107, 81, 57, .25);
    transform-origin: left center;
    transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
    z-index: 4;
}

.box-counter {
    margin-top: 16px;
    font-family: 'Cormorant Garamond', serif;
    font-size: .9rem;
    color: var(--ink-light);
    letter-spacing: .1em;
}

.box-counter span {
    color: var(--accent);
    font-size: 1.1rem;
}

/* ── ADD FORM ── */
.add-form {
    background: var(--paper);
    border-radius: 12px;
    padding: 28px 28px 22px;
    box-shadow: 0 2px 16px rgba(61, 53, 48, .07);
    margin-bottom: 32px;
    border: 1px solid var(--line);
}

.add-form h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 1.15rem;
    color: var(--ink-light);
    margin-bottom: 14px;
    letter-spacing: .04em;
}

textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line);
    resize: none;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    color: var(--ink);
    line-height: 1.8;
    padding: 6px 0 10px;
    outline: none;
    min-height: 70px;
    transition: border-color .2s;
}

textarea:focus {
    border-color: var(--accent);
}

textarea::placeholder {
    color: var(--accent-soft);
    font-style: italic;
}

.add-form-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
    gap: 10px;
    align-items: center;
}

.char-counter {
    font-size: .72rem;
    color: var(--accent-soft);
    margin-right: auto;
}

.btn-primary {
    background: var(--ink);
    color: var(--bg);
    border: none;
    font-family: 'Jost', sans-serif;
    font-size: .78rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 9px 22px;
    border-radius: 30px;
    cursor: pointer;
    transition: all .2s;
}

.btn-primary:hover {
    background: var(--dark);
}

.btn-primary:disabled {
    opacity: .35;
    cursor: default;
}

/* ── FILTERS ── */
.filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    background: none;
    border: 1px solid var(--line);
    color: var(--ink-light);
    font-family: 'Jost', sans-serif;
    font-size: .75rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all .2s;
}

.filter-btn.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.filter-btn:hover:not(.is-active) {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── WORRY CARDS ── */
.worries-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.worry-card {
    background: var(--paper);
    border-radius: 10px;
    padding: 20px 22px 16px;
    box-shadow: 0 2px 12px rgba(61, 53, 48, .06);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent-soft);
    animation: slideIn .35s ease;
}

.worry-card.is-resolved {
    border-left-color: var(--green);
    background: var(--green-bg);
    opacity: .82;
}

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

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(40px);
        height: 0;
        padding: 0;
        margin: 0;
    }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.card-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    line-height: 1.65;
    flex: 1;
}

.worry-card.is-resolved .card-text {
    text-decoration: line-through;
    color: var(--ink-light);
}

.card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity .2s;
}

.worry-card:hover .card-actions {
    opacity: 1;
}

.icon-btn {
    background: none;
    border: 1px solid transparent;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    transition: all .2s;
    color: var(--ink-light);
}

.icon-btn:hover {
    border-color: var(--line);
    background: var(--bg);
}

.icon-btn.open-note-btn:hover {
    color: var(--accent);
}

.icon-btn.resolve-btn:hover {
    color: var(--green);
}

.icon-btn.delete-btn:hover {
    color: var(--red);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.card-date {
    font-size: .72rem;
    color: var(--accent-soft);
    letter-spacing: .06em;
}

.resolved-label {
    font-size: .7rem;
    color: var(--green);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.resolved-date {
    font-size: .7rem;
    color: var(--green);
}

.note-chips {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.note-chip {
    font-size: .7rem;
    color: var(--ink-light);
    background: var(--tag);
    border-radius: 20px;
    padding: 3px 10px;
    font-style: italic;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-chip.is-truth {
    background: #e8f0ea;
    color: var(--green);
}

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--accent-soft);
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.8;
}

/* ── BREATHING ── */
.breathe-section {
    text-align: center;
    padding: 36px 20px 10px;
}

.breathe-toggle-btn {
    background: none;
    border: none;
    font-size: .75rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--accent-soft);
    cursor: pointer;
    padding: 6px;
    transition: color .2s;
}

.breathe-toggle-btn:hover {
    color: var(--accent);
}

.breathe-widget {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 28px 0 10px;
}

.breathe-widget.is-visible {
    display: flex;
}

.breathe-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-soft), var(--wood));
    opacity: .7;
}

.breathe-circle.is-inhale {
    animation: breatheExpand 4s ease-in-out forwards;
}

.breathe-circle.is-hold {
    animation: breatheHold 4s ease-in-out forwards;
}

.breathe-circle.is-exhale {
    animation: breatheShrink 6s ease-in-out forwards;
}

@keyframes breatheExpand {
    from {
        transform: scale(1);
        opacity: .5;
    }
    to {
        transform: scale(1.9);
        opacity: .85;
    }
}

@keyframes breatheHold {
    from {
        transform: scale(1.9);
        opacity: .85;
    }
    to {
        transform: scale(1.9);
        opacity: .85;
    }
}

@keyframes breatheShrink {
    from {
        transform: scale(1.9);
        opacity: .85;
    }
    to {
        transform: scale(1);
        opacity: .5;
    }
}

.breathe-label {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.1rem;
    color: var(--ink-light);
    min-height: 1.6em;
}

.breathe-start-btn {
    background: none;
    border: 1px solid var(--accent-soft);
    color: var(--accent);
    font-family: 'Jost', sans-serif;
    font-size: .75rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 7px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all .2s;
}

.breathe-start-btn:hover {
    background: var(--accent-soft);
    color: var(--ink);
}

/* ── STATS DRAWER ── */
.stats-overlay {
    position: fixed;
    inset: 0;
    background: var(--scrim);
    backdrop-filter: blur(3px);
    z-index: 100;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.stats-drawer {
    background: var(--paper);
    width: 100%;
    max-width: 680px;
    max-height: 75vh;
    border-radius: 18px 18px 0 0;
    padding: 28px 28px 36px;
    overflow-y: auto;
    animation: drawerSlideUp .35s cubic-bezier(.34, 1.56, .64, 1);
}

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

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

.stats-drawer-header h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 1.2rem;
}

.drawer-close-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--ink-light);
    padding: 4px 8px;
    border-radius: 4px;
    transition: color .2s;
}

.drawer-close-btn:hover {
    color: var(--ink);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    border: 1px solid var(--line);
}

.stat-number {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    color: var(--accent);
    display: block;
}

.stat-label {
    font-size: .68rem;
    color: var(--ink-light);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.clear-resolved-btn {
    background: none;
    border: 1px solid #d4b0b0;
    color: var(--red);
    font-family: 'Jost', sans-serif;
    font-size: .75rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 7px 18px;
    border-radius: 20px;
    cursor: pointer;
    transition: all .2s;
}

.clear-resolved-btn:hover {
    background: #f9efef;
}

/* ── CBT NOTE MODAL ── */
.note-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--scrim);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.note-modal-overlay.is-open {
    display: flex;
}

.note-modal {
    background: var(--paper);
    border-radius: 18px;
    width: 100%;
    max-width: 580px;
    max-height: 94vh;
    overflow-y: auto;
    box-shadow: 0 32px 80px rgba(61, 53, 48, .28);
    animation: modalPopIn .3s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(.94) translateY(14px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 28px 32px 22px;
    border-bottom: 1px solid var(--line);
}

.modal-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.modal-header h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 1.5rem;
    color: var(--ink);
    letter-spacing: .02em;
    line-height: 1.3;
}

.modal-header p {
    font-size: .82rem;
    color: var(--ink-light);
    margin-top: 6px;
    line-height: 1.6;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--ink-light);
    padding: 4px 6px;
    flex-shrink: 0;
    transition: color .2s;
    margin-top: 2px;
}

.modal-close-btn:hover {
    color: var(--ink);
}

.modal-worry-quote {
    margin: 20px 32px 0;
    padding: 14px 18px;
    background: var(--bg);
    border-left: 3px solid var(--accent-soft);
    border-radius: 0 8px 8px 0;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--ink-light);
    line-height: 1.7;
}

.modal-fields {
    padding: 24px 32px 12px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cbt-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cbt-field + .cbt-field {
    padding-top: 4px;
    border-top: 1px solid var(--line);
}

.cbt-field-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cbt-number-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: .75rem;
    font-family: 'Jost', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.badge-facts {
    background: #ede8df;
    color: #7a6a60;
}

.badge-brain {
    background: #f0e4da;
    color: #8a5848;
}

.badge-evidence {
    background: #deeae1;
    color: #3d7055;
}

.badge-truth {
    background: #dce5f2;
    color: #3a5888;
}

.cbt-field-title {
    font-size: .8rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink);
    font-family: 'Jost', sans-serif;
    font-weight: 400;
}

.cbt-field-hint {
    font-size: .8rem;
    color: var(--ink-light);
    font-style: italic;
    line-height: 1.5;
    padding-left: 38px;
}

.cbt-field textarea {
    min-height: 64px;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    padding: 8px 2px 12px;
    border-radius: 0;
    margin-top: 2px;
}

.cbt-field textarea:focus {
    border-color: var(--accent);
}

.cbt-field textarea::placeholder {
    font-size: .95rem;
}

.modal-footer {
    padding: 20px 32px 28px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--line);
    margin-top: 8px;
}

.btn-secondary {
    background: none;
    border: 1px solid var(--line);
    color: var(--ink-light);
    font-family: 'Jost', sans-serif;
    font-size: .78rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 9px 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: all .2s;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-save {
    background: var(--ink);
    border: 1px solid var(--ink);
    color: var(--bg);
    font-family: 'Jost', sans-serif;
    font-size: .78rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 9px 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: all .2s;
}

.btn-save:hover {
    background: var(--dark);
    border-color: var(--dark);
}

footer {
    text-align: center;
    padding: 20px;
    font-size: .7rem;
    color: var(--accent-soft);
    letter-spacing: .08em;
}
