:root {
  --bg: #05070d;
  --panel: #0a0f1b;
  --panel2: #0e1524;
  --line: rgba(120, 140, 190, 0.18);
  --text: #e8eeff;
  --dim: #8f9bb8;
  --up: #ff3d5f;
  --dn: #3b8cff;
  --ac: #ffe066;
  --ok: #43e39a;
  --mono: 'JetBrains Mono', 'Noto Sans KR', ui-monospace, Consolas, monospace;
  --sans: 'Noto Sans KR', system-ui, 'Malgun Gothic', sans-serif;
}
:root[data-colors="us"] { --up: #1fd68f; --dn: #ff4d5e; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd {
  font-family: var(--mono); font-size: 0.72em; padding: 1px 5px; margin: 0 2px; border-radius: 4px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: var(--dim);
}
.c-up, .l-up { color: var(--up); }
.c-dn, .l-dn { color: var(--dn); }
.c-ac { color: var(--ac); }
.hint { color: var(--dim); font-size: 11px; font-family: var(--mono); font-weight: 400; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; display: none; }
.screen.active { display: block; }

/* title / select / result screens: see screens.css */
input[type="range"] { width: 100%; accent-color: var(--ac); }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.chk small { color: var(--dim); }
.chk input { accent-color: var(--ac); width: 16px; height: 16px; }

/* ---------------------------------------------------------- play: see play.css */
.overlay { position: absolute; inset: 0; background: rgba(3, 5, 10, 0.78); display: flex; align-items: center; justify-content: center; z-index: 3; backdrop-filter: blur(3px); padding: 16px; }
.halt { background: var(--panel); border: 1px solid var(--ac); border-radius: 16px; padding: 26px 28px; width: min(420px, 100%); text-align: center; }
.halt-tag { font-family: var(--mono); color: var(--ac); font-size: 12px; letter-spacing: 0.2em; }
.halt h2 { margin: 8px 0 4px; font-size: 26px; }
.halt p { margin: 0 0 18px; color: var(--dim); }
.halt-btns { display: flex; flex-direction: column; gap: 8px; }
.halt-btns button, .r-btns button, .dlg-btns button {
  padding: 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); font-weight: 700;
}
button.primary { background: var(--ac) !important; color: #111 !important; border-color: var(--ac) !important; }
button.primary kbd { color: #333; border-color: rgba(0, 0, 0, 0.3); }

/* ---------------------------------------------------------- settings */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(560px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.settings { padding: 20px 22px; }
.settings h3 { margin: 0 0 14px; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.set-grid > label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.set-grid label small { color: var(--dim); font-weight: 400; }
.set-grid > label.chk { flex-direction: row; }
.set-grid select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.rng { display: flex; align-items: center; gap: 8px; }
.rng b { font-family: var(--mono); font-size: 12px; min-width: 52px; text-align: right; }
.keys-set { grid-column: span 2; font-size: 13px; font-weight: 600; }
.keys-set small { color: var(--dim); font-weight: 400; }
.key-btns { display: flex; gap: 8px; margin: 8px 0 4px; flex-wrap: wrap; }
.key-btns button { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 10px; min-width: 96px; font-size: 12px; text-align: left; }
.key-btns button b { display: block; font-family: var(--mono); font-size: 18px; }
.key-btns button.wait { border-color: var(--ac); color: var(--ac); }
.dlg-btns { display: flex; justify-content: flex-end; margin-top: 18px; }
.dlg-btns button { min-width: 100px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 10; max-width: calc(100% - 32px); }

/* ---------------------------------------------------------- responsive */
@media (max-width: 760px) {
  .set-grid { grid-template-columns: 1fr; }
  .keys-set { grid-column: auto; }
}
