/* ============================================================
   ChromaCheck — static color vision test
   Plain CSS, no dependencies. Light + dark themes via data-theme.
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f2efea;
  --text: #1d1915;
  --muted: #716862;
  --border: #e4dfd9;
  --primary: #bb4b00;
  --primary-hover: #9e3f00;
  --primary-soft: #f4e9dd;
  --on-primary: #fdf9f4;
  --good: #3d9a50;
  --good-soft: #e9f5ec;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --bad: #c2410c;
  --bad-soft: #fbeae4;
  --shadow: 0 1px 2px rgba(29, 25, 21, 0.05), 0 4px 14px rgba(29, 25, 21, 0.05);
  --shadow-lg: 0 4px 10px rgba(29, 25, 21, 0.07), 0 14px 36px rgba(29, 25, 21, 0.1);
  --radius: 14px;
}

html[data-theme="dark"] {
  --bg: #17130f;
  --surface: #201b16;
  --surface-2: #2a241e;
  --text: #f3efea;
  --muted: #a89d92;
  --border: #38312a;
  --primary: #e5904f;
  --primary-hover: #f0a366;
  --primary-soft: #3a2c1e;
  --on-primary: #22150a;
  --good: #6cbf7d;
  --good-soft: #1e3324;
  --warn: #e5a13d;
  --warn-soft: #362a17;
  --bad: #e88055;
  --bad-soft: #3a241a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.35), 0 14px 36px rgba(0, 0, 0, 0.4);
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top rainbow accent ---------- */
.rainbow-bar {
  height: 4px;
  background: linear-gradient(
    90deg,
    #9433cc,
    #4a29ae,
    #174ecf,
    #1da53f,
    #f9da10,
    #f2780d,
    #cf2317
  );
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header {
    background: var(--bg);
  }
}

.header-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: 10px;
}

.brand-mark {
  height: 2rem;
  width: 2rem;
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.theme-toggle {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.45rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

html[data-theme="light"] .icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }

/* ---------- Layout ---------- */
main#app {
  flex: 1;
}

