:root {
  --bg: #17171b;
  --panel: #1f1f25;
  --panel-border: #33333c;
  --input: #2a2a32;
  --input-border: #44444f;
  --text: #e8e8ec;
  --muted: #9a9aa6;
  --accent: #4c8dff;
  --green: #3fa66a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 13px/1.4 system-ui, sans-serif; display: flex; overflow: hidden; }

aside {
  width: 252px; flex: none; background: var(--panel); border-right: 1px solid var(--panel-border);
  padding: 14px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto;
}
aside h1 { font-size: 24px; margin: 0; display: flex; flex-direction: column; gap: 2px; }
aside h1 small { color: var(--muted); font-weight: normal; font-size: 11px; }
main { flex: 1; min-width: 0; position: relative; }
#view { width: 100%; height: 100%; display: block; }

main #status {
  position: absolute; left: 12px; bottom: 12px; max-width: min(60ch, calc(100% - 24px));
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 8px;
  padding: 6px 10px; color: #f88; display: none;
}
main #status.show { display: block; }
#hint { color: var(--muted); font-size: 11px; margin: 0; }

#sidebartoggle,
#sidebarbackdrop { display: none; }

@media (max-width: 700px) {
  aside {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
    width: min(280px, 85vw);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  body.sidebar-open aside { transform: none; box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); }
  #sidebartoggle { display: flex; }
  body.sidebar-open #sidebarbackdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.45); z-index: 29;
  }
}

section { display: flex; flex-direction: column; gap: 7px; }
section > h2 {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin: 0; display: flex; align-items: center; justify-content: space-between;
}

.row { display: flex; gap: 6px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.row > label { flex: initial; }
.fields { display: grid; grid-template-columns: auto 1fr; gap: 7px 6px; align-items: center; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%; background: var(--input); color: var(--text);
  border: 1px solid var(--input-border); border-radius: 6px; padding: 5px 8px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); }
textarea { resize: vertical; min-height: 4em; }
input[type="range"] { accent-color: var(--accent); min-width: 0; }
.val { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; flex: none; min-width: 36px; }

button {
  background: var(--input); color: var(--text); border: 1px solid var(--input-border);
  border-radius: 6px; padding: 5px 10px; font: inherit; cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.active { background: var(--green); border-color: var(--green); color: #fff; }
button.icon { background: none; border: none; padding: 0; color: var(--muted); display: flex; align-items: center; }
button.icon:hover:not(:disabled) { color: var(--accent); border: none; }
.row > .icon { flex: initial; font-size: 16px; line-height: 1; padding: 4px 6px; margin: -4px -2px; justify-content: center; }

label.check { display: flex; align-items: center; gap: 6px; color: var(--text); cursor: pointer; user-select: none; }

#packstatus, #scenestatus { color: var(--muted); font-size: 12px; }
#packfile { display: none; }

.menu-button {
  position: fixed; top: 10px; left: 10px; z-index: 29;
  display: flex; width: 36px; height: 36px; align-items: center; justify-content: center;
  background: rgba(31, 31, 37, 0.85); border: 1px solid var(--panel-border); border-radius: 8px;
  color: var(--text); cursor: pointer; padding: 0;
}
.menu-button:hover { border-color: var(--accent); }
