/* terminal-inja — shared base for all terminal templates */
:root {
    --bg: #0a0a08;
    --card-bg: #0f0f0c;
    --text: #33ff33;
    --text-secondary: #22aa22;
    --text-dim: #116611;
    --accent: #66ff66;
    --accent-glow: #88ff88;
    --accent-dim: #228822;
    --border: #1a331a;
    --code-bg: #080808;
    --bezel: #1a1a1a;
    --bezel-dark: #0d0d0d;
}

html {
    overflow: hidden;
    height: 100%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Ark Pixel', 'VT323',
    'SimHei', 'NSimSun', 'GB18030 Bitmap', 'Unifont',
    'WenQuanYi Bitmap Song', 'SimSun',
    'Noto Serif CJK SC', 'AR PL UMing CN',
    'Noto Sans SC',
    serif, monospace;
    background: #000;
    color: var(--text);
    line-height: 1.4;
    overflow: hidden !important;
    height: 100vh;
    width: 100vw;
}

.font-loaded body {
    font-family: 'Ark Pixel', 'VT323',
    'SimHei', 'NSimSun', 'GB18030 Bitmap', 'Unifont',
    'WenQuanYi Bitmap Song', 'SimSun',
    'Noto Serif CJK SC', 'AR PL UMing CN',
    'Noto Sans SC',
    serif, monospace;
}

/* Prevent overflow on mobile */
img, video, iframe, table {
    max-width: 100%;
    height: auto;
}

pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Terminal Bezel ── */
.terminal {
    width: 100vw;
    height: 100vh;
    background: var(--bezel);
    position: relative;
    padding: 2.5vh 3vw 3.5vh;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 3px rgba(255, 255, 255, 0.04),
    inset 0 0 100px rgba(0, 0, 0, 0.4),
    0 0 0 1.5px #444,
    0 0 0 3px var(--bezel-dark),
    0 0 0 5px #222,
    0 0 0 6px var(--bezel-dark);
}

.terminal-vent {
    position: absolute;
    top: 1vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
}

.terminal-vent-line {
    width: 2px;
    height: 7px;
    background: #0a0a0a;
    border-radius: 1px;
}

.terminal-label {
    position: absolute;
    bottom: 0.6vh;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    color: #111;
    letter-spacing: 0.3em;
}

.terminal-corner {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #111;
    border-radius: 1px;
}

.terminal-corner.tl {
    top: 0.8vh;
    left: 1.5vw;
}

.terminal-corner.tr {
    top: 0.8vh;
    right: 1.5vw;
}

.terminal-corner.bl {
    bottom: 1vh;
    left: 1.5vw;
}

.terminal-corner.br {
    bottom: 1vh;
    right: 1.5vw;
}

.terminal-led {
    position: absolute;
    bottom: 0.8vh;
    right: 3.5vw;
    width: 5px;
    height: 5px;
    background: var(--text);
    border-radius: 50%;
    box-shadow: 0 0 4px var(--text), 0 0 10px var(--text);
}

.terminal-badge {
    position: absolute;
    bottom: 0.7vh;
    left: 3.5vw;
    font-size: 1rem;
    color: #111;
    letter-spacing: 0.15em;
}

/* ── CRT Screen ── */
.screen {
    background: var(--bg);
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 30px;
    border: 3px solid #090909;
    box-shadow: inset 0 0 150px rgba(0, 0, 0, 0.9),
    inset 0 0 40px rgba(51, 255, 51, 0.02),
    inset 0 0 3px rgba(0, 0, 0, 0.5),
    0 0 0 2px #0d0d0d,
    0 0 0 5px #111,
    0 2px 2px rgba(0, 0, 0, 0.5) inset;
}

.crt-distort {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    border-radius: inherit;
    background: radial-gradient(ellipse at 50% 50%,
    transparent 30%,
    rgba(0, 0, 0, 0.08) 60%,
    rgba(0, 0, 0, 0.3) 85%,
    rgba(0, 0, 0, 0.75) 100%);
}

.screen-vignette {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    border-radius: inherit;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.5) 80%, rgba(0, 0, 0, 0.8) 100%);
}

.screen-glare {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30%;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(to bottom,
    rgba(51, 255, 51, 0.025) 0%,
    rgba(51, 255, 51, 0.01) 30%,
    transparent 100%);
    border-radius: 30px 30px 0 0;
}

.screen-scanlines {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.25) 2px,
            rgba(0, 0, 0, 0.25) 4px);
    border-radius: inherit;
}

.screen-phosphor {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    border-radius: inherit;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.15) 85%, rgba(0, 0, 0, 0.4) 100%);
}

/* ── Common Components ── */
.term-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem 0.3rem;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
    color: var(--text-dim);
}

/* scrollbar (shared across pages with scrollable content) */
.screen-content::-webkit-scrollbar {
    width: 4px;
}

.screen-content::-webkit-scrollbar-track {
    background: transparent;
}

.screen-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* footer */
.page-footer {
    color: var(--text-dim);
    font-size: 25px;
    text-shadow: 0 0 4px var(--text-dim);
}

/* page header */
.page-header {
    text-align: left;
    padding: 0.3rem 0 0.5rem;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid var(--border);
}

/* page title */
.page-title {
    font-size: 3rem;
    color: var(--accent);
    letter-spacing: 0.05em;
    text-shadow: 0 0 30px var(--accent-dim);
    image-rendering: pixelated;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    html {
        overflow: auto;
        height: auto;
    }

    body {
        overflow: auto !important;
        height: auto;
        font-size: 1.6rem;
    }

    .terminal {
        height: auto;
        min-height: 100vh;
        padding: 1.5vh 2vw 2vh;
        box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.03),
        0 0 0 1px #444,
        0 0 0 2px var(--bezel-dark);
    }

    .screen {
        flex: none;
        overflow: visible;
        min-height: 100vh;
        border-radius: 18px;
        border-width: 2px;
    }

    .screen-scanlines,
    .screen-glare,
    .screen-vignette,
    .screen-phosphor,
    .crt-distort {
        border-radius: 18px;
    }

    .terminal-vent {
        display: none;
    }

    .terminal-corner {
        display: none;
    }

    .terminal-label {
        font-size: 0.7rem;
        bottom: 0.3vh;
    }

    .terminal-badge {
        font-size: 0.7rem;
        bottom: 0.3vh;
        left: 2vw;
    }

    .terminal-led {
        width: 3px;
        height: 3px;
        bottom: 0.4vh;
        right: 2.5vw;
    }

    .page-title {
        font-size: 2rem !important;
    }

    .page-header {
        padding: 0.2rem 0 0.3rem;
        margin-bottom: 0.4rem;
    }

    .page-footer {
        font-size: 18px;
    }

    .term-bar {
        font-size: 0.9rem;
        padding: 0.15rem 0.2rem;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 1.5rem;
    }

    .terminal {
        padding: 1vh 1.5vw 1.5vh;
        box-shadow: 0 0 0 1px #444,
        0 0 0 2px var(--bezel-dark);
    }

    .screen {
        border-radius: 12px;
        border-width: 1px;
    }

    .screen-scanlines,
    .screen-glare,
    .screen-vignette,
    .screen-phosphor,
    .crt-distort {
        border-radius: 12px;
    }

    .terminal-label {
        display: none;
    }

    .terminal-badge {
        display: none;
    }

    .terminal-led {
        display: none;
    }

    .page-title {
        font-size: 1.6rem !important;
    }

    .page-footer {
        font-size: 16px;
    }

    .term-bar {
        font-size: 0.85rem;
        padding: 0.1rem 0.15rem;
        margin-bottom: 0.4rem;
    }
}
