﻿/* Glitch Minigames  Preview Site
   Residual CSS: pseudo-elements, keyframes, component classes, and
   hard overrides that cannot be expressed as Tailwind utilities.
   All layout / sizing / spacing lives in Tailwind classes in index.html. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Share+Tech+Mono&display=swap');

/*  Hard reset */
html, body { background: #0b0b14 !important; background-color: #0b0b14 !important; display: block !important; height: 100% !important; overflow: hidden !important; -webkit-font-smoothing: antialiased; }

/*  Resource override */
#game-layer .game-container { background: rgba(12,12,22,0.97); box-shadow: 0 0 40px rgba(0,0,0,0.5); }

/*  Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(168,85,247,0.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(168,85,247,0.45); }

/*  Keyframes */
@keyframes dot-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.65); } }
.pulse-dot      { animation: dot-pulse 2s   ease-in-out infinite; }
.pulse-dot-fast { animation: dot-pulse 1.4s ease-in-out infinite; }

/*  Stage gradient + grid lines */
#stage { background: radial-gradient(ellipse 70% 55% at 65% 25%, rgba(168,85,247,0.07) 0%, transparent 100%), radial-gradient(ellipse 50% 45% at 15% 75%, rgba(236,72,153,0.05) 0%, transparent 100%), #0b0b14; }
#stage::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,0.016) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.016) 1px, transparent 1px); background-size: 44px 44px; pointer-events: none; z-index: 0; }

/*  Config panel */
#config-panel { transition: width 0.22s cubic-bezier(0.4,0,0.2,1); }
#config-panel.open { width: 288px; overflow-y: auto; border-left-width: 1px !important; }
.config-body, .config-footer { min-width: 288px; }

/*  Result toast */
#result-toast { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(70px); z-index: 9999; background: rgba(10,10,20,0.97); border: 1px solid rgba(255,255,255,0.07); border-radius: 10px; padding: 9px 20px; font-family: 'Courier New', monospace; font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase; color: #6b6b7e; backdrop-filter: blur(12px); opacity: 0; transition: transform 0.3s cubic-bezier(0.34,1.46,0.64,1), opacity 0.3s ease; white-space: nowrap; pointer-events: none; }
#result-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#result-toast.ok   { border-color: rgba(45,212,168,0.5); color: #2dd4a8; }
#result-toast.fail { border-color: rgba(239,68,68,0.4);  color: #ef4444; }

