/* The Worry Campfire - Master CSS */
:root {
    --bg-dark: #07090e;
    --dock-bg: rgba(18, 14, 24, 0.78);
    --dock-border: rgba(255, 130, 45, 0.25);
    
    --fire-gold: #ffc837;
    --fire-orange: #ff6a00;
    --fire-crimson: #ee0979;
    --fire-glow: rgba(255, 106, 0, 0.45);
    
    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    --transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    color: var(--text-primary);
}

/* --- Fullscreen Scene --- */
.scene-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.campfire-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('images/campfire_bg.jpg');
    background-size: cover;
    background-position: center 65%;
    background-repeat: no-repeat;
    transform: scale(1.03);
    transition: transform 15s ease-out;
}

/* Deep Night Vignette */
.scene-container::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 50% 65%, transparent 20%, rgba(7, 9, 14, 0.5) 60%, rgba(7, 9, 14, 0.95) 100%);
    pointer-events: none;
}

/* Ambient Radial Flame Glow */
.fire-glow-layer {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 120, 30, 0.4) 0%, rgba(255, 60, 0, 0.15) 50%, transparent 80%);
    filter: blur(80px);
    opacity: 0.85;
    pointer-events: none;
    animation: flamePulse 3s infinite alternate ease-in-out;
}

@keyframes flamePulse {
    0% { opacity: 0.7; transform: translateX(-50%) scale(0.96); }
    100% { opacity: 0.95; transform: translateX(-50%) scale(1.05); }
}

/* Live Canvas */
#ember-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* --- Header --- */
.top-nav {
    position: fixed;
    top: 20px;
    left: 24px;
    right: 24px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 10px rgba(255, 106, 0, 0.8));
}
.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 60%, #ffd4a3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.brand-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: block;
}

.nav-tools, .nav-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.glass-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}
.glass-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 130, 45, 0.5);
    transform: translateY(-1px);
}

/* Top Ad Container */
.ad-top-wrapper {
    position: fixed;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    width: 90%;
    max-width: 680px;
    min-height: 40px;
    max-height: 75px;
    overflow: hidden;
    opacity: 0.75;
}

/* --- Main Content Area --- */
.main-content {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 6;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    padding: 20px;
}

/* 1. The Worry Paper Note */
.worry-card-container {
    width: 100%;
    max-width: 520px;
    pointer-events: auto;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s ease;
}

.worry-paper {
    background: rgba(24, 18, 14, 0.82);
    border: 1px solid rgba(255, 130, 45, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 35px rgba(255, 90, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.paper-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.quill-icon {
    font-size: 1.5rem;
}
.paper-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff2e0;
    letter-spacing: -0.01em;
}
.paper-sub {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.5;
}

.input-wrapper textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 14px;
    color: #ffffff;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: var(--transition);
}
.input-wrapper textarea:focus {
    border-color: var(--fire-orange);
    box-shadow: 0 0 15px rgba(255, 106, 0, 0.35);
    background: rgba(0, 0, 0, 0.6);
}
.input-wrapper textarea::placeholder {
    color: #64748b;
    font-size: 0.85rem;
}

.paper-actions {
    display: flex;
    justify-content: flex-end;
}
.burn-button {
    background: linear-gradient(135deg, #ff7a18, #ff3c00);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(255, 60, 0, 0.5);
    transition: var(--transition);
}
.burn-button:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 28px rgba(255, 60, 0, 0.7);
}
.burn-flame {
    font-size: 1.1rem;
    animation: flameShake 1.5s infinite ease-in-out;
}
@keyframes flameShake {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(8deg) scale(1.15); }
}

/* Multi-Phase Burning Into Fire Animation & Climax */
@keyframes burnAndSinkClimax {
    0% {
        transform: translateY(0) scale(1) rotate(0deg);
        filter: brightness(1) drop-shadow(0 0 0 rgba(255, 100, 0, 0));
        opacity: 1;
    }
    30% {
        transform: translateY(45px) scale(0.92) rotate(-3deg);
        filter: brightness(1.7) contrast(1.2) drop-shadow(0 0 35px rgba(255, 120, 20, 0.9));
        box-shadow: inset 0 0 50px rgba(255, 60, 0, 0.85);
        opacity: 0.95;
    }
    65% {
        transform: translateY(150px) scale(0.65) rotate(7deg);
        filter: brightness(3.5) contrast(1.6) blur(2px) drop-shadow(0 0 60px rgba(255, 80, 0, 1));
        opacity: 0.85;
    }
    85% {
        transform: translateY(260px) scale(0.3) rotate(14deg);
        filter: brightness(6) contrast(2) blur(6px) drop-shadow(0 0 80px rgba(255, 200, 50, 1));
        opacity: 0.5;
    }
    100% {
        transform: translateY(360px) scale(0.08) rotate(22deg);
        filter: brightness(8) blur(14px);
        opacity: 0;
    }
}

.worry-card-container.burning {
    animation: burnAndSinkClimax 2.6s cubic-bezier(0.35, 0, 0.25, 1) forwards;
    pointer-events: none;
}

/* 2. Relief Card (Comfort After Burning) */
.relief-card-container {
    width: 100%;
    max-width: 540px;
    pointer-events: auto;
    transition: opacity 1.2s ease, transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.relief-card-container.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    display: none;
}

