:root {
  --bg: #1b1d21;
  --panel: #24272c;
  --panel-2: #2c3036;
  --border: #3a3f47;
  --text: #e6e8eb;
  --muted: #9aa3ad;
  --accent: #f0a63a;
  --accent-text: #1b1d21;
  --topbar-height: 56px;
  --viewer-bar-height: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}

body { display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar h1 { font-size: 16px; margin: 0 12px 0 0; font-weight: 600; }

.file-button {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.file-button.small { padding: 4px 10px; font-weight: 500; }
.file-button input { display: none; }

.file-name { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status { margin-left: auto; color: var(--muted); font-family: ui-monospace, monospace; font-size: 12px; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.error { color: #ff7b72; }

.columns { flex: 1; display: flex; min-height: 0; }

.left {
  width: 360px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--panel);
  min-height: 0;
}

.animations { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.list-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.animation-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.animation-list li { border-bottom: 1px solid var(--border); }
.animation-list label { display: flex; align-items: center; gap: 8px; padding: 6px 14px; cursor: pointer; }
.animation-list label:hover { background: var(--panel-2); }
.animation-list li.active label { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.animation-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.animation-list .duration { color: var(--muted); font-family: ui-monospace, monospace; font-size: 12px; }
.animation-list .empty { padding: 14px; color: var(--muted); }

.settings { border-top: 1px solid var(--border); padding: 8px 14px; max-height: 45%; overflow-y: auto; }
.settings details { margin-bottom: 8px; }
.settings summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.settings label { display: block; padding: 3px 0; }
.settings .row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.settings select, .settings input[type=number] {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px;
}
.settings input[type=number] { width: 90px; }
.settings textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font: 12px/1.35 ui-monospace, monospace;
  padding: 6px;
  resize: vertical;
}
.alignment { margin: 4px 0 0; font: 12px/1.35 ui-monospace, monospace; color: var(--muted); white-space: pre-wrap; }

.export { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }

button {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.45; cursor: default; }
.export button { flex: 1; font-weight: 600; }
#export-all { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.right { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.canvas-box { flex: 1; min-height: 0; position: relative; background: #1e2024; }
.canvas-box canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; outline: none; display: block; }

.viewer-bar {
  height: var(--viewer-bar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: var(--panel);
  border-top: 1px solid var(--border);
}
.viewer-bar > * { white-space: nowrap; flex-shrink: 0; }
.viewer-bar .hint { margin-left: auto; color: var(--muted); font-size: 12px; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; }
.viewer-bar #play { min-width: 64px; }
.viewer-bar #frame { width: 220px; accent-color: var(--accent); }
.viewer-bar .frame-label { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); min-width: 110px; }
