/* ═══════════════════════════════════════════════
   ExileKit — interactive app replica on the landing page
   A 720×560 desktop window scaled to fit; below 720px it reflows.
   ═══════════════════════════════════════════════ */

:root {
    --pe-gold: #C8AD7F;
    --pe-bg: #1B1B1F;
    --pe-chrome: #232327;
    --pe-card: #232327;
    --pe-raised: #2F2F35;
    --pe-raised-hover: #3A3A41;
    --pe-well: #17171A;
    --pe-border: #2E2E33;
    --pe-border-card: #2A2A2F;
    --pe-text: #D8D8DE;
    --pe-text-strong: #ECECF1;
    --pe-text-dim: #9A9AA2;
    --pe-text-fainter: #6C6C74;
    --pe-row-applied: #2A2619;
    --pe-border-applied: #5C4D2C;
}

.pe-demo-stage { display: flex; justify-content: center; margin-top: 1.25rem; }
.pe-demo-scaler { transform: scale(var(--pe-scale, 1)); transform-origin: top center; }

.pe-window {
    width: 720px; height: 560px; display: flex; flex-direction: column; position: relative; overflow: hidden;
    background: var(--pe-bg); border: 1px solid #33333A; border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    font-family: var(--font); color: var(--pe-text); font-size: 12px; text-align: left; user-select: none;
}
.pe-window button { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.pe-window img { display: block; }

/* ─── Title bar ─── */
.pe-titlebar { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 12px; background: var(--pe-chrome); border-bottom: 1px solid var(--pe-border); flex: 0 0 auto; }
.pe-brand { position: relative; display: flex; align-items: center; gap: 7px; }
.pe-brand-icon { width: 20px; height: 20px; object-fit: contain; }
.pe-brand-name { font-size: 15px; font-weight: 700; color: var(--pe-text); }
.pe-brand-version { font-size: 10px; color: #5A5A62; margin-top: 2px; }
.pe-gamepick { display: flex; align-items: center; gap: 4px; margin-left: 6px; padding: 3px 6px; border: 1px solid #3A3A42; border-radius: 5px; background: #2A2A2E; }
.pe-gamepick:hover { background: #33333A; border-color: #4C4C56; }
.pe-gamepick.is-open { background: #33333A; border-color: var(--pe-gold); }
.pe-gamepick-icon { width: 18px; height: 18px; object-fit: contain; }
.pe-gamepick-label { font-size: 11px; font-weight: 600; color: var(--pe-text); }
.pe-gamepick-chevron { font-size: 10px; color: #9A9AA2; line-height: 1; }
.pe-gamemenu { position: absolute; top: 34px; left: 0; z-index: 5; min-width: 200px; padding: 4px; background: #26262B; border: 1px solid #3A3A42; border-radius: 7px; box-shadow: 0 12px 30px rgba(0,0,0,0.5); }
.pe-gamemenu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; border-radius: 5px; font-size: 12px; text-align: left; }
.pe-gamemenu button:hover { background: #33333A; }
.pe-gamemenu button.is-active { color: var(--pe-gold); }
.pe-gamemenu img { width: 18px; height: 18px; object-fit: contain; }
.pe-gamemenu small { margin-left: auto; color: var(--pe-text-fainter); font-size: 10px; }
.pe-titlebar-gap { flex: 1 1 0; min-width: 0; }
.pe-tabs { display: flex; padding: 2px; background: #2A2A2E; border: 1px solid #35353C; border-radius: 6px; }
.pe-tab { padding: 5px 16px; border-radius: 4px; font-size: 12px; font-weight: 600; color: var(--pe-text-dim); }
.pe-tab:hover { background: #37373E; color: #D2D2D8; }
.pe-tab.is-active { background: var(--pe-gold); color: #20201C; }
.pe-titlebar-actions { display: flex; align-items: center; gap: 4px; }
.pe-chrome-btn { padding: 5px 10px; border-radius: 4px; font-size: 11px; font-weight: 600; color: var(--pe-text-dim); background: var(--pe-raised); }
.pe-chrome-btn:hover { background: var(--pe-raised-hover); color: var(--pe-text); }
.pe-chrome-btn.is-warn { color: var(--pe-gold); }
.pe-winbtns { display: flex; margin-left: 6px; }
.pe-winbtn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 4px; font-size: 13px; color: var(--pe-text-dim); }
.pe-winbtn:hover { background: #3A3A41; color: #fff; }
.pe-winbtn.is-close:hover { background: #C4373C; }

/* ─── Content ─── */
.pe-content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pe-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 20px 14px; }
.pe-scroll::-webkit-scrollbar { width: 8px; }
.pe-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }
.pe-preview-note { margin: 10px 20px 0; padding: 7px 11px; background: #2E2719; border: 1px solid #59492E; border-radius: 6px; font-size: 11px; color: var(--pe-gold); }
.pe-empty { padding: 40px 0; text-align: center; color: var(--pe-text-fainter); font-size: 12px; }
.pe-more { margin: 10px 0 4px; padding: 12px; border: 1px dashed #3A3A42; border-radius: 8px; text-align: center; color: var(--pe-text-fainter); font-size: 11px; }

/* status bar & toast */
.pe-statusbar { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; height: 26px; padding: 0 12px; background: var(--pe-chrome); border-top: 1px solid var(--pe-border); font-size: 10px; color: var(--pe-text-fainter); }
.pe-statusbar b { color: var(--pe-text-dim); font-weight: 500; }
.pe-statusbar .pe-status-right { margin-left: auto; color: var(--pe-gold); }
.pe-toast { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 6; padding: 8px 14px; background: #2B2B31; border: 1px solid #45454D; border-radius: 6px; color: var(--pe-text-strong); font-size: 11px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); animation: pe-toast-in .2s ease; white-space: nowrap; }
@keyframes pe-toast-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.pe-lightbox { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; background: rgba(0,0,0,0.75); cursor: pointer; }
.pe-lightbox img { width: 200px; height: 200px; object-fit: contain; }
.pe-lightbox-hint { position: absolute; bottom: 30px; font-size: 11px; color: var(--pe-text-dim); }

/* ─── General tab ─── */
.pe-general { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 20px 0; }
.pe-card { background: var(--pe-card); border: 1px solid var(--pe-border-card); border-radius: 8px; padding: 12px 14px; }
.pe-card-title { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--pe-text-fainter); margin-bottom: 8px; }
.pe-sub { display: flex; align-items: center; gap: 10px; }
.pe-sub img { width: 34px; height: 34px; object-fit: contain; }
.pe-sub b { display: block; font-size: 13px; color: var(--pe-text-strong); }
.pe-sub span { font-size: 11px; color: var(--pe-gold); }
.pe-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pe-btn-raised, .pe-btn-outlined { height: 24px; padding: 0 10px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.pe-btn-raised { background: var(--pe-raised); color: var(--pe-text-strong); }
.pe-btn-raised:hover { background: var(--pe-raised-hover); }
.pe-btn-outlined { border: 1px solid #45454D; color: var(--pe-text-dim); }
.pe-btn-outlined:hover { background: rgba(255,255,255,0.08); }
.pe-sect { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--pe-text-fainter); margin: 8px 0 4px; }
.pe-sect:first-child { margin-top: 0; }
.pe-pill-list { display: flex; flex-wrap: wrap; gap: 4px; }
.pe-pill { padding: 2px 8px; border-radius: 10px; background: #2E2719; border: 1px solid #59492E; font-size: 10px; color: var(--pe-gold); }
.pe-hint { font-size: 11px; color: var(--pe-text-fainter); line-height: 1.4; }
.pe-apply-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.pe-btn-apply { height: 32px; min-width: 88px; padding: 0 22px; border-radius: 4px; background: var(--pe-gold); font-size: 13px; font-weight: 700; color: #20201C; }
.pe-btn-apply:hover { background: #D4BD93; }
.pe-btn-apply.is-secondary { background: var(--pe-raised); color: var(--pe-text-strong); }
.pe-btn-apply.is-secondary:hover { background: var(--pe-raised-hover); }
.pe-disclose { margin: 12px 20px 0; border: 1px solid var(--pe-border-card); border-radius: 8px; background: var(--pe-card); }
.pe-disclose-head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 9px 12px; text-align: left; }
.pe-disclose-title { font-size: 12px; font-weight: 600; color: var(--pe-text-strong); }
.pe-disclose-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.pe-link { color: var(--pe-gold); font-size: 11px; text-decoration: underline; text-align: left; }
.pe-textarea { width: 100%; min-height: 54px; resize: none; padding: 7px 9px; border-radius: 5px; border: 1px solid #3A3A42; background: var(--pe-well); color: var(--pe-text); font: inherit; font-size: 11px; }

/* ─── MTX tab ─── */
.pe-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 20px 0; }
.pe-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px; background: #2A2A2E; font-size: 11px; font-weight: 600; color: var(--pe-text-dim); }
.pe-chip:hover { background: #37373E; color: #D2D2D8; }
.pe-chip.is-active { background: var(--pe-gold); color: #20201C; }
.pe-chip-fav { background: #332C1E; color: #C2A97C; }
.pe-chip-fav:hover { background: #403727; color: #DCCBA2; }
.pe-chip-fav.is-active { background: var(--pe-gold); color: #20201C; }
.pe-chip-count { padding: 1px 6px; border-radius: 8px; background: #4A4029; font-size: 9px; font-weight: 500; color: var(--pe-gold); }
.pe-chip.is-active .pe-chip-count { background: #20201C; }
.pe-chip-sep { display: inline-block; width: 1px; height: 15px; margin: 0 6px 0 3px; background: #33333A; }
.pe-search-row { display: flex; align-items: center; gap: 8px; padding: 10px 20px 8px; }
.pe-search { flex: 1 1 auto; height: 28px; padding: 0 10px; border-radius: 5px; border: 1px solid #3A3A42; background: var(--pe-well); color: var(--pe-text); font: inherit; font-size: 11px; }
.pe-search:focus { outline: none; border-color: var(--pe-gold); }
.pe-btn-favourites { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 8px 20px 0; height: 34px; border-radius: 4px; background: var(--pe-gold); font-size: 12px; font-weight: 700; color: #1E1E22; }
.pe-btn-favourites:hover { background: #D4BD93; }
.pe-group { margin-top: 8px; background: var(--pe-card); border: 1px solid var(--pe-border-card); border-radius: 8px; overflow: hidden; }
.pe-group.is-flat { background: transparent; border-color: transparent; margin-top: 0; }
.pe-group-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px 8px 10px; text-align: left; }
.pe-group-head:hover { background: rgba(255, 255, 255, 0.03); }
.pe-group-thumb { flex: 0 0 auto; width: 46px; height: 46px; display: grid; place-items: center; background: #1A1A1D; border-radius: 6px; overflow: hidden; }
.pe-group-thumb img { width: 42px; height: 42px; object-fit: contain; }
.pe-group-title { flex: 1 1 auto; min-width: 0; }
.pe-group-name { font-size: 14px; font-weight: 600; color: var(--pe-text-strong); }
.pe-group-count { margin-top: 2px; font-size: 11px; color: var(--pe-text-fainter); }
.pe-group-arrow { font-size: 11px; color: var(--pe-text-fainter); }
.pe-group-body { padding: 0 8px 8px; }
.pe-group.is-flat > .pe-group-body { padding: 0; }
.pe-item { display: flex; align-items: center; gap: 12px; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--pe-border-card); border-radius: 7px; background: #1F1F23; }
.pe-item.is-applied { background: var(--pe-row-applied); border-color: var(--pe-border-applied); }
.pe-item.is-blocked { opacity: 0.4; }
.pe-item-image { flex: 0 0 auto; width: 78px; height: 78px; display: grid; place-items: center; padding: 5px; background: var(--pe-well); border: 1px solid #2A2A2F; border-radius: 6px; cursor: zoom-in; }
.pe-item-image img { width: 68px; height: 68px; object-fit: contain; }
.pe-item-image .pe-noicon { font-size: 22px; color: var(--pe-text-fainter); }
.pe-item-main { flex: 1 1 auto; min-width: 0; }
.pe-item-titlerow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pe-item-name { font-size: 14px; font-weight: 600; color: var(--pe-gold); }
.pe-badge { padding: 1px 5px; background: #332C1C; border: 1px solid #59492E; border-radius: 4px; font-size: 9px; font-weight: 600; color: var(--pe-gold); text-transform: uppercase; }
.pe-item-desc { margin-top: 4px; font-size: 11px; color: #76767E; }
.pe-item-active { margin-top: 2px; font-size: 10px; color: var(--pe-gold); }
.pe-item-actions { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.pe-star { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 4px; border: 1px solid #45454D; font-size: 12px; color: var(--pe-text-dim); }
.pe-star.is-on { color: var(--pe-gold); border-color: #59492E; background: #2E2719; }

/* ─── Optimizer tab ─── */
.pe-opt-top { display: flex; align-items: center; gap: 10px; padding: 12px 20px 0; }
.pe-seg { display: flex; padding: 2px; background: #2A2A2E; border: 1px solid #35353C; border-radius: 6px; }
.pe-seg button { padding: 4px 12px; border-radius: 4px; font-size: 11px; font-weight: 600; color: var(--pe-text-dim); }
.pe-seg button.is-active { background: var(--pe-gold); color: #20201C; }
.pe-badge-ed { padding: 1px 5px; background: #332C1C; border: 1px solid #59492E; border-radius: 4px; font-size: 9px; font-weight: 600; color: var(--pe-gold); }
.pe-opt-banner { margin: 10px 20px 0; padding: 8px 11px; background: #2E2719; border: 1px solid #59492E; border-radius: 6px; font-size: 11px; color: var(--pe-gold); }
.pe-opt-wrap { padding: 12px 20px 14px; }
.pe-opt-list { background: #232327; border: 1px solid var(--pe-border-card); border-radius: 8px; overflow: hidden; }
.pe-opt-row { border-bottom: 1px solid #2E2E33; }
.pe-opt-row:last-child { border-bottom: 0; }
.pe-opt-hit { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 11px 16px 12px 14px; text-align: left; }
.pe-opt-hit:hover { background: rgba(255, 255, 255, 0.04); }
.pe-opt-copy { min-width: 0; }
.pe-opt-name { font-size: 13px; color: #CFCFD5; display: flex; align-items: center; gap: 6px; }
.pe-opt-row.is-on .pe-opt-name { color: #E8E8EE; font-weight: 500; }
.pe-opt-desc { margin-top: 3px; font-size: 11px; color: #76767E; }
.pe-switch { flex: 0 0 auto; width: 34px; height: 18px; border-radius: 9px; background: #3A3A42; position: relative; transition: background .15s; }
.pe-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #B9B9C2; transition: transform .15s; }
.pe-opt-row.is-on .pe-switch { background: var(--pe-gold); }
.pe-opt-row.is-on .pe-switch::after { transform: translateX(16px); background: #20201C; }
.pe-zoom { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid #2E2E33; font-size: 11px; color: var(--pe-text-dim); }
.pe-zoom input[type=range] { flex: 1 1 auto; accent-color: var(--pe-gold); }
.pe-zoom b { color: var(--pe-gold); min-width: 30px; text-align: right; }

/* ─── Narrow screens: reflow instead of scaling ─── */
@media (max-width: 720px) {
    .pe-demo-scaler { width: 100%; transform: none !important; }
    .pe-window { width: 100%; height: auto; min-height: 520px; }
    .pe-scroll { max-height: 480px; }
    .pe-titlebar { flex-wrap: wrap; height: auto; padding: 8px 10px; row-gap: 6px; }
    .pe-titlebar-actions, .pe-winbtns, .pe-brand-version { display: none; }
    .pe-titlebar-gap { display: none; }
    .pe-tabs { width: 100%; }
    .pe-tab { flex: 1 1 0; text-align: center; padding: 6px 4px; }
    .pe-general { grid-template-columns: 1fr; padding: 12px 12px 0; }
    .pe-chips { padding: 10px 12px 0; }
    .pe-search-row { padding: 10px 12px 8px; }
    .pe-scroll { padding: 0 12px 12px; }
    .pe-preview-note, .pe-btn-favourites, .pe-disclose, .pe-opt-banner { margin-left: 12px; margin-right: 12px; }
    .pe-opt-wrap { padding: 12px 12px 14px; }
    .pe-opt-top { padding: 12px 12px 0; flex-wrap: wrap; }
    .pe-item-image { width: 62px; height: 62px; }
    .pe-item-image img { width: 52px; height: 52px; }
    .pe-item-name { font-size: 13px; }
    .pe-group-thumb { width: 40px; height: 40px; }
    .pe-group-thumb img { width: 36px; height: 36px; }
    .pe-toast { white-space: normal; max-width: 90%; text-align: center; }
}
