:root {
  color-scheme: light dark;
  --bg: #f2f2f6; --card: #ffffff; --text: #1c1c1e; --muted: #6e6e73;
  --accent: #0a7cff; --border: #d5d5da; --danger: #d0342c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101014; --card: #1c1c21; --text: #f2f2f7; --muted: #98989e;
    --accent: #3395ff; --border: #3a3a40;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 8px 12px 56px; }
nav { display: flex; gap: 16px; align-items: center; max-width: 640px; margin: 0 auto; padding: 12px; }
nav a { color: var(--accent); text-decoration: none; font-weight: 600; }
nav .brand { margin-right: auto; color: var(--text); font-size: 18px; }
h1 { font-size: 22px; margin: 14px 0 10px; }
a { color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 0 0 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
/* Spool swatch: filament-colored ring, black hub hole, and a conic-gradient
   pie in the hub (12 o'clock, clockwise) showing --pct of the spool left. */
.swatch { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); flex-shrink: 0; background: var(--fc, #888888); }
.swatch::before { content: ''; position: absolute; inset: 22%; border-radius: 50%; background: #000; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15); }
.swatch::after { content: ''; position: absolute; inset: 29%; border-radius: 50%; background: conic-gradient(var(--pc, #fff) var(--pct, 0%), transparent 0); }
.muted { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.error { color: var(--danger); font-weight: 600; }
.flash { background: var(--accent); color: #fff; border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.badge { font-size: 12px; border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; color: var(--muted); white-space: nowrap; }
.bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.rowlinks { display: flex; flex-direction: column; gap: 10px; text-align: right; }
.rowlinks a { text-decoration: none; font-weight: 600; }
label { display: block; margin: 14px 0 4px; font-weight: 600; font-size: 14px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 8px 10px; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
input[type=checkbox] { width: 24px; height: 24px; min-height: 0; accent-color: var(--accent); margin: 0; }
input[type=color] { width: 64px; padding: 4px; flex-shrink: 0; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 16px; min-height: 44px; margin: 4px 0; }
button, .btn { display: inline-block; min-height: 44px; padding: 10px 18px; font: inherit; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 10px; cursor: pointer; text-decoration: none; text-align: center; }
button.secondary, .btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--border); }
button.danger { background: var(--danger); }
.actions { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.sortbar { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.sortbar label { margin: 0; color: var(--muted); }
.sortbar select { width: auto; min-height: 36px; padding: 6px 10px; }
.suggest-wrap { position: relative; }
.suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10; background: var(--card); border: 1px solid var(--border); border-radius: 10px; max-height: 300px; overflow-y: auto; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); }
.suggest-row { display: flex; width: 100%; gap: 10px; align-items: center; min-height: 44px; padding: 8px 10px; background: none; border: 0; border-radius: 0; color: var(--text); font-weight: 400; text-align: left; }
.suggest-row:hover, .suggest-row:focus { background: var(--bg); }
.suggest-row .chip { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); flex-shrink: 0; }
.suggest-foot { display: block; padding: 8px 10px; font-size: 12px; color: var(--muted); text-decoration: none; border-top: 1px solid var(--border); }
.drop { display: block; border: 2px dashed var(--border); border-radius: 12px; padding: 26px 14px; text-align: center; color: var(--muted); font-weight: 400; cursor: pointer; }
.drop.hover { border-color: var(--accent); color: var(--accent); }
video { width: 100%; border-radius: 12px; margin-top: 10px; }
