:root{
  --good:#2E7D5B;
  --bad:#9D493C;
}

body{
  background:
    radial-gradient(circle at 20% 20%,rgba(30,92,74,.04),transparent 35%),
    radial-gradient(circle at 80% 60%,rgba(224,166,58,.05),transparent 40%),
    var(--parchment-light);
}

main{
  max-width:900px;
  margin:0 auto;
  padding:118px 24px 72px;
}

.quiz-head{
  margin-bottom:24px;
}
.kicker{
  display:inline-block;
  color:var(--leaf);
  font-size:.78rem;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:1.2px;
  margin-bottom:10px;
}
.quiz-head h1{
  margin:0 0 10px;
  color:var(--forest-deep);
  font-size:clamp(2rem,5vw,3rem);
  line-height:1.05;
}
.quiz-head p{
  margin:0;
  color:var(--ink-soft);
  line-height:1.6;
  max-width:680px;
}

.status{
  background:var(--parchment);
  border:1px solid rgba(43,33,24,.07);
  border-radius:16px;
  padding:16px 18px;
  margin-bottom:22px;
}
.status-top{
  display:flex;
  justify-content:space-between;
  gap:18px;
  font-weight:800;
  color:var(--forest-deep);
  font-size:.9rem;
  margin-bottom:10px;
}
.progress{
  height:10px;
  border-radius:999px;
  background:rgba(30,92,74,.10);
  overflow:hidden;
}
.progress-bar{
  width:10%;
  height:100%;
  border-radius:inherit;
  background:linear-gradient(90deg,var(--leaf),var(--river-deep));
  transition:width .3s ease;
}

.quiz-card{
  background:#fffdf7;
  border:1px solid rgba(43,33,24,.08);
  border-radius:var(--radius);
  padding:clamp(22px,5vw,38px);
  box-shadow:0 18px 50px rgba(18,54,44,.08);
}
.q-num{
  display:block;
  color:var(--gold);
  font-weight:900;
  font-size:.78rem;
  text-transform:uppercase;
  letter-spacing:1px;
  margin-bottom:10px;
}
.quiz-card h2{
  margin:0 0 10px;
  font-size:clamp(1.45rem,4vw,2rem);
  color:var(--forest-deep);
  line-height:1.18;
}
.prompt{
  margin:0 0 24px;
  color:var(--ink-soft);
  line-height:1.6;
}

.options{
  display:grid;
  gap:12px;
}
.option{
  width:100%;
  text-align:left;
  border:1.5px solid rgba(43,33,24,.14);
  background:var(--parchment-light);
  border-radius:14px;
  padding:15px 17px;
  color:var(--ink);
  font-weight:750;
  transition:border-color .15s,transform .15s,background .15s;
}
.option:hover{
  border-color:var(--leaf);
  transform:translateY(-1px);
}
.option.selected{
  border-color:var(--forest);
  background:rgba(47,168,138,.11);
}
.option:disabled{
  cursor:default;
  opacity:.9;
  transform:none;
}

.truefalse{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.order-help{
  color:var(--ink-soft);
  font-size:.9rem;
  margin:-8px 0 14px;
}
.order-bank,.order-picked{
  display:grid;
  gap:10px;
}
.order-picked{
  counter-reset:item;
  margin-bottom:14px;
}
.order-picked .order-item::before{
  counter-increment:item;
  content:counter(item);
  width:28px;
  height:28px;
  border-radius:50%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-right:10px;
  background:var(--forest);
  color:#fff;
  font-weight:900;
  flex:0 0 28px;
}
.order-item{
  display:flex;
  align-items:center;
  width:100%;
  border:1px solid rgba(43,33,24,.13);
  border-radius:12px;
  background:var(--parchment-light);
  padding:12px 14px;
  text-align:left;
  color:var(--ink);
}
.order-item:hover{border-color:var(--leaf)}
.order-item.used{
  opacity:.42;
  cursor:default;
}
.order-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:12px;
}

.match-grid{
  display:grid;
  gap:14px;
}
.match-row{
  display:grid;
  grid-template-columns:minmax(150px,.7fr) minmax(220px,1.3fr);
  gap:12px;
  align-items:center;
}
.match-label{
  font-weight:900;
  color:var(--forest-deep);
}
.match-row select{
  width:100%;
  min-height:46px;
  border:1px solid rgba(43,33,24,.16);
  border-radius:12px;
  background:var(--parchment-light);
  color:var(--ink);
  padding:9px 12px;
}

#nextBtn{display:none}

.actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:24px;
  flex-wrap:wrap;
}
.btn{
  border:0;
  border-radius:999px;
  padding:13px 22px;
  font-weight:900;
}
.btn-primary{
  background:var(--forest);
  color:#fff;
}
.btn-secondary{
  background:transparent;
  color:var(--forest-deep);
  border:1.5px solid rgba(43,33,24,.22);
}
.btn:disabled{
  opacity:.45;
  cursor:not-allowed;
}

