/* Morph Quiz – shared tokens and components (EY-Parthenon palette only) */
:root {
  --ey-offblack: #2e2e38;
  --ey-black: #000000;
  --ey-white: #ffffff;
  --ep-blue: #1a9afa;
  --gray-1: #c4c4cd;
  --gray-2: #747480;
  --ok: #3dbe7a;
  --err: #e5484d;

  --bg: var(--ey-offblack);
  --bg-deep: rgba(0, 0, 0, 0.22); /* Confident Black over Off Black, for wells */
  --fg: var(--ey-white);
  --muted: var(--gray-1);
  --line: var(--gray-2);
  --accent: var(--ep-blue);

  --radius: 4px;
  --tap: 52px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: 'EYInterstate', 'Interstate', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

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

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ── brand ── */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}
.brand img {
  height: 28px;
  width: auto;
}
.wordmark {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wordmark::before {
  content: '';
  width: 4px;
  height: 1.1em;
  background: var(--accent);
}

/* Eyebrow: the small uppercase line-led label used throughout */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--accent);
}

/* ── buttons ── */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 0 22px;
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s var(--ease), background 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active {
  transform: scale(0.97);
}
.btn[disabled],
.btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ey-offblack); /* 4.5:1 on blue – white on blue fails contrast */
}
.btn-primary:hover:not([disabled]) {
  filter: brightness(1.1);
}
.btn-ghost {
  border-color: var(--line);
  color: var(--fg);
}
.btn-ghost:hover:not([disabled]) {
  border-color: var(--fg);
}
.btn-link {
  border: 0;
  padding: 0 6px;
  min-height: 44px;
  color: var(--accent);
  font-weight: 600;
  background: none;
}
.btn-danger {
  border-color: var(--err);
  color: var(--err);
}
.btn-block {
  width: 100%;
}
.btn-small {
  min-height: 40px;
  padding: 0 14px;
  font-size: 15px;
}
.icon-btn {
  appearance: none;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--fg);
  cursor: pointer;
  font-size: 20px;
}
.icon-btn:hover {
  border-color: var(--line);
}

/* ── form fields ── */
.field {
  display: grid;
  gap: 6px;
}
.field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.input {
  appearance: none;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-deep);
  color: var(--fg);
  font: inherit;
  font-size: 18px; /* ≥16px stops iOS zooming on focus */
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input::placeholder {
  color: var(--gray-2);
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.input[readonly] {
  border-style: dashed;
  color: var(--muted);
}

/* ── misc components ── */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg);
}
.card-accent {
  border-left: 4px solid var(--accent);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip.is-done {
  border-color: var(--accent);
  color: var(--fg);
}
.chip.is-done::after {
  content: '✓';
  color: var(--accent);
  font-weight: 700;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-2);
  flex: none;
}
.dot.on {
  background: var(--ok);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--ey-offblack);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tick,
.cross {
  display: inline-grid;
  place-items: center;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85em;
  flex: none;
}
.tick {
  background: var(--ok);
  color: var(--ey-black);
}
.cross {
  background: var(--err);
  color: var(--ey-black);
}

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

/* Connection banner */
.conn-banner {
  position: fixed;
  z-index: 50;
  left: 0;
  right: 0;
  top: 0;
  padding: calc(8px + var(--safe-top)) 16px 8px;
  background: var(--ey-black);
  border-bottom: 2px solid var(--err);
  color: var(--fg);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  transform: translateY(-110%);
  transition: transform 0.3s var(--ease);
}
.conn-banner.show {
  transform: none;
}
.conn-banner .spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid var(--gray-2);
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -1px;
}

/* Toasts */
.toasts {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--ey-black);
  border-left: 4px solid var(--accent);
  color: var(--fg);
  font-size: 15px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.3s var(--ease);
}
.toast.error {
  border-left-color: var(--err);
}

.pulse {
  animation: pulse 1.6s ease-in-out infinite;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}
@keyframes image-in {
  from {
    opacity: 0;
    transform: scale(1.06);
    filter: blur(18px) grayscale(1);
  }
  60% {
    filter: blur(0) grayscale(0.4);
  }
}
@keyframes pop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  60% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}
@keyframes draw-line {
  from {
    transform: scaleX(0);
  }
}

@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;
  }
}
