:root {
    --burgundy: #9C1C1C;
    --green: #1C4A32;
    --charcoal: #2B2B2B;
    --mustard: #D9A521;
    --gray: #C9C9C9;
    --cream: #fffaf0;
    --ink: var(--green);
    --red: var(--burgundy);
    --line: var(--gray)
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--charcoal);
    font-family: "DM Sans", sans-serif;
    background: radial-gradient(circle at 12% 14%,
            #fff8dc 0 2px,
            transparent 3px),
        radial-gradient(circle at 87% 30%,
            #fff8dc 0 1px,
            transparent 2px),
        #f2eee5;
    background-size: 43px 43px, 69px 69px
}

.site-header {
    background: linear-gradient(100deg, var(--green), #123621 65%, var(--burgundy));
    border-bottom: 4px solid var(--mustard);
    box-shadow: 0 4px 16px #2b2b2b2b;
}

.nav {
    width: min(1200px, 100%);
    min-height: 70px;
    margin: auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    color: var(--cream);
    font: 700 1.25rem "Playfair Display", serif;
    letter-spacing: .01em;
    text-decoration: none
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px
}

.nav-link {
    padding: 9px 12px;
    color: var(--cream);
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: .83rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s, border-color .2s, color .2s
}

.nav-link:hover,
.nav-link:focus-visible {
    color: #fff;
    background: #ffffff18;
    border-color: var(--mustard);
    outline: none
}

.app-shell {
    max-width: 1200px;
    margin: auto;
    padding: 58px 28px 48px
}

.hero {
    text-align: center;
    max-width: 620px;
    margin: 0 auto 46px
}

.eyebrow,
.preview-label {
    margin: 0;
    color: var(--mustard);
    font-size: .73rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase
}

h1 {
    margin: 10px 0 13px;
    color: var(--green);
    font: 700 clamp(2.7rem, 6vw, 4.7rem)/.95 "Playfair Display", serif;
    letter-spacing: -.05em
}

h1 em {
    color: var(--burgundy);
    font-weight: 600
}

.hero>p:last-child {
    margin: auto;
    max-width: 490px;
    color: #4d4d4d;
    line-height: 1.6
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 410px);
    gap: clamp(28px, 6vw, 76px);
    align-items: start
}

.editor-panel {
    padding: 5px 0
}

.panel-heading {
    display: flex;
    gap: 11px;
    align-items: center;
    margin: 0 0 14px
}

.panel-heading span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: #fff;
    background: var(--burgundy);
    border-radius: 50%;
    font-size: .72rem;
    font-weight: 700
}

.panel-heading h2 {
    margin: 0;
    color: var(--green);
    font: 700 1.04rem "Playfair Display", serif
}

.theme-picker {
    width: min(100%, 595px);
    margin: 0 auto 14px
}

.theme-picker .panel-heading {
    margin-bottom: 8px
}

.theme-picker select {
    min-height: 46px;
    margin: 0;
    border-color: var(--mustard);
    background: #fffdf9
}

.style-picker {
    display: grid;
    justify-items: center;
    width: min(100%, 595px);
    margin: 0 auto 14px;
}

.style-picker .panel-heading { margin-bottom: 10px }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
}

.theme-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 0 0 20px;
    font-size: 20px
}

.theme-menu-open {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
}

.theme-menu-open:focus-visible + .theme-menu-open-button {
    outline: 3px solid var(--green);
    outline-offset: 3px
}

.theme-menu-open-button,
.theme-menu-item {
    display: grid;
    place-items: center;
    position: relative;
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    box-shadow: 2px 3px 10px #2b2b2b45;
    cursor: pointer;
    transition: transform .24s cubic-bezier(.2, 1, .2, 1.2), filter .2s
}

.theme-menu-open-button {
    z-index: 3;
    margin: 0;
    font: inherit;
    letter-spacing: normal;
    text-transform: none;
    background: var(--mustard)
}

.theme-menu-open-button:hover {
    transform: scale(1.1)
}

.theme-menu-line {
    position: absolute;
    width: 25px;
    height: 3px;
    border-radius: 2px;
    background: var(--green);
    transition: transform .2s
}

.theme-menu-line.line-1 {
    transform: translateY(-7px)
}

.theme-menu-line.line-3 {
    transform: translateY(7px)
}

.theme-menu-open:checked+.theme-menu-open-button .line-1 {
    transform: rotate(45deg)
}

.theme-menu-open:checked+.theme-menu-open-button .line-2 {
    transform: scaleX(0)
}

.theme-menu-open:checked+.theme-menu-open-button .line-3 {
    transform: rotate(-45deg)
}

.theme-menu-item {
    z-index: 1;
    display: none;
    font: 700 1.25rem "Playfair Display", serif
}

