/* =========================================================================
   RETRO WEB EMULATOR HUB - Global Stylesheet
   Design language: dark cyber / DOS neon (green accent, magenta, yellow)
   -------------------------------------------------------------------------
   Sections:
     1. Design tokens & base
     2. Typography utilities
     3. Layout helpers
     4. App header / footer
     5. Buttons & inputs
     6. Hero banner
     7. Toolbar (search + tag chips)
     8. Games grid & cards
     9. Modals & upload loader
    10. Emulator viewport, loader overlay, touch gamepad
    11. MSX console panel
    12. CRT scanlines effect
    13. Index (menu hub) cards
    14. Small helpers
    15. Responsive
   ========================================================================= */

/* ---------------------------------------------------------------------------
   1. Design tokens & base
--------------------------------------------------------------------------- */
:root {
    --bg:          #08090d;
    --bg-panel:    #0d0f17;
    --card:        #121520;
    --border:      #1f293d;
    --text:        #e0e6ed;
    --muted:       #8b98ab;
    --faint:       #52607a;
    --accent:      #00ffcc;
    --purple:      #ff007f;
    --yellow:      #ffcc00;
    --blue:        #00bfff;
    --danger:      #ff5252;
    --font-sans:   'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-cyber:  'Orbitron', 'Segoe UI', system-ui, sans-serif;
    --font-retro:  'Press Start 2P', 'Courier New', monospace;
    --radius:      12px;
    --radius-sm:   8px;
    --shadow-accent: 0 0 14px rgba(0, 255, 204, 0.35);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 15% -10%, rgba(255, 0, 127, 0.06), transparent 45%),
        radial-gradient(circle at 90% 0%, rgba(0, 255, 204, 0.07), transparent 40%),
        radial-gradient(circle at 50% 100%, rgba(0, 255, 204, 0.04), transparent 50%);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.55;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
}

button {
    font-family: inherit;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

::selection {
    background: rgba(0, 255, 204, 0.35);
    color: #fff;
}

/* Custom scrollbar */
::-webkit-scrollbar            { width: 9px; height: 9px; }
::-webkit-scrollbar-track      { background: #0d0f17; }
::-webkit-scrollbar-thumb      { background: #1e293b; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover{ background: var(--accent); }

/* ---------------------------------------------------------------------------
   2. Typography utilities
--------------------------------------------------------------------------- */
.font-cyber  { font-family: var(--font-cyber);  letter-spacing: 0.02em; }
.font-retro  { font-family: var(--font-retro);  letter-spacing: 0.05em; }
.font-mono   { font-family: 'Consolas', 'Courier New', monospace; }

.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-base{ font-size: 15px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.text-2xl{ font-size: 28px; }
.text-3xl{ font-size: 36px; }

.text-accent  { color: var(--accent); }
.text-purple  { color: var(--purple); }
.text-yellow  { color: var(--yellow); }
.text-blue    { color: var(--blue); }
.text-muted   { color: var(--muted); }
.text-center  { text-align: center; }

.neon-accent { text-shadow: 0 0 8px rgba(0, 255, 204, 0.6); }
.neon-pink   { text-shadow: 0 0 8px rgba(255, 0, 127, 0.6); }

.grad-text {
    background: linear-gradient(90deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---------------------------------------------------------------------------
   3. Layout helpers
--------------------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-main {
    flex: 1 1 auto;
    padding: 28px 0 48px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.hidden { display: none !important; }

/* ---------------------------------------------------------------------------
   4. App header / footer
--------------------------------------------------------------------------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(10, 11, 16, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(31, 41, 61, 0.85);
}

.header-inner {
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo-block {
    display: flex;
    align-items: center;
    gap: 12px;
    user-select: none;
}

.logo-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--purple), var(--accent));
    display: grid;
    place-items: center;
    box-shadow: 0 0 18px rgba(0, 255, 204, 0.35);
    color: #000;
    flex: 0 0 auto;
}

.logo-mark svg { width: 22px; height: 22px; }

.logo-title {
    font-family: var(--font-cyber);
    font-weight: 900;
    font-size: 20px;
    color: #fff;
    letter-spacing: 0.05em;
    margin: 0;
    line-height: 1.1;
}

.logo-subtitle {
    font-size: 10px;
    color: var(--muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin: 2px 0 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: rgba(10, 11, 16, 0.82);
    padding: 22px 0;
    margin-top: 24px;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--faint);
}

.footer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-cyber);
    font-size: 12px;
}

.footer-actions a,
.footer-actions span.linklike { color: var(--muted); cursor: pointer; }
.footer-actions a:hover,
.footer-actions span.linklike:hover { color: var(--accent); }

/* ---------------------------------------------------------------------------
   5. Buttons & inputs
--------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-family: var(--font-cyber);
    font-size: 12px;
    letter-spacing: 0.06em;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:hover { border-color: rgba(0, 255, 204, 0.5); color: var(--accent); }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 700;
}

.btn-primary:hover {
    background: rgba(0, 255, 204, 0.82);
    color: #000;
    box-shadow: var(--shadow-accent);
}

.btn-ghost { background: transparent; }

.btn-danger {
    background: rgba(255, 82, 82, 0.14);
    border-color: rgba(255, 82, 82, 0.45);
    color: var(--danger);
}

.btn-danger:hover { background: rgba(255, 82, 82, 0.28); color: #fff; }

.btn-sm { padding: 6px 10px; font-size: 11px; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--card);
    border: 1px solid var(--border);
    color: #cbd5e1;
    transition: all 0.2s ease;
}

.icon-btn:hover { border-color: rgba(0, 255, 204, 0.5); color: var(--accent); }
.icon-btn.is-active { color: var(--purple); border-color: rgba(255, 0, 127, 0.5); }

.icon-btn svg { width: 18px; height: 18px; }

.text-input {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #fff;
    padding: 10px 13px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.text-input:focus { border-color: var(--accent); }
.text-input::placeholder { color: var(--faint); }

/* ---------------------------------------------------------------------------
   6. Hero banner
--------------------------------------------------------------------------- */
.hero {
    position: relative;
    border-radius: 16px;
    background: linear-gradient(120deg, var(--card), rgba(18, 21, 32, 0.72));
    border: 1px solid var(--border);
    padding: 42px 40px;
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -40px;
    bottom: -40px;
    width: 45%;
    opacity: 0.1;
    background-image: radial-gradient(var(--accent) 1px, transparent 1px);
    background-size: 16px 16px;
    pointer-events: none;
}

.hero-inner { position: relative; z-index: 2; max-width: 660px; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(0, 255, 204, 0.1);
    border: 1px solid rgba(0, 255, 204, 0.3);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pulse-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.6s ease-out infinite;
    flex: 0 0 auto;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(0, 255, 204, 0.6); }
    70%  { box-shadow: 0 0 0 9px rgba(0, 255, 204, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 204, 0); }
}

.hero-title {
    font-family: var(--font-cyber);
    font-weight: 900;
    font-size: 34px;
    line-height: 1.2;
    color: #fff;
    margin: 18px 0 12px;
}

.hero-text { color: var(--muted); font-size: 15px; margin: 0; max-width: 60ch; }

/* ---------------------------------------------------------------------------
   7. Toolbar (search + tag chips)
--------------------------------------------------------------------------- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    gap: 14px;
}

@media (min-width: 768px) {
    .toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
}

.search-box { position: relative; flex: 1 1 100%; max-width: 360px; }

@media (min-width: 768px) { .search-box { flex: 0 1 320px; } }

.search-box svg {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--faint);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 11px 14px 11px 40px;
}

.chips {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    max-width: 100%;
}

.chip {
    border: 1px solid var(--border);
    background: var(--card);
    color: #cbd5e1;
    padding: 7px 13px;
    border-radius: 9px;
    font-family: var(--font-cyber);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.chip:hover { border-color: rgba(0, 255, 204, 0.45); color: var(--accent); }

.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 700;
    box-shadow: var(--shadow-accent);
}

/* ---------------------------------------------------------------------------
   8. Games grid & cards
--------------------------------------------------------------------------- */
.section-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 6px 0 18px;
}

.section-head::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

.section-title {
    font-family: var(--font-cyber);
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    margin: 0;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 22px;
}

.game-card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.game-card:hover {
    transform: translateY(-6px);
    border-color: rgba(0, 255, 204, 0.55);
    box-shadow: 0 14px 28px -12px rgba(0, 255, 204, 0.35);
}

.card-cover {
    position: relative;
    height: 160px;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255, 0, 127, 0.12), rgba(0, 255, 204, 0.12)),
        radial-gradient(circle at 70% 20%, rgba(0, 255, 204, 0.15), transparent 55%),
        var(--bg-panel);
    display: grid;
    place-items: center;
}

.card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.game-card:hover .card-cover img {
    transform: scale(1.06);
    opacity: 1;
}

.cover-fallback {
    font-family: var(--font-retro);
    font-size: 12px;
    color: var(--accent);
    padding: 12px;
    text-align: center;
    line-height: 1.7;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}

.card-fav {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    border: none;
    color: #fff;
    display: grid;
    place-items: center;
    backdrop-filter: blur(4px);
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 2;
}

.card-fav:hover { color: var(--purple); transform: scale(1.1); }
.card-fav.is-fav { color: var(--purple); }
.card-fav svg { width: 15px; height: 15px; }

.card-tags {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    z-index: 2;
}

.card-tag {
    padding: 3px 8px;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 10px;
    background: rgba(0, 0, 0, 0.68);
    color: var(--accent);
    border: 1px solid rgba(0, 255, 204, 0.3);
}

.card-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;
}

.card-title {
    font-family: var(--font-cyber);
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    margin: 0;
    transition: color 0.2s ease;
}

.game-card:hover .card-title { color: var(--accent); }

.card-publisher {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--faint);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-desc {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-actions { padding: 0 16px 16px; }

.card-play-btn {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: #fff;
    font-family: var(--font-cyber);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.card-play-btn svg { width: 13px; height: 13px; }

.game-card:hover .card-play-btn {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    box-shadow: var(--shadow-accent);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--faint);
}

.empty-state .ghost {
    font-size: 44px;
    margin-bottom: 14px;
}

.empty-state p { font-family: var(--font-cyber); font-size: 16px; color: var(--muted); }

/* ---------------------------------------------------------------------------
   9. Modals
--------------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.86);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-backdrop--flush { padding: 0; }

.modal {
    width: 100%;
    max-width: 600px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
}

.modal-full {
    max-width: none;
    height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.modal-close-x {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
}

.modal-close-x:hover { color: #fff; }

.modal-body { padding: 26px; }

.modal-heading { margin-bottom: 18px; }

.modal-heading h3 {
    font-family: var(--font-cyber);
    font-weight: 700;
    font-size: 20px;
    color: #fff;
    margin: 0 0 4px;
}

.modal-heading p { margin: 0; color: var(--muted); font-size: 12px; }

/* Upload */
.upload-zone {
    border: 2px dashed var(--border);
    background: rgba(13, 15, 23, 0.6);
    border-radius: var(--radius);
    padding: 34px 20px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(0, 255, 204, 0.05);
}

.upload-icon {
    width: 54px;
    height: 54px;
    color: var(--accent);
    animation: bob 1.8s ease-in-out infinite;
}

.upload-zone strong { display: block; color: #fff; font-size: 15px; margin-bottom: 4px; }
.upload-zone small { color: var(--muted); }

@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.url-row { display: flex; gap: 10px; margin-top: 20px; }
.url-row .text-input { flex: 1 1 auto; }

.form-label {
    display: block;
    font-family: var(--font-cyber);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin: 22px 0 8px;
}

.notice {
    border: 1px solid rgba(255, 204, 0, 0.35);
    background: rgba(255, 204, 0, 0.08);
    color: var(--yellow);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    font-size: 12px;
    margin-top: 16px;
    line-height: 1.5;
}

/* ---------------------------------------------------------------------------
   10. Emulator viewport, loader overlay, touch gamepad
--------------------------------------------------------------------------- */
.modal-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

.modal-heading-inline { display: flex; align-items: center; gap: 10px; min-width: 0; }

.modal-badge {
    padding: 3px 9px;
    border-radius: 6px;
    background: rgba(0, 255, 204, 0.18);
    border: 1px solid rgba(0, 255, 204, 0.4);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    flex: 0 0 auto;
}

.modal-title {
    font-family: var(--font-cyber);
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-toolbar { display: flex; align-items: center; gap: 8px; }

.modal-toolbar .icon-btn { width: 36px; height: 36px; }
.modal-toolbar .btn { padding: 8px 12px; }

.toolbar-label { display: none; }
@media (min-width: 768px) { .toolbar-label { display: inline; } }

.emulator-viewport {
    position: relative;
    flex: 1 1 auto;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* js-dos mount point fills the viewport */
.emulator-host {
    position: absolute;
    inset: 0;
    background: #000;
}

.loader-overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 24px;
}

.spinner {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 4px solid rgba(0, 255, 204, 0.25);
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-title {
    font-family: var(--font-cyber);
    color: var(--accent);
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    animation: blink 1.4s ease-in-out infinite;
    margin: 0;
}

.loader-sub { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin: 0; }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.loader-error { max-width: 460px; color: var(--yellow); line-height: 1.6; }
.loader-error .err-title { font-family: var(--font-cyber); text-transform: uppercase; letter-spacing: 0.1em; }
.loader-error p { font-size: 12px; color: var(--text); }

.error-icon { color: var(--yellow); font-size: 40px; }

/* Touch gamepad */
.touch-overlay {
    position: absolute;
    bottom: 18px;
    left: 18px;
    right: 18px;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
}

.dpad {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    grid-auto-rows: 44px;
    gap: 6px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid #46536b;
    padding: 10px;
    border-radius: 50%;
    pointer-events: auto;
    backdrop-filter: blur(4px);
}

.dpad-btn {
    border: none;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.28);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    transition: background 0.1s ease, color 0.1s ease;
}

.dpad-btn:active, .dpad-btn.pressed { background: var(--accent); color: #000; }

.dpad .pad-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--faint);
    font-family: var(--font-mono);
}

.action-pad {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    pointer-events: auto;
}

.action-btn {
    border: 1px solid transparent;
    border-radius: 50%;
    color: #fff;
    font-family: var(--font-cyber);
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    transition: background 0.1s ease, transform 0.1s ease;
}

.action-btn:active { transform: scale(0.94); }

.action-btn.ctl  { width: 56px; height: 56px; background: rgba(255, 0, 127, 0.75); font-size: 12px; }
.action-btn.spc  { width: 56px; height: 56px; background: rgba(0, 255, 204, 0.75); color: #000; font-size: 11px; }
.action-btn.ent  { width: 46px; height: 46px; background: rgba(255, 204, 0, 0.78); color: #000; font-size: 10px; }

/* ---------------------------------------------------------------------------
   11. MSX console panel
--------------------------------------------------------------------------- */
.console-panel {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 40px rgba(0, 255, 204, 0.08);
}

.console-statusbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.8);
    flex: 0 0 auto;
}

.console-statusbar .status-right { margin-left: auto; }

.console-screen {
    position: relative;
    min-height: 400px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* WebMSX places its screen into #wmsx-screen; keep it centered */
.console-screen #wmsx-screen { margin: 0 auto; }

.console-screen .crt-inner {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* ---------------------------------------------------------------------------
   12. CRT scanlines overlay
--------------------------------------------------------------------------- */
body.crt::after {
    content: "";
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.26) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.012), rgba(0, 0, 255, 0.03));
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
    opacity: 0.7;
}

body:not(.crt)::after { display: none; }

/* ---------------------------------------------------------------------------
   13. Index (menu hub)
--------------------------------------------------------------------------- */
.hub-hero {
    position: relative;
    text-align: center;
    padding: 72px 20px 56px;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(circle at 50% -20%, rgba(0, 255, 204, 0.14), transparent 55%),
        radial-gradient(circle at 15% 100%, rgba(255, 0, 127, 0.1), transparent 50%);
    overflow: hidden;
}

.hub-hero h1 {
    font-family: var(--font-cyber);
    font-weight: 900;
    font-size: clamp(34px, 6vw, 64px);
    margin: 0 0 10px;
    color: #fff;
    letter-spacing: 0.04em;
}

.hub-hero .tagline {
    font-family: var(--font-mono);
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    margin: 0 0 8px;
}

.hub-hero p{
    max-width: 520px;
    margin: 14px auto 0;
    color: var(--muted);
}

.hub-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 26px;
    max-width: 900px;
    margin: -28px auto 0;
    padding: 0 20px 60px;
    position: relative;
    z-index: 2;
}

.hub-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 30px 26px 26px;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hub-card:hover {
    transform: translateY(-8px);
    border-color: rgba(0, 255, 204, 0.55);
    box-shadow: 0 20px 44px -18px rgba(0, 255, 204, 0.4);
}

.hub-card.msx-card:hover { border-color: rgba(0, 191, 255, 0.55); box-shadow: 0 20px 44px -18px rgba(0, 191, 255, 0.4); }

.hub-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
}

.hub-card.msx-card::before { background: linear-gradient(90deg, var(--blue), var(--accent)); }

.hub-card-icon {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--purple), var(--accent));
    color: #000;
    box-shadow: var(--shadow-accent);
}

