:root {
  color-scheme: light dark;
  --bg: #0f1216;
  --panel: #171c22;
  --panel-2: #1e252d;
  --text: #e7edf3;
  --muted: #94a3b1;
  --accent: #6ea8fe;
  --good: #57d38c;
  --warn: #f0b45a;
  --bad: #ef6b6b;
  --border: #2b343e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

h1 {
  font-size: 20px;
  margin: 0;
  flex: 1 1 auto;
}

.badge,
.timer {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

.notice {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.puzzle-host {
  display: grid;
  gap: 18px;
}

.puzzle-task {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.puzzle-board {
  position: relative;
  width: 100%;
  line-height: 0;
  overflow: visible;
  touch-action: none;
  user-select: none;
}

.puzzle-bg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  pointer-events: none;
  -webkit-user-drag: none;
}

.puzzle-shape {
  position: absolute;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
  z-index: 2;
}

.puzzle-shape:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.puzzle-shape.dragging {
  cursor: grabbing;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

.puzzle-readout {
  margin: 8px 2px 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.controls {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--muted);
}

.consent input {
  margin-top: 3px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

input[type="text"],
select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 11px;
  font: inherit;
  min-width: 0;
}

.notes {
  flex: 1 1 320px;
}

.confidence {
  flex: 0 0 auto;
}

.skip-reason {
  width: 100%;
}

button {
  border-radius: 9px;
  padding: 9px 14px;
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #08111f;
  font-weight: 600;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 14px;
  white-space: pre-wrap;
}

.status-success {
  border-color: rgba(87, 211, 140, 0.5);
  color: var(--good);
}

.status-error {
  border-color: rgba(239, 107, 107, 0.5);
  color: var(--bad);
}

.status-warn {
  border-color: rgba(240, 180, 90, 0.5);
  color: var(--warn);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.queue {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 8px;
}

.queue li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

a {
  color: var(--accent);
}

@media (max-width: 560px) {
  main {
    padding: 16px 10px 48px;
  }
  .notes {
    flex-basis: 100%;
  }
}