.theme-menu-item.active {
    outline: 3px solid var(--mustard);
    outline-offset: 2px
}

.theme-menu-item:hover {
    filter: brightness(1.15);
    transform: scale(1.1)
}

.theme-menu-item.classic {
    background: var(--burgundy)
}

.theme-menu-item.snow {
    background: #6799b6
}

.theme-menu-item.ginger {
    background: #b76b39
}

.theme-menu-item.candy {
    background: #e11d48
}

.theme-menu-item.midnight {
    background: #17253a
}

.theme-menu-item.sugarplum {
    background: #9c4b8f
}

.theme-menu-open:checked~.theme-menu-item {
    display: grid
}

.second {
    margin-top: 31px
}

label {
    display: block;
    margin: 15px 0 6px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase
}

input,
textarea,
#sticker-select {
    width: 100%;
    padding: 11px 12px;
    color: var(--charcoal);
    font: inherit;
    font-size: .9rem;
    background: #fffdf9;
    border: 1px solid var(--line);
    border-radius: 7px;
    outline: none;
    transition: .2s
}

textarea {
    resize: vertical;
    line-height: 1.5
}

input:focus,
textarea:focus,
#sticker-select:focus {
    border-color: var(--mustard);
    box-shadow: 0 0 0 3px #d9a52120
}

.count {
    margin-top: 5px;
    color: #777;
    text-align: right;
    font-size: .7rem
}

.actions {
    display: grid;
    gap: 9px;
    margin-top: 21px
}

.button {
    padding: 12px 15px;
    border-radius: 7px;
    font: 600 .84rem "DM Sans", sans-serif;
    cursor: pointer;
    transition: .2s
}

.primary {
    color: #fff;
    background: var(--burgundy);
    border: 1px solid var(--burgundy);
    box-shadow: 0 5px 13px #9c1c1c32
}

.primary:hover {
    background: #7c1616
}

.send {
    color: var(--green);
    background: var(--mustard);
    border: 1px solid var(--mustard);
    box-shadow: 0 5px 13px #d9a52138
}

.send:hover {
    background: #efbe3a;
    border-color: #efbe3a
}

.secondary {
    color: var(--green);
    background: transparent;
    border: 1px solid var(--gray)
}

.secondary:hover {
    background: var(--cream);
    border-color: var(--mustard)
}

.save-note {
    margin: 12px 0;
    color: #777;
    font-size: .69rem;
    text-align: center
}

.preview-column {
    display: flex;
    flex-direction: column;
    align-items: center
}

.preview-label {
    align-self: flex-start;
    margin-bottom: 10px
}

.letter {
    position: relative;
    width: min(100%, 595px);
    min-height: 650px;
    padding: 13px;
    overflow: hidden;
    box-shadow: 12px 15px 35px #2b2b2b1f
}

.sticker-layer {
    position: absolute;
    z-index: 5;
    inset: 13px;
    pointer-events: none
}

.sticker {
    position: absolute;
    cursor: grab;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none
}

.sticker::before {
    position: absolute;
    z-index: 0;
    inset: -24px;
    content: "";
    touch-action: none
}

.sticker:active {
    cursor: grabbing
}

.sticker img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 2px 3px #0005)
}

.sticker.selected {
    z-index: 1;
    outline: 2px dashed var(--mustard);
    outline-offset: 4px;
    border-radius: 6px
}

.sticker-row {
    display: flex;
    align-items: center;
    gap: 10px
}

.sticker-preview {
    flex: none;
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: #fffdf9;
    border: 1px solid var(--line);
    border-radius: 7px
}

.sticker-row #sticker-select {
    min-width: 0;
    flex: 1
}

.sticker-btn {
    width: 100%;
    margin-top: 10px
}

.bg-controls {
    display: grid;
    gap: 5px;
    margin-top: 12px
}

.bg-controls[hidden] {
    display: none
}

.bg-controls input[type="range"] {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none
}

#sticker-clear {
    margin-top: 8px
}

#sticker-delete:disabled,
#sticker-clear:disabled,
.sticker-btn:disabled {
    cursor: not-allowed;
    opacity: .55
}

@media(pointer:coarse) {
    .sticker::before {
        inset: -36px
    }
}

.letter-inner {
    display: flex;
    min-height: 624px;
    padding: 61px clamp(30px, 8vw, 76px) 44px;
    flex-direction: column;
    border: 1px solid currentColor
}

.letter-kicker {
    margin: 0;
    text-align: center;
    font-size: .69rem;
    font-weight: 700;
    letter-spacing: .19em;
    text-transform: uppercase
}

.letter h2 {
    margin: 12px 0 19px;
    text-align: center;
    font: 700 clamp(2rem, 5vw, 3.1rem) "Playfair Display", serif
}

.ornament {
    text-align: center;
    font-size: 1.1rem
}

