:root { --bg: #18181b; --panel: #232328; --line: #3a3a42; --text: #efeff1; --muted: #a0a0ab; --accent: #9147ff; --error: #ff6b6b; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
button, .btn { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 6px 12px; font: inherit; cursor: pointer; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
input { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; }
.muted { color: var(--muted); }
.error { color: var(--error); }

#login { display: grid; place-items: center; height: 100%; }
.card { background: var(--panel); padding: 24px; border-radius: 10px; max-width: 380px; }
.card h1 { margin-top: 0; }
.code { font: 700 28px monospace; letter-spacing: 4px; margin: 8px 0; }
.card a { color: #bf94ff; }

#app { display: flex; flex-direction: column; height: 100%; }
header { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
header form { display: flex; gap: 6px; }
#textIn { width: 220px; }
.spacer { flex: 1; }
select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px; font: inherit; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; width: min(440px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h2 { margin-top: 0; }
dialog ul { padding-left: 18px; }
dialog li { margin: 4px 0; }
dialog form { display: flex; gap: 6px; }
dialog .right { justify-content: flex-end; }

#work { position: relative; flex: 1; overflow: hidden; touch-action: none; user-select: none; }
#work.dropping { outline: 2px dashed var(--accent); outline-offset: -6px; }
.hint { position: absolute; left: 12px; right: 12px; bottom: 4px; margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
#frame { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  width: min(62%, calc((100vh - 120px) * 16 / 9)); aspect-ratio: 16 / 9; background: #000; outline: 2px solid var(--accent); }
#player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: .55; pointer-events: none; }
#stage { position: absolute; inset: 0; overflow: hidden; }

#work .item { cursor: grab; touch-action: none; }
#work .item:hover, #work .item:focus { outline: 1px dashed var(--accent); outline-offset: 2px; }
#work .item.dragging { cursor: grabbing; z-index: 10; opacity: .85; }
