@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

/* 2. THEME VARIANTS */
:root,
:root[data-theme="forest"] {
    --crt-bg: #000;
    --crt-font: 'VT323', 'Fira Mono', 'Consolas', monospace;
    --crt-glow: #39ff14;
    --crt-glow-rgb: 57, 255, 20;
    --crt-text: #39ff14;
    --crt-border: #39ff14;
    --crt-shadow: 0 0 5px currentColor, 0 0 10px currentColor, 0 0 20px currentColor;
    --crt-cursor: #39ff14;
    --scanline-opacity: 0.03;
    --flicker-intensity: 0.98;
    --bloom-intensity: 1.5;
}

:root[data-theme="amber"] {
    --crt-bg: #000;
    --crt-font: 'VT323', 'Fira Mono', 'Consolas', monospace;
    --crt-glow: #ffb300;
    --crt-glow-rgb: 255, 179, 0;
    --crt-text: #ffcc00;
    --crt-border: #ffb300;
    --crt-shadow: 0 0 5px currentColor, 0 0 10px currentColor, 0 0 20px currentColor;
    --crt-cursor: #ffcc00;
    --scanline-opacity: 0.04;
    --flicker-intensity: 0.98;
    --bloom-intensity: 1.5;
}

:root[data-theme="arctic"] {
    --crt-bg: #000;
    --crt-font: 'VT323', 'Fira Mono', 'Consolas', monospace;
    --crt-glow: #e0e0e0;
    --crt-glow-rgb: 224, 224, 224;
    --crt-text: #f0f0f0;
    --crt-border: #e0e0e0;
    --crt-shadow: 0 0 5px currentColor, 0 0 10px currentColor, 0 0 20px currentColor;
    --crt-cursor: #f0f0f0;
    --scanline-opacity: 0.05;
    --flicker-intensity: 0.98;
    --bloom-intensity: 1.5;
}

:root[data-theme="portal"] {
    --crt-bg: #000;
    --crt-font: 'VT323', 'Fira Mono', 'Consolas', monospace;
    --crt-glow: #5d00b3;
    --crt-glow-rgb: 93, 0, 179;
    --crt-text: #8a2be2;
    --crt-border: #5d00b3;
    --crt-shadow: 0 0 5px currentColor, 0 0 10px currentColor, 0 0 20px currentColor;
    --crt-cursor: #8a2be2;
    --scanline-opacity: 0.04;
    --flicker-intensity: 0.98;
    --bloom-intensity: 1.5;
}

:root[data-theme="crimson"] {
    --crt-bg: #000;
    --crt-font: 'VT323', 'Fira Mono', 'Consolas', monospace;
    --crt-glow: #ff0a14;
    --crt-glow-rgb: 255, 10, 20;
    --crt-text: #ff3333;
    --crt-border: #ff0a14;
    --crt-shadow: 0 0 5px currentColor, 0 0 10px currentColor, 0 0 20px currentColor;
    --crt-cursor: #ff3333;
    --scanline-opacity: 0.04;
    --flicker-intensity: 0.98;
    --bloom-intensity: 1.5;
}

:root[data-theme="flamingo"] {
    --crt-bg: #000;
    --crt-font: 'VT323', 'Fira Mono', 'Consolas', monospace;
    --crt-glow: #ff66ff;
    --crt-glow-rgb: 255, 102, 255;
    --crt-text: #ff99ff;
    --crt-border: #ff66ff;
    --crt-shadow: 0 0 5px currentColor, 0 0 10px currentColor, 0 0 20px currentColor;
    --crt-cursor: #ff99ff;
    --scanline-opacity: 0.04;
    --flicker-intensity: 0.98;
    --bloom-intensity: 1.5;
}

/* Backwards-compatible aliases for older variable names used in the stylesheet */
:root {
    --bg: var(--crt-bg);
    --text: var(--crt-text);
    --accent: var(--crt-border);
    --font: var(--crt-font);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    background: radial-gradient(ellipse at center, #111 0%, #000 100%);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0.08em;
    font-size: 1.2rem;
}

/* Center page content horizontally; allow header to stay at top */
body {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 24px 12px;
}

/* Header: title centered, language switch pinned to the right */
header {
    width: 100%;
    max-width: 920px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0 18px 0;
    gap: 8px;
}

/* Title stays centered */
header h1 {
    margin: 0;
    font-size: 5rem;
    text-align: center;
    font-weight: normal;
    letter-spacing: 0.12em;
    text-shadow: 0 0 5px var(--crt-glow), 0 0 10px var(--crt-glow);
}

/* Language switch: placed below the title now */
.lang-switch {
    position: static;
    right: auto;
    top: auto;
    transform: none;
    display: inline-flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 999px;
    align-items: center;
    margin-top: 0;
}

/* Theme selector near the header (also stacked under the title) */
.theme-switch {
    position: static;
    right: auto;
    top: auto;
    transform: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 0;
}

/* Combined responsive small-screen tweaks */
@media (max-width: 520px) {
    header h1 {
        font-size: 1.5rem;
    }

    .content {
        padding: 8px;
    }

    .theme-switch {
        right: auto;
    }
}

/* Enhanced theme select (single definition, touch-friendly) */
.theme-switch select {
    appearance: none;
    background: #111;
    color: var(--text);
    border: 1px solid rgba(var(--crt-glow-rgb), 0.12);
    padding: 8px 10px;
    min-height: 40px;
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.88rem;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(var(--crt-glow-rgb), 0.06);
}

/* Active button style */
.lang-btn.active {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.18));
    color: var(--text);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

/* Content wrapper: center text and limit width */
.content {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 12px;
    text-align: center;
}

/* Keep block language fragments behaving correctly */
.lang.block {
    display: block;
    margin: 0.6rem 0;
    text-align: center;
}

/* mailto link styled to match and slightly highlighted */
a.mailto {
    color: var(--crt-text);
    text-decoration: none;
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid rgba(var(--crt-glow-rgb), 0.12);
    box-shadow: 0 0 8px rgba(var(--crt-glow-rgb), 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.25);
    transition: box-shadow .18s ease, transform .12s ease;
}

a.mailto:hover,
a.mailto:focus {
    box-shadow: 0 0 14px rgba(var(--crt-glow-rgb), 0.28), 0 0 30px rgba(var(--crt-glow-rgb), 0.12);
    transform: translateY(-1px);
    outline: none;
}

/* Footer */
footer {
    margin-top: 18px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text);
    font-family: var(--font);
    opacity: 0.95;
    padding: 0.5em;
}

/* Buttons - increased tappable area for mobile (single definition) */
.lang-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: inherit;
    padding: 8px 12px;
    min-height: 40px;
    min-width: 44px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
}

/* header becomes a row on wider screens, stays stacked on small */
@media (min-width: 640px) {
    header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    header h1 {
        font-size: 3rem;
        text-align: left;
    }

    .lang-switch,
    .theme-switch {
        margin-top: 0;
    }

    .content {
        text-align: left;
    }
}