/* ============================================
   uhavn.fun - Design System
   Dark/Light theme. Purple accent. No frameworks.
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=JetBrains+Mono:wght@400;700&display=swap');

/* --- Dark Theme (default) --- */
:root {
    --bg-primary: #0a0a0f;
    --bg-card: #12121a;
    --bg-card-hover: #1a1a25;
    --bg-input: #0e0e16;
    --border: #1e1e2e;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #a855f7;
    --accent-hover: #9333ea;
    --accent-glow: rgba(168, 85, 247, 0.3);
    --success: #22c55e;
    --danger: #ef4444;
    --shadow-card: rgba(0, 0, 0, 0.3);
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius-sm: 8px;
    --radius-md: 12px;
    --max-width: 800px;
}

/* --- Light Theme --- */
[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f0f5;
    --bg-input: #ffffff;
    --border: #e2e4e9;
    --text-primary: #1a1a2e;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-glow: rgba(124, 58, 237, 0.2);
    --success: #16a34a;
    --danger: #dc2626;
    --shadow-card: rgba(0, 0, 0, 0.08);
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- Base --- */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 200ms ease, color 200ms ease;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 200ms ease;
}

a:hover {
    color: var(--accent-hover);
}

/* --- Layout --- */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

main {
    flex: 1;
    padding: 48px 0;
}

/* --- Header --- */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.site-logo:hover {
    color: var(--accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.site-nav {
    display: flex;
    gap: 24px;
    list-style: none;
}

.site-nav a {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    transition: color 200ms ease;
}

.site-nav a:hover {
    color: var(--text-primary);
}

/* --- Theme Toggle --- */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 6px 8px;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--text-secondary);
    transition: border-color 200ms ease, color 200ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Show correct icon per theme */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }

:root .theme-toggle .icon-sun { display: inline; }
[data-theme="light"] .theme-toggle .icon-moon { display: inline; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
}

.site-footer p {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

/* --- Hero --- */
.hero {
    text-align: center;
    padding: 64px 0 48px;
}

.hero h1 {
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.hero .tagline {
    color: var(--text-secondary);
    font-size: 1.25rem;
}

/* --- App Grid --- */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 48px;
}

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
    display: block;
    color: var(--text-primary);
}

.app-card:hover {
    transform: translateY(-2px);
    background: var(--bg-card-hover);
    box-shadow: 0 8px 24px var(--shadow-card);
    color: var(--text-primary);
}

.app-card .emoji {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}

.app-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.app-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* --- App Page Layout --- */
.app-page {
    text-align: center;
    padding: 48px 0;
}

.app-page h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.app-page .subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 48px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 200ms ease, transform 100ms ease;
    color: #fff;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-large {
    padding: 20px 48px;
    font-size: 1.25rem;
    border-radius: var(--radius-md);
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* --- Inputs --- */
.input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    width: 100%;
    transition: border-color 200ms ease;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

.input::placeholder {
    color: var(--text-muted);
}

/* --- Counter Display --- */
.counter {
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--accent);
}

/* --- Timer Display --- */
.timer {
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 32px;
    transition: color 200ms ease;
}

.timer.idle { color: var(--text-muted); }
.timer.active { color: var(--success); text-shadow: 0 0 20px rgba(34, 197, 94, 0.3); }
.timer.done { color: var(--accent); }

/* --- Leaderboard --- */
.leaderboard {
    max-width: 400px;
    margin: 48px auto 0;
    text-align: left;
}

.leaderboard h2 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
    color: var(--text-secondary);
}

.leaderboard-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.leaderboard-row:first-of-type {
    color: var(--accent);
    font-weight: 700;
}

.leaderboard-rank {
    color: var(--text-muted);
    width: 30px;
}

.leaderboard-name {
    flex: 1;
    color: var(--text-primary);
}

.leaderboard-score {
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* --- The Wall --- */
.wall-text {
    text-align: left;
    line-height: 2;
    font-size: 1.125rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.wall-text .new-word {
    color: var(--accent);
    animation: fadeWord 2s ease forwards;
}

@keyframes fadeWord {
    from { color: var(--accent); }
    to { color: var(--text-primary); }
}

.word-count {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-bottom: 16px;
}

.wall-input-row {
    display: flex;
    gap: 8px;
}

.wall-input-row .input {
    flex: 1;
}

/* --- Vibe Check --- */
.vibe-feed {
    text-align: left;
    margin-top: 32px;
}

.vibe-entry {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    animation: fadeIn 300ms ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.vibe-emoji {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.vibe-content {
    flex: 1;
}

.vibe-text {
    font-size: 1rem;
    margin-bottom: 4px;
}

.vibe-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.vibe-input-row {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.vibe-input-row .input {
    flex: 1;
}

/* --- Roast --- */
.dossier {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: left;
    margin-bottom: 32px;
}

.dossier h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.dossier-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.dossier-label {
    color: var(--text-muted);
}

.dossier-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.roast-section {
    text-align: left;
}

.roast-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    animation: fadeIn 300ms ease;
}

.roast-item .roast-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.roast-item .roast-text {
    font-size: 1rem;
}

/* --- Are You Okay --- */
.ayo-question {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 32px;
}

.ayo-response {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-top: 24px;
    opacity: 0;
    transition: opacity 300ms ease;
}

.ayo-response.visible {
    opacity: 1;
}

/* --- Content Pages (About, Privacy) --- */
.content-page {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
    padding: 48px 0;
}

.content-page h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 32px;
}

.content-page h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 32px;
    margin-bottom: 12px;
}

.content-page p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.7;
}

/* --- Toast / Feedback --- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-size: 0.875rem;
    color: var(--text-primary);
    opacity: 0;
    transition: transform 300ms ease, opacity 300ms ease;
    z-index: 100;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero .tagline {
        font-size: 1rem;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }

    .counter, .timer {
        font-size: 3rem;
    }

    .btn-large {
        width: 100%;
        padding: 16px 24px;
    }

    .site-nav {
        gap: 16px;
    }

    .wall-input-row,
    .vibe-input-row {
        flex-direction: column;
    }

    .wall-input-row .btn,
    .vibe-input-row .btn {
        width: 100%;
    }
}
/* --- Coin Flip --- */
.coin-container {
    perspective: 600px;
    margin-bottom: 24px;
}

.coin {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 700;
    backface-visibility: hidden;
    border: 3px solid var(--border);
}

.coin-heads {
    background: var(--bg-card);
    color: var(--accent);
}

.coin-tails {
    background: var(--accent);
    color: var(--bg-card);
    transform: rotateY(180deg);
}
