/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --deep-plum: #2d1b36;
    --amber: #e8a44a;
    --mid-plum: #3a2545;
    --darkest: #1e1521;
    --rose-mist: #c9a8b4;
    --warm-cream: #f5e6d0;
    --mauve: #8b4a6b;
    --light-amber: #f4c27a;

    --font-display: 'Caveat', cursive;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--darkest);
    color: var(--warm-cream);
    font-family: var(--font-body);
    font-weight: 300;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ===== BUBBLE LAYER ===== */
#bubble-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(245, 230, 208, 0.2) 0%, rgba(45, 27, 54, 0.05) 70%, transparent 100%);
    border: 1px solid rgba(200, 168, 180, 0.12);
    animation: bubble-rise linear forwards;
    will-change: transform, opacity;
}

@keyframes bubble-rise {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-110vh) translateX(var(--drift, 30px)) scale(var(--end-scale, 1.2));
        opacity: 0;
    }
}

/* ===== OPENING SECTION ===== */
.opening {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--darkest);
    cursor: pointer;
    transition: opacity 1.5s ease, visibility 1.5s ease;
}

.opening.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.opening-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 164, 74, 0.15) 0%, transparent 70%);
    animation: glow-breathe 4s ease-in-out infinite;
}

@keyframes glow-breathe {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
}

.opening-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 700;
    color: var(--warm-cream);
    letter-spacing: 0.01em;
    position: relative;
    z-index: 2;
    animation: title-fade-in 2s ease forwards;
}

.opening-title .dot {
    color: var(--amber);
}

@keyframes title-fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.opening-whisper {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 400;
    color: var(--rose-mist);
    margin-top: 1rem;
    opacity: 0;
    animation: whisper-in 2s ease 1s forwards;
}

@keyframes whisper-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 0.8; transform: translateY(0); }
}

.opening-invite {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--rose-mist);
    opacity: 0;
    letter-spacing: 0.08em;
    margin-top: 3rem;
    animation: invite-pulse 2s ease 2.5s forwards;
}

@keyframes invite-pulse {
    0% { opacity: 0; }
    50% { opacity: 0.5; }
    100% { opacity: 0.4; }
}

/* ===== DASHBOARD ===== */
.dashboard {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    padding: 1rem;
    opacity: 0;
    transition: opacity 1.5s ease 0.5s;
}

.dashboard.visible {
    opacity: 1;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== PANELS ===== */
.panel {
    background: rgba(58, 37, 69, 0.4);
    border: 1px solid rgba(200, 168, 180, 0.08);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.6s ease, box-shadow 0.6s ease;
    position: relative;
}

.panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(232, 164, 74, 0.04) 0%, transparent 60%);
    pointer-events: none;
}

.panel:hover {
    border-color: rgba(232, 164, 74, 0.2);
    box-shadow: 0 0 30px rgba(232, 164, 74, 0.05);
}

.panel-inner {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.panel-heading {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3.6rem);
    font-weight: 400;
    color: var(--light-amber);
    letter-spacing: 0.01em;
    margin-bottom: 1rem;
}

/* Panel sizes */
.panel-large {
    grid-column: span 2;
    grid-row: span 2;
    min-height: 350px;
}

.panel-narrow {
    grid-column: span 1;
    grid-row: span 2;
    min-height: 300px;
}

.panel-small {
    grid-column: span 1;
    grid-row: span 1;
    min-height: 120px;
}

.panel-medium {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 180px;
}

/* ===== PANEL: BUBBLES ===== */
.bubble-scene {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.scene-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(245, 230, 208, 0.25) 0%, rgba(139, 74, 107, 0.08) 70%, transparent 100%);
    border: 1px solid rgba(200, 168, 180, 0.15);
    animation: scene-bubble-float linear infinite;
}

@keyframes scene-bubble-float {
    0% { transform: translateY(100%) translateX(0); opacity: 0; }
    10% { opacity: 0.8; }
    80% { opacity: 0.4; }
    100% { transform: translateY(-20px) translateX(var(--drift, 15px)); opacity: 0; }
}

