/* Reflex Hammer tool — theme + layout.
   Same design language as the stethoscope (cream buttons, verdict card,
   tap-to-start intro); only the palette (green) and the hero interaction
   (tap-to-bonk + grading) differ. */

/* Green re-theme. tokens.css invites per-tool overrides; we keep the cream
   buttons/cards from tokens and just swap the background family to green. */
:root {
  --color-bg-center: #bcd76a;
  --color-bg-edge: #88ab44;
}

body {
  background: radial-gradient(circle at 50% 40%,
    var(--color-bg-center) 0%, var(--color-bg-edge) 88%);
}

/* Faint heart/star pattern, recreated in CSS via an inline-SVG tile (no image
   asset). Sits behind everything; the app content layers above it. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='150' height='150' viewBox='0 0 150 150'><g fill='%23335507'><path transform='translate(16,14) scale(0.85)' d='M12 21C12 21 3 14 3 8.5 3 5.4 5.4 3 8.5 3 10.3 3 11.6 4 12 5 12.4 4 13.7 3 15.5 3 18.6 3 21 5.4 21 8.5 21 14 12 21 12 21Z'/><path transform='translate(94,82) scale(0.85)' d='M12 2 14.6 8.6 21.6 9.2 16.3 13.8 18 20.6 12 16.9 6 20.6 7.7 13.8 2.4 9.2 9.4 8.6Z'/><path transform='translate(104,18) scale(0.5)' d='M12 2 14.6 8.6 21.6 9.2 16.3 13.8 18 20.6 12 16.9 6 20.6 7.7 13.8 2.4 9.2 9.4 8.6Z'/><path transform='translate(20,94) scale(0.5)' d='M12 21C12 21 3 14 3 8.5 3 5.4 5.4 3 8.5 3 10.3 3 11.6 4 12 5 12.4 4 13.7 3 15.5 3 18.6 3 21 5.4 21 8.5 21 14 12 21 12 21Z'/></g></svg>");
  background-size: 150px 150px;
}

.app { position: relative; z-index: 1; }

/* ---- Screens ----
   The two in-app screens (hammer, grading) are stacked absolutely and
   cross-fade. The intro and verdict card are separate fixed overlays. */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  transition: opacity 450ms ease;
}

/* Grading hidden until we advance; hammer screen hidden once we do.
   visibility (delayed) keeps the hidden screen out of the tap path. */
.grading-screen {
  opacity: 0;
  visibility: hidden;
  transition: opacity 450ms ease, visibility 0s linear 450ms;
}
.app.grading .grading-screen {
  opacity: 1;
  visibility: visible;
  transition: opacity 450ms ease;
}
.app.grading .hammer-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 450ms ease, visibility 0s linear 450ms;
}

/* Dim the active screen behind the terminal verdict card (declared after the
   .grading rules so it wins when both classes are present). */
.app.complete .grading-screen {
  opacity: 0.28;
  pointer-events: none;
}

/* Dim the hammer screen behind the instruction card. */
.app.instructing .hammer-screen {
  opacity: 0.28;
  pointer-events: none;
}

/* In-flow footer pinned to the bottom of each screen. */
.screen .footer-disclaimer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 8px);
  margin: 0;
}

/* ---- Hammer (hero) ---- */
.hammer-btn {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  display: block;
  width: min(83vw, 414px); /* ~15% larger than min(72vw,360px); flex-centred so it grows from the centre */
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.hammer {
  width: 100%;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  transform-origin: center;
  will-change: transform;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.28));
  -webkit-user-drag: none;
  user-select: none;
  /* Gentle idle wiggle invites the first tap; removed once play begins. */
  animation: hammer-idle 2.4s ease-in-out infinite;
}
.app.played .hammer { animation: none; }
@keyframes hammer-idle {
  0%, 100% { transform: rotate(-1.6deg); }
  50% { transform: rotate(1.6deg); }
}

/* ---- Nurse Dolly clipboard (advance affordance) ---- */
/* Always present on the hammer screen; only hidden while the instruction card
   is up (so it can't be tapped behind/around the card). */
.dolly {
  position: absolute;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 5;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  width: min(31vw, 140px);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 500ms ease, transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25));
}
.app.instructing .dolly {
  opacity: 0;
  transform: translateY(14px) scale(0.9);
  pointer-events: none;
}
.dolly:active { transform: scale(0.94); }
.dolly-img {
  width: 100%;
  height: auto;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
}

/* "All done!" label under Dolly — same font/size/colour + relative spacing as
   the stethoscope app's version, centred under the clipboard (which sits ~0.25×
   the image width above the PNG's bottom). Visual only; fades with Dolly. */
.alldone {
  position: absolute;
  right: calc(max(10px, env(safe-area-inset-right)) + min(31vw, 140px) / 2);
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + min(31vw, 140px) * 0.25 - 22px);
  transform: translateX(50%);
  z-index: 5;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
  font-family: var(--font-rounded);
  font-weight: 700;
  font-size: clamp(11px, 1.85svh, 15px);
  letter-spacing: 0.01em;
  color: #4e2e1a;
  opacity: 1;
  transition: opacity 500ms ease;
}
.app.instructing .alldone { opacity: 0; }