.feedback{
  display:none;
  margin-top:22px;
  border-radius:14px;
  padding:15px 17px;
  line-height:1.5;
  font-weight:700;
}
.feedback.show{display:block}
.feedback.good{
  background:rgba(46,125,91,.11);
  border:1px solid rgba(46,125,91,.25);
  color:#205b42;
}
.feedback.bad{
  background:rgba(157,73,60,.09);
  border:1px solid rgba(157,73,60,.22);
  color:#7c382f;
}

.score-note{
  display:block;
  margin-top:6px;
  font-size:.85rem;
  opacity:.82;
}

.final-wrap{
  display:none;
  padding:8px 0 12px;
}
.final-wrap.show{display:block}
.scroll{
  position:relative;
  max-width:700px;
  margin:0 auto;
  padding:58px clamp(28px,7vw,72px);
  text-align:center;
  background:
    radial-gradient(circle at 30% 20%,rgba(255,255,255,.34),transparent 28%),
    repeating-linear-gradient(0deg,rgba(111,72,30,.035) 0 1px,transparent 1px 5px),
    #efd7a1;
  color:#3e2d1f;
  border:1px solid rgba(96,63,29,.23);
  border-radius:18px 18px 14px 14px;
  box-shadow:0 22px 60px rgba(53,37,22,.16);
}
.scroll::before,.scroll::after{
  content:"";
  position:absolute;
  left:4%;
  right:4%;
  height:18px;
  border-radius:50%;
  background:rgba(130,87,39,.14);
  filter:blur(.2px);
}
.scroll::before{top:8px}
.scroll::after{bottom:8px}
.scroll .seal{
  width:58px;
  height:58px;
  border-radius:50%;
  margin:0 auto 16px;
  display:grid;
  place-items:center;
  background:var(--forest);
  color:#fff;
  font-size:1.65rem;
  border:4px double rgba(255,255,255,.5);
}
.scroll h2{
  margin:0 0 10px;
  color:#46301e;
  font-size:clamp(2rem,6vw,3rem);
}
.final-title{
  font-size:1.2rem;
  font-weight:900;
  color:var(--forest-deep);
  margin-bottom:18px;
}
.final-score{
  font-size:clamp(2.5rem,9vw,4.6rem);
  line-height:1;
  font-weight:950;
  color:var(--forest-deep);
  margin:12px 0 8px;
}
.final-text{
  max-width:520px;
  margin:0 auto 24px;
  line-height:1.6;
}
.final-actions{
  display:flex;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
}

@media(max-width:620px){
  main{padding:104px 16px 54px}
  .truefalse{grid-template-columns:1fr}
  .match-row{grid-template-columns:1fr}
  .status-top{font-size:.84rem}
  .actions{justify-content:stretch}
  .actions .btn{width:100%}
}

@media(prefers-reduced-motion:reduce){
  *{scroll-behavior:auto!important;transition:none!important}
}


.btn[aria-disabled="true"]{
  pointer-events:none;
  opacity:.45;
}

.certificate-panel{
  margin:26px auto 28px;
  padding:24px 22px;
  border-radius:18px;
  background:rgba(255,255,255,.34);
  border:1px solid rgba(96,63,29,.18);
}

.certificate-panel h3{
  margin:0 0 10px;
  color:var(--forest-deep);
  font-size:1.35rem;
}

.certificate-copy{
  max-width:560px;
  margin:0 auto 18px;
  color:#5b4631;
  line-height:1.55;
}

.certificate-preview-frame{
  display:flex;
  justify-content:center;
  align-items:center;
  min-height:220px;
}

.certificate-preview-static{
  width:min(100%, 320px);
  height:auto;
  filter:drop-shadow(0 20px 30px rgba(53,37,22,.18));
}

.certificate-fallback{
  max-width:520px;
  margin:16px auto 0;
  padding:16px 18px;
  border-radius:14px;
  background:rgba(157,73,60,.09);
  border:1px solid rgba(157,73,60,.18);
  color:#7c382f;
  line-height:1.55;
}

.certificate-name-field{
  max-width:320px;
  margin:22px auto 0;
  text-align:left;
}

.certificate-name-field label{
  display:block;
  margin-bottom:8px;
  font-size:.85rem;
  font-weight:700;
  color:#5b4631;
}

.certificate-name-field input{
  width:100%;
  min-height:46px;
  border:1px solid rgba(96,63,29,.28);
  border-radius:12px;
  background:#fffdf7;
  color:#3e2d1f;
  padding:9px 14px;
  font:inherit;
}

.certificate-name-field input:focus{
  outline:2px solid var(--leaf);
  outline-offset:1px;
}

.certificate-actions{
  display:flex;
  justify-content:center;
  margin-top:18px;
}
