:root {
    --bg: #0f1119;
    --card: #151826;
    --card-hover: #1a1e2f;
    --line: #242739;
    --line-soft: #1d2030;
    --white: #f3f4fa;
    --text: #d7d9e6;
    --muted: #868aa3;
    --accent: #8b8ff8;
    --accent-strong: #6d71f0;
    --accent-soft: rgba(139, 143, 248, 0.16);
    --good: #4ade80;
    --ok: #fbbf24;
    --bad: #f87171;
    --hot: #fb923c;
    --hot-soft: rgba(251, 146, 60, 0.15);
    --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: "Manrope", "Segoe UI", sans-serif; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { position: fixed; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; background: rgba(5, 6, 10, 0.4); }

.panel {
    width: min(95vw, 980px);
    padding: 24px;
    color: var(--text);
    border-radius: 24px;
    background:
        radial-gradient(700px 300px at 0% 0%, rgba(139, 143, 248, 0.14), transparent 65%),
        var(--bg);
    border: 1px solid var(--line);
    box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.9);
    animation: pop 0.25s cubic-bezier(0.2, 0.9, 0.25, 1.05);
}
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }

/* header */
header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
    width: 50px; height: 50px; border-radius: 15px; flex: none;
    display: grid; place-items: center; color: #fff;
    background: linear-gradient(145deg, var(--accent), var(--accent-strong));
    box-shadow: 0 12px 26px -10px rgba(109, 113, 240, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.logo svg { width: 28px; height: 28px; }
h1 { font-size: 23px; font-weight: 800; color: var(--white); }
header p { margin-top: 2px; font-size: 13px; color: var(--muted); }

.live {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 14px; border-radius: 16px;
    background: var(--card); border: 1px solid var(--line-soft);
}
.live-fps { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.live-label { font-size: 10.5px; font-weight: 800; letter-spacing: 0.12em; color: var(--muted); }
.live-fps b { font: 700 30px var(--mono); line-height: 1.05; font-variant-numeric: tabular-nums; }
.good { color: var(--good); } .ok { color: var(--ok); } .bad { color: var(--bad); }
.live-graph { display: flex; flex-direction: column; gap: 3px; }
.live-graph svg { width: 170px; height: 46px; }
.graph-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.graph-area { fill: rgba(139, 143, 248, 0.14); }
.live-sub { font-size: 11px; color: var(--muted); }
.live-sub b { font-family: var(--mono); color: var(--text); }

/* mode cards */
.modes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.mode {
    position: relative;
    display: flex; flex-direction: column; gap: 10px;
    padding: 16px 14px 14px; text-align: left;
    border-radius: 18px;
    background: var(--card); border: 1px solid var(--line-soft);
    transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.mode:hover { background: var(--card-hover); border-color: var(--line); transform: translateY(-2px); }
.mode.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 16px 34px -18px rgba(139, 143, 248, 0.9); }

.mode-top { display: flex; align-items: center; justify-content: space-between; }
.mode-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center;
    color: var(--accent); background: var(--accent-soft);
}
.mode-icon svg { width: 22px; height: 22px; }
.mode.active .mode-icon { color: #fff; background: linear-gradient(145deg, var(--accent), var(--accent-strong)); }
.tag { padding: 3px 8px; border-radius: 8px; font-size: 9.5px; font-weight: 800; letter-spacing: 0.1em; }
.tag.active-tag { color: var(--good); background: rgba(74, 222, 128, 0.13); }
.tag.max-tag { color: var(--hot); background: var(--hot-soft); }

.mode h3 { font-size: 15.5px; font-weight: 800; color: var(--white); }
.mode p { font-size: 12px; line-height: 1.45; color: var(--muted); min-height: 52px; }

.meters { display: grid; gap: 7px; }
.meter { display: grid; gap: 3px; }
.meter-row { display: flex; justify-content: space-between; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.meter-row b { font-family: var(--mono); color: var(--text); }
.bar { height: 5px; border-radius: 3px; background: #22253a; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; transition: width 0.3s; }
.bar.q i { background: #60a5fa; }
.bar.p i { background: var(--good); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { padding: 2px 7px; border-radius: 7px; font-size: 10.5px; font-weight: 700; color: var(--text); background: #1f2233; }
.chip.off { color: var(--muted); text-decoration: line-through; background: transparent; border: 1px solid var(--line); }

/* the extreme mode gets the warm accent */
.mode.potato .mode-icon { color: var(--hot); background: var(--hot-soft); }
.mode.potato.active { border-color: var(--hot); box-shadow: 0 0 0 1px var(--hot), 0 16px 34px -18px rgba(251, 146, 60, 0.9); }
.mode.potato.active .mode-icon { color: #fff; background: linear-gradient(145deg, #fdba74, #f97316); }

footer { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.current { font-size: 13px; color: var(--muted); }
.current b { margin-left: 4px; color: var(--white); }
.close-btn { height: 40px; padding: 0 20px; border-radius: 12px; font-size: 13.5px; font-weight: 700; color: var(--white); background: #22253a; transition: background 0.15s; }
.close-btn:hover { background: #2b2f48; }

/* footer controls: FPS counter toggle + corner picker */
.footer-left { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.counter-ctrl { display: flex; align-items: center; gap: 8px; padding-left: 18px; border-left: 1px solid var(--line); }

.switch { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; color: var(--text); }
.switch-track { position: relative; width: 38px; height: 22px; border-radius: 11px; background: #2a2d42; transition: background 0.18s; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.18s; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4); }
.switch[aria-checked="true"] .switch-track { background: var(--accent); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(16px); }

.select { position: relative; }
.select-btn {
    height: 34px; padding: 0 10px; border-radius: 10px;
    display: flex; align-items: center; gap: 8px;
    font-size: 12.5px; font-weight: 700; color: var(--white);
    background: #1c1f30; border: 1px solid var(--line);
    transition: border-color 0.15s, opacity 0.15s;
}
.select-btn:hover { border-color: var(--accent); }
.select-btn svg { width: 15px; height: 15px; color: var(--muted); }
.select.disabled .select-btn { opacity: 0.4; pointer-events: none; }
.select-menu {
    position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 3;
    min-width: 190px; padding: 5px; border-radius: 12px;
    background: #1a1d2c; border: 1px solid var(--line);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.8);
}
.select-opt {
    width: 100%; display: flex; align-items: center; gap: 9px;
    padding: 8px 9px; border-radius: 8px; text-align: left;
    font-size: 12.5px; font-weight: 700; color: var(--text);
}
.select-opt:hover { background: rgba(255, 255, 255, 0.05); }
.select-opt.selected { color: var(--white); background: var(--accent-soft); }

/* little screen icon with the chosen corner lit */
.corner-ico { position: relative; width: 18px; height: 13px; border-radius: 3px; border: 1.5px solid var(--muted); flex: none; }
.corner-ico::after { content: ""; position: absolute; width: 5px; height: 4px; border-radius: 1px; background: var(--accent); }
.corner-ico.top-left::after { top: 1px; left: 1px; }
.corner-ico.top-right::after { top: 1px; right: 1px; }
.corner-ico.bottom-left::after { bottom: 1px; left: 1px; }
.corner-ico.bottom-right::after { bottom: 1px; right: 1px; }

/* on-screen counter */
.counter {
    position: fixed; z-index: 10;
    display: flex; align-items: baseline; gap: 5px;
    padding: 5px 10px; border-radius: 9px;
    background: rgba(12, 13, 20, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.06);
    pointer-events: none;
}
.counter b { font: 700 16px var(--mono); font-variant-numeric: tabular-nums; }
.counter span { font-size: 10px; font-weight: 800; letter-spacing: 0.1em; color: var(--muted); }
.counter i { font: 600 10.5px var(--mono); font-style: normal; color: var(--muted); }
.counter i:not(:empty)::before { content: "· "; }
.counter.top-left { top: 14px; left: 14px; }
.counter.top-right { top: 14px; right: 14px; }
.counter.bottom-left { bottom: 14px; left: 14px; }
.counter.bottom-right { bottom: 14px; right: 14px; }

@media (max-width: 900px) { .modes { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } .mode, .bar i { transition: none; } }
