:root {
    --bg-dark: #070f07;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary: #4caf50;
    --secondary: #2e7d32;
    --accent: #8bc34a;
    --wilt: #6d4c41;
    --white: #f8faf8;
    --text-dim: #a5d6a7;
    --glow: 0 0 20px rgba(76, 175, 80, 0.4);
}

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

body,
html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: 'Plus Jakarta Sans', 'Plus Jakarta Sans Fallback', sans-serif;
    background: var(--bg-dark);
    color: var(--white);
}

#app-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}

/* --- HEADER --- */
.app-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(7, 15, 7, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
}

.user-stats {
    display: flex;
    gap: 0.8rem;
    flex: 1;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--card-bg);
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

.stat-item svg {
    color: var(--accent);
    width: 16px;
    height: 16px;
}

.brand-logo {
    display: flex;
    align-items: center;
    width: 140px;
    height: 45px;
    overflow: hidden;
    justify-content: center;
    flex: 0 0 auto;
}

.app-brand-logo {
    width: 100%;
    height: auto;
    transform: scale(1.0);
    transform-origin: center;
}

.user-profile {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}


/* --- MAIN VIEWS --- */
#viewContainer {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem 1.5rem 100px;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    margin-bottom: 1.5rem;
}

.view-header h2 {
    font-family: 'Fraunces', 'Fraunces Fallback', serif;
    font-size: 1.8rem;
}

.view-header p {
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* --- NURSERY GRID --- */
.nursery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

.tray-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.6rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 5;
}

.badge.blackout {
    color: #aaa;
    border: 1px solid #444;
}

.badge.light {
    color: #ffeb3b;
    border: 1px solid #ffeb3b;
    box-shadow: 0 0 5px #ffeb3b;
}

.badge.ready {
    color: #00e676;
    border: 1px solid #00e676;
    box-shadow: 0 0 10px #00e676;
}

.badge.wilted {
    color: #ff5252;
    border: 1px solid #ff5252;
}

.tray-visual-realistic {
    width: 100%;
    aspect-ratio: 1;
    margin: 1rem 0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.tray-visual-realistic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.progress-ring {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) calc(var(--p) * 1%), transparent 0);
}

.tray-actions button {
    width: 100%;
    padding: 0.6rem;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.8rem;
    transition: transform 0.1s;
}

.tray-actions button:active {
    transform: scale(0.95);
}

.harvest-btn {
    background: var(--primary);
    color: white;
}

.revive-btn {
    background: var(--water, #2196f3);
    color: white;
    margin-bottom: 5px;
}

.discard-btn {
    background: #333;
    color: #888;
}

.empty-state button {
    width: 100%;
    aspect-ratio: 1;
    background: transparent;
    border: 2px dashed var(--card-border);
    border-radius: 15px;
    color: var(--text-dim);
    font-size: 0.7rem;
    cursor: pointer;
}

/* --- THE GREEN WALL --- */
.broadcast-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.log-card {
    background: var(--card-bg);
    padding: 1.2rem;
    border-radius: 15px;
    border-left: 4px solid var(--primary);
}

.log-time {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
}

.emoji-reactions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.emoji-reactions button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
}

/* --- IMPACT DASHBOARD --- */
.impact-stats {
    display: flex;
    justify-content: space-around;
    padding: 2rem 0;
}

.impact-ring-container {
    text-align: center;
}

.impact-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(closest-side, var(--bg-dark) 80%, transparent 0 100%),
        conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255, 255, 255, 0.05) 0);
    margin-bottom: 0.5rem;
}

.ring-val {
    font-weight: 700;
    font-size: 1.1rem;
}

.ring-label {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.impact-comparison-card {
    background: linear-gradient(135deg, var(--secondary), var(--bg-dark));
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--card-border);
}

.impact-comparison-card h3 {
    font-family: 'Fraunces', 'Fraunces Fallback', serif;
    margin-bottom: 0.5rem;
}

.impact-comparison-card p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-dim);
}

/* --- STORE --- */
.store-item {
    background: var(--card-bg);
    padding: 1.2rem;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.store-item h3 {
    font-size: 1rem;
}

.store-item p {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.redeem-btn {
    background: var(--accent);
    color: black;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.8rem;
}

/* --- NAVIGATION --- */
.app-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    height: 70px;
    background: rgba(10, 20, 10, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid var(--card-border);
    border-radius: 35px;
    display: flex;
    justify-content: space-around;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    opacity: 0.6;
}

.nav-item.active {
    color: var(--primary);
    opacity: 1;
}

/* --- TOASTS --- */
.app-toast {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    z-index: 2000;
    animation: toastIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}