/*  Running badge */
#running-badge { position: absolute; top: 14px; right: 14px; z-index: 9998; display: none; align-items: center; gap: 6px; background: rgba(10,10,20,0.92); border: 1px solid rgba(168,85,247,0.3); border-radius: 99px; padding: 4px 12px 4px 9px; font-family: 'Courier New', monospace; font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: #a855f7; backdrop-filter: blur(10px); }
#running-badge.show { display: flex; }
.rb-dot { width: 6px; height: 6px; border-radius: 50%; background: #a855f7; box-shadow: 0 0 6px #a855f7; animation: dot-pulse 1.4s ease-in-out infinite; }

/*  Sidebar buttons */
.game-btn.hidden { display: none !important; }
.game-btn { display: flex !important; align-items: center !important; gap: 9px !important; width: 100% !important; background: transparent !important; border: 1px solid transparent !important; border-radius: 7px !important; color: #6b6b7e !important; font-size: 0.78rem !important; font-weight: 500 !important; font-family: 'Inter', -apple-system, sans-serif !important; padding: 7px 9px !important; cursor: pointer !important; text-align: left !important; transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease !important; text-transform: none !important; letter-spacing: normal !important; box-shadow: none !important; filter: none !important; transform: none !important; }
.game-btn:hover { background: rgba(255,255,255,0.06) !important; border-color: rgba(255,255,255,0.07) !important; color: #f0f0f5 !important; box-shadow: none !important; transform: none !important; filter: none !important; }
.game-btn.active { background: rgba(168,85,247,0.1) !important; border-color: rgba(168,85,247,0.35) !important; color: #a855f7 !important; box-shadow: none !important; transform: none !important; filter: none !important; }
.game-btn-dot { width: 6px; height: 6px; border-radius: 50%; background: #35354a; flex-shrink: 0; transition: all 0.12s; }
.game-btn.active .game-btn-dot { background: #a855f7 !important; box-shadow: 0 0 7px #a855f7 !important; }
.game-btn-type { margin-left: auto; font-size: 0.52rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: #35354a; flex-shrink: 0; background: rgba(255,255,255,0.04); border-radius: 3px; padding: 2px 5px; }
.game-btn.active .game-btn-type { color: rgba(168,85,247,0.6) !important; background: rgba(168,85,247,0.08) !important; }

/*  Empty state */
#empty-state { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; pointer-events: auto; padding: 24px 32px; }
.empty-logo { height: 44px; width: auto; object-fit: contain; border-radius: 10px; margin-bottom: 6px; opacity: 0.9; filter: drop-shadow(0 0 18px rgba(168,85,247,0.35)); pointer-events: auto; }
.empty-title { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; background: linear-gradient(100deg, #f0f0f5 30%, #a855f7 80%, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.15; margin-bottom: 2px; }
.empty-tagline { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #a855f7; opacity: 0.7; margin-bottom: 4px; }
.empty-desc { font-size: 0.8rem; color: #6b6b7e; line-height: 1.65; max-width: 420px; }
.empty-by { font-size: 0.68rem; color: #35354a; margin-top: 4px; }
.empty-link { color: #a855f7; text-decoration: none; pointer-events: auto; transition: color 0.15s; }
.empty-link:hover { color: #ec4899; }
.empty-socials { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; justify-content: center; pointer-events: auto; }
.empty-social-btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 7px; font-size: 0.7rem; font-weight: 600; color: #6b6b7e; text-decoration: none; font-family: inherit; transition: all 0.15s ease; pointer-events: auto; cursor: pointer; }
.empty-social-btn:hover { background: rgba(168,85,247,0.1); border-color: rgba(168,85,247,0.35); color: #a855f7; }
.empty-hint { font-size: 0.62rem; color: #2a2a3a; margin-top: 8px; font-family: 'Courier New', monospace; letter-spacing: 0.06em; }
.empty-hints-row { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 460px; margin-top: 16px; pointer-events: auto; }
.empty-hint-card { display: flex; align-items: flex-start; gap: 12px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 9px; padding: 12px 14px; text-align: left; }
.empty-hint-icon { font-size: 1rem; line-height: 1; flex-shrink: 0; margin-top: 1px; color: #2dd4a8; }
.empty-hint-label { font-size: 0.72rem; font-weight: 700; color: #c8c8d8; margin-bottom: 3px; }
.empty-hint-text { font-size: 0.72rem; color: #6b6b7e; line-height: 1.55; }
.empty-inline-btn { background: transparent; border: none; padding: 0; color: #2dd4a8; font-size: inherit; font-family: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; transition: color 0.15s; }
.empty-inline-btn:hover { color: #5ee8cb; }
.empty-keys { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.kbd { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.07); border-radius: 4px; padding: 2px 7px; font-family: 'Courier New', monospace; font-size: 0.62rem; color: #6b6b7e; }

/*  Config component classes */
.config-header { padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); flex-shrink: 0; }
.config-game-name { font-size: 0.92rem; font-weight: 700; color: #f0f0f5; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.config-game-sub { font-size: 0.63rem; color: #6b6b7e; margin-top: 3px; }
.config-body { flex: 1; overflow-y: auto; padding: 12px 14px 0; }
.config-section-label { font-size: 0.54rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: #35354a; padding: 12px 0 7px; border-top: 1px solid rgba(255,255,255,0.04); margin-top: 4px; }
.config-section-label:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.param-row { margin-bottom: 14px; }
.param-label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.param-label { font-size: 0.72rem; font-weight: 500; color: #f0f0f5; }
.param-value { font-size: 0.67rem; font-family: 'Courier New', monospace; color: #a855f7; font-weight: 600; min-width: 28px; text-align: right; }
.param-input { width: 100%; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07); border-radius: 5px; color: #f0f0f5; font-family: 'Courier New', monospace; font-size: 0.78rem; padding: 6px 10px; outline: none; transition: border-color 0.15s; }
.param-input:focus { border-color: rgba(168,85,247,0.45); background: rgba(168,85,247,0.04); }
.param-select { width: 100%; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07); border-radius: 5px; color: #f0f0f5; font-family: inherit; font-size: 0.75rem; padding: 6px 10px; outline: none; cursor: pointer; }
.param-select option { background: #17172a; }
.param-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.config-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,0.04); flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.config-reload-btn { width: 100%; padding: 9px 16px; background: linear-gradient(100deg, #a855f7, #ec4899); border: none; border-radius: 7px; color: white; font-family: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: opacity 0.15s; }
.config-reload-btn:hover { opacity: 0.88; }
.config-reset-btn { width: 100%; padding: 7px 16px; background: transparent; border: 1px solid rgba(255,255,255,0.07); border-radius: 7px; color: #6b6b7e; font-family: inherit; font-size: 0.71rem; cursor: pointer; transition: all 0.15s; }
.config-reset-btn:hover { border-color: rgba(168,85,247,0.4); color: #f0f0f5; }
.config-code-btn { width: 100%; padding: 7px 16px; background: transparent; border: 1px solid rgba(45,212,168,0.2); border-radius: 7px; color: rgba(45,212,168,0.7); font-family: 'Courier New', monospace; font-size: 0.71rem; cursor: pointer; transition: all 0.15s; }
.config-code-btn:hover { border-color: rgba(45,212,168,0.5); color: #2dd4a8; background: rgba(45,212,168,0.05); }
.config-code-pre { background: rgba(0,0,0,0.45); border: 1px solid rgba(45,212,168,0.12); border-radius: 8px; padding: 14px 16px; font-family: 'Courier New', monospace; font-size: 0.74rem; color: #abb2bf; white-space: pre; overflow-x: auto; margin: 0; line-height: 1.65; max-height: 320px; overflow-y: auto; }
/* Strip hljs background so our pre background shows through */
.config-code-pre.hljs, .config-code-pre > code.hljs,
.guide-code.hljs,      .guide-code > code.hljs { background: transparent !important; padding: 0 !important; }
.config-copy-btn { width: 100%; padding: 9px 16px; background: rgba(45,212,168,0.08); border: 1px solid rgba(45,212,168,0.2); border-radius: 7px; color: rgba(45,212,168,0.85); font-family: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.config-copy-btn:hover { background: rgba(45,212,168,0.15); border-color: rgba(45,212,168,0.5); color: #2dd4a8; }
.config-key-note { padding: 9px 10px; background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.04); border-radius: 5px; font-size: 0.62rem; color: #6b6b7e; line-height: 1.55; margin-bottom: 10px; }
.config-key-note code { font-family: 'Courier New', monospace; color: #2dd4a8; background: rgba(45,212,168,0.1); padding: 1px 4px; border-radius: 3px; }

/*  Range slider */
.param-range { -webkit-appearance: none; width: 100%; height: 4px; background: rgba(255,255,255,0.09); border-radius: 99px; outline: none; cursor: pointer; }
.param-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #a855f7; box-shadow: 0 0 8px rgba(168,85,247,0.5); cursor: pointer; transition: transform 0.1s; }
.param-range::-webkit-slider-thumb:hover { transform: scale(1.25); }

/*  Toggle switch */
.param-toggle { position: relative; width: 34px; height: 18px; flex-shrink: 0; }
.param-toggle input { opacity: 0; width: 0; height: 0; }
.param-toggle-slider { position: absolute; inset: 0; background: rgba(255,255,255,0.1); border-radius: 99px; cursor: pointer; transition: background 0.2s; }
.param-toggle-slider::before { content: ''; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: transform 0.2s; }
.param-toggle input:checked + .param-toggle-slider { background: #a855f7; }
.param-toggle input:checked + .param-toggle-slider::before { transform: translateX(16px); }

/* ── Sidebar section / label */
.sidebar-section { margin-bottom: 6px; }
.sidebar-label { font-size: 0.56rem; font-weight: 700; letter-spacing: 0.17em; text-transform: uppercase; color: #35354a; padding: 10px 8px 6px; }

/* ── Native info panel */
#native-info { position: absolute; inset: 0; z-index: 3; display: none; align-items: center; justify-content: center; padding: 32px; }
#native-info.show { display: flex; }
.native-card { display: flex; gap: 28px; max-width: 700px; width: 100%; background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 28px; }
.native-img-col { width: 220px; flex-shrink: 0; }
#native-img { width: 100%; border-radius: 8px; display: block; }
#native-img-placeholder { width: 100%; aspect-ratio: 16/10; border-radius: 8px; border: 1px dashed rgba(255,255,255,0.08); background: rgba(255,255,255,0.02); display: flex; align-items: center; justify-content: center; font-size: 0.64rem; color: #35354a; letter-spacing: 0.06em; font-family: 'Courier New', monospace; }
.native-detail-col { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.native-badge { display: inline-flex; align-items: center; font-size: 0.57rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #d97706; background: rgba(217,119,6,0.1); border: 1px solid rgba(217,119,6,0.25); border-radius: 99px; padding: 3px 10px; align-self: flex-start; }
.native-title { font-size: 1.35rem; font-weight: 800; color: #f0f0f5; margin: 0; letter-spacing: -0.02em; }
.native-desc { font-size: 0.78rem; color: #9898a8; line-height: 1.65; margin: 0; flex: 1; }
.native-note { font-size: 0.62rem; color: #35354a; padding: 8px 10px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.04); border-radius: 6px; line-height: 1.55; }

/* ── Mobile: sidebar overlay, hamburger button, responsive nav ── */
#menu-btn { display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px; }
#sidebar-scrim { display: none; position: fixed; inset: 58px 0 0 0; background: rgba(0,0,0,0.5); z-index: 499; cursor: pointer; }
#sidebar-scrim.show { display: block; }

@media (max-width: 639px) {
    html, body { overflow: hidden !important; }
    #menu-btn { display: flex; }
    #nav-status, #nav-github-link, #nav-website-link, #nav-sep, #nav-label { display: none !important; }
    #sidebar {
        position: fixed !important;
        top: 58px; left: 0; bottom: 0;
        z-index: 500;
        transform: translateX(-100%);
        transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
        background: rgba(6,6,14,0.99) !important;
        box-shadow: 4px 0 24px rgba(0,0,0,0.6);
    }
    #sidebar.open { transform: translateX(0); }
    #config-panel, #config-panel.open { width: 0 !important; overflow: hidden !important; border-left: none !important; }
    #result-toast { max-width: calc(100vw - 40px); white-space: normal; text-align: center; font-size: 0.62rem; padding: 7px 14px; }
    #running-badge { right: auto; left: 50%; transform: translateX(-50%); top: 8px; }
    .native-card { flex-direction: column; gap: 16px; padding: 20px; }
    .native-img-col { width: 100%; }
    #reference-view, #guide-view { padding: 20px 16px; }
    #nav-guide-btn, #nav-ref-btn { display: none; }
}

/* ── Docs button on config header ───────────────────────────────────────── */
.config-docs-btn {
    background: rgba(168,85,247,0.1);
    border: 1px solid rgba(168,85,247,0.2);
    border-radius: 7px;
    color: rgba(168,85,247,0.7);
    font-size: 0.78rem;
    font-weight: 700;
    width: 26px; height: 26px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    font-family: inherit;
}
.config-docs-btn:hover {
    background: rgba(168,85,247,0.18);
    border-color: rgba(168,85,247,0.5);
    color: #a855f7;
}

/* ── Lua/JS code tabs ────────────────────────────────────────────────────── */
.code-tab-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 6px;
    color: #6b6b7e;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.code-tab-btn:hover { border-color: rgba(45,212,168,0.3); color: #c0c0d0; }
.code-tab-btn.active {
    background: rgba(45,212,168,0.1);
    border-color: rgba(45,212,168,0.35);
    color: #2dd4a8;
}

/* ── Docs modal ──────────────────────────────────────────────────────────── */
.docs-section-label {
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(168,85,247,0.6);
    margin-bottom: 8px;
}
.docs-params-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
}
.docs-params-table th {
    text-align: left;
    padding: 6px 10px;
    color: #6b6b7e;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.docs-td {
    padding: 6px 10px;
    color: #9898a8;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 0.72rem;
}
.docs-td:first-child { color: #c8c8d8; font-weight: 500; }

/* ── Reference + Guide views ─────────────────────────────────────────────── */
.view-header { margin-bottom: 22px; }
.view-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f0f0f5;
    margin-bottom: 4px;
}
.view-sub { font-size: 0.72rem; color: #6b6b7e; }

.ref-th {
    text-align: left;
    padding: 7px 12px;
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6b6b7e;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    position: sticky; top: 0;
}
.ref-td {
    padding: 6px 12px;
    color: #9898a8;
    font-size: 0.72rem;
    border-bottom: 1px solid rgba(255,255,255,0.025);
}
.ref-game-name { color: #c8c8d8; font-weight: 600; font-size: 0.73rem; }
.ref-type {
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    color: rgba(45,212,168,0.7);
}
tr:hover .ref-td { background: rgba(255,255,255,0.015); }

.guide-section {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 20px 22px;
    margin-bottom: 16px;
}
.guide-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f0f0f5;
    margin-bottom: 10px;
}
.guide-text {
    font-size: 0.78rem;
    color: #9898a8;
    line-height: 1.65;
    margin-bottom: 10px;
}
.guide-text:last-child { margin-bottom: 0; }
.guide-code {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 7px;
    color: #c8c8d8;
    font-family: 'Courier New', monospace;
    font-size: 0.71rem;
    line-height: 1.6;
    padding: 14px 16px;
    overflow-x: auto;
    white-space: pre;
    margin-bottom: 10px;
}
.gc {
    background: rgba(168,85,247,0.1);
    color: rgba(168,85,247,0.9);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

/* ── Nav divider between docs buttons and external links ────────────────── */
.nav-divider {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.07);
    margin: 0 2px;
    flex-shrink: 0;
    align-self: center;
}

/* ── Nav active state for Reference / Guide ──────────────────────────────── */
#nav-ref-btn.active, #nav-guide-btn.active {
    background: rgba(45,212,168,0.1);
    border-color: rgba(45,212,168,0.35);
    color: #2dd4a8;
}