/* ===== PANEL: POETRY ===== */
.panel-poetry {
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-poetry .panel-inner {
    align-items: center;
    justify-content: center;
}

.poetry-line {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 400;
    color: var(--rose-mist);
    text-align: center;
    line-height: 1.6;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

/* ===== PANEL: PULSE ===== */
.panel-pulse .panel-inner {
    align-items: center;
    justify-content: center;
}

.heartbeat-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--amber);
    animation: heartbeat 2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(232, 164, 74, 0.3);
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    15% { transform: scale(1.3); opacity: 1; }
    30% { transform: scale(1); opacity: 0.7; }
    45% { transform: scale(1.15); opacity: 0.9; }
    60% { transform: scale(1); opacity: 0.7; }
}

/* ===== PANEL: WHISPERS ===== */
.whisper-feed {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.whisper {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--warm-cream);
    opacity: 0;
    transition: opacity 1.5s ease, transform 1.5s ease;
    transform: translateY(10px);
    position: absolute;
}

.whisper.active {
    opacity: 0.85;
    transform: translateY(0);
    position: relative;
}

/* ===== PANEL: WARMTH ===== */
.warmth-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.warmth-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rose-mist);
    opacity: 0.6;
    margin-bottom: 0.5rem;
}

.warmth-value {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    color: var(--amber);
    font-weight: 700;
}

/* ===== PANEL: AMBIENT ===== */
.ambient-reading {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
}

.ambient-bar {
    height: 4px;
    background: rgba(200, 168, 180, 0.15);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.ambient-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 72%;
    background: linear-gradient(90deg, var(--amber), var(--light-amber));
    border-radius: 2px;
    animation: ambient-glow 6s ease-in-out infinite;
}

@keyframes ambient-glow {
    0%, 100% { width: 72%; opacity: 0.8; }
    50% { width: 78%; opacity: 1; }
}

.ambient-text {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--rose-mist);
    opacity: 0.5;
}

/* ===== PANEL: QUIET ROOM ===== */
.panel-quiet .panel-inner {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.quiet-text {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--rose-mist);
    opacity: 0.6;
    line-height: 1.8;
    margin-bottom: 2rem;
}

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

.candle-body {
    width: 8px;
    height: 40px;
    background: linear-gradient(to bottom, var(--warm-cream), var(--rose-mist));
    border-radius: 2px 2px 4px 4px;
}

.candle-flame {
    width: 12px;
    height: 20px;
    background: radial-gradient(ellipse at 50% 80%, var(--amber) 0%, var(--light-amber) 40%, transparent 70%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flame-flicker 3s ease-in-out infinite;
    filter: blur(0.5px);
    margin-bottom: -2px;
}

@keyframes flame-flicker {
    0%, 100% { transform: scaleX(1) scaleY(1) rotate(0deg); }
    25% { transform: scaleX(0.9) scaleY(1.05) rotate(-2deg); }
    50% { transform: scaleX(1.05) scaleY(0.95) rotate(1deg); }
    75% { transform: scaleX(0.95) scaleY(1.02) rotate(-1deg); }
}

/* ===== PANEL: STATUS ===== */
.panel-status .panel-inner {
    align-items: center;
    justify-content: center;
    flex-direction: row;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--amber);
    animation: status-blink 3s ease-in-out infinite;
}

@keyframes status-blink {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.status-text {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--rose-mist);
    opacity: 0.5;
}

/* ===== PANEL: TOUCH ===== */
.touch-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 8px;
    cursor: pointer;
    min-height: 80px;
}

.touch-ripple {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid rgba(232, 164, 74, 0.2);
    opacity: 0;
    pointer-events: none;
}

.touch-ripple.active {
    animation: ripple-out 1.5s ease forwards;
}

@keyframes ripple-out {
    0% { transform: scale(0.5); opacity: 0.8; border-color: rgba(232, 164, 74, 0.5); }
    100% { transform: scale(3); opacity: 0; border-color: rgba(232, 164, 74, 0); }
}

.touch-response {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--light-amber);
    opacity: 0;
    transition: opacity 1s ease;
    text-align: center;
}

.touch-response.visible {
    opacity: 0.9;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .panel-large {
        grid-column: span 2;
        grid-row: span 1;
        min-height: 250px;
    }

    .panel-narrow {
        grid-column: span 1;
        grid-row: span 1;
        min-height: 200px;
    }

    .panel-medium {
        grid-column: span 2;
    }

    .poetry-line {
        writing-mode: horizontal-tb;
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .panel-large,
    .panel-narrow,
    .panel-medium,
    .panel-small {
        grid-column: span 1;
    }
}
