/* ==========================================================================
   ChronoLetter — Minimalist Bespoke Birthday Correspondence
   Mobile-Optimized with Responsive Clip-Path Envelope Geometry
   ========================================================================== */

:root {
    --bg-wood: #12100e;
    --bg-card: #1c1916;
    --bg-input: #151210;
    
    --border-subtle: rgba(197, 160, 89, 0.16);
    --border-medium: rgba(197, 160, 89, 0.32);
    --gold-leaf: #c5a059;
    --gold-hover: #d8b46e;

    --text-pure: #faf6ee;
    --text-cream: #ebe4d5;
    --text-muted: #968c7e;
    --text-dim: #6b6357;

    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Newsreader', Garamond, serif;
    --font-sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --font-script: 'Pinyon Script', cursive;

    --shadow-desk: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-wood);
    color: var(--text-cream);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Ambient Vignette */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, transparent 40%, rgba(10, 8, 7, 0.8) 100%);
    pointer-events: none;
    z-index: 0;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(14px);
    background: rgba(18, 16, 14, 0.92);
    border-bottom: 1px solid var(--border-subtle);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-back {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    transition: color 0.2s;
}

.header-back:hover {
    color: var(--gold-leaf);
}

.brand-title {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-pure);
}

.brand-title em {
    font-style: italic;
    color: var(--gold-leaf);
}

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.2s ease;
}

.btn-icon {
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-cream);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.btn-icon:hover {
    border-color: var(--gold-leaf);
    background: rgba(197, 160, 89, 0.12);
}

.btn-pill {
    background: transparent;
    color: var(--gold-leaf);
    border: 1px solid var(--gold-leaf);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.45rem 0.9rem;
    border-radius: 3px;
}

.btn-pill:hover {
    background: var(--gold-leaf);
    color: #12100e;
}

/* ==========================================================================
   WORKSPACE & MOBILE TABS
   ========================================================================== */
.workspace-wrapper {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
}

.mobile-view-tabs {
    display: none;
    margin-bottom: 1.25rem;
    background: #191613;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 3px;
    gap: 3px;
}

.mobile-tab {
    flex: 1;
    padding: 0.6rem;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 4px;
    text-align: center;
}