.letter-message {
    flex: 1;
    margin: 36px 0 23px;
    white-space: pre-wrap;
    font: 500 1.02rem/1.85 "Playfair Display", serif
}

.signature {
    display: flex;
    flex-direction: column;
    gap: 2px
}

.signature span {
    font-size: .8rem
}

.signature strong {
    font: 2.2rem "Sacramento", cursive
}

.letter-date {
    margin: 21px 0 0;
    color: inherit;
    font-size: .68rem;
    opacity: .72
}

.corner-decor {
    position: absolute;
    font-size: 4rem;
    line-height: 1;
    opacity: .45
}

.decor-top {
    top: 15px;
    right: 22px
}

.decor-bottom {
    bottom: 12px;
    left: 20px
}

.theme-classic {
    color: var(--green);
    background:
        radial-gradient(circle at 8% 10%, #d9a52155 0 2px, transparent 3px),
        radial-gradient(circle at 92% 88%, #9c1c1c33 0 2px, transparent 3px),
        linear-gradient(135deg, #fffdf5, #f7ead0);
    box-shadow:
        inset 0 0 0 2px var(--mustard),
        inset 0 0 0 7px #fffaf0,
        12px 15px 35px #2b2b2b1f
}

.theme-classic .letter-inner {
    border-color: var(--mustard);
    box-shadow: inset 0 0 0 5px #d9a52118
}

.theme-classic .letter-kicker,
.theme-classic .ornament {
    color: var(--burgundy)
}

.theme-classic .ornament {
    text-shadow: 0 1px 0 #fff, 0 0 12px #d9a52166
}

.theme-snow {
    color: #315a76;
    background: linear-gradient(135deg, #f6fcff, #dceef5)
}

.theme-snow .letter-kicker,
.theme-snow .ornament {
    color: #678ea8
}

.theme-ginger {
    color: #6c392b;
    background: linear-gradient(135deg, #fff9ea, #eed6a7)
}

.theme-ginger .letter-kicker,
.theme-ginger .ornament {
    color: #af5738
}

.theme-candy {
    color: #111827;
    background: repeating-linear-gradient(135deg, #E11D48 0 8px, #FFFFFF 8px 17px, #0F766E 17px 20px, #FFFFFF 20px 29px)
}

.theme-candy .letter-inner {
    background: #FFFFFF;
    border: 2px solid #0F766E
}

.theme-candy .letter-kicker,
.theme-candy .ornament {
    color: #E11D48
}

.theme-candy .signature strong {
    color: #0F766E
}

.theme-candy .letter-date {
    color: #0F766E
}

.theme-candy .corner-decor {
    color: #FDE68A;
    text-shadow: 1px 2px 2px #111827
}

.theme-midnight {
    color: #F2EFEA;
    background: linear-gradient(145deg, #0B1320, #1D3557)
}

.theme-midnight .letter-inner {
    background:
        radial-gradient(circle at 12% 18%, #C7B38B 0 1px, transparent 2px),
        radial-gradient(circle at 82% 28%, #C7B38B 0 1px, transparent 2px),
        radial-gradient(circle at 70% 76%, #C7B38B 0 1px, transparent 2px),
        linear-gradient(145deg, #1D3557, #0B1320);
    border: 2px solid #C7B38B
}

.theme-midnight .letter-kicker,
.theme-midnight .ornament,
.theme-midnight .letter-date {
    color: #C7B38B
}

.theme-midnight .signature strong {
    color: #F2EFEA
}

.theme-midnight .corner-decor {
    color: #6D1E2C;
    text-shadow: 1px 2px 2px #C7B38B
}

.theme-sugarplum {
    color: #2B2D42;
    background: linear-gradient(135deg, #F4E6F3, #B9E3E2)
}

.theme-sugarplum .letter-inner {
    background: linear-gradient(145deg, #F4E6F3, #FFFFFF);
    border: 2px solid #7A2E6D
}

.theme-sugarplum .letter-kicker,
.theme-sugarplum .ornament,
.theme-sugarplum .letter-date {
    color: #7A2E6D
}

.theme-sugarplum .signature strong {
    color: #C96CB0
}

.theme-sugarplum .corner-decor {
    color: #B9E3E2;
    text-shadow: 1px 2px 2px #2B2D42
}

.preview-tip {
    color: #777;
    font-size: .75rem
}

.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 34px;
    padding: 22px max(28px, calc((100% - 1144px) / 2));
    color: var(--cream);
    background: var(--green);
    border-top: 4px solid var(--burgundy);
    font-size: .78rem;
}

.footer p {
    margin: 0
}

.footer-credit {
    color: var(--gray)
}

.footer strong {
    color: var(--mustard)
}

.footer span {
    color: var(--burgundy)
}

.christmas-intro {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: var(--cream);
    background: #123621f2;
    border: 0
}

.christmas-intro[open] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px
}

.christmas-intro-title {
    margin: 0;
    color: var(--cream);
    font: 700 clamp(1.5rem, 5vw, 2.5rem) "Playfair Display", serif;
    text-align: center
}

.christmas-intro::backdrop {
    background: #123621
}

.christmas-intro-close {
    position: fixed;
    z-index: 2;
    top: 18px;
    right: 22px;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--cream);
    background: #ffffff18;
    border: 1px solid #ffffff55;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer
}

.christmas-intro-close:hover,
.christmas-intro-close:focus-visible {
    background: var(--burgundy);
    outline: 2px solid var(--mustard);
    outline-offset: 3px
}

.christmas-tree-animation {
    width: min(78vw, 520px);
    height: min(68vh, 520px);
    margin: auto
}

.send-dialog {
    position: fixed;
    max-height: 90vh;
    overflow-y: auto;
    width: min(92vw, 460px);
    padding: 27px 30px 31px;
    color: var(--charcoal);
    background: var(--cream);
    border: 2px solid var(--mustard);
    border-radius: 15px;
    box-shadow: 0 24px 60px #0008;
    text-align: center
}

.send-dialog::backdrop {
    background: #1c4a32bd;
    backdrop-filter: blur(3px)
}

.dialog-close {
    position: absolute;
    top: 10px;
    right: 13px;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--green);
    background: transparent;
    border: 0;
    border-radius: 50%;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer
}

.dialog-close:hover {
    color: var(--burgundy);
    background: #9c1c1c12
}

.lottie-animation {
    width: 220px;
    height: 220px;
    margin: 0 auto
}

.share-options h2 {
    margin: 8px 0 7px;
    color: var(--green);
    font: 700 1.7rem "Playfair Display", serif
}

.share-description {
    margin: 0 0 20px;
    color: #555;
    font-size: .9rem
}

.share-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px
}

.share-group-title {
    margin: 9px 0 -2px;
    color: var(--green);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-align: left;
    text-transform: uppercase
}

.share-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
    padding: 10px;
    color: var(--green);
    background: #fff;
    border: 1px solid var(--gray);
    border-radius: 7px;
    font: 600 .8rem "DM Sans", sans-serif;
    text-decoration: none;
    cursor: pointer
}

.share-button:hover {
    border-color: var(--mustard);
    background: #fff9e9
}

.share-button.email {
    color: #fff;
    background: var(--burgundy);
    border-color: var(--burgundy)
}

.share-button.whatsapp {
    color: #fff;
    background: #267b4e;
    border-color: #267b4e
}

.share-button.whatsapp-text {
    color: var(--green);
    background: #fff;
    border-color: #267b4e
}

.share-status {
    min-height: 18px;
    margin: 15px 0 0;
    color: var(--green);
    font-size: .78rem;
    font-weight: 600
}

@media(max-width:760px) {

    .theme-menu-open-button,
    .theme-menu-item {
        flex-basis: 50px;
        width: 50px;
        height: 50px
    }

    .app-shell {
        padding: 24px 12px 32px
    }

    .hero {
        margin-bottom: 20px
    }

    h1 {
        font-size: clamp(2.2rem, 9vw, 3rem)
    }

    .workspace {
        grid-template-columns: 1fr;
        gap: 24px
    }

    .preview-column {
        margin-top: 0
    }

    .letter {
        min-height: 500px
    }

    .letter-inner {
        min-height: 474px;
        padding: 42px 28px 30px
    }

    .letter h2 {
        margin: 8px 0 14px;
        font-size: clamp(1.7rem, 8vw, 2.3rem)
    }

    .letter-message {
        margin: 24px 0 16px;
        font-size: .96rem;
        line-height: 1.6
    }

    .letter-date {
        margin-top: 12px
    }

    .preview-label {
        align-self: center
    }

    .nav {
        min-height: auto;
        padding: 12px;
        flex-direction: column;
        gap: 8px
    }

    .nav-links {
        justify-content: center;
        flex-wrap: wrap
    }

    .footer {
        padding: 20px 18px;
        flex-direction: column;
        text-align: center
    }

    .send-dialog {
        padding: 25px 18px
    }

    .share-buttons {
        grid-template-columns: 1fr
    }
}

@media print {
    body {
        background: #fff
    }

    .app-shell {
        padding: 0
    }

    .site-header,
    .hero,
    .editor-panel,
    .preview-label,
    .preview-tip,
    .footer {
        display: none
    }

    .workspace {
        display: block
    }

    .letter {
        width: 100%;
        min-height: 100vh;
        box-shadow: none
    }

    .letter-inner {
        min-height: calc(100vh - 26px)
    }
}