.relief-card {
    background: rgba(18, 14, 20, 0.85);
    border: 1px solid rgba(255, 180, 80, 0.3);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 35px rgba(255, 120, 20, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 18px;
}
.relief-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.relief-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffd8a8;
}
.relief-message {
    font-family: 'Nanum Myeongjo', serif;
    font-size: 1.05rem;
    color: #f1f5f9;
    line-height: 1.8;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}


.relief-actions {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    flex-wrap: wrap;
    justify-content: center;
}
.pill-action-btn {
    background: linear-gradient(135deg, #ff7a18, #ff3c00);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(255, 60, 0, 0.4);
    transition: var(--transition);
}
.pill-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 60, 0, 0.6);
}
.pill-action-btn.outline {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--dock-border);
    box-shadow: none;
}
.pill-action-btn.outline:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Floating Pen Button (좌측 밑으로 배치) */
.floating-pen-btn {
    position: fixed;
    bottom: 34px;
    left: 28px;
    z-index: 25;
    background: rgba(24, 18, 14, 0.88);
    border: 1px solid rgba(255, 130, 45, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #ffd4a3;
    padding: 12px 22px;
    border-radius: var(--radius-full);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    transition: var(--transition);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 100, 0, 0.25);
}
.floating-pen-btn:hover {
    transform: translateY(-2px) scale(1.05);
    background: rgba(255, 120, 30, 0.45);
    border-color: var(--fire-orange);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 120, 20, 0.5);
    color: #ffffff;
}
.floating-pen-btn.hidden {
    display: none;
}

/* --- Floating Master Control Dock --- */
.control-dock-wrap {
    position: fixed;
    bottom: 34px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: 90%;
    max-width: 680px;
    pointer-events: auto;
}

.glass-dock {
    background: var(--dock-bg);
    border: 1px solid var(--dock-border);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.75), 0 0 30px rgba(255, 90, 0, 0.15);
    padding: 14px 22px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.dock-circle-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff7a18, #ff3c00);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 90, 0, 0.45);
    flex-shrink: 0;
    transition: var(--transition);
}
.dock-circle-btn:hover {
    transform: scale(1.08);
}
.dock-circle-btn:not(.playing) {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.vol-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}
.vol-icon {
    font-size: 1.1rem;
}
.vol-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
    cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--fire-orange);
    box-shadow: 0 0 10px var(--fire-glow);
    cursor: pointer;
}
.vol-val {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 34px;
    text-align: right;
}

.timer-control {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.timer-chips {
    display: flex;
    gap: 4px;
}
.t-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    cursor: pointer;
    transition: var(--transition);
}
.t-chip:hover {
    background: rgba(255, 255, 255, 0.14);
    color: white;
}
.t-chip.active {
    background: rgba(255, 122, 24, 0.25);
    border-color: var(--fire-orange);
    color: var(--fire-orange);
    font-weight: 600;
}
.timer-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 4-7-8 Breathing Meditation Modal (Campfire Integrated & Translucent) */
.breathe-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 60;
    background: rgba(10, 8, 14, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease;
}
.breathe-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}
.breathe-card {
    background: rgba(22, 16, 26, 0.82);
    border: 1px solid rgba(255, 140, 50, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 100, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    text-align: center;
    max-width: 380px;
    width: 90%;
}
.breathe-circle {
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 122, 24, 0.35) 0%, rgba(238, 9, 121, 0.15) 70%, transparent 100%);
    border: 2px solid rgba(255, 180, 80, 0.5);
    box-shadow: 0 0 45px rgba(255, 106, 0, 0.4), inset 0 0 30px rgba(238, 9, 121, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 4s cubic-bezier(0.4, 0, 0.2, 1);
}
.breathe-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.breathe-action {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff2e0;
    letter-spacing: -0.01em;
}
.breathe-count {
    font-size: 2.4rem;
    font-weight: 700;
    color: #ff9d42;
    font-variant-numeric: tabular-nums;
}
.breathe-sub {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.4;
}

/* Footer */
.app-footer {
    position: fixed;
    bottom: 8px;
    left: 0; right: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 0.74rem;
    color: var(--text-muted);
}
.app-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}
.app-footer a:hover {
    color: var(--fire-gold);
}

/* Privacy & Legal Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-overlay.hidden {
    display: none;
}
.modal-card {
    max-width: 580px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 28px 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(18, 14, 22, 0.94);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 30px rgba(255, 120, 40, 0.15);
    border-radius: 20px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--fire-gold);
    margin: 0;
}
.modal-close-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 4px 8px;
    line-height: 1;
}
.modal-close-icon:hover {
    color: #fff;
    transform: scale(1.15);
}
.modal-body {
    overflow-y: auto;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-size: 0.88rem;
    color: #cbd5e1;
    line-height: 1.65;
}
.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}
.legal-section h4 {
    font-size: 0.95rem;
    color: #f8fafc;
    margin: 0 0 6px 0;
    font-weight: 600;
}
.legal-section p {
    margin: 0;
    color: #94a3b8;
}
.legal-section strong {
    color: #fef08a;
}
.modal-footer {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .glass-dock {
        flex-direction: column;
        padding: 14px;
        gap: 12px;
    }
    .vol-control {
        width: 100%;
    }
    .timer-control {
        width: 100%;
        align-items: center;
    }
    .timer-chips {
        width: 100%;
        justify-content: center;
    }
    .worry-paper {
        padding: 20px;
    }
    .paper-header h2 {
        font-size: 1.05rem;
    }
    .top-nav {
        top: 14px;
        left: 16px;
        right: 16px;
    }
}