.hub-card.msx-card .hub-card-icon { background: linear-gradient(135deg, var(--blue), var(--accent)); }

.hub-card-icon svg { width: 28px; height: 28px; }

.hub-card h3 {
    font-family: var(--font-cyber);
    font-weight: 800;
    font-size: 22px;
    margin: 0;
    color: #fff;
}

.hub-card .engine {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
}

.hub-card.msx-card .engine { color: var(--blue); }

.hub-card p { margin: 0; color: var(--muted); font-size: 13px; }

.hub-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
}

.hub-features li { display: flex; align-items: center; gap: 10px; }
.hub-features li::before {
    content: "▸";
    color: var(--accent);
    font-weight: 700;
}
.hub-card.msx-card .hub-features li::before { color: var(--blue); }

.hub-card .card-actions { padding: 8px 0 0; }

.enter-btn {
    width: 100%;
    padding: 13px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 204, 0.4);
    background: rgba(0, 255, 204, 0.08);
    color: var(--accent);
    font-family: var(--font-cyber);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.hub-card:hover .enter-btn {
    background: var(--accent);
    color: #000;
    box-shadow: var(--shadow-accent);
}

.hub-card.msx-card .enter-btn { border-color: rgba(0, 191, 255, 0.4); color: var(--blue); }
.hub-card.msx-card:hover .enter-btn { background: var(--blue); color: #000; box-shadow: 0 0 16px rgba(0, 191, 255, 0.4); }

.enter-btn svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------------------
   14. Small helpers
--------------------------------------------------------------------------- */
.inline-code {
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 8px;
    color: var(--accent);
    display: inline-block;
    margin-top: 6px;
    word-break: break-all;
}

/* ---------------------------------------------------------------------------
   15. Responsive
--------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .header-inner { height: 72px; }
    .logo-title { font-size: 16px; }
    .logo-subtitle { display: none; }
    .hero { padding: 28px 22px; }
    .hero-title { font-size: 24px; }
    .modal-title { max-width: 140px; }
    .console-screen { min-height: 260px; }
    .hub-hero { padding: 52px 16px 44px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}