:root {
  --bg: #0e0e10;
  --panel: #18181b;
  --panel-2: #202024;
  --border: #2f2f35;
  --text: #efeff1;
  --muted: #adadb8;
  --purple: #9147ff;
  --purple-hover: #772ce8;
  --good: #00c878;
  --bad: #ff4f5e;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

.bg-cycler {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top, rgba(145,71,255,.08), transparent 40%),
    linear-gradient(180deg, rgba(14,14,16,.88), rgba(14,14,16,.95));
}

.bg-emote-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 700ms ease;
  background-repeat: repeat;
  background-position: center;
  background-size: 140px 140px;
  filter: grayscale(.08) saturate(.95);
  mix-blend-mode: screen;
}

.bg-emote-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(14,14,16,.78);
}

.bg-emote-layer.is-active {
  opacity: .26;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

a { color: #caa7ff; }

.shell {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 18px 40px;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.08rem;
}

.progress-wrap {
  width: min(250px, 46vw);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.progress-track {
  height: 6px;
  flex: 1;
  background: #2a2a2f;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 10%;
  background: var(--purple);
  transition: width 180ms ease;
}

.panel {
  border: 1px solid var(--border);
  background: rgba(24, 24, 27, .92);
  backdrop-filter: blur(6px);
  padding: clamp(24px, 6vw, 44px);
}

.start-panel {
  margin-top: clamp(40px, 11vh, 120px);
}

.eyebrow, .question-number {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .75rem;
  font-weight: 800;
  margin: 0 0 12px;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.1rem, 8vw, 4.4rem);
  line-height: .96;
  letter-spacing: -0.055em;
  max-width: 650px;
}

.intro, .score-line, .pin-instructions {
  color: var(--muted);
  line-height: 1.5;
  max-width: 580px;
}

.primary-btn, .secondary-btn, .answer-btn {
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn {
  margin-top: 14px;
  padding: 14px 18px;
  background: var(--purple);
  color: white;
}

.primary-btn:hover:not(:disabled) { background: var(--purple-hover); }
.primary-btn:disabled { opacity: .48; cursor: wait; }

.secondary-btn {
  margin-top: 28px;
  padding: 12px 16px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.load-status {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .84rem;
}

#quizView { margin-top: 4vh; }
.question-text {
  font-size: clamp(1.65rem, 5vw, 2.8rem);
  line-height: 1.06;
  letter-spacing: -0.04em;
  margin-bottom: 22px;
}

.question-media {
  min-height: 180px;
  display: grid;
  place-items: center;
  margin: 8px 0 24px;
  background: #111113;
  border: 1px solid var(--border);
  padding: 20px;
}

.question-media > img {
  display: block;
  max-width: min(230px, 70vw);
  max-height: 230px;
  object-fit: contain;
  image-rendering: auto;
}

.answer-area {
  display: grid;
  gap: 10px;
}

.answer-btn {
  width: 100%;
  padding: 14px 16px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  text-align: left;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.answer-btn:hover:not(:disabled) {
  background: #29292e;
  border-color: #4a4a52;
}

.answer-btn:active:not(:disabled) { transform: translateY(1px); }
.answer-btn:disabled { cursor: default; opacity: .75; }

.text-answer-row {
  display: flex;
  gap: 10px;
}

.text-answer {
  min-width: 0;
  flex: 1;
  background: #111113;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 13px 14px;
  outline: none;
}

.text-answer:focus { border-color: var(--purple); }

.submit-btn {
  padding: 0 18px;
  background: var(--purple);
  color: white;
  border: 0;
  font-weight: 800;
  cursor: pointer;
}

.pinpoint-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 18px;
  align-items: start;
}

.pin-block {
  display: grid;
  gap: 10px;
}

.pin-label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
  font-weight: 800;
}

.crop-canvas {
  width: min(240px, 60vw);
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
  background: #0d0d10;
  border: 1px solid var(--border);
}

.pin-target-wrap {
  position: relative;
  display: inline-block;
  width: fit-content;
  cursor: crosshair;
  user-select: none;
}

.pin-target-wrap.disabled {
  cursor: default;
  pointer-events: none;
}

.pin-target {
  display: block;
  max-width: min(360px, 80vw);
  max-height: 360px;
  width: auto;
  height: auto;
  border: 1px solid var(--border);
  background: #0d0d10;
}

.pin-hitbox,
.pin-marker {
  position: absolute;
  pointer-events: none;
}

.pin-hitbox {
  border: 2px solid rgba(145, 71, 255, .95);
  box-shadow: 0 0 0 9999px rgba(145, 71, 255, .06) inset;
}

.pin-marker {
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 999px;
  background: rgba(255, 79, 94, .96);
  border: 2px solid white;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .35);
}


.hint-wrap {
  margin-top: 14px;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hint-btn {
  border: 1px solid #3a3a41;
  background: #141416;
  color: var(--muted);
  padding: 8px 11px;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  text-transform: lowercase;
}

.hint-btn:not(:disabled) {
  color: var(--text);
  border-color: #555560;
}

.hint-btn:not(:disabled):hover {
  background: #202024;
}

.hint-btn:disabled {
  cursor: default;
  opacity: .68;
}

.hint-btn.used {
  opacity: .46;
}

.hint-text {
  margin: 0;
  color: #d8c7f7;
  font-size: .86rem;
  line-height: 1.35;
}

.pin-hint-zone {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  border: 2px dashed rgba(202, 167, 255, .95);
  background: rgba(145, 71, 255, .13);
  transition: opacity 160ms ease;
}

.pin-hint-zone.is-visible {
  opacity: 1;
}

.feedback {
  margin-top: 18px;
  padding: 12px 14px;
  border-left: 4px solid currentColor;
  background: #111113;
  font-weight: 800;
  line-height: 1.35;
}

.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.feedback small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-weight: 600;
}

.score-display {
  font-size: clamp(4rem, 18vw, 8rem);
  line-height: .9;
  letter-spacing: -0.08em;
  font-weight: 900;
  margin: 8px 0 18px;
}

.review-list {
  margin-top: 30px;
  display: grid;
  gap: 12px;
}

.review-card {
  background: #111113;
  border: 1px solid var(--border);
  padding: 16px;
}

.review-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.review-q {
  margin: 0;
  font-weight: 800;
  line-height: 1.35;
}

.result-chip {
  flex: 0 0 auto;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.result-chip.good { color: var(--good); }
.result-chip.bad { color: var(--bad); }

.review-answer {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.45;
}

.review-answer strong { color: var(--text); }
.review-emote {
  margin-top: 12px;
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.review-pinpoint {
  width: 96px;
  height: 96px;
}

.footer {
  margin-top: auto;
  padding-top: 24px;
  color: #777781;
  font-size: .74rem;
  text-align: center;
}

.hidden { display: none !important; }

@media (max-width: 560px) {
  .bg-emote-layer { background-size: 104px 104px; }
  .shell { padding: 14px 12px 28px; }
  .panel { padding: 22px 18px; }
  .topbar { margin-bottom: 10px; }
  .text-answer-row { flex-direction: column; }
  .submit-btn { min-height: 46px; }
  #quizView { margin-top: 1vh; }
  .pinpoint-layout { grid-template-columns: 1fr; }
  .crop-canvas { width: min(240px, 74vw); }
  .pin-target { max-width: 100%; }
}
