/* Box-Quiz */
@property --c1 { syntax: "<color>"; inherits: true; initial-value: #2e6bff; }
@property --c2 { syntax: "<color>"; inherits: true; initial-value: #7cf0ff; }

html.quiz-open { overflow: hidden; }

.quiz {
  width: min(1120px, calc(100vw - 32px));
  height: min(720px, calc(100dvh - 32px));
  max-width: none; max-height: none;
  padding: 0;
  border: var(--line);
  border-radius: 24px;
  box-shadow: 12px 12px 0 var(--ink);
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  display: none;
}
.quiz[open] { display: grid; grid-template-columns: 0.85fr 1.15fr; animation: quiz-in 500ms var(--ease); }
.quiz::backdrop { background: rgba(20, 18, 16, 0.6); backdrop-filter: blur(6px); }
@keyframes quiz-in { from { opacity: 0; transform: translateY(30px) scale(0.96); } }

/* Left: workbench */
.quiz-bench {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  padding: 28px;
  display: flex; flex-direction: column; gap: 18px;
  background-image: radial-gradient(rgba(244, 239, 228, 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
  overflow: hidden;
}
.quiz-top { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }
.quiz-brand { color: var(--yellow); }
.quiz-progress { height: 10px; border: 2px solid var(--paper); border-radius: 999px; overflow: hidden; }
.quiz-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--yellow), var(--orange)); transition: width 500ms var(--ease); }
.quiz-cube-wrap { flex: 1; display: grid; place-items: center; perspective: 800px; min-height: 200px; position: relative; }
.quiz-cube-wrap::before { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 184, 0, 0.35), transparent 65%); filter: blur(10px); }
.quiz-cube { animation: turn 16s linear infinite; transition: --c1 600ms, --c2 600ms; }
.quiz-cube.pop { animation: quiz-pop 800ms var(--ease), turn 16s linear 800ms infinite; }
@keyframes quiz-pop {
  0% { transform: rotateX(-22deg) rotateY(0) scale(1); }
  40% { transform: rotateX(-22deg) rotateY(200deg) scale(1.25); }
  100% { transform: rotateX(-22deg) rotateY(360deg) scale(1); }
}
.quiz-lead { margin: 0; font-family: var(--font-mono); font-size: 0.85rem; }
.quiz-lead b { color: var(--yellow); font-family: var(--font-display); font-size: 1.2rem; }
.quiz-labels { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; min-height: 64px; align-content: flex-start; }
.quiz-labels li {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  background: var(--paper); color: var(--ink); border: 2px solid var(--paper); border-radius: 6px; padding: 4px 8px;
  transform: rotate(calc((var(--i) - 2) * 1.6deg));
  animation: label-in 400ms var(--ease) both;
}
.quiz-labels li:nth-child(3n+2) { background: var(--yellow); }
.quiz-labels li:nth-child(3n+3) { background: var(--mint); }
@keyframes label-in { from { opacity: 0; transform: translateY(-14px) rotate(-12deg) scale(1.3); } }

/* Right: question */
.quiz-main { position: relative; padding: clamp(28px, 4vw, 56px); display: flex; flex-direction: column; overflow-y: auto; }
.quiz-close { position: absolute; top: 18px; right: 18px; background: var(--paper); z-index: 2; }
.quiz-body { flex: 1; display: flex; }
.quiz-step { width: 100%; display: flex; flex-direction: column; animation: step-in 450ms var(--ease); }
@keyframes step-in { from { opacity: 0; transform: translateX(40px); } }
.quiz-step h2 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.4rem); margin: 0 0 0.3em; padding-right: 48px; }
.quiz-intro { font-family: var(--font-mono); font-size: 0.85rem; background: var(--yellow); border: 2px solid var(--ink); border-radius: 8px; padding: 8px 12px; margin: 0 48px 1rem 0; align-self: flex-start; }
.quiz-hint { margin: -0.4rem 0 1rem; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); text-transform: uppercase; }
.quiz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0.6rem 0 1.6rem; }
.quiz-opt {
  position: relative; text-align: left; font: inherit; cursor: pointer; color: var(--ink);
  background: #fffaf0; border: var(--line); border-radius: 14px; padding: 18px 18px 18px 58px;
  box-shadow: var(--shadow-sm); display: grid; gap: 2px; min-height: 76px; align-content: center;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms;
  animation: opt-in 420ms var(--ease) both; animation-delay: calc(var(--i) * 45ms);
}
@keyframes opt-in { from { opacity: 0; transform: translateY(16px); } }
.quiz-opt:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--ink); }
.quiz-opt:focus-visible { outline: 3px dashed var(--blue); outline-offset: 3px; }
.quiz-opt[aria-pressed="true"] { background: var(--yellow); transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.quiz-opt[aria-pressed="true"] .opt-key { background: var(--ink); color: var(--yellow); }
.quiz-opt[aria-pressed="true"] .opt-key::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; background: var(--ink); border-radius: 4px; }
.opt-key { position: absolute; left: 16px; top: 50%; translate: 0 -50%; width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 8px; display: grid; place-items: center; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; }
.opt-l { font-weight: 800; font-size: 1.15rem; line-height: 1.15; }
.opt-s { font-size: 0.85rem; color: var(--muted); }
.quiz-opts.many .quiz-opt { min-height: 64px; padding-block: 14px; }
.quiz-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: auto; }
.quiz-nav.col { flex-direction: column; margin-top: 0.4rem; }
.quiz-nav [hidden] { visibility: hidden; display: inline-flex; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
.quiz-legal { margin: 1.2rem 0 0; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }

/* Result */
.quiz-result .eyebrow { margin-bottom: 0.2rem; }
.match { display: flex; align-items: baseline; font-weight: 800; line-height: 0.9; letter-spacing: -0.06em; }
.match-pct { font-size: clamp(4.5rem, 3rem + 6vw, 8rem); background: linear-gradient(120deg, var(--orange), var(--pink) 50%, var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.match > span:last-child { font-size: 2.6rem; }
.result-price { margin: 0 0 0.6rem; font-size: 1.1rem; }
.result-why { margin: 0 0 0.8rem; padding: 0; list-style: none; display: grid; gap: 4px; }
.result-why li::before { content: "→ "; font-family: var(--font-mono); color: var(--orange); font-weight: 700; }
.result-prefs { font-size: 0.9rem; background: #fffaf0; border: 2px dashed var(--ink); border-radius: 10px; padding: 10px 12px; margin: 0 0 1rem; }
.result-alts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 1.1rem 0 0.6rem; font-family: var(--font-mono); font-size: 0.8rem; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; color: inherit; font-weight: 700; align-self: flex-start; }

/* Cart prefs */
.cart-item small.prefs { color: #128a55; margin-top: 2px; }
.cart-item small.prefs.open { color: var(--orange); }

/* Header quiz link + hero button */
.nav-quiz { font: inherit; font-weight: 800; background: var(--ink); color: var(--yellow); border: 0; border-radius: 999px; padding: 2px 12px; cursor: pointer; }
.btn-xl { flex-direction: column; gap: 0; padding: 14px 28px; font-size: 1.1rem; }
.btn-sub { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 400; }

@media (max-width: 820px) {
  .quiz { inset: 0; margin: 0; width: 100%; height: 100%; border-radius: 0; border: 0; box-shadow: none; }
  .quiz[open] { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .quiz-bench { padding: 16px 16px 12px; gap: 6px 14px; display: grid; grid-template-columns: 80px 1fr; grid-template-areas: "cube top" "cube bar" "cube lead"; align-items: center; }
  .quiz-top { grid-area: top; padding-right: 44px; }
  .quiz-progress { grid-area: bar; }
  .quiz-lead { grid-area: lead; font-size: 0.75rem; }
  .quiz-lead b { font-size: 1rem; }
  .quiz-cube-wrap { grid-area: cube; min-height: 80px; }
  .quiz-cube-wrap::before { width: 110px; height: 110px; }
  .quiz-cube { --s: 46px; }
  .quiz-labels { display: none; }
  .quiz-main { padding: 22px 16px 18px; position: static; }
  .quiz-close { top: 12px; right: 12px; position: fixed; }
  .quiz-step h2 { padding-right: 0; }
  .quiz-intro { margin-right: 0; }
  .quiz-opts { grid-template-columns: 1fr; gap: 10px; }
  .quiz-opt { min-height: 58px; padding: 12px 14px 12px 54px; }
}