.mobile-tab.active {
    background: var(--bg-card);
    color: var(--gold-leaf);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

@media (max-width: 850px) {
    .mobile-view-tabs {
        display: flex;
    }
    .workspace-wrapper {
        padding: 1rem 0.85rem;
    }
}

.atelier-layout {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 850px) {
    .atelier-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .scribe-desk.mobile-hidden {
        display: none !important;
    }
    .desk-stage-wrapper.mobile-hidden {
        display: none !important;
    }
}

/* ==========================================================================
   MINIMAL SCRIBE DESK (Left Panel)
   ========================================================================== */
.scribe-desk {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 1.5rem;
    box-shadow: var(--shadow-desk);
}

.scribe-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.fields-row {
    display: flex;
    gap: 0.85rem;
}

.field-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

label {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.section-label-split {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-text-subtle {
    background: transparent;
    color: var(--gold-leaf);
    font-size: 0.75rem;
    padding: 0;
}

input[type="text"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-pure);
    font-family: var(--font-body);
    font-size: 0.95rem;
}

input[type="text"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
    border-color: var(--gold-leaf);
    outline: none;
    box-shadow: 0 0 8px rgba(197, 160, 89, 0.2);
}

textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.5;
}

/* Stationery Radio Grid */
.stationery-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.stationery-choice {
    cursor: pointer;
}

.stationery-choice input {
    display: none;
}

.choice-card {
    padding: 0.5rem 0.4rem;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    background: var(--bg-input);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.choice-swatch {
    width: 100%;
    height: 14px;
    border-radius: 2px;
}

.choice-card.parchment .choice-swatch { background: #e8dbbe; }
.choice-card.midnight .choice-swatch { background: #131720; border: 1px solid rgba(197, 160, 89, 0.4); }
.choice-card.pastel .choice-swatch { background: #fed7e2; }
.choice-card.classified .choice-swatch { background: #c5b596; }

.choice-label {
    font-size: 0.72rem;
    color: var(--text-cream);
}

.stationery-choice input:checked + .choice-card {
    border-color: var(--gold-leaf);
    box-shadow: 0 0 8px rgba(197, 160, 89, 0.3);
}

/* Wax Seal Controls */
.seal-picker {
    display: flex;
    gap: 0.4rem;
}

.seal-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.seal-btn.active {
    background: #6b1414;
    border-color: var(--gold-leaf);
}

.wax-color-control input[type="color"] {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
}

/* Photo Upload Enclosure */
.enclosure-box {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 0.75rem;
}

.polaroid-dropzone {
    border: 1px dashed var(--border-medium);
    border-radius: 4px;
    padding: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.photo-thumbnails-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.thumbnail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #14110e;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 0.35rem 0.5rem;
}

.thumbnail-preview {
    width: 32px;
    height: 32px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}

.thumbnail-caption-input {
    flex: 1;
    font-size: 0.78rem;
    padding: 0.25rem 0.4rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    color: var(--text-pure);
}

.btn-thumb-remove {
    background: transparent;
    color: #ef4444;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.35rem;
    border: none;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.15s, transform 0.15s;
}

.btn-thumb-remove:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Self-Destruct Box */
.protocol-box {
    background: rgba(107, 20, 20, 0.12);
    border: 1px solid rgba(107, 20, 20, 0.35);
    border-radius: 4px;
    padding: 0.85rem;
}

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

.protocol-header strong {
    font-size: 0.85rem;
    color: #fca5a5;
}

.sub-hint {
    display: block;
    font-size: 0.72rem;
    color: #e2a6a6;
    margin-top: 2px;
}

.switch-minimal {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch-minimal input {
    opacity: 0; width: 0; height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #2b2320;
    border-radius: 20px;
    border: 1px solid rgba(197, 160, 89, 0.2);
    transition: 0.25s;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: #d1c5b4;
    border-radius: 50%;
    transition: 0.25s;
}

input:checked + .switch-slider {
    background-color: #7f1d1d;
    border-color: #ef4444;
}

input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: #fee2e2;
}

.protocol-controls {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(239, 68, 68, 0.15);
}

/* Custom Slug Input */
.slug-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    overflow: hidden;
}

.slug-prefix {
    font-size: 0.8rem;
    color: var(--text-dim);
    padding: 0.65rem 0 0.65rem 0.75rem;
    user-select: none;
}

.slug-input-wrapper input {
    border: none;
    background: transparent;
    padding-left: 0.25rem;
}

/* Dispatch Button */
.btn-dispatch {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, #c5a059, #a3813a);
    color: #12100e;
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.btn-dispatch:hover {
    background: linear-gradient(135deg, #d8b46e, #b59247);
    transform: translateY(-1px);
}

/* ==========================================================================
   PREVIEW STAGE (Right Panel)
   ========================================================================== */
.desk-stage-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    box-shadow: var(--shadow-desk);
    position: sticky;
    top: 4.5rem;
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.stage-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.stage-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stage-tools {
    display: flex;
    gap: 0.4rem;
}

.btn-tool {
    font-size: 0.72rem;
    padding: 0.3rem 0.65rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-cream);
    border-radius: 3px;
}

.btn-burn-preview {
    background: rgba(127, 29, 29, 0.25);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.tabletop-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2.5rem 1rem;
    overflow: hidden;
    background: radial-gradient(circle at center, #1c1815 0%, #110e0c 85%);
}

/* ==========================================================================
   FLUID RESPONSIVE ENVELOPE (Using 100% Percentage Clip-Path)
   ========================================================================== */
.envelope-wrapper {
    position: relative;
    width: 360px;
    max-width: 88vw;
    margin: 0 auto;
    transition: transform 0.4s ease;
}

@media (max-width: 480px) {
    .envelope-wrapper {
        width: 300px;
        max-width: 90vw;
    }
}

.envelope {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 2.65;
    border-radius: 4px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.55);
    cursor: pointer;
    transition: all 0.45s ease;
}

.envelope-pocket {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 10;
    pointer-events: none;
    border-radius: 4px;
}

.envelope-flap-left {
    position: absolute;
    inset: 0;
    clip-path: polygon(0 0, 50% 50%, 0 100%);
    z-index: 11;
}

.envelope-flap-right {
    position: absolute;
    inset: 0;
    clip-path: polygon(100% 0, 50% 50%, 100% 100%);
    z-index: 11;
}

.envelope-flap-bottom {
    position: absolute;
    inset: 0;
    clip-path: polygon(0 100%, 50% 48%, 100% 100%);
    z-index: 12;
}

.envelope-flap-top {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 56%;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), z-index 0.2s 0.3s;
    z-index: 15;
}

.envelope.open .envelope-flap-top {
    transform: rotateX(180deg);
    z-index: 5;
}

.envelope-front-badge {
    position: absolute;
    top: 56%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 14;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.3s ease;
    width: 80%;
}

.envelope.open .envelope-front-badge {
    opacity: 0;
}

.badge-to-label {
    font-size: 0.62rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.7;
}

.badge-to-name {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wax-seal {
    position: absolute;
    top: 54%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 58px;
    height: 58px;
    border-radius: 50%;
    z-index: 20;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5), inset 0 2px 4px rgba(255,255,255,0.4);
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.25s ease, opacity 0.3s ease;
}

.wax-seal:hover {
    transform: translate(-50%, -50%) scale(1.08);
}

.envelope.open .wax-seal {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -150%) scale(0.6);
}

/* ==========================================================================
   THE LETTER (Inside Paper)
   ========================================================================== */
.letter-paper {
    position: absolute;
    top: 8px;
    left: 4%;
    right: 4%;
    height: 90%;
    padding: 1.5rem;
    border-radius: 3px;
    z-index: 6;
    overflow: hidden;
    transition: all 0.65s cubic-bezier(0.34, 1.25, 0.64, 1);
    display: flex;
    flex-direction: column;
}

.letter-paper::before,
.letter-paper::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 1px;
    pointer-events: none;
    opacity: 0.3;
}
.letter-paper::before { top: 33%; box-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.letter-paper::after { top: 66%; box-shadow: 0 1px 2px rgba(0,0,0,0.15); }

.envelope.open .letter-paper {
    top: -115px;
    height: auto;
    min-height: 380px;
    max-height: 72vh;
    overflow-y: auto;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
    z-index: 30;
    transform: scale(1.04);
}

@media (max-width: 480px) {
    .envelope.open .letter-paper {
        top: -95px;
        min-height: 340px;
        padding: 1.25rem 1rem;
        transform: scale(1.02);
    }
}

.letter-salutation {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-style: italic;
    margin-bottom: 0.75rem;
}

.letter-body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
    white-space: pre-wrap;
    flex: 1;
}

.letter-signoff {
    margin-top: 1.5rem;
    text-align: right;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.95rem;
}

.letter-sender {
    font-family: var(--font-script);
    font-size: 1.8rem;
    line-height: 1.1;
    display: block;
    margin-top: 0.15rem;
}

.polaroid-gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin: 1rem 0 0.5rem;
}

.letter-polaroid {
    background: #fff;
    padding: 5px 5px 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    max-width: 140px;
    width: calc(50% - 0.4rem);
    border-radius: 2px;
    transition: transform 0.2s ease, z-index 0.2s ease;
    cursor: pointer;
    position: relative;
}

.polaroid-gallery:has(> :only-child) .letter-polaroid,
.letter-polaroid:only-child {
    max-width: 180px;
    width: 100%;
}

.polaroid-gallery:has(> :only-child) .letter-polaroid img,
.letter-polaroid:only-child img {
    height: 140px;
}

.letter-polaroid:nth-child(1) { transform: rotate(-2deg); }
.letter-polaroid:nth-child(2) { transform: rotate(2deg); }
.letter-polaroid:nth-child(3) { transform: rotate(-1.5deg); }
.letter-polaroid:nth-child(4) { transform: rotate(2.5deg); }

.letter-polaroid:hover,
.letter-polaroid.focused,
.letter-polaroid:active {
    transform: scale(1.08) rotate(0deg) !important;
    z-index: 10;
}

.letter-polaroid img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
}

.polaroid-caption {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.76rem;
    color: #1f2937;
    text-align: center;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    .letter-polaroid {
        max-width: 130px;
        padding: 4px 4px 10px;
    }
    .letter-polaroid img {
        height: 95px;
    }
    .polaroid-gallery:has(> :only-child) .letter-polaroid,
    .letter-polaroid:only-child {
        max-width: 160px;
    }
    .polaroid-gallery:has(> :only-child) .letter-polaroid img,
    .letter-polaroid:only-child img {
        height: 125px;
    }
}

/* ==========================================================================
   THEMES
   ========================================================================== */
.theme-parchment .envelope { background-color: #5c1818; }
.theme-parchment .envelope-flap-left { background-color: #4a1313; }
.theme-parchment .envelope-flap-right { background-color: #4a1313; }
.theme-parchment .envelope-flap-bottom { background-color: #3d0f0f; }
.theme-parchment .envelope-flap-top { background-color: #691c1c; }
.theme-parchment .envelope-front-badge { color: #f7e2c8; }
.theme-parchment .letter-paper {
    background-color: #faf6eb;
    color: #2b1a0d;
}
.theme-parchment .letter-salutation,
.theme-parchment .letter-sender { color: #6b1414; }

.theme-midnight .envelope { background-color: #0b0d13; border: 1px solid rgba(197, 160, 89, 0.25); }
.theme-midnight .envelope-flap-left { background-color: #08090d; }
.theme-midnight .envelope-flap-right { background-color: #08090d; }
.theme-midnight .envelope-flap-bottom { background-color: #040508; }
.theme-midnight .envelope-flap-top { background-color: #11141d; }
.theme-midnight .envelope-front-badge { color: #c5a059; }
.theme-midnight .letter-paper {
    background-color: #0f131a;
    color: #f3eee3;
    border: 1px solid rgba(197, 160, 89, 0.3);
}
.theme-midnight .letter-salutation,
.theme-midnight .letter-sender { color: #c5a059; }

.theme-pastel .envelope { background-color: #9f2a44; }
.theme-pastel .envelope-flap-left { background-color: #842036; }
.theme-pastel .envelope-flap-right { background-color: #842036; }
.theme-pastel .envelope-flap-bottom { background-color: #6d172b; }
.theme-pastel .envelope-flap-top { background-color: #b0324e; }
.theme-pastel .envelope-front-badge { color: #fff; }
.theme-pastel .letter-paper {
    background-color: #fffbf9;
    color: #3b2c31;
}
.theme-pastel .letter-salutation,
.theme-pastel .letter-sender { color: #9f2a44; }

.theme-classified .envelope { background-color: #a38c6d; }
.theme-classified .envelope-flap-left { background-color: #8a7457; }
.theme-classified .envelope-flap-right { background-color: #8a7457; }
.theme-classified .envelope-flap-bottom { background-color: #735f45; }
.theme-classified .envelope-flap-top { background-color: #b39b7a; }
.theme-classified .envelope-front-badge { color: #5c1818; }
.theme-classified .letter-paper {
    background-color: #ded1b8;
    color: #171513;
}
.theme-classified .letter-salutation,
.theme-classified .letter-sender { color: #7f1d1d; }

/* ==========================================================================
   RECIPIENT MODE & COMBUSTION
   ========================================================================== */
.recipient-section {
    min-height: calc(100vh - 6rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.recipient-hud {
    position: fixed;
    top: 4.25rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(22, 19, 17, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: 30px;
    padding: 0.4rem 1.15rem;
    z-index: 100;
    max-width: 90vw;
}

.hud-inscribed {
    font-family: var(--font-serif);
    font-size: 0.9rem;
    color: var(--text-pure);
}

.hud-incineration {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(127, 29, 29, 0.3);
    border-radius: 20px;
    padding: 2px 8px;
}

.timer-digits {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fee2e2;
}

.clock-meter {
    width: 45px;
    height: 4px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
}

.clock-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ef4444, #f97316);
    transition: width 1s linear;
}

.recipient-tabletop {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 3rem;
}

.recipient-bottom {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
}

.recipient-credits {
    font-size: 0.72rem;
    color: var(--text-dim);
}

.recipient-credits a {
    color: var(--gold-leaf);
    text-decoration: none;
}

/* Procedural Canvas Overlay */
.combustion-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 200;
}

.active-burn-canvas {
    position: absolute;
    left: 4%;
    width: 92%;
    z-index: 40;
    pointer-events: none;
}

/* ==========================================================================
   THE MEME AFTERMATH (Cat Shaking Head No)
   ========================================================================== */
.ash-remains-card {
    background: #191613;
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    padding: 2rem 1.5rem;
    text-align: center;
    max-width: 380px;
    width: 90vw;
    animation: fadeInMeme 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-desk);
}

@keyframes fadeInMeme {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.meme-gif-wrapper {
    width: 100%;
    max-width: 240px;
    margin: 0 auto 1.25rem;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    background: #110e0c;
}

.meme-cat-gif {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease;
}

.meme-cat-gif:active {
    transform: scale(0.96);
}

.resurrect-hint {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 0.65rem;
    font-style: italic;
    user-select: none;
}

.resurrect-banner {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(197, 160, 89, 0.95);
    color: #12100e;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.45rem 1.25rem;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(197, 160, 89, 0.4);
    z-index: 150;
    animation: fadeInBanner 0.4s ease;
}

@keyframes fadeInBanner {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.checkbox-simple {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.76rem;
    color: var(--text-muted);
    cursor: pointer;
}

.checkbox-simple input {
    accent-color: var(--gold-leaf);
    width: 15px;
    height: 15px;
}

.ash-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: #faf6ee;
    margin-bottom: 0.35rem;
    letter-spacing: -0.01em;
}

.ash-text {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 1.5rem;
}

.btn-create-fresh {
    background: var(--gold-leaf);
    color: #12100e;
    font-weight: 600;
    padding: 0.6rem 1.4rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.btn-create-fresh:hover {
    background: var(--gold-hover);
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 8, 7, 0.85);
    backdrop-filter: blur(8px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-dialog {
    background: #1b1714;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-desk);
    overflow: hidden;
}

.dialog-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
}

.dialog-title {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    color: var(--text-pure);
}

.dialog-close {
    position: absolute;
    top: 1.15rem; right: 1.25rem;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.3rem;
}

.dialog-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.dialog-intro {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.link-copy-container {
    display: flex;
    gap: 0.4rem;
}

.btn-copy-action {
    background: var(--gold-leaf);
    color: #12100e;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0 1rem;
    border-radius: 3px;
}

.copy-success-notice {
    font-size: 0.75rem;
    color: #34d399;
    display: none;
}

.dialog-actions-grid {
    display: flex;
    gap: 0.4rem;
}

.btn-secondary-action {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-cream);
    padding: 0.5rem;
    border-radius: 3px;
    font-size: 0.78rem;
    text-align: center;
    text-decoration: none;
}

.qr-display-card {
    text-align: center;
    padding: 1rem;
    background: #fff;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.qr-label {
    font-size: 0.7rem;
    color: #4b5563;
}

.incineration-dialog-warning {
    background: rgba(127, 29, 29, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    padding: 0.65rem;
    font-size: 0.78rem;
    color: #fca5a5;
}

.dialog-footer {
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
}

.btn-dialog-primary {
    background: var(--gold-leaf);
    color: #12100e;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: 3px;
    font-size: 0.9rem;
}

/* Supabase Help & Status */
.supabase-sql-help {
    background: #13100e;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

.supabase-sql-help summary {
    cursor: pointer;
    color: var(--gold-leaf);
    font-weight: 500;
}

.supabase-sql-help pre {
    margin-top: 0.5rem;
    overflow-x: auto;
    color: #cbd5e1;
    font-family: monospace;
    font-size: 0.72rem;
    line-height: 1.4;
}

.status-banner {
    background: rgba(197, 160, 89, 0.1);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
    color: var(--gold-leaf);
}
