/* Modern + clean: off-white surface, near-black ink, single indigo accent. */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --ink: #0a0a0a;
  --ink-soft: #525252;
  --ink-subtle: #a3a3a3;
  --accent: #4f46e5;          /* indigo-600 */
  --accent-soft: #eef2ff;     /* indigo-50 */
  --accent-ink: #3730a3;      /* indigo-800 */
  --ok: #15803d;
  --err: #b91c1c;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px -4px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --maxw: 920px;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: 'Fraunces', 'Iowan Old Style', 'Charter', Georgia, serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
}

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px 24px 96px;
}

.view {
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.4em;
  color: var(--ink);
}

h1 { font-size: 36px; line-height: 1.1; }
h2 { font-size: 22px; line-height: 1.25; letter-spacing: -0.01em; }

.lede {
  color: var(--ink-soft);
  margin: 0 0 32px;
  max-width: 56ch;
  font-size: 17px;
  line-height: 1.6;
}

.masthead {
  margin-bottom: 32px;
}

/* Cards & inputs */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: grid;
  gap: 18px;
  box-shadow: var(--shadow-sm);
}

label {
  display: grid;
  gap: 6px;
}

.label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

input[type='text'], input[type='password'], textarea {
  font: inherit;
  font-family: var(--sans);
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  width: 100%;
  transition: border-color 0.1s ease, box-shadow 0.1s ease;
}

input[type='text']:focus, input[type='password']:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
  font-family: var(--sans);
}

button {
  font: inherit;
  font-family: var(--sans);
  font-weight: 500;
  padding: 10px 18px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease, transform 0.05s ease;
}

button:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--ink);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button.primary {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

button.primary:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
}

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

.error {
  color: var(--err);
  font-size: 14px;
  margin: 0;
}

/* Test bar */
.testbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
}

.crumb {
  font-weight: 500;
  color: var(--ink);
}

.progress {
  display: flex;
  align-items: center;
  gap: 14px;
}

#progress-text {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink);
}

.bar {
  width: 160px;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease-out;
  border-radius: 999px;
}

/* Pair head: image + meta */
.pair {
  display: grid;
  gap: 32px;
}

.pair-head {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

#pair-image {
  width: 220px;
  height: 220px;
  object-fit: contain;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.pair-meta h2 {
  margin-bottom: 6px;
  font-size: 24px;
}

.family {
  color: var(--ink-soft);
  margin: 0 0 8px;
  font-size: 15px;
}

.price {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 16px;
  font-variant-numeric: tabular-nums;
}

.specs {
  font-size: 13px;
  margin-top: 8px;
}

.specs summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
  font-size: 13px;
  user-select: none;
}

.specs summary:hover { color: var(--accent-ink); }

.specs dl {
  margin: 12px 0 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  color: var(--ink-soft);
}

.specs dt { font-weight: 600; color: var(--ink); }
.specs dd { margin: 0; }

/* A/B blocks */
.blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.block-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-subtle);
  margin-bottom: 14px;
}

.prose {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
}

/* Picker / confidence / tags */
fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

legend {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 6px;
  padding: 0;
}

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

.picker legend { width: 100%; }

.picker label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  background: var(--surface);
  user-select: none;
  font-weight: 500;
  transition: all 0.1s ease;
}

.picker label:hover { border-color: var(--ink); }

.picker label:has(input:checked) {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.picker input { display: none; }

.confidence input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
  margin: 4px 0;
}

.conf-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}

#conf-value {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  transition: all 0.1s ease;
}

.chip:hover { border-color: var(--ink); color: var(--ink); }

.chip.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.why textarea { min-height: 56px; }

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.save-status {
  text-align: right;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--ok);
  min-height: 1em;
  margin: 0;
}

.save-status.err { color: var(--err); }

/* Mobile */
@media (max-width: 720px) {
  main { padding: 28px 16px 64px; }
  h1 { font-size: 28px; }
  .pair-head { grid-template-columns: 1fr; padding: 20px; }
  #pair-image { width: 100%; height: auto; aspect-ratio: 1/1; }
  .blocks { grid-template-columns: 1fr; }
}
