/* =====================================================
   BASE THEME TOKENS — overridden per-theme by JS
   ===================================================== */
:root {
    /* accent pair */
    --t-a1: #55ffff;
    --t-a2: #ff5555;
    /* backgrounds */
    --t-bg0: #080b10;
    --t-bg1: #101722;
    --t-bg2: #161f2c;
    --t-bg3: #1c2838;
    /* sidebar */
    --t-sidebar: rgba(10,14,20,0.97);
    --t-header:  rgba(12,17,25,0.92);
    /* glow & border tints */
    --t-glow1: rgba(85,255,255,0.14);
    --t-glow2: rgba(255,85,85,0.12);
    --t-bdr1:  rgba(85,255,255,0.28);
    --t-bdr2:  rgba(255,85,85,0.22);
    /* text */
    --t-tx1: #f1f5f9;
    --t-tx2: #94a3b8;
    --t-tx3: #64748b;
    /* ui details */
    --t-border:  rgba(255,255,255,0.08);
    --t-borderS: rgba(255,255,255,0.14);
    /* body bg gradient stops */
    --t-grad1: rgba(255,85,85,0.07);
    --t-grad2: rgba(85,255,255,0.07);
    /* card recommended tint */
    --t-rec-tint: rgba(85,255,255,0.07);
    --t-norec-tint: rgba(255,85,85,0.07);  /* red tint for JS card */
    /* font */
    --t-font-head: 'Oxanium', sans-serif;
    --t-font-body: 'Nunito', sans-serif;
    /* scrollbar */
    --t-scroll: rgba(85,255,255,0.25);
    /* header title extra style */
    --t-pk-style: italic;
    --t-pk-shadow: 2px 2px 0 #3e1414;
    --t-smp-shadow: 2px 2px 0 #143e3e;
}

/* =====================================================
   RESET + BASE
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: var(--t-bg0);
    color: var(--t-tx1);
    font-family: var(--t-font-body);
    transition: background 0.4s, color 0.4s;
}

/* scrollbars */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--t-scroll); border-radius: 99px; }

/* body ambient glow */
body::after {
    content: "";
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background:
        radial-gradient(ellipse 60% 40% at 0% 0%, var(--t-grad1), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, var(--t-grad2), transparent);
    transition: background 0.5s;
}

/* =====================================================
   LAYOUT
   ===================================================== */
.app { display: flex; width: 100%; height: 100vh; position: relative; z-index: 1; }

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    width: 74px; background: var(--t-sidebar);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--t-border);
    display: flex; flex-direction: column; align-items: center;
    padding: 14px 0; z-index: 50;
    transition: background 0.4s, border-color 0.4s;
}

.player-head-btn {
    width: 46px; height: 46px; border-radius: 14px;
    overflow: hidden; border: 2px solid transparent;
    background: var(--t-bg2); cursor: pointer; position: relative;
    transition: 0.25s;
}
.player-head-btn:hover { border-color: var(--t-a1); box-shadow: 0 0 18px var(--t-glow1); }
.player-head-btn img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }

.head-tooltip, .nav-tooltip {
    position: absolute; left: 58px; top: 50%; transform: translateY(-50%);
    background: var(--t-bg0); border: 1px solid var(--t-borderS);
    padding: 6px 10px; border-radius: 8px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: 0.2s; font-size: 13px;
    color: var(--t-tx1); z-index: 100;
}
.player-head-btn:hover .head-tooltip,
.nav-btn:hover .nav-tooltip { opacity: 1; }

.sidebar-divider { width: 34px; height: 1px; background: var(--t-border); margin: 12px 0; }
.sidebar-spacer { flex: 1; }

.nav-btn {
    width: 46px; height: 46px; border-radius: 14px;
    border: none; background: transparent;
    color: var(--t-tx2); margin-bottom: 8px; cursor: pointer;
    position: relative; transition: 0.25s;
}
.nav-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
.nav-btn:hover { background: var(--t-glow1); color: var(--t-a1); }
.nav-btn.active {
    background: var(--t-glow1);
    color: var(--t-a1);
    box-shadow: inset 0 0 0 1px var(--t-bdr1), 0 0 14px var(--t-glow1);
}

