/**
 * New Life Daily — Springtime in Heaven (2027 System)
 * Unified Design System
 */

:root {
    color-scheme: light;
    --primary: #3A8A5F;
    --primary-dark: #2A3A1C;
    --accent-gold: #D9A24A;
    --bg-top: #DCD0E8;
    --bg-mid: #FFE4C4;
    --bg-bottom: #FFF6E6;
    --bg-main: var(--bg-bottom);
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-main: #2A2522;
    --text-muted: #6B5B4B;
    --font-family: 'Inter', -apple-system, sans-serif;
    --font-serif: 'Cormorant Garamond', 'Georgia', serif;

    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-subtle: 0 2px 10px rgba(42, 37, 34, 0.05);
    --shadow-float: 0 5px 20px rgba(42, 37, 34, 0.08);

    --s-3: 3px; --s-6: 6px; --s-9: 9px; --s-12: 12px; --s-18: 18px;
    --s-24: 24px; --s-27: 27px; --s-36: 36px; --s-48: 48px;
    --s-72: 72px; --s-96: 96px; --s-144: 144px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 45%, var(--bg-bottom) 100%);
    background-attachment: fixed;
    background-size: cover;
    color: var(--text-main);
    font-family: var(--font-family);
    letter-spacing: 0.05em;
    line-height: 1.8;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
}

h1, h2, h3 { font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.01em; }

/* --- Bounded Habitat Container (legacy fullscreen) --- */
#habitat-container {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1A2F1C 0%, #2A3A1C 100%);
    opacity: 0;
    transition: opacity 1.2s ease;
}
#habitat-container.visible {
    opacity: 1;
}
#habitat-container canvas { display: block; width: 100%; height: 100%; pointer-events: auto; }

/* The 3D habitat now lives inside the Garden tab (#garden-habitat). */
#garden-habitat {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-width: 480px;
    margin: 0 auto;
    background: linear-gradient(180deg, #1A2F1C 0%, #2A3A1C 100%);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-float);
    border: 8px solid #fffaf0; /* Parchment/White border */
    outline: 2px solid var(--accent-gold);
    outline-offset: -10px;
}
#garden-habitat canvas { display: block; width: 100%; height: 100%; pointer-events: auto; }

/* --- Content Layers --- */
.scroll-zone {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

main {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Onboarding screens are semi-transparent to see the sprout */
.onboarding-screen {
    background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 45%, var(--bg-bottom) 100%) !important;
    z-index: 100;
    text-align: center;
    overflow-y: auto;
    padding-bottom: 120px;
}

.screen { display: none; width: 100%; max-width: 520px; margin: 0 auto; padding-top: 80px; text-align: center; }
.screen.active { display: flex; flex-direction: column; align-items: center; animation: screen-fade 0.25s ease-out; }

/* Tabs 0, 1, 2 have semi-opaque backgrounds to see the soft colors */
#screen-0.active, #screen-1.active, #screen-2.active {
    background: transparent;
    min-height: 100vh;
    padding-left: var(--s-18);
    padding-right: var(--s-18);
    padding-bottom: 240px; /* Massive space for nav bar and accessibility */
    justify-content: flex-start;
}

/* Tab 3 (Garden) is transparent to show the tree through its hole */
#screen-3.active {
    background: transparent;
    min-height: 100vh;
    padding-bottom: 240px; /* Massive space for nav bar */
    justify-content: flex-start;
}

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

.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: var(--s-24);
    margin-bottom: var(--s-18);
    box-shadow: var(--shadow-subtle);
    border: 1px solid rgba(0,0,0,0.02);
    position: relative;
    width: 100%;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: var(--s-12) var(--s-24);
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(58,138,95,0.2);
}
.btn:active { transform: scale(0.98); }
.btn-ghost { background: transparent; color: var(--primary); border: 2px solid var(--primary); box-shadow: none; }
.btn-block { display: block; width: 100%; }

