@font-face { font-family: 'Fredoka'; font-weight: 500; font-display: block; src: url('/fonts/fredoka-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: block; src: url('/fonts/fredoka-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-display: block; src: url('/fonts/fredoka-latin-700-normal.woff2') format('woff2'); }

:root {
  --bg: #fff6f8;
  --panel: #ffffff;
  --ink: #4a3340;
  --muted: #8a7480;
  --accent: #ff5c82;
  --accent-ink: #ffffff;
  --line: #f1dde4;
  --field: #fffafb;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1519; --panel: #2a1f25; --ink: #fbeef3; --muted: #c2a9b5;
    --line: #43313a; --field: #231a1f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1d1519; --panel: #2a1f25; --ink: #fbeef3; --muted: #c2a9b5;
  --line: #43313a; --field: #231a1f; color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 500 16px/1.45 Fredoka, system-ui, sans-serif;
}
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; }
.brand svg { width: 28px; height: 28px; fill: var(--accent); }
.tag { font-size: 13px; color: var(--muted); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; }

.layout {
  display: grid; grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); gap: 24px;
  max-width: 1200px; margin: 0 auto; padding: 20px;
}
.preview-col { position: sticky; top: 76px; align-self: start; }
.stage {
  position: relative; width: 100%; aspect-ratio: 9 / 16; border-radius: 22px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(74, 51, 64, 0.18); background: #000;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.player { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.player input { flex: 1; accent-color: var(--accent); }
.time { font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; padding: 0; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 14px; color: var(--muted); }

.controls { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.panel h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 19px; font-weight: 700; }
.panel h2 span {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 15px;
}
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; margin-bottom: 12px; flex: 1; min-width: 0; }
label small { font-weight: 500; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; margin: 0; flex: 0 0 auto; }
input[type="text"], textarea, select {
  font: inherit; font-weight: 500; color: var(--ink); background: var(--field);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%;
}
select { width: auto; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="range"] { accent-color: var(--accent); width: 100%; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row.tight { align-items: center; gap: 10px; }
details { margin-top: 4px; }
summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; color: var(--muted); }

button, .btn {
  font: inherit; font-weight: 600; border-radius: 999px; padding: 10px 18px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--field); color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.ghost { background: transparent; }

.sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-bottom: 12px; }
.set-btn {
  flex-direction: column; border-radius: 16px; padding: 6px 6px 8px; gap: 4px; font-size: 13px;
}
.set-btn canvas { width: 100%; aspect-ratio: 1; border-radius: 12px; display: block; }
.set-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.hint { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.progress { position: relative; height: 28px; border-radius: 999px; background: var(--field); border: 1.5px solid var(--line); overflow: hidden; margin-top: 12px; }
.progress div { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); transition: width 0.15s; }
.progress span { position: relative; display: block; text-align: center; font-size: 13px; line-height: 25px; font-weight: 600; mix-blend-mode: difference; color: #fff; }
.result { margin-top: 14px; }
.result video { width: 100%; max-width: 240px; border-radius: 14px; display: block; margin-bottom: 10px; background: #000; }
.batch-list { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.batch-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; font-size: 14px; }
.batch-list li .name { flex: 1; min-width: 140px; }
.batch-list li .btn, .batch-list li button { padding: 6px 12px; font-size: 13px; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .preview-col { position: static; max-width: 360px; width: 100%; margin: 0 auto; }
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; }