/* =====================================================
   HEADER
   ===================================================== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.header {
    height: 68px; background: var(--t-header);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--t-border);
    display: flex; align-items: center; gap: 18px; padding: 0 24px;
    transition: background 0.4s;
}

.header-title { font-size: 28px; font-weight: 800; font-family: var(--t-font-head); letter-spacing: 1px; }
.pk-red {
    color: var(--t-a2);
    font-style: var(--t-pk-style);
    text-shadow: 0 0 12px var(--t-glow2), var(--t-pk-shadow);
    transition: color 0.4s, text-shadow 0.4s;
}
.smp-blue {
    color: var(--t-a1);
    font-style: var(--t-pk-style);
    text-shadow: 0 0 12px var(--t-glow1), var(--t-smp-shadow);
    transition: color 0.4s, text-shadow 0.4s;
}
.header-launcher-word {
    font-size: 17px; font-weight: 600; color: var(--t-tx2);
    margin-left: 4px; letter-spacing: 0.3px;
    font-family: var(--t-font-body);
}

.header-search {
    width: 300px; height: 40px; border-radius: 12px;
    background: rgba(255,255,255,0.04); border: 1px solid var(--t-border);
    display: flex; align-items: center; gap: 10px; padding: 0 14px;
}
.header-search svg { width: 15px; height: 15px; stroke: var(--t-tx3); fill: none; stroke-width: 2; flex-shrink: 0; }
.header-search input { background: transparent; border: none; outline: none; color: var(--t-tx1); width: 100%; font-family: var(--t-font-body); font-size: 14px; }
.header-search input::placeholder { color: var(--t-tx3); }

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

.header-btn {
    display: flex; align-items: center; gap: 6px; height: 36px; border-radius: 10px;
    border: 1px solid var(--t-border); background: rgba(255,255,255,0.04);
    color: var(--t-tx1); padding: 0 14px; cursor: pointer;
    font-family: var(--t-font-body); font-weight: 700; font-size: 13px;
    transition: 0.2s; white-space: nowrap; text-decoration: none;
}
.header-btn:hover { background: rgba(255,255,255,0.08); border-color: var(--t-borderS); }
.header-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

.header-btn.install-btn {
    background: var(--t-glow1);
    border-color: var(--t-bdr1);
    color: var(--t-a1);
    transition: 0.2s;
}
.header-btn.install-btn:not(:disabled):hover {
    background: var(--t-glow1);
    box-shadow: 0 0 14px var(--t-glow1);
    filter: brightness(1.2);
}
.header-btn.install-btn:disabled {
    background: rgba(255,255,255,0.03);
    color: var(--t-tx3); border-color: var(--t-border);
    cursor: default;
}

.instance-status {
    height: 36px; border-radius: 10px;
    background: rgba(255,255,255,0.04); border: 1px solid var(--t-border);
    display: flex; align-items: center; gap: 8px; padding: 0 12px;
}
.instance-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--t-a1); box-shadow: 0 0 10px var(--t-a1);
    transition: background 0.4s, box-shadow 0.4s;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* =====================================================
   CONTENT AREA
   ===================================================== */
.content { flex: 1; overflow-y: auto; padding: 28px; }
.panel { display: none; }
.panel.active { display: block; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.section-title, .settings-title {
    font-size: 26px; font-family: var(--t-font-head); font-weight: 800; margin-bottom: 22px;
    color: var(--t-tx1);
}

/* =====================================================
   VERSION CARDS — NO DIMMING, RED STYLES FOR JS
   ===================================================== */
.client-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 24px; }

.client-card {
    position: relative; overflow: hidden; border-radius: 24px;
    border: 1px solid var(--t-border); background: var(--t-bg2);
    cursor: pointer; transition: 0.28s; min-height: 320px;
}
.client-card:hover { transform: translateY(-6px); box-shadow: 0 20px 60px rgba(0,0,0,0.5); }

/* WASM card (recommended) — cyan glow */
.client-card.recommended {
    box-shadow: 0 0 40px var(--t-glow1), inset 0 0 0 1px var(--t-bdr1);
}

/* JS card (not recommended) — red glow */
.client-card.notrecommended {
    box-shadow: 0 0 40px var(--t-glow2), inset 0 0 0 1px var(--t-bdr2);
}

.client-image-wrap { position: absolute; inset: 0; overflow: hidden; }
.client-image {
    width: 100%; height: 100%; object-fit: cover;
    /* No dimming: remove brightness filter */
    filter: none;
}
.image-tint { position: absolute; inset: 0; pointer-events: none; }

/* WASM tint — cyan */
.wasm-tint {
    background: var(--t-rec-tint);
    border: 1px solid var(--t-bdr1);
    box-sizing: border-box;
}

/* JS tint — red */
.js-outline {
    background: var(--t-norec-tint);
    border: 1px solid var(--t-bdr2);
    box-sizing: border-box;
}

