:root {
            --term-bg: #040103;
            --blood-red: #ff1a3c;
            --blood-glow: rgba(255, 26, 60, 0.6);
            --dim-red: #8b001a;
            --dark-red: #240007;
            --term-gold: #d4af37;
            --term-gold-glow: rgba(212, 175, 55, 0.4);
            --text-main: #f0d8dd;
            --text-dim: #99737c;
        }

        /* Inverted Castle Easter Egg Theme */
        body.inverted-castle {
            filter: invert(0.9) hue-rotate(180deg);
            transform: rotate(180deg);
            transition: transform 1.2s ease-in-out, filter 1s ease;
        }

        /* Blood Mode Easter Egg */
        body.blood-mode {
            --blood-red: #ff0000;
            --term-bg: #1a0003;
            --text-main: #ff99a8;
            animation: redPulse 2s infinite alternate;
        }

        /* Matrix Green Mode */
        body.matrix-mode {
            --blood-red: #00ff66;
            --blood-glow: rgba(0, 255, 102, 0.6);
            --dim-red: #008833;
            --dark-red: #00220d;
            --term-gold: #33ff99;
            --text-main: #a8ffcb;
        }

        @keyframes redPulse {
            0% { box-shadow: inset 0 0 50px rgba(255, 0, 0, 0.2); }
            100% { box-shadow: inset 0 0 150px rgba(255, 0, 0, 0.6); }
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* Belt-and-suspenders against sideways scroll on mobile: body
           already has overflow-x: hidden below, but mobile Safari in
           particular sometimes treats <html>, not <body>, as the actual
           scroll root -- constraining body alone doesn't reliably stop it
           there. */
        html {
            overflow-x: hidden;
        }

        body {
            background-color: var(--term-bg);
            color: var(--text-main);
            font-family: 'VT323', monospace;
            font-size: 21px;
            line-height: 1.3;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 1rem;
            overflow-x: hidden;
            position: relative;
            transition: transform 0.8s ease, filter 0.8s ease;
        }

        /* CRT Screen Shell */
        .crt-wrapper {
            position: relative;
            width: 100%;
            max-width: 1000px;
            background: #080204;
            border: 3px solid var(--dim-red);
            box-shadow: 0 0 35px rgba(139, 0, 26, 0.5), inset 0 0 25px rgba(0, 0, 0, 0.95);
            border-radius: 6px;
            overflow: hidden;
            transition: all 0.5s ease;
        }

        .crt-wrapper.power-off {
            animation: crtOff 0.6s forwards;
        }

        @keyframes crtOff {
            0% { transform: scale(1, 1); filter: brightness(1); }
            50% { transform: scale(1, 0.005); filter: brightness(5); }
            100% { transform: scale(0, 0); filter: brightness(0); opacity: 0; }
        }

        /* CRT Scanlines and Ambient Glow */
        .crt-wrapper::before {
            content: " ";
            display: block;
            position: absolute;
            top: 0; left: 0; bottom: 0; right: 0;
            background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.4) 50%), 
                        linear-gradient(90deg, rgba(255, 0, 0, 0.04), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
            z-index: 10;
            background-size: 100% 4px, 6px 100%;
            pointer-events: none;
        }

        .crt-wrapper::after {
            content: " ";
            display: block;
            position: absolute;
            top: 0; left: 0; bottom: 0; right: 0;
            background: rgba(255, 26, 60, 0.02);
            opacity: 0;
            z-index: 10;
            pointer-events: none;
            animation: flicker 0.12s infinite;
        }

        /* Terminal Window Header Bar */
        .term-header {
            background: var(--dark-red);
            border-bottom: 2px solid var(--dim-red);
            padding: 8px 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 10px;
            color: var(--blood-red);
            font-family: 'Fira Code', monospace;
            font-size: 13px;
            letter-spacing: 1px;
        }

        /* Shrinks and truncates instead of overflowing/wrapping the header
           to a second row -- term-controls and the audio button keep their
           natural size (they're the parts you actually need to tap), this
           just gives up the middle ground first on a narrow phone. */
        .term-label {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            flex: 1;
            min-width: 0;
        }

        .term-controls {
            display: flex;
            gap: 8px;
            flex-shrink: 0;
        }

        .term-btn {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--dim-red);
            display: inline-block;
            cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }

        .term-btn:hover { transform: scale(1.2); }
        .term-btn.close { background: var(--blood-red); box-shadow: 0 0 6px var(--blood-red); }
        .term-btn.min { background: var(--term-gold); }
        .term-btn.max { background: #00ff66; }

        /* Sound Control Toggle */
        .audio-toggle-btn {
            background: rgba(139, 0, 26, 0.3);
            border: 1px solid var(--blood-red);
            color: var(--term-gold);
            padding: 2px 8px;
            font-family: 'VT323', monospace;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.2s ease;
            flex-shrink: 0;
        }

        .audio-toggle-btn:hover {
            background: var(--blood-red);
            color: #000;
            box-shadow: 0 0 8px var(--blood-glow);
        }

        .audio-toggle-btn.playing {
            background: var(--term-gold);
            color: #000;
            border-color: var(--term-gold);
            animation: audioPulse 1.5s infinite alternate;
        }

        @keyframes audioPulse {
            0% { box-shadow: 0 0 4px var(--term-gold); }
            100% { box-shadow: 0 0 12px var(--term-gold); }
        }

        /* Main Content Body */
        .term-body {
            padding: 2rem;
            position: relative;
            z-index: 2;
        }

        /* Pixel-Perfect ASCII Header */
        .ascii-art {
            color: var(--blood-red);
            text-shadow: 0 0 10px var(--blood-glow);
            font-family: monospace;
            white-space: pre;
            font-size: 11px;
            line-height: 1.0;
            margin-bottom: 1.2rem;
            overflow-x: auto;
            cursor: pointer;
            user-select: none;
        }

        .glow-red {
            color: var(--blood-red);
            text-shadow: 0 0 10px var(--blood-glow);
        }

        .glow-gold {
            color: var(--term-gold);
            text-shadow: 0 0 8px var(--term-gold-glow);
        }

        .dim-text {
            color: var(--text-dim);
        }

        .prompt {
            color: var(--blood-red);
            margin-right: 8px;
        }

        .cmd-line {
            margin-bottom: 0.8rem;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
        }

        /* Castlevania Quote Banner */
        .quote-box {
            border-left: 3px solid var(--term-gold);
            padding: 8px 15px;
            margin: 1.2rem 0;
            background: rgba(212, 175, 55, 0.05);
            font-style: italic;
        }

        /* Quick Server Gateway Banner */
        .ip-block {
            margin: 1.2rem 0;
            background: rgba(36, 0, 7, 0.7);
            border: 1px dashed var(--blood-red);
            padding: 1rem 1.2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 1rem;
            flex-wrap: wrap;
        }

        .ip-address {
            font-family: 'Fira Code', monospace;
            font-size: 20px;
            color: #fff;
            letter-spacing: 1.5px;
        }

        .btn-cli {
            background: var(--dim-red);
            color: #fff;
            border: 1px solid var(--blood-red);
            padding: 4px 14px;
            font-family: 'VT323', monospace;
            font-size: 20px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .btn-cli:hover {
            background: var(--blood-red);
            box-shadow: 0 0 15px var(--blood-glow);
            color: #000;
        }

        /* Blog / Wiki Navigation Tabs */
        .nav-tabs {
            display: flex;
            gap: 6px;
            margin: 1.5rem 0 1rem;
            border-bottom: 2px solid var(--dim-red);
            padding-bottom: 2px;
            flex-wrap: wrap;
        }

        .tab-btn {
            background: rgba(36, 0, 7, 0.8);
            border: 1px solid var(--dim-red);
            border-bottom: none;
            color: var(--text-dim);
            padding: 6px 16px;
            font-family: 'VT323', monospace;
            font-size: 20px;
            cursor: pointer;
            transition: all 0.2s ease;
            /* .tab-btn is also used on the Video Forge link, which is a
               real <a> (navigates offsite) rather than a <button> (switches
               local tab content) -- these reset the anchor-specific defaults
               so it renders identically either way. */
            text-decoration: none;
            display: inline-block;
        }

        .tab-btn:hover {
            color: var(--term-gold);
            border-color: var(--term-gold);
        }

        .tab-btn.active {
            background: var(--dim-red);
            color: #fff;
            border-color: var(--blood-red);
            box-shadow: 0 -3px 10px rgba(255, 26, 60, 0.3);
        }

        /* Tab Content Styling */
        .tab-content {
            display: none;
            background: rgba(12, 2, 6, 0.85);
            border: 1px solid rgba(139, 0, 26, 0.6);
            padding: 1.5rem;
            min-height: 280px;
        }

        .tab-content.active {
            display: block;
        }

        /* Blog Articles */
        .blog-post {
            margin-bottom: 1.5rem;
            padding-bottom: 1.2rem;
            border-bottom: 1px dashed rgba(139, 0, 26, 0.4);
        }

        .blog-post:last-child {
            margin-bottom: 0;
            padding-bottom: 0;
            border-bottom: none;
        }

        .post-title {
            color: var(--term-gold);
            font-size: 23px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
        }

        .post-date {
            font-size: 16px;
            color: var(--text-dim);
            font-family: 'Fira Code', monospace;
        }

        .post-body {
            margin-top: 6px;
            color: var(--text-main);
            font-size: 20px;
        }

        /* Wiki Entry Lists */
        .wiki-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
            gap: 1.2rem;
        }

        .wiki-card {
            border: 1px solid rgba(139, 0, 26, 0.5);
            background: rgba(24, 2, 9, 0.6);
            padding: 1rem;
        }

        .wiki-title {
            color: var(--blood-red);
            border-bottom: 1px solid var(--dim-red);
            padding-bottom: 4px;
            margin-bottom: 8px;
            font-size: 20px;
        }

        /* Horizontal-scroll fallback for any table that's wider than a
           narrow phone -- keeps the table itself completely unchanged
           (readable, un-squished) instead of trying to force 4 columns
           into ~300px. */
        .table-scroll {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }

        /* Roster Table */
        .roster-table {
            width: 100%;
            /* Keeps a sane minimum so cells can't get squished to the
               point of wrapping mid-word -- .table-scroll is what actually
               makes this safe on a narrow phone (scrolls instead of
               overflowing the page). */
            min-width: 480px;
            border-collapse: collapse;
            font-family: 'Fira Code', monospace;
            font-size: 16px;
        }

        .roster-table th, .roster-table td {
            padding: 8px 12px;
            text-align: left;
            border-bottom: 1px solid rgba(139, 0, 26, 0.4);
        }

        .roster-table th {
            color: var(--term-gold);
            border-bottom: 2px solid var(--dim-red);
        }

        .status-online { color: #00ff66; text-shadow: 0 0 5px rgba(0,255,102,0.4); }
        .status-away { color: var(--term-gold); }
        .status-offline { color: var(--text-dim); }

        /* Server Status Cards */
        .server-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1.2rem;
        }

        .server-card {
            border: 1px solid rgba(139, 0, 26, 0.5);
            background: rgba(24, 2, 9, 0.6);
            padding: 1rem 1.2rem;
        }

        .server-card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
        }

        .server-name {
            color: var(--blood-red);
            font-size: 20px;
        }

        .server-status-badge {
            font-family: 'Fira Code', monospace;
            font-size: 13px;
            border: 1px solid currentColor;
            padding: 2px 8px;
            white-space: nowrap;
        }

        .server-meta {
            margin-top: 6px;
            font-family: 'Fira Code', monospace;
            font-size: 14px;
        }

        /* Time Rift Tab */
        .tz-add-row {
            display: flex;
            gap: 8px;
            margin-bottom: 1.2rem;
            flex-wrap: wrap;
        }

        .tz-add-row input {
            flex: 1;
            min-width: 220px;
        }

        .tz-add-row .btn-cli {
            width: auto;
            white-space: nowrap;
        }

        .tz-master-wrap {
            position: relative;
            height: 26px;
        }

        .tz-ruler {
            position: absolute;
            inset: 0;
            border: 1px solid var(--dim-red);
            background: rgba(0, 0, 0, 0.4);
            overflow: hidden;
        }

        .tz-segment {
            position: absolute;
            top: 0;
            bottom: 0;
            background: transparent;
        }

        .tz-segment.green {
            background: rgba(0, 255, 102, 0.3);
        }

        .tz-segment.awake {
            background: rgba(212, 175, 55, 0.25);
        }

        .tz-marker {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 2px;
            background: var(--blood-red);
            box-shadow: 0 0 6px var(--blood-glow);
            pointer-events: none;
            left: 50%;
        }

        .tz-slider {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            margin: 0;
            -webkit-appearance: none;
            appearance: none;
            background: transparent;
            cursor: ew-resize;
        }

        .tz-slider::-webkit-slider-runnable-track { background: transparent; height: 26px; }
        .tz-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 4px;
            height: 30px;
            margin-top: -2px;
            background: var(--term-gold);
            box-shadow: 0 0 8px var(--term-gold-glow);
            cursor: ew-resize;
        }
        .tz-slider::-moz-range-track { background: transparent; height: 26px; }
        .tz-slider::-moz-range-thumb {
            width: 4px;
            height: 30px;
            border: none;
            background: var(--term-gold);
            box-shadow: 0 0 8px var(--term-gold-glow);
            cursor: ew-resize;
        }

        .tz-ruler-labels {
            position: relative;
            height: 18px;
            margin: 4px 0 1.2rem;
            font-family: 'Fira Code', monospace;
            font-size: 11px;
            color: var(--text-dim);
        }

        .tz-ruler-tick {
            position: absolute;
            transform: translateX(-50%);
        }

        .tz-city-row {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 0.7rem 0;
            border-bottom: 1px solid rgba(139, 0, 26, 0.3);
            flex-wrap: wrap;
        }

        .tz-city-info {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 180px;
        }

        .tz-remove-btn {
            background: transparent;
            border: 1px solid var(--dim-red);
            color: var(--text-dim);
            width: 22px;
            height: 22px;
            line-height: 1;
            cursor: pointer;
            font-family: 'Fira Code', monospace;
        }

        .tz-remove-btn:hover {
            border-color: var(--blood-red);
            color: var(--blood-red);
        }

        .tz-city-name {
            color: var(--term-gold);
            font-size: 18px;
        }

        .tz-city-sub {
            font-family: 'Fira Code', monospace;
            font-size: 11px;
        }

        .tz-city-time {
            display: flex;
            flex-direction: column;
            min-width: 110px;
            font-family: 'Fira Code', monospace;
        }

        .tz-time-val {
            font-size: 22px;
            color: var(--text-main);
        }

        .tz-date-val {
            font-size: 11px;
        }

        .tz-mini-strip {
            position: relative;
            flex: 1;
            min-width: 180px;
            height: 16px;
            border: 1px solid rgba(139, 0, 26, 0.4);
            overflow: hidden;
        }

        /* Console Output Log */
        #console-log {
            margin-top: 1rem;
            font-family: 'Fira Code', monospace;
            font-size: 14px;
            color: var(--text-dim);
            min-height: 22px;
        }

        /* Interactive Terminal Input Easter Egg */
        .interactive-cli {
            background: transparent;
            border: none;
            color: var(--text-main);
            font-family: 'VT323', monospace;
            font-size: 21px;
            outline: none;
            width: calc(100% - 180px);
            caret-color: var(--blood-red);
        }

        /* Pixel Bat Swarm Effect */
        .pixel-bat {
            position: fixed;
            font-size: 24px;
            pointer-events: none;
            z-index: 999;
            animation: batFly 2.5s linear forwards;
        }

        @keyframes batFly {
            0% { transform: translate(0, 0) scale(0.8); opacity: 1; }
            50% { transform: translate(300px, -150px) scale(1.3); }
            100% { transform: translate(700px, -400px) scale(0.5); opacity: 0; }
        }

        /* Blinking Cursor */
        .cursor {
            display: inline-block;
            width: 10px;
            height: 20px;
            background: var(--blood-red);
            margin-left: 5px;
            animation: blink 0.8s infinite;
            vertical-align: middle;
        }

        @keyframes blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0; }
        }

        @keyframes flicker {
            0% { opacity: 0.02; }
            50% { opacity: 0.04; }
            100% { opacity: 0.01; }
        }

        @media (max-width: 650px) {
            body { padding: 0.5rem; font-size: 19px; }
            .term-body { padding: 1.2rem; }
            .ascii-art { font-size: 7px; }
            .ip-block { flex-direction: column; align-items: flex-start; }
            .btn-cli { width: 100%; text-align: center; }
            .post-title { flex-direction: column; align-items: flex-start; }
            .interactive-cli { width: 100%; margin-top: 5px; }
            /* Smaller touch targets still comfortably tappable (~40px),
               but stop 6-7 buttons from eating the whole screen height
               before you even reach the content. */
            .tab-btn { font-size: 17px; padding: 6px 12px; }
            .tz-city-row { flex-direction: column; align-items: stretch; }
            .tz-mini-strip { min-width: 0; }
        }

        /* Very small phones (iPhone SE and similar, ~375px and under) --
           the 650px breakpoint above already prevents overflow; this just
           claws back a bit more room since every rem/px there still
           assumes a wider phone than this. */
        @media (max-width: 400px) {
            .term-body { padding: 1rem 0.8rem; }
            .ascii-art { font-size: 5.5px; }
            body { font-size: 17px; }
        }

        /* ==========================================
   🎮 GAME LIBRARY GRID STYLES
   ========================================== */