.nav {
    position: fixed;
    bottom: var(--s-24);
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 420px;
    background: rgba(255, 250, 240, 0.32);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    display: flex;
    justify-content: space-around;
    gap: var(--s-27);
    padding: var(--s-12) var(--s-24);
    border-radius: 999px;
    box-shadow:
        0 8px 24px rgba(10, 8, 5, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.65),
        inset 0 -1px 0 rgba(58, 138, 95, 0.12);
    z-index: 10000;
    border: 1px solid rgba(255, 255, 255, 0.55);
    pointer-events: auto !important;
}

.nav-item {
    color: var(--text-muted, #6b7a6f);
    text-decoration: none;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-3);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}
.nav-item.active { color: var(--primary); }
.nav-item span { font-size: 24px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.12)); }

.input {
    width: 100%;
    padding: var(--s-12) 0;
    border: none;
    border-bottom: 1px solid rgba(58, 138, 95, 0.2);
    background: transparent !important;
    font-family: inherit;
    font-size: 18px;
    outline: none;
    transition: border-color 0.3s ease;
}
.input:focus { border-bottom-color: var(--primary); }

.word-pill {
    padding: var(--s-6) var(--s-18);
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.05);
    background: rgba(255,255,255,0.6);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.word-pill.word-pill-active { background: var(--primary); color: white; border-color: var(--primary); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-9); }
.stat { background: #f8fafc; border-radius: var(--radius-md); padding: var(--s-12); text-align: center; border: 1px solid rgba(0,0,0,0.02); }
.stat-num { font-size: 22px; color: var(--primary); font-weight: 800; }
.stat-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; }

