:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #16161a;
  --muted: #6b6b76;
  --line: #dededf;
  --accent: #4f46e5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101014;
    --surface: #1a1a20;
    --text: #ececf1;
    --muted: #9a9aa6;
    --line: #2c2c35;
    --accent: #8b85f5;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px 16px 48px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

main { max-width: 880px; margin: 0 auto; }

h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -0.01em; }

header p { margin: 0 0 24px; color: var(--muted); max-width: 62ch; }

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

.workspace { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

canvas#pad {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
  display: block;
  margin: 0 auto;
  border-radius: 10px;
  background: #000;
  cursor: crosshair;
  touch-action: none;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

button {
  font: inherit;
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
button:hover { border-color: var(--accent); }

#status { color: var(--muted); font-size: 13px; }

.examples { margin-top: 16px; font-size: 13px; color: var(--muted); }
.examples div { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.examples img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #000;
  cursor: pointer;
  image-rendering: pixelated;
  border: 1px solid var(--line);
}
.examples img:hover { border-color: var(--accent); }

.verdict { display: flex; align-items: baseline; gap: 12px; }
#digit { font-size: 64px; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; }
#confidence { color: var(--muted); }

ol#scores { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
ol#scores li { display: grid; grid-template-columns: 18px 1fr 52px; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
ol#scores b { font-weight: 600; }
ol#scores span.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
ol#scores span.bar i { display: block; height: 100%; background: var(--accent); }
ol#scores span.value { text-align: right; color: var(--muted); font-size: 13px; }

.preview { display: flex; align-items: center; gap: 12px; margin-top: 22px; color: var(--muted); font-size: 13px; }
.preview canvas {
  width: 84px;
  height: 84px;
  image-rendering: pixelated;
  border-radius: 8px;
  background: #000;
  border: 1px solid var(--line);
}
.preview em { font-style: normal; }
