:root {
  --bg: #0f1012;
  --panel: #17181b;
  --panel-2: #1f2024;
  --line: #2a2c31;
  --text: #ececef;
  --muted: #9a9ca4;
  --accent: #ff7a1a;
  --accent-2: #ff9a4d;
  --danger: #ff5c5c;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; font-size: 13px; }

button, input[type=text], input[type=password], input[type=number] {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 12px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { cursor: pointer; }
button:hover { border-color: #3a3d44; background: #26282d; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 650; }
button.primary:hover { background: var(--accent-2); }
button.ghost { background: transparent; }
button.danger { color: var(--danger); border-color: #4a2a2a; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.btns button { padding: 6px 10px; font-size: 13px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.login .card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 10px; }
.login .card.center { text-align: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; margin: 10px auto 0; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* dashboard */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.dash { max-width: 1200px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.upload .drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); cursor: pointer; margin: 10px 0; transition: border-color .15s, background .15s; }
.upload .drop:hover, .upload .drop.over { border-color: var(--accent); background: rgba(255,122,26,.06); }
.upload .drop input { display: none; }
.upload .drop.has { color: var(--text); border-style: solid; }
.progress { position: relative; height: 10px; background: var(--panel-2); border-radius: 6px; margin-top: 12px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress span { position: absolute; right: 0; top: -22px; font-size: 12px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.item .thumb { aspect-ratio: 16/9; background: #0a0a0c center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.item .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.item .name { font-weight: 600; }
.item .meta { font-size: 12.5px; color: var(--muted); }
.item .actions { display: flex; gap: 6px; margin-top: 4px; }
.item .actions button, .item .actions a { font-size: 13px; padding: 6px 10px; }
.item .actions a { border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.badge { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.badge.ready { color: #6fe39a; } .badge.processing { color: var(--accent-2); } .badge.error { color: var(--danger); }
.empty { color: var(--muted); grid-column: 1 / -1; text-align: center; padding: 40px; }

/* editor */
.editor { position: fixed; inset: 0; display: grid; grid-template-columns: 1fr 340px; }
.editor canvas { width: 100%; height: 100%; display: block; background: var(--bg); touch-action: none; }
.panel { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.panel header h2 { font-size: 18px; margin: 6px 0 2px; padding: 2px 4px; border-radius: 6px; }
.panel header h2:focus { outline: 2px solid var(--accent); }
.panel section { display: flex; flex-direction: column; gap: 6px; }
.panel .back { font-size: 13px; }
.xyz { display: flex; gap: 6px; }
.xyz label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); flex: 1; }
.xyz input { width: 100%; padding: 6px 8px; }
.sliders { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; font-size: 12px; color: var(--muted); }
.sliders input[type=range] { width: 100%; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.apply { border-top: 1px solid var(--line); padding-top: 14px; }
.hint { position: fixed; left: 12px; bottom: 12px; background: rgba(20,20,22,.8); border: 1px solid var(--line); padding: 7px 11px; border-radius: 9px; font-size: 12.5px; color: var(--muted); pointer-events: none; }
@media (max-width: 800px) {
  .editor { grid-template-columns: 1fr; grid-template-rows: 55vh 45vh; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
}