.client-overlay {
    position: absolute; inset: 0;
    /* No dimming: remove dark gradient overlay */
    background: transparent;
    display: flex; flex-direction: column; justify-content: flex-end; padding: 26px;
}

/* Black text outline for readability on any image */
.client-overlay .client-name,
.client-overlay .client-sub,
.client-overlay .tech-chip,
.client-overlay .badge {
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    -webkit-text-stroke: 0.4px #000;
    text-stroke: 0.4px #000;
}

.client-top { position: absolute; top: 18px; left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: center; }

.tech-chip, .badge { padding: 5px 11px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.wasm { background: var(--t-glow1); color: var(--t-a1); }
.js   { background: var(--t-glow2); color: var(--t-a2); }
.badge-recommended    { background: var(--t-glow1); color: var(--t-a1); }
.badge-notrecommended { background: var(--t-glow2); color: var(--t-a2); }

.client-name { font-size: 28px; font-weight: 800; font-family: var(--t-font-head); margin-bottom: 6px; }
.client-sub  { color: rgba(255,255,255,0.85); margin-bottom: 18px; font-size: 14px; }

.launch-btn {
    width: fit-content; height: 40px; border-radius: 12px; border: none;
    padding: 0 20px; font-weight: 800; cursor: pointer; font-size: 14px;
    font-family: var(--t-font-body);
    background: var(--t-a1); color: #000;
    transition: 0.2s;
}
.launch-btn:hover { filter: brightness(1.15); transform: scale(1.03); }

/* =====================================================
   CLIENT CHANGES LIST
   ===================================================== */
.changes-list { display: flex; flex-direction: column; padding: 0 2px; }
.change-item-wrapper { display: block; }
.change-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 15px 6px; border-bottom: 1px solid var(--t-border);
    font-size: 15px; line-height: 1.5;
}
.change-item-wrapper:last-child .change-item { border-bottom: none; }
.change-bullet { color: var(--t-a1); font-size: 18px; line-height: 1.5; flex-shrink: 0; }
.change-text { font-weight: 500; color: var(--t-tx1); }
.change-text em { color: var(--t-tx2); font-style: normal; font-size: 13px; display: block; margin-top: 2px; }

/* =====================================================
   SETTINGS
   ===================================================== */
.settings-group {
    background: var(--t-bg2); border: 1px solid var(--t-border);
    border-radius: 20px; overflow: hidden; margin-bottom: 20px;
    transition: background 0.4s, border-color 0.4s;
}
.settings-group-label {
    padding: 15px 22px; border-bottom: 1px solid var(--t-border);
    color: var(--t-tx3); font-size: 11px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 1px;
}
.settings-row { padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; }
.settings-row + .settings-row { border-top: 1px solid var(--t-border); }
.settings-row-label { font-weight: 700; color: var(--t-tx1); }
.settings-row-sub { color: var(--t-tx2); margin-top: 3px; font-size: 13px; }

/* =====================================================
   THEME GRID
   ===================================================== */
.theme-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-btn {
    display: flex; flex-direction: column; align-items: center; gap: 7px;
    padding: 10px 12px; border-radius: 14px; cursor: pointer;
    border: 2px solid transparent; background: rgba(255,255,255,0.04);
    font-family: var(--t-font-body); font-weight: 700; font-size: 11px;
    color: var(--t-tx2); transition: 0.2s; min-width: 62px;
}
.theme-btn:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.2); color: var(--t-tx1); transform: translateY(-2px); }
.theme-btn.active { border-color: var(--t-a1); color: var(--t-tx1); background: var(--t-glow1); box-shadow: 0 0 14px var(--t-glow1); }
.theme-swatch { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }

/* =====================================================
   FAVICON OPTIONS
   ===================================================== */
.favicon-options { display: flex; gap: 10px; flex-wrap: wrap; }
.favicon-btn {
    width: 50px; height: 50px; border-radius: 12px;
    border: 2px solid transparent; background: rgba(255,255,255,0.04);
    overflow: hidden; cursor: pointer; transition: 0.2s; padding: 0;
}
.favicon-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.favicon-btn:hover { border-color: rgba(255,255,255,0.3); transform: scale(1.06); }
.favicon-btn.active { border-color: var(--t-a1); box-shadow: 0 0 16px var(--t-glow1); }

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.72);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: 0.2s; z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
    width: 400px; background: var(--t-bg1);
    border-radius: 24px; border: 1px solid var(--t-borderS);
    padding: 28px; position: relative;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px var(--t-bdr1);
    transition: background 0.4s;
}
.modal-title { font-size: 22px; font-weight: 800; margin-bottom: 20px; font-family: var(--t-font-head); color: var(--t-tx1); }