.heavenly-glow-box {
    background: linear-gradient(135deg, #FFFBF0 0%, #FFFFFF 100%);
    border: 1px solid rgba(217, 162, 74, 0.2);
    box-shadow: 0 4px 20px rgba(217, 162, 74, 0.1);
    padding: var(--s-18);
    border-radius: var(--radius-md);
}
.nld-heavenly-voice { color: #D9A24A; font-weight: 600; font-style: italic; text-shadow: 0 0 12px rgba(217,162,74,0.1); }

.flow-step {
    display: flex;
    align-items: center;
    gap: var(--s-12);
    padding: var(--s-15);
    border-radius: var(--radius-md);
    margin-bottom: var(--s-9);
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
}
.flow-step:active { transform: scale(0.99); }
.flow-step.done { opacity: 0.7; background: #f0fdf4; border: 1px solid rgba(58,138,95,0.1); }
.flow-step.active { border: 2px solid var(--primary); background: white; }

@keyframes pulse-flash {
    0% { transform: scale(1); background: white; }
    30% { transform: scale(1.05); background: #3A8A5F; color: white; box-shadow: 0 0 20px rgba(58,138,95,0.4); }
    100% { transform: scale(1); background: #f0fdf4; }
}

.flow-icon { font-size: 20px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: white; border-radius: 50%; box-shadow: var(--shadow-subtle); }
.flow-label { flex: 1; font-weight: 600; font-size: 15px; }

/* Forcefield Piece */
.forcefield-piece { fill:none; stroke:var(--primary); stroke-width:2; stroke-dasharray:4 4; transition: all 1s; }
.forcefield-piece.equipped { stroke-dasharray:none; stroke-width:3; filter: drop-shadow(0 0 8px var(--primary)); }

/* Overlays & Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 28, 32, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12000;
    padding: var(--s-18);
}

.modal-box {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--s-36);
    max-width: 460px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 80px rgba(0,0,0,0.25);
    position: relative;
}

#tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 11000;
    background: rgba(240, 249, 255, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s-24);
}

.small { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.link { color: var(--primary); text-decoration: underline; cursor: pointer; }

/* Tree stage advance animation */
@keyframes tree-stage-advance {
    0%   { filter: brightness(1) drop-shadow(0 0 0 rgba(255,215,90,0)); transform: scale(1); }
    30%  { filter: brightness(1.25) drop-shadow(0 0 24px rgba(255,215,90,0.85)); transform: scale(1.04); }
    70%  { filter: brightness(1.1)  drop-shadow(0 0 16px rgba(255,215,90,0.5));  transform: scale(1.02); }
    100% { filter: brightness(1) drop-shadow(0 0 0 rgba(255,215,90,0)); transform: scale(1); }
}
.tree-stage-advance { animation: tree-stage-advance 1.8s ease-out; }

/* Tree HUD Label */
.tree-label {
    background: rgba(58,138,95,0.1);
    color: var(--primary);
    padding: var(--s-6) var(--s-18);
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Armor of God Interactive Styles */
.armor-piece {
    fill: #222;
    stroke: rgba(255,255,255,0.1);
    stroke-width: 1.5;
    stroke-dasharray: 4 2;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0.5;
}

.armor-piece.equipped {
    fill: url(#goldGrad);
    stroke: #FFE082;
    stroke-width: 2.5;
    stroke-dasharray: none;
    opacity: 1;
    filter: drop-shadow(0 0 12px rgba(217, 162, 74, 0.6));
}

@keyframes armor-glow {
    0% { filter: drop-shadow(0 0 5px rgba(217, 162, 74, 0.4)); }
    50% { filter: drop-shadow(0 0 20px rgba(217, 162, 74, 0.8)); }
    100% { filter: drop-shadow(0 0 5px rgba(217, 162, 74, 0.4)); }
}

.armor-piece.equipped {
    animation: armor-glow 3s infinite ease-in-out;
}

/* Journey Timeline Styles */
.journey-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
    width: 60px;
}
.journey-node:active { transform: scale(0.9); }
.journey-icon {
    font-size: 20px;
    margin-bottom: 6px;
    z-index: 5;
    background: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: var(--shadow-subtle);
    border: 2px solid var(--primary);
}

.journey-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
    box-shadow: 0 2px 8px rgba(58, 138, 95, 0.2);
    margin-bottom: 6px;
    z-index: 5;
}
.journey-dot.seed { border-color: var(--accent-gold); }
.journey-dot.today {
    background: var(--primary);
    box-shadow: 0 0 12px var(--primary);
    animation: pulse-glow 2s infinite;
}
.journey-label {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.journey-date {
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.7;
}

@keyframes pulse-glow {
    0% { transform: scale(1); box-shadow: 0 0 5px rgba(58, 138, 95, 0.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(58, 138, 95, 0.8); }
    100% { transform: scale(1); box-shadow: 0 0 5px rgba(58, 138, 95, 0.4); }
}

@keyframes dew-breath {
    0%, 100% { transform: scale(1) translateY(0); opacity: 0.88; filter: drop-shadow(0 2px 4px rgba(58,138,95,0.18)); }
    50% { transform: scale(1.08) translateY(-2px); opacity: 1; filter: drop-shadow(0 6px 12px rgba(58,138,95,0.35)); }
}

@keyframes dew-dots {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

.sacred-loader .dot { display:inline-block; width:6px; height:6px; border-radius:50%; background: var(--primary); margin: 0 3px; animation: dew-dots 1.4s ease-in-out infinite both; }
.sacred-loader .dot:nth-child(2) { animation-delay: 0.18s; }
.sacred-loader .dot:nth-child(3) { animation-delay: 0.36s; }

/* Mobile header: prevent right-side buttons from overlapping the avatar */
@media (max-width: 480px) {
    .app-header { top: 12px !important; left: 10px !important; right: 10px !important; gap: 6px !important; }
    .app-header-actions { gap: 6px !important; }
    .app-header-actions .btn { padding: 6px 9px !important; font-size: 15px !important; line-height: 1 !important; }
    .app-header-avatar { width: 36px !important; height: 36px !important; }
}
@media (max-width: 360px) {
    .app-header-actions { gap: 4px !important; }
    .app-header-actions .btn { padding: 5px 7px !important; font-size: 14px !important; }
}

