:root {
  --bg: #0e0f14;
  --panel: #15171e;
  --panel-2: #1b1e27;
  --panel-3: #232734;
  --line: #262a37;
  --line-2: #323748;
  --text: #e9eaf0;
  --muted: #8d91a5;
  --dim: #5f6378;
  --accent: #7c5cff;
  --accent-2: #a58bff;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --pink: #ff4d8a;
  --rec: #ff3b30;
  --ok: #30d158;
  --warn: #ffb020;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  overflow: hidden;
}

button { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #3d4357; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #8c70ff; }
.btn.danger { background: var(--rec); border-color: var(--rec); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-3); }
.btn.icon { width: 34px; padding: 0; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

kbd {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font: 600 11px/18px "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.2px;
}

/* switch */
.switch { position: relative; width: 40px; height: 22px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 22px; background: var(--panel-3);
  border: 1px solid var(--line-2); transition: background 0.18s, border-color 0.18s;
  pointer-events: none;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #c4c7d4; transition: transform 0.18s, background 0.18s;
}
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* segmented */
.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
}
.seg button {
  border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 7px;
  color: var(--muted); cursor: pointer; font-weight: 500;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset; }

select, input[type="text"] {
  height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text);
  font: inherit; outline: none; min-width: 0;
}
select:focus, input[type="text"]:focus { border-color: var(--accent); }
select option { background: var(--panel-2); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2e3c; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #363b4d; }
::-webkit-scrollbar-track { background: transparent; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: #22252f; border: 1px solid var(--line-2); color: var(--text);
  padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow);
  opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; z-index: 1000;
  display: flex; align-items: center; gap: 10px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