/* ---- Grading screen ---- */
.grade-prompt {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 7%);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0 9vw;
  text-align: center;
  font-weight: 800;
  font-size: 26px;
  line-height: 1.3;
  color: var(--color-text-on-dark);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.grade-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(18px, 6vw, 30px);
  width: min(84vw, 360px);
}
.grade {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.grade-icon {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 150px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--color-cream);
  font-size: clamp(42px, 14vw, 66px);
  line-height: 1;
  box-shadow: 0 6px 0 var(--color-cream-edge), 0 10px 18px rgba(0, 0, 0, 0.28);
  transition: transform 90ms ease, box-shadow 90ms ease;
}
.grade:active .grade-icon {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--color-cream-edge), 0 6px 12px rgba(0, 0, 0, 0.28);
}
.grade-label {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--color-text-on-dark);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ---- Intro overlay (same treatment as the stethoscope) ---- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #b6d56a;          /* green-family hold color while the video loads */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 600ms ease;
}
/* Scrim so the caption + button stay legible against any video content. */
.intro::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
  z-index: 1;
}
.intro.hide {
  opacity: 0;
  pointer-events: none;
}
.intro-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.intro-cta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 7%);
  z-index: 2;                   /* above the scrim */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.intro-caption {
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: 38px;
  letter-spacing: 0.005em;
  color: var(--color-cream);
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.55);
}
.intro-hint {
  margin: 0;
  padding: 13px 28px;
  background: var(--color-cream);
  color: var(--color-button-text);
  font: 700 18px/1 inherit;
  letter-spacing: 0.04em;
  border-radius: 999px;
  box-shadow: 0 5px 0 var(--color-cream-edge), 0 10px 18px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  animation: hint-bob 1.6s ease-in-out infinite;
  transition: opacity 250ms ease;
}
.intro-hint.hide {
  opacity: 0;
  animation: none;
}
@keyframes hint-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.intro-skip {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 14px);
  right: calc(env(safe-area-inset-right) + 14px);
  z-index: 2;
  width: 46px;
  height: 46px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--color-button-text);
  color: var(--color-cream);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
  opacity: 0.92;
}
.intro-skip:hover,
.intro-skip:focus-visible { opacity: 1; }
.intro-skip:active {
  transform: scale(0.92);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.intro-skip-icon {
  display: block;
  width: 60%;
  height: 60%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
}

/* ---- Instruction card (same cream card shell as the verdict card) ---- */
.instruction-card {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 50;
  width: min(86vw, 400px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px 28px;
  background: var(--color-cream);
  border-radius: 28px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, calc(-50% + 10vh));
  opacity: 0;
  visibility: hidden;
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 450ms ease,
              visibility 0s linear 600ms;
}
.app.instructing .instruction-card {
  transform: translate(-50%, -50%);
  opacity: 1;
  visibility: visible;
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 400ms ease;
}
.instruction-thump {
  width: 132px;
  height: auto;
  margin-bottom: -4px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.2));
}
.instruction-title {
  margin: 2px 0 0;
  text-align: center;
  font-weight: 800;
  font-size: 25px;
  line-height: 1.2;
  color: var(--color-button-text);
}
.instruction-body {
  margin: 0;
  text-align: center;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.4;
  color: var(--color-button-text);
}
/* Smaller, grownup-facing aside. */
.instruction-grownup {
  margin: -2px 0;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
  color: var(--color-button-text);
  opacity: 0.6;
}
/* ---- Verdict card (same pattern as the stethoscope) ---- */
.verdict-card {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 50;
  width: min(86vw, 400px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px 28px;
  background: var(--color-cream);
  border-radius: 28px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, calc(-50% + 10vh));
  opacity: 0;
  visibility: hidden;
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 450ms ease,
              visibility 0s linear 600ms;
}
.app.complete .verdict-card {
  transform: translate(-50%, -50%);
  opacity: 1;
  visibility: visible;
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 400ms ease;
}
.verdict-thump {
  width: 124px;
  height: auto;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.2));
}
.verdict-label {
  margin: 4px 0 -4px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-button-text);
  opacity: 0.55;
}
/* The chosen grade, big and bold with its emoji. */
.verdict-grade {
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: 27px;
  line-height: 1.2;
  color: var(--color-button-text);
}
/* Dr. Thump's instruction for the grownup. */
.verdict-orders {
  margin: 0;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.4;
  color: var(--color-button-text);
  opacity: 0.85;
}
.verdict-orders strong {
  font-weight: 800;
  opacity: 1;
}
/* The fun line the grownup has to perform — the star of the card. */
.verdict-quote {
  margin: 2px 0;
  text-align: center;
  font-weight: 800;
  font-size: 22px;
  line-height: 1.3;
  color: var(--color-button-text);
}
.verdict-divider {
  width: 56px;
  height: 2px;
  border-radius: 1px;
  background: var(--color-button-text);
  opacity: 0.22;
  margin: 6px 0;
}
.verdict-return {
  margin: 0;
  text-align: center;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.4;
  color: var(--color-button-text);
  opacity: 0.75;
}
