/* ===== Generic cards & buttons ===== */
.card {
  background: var(--card); border: var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 26px;
}
.card h3 { margin: 0 0 10px; font-size: 30px; font-weight: 800; }
.card p { margin: 0; }
.card p + p { margin-top: 8px; }
.card--tape { background: var(--tape-l); }
.card--green { background: var(--green-l); }
.card--terra { background: var(--terra-l); }
.card--sky { background: var(--sky-l); }
.card--oak { background: var(--oak-l); }
.card--tilt-l { transform: rotate(-1.2deg); }
.card--tilt-r { transform: rotate(1.2deg); }
.hint { margin: 0; font-size: 22px; color: var(--muted); }
.sub { margin: 0; font-size: 32px; font-weight: 800; }
.nowrap { flex-wrap: nowrap; align-items: stretch; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 24px; border: var(--line); border-radius: 18px; background: var(--card);
  font-size: 26px; font-weight: 700; box-shadow: var(--shadow-sm); text-decoration: none; color: var(--ink);
  transition: transform .12s, box-shadow .12s, background .2s;
}
.btn:hover { transform: translate(-1px, -2px); box-shadow: 5px 6px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.btn:focus-visible, .nbtn:focus-visible, .flip:focus-visible, .reveal:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
.btn--tape { background: var(--tape); }
.btn--green { background: var(--green); color: #fff; }
.btn--terra { background: var(--terra); color: #fff; }
.btn--sm { font-size: 20px; padding: 8px 16px; border-radius: 14px; }
.btn.is-done { background: var(--green-l); }

.formula {
  align-self: flex-start; font-size: 64px; font-weight: 800; letter-spacing: 1px;
  padding: 4px 26px; border: var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow-sm);
}
.big-eq { font-size: 36px; font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

/* Click-to-reveal answer */
.reveal {
  display: inline-flex; align-items: center; gap: 8px; min-width: 120px; justify-content: center;
  padding: 2px 16px; border: 3px dashed var(--ink); border-radius: 14px; background: var(--tape-l);
  font-weight: 800; transition: background .2s;
}
.reveal:not(.is-open)::before { content: "❓"; }
.reveal:not(.is-open) > * { display: none; }
.reveal.is-open { border-style: solid; background: var(--green-l); animation: popIn .4s cubic-bezier(.2,.9,.3,1.3); }

/* ===== Flip cards ===== */
.flip { border: 0; padding: 0; background: none; perspective: 900px; text-align: center; }
.flip__inner {
  position: relative; display: block; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3,1.4,.5,1);
}
.flip.is-flipped .flip__inner { transform: rotateY(180deg); }
.flip__face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); padding: 14px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--card);
}
.flip__back { transform: rotateY(180deg); background: var(--green-l); }
.flip:hover .flip__face { box-shadow: 6px 7px 0 var(--ink); }

/* ===== Poll ===== */
.poll { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.poll__opt {
  position: relative; display: flex; justify-content: space-between; align-items: center; overflow: hidden;
  border: var(--line); border-radius: 14px; background: var(--card); padding: 6px 16px; font-size: 24px; font-weight: 600; text-align: left;
}
.poll__opt::before { content: ""; position: absolute; inset: 0; width: var(--p, 0%); background: var(--tape-l); transition: width .4s; z-index: 0; }
.poll__opt.is-top::before { background: var(--tape); }
.poll__opt > * { position: relative; z-index: 1; }
.poll__opt b { font-size: 28px; min-width: 40px; text-align: right; }

/* ===== Answer checker ===== */
.check { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.check input {
  width: 120px; height: 52px; padding: 0 12px; font-size: 28px; font-weight: 700; text-align: center;
  border: var(--line); border-radius: 14px; background: #fff;
}
.check input:focus { outline: 4px solid var(--tape); }
.check.is-ok input { background: var(--green-l); border-color: var(--green); }
.check.is-bad input { background: var(--red-l); animation: shake .4s ease; }
.check__fb { margin: 6px 0 0; min-height: 30px; font-size: 22px; font-weight: 700; }
.hintbtn { font-size: 18px; min-width: 56px; padding: 6px 10px; }
.hintbtn:not(.is-open)::before { content: "💡"; }

/* ===== Photo card with pins ===== */
.photo-card {
  position: relative; margin: 0; align-self: flex-start;
  border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; background: var(--card);
}
.photo-card img { display: block; width: 100%; height: auto; }
.photo-card figcaption { padding: 12px 18px; font-size: 22px; border-top: var(--line); }
.pin {
  position: absolute; padding: 4px 12px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--card); font-size: 19px; font-weight: 700; box-shadow: 3px 3px 0 var(--ink); white-space: nowrap;
}
.slide.is-active .pin { animation: popIn .5s cubic-bezier(.2,.9,.3,1.4) both, bob 2.4s ease-in-out infinite alternate; }
.slide.is-active .pin:nth-of-type(1) { animation-delay: .6s, 1.1s; }
.slide.is-active .pin:nth-of-type(2) { animation-delay: .75s, 1.3s; }
.slide.is-active .pin:nth-of-type(3) { animation-delay: .9s, 1.5s; }
.slide.is-active .pin:nth-of-type(4) { animation-delay: 1.05s, 1.7s; }
.slide.is-active .pin:nth-of-type(5) { animation-delay: 1.2s, 1.9s; }
@keyframes bob { to { transform: translateY(-6px); } }

/* ===== Scoreboard ===== */
.sheet--score { width: min(760px, 100%); }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.score {
  display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 10px;
  padding: 12px 16px; border: var(--line); border-radius: 18px; background: var(--c);
}
.score b { font-size: 24px; }
.score strong { font-size: 44px; min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.score.is-lead { box-shadow: var(--shadow-sm); }
.score.is-lead b::after { content: " 🏆"; }
.score.bump strong { animation: pulse .4s ease; }
