@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Caveat:wght@600&display=swap');

:root {
    --bg: #050505;
    --surface: #121212;
    --surface-highlight: #1e1e1e;
    --teal: #00f2f2;
    --teal-dim: rgba(0, 242, 242, 0.1);
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
}

body.theme-light {
    --bg: #f0f4f8;
    --surface: #ffffff;
    --surface-highlight: #f1f5f9;
    --teal: #0f766e;
    --teal-dim: rgba(15, 118, 110, 0.1);
    --text-main: #0f172a;
    --text-sub: #475569;
    --border: rgba(0, 0, 0, 0.08);
}

body { 
    font-family: 'Outfit', sans-serif; 
    background-color: var(--bg);
    background-image: 
        radial-gradient(circle at 50% 0%, var(--teal-dim) 0%, transparent 40%),
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    background-attachment: fixed;
    color: var(--text-main);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* --- UI Classes --- */
.text-adaptive { color: var(--text-main); }
.text-sub-adaptive { color: var(--text-sub); }
.bg-highlight { background: var(--surface-highlight); }
.bg-adaptive { background: var(--surface); }
.border-adaptive { border-color: var(--border); }

.nebula-glass { background: var(--surface); backdrop-filter: blur(20px); border: 1px solid var(--border); }
.content-container { flex: 1; overflow-y: auto; padding-bottom: 140px; position: relative; z-index: 10; scroll-behavior: smooth; }

/* FIX: Massive padding for chat so it never hides */
#chat-stream { padding-bottom: 250px !important; }

.widget { background: var(--surface); border-radius: 24px; border: 1px solid var(--border); padding: 20px; margin-bottom: 12px; position: relative; overflow: hidden; }
.view-section { display: none; width: 100%; opacity: 0; transform: translateY(10px); transition: opacity 0.3s ease, transform 0.3s ease; }
.view-section.active { display: block; opacity: 1; transform: translateY(0); }

.bottom-nav { position: fixed; bottom: 12px; left: 12px; right: 12px; height: 70px; border-radius: 24px; z-index: 1000; box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5); border: 1px solid var(--border); background: var(--surface); backdrop-filter: blur(20px); }
.chat-console { position: fixed; bottom: 95px; left: 12px; right: 12px; z-index: 900; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.progress-bar { height: 6px; border-radius: 3px; background: var(--surface-highlight); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-press:active { transform: scale(0.96); }

/* Markdown & Text */
.markdown-body p { margin-bottom: 0.5em; line-height: 1.5; }
.markdown-body strong { color: var(--teal); font-weight: 800; }
.markdown-body ul { list-style-type: disc; padding-left: 1.2em; margin-bottom: 0.5em; }
.markdown-body pre { background: rgba(0,0,0,0.3); padding: 10px; border-radius: 8px; overflow-x: auto; margin-top: 5px; border: 1px solid var(--border); }
.markdown-body code { background: rgba(255,255,255,0.1); padding: 2px 4px; border-radius: 4px; font-family: monospace; font-size: 0.9em; }

/* Modal Overlay */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); z-index: 6000; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s; }
.modal-overlay.open { display: flex; opacity: 1; }
.clean-input { background: transparent; border: none; border-bottom: 2px solid var(--border); padding: 8px 4px; outline: none; width: 100%; color: var(--text-main); transition: 0.3s; font-weight: 600; }

/* Zen Mode */
#zen-overlay { position: fixed; inset: 0; background: #000; z-index: 9000; display: none; flex-direction: column; align-items: center; justify-content: center; }
#zen-overlay.active { display: flex; animation: fadeIn 0.5s ease; }

/* Custom Checkbox */
.custom-check { appearance: none; width: 20px; height: 20px; border: 2px solid var(--teal); border-radius: 6px; position: relative; cursor: pointer; }
.custom-check:checked { background: var(--teal); }
.custom-check:checked::after { content: '✓'; position: absolute; color: black; font-size: 14px; top: -2px; left: 2px; font-weight: bold; }

/* XP Popup */
@keyframes xpFloat { 0% { opacity: 0; transform: translateY(10px); } 20% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-40px); } }
.xp-popup { position: fixed; pointer-events: none; color: #fbbf24; font-weight: 900; z-index: 5000; animation: xpFloat 1.2s forwards; font-size: 1.5rem; text-shadow: 0 4px 10px rgba(0,0,0,0.5); }

/* Calc Grid */
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-btn { background: var(--surface-highlight); color: var(--text-main); border-radius: 12px; padding: 16px; font-weight: bold; text-align: center; border: 1px solid var(--border); }
.calc-btn.op { color: var(--teal); }
.calc-screen { grid-column: span 4; background: black; color: var(--teal); font-family: monospace; font-size: 1.5rem; padding: 16px; border-radius: 12px; text-align: right; margin-bottom: 12px; border: 1px solid var(--border); overflow-x: auto; }
.support-btn {
    padding: 12px 0;
    border-radius: 14px;
    font-weight: 900;
    font-size: 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    transition: all 0.25s ease;
}

.support-btn:hover {
    background: #ec4899;
    color: black;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(236,72,153,0.4);
}
