:root {
  --night: #140826;
  --deck: #21103d;
  --edge: #3a2366;
  --text: #f3edff;
  --dim: #a596c7;
  --violet: #8a3ffc;
  --sun: #ffd23f;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { width: 340px; margin: 0; background: var(--night); color: var(--text); font: 13px/1.45 system-ui, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
a { color: var(--sun); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; }
.dim { color: var(--dim); }

header { display: flex; align-items: center; gap: 9px; padding: 12px 14px 4px; }
.word { font: 800 14px system-ui, sans-serif; letter-spacing: .12em; }
.word span { color: var(--sun); }
.site { display: flex; gap: 8px; padding: 0 14px 10px; font: 11px var(--mono); color: var(--dim); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.site #site { color: var(--text); }

.switch { margin-left: auto; position: relative; width: 34px; height: 20px; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--edge); border-radius: 10px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); transition: transform .2s; }
.switch input:checked + span { background: var(--violet); }
.switch input:checked + span::after { transform: translateX(14px); }

.empty { padding: 24px 14px; display: grid; gap: 4px; text-align: center; }

main { display: grid; gap: 12px; padding: 0 14px 12px; }
.stage { position: relative; aspect-ratio: var(--sar, 1.778); width: min(100%, calc(150px * var(--sar, 1.778))); margin-inline: auto; background: #07020f; overflow: hidden; border-radius: 4px; outline: 1px dashed var(--violet); outline-offset: -1px; }
.frame { position: absolute; inset: 0; margin: auto; aspect-ratio: var(--car, 1.778); max-width: 100%; max-height: 100%; background: linear-gradient(160deg, #6b2bd9, #c4407a 60%, #ffd23f); transition: transform .2s; }
.frame::after { content: ""; position: absolute; left: 44%; top: 28%; width: 10%; aspect-ratio: 1; border-radius: 50%; background: #fff6; }
.tag { position: absolute; left: 6px; bottom: 5px; font: 11px var(--mono); background: #07020fcc; padding: 1px 6px; border-radius: 3px; }

.lbl { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; font: 11px var(--mono); color: var(--dim); margin-bottom: 5px; }
.src { color: var(--sun); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--edge); border-radius: 6px; overflow: hidden; }
.seg button { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: 0; border-left: 1px solid var(--edge); padding: 6px 0; font: 500 11.5px var(--mono); color: var(--dim); }
.seg button:first-child { border-left: 0; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--violet); color: #fff; }

.fine { display: grid; grid-template-columns: 26px 1fr 26px 50px; gap: 8px; align-items: center; }
.step { height: 26px; border-radius: 5px; border: 1px solid var(--edge); background: var(--deck); font-size: 15px; line-height: 1; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: none; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--edge); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--sun); border: 0; }
.val { font: 600 14px var(--mono); text-align: right; color: var(--sun); font-variant-numeric: tabular-nums; }

.pan { display: flex; gap: 4px; align-items: center; font: 11px var(--mono); }
.pan .dim { margin-right: auto; }
.pan button { width: 28px; height: 24px; border-radius: 5px; border: 1px solid var(--edge); background: var(--deck); font-size: 10px; }

.acts { display: flex; gap: 6px; }
.ghost { flex: 1; background: none; border: 1px solid var(--edge); border-radius: 6px; padding: 7px; font-size: 12px; }
.ghost:hover { border-color: var(--violet); }
.ghost.done { border-color: var(--sun); color: var(--sun); }

.presets { display: grid; }
.preset { display: grid; grid-template-columns: 1fr auto 20px; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--edge); }
.preset button.apply { background: none; border: 0; text-align: left; padding: 0; font-weight: 500; }
.preset button.apply:hover { color: var(--sun); }
.preset small { font: 11px var(--mono); color: var(--dim); }
.preset .del { background: none; border: 0; color: var(--dim); }
.presets .none { color: var(--dim); font-size: 12px; padding: 4px 0; }
#presetForm { display: flex; gap: 6px; margin-bottom: 6px; }
#presetForm input { flex: 1; background: var(--deck); border: 1px solid var(--edge); border-radius: 5px; color: var(--text); padding: 5px 8px; font: inherit; }
#presetForm button { background: var(--sun); color: #1a0d00; border: 0; border-radius: 5px; padding: 0 10px; font-weight: 600; }

.rate { display: flex; gap: 8px; align-items: center; margin: 0 14px 10px; padding: 8px 10px; background: var(--deck); border: 1px solid var(--edge); border-radius: 6px; font-size: 12px; }
.rate a { font-weight: 600; margin-left: auto; }
.rate a.off { color: var(--dim); pointer-events: none; }
.rate button { background: none; border: 0; color: var(--dim); font-size: 14px; }

footer { display: flex; justify-content: space-between; padding: 9px 14px; border-top: 1px solid var(--edge); font: 11px var(--mono); color: var(--dim); }
kbd { font: 10px var(--mono); border: 1px solid var(--edge); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; background: var(--deck); color: var(--text); }

.manual { padding: 8px 10px; border: 1px solid var(--edge); border-radius: 6px; }
.manual.on { border-color: var(--sun); }
.manual.on .lbl > span:first-child { color: var(--sun); }
.muted { opacity: .45; }
.exact { display: grid; grid-template-columns: auto 1fr 50px; gap: 8px; align-items: center; margin-top: 6px; font: 11px var(--mono); }
.exact .val { font-size: 12px; }