.view {
  animation: view-in 0.3s ease both;
  padding-bottom: 2rem;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.container {
  max-width: 56rem;
  margin: 0 auto;
  padding: 2rem 1rem 0;
}

.container.narrow {
  max-width: 44rem;
}

.container.test-container {
  max-width: 36rem;
}

.hidden {
  display: none !important;
}

.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-xs { font-size: 0.75rem; color: var(--muted); }

h1 {
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0.5rem 0;
}

h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

h3 {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

p {
  margin: 0;
}

.lead {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  margin-top: 0.75rem;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

/* ---------- Hero ---------- */
.hero {
  margin-bottom: 2.5rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.cards-2 {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: 1fr;
  margin-bottom: 1.5rem;
}

@media (min-width: 680px) {
  .cards-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.test-card {
  display: flex;
  flex-direction: column;
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .test-card { border-color: var(--border); }
}

.card-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.8rem;
}

.card-icon {
  height: 2.5rem;
  width: 2.5rem;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.card-list {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
  font-size: 0.88rem;
}

.card-list li {
  display: flex;
  gap: 0.55rem;
  align-items: baseline;
  padding: 0.18rem 0;
}

.card-list li::before {
  content: "";
  height: 6px;
  width: 6px;
  border-radius: 999px;
  background: var(--primary);
  flex-shrink: 0;
  transform: translateY(-2px);
}

/* ---------- Home demo ---------- */
.demo-grid-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
}

@media (min-width: 900px) {
  .demo-grid-wrap {
    flex-direction: row;
  }
  .demo-copy {
    text-align: left;
  }
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  flex-shrink: 0;
}

.demo-grid figure {
  margin: 0;
  text-align: center;
}

.demo-grid canvas {
  border-radius: 16px;
  width: 128px;
  height: 128px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  box-shadow: var(--shadow);
}

.demo-grid figcaption {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.demo-copy h2 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.demo-copy p {
  color: var(--muted);
  font-size: 0.9rem;
}

.demo-hues {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.hue-dots {
  display: inline-flex;
  gap: 0.3rem;
}

.hue-dots i {
  height: 16px;
  width: 16px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow);
}

/* ---------- Swatch strip ---------- */
.swatch-strip {
  display: flex;
  overflow: hidden;
  border-radius: 999px;
  height: 8px;
  margin-bottom: 1.1rem;
}

.swatch-strip i {
  flex: 1;
}

/* ---------- History ---------- */
.history-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .history-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.history-icon {
  height: 2.2rem;
  width: 2.2rem;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-info {
  min-width: 0;
  flex: 1;
}

.history-title {
  font-size: 0.85rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

/* ---------- FAQ ---------- */
.faq-card details {
  border-top: 1px solid var(--border);
}

.faq-card details:first-of-type {
  border-top: 0;
}

.faq-card summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 0.92rem;
  padding: 0.8rem 0.2rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.faq-card summary::-webkit-details-marker {
  display: none;
}

.faq-card summary::after {
  content: "▾";
  color: var(--muted);
  transition: transform 0.2s ease;
}

.faq-card details[open] summary::after {
  transform: rotate(180deg);
}

.faq-card details p {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0 0.2rem 0.9rem;
}

/* ---------- Alerts ---------- */
.alert {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
}

.alert-title {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.alert-desc {
  color: var(--muted);
  font-size: 0.85rem;
}

.alert-warn {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
  background: var(--warn-soft);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .alert-warn { border-color: var(--warn); }
}

/* ---------- Intro pages ---------- */
.back-btn {
  margin-bottom: 0.75rem;
}

.intro-head {
  margin-bottom: 1.75rem;
}

.intro-head h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.tips-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .tips-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.tip-card {
  margin-bottom: 0;
  padding: 1rem;
}

.tip-card p {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.6rem 0;
}

.start-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

@media (min-width: 560px) {
  .start-row {
    flex-direction: row;
  }
  .start-note {
    text-align: left;
  }
}

.start-note {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.family-title {
  font-size: 1rem;
  margin-bottom: 0.9rem;
}

.family-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.family-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.8rem 0.35rem 0.45rem;
}

.family-pill .pips {
  display: inline-flex;
}

.family-pill .pips i {
  height: 16px;
  width: 16px;
  border-radius: 999px;
  border: 1px solid var(--surface);
  display: inline-block;
}

.family-pill .pips i + i {
  margin-left: -4px;
}

.family-pill span.label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: capitalize;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 650;
  font-size: 0.92rem;
  padding: 0.65rem 1.15rem;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease,
    box-shadow 0.15s ease;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
.key:focus-visible,
.brand:focus-visible,
.theme-toggle:focus-visible,
.vib-opt:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
}

.btn-lg {
  min-height: 48px;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
  margin-top: auto;
}

/* ---------- Test runner (shared) ---------- */
.test-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 1.8rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #e08a4a);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress.thin {
  height: 6px;
  margin-bottom: 0;
}

.fill-good { background: var(--good); }
.fill-primary { background: var(--primary); }
.fill-warn { background: var(--warn); }

.test-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.q-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 1.4rem;
  text-align: center;
}

.q-title.center {
  margin-top: 0;
  margin-bottom: 1rem;
}

.q-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.3rem;
  text-align: center;
  margin-bottom: 0.4rem;
}

/* Plate frame — neutral surround kept theme-independent on purpose */
.plate-frame {
  background: #c4c2be;
  border-radius: 24px;
  padding: 14px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.18);
}

#cv-canvas {
  display: block;
  border-radius: 16px;
}

/* Response box */
.response {
  margin-top: 1.1rem;
  width: 11rem;
  height: 4rem;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.response.empty {
  color: color-mix(in srgb, var(--muted) 40%, transparent);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .response.empty { color: var(--border); }
}

/* Keypad */
.keypad {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  width: 100%;
  max-width: 22rem;
}

.key {
  height: 3rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease;
}

.key:hover:not(:disabled) {
  background: var(--border);
}

.key:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.key-ghost {
  background: transparent;
  font-size: 1rem;
}

.key-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-size: 0.95rem;
}

.key-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.nothing-btn {
  margin-top: 0.75rem;
}

/* ---------- VIBGYOR runner ---------- */
.swatch-frame {
  background: #c4c2be;
  border-radius: 24px;
  padding: 20px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.18);
  width: 100%;
}

.swatch {
  height: 11rem;
  border-radius: 16px;
  border: 4px solid #c4c2be;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  transition: background-color 0.2s ease;
}

@media (min-width: 640px) {
  .swatch {
    height: 14rem;
  }
}

.vib-options {
  margin-top: 1.4rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  width: 100%;
}

@media (min-width: 640px) {
  .vib-options {
    grid-template-columns: repeat(4, 1fr);
  }
}

.vib-opt {
  justify-content: flex-start;
  height: 3.4rem;
  padding-left: 0.9rem;
  font-weight: 600;
}

.vib-dot {
  height: 1.4rem;
  width: 1.4rem;
  border-radius: 999px;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow);
  margin-right: 0.55rem;
  flex-shrink: 0;
}

/* ---------- Results ---------- */
.results-head {
  text-align: center;
  margin-bottom: 1.8rem;
}

.results-head h1 {
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.results-head .lead {
  font-size: 0.95rem;
  margin-top: 0.6rem;
}

.badges {
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.65rem;
  border: 1px solid transparent;
}

.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.neutral { background: var(--surface-2); color: var(--muted); }
.badge.outline { border-color: var(--border); color: var(--muted); background: transparent; }
.badge.primary { background: var(--primary-soft); color: var(--primary); }

/* Score ring */
.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
}

@media (min-width: 640px) {
  .score-card {
    flex-direction: row;
  }
}

.ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ring svg {
  display: block;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ring-total {
  color: var(--muted);
  font-weight: 600;
  font-size: 1.1rem;
}

.ring-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.axes {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.axis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.axis-stat {
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.axis-stat.ok { color: var(--good); }
.axis-stat.miss { color: var(--primary); }

.muted-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.9rem;
}

/* Difficulty pairs */
.pair-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

@media (min-width: 560px) {
  .pair-item {
    flex-direction: row;
    align-items: center;
  }
}

.pair-info {
  flex: 1;
}

.pair-name {
  font-size: 0.88rem;
  font-weight: 700;
}

.pair-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.pair-chips {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.chips {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.chips-label {
  font-size: 0.78rem;
  font-weight: 600;
  margin-right: 0.1rem;
}

.chips-row {
  display: inline-flex;
}

.chip {
  height: 20px;
  width: 20px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow);
  display: inline-block;
}

.chip + .chip {
  margin-left: -6px;
}

.vs {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.none-box {
  border: 1px solid color-mix(in srgb, var(--good) 40%, var(--border));
  background: var(--good-soft);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  display: flex;
  gap: 0.7rem;
  font-size: 0.85rem;
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .none-box { border-color: var(--good); }
}

.none-box .tick {
  color: var(--good);
  font-weight: 800;
  flex-shrink: 0;
}

.none-box p.sub {
  color: var(--muted);
  margin-top: 0.25rem;
  font-size: 0.8rem;
}

/* Points list */
.points {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.points li {
  display: flex;
  gap: 0.65rem;
  font-size: 0.88rem;
  align-items: baseline;
}

.points li::before {
  content: "";
  height: 6px;
  width: 6px;
  border-radius: 999px;
  background: var(--primary);
  flex-shrink: 0;
  transform: translateY(-2px);
}

.points {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Simulation grid */
.sim-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .sim-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.sim-grid figure {
  margin: 0;
  text-align: center;
}

.sim-grid canvas {
  border-radius: 16px;
  width: 100%;
  max-width: 150px;
  height: auto;
  aspect-ratio: 1 / 1;
  box-shadow: var(--shadow);
}

.sim-grid figcaption {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

/* Plate-by-plate review */
.scrollarea {
  max-height: 24rem;
  overflow-y: auto;
  padding-right: 0.4rem;
  margin-right: -0.4rem;
}

.scrollarea::-webkit-scrollbar {
  width: 8px;
}

.scrollarea::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.scrollarea::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.review-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.5rem;
  background: var(--surface);
}

.review-row summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}

.review-row summary::-webkit-details-marker {
  display: none;
}

.mini-plate {
  background: #c4c2be;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.mini-plate canvas {
  display: block;
}

.review-main {
  flex: 1;
  min-width: 0;
}

.review-kind {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  font-weight: 700;
}

.review-line {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chevron {
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.review-row[open] .chevron {
  transform: rotate(180deg);
}

.review-body {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 12px 12px;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
}

.review-body p {
  color: var(--text);
}

.review-chips {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

/* VIBGYOR results */
.fam-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .fam-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.fam-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
}

.fam-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.fam-dot {
  height: 18px;
  width: 18px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow);
}

.fam-name {
  font-size: 0.88rem;
  font-weight: 700;
  flex: 1;
}

.fam-score {
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fam-score.ok { color: var(--good); }
.fam-score.miss { color: var(--primary); }

.fam-shades {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.shade {
  flex: 1;
}

.shade-block {
  position: relative;
  height: 28px;
  border-radius: 7px;
  border: 2px solid transparent;
  opacity: 0.95;
}

.shade-block.miss {
  border-color: var(--primary);
}

.shade-x {
  position: absolute;
  top: -6px;
  right: -6px;
  height: 15px;
  width: 15px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.shade-label {
  display: block;
  text-align: center;
  font-size: 0.6rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.fam-misses {
  font-size: 0.72rem;
  color: var(--muted);
}

/* Confusion cards */
.confusion {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.6rem;
}

.confusion-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.confusion-side {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.confusion-side .dot {
  height: 20px;
  width: 20px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow);
}

.confusion-arrow {
  color: var(--muted);
  font-weight: 700;
}

.confusion-count {
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  color: var(--muted);
}

.confusion-note {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Observer agreement */
.agree-row {
  margin-bottom: 1rem;
}

.agree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  gap: 0.5rem;
}

.agree-stat {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.agree-stat .soft {
  font-weight: 400;
  opacity: 0.75;
}

.callout {
  margin-top: 1.2rem;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .callout { border-color: var(--primary); }
}

.callout p.title {
  font-weight: 700;
}

.callout p.body {
  color: var(--muted);
  margin-top: 0.25rem;
}

/* Result actions */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.5rem;
}

@media (min-width: 560px) {
  .result-actions {
    flex-direction: row;
  }
  .result-actions .btn {
    flex: 1;
  }
}

/* ---------- Footer (sticky) ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.footer-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: center;
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    text-align: left;
  }
}

.footer-note {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 34rem;
}

.footer-dots {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.footer-dots-row {
  display: inline-flex;
  gap: 0.3rem;
}

.footer-dots-row i {
  height: 8px;
  width: 8px;
  border-radius: 999px;
  display: inline-block;
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