.modal-close {
    position: absolute; top: 18px; right: 18px;
    width: 32px; height: 32px; border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06);
    color: var(--t-tx2); cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: center; transition: 0.2s; float: none;
}
.modal-close:hover { background: rgba(255,85,85,0.3); border-color: rgba(255,85,85,0.5); color: #fff; }

.head-preview-area { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.head-preview-img { width: 64px; height: 64px; border-radius: 14px; image-rendering: pixelated; border: 2px solid var(--t-bdr1); }
#headPreviewName { font-weight: 700; font-size: 16px; color: var(--t-tx1); }

.form-label { display: block; margin-bottom: 8px; font-size: 13px; color: var(--t-tx2); font-weight: 600; }
.form-input {
    width: 100%; height: 44px; border-radius: 12px;
    border: 1px solid var(--t-border); background: rgba(255,255,255,0.04);
    color: var(--t-tx1); padding: 0 14px; margin-bottom: 20px;
    font-family: var(--t-font-body); font-size: 14px; outline: none; transition: 0.2s;
}
.form-input:focus { border-color: var(--t-bdr1); box-shadow: 0 0 0 3px var(--t-glow1); }
.form-actions { display: flex; gap: 12px; }

/* =====================================================
   SAVE / CANCEL
   ===================================================== */
.btn-save {
    height: 40px; border-radius: 10px;
    border: 1px solid var(--t-bdr1); background: var(--t-glow1);
    color: var(--t-a1); padding: 0 20px; cursor: pointer;
    font-family: var(--t-font-body); font-weight: 800; font-size: 14px;
    display: flex; align-items: center; gap: 7px; transition: 0.2s;
}
.btn-save:hover { filter: brightness(1.25); transform: translateY(-1px); box-shadow: 0 6px 20px var(--t-glow1); }
.btn-save:active { transform: translateY(0); }
.btn-save svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.5; }

.btn-cancel {
    height: 40px; border-radius: 10px;
    border: 1px solid rgba(255,85,85,0.35); background: rgba(255,85,85,0.08);
    color: #ff5555; padding: 0 20px; cursor: pointer;
    font-family: var(--t-font-body); font-weight: 800; font-size: 14px;
    display: flex; align-items: center; gap: 7px; transition: 0.2s;
}
.btn-cancel:hover { background: rgba(255,85,85,0.2); border-color: #ff5555; box-shadow: 0 6px 20px rgba(255,85,85,0.2); transform: translateY(-1px); }
.btn-cancel:active { transform: translateY(0); }
.btn-cancel svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.5; }

.btn-secondary {
    height: 38px; border-radius: 10px; border: 1px solid var(--t-border);
    background: rgba(255,255,255,0.06); color: var(--t-tx1); padding: 0 16px;
    cursor: pointer; font-family: var(--t-font-body); font-weight: 700; font-size: 13px; transition: 0.2s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: var(--t-borderS); }

/* =====================================================
   FULLSCREEN OVERLAY
   ===================================================== */
.fullscreen-overlay {
    position: fixed; inset: 0; z-index: 999999;
    background: #000; display: none; flex-direction: column;
}
.fullscreen-overlay iframe { flex: 1; width: 100%; height: 100%; border: none; }

.fullscreen-bar {
    position: absolute; top: 0; left: 0; right: 0; height: 46px;
    background: var(--t-header); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--t-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; z-index: 10;
    transform: translateY(-100%);
    transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
    pointer-events: none;
}
.fullscreen-bar.visible { transform: translateY(0); pointer-events: auto; }
.fullscreen-bar-left { display: flex; align-items: center; gap: 10px; }
.fullscreen-url-chip {
    background: var(--t-glow1); border: 1px solid var(--t-bdr1);
    border-radius: 8px; padding: 4px 12px;
    font-family: var(--t-font-body); font-size: 13px; font-weight: 700;
    color: var(--t-a1); letter-spacing: 0.2px;
}
.fullscreen-close {
    width: 30px; height: 30px; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.07);
    color: #fff; cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: center; transition: 0.2s;
}
.fullscreen-close:hover { background: rgba(255,85,85,0.4); border-color: #ff5555; }
.fullscreen-hover-zone { position: absolute; top: 0; left: 0; right: 0; height: 8px; z-index: 11; }

/* =====================================================
   NO RESULTS
   ===================================================== */
.no-results { text-align: center; padding: 40px; color: var(--t-tx3); font-size: 16px; grid-column: 1 / -1; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 950px) {
    .client-grid { grid-template-columns: 1fr; }
    .header-search { display: none; }
}