:root {
  --bg: #0c0e14;
  --bg2: #12151e;
  --card: #161a25;
  --card2: #1c2130;
  --line: #262c3d;
  --text: #e7eaf2;
  --muted: #8d95ab;
  --accent: #7cf0c8;
  --accent2: #6aa8ff;
  --warn: #ffc65c;
  --bad: #ff6b7a;
  --ok: #5fe08f;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #1a2340 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
button, select, input { font: inherit; color: inherit; }

/* header */
.top { display: flex; align-items: baseline; gap: 24px; flex-wrap: wrap; padding: 22px 32px 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 600; letter-spacing: .3px; }
.brand b { color: var(--accent); }
.logo { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; align-self: center; }
.tagline { margin: 0; color: var(--muted); }

/* layout */
.layout { display: grid; grid-template-columns: 380px 1fr; gap: 24px; padding: 12px 32px 32px; align-items: start; }
.config { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; padding-right: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #062018; font-size: 12px; font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; flex: 1; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.field-row { display: flex; gap: 10px; align-items: flex-end; }
select {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
  appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px;
}
select:focus, button:focus-visible { outline: 2px solid var(--accent2); outline-offset: 1px; }
optgroup { background: var(--bg2); color: var(--muted); }
option { color: var(--text); }
.check { display: flex; align-items: center; gap: 8px; padding: 9px 0; margin-bottom: 10px; flex: 1; cursor: pointer; }
.check input { accent-color: var(--accent); width: 18px; height: 18px; }

.games { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.game, .chip, .preset {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; text-align: left; transition: border-color .15s, background .15s;
}
.game { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.game-name { font-weight: 600; font-size: 14px; }
.game-tag { font-size: 11px; color: var(--muted); }
.game:hover, .chip:hover, .preset:hover { border-color: #3a4560; }
.game[aria-pressed="true"], .chip[aria-pressed="true"], .preset[aria-pressed="true"] { border-color: var(--accent); background: #13241f; }

.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.chip { padding: 8px; text-align: center; display: flex; flex-direction: column; }
.chip small { color: var(--muted); font-size: 11px; }

.presets { display: flex; flex-direction: column; gap: 8px; }
.preset { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border-left-width: 4px; }
.preset small { color: var(--muted); font-size: 12px; }
.preset-quality { border-left-color: #b28cff; }
.preset-balanced { border-left-color: var(--accent2); }
.preset-fluid { border-left-color: var(--accent); }

/* results */
.results { min-width: 0; }
.res-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.res-head h2 { margin: 0; font-size: 26px; }
.res-sub { margin: 2px 0 0; color: var(--muted); }
.menu-note { margin: 6px 0 0; font-size: 13px; color: #b9c1d6; }
.res-actions { display: flex; gap: 8px; }
.btn { background: var(--accent); color: #062018; border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 600; cursor: pointer; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn:hover { filter: brightness(1.08); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat.is-main .stat-value { color: var(--accent); font-size: 28px; }
.stat.is-ok .stat-sub { color: var(--ok); }
.stat.is-bad .stat-sub { color: var(--bad); }
.stat.is-warn .stat-value { color: var(--warn); }
.bar { display: block; height: 6px; background: var(--bg2); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent2); border-radius: 3px; }
.bar-fill.warn { background: var(--warn); }

.warnings { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 6px; }
.warnings li { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); border-left: 4px solid var(--accent2); font-size: 14px; }
.warnings .w-warn { border-left-color: var(--warn); }
.warnings .w-bad { border-left-color: var(--bad); }

.group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.group h3 { margin: 0; padding: 12px 16px; font-size: 14px; text-transform: uppercase; letter-spacing: .6px; color: var(--accent2); background: var(--card2); border-bottom: 1px solid var(--line); }
.settings { width: 100%; border-collapse: collapse; }
.settings th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.settings td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.settings tr:last-child td { border-bottom: 0; }
.settings tbody tr:hover { background: #1a1f2c; }
.c-name { width: 34%; }
.c-val { width: 20%; white-space: nowrap; }
.c-why { color: #b9c1d6; font-size: 13.5px; }
.set-name { display: block; font-weight: 600; }
.set-tip { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.impact { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 99px; margin-top: 5px; border: 1px solid; }
.impact-low { color: var(--ok); border-color: #2a5a3e; }
.impact-mid { color: var(--warn); border-color: #5e4c26; }
.impact-high { color: var(--bad); border-color: #643039; }

.val { display: inline-block; padding: 4px 10px; border-radius: 7px; font-weight: 700; font-size: 14px; background: var(--bg2); border: 1px solid var(--line); white-space: normal; }
.lvl-max { color: #062018; background: var(--accent); border-color: var(--accent); }
.lvl-high { color: var(--accent); border-color: #2d6b58; }
.lvl-low { color: var(--warn); border-color: #5e4c26; }
.lvl-min { color: #ffa0aa; border-color: #643039; }
.lvl-fixed { color: var(--text); border-color: #4a5372; }
.lvl-on { color: #fff; background: #2a4f8f; border-color: var(--accent2); }
.lvl-info { color: var(--text); }

.disclaimer { color: var(--muted); font-size: 12.5px; margin: 16px 2px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 24px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--accent); color: #062018; font-weight: 600; padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 10px 14px 24px; }
  .top { padding: 16px 14px 6px; }
  .config { position: static; max-height: none; overflow: visible; }
  .settings thead { display: none; }
  .settings tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .settings td { border: 0; padding: 0; }
  .c-name, .c-val { width: auto; }
  .c-val { text-align: right; padding-left: 10px; }
  .c-why { grid-column: 1 / -1; margin-top: 6px; }
}
