:root { color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
body { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: #e8f5e0; }
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }

#ui {
  position: fixed; top: 0; right: 0; width: min(360px, 94vw); max-height: 100vh;
  height: 100dvh;
  overflow-y: auto; padding: 8px 18px 24px;
  background: rgba(8, 10, 6, 0.84); border-left: 3px solid #b6ff2e;
  transition: opacity 0.7s ease, transform 0.45s cubic-bezier(0.2, 0.9, 0.25, 1);
  touch-action: pan-y; will-change: transform;
}
body.idle #ui { opacity: 0; transform: translateX(30px); pointer-events: none; }
body.panel-hidden #ui { transform: translateX(106%); pointer-events: none; }
body.idle, body.panel-hidden { cursor: none; }
body.panel-hidden { cursor: auto; }
#ui.dragging { transition: none; }

#dragbar {
  text-align: center; color: #9db98d; font-size: 13px; letter-spacing: 0.2em;
  padding: 6px 0 2px; cursor: grab; user-select: none; -webkit-user-select: none;
  touch-action: none;
}
#reopen {
  position: fixed; top: 42%; right: 0; z-index: 30;
  writing-mode: vertical-rl; padding: 14px 7px; font-size: 12px; letter-spacing: 0.14em;
  background: rgba(182, 255, 46, 0.92); color: #0c0f08; border: 0;
  opacity: 0; pointer-events: none; transform: translateX(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
body.panel-hidden #reopen { opacity: 1; pointer-events: auto; transform: none; }
body.panel-hidden.idle #reopen { opacity: 0; pointer-events: none; }
#hidepanel { float: right; padding: 2px 10px; font-size: 16px; line-height: 1; }
#presets { display: flex; flex-wrap: wrap; gap: 6px; }
#presets button { background: #3a1530; color: #ffd7ef; border: 1px solid #ff5db1; font-weight: 400; padding: 7px 10px; }
#presets button:hover { background: #ff5db1; color: #160510; }

h1 { font-size: 21px; line-height: 1.15; margin: 2px 0 8px; letter-spacing: 0.04em; color: #ffe600; }
h2 { font-size: 15px; margin: 0 0 6px; color: #ff5db1; }
.sub, p { font-size: 12.5px; line-height: 1.55; color: #cfe8bd; }
.hint { font-size: 11.5px; color: #9db98d; }
.hint code { color: #ffe600; }
.panel { border-top: 1px dashed #3d5230; padding: 14px 0 6px; margin-top: 10px; }
.panel.row { display: flex; flex-wrap: wrap; gap: 8px; }
label { display: block; font-size: 12px; margin: 10px 0 4px; color: #fff; }
label output { color: #ffe600; float: right; }
label.check { display: flex; gap: 8px; align-items: center; margin-top: 14px; cursor: pointer; }

input[type="text"], select {
  width: 100%; padding: 10px; font: inherit; font-size: 14px; color: #fff;
  background: #131a0e; border: 2px solid #b6ff2e; border-radius: 0;
}
input[type="text"]:focus, select:focus { outline: 2px solid #ff5db1; outline-offset: 1px; }
input[type="range"] { width: 100%; accent-color: #ff5db1; height: 26px; }
.slider { margin-bottom: 2px; }

#chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
button {
  font: inherit; font-size: 12px; padding: 8px 12px; cursor: pointer;
  color: #0c0f08; background: #b6ff2e; border: 0; border-radius: 0; font-weight: 700;
}
button:hover { background: #ffe600; }
#chips button { background: #23331a; color: #d8ffb0; border: 1px solid #b6ff2e; font-weight: 400; padding: 5px 9px; }
#chips button:hover { background: #b6ff2e; color: #0c0f08; }
a.dl {
  display: inline-block; margin: 4px 6px 4px 0; padding: 10px 14px;
  background: #ff5db1; color: #160510; font-weight: 700; font-size: 13px; text-decoration: none;
}
a.dl.alt { background: #ffe600; }
a.dl:hover { filter: brightness(1.2); }

#glfail {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: #ffe600; color: #111; padding: 14px 18px;
  font-size: 14px; font-weight: 700; text-align: center;
}
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #ffe600; color: #111; padding: 10px 16px; font-size: 13px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #ui { transition: none; } }