.game-library-grid {
    display: grid;
    /* This automatically wraps cards to the next row on small screens */
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
    padding-bottom: 1rem;
}

.game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none; /* Removes the default blue link underline */
    transition: transform 0.2s ease-out;
    /* Grid items default to min-width: auto, which for a card containing
       an <img> means "at least as wide as the image's natural size" --
       these Steam covers are natively 600x900px, so without this override
       the grid track gets forced wider than the column actually asked for
       (grid-template-columns below), which is what was forcing the whole
       page to scroll sideways on a phone even though .game-cover itself
       has width: 100%. This is the actual fix; width: 100% on the image
       alone was never enough on its own. */
    min-width: 0;
}

/* Float the card up slightly when hovered */
.game-card:hover {
    transform: translateY(-5px);
    cursor: pointer;
}

.game-cover {
    width: 100%;
    aspect-ratio: 2 / 3; /* This forces the phone-screen / vertical shape */
    object-fit: cover;
    border: 1px solid #ff1a3c;
    border-radius: 3px;
    box-shadow: 0 0 5px rgba(255, 26, 60, 0.2);
    transition: box-shadow 0.3s, border-color 0.3s;
}

/* Glow effect when hovered */
.game-card:hover .game-cover {
    box-shadow: 0 0 15px rgba(255, 26, 60, 0.7);
    border-color: #d4af37;
}

.game-title {
    margin-top: 0.8rem;
    color: #d4af37; /* Gothic gold */
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    text-align: center;
    text-shadow: 1px 1px 0px #000;
    transition: color 0.3s;
}

.game-card:hover .game-title {
    color: #ff1a3c; /* Turns blood red when hovered */
}

/* Mobile override -- MUST come after the base .game-library-grid/.game-title
   rules above, not inside the earlier @media block near the top of this
   file: same specificity (one class each), so with equal specificity the
   rule that's later in the file wins regardless of which one is inside a
   media query. That's why an earlier attempt at this exact override had no
   visible effect on a phone -- the unconditional desktop rule above always
   won the cascade. */
@media (max-width: 650px) {
    /* Desktop's minmax(130px, 1fr) + 1.5rem gap only fits 2 columns on a
       phone -- 10 games at 2-per-row stacks into 5 tall rows (~1500px of
       pure grid, before you've even reached it). Smaller cards + tighter
       gap fit 3 per row instead, cutting that to roughly half the
       scrolling for the same content -- still plenty big enough to read
       the title and tap accurately. */
    .game-library-grid {
        grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
        gap: 0.7rem;
    }
    .game-title {
        font-size: 0.75rem;
        margin-top: 0.4rem;
    }
}
