/* =============================================================================
 * Class Boss — styles.
 * Tokens and fonts are lifted from the curriculum hub (curriculum/index.html):
 * Nunito for display, Atkinson Hyperlegible for reading. LIGHT ONLY — this site
 * has no dark mode and must never emit a prefers-color-scheme: dark block.
 * ========================================================================== */

:root {
  --navy: #15487f;
  --teal: #205fa6;
  --teal-light: rgba(32, 95, 166, 0.08);
  --green: #256b5b;
  --green-light: rgba(37, 107, 91, 0.1);
  --cream: #eaf0f7;
  --ink: #14223a;
  --muted: #56627a;
  --line: rgba(20, 34, 58, 0.12);
  --card: #ffffff;
  --surface-2: #f3f7fc;
  --danger: #a3341f;
  --radius: 18px;
  --shadow: 0 2px 4px rgba(20, 34, 58, 0.06), 0 12px 30px rgba(20, 34, 58, 0.08);

  /* Overwritten per week by boss.js from the deterministic seed. */
  --boss-1: #3b5bdb;
  --boss-2: #7048e8;
  --boss-glow: #dbe4ff;
  --boss-ink: #10203a;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 520px at 50% -160px, var(--boss-glow), transparent 70%), var(--cream);
  color: var(--ink);
  font-family:
    "Atkinson Hyperlegible",
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 18px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3,
.display {
  font-family: "Nunito", system-ui, sans-serif;
  letter-spacing: -0.01em;
  margin: 0;
}

a {
  color: var(--teal);
}

:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  z-index: 20;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 28px) 64px;
}

/* --- top bar ------------------------------------------------------------ */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--card);
  border: 2px solid var(--line);
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
}
.back-link:hover {
  border-color: var(--teal);
}

.topbar-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill-btn {
  min-height: 44px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.pill-btn:hover {
  border-color: var(--teal);
  background: var(--teal-light);
}
.pill-btn[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* --- headline ----------------------------------------------------------- */
.eyebrow {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  color: var(--teal);
  margin: 0 0 6px;
}

.page-title {
  font-size: clamp(1.9rem, 4.6vw, 3rem);
  font-weight: 900;
  color: var(--navy);
}

.page-sub {
  color: var(--muted);
  margin: 8px 0 0;
  max-width: 62ch;
}

.data-note {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

/* --- layout ------------------------------------------------------------- */
.layout {
  display: grid;
  gap: 22px;
  margin-top: 22px;
  grid-template-columns: 1fr;
}
@media (min-width: 940px) {
  .layout {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: start;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2.4vw, 26px);
}

.card + .card {
  margin-top: 22px;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 10px;
}

/* --- boss stage --------------------------------------------------------- */
.stage {
  text-align: center;
}

.boss-name {
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-weight: 900;
  color: var(--boss-ink);
}

.boss-tagline {
  color: var(--muted);
  margin: 4px 0 14px;
}

.boss-art {
  width: min(100%, 380px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: block;
}

.boss-art .aura {
  fill: var(--boss-2);
  opacity: 0.16;
}
.boss-art .body {
  fill: url(#bossGrad);
  stroke: var(--boss-ink);
  stroke-width: 3;
}
.boss-art .belly {
  fill: #fff;
  opacity: 0.22;
}
.boss-art .spike {
  fill: var(--boss-2);
  stroke: var(--boss-ink);
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.boss-art .eye-white {
  fill: #fff;
  stroke: var(--boss-ink);
  stroke-width: 2.5;
}
.boss-art .pupil {
  fill: var(--boss-ink);
}
.boss-art .mouth {
  fill: var(--boss-ink);
  opacity: 0.85;
}
.boss-art .tooth {
  fill: #fff;
}
.boss-art .rune {
  fill: var(--boss-2);
  opacity: 0.45;
}

/* --- health bar --------------------------------------------------------- */
.hp {
  margin-top: 16px;
}

.hp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  color: var(--navy);
}

.hp-track {
  margin-top: 8px;
  height: 30px;
  border-radius: 999px;
  background: #dfe7f2;
  border: 2px solid var(--navy);
  overflow: hidden;
  position: relative;
}

.hp-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, var(--boss-1), var(--boss-2));
  transition: width 420ms ease;
}

.hp-caption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.98rem;
}

.hp-defeated .hp-fill {
  background: var(--green);
}

.victory {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--green-light);
  border: 2px solid var(--green);
  color: #123c33;
  font-weight: 800;
}

/* --- attacks ------------------------------------------------------------ */
.attacks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.attack {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-left: 8px solid var(--boss-1);
  border-radius: 14px;
  background: var(--surface-2);
}

.attack-no {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #fff;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 900;
  font-size: 1.2rem;
}

.attack-name {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--boss-ink);
}

.attack-label {
  color: var(--muted);
  font-size: 0.98rem;
}

.attack-meta {
  color: var(--teal);
  font-size: 0.88rem;
  font-weight: 700;
  margin-top: 2px;
}

/* --- battle ------------------------------------------------------------- */
.question {
  font-size: clamp(1.15rem, 2.3vw, 1.5rem);
  font-weight: 700;
  line-height: 1.45;
  margin: 0 0 6px;
}

.question-tag {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 16px;
}

.choices {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  .choices {
    grid-template-columns: 1fr 1fr;
  }
}

.choice {
  min-height: 68px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 16px;
  border: 3px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}
.choice:hover:not(:disabled) {
  border-color: var(--teal);
  background: var(--teal-light);
}
.choice:disabled {
  cursor: default;
  opacity: 0.85;
}
.choice .key {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--muted);
}
.choice.is-correct {
  border-color: var(--green);
  background: var(--green-light);
}
.choice.is-chosen-wrong {
  border-color: var(--danger);
  background: rgba(163, 52, 31, 0.08);
}

.feedback {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--surface-2);
  min-height: 64px;
}
.feedback:empty {
  display: none;
}
.feedback h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}
.feedback.good {
  border-color: var(--green);
  background: var(--green-light);
}
.feedback.coach {
  border-color: var(--teal);
  background: var(--teal-light);
}
.feedback p {
  margin: 6px 0 0;
}
.coach-line {
  font-weight: 700;
}

.next-btn {
  margin-top: 16px;
  min-height: 60px;
  width: 100%;
  border-radius: 16px;
  border: none;
  background: var(--navy);
  color: #fff;
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
  cursor: pointer;
}
.next-btn:hover {
  background: #103a68;
}
.next-btn[hidden] {
  display: none;
}

.no-fail {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

/* --- feed --------------------------------------------------------------- */
.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.feed li {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 1rem;
}
.feed li.hit {
  border-left: 6px solid var(--green);
}
.feed li.land {
  border-left: 6px solid var(--boss-1);
}
.feed-empty {
  color: var(--muted);
}

.privacy {
  margin-top: 26px;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 74ch;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- projector mode ----------------------------------------------------- */
body.projector {
  font-size: 24px;
}
body.projector .battle,
body.projector .privacy,
body.projector .page-sub,
body.projector .back-link {
  display: none;
}
body.projector .layout {
  grid-template-columns: 1fr;
}
@media (min-width: 1100px) {
  body.projector .layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
body.projector .page-title {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
}
body.projector .boss-name {
  font-size: clamp(2.4rem, 5vw, 4rem);
}
body.projector .boss-art {
  width: min(100%, 560px);
}
body.projector .hp-track {
  height: 58px;
}
body.projector .hp-head {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
}
body.projector .hp-caption {
  font-size: 1.4rem;
}
body.projector .attack-name {
  font-size: clamp(1.4rem, 2.6vw, 2.2rem);
}
body.projector .attack-label,
body.projector .feed li {
  font-size: 1.35rem;
}
body.projector .attack-no {
  width: 62px;
  height: 62px;
  font-size: 1.8rem;
}
body.projector .attack {
  grid-template-columns: 62px minmax(0, 1fr);
}
body.projector .card-title {
  font-size: 2rem;
}

/* --- motion (opt-in only) ----------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .boss-art .float {
    animation: bossFloat 5.5s ease-in-out infinite;
    transform-origin: 160px 180px;
  }
  .boss-art .aura {
    animation: bossAura 7s ease-in-out infinite;
    transform-origin: 160px 165px;
  }
  .boss-art .eye-lid {
    animation: bossBlink 6s ease-in-out infinite;
    transform-origin: center;
  }
  .boss-art .rune {
    animation: bossOrbit 12s linear infinite;
    transform-origin: 160px 165px;
  }
  .boss-stage.is-hit .boss-art {
    animation: bossShake 400ms ease;
  }
  .boss-stage.is-attacking .boss-art {
    animation: bossLunge 500ms ease;
  }
  .hp-fill {
    transition: width 600ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  .feed li {
    animation: feedIn 320ms ease;
  }
}

@keyframes bossFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}
@keyframes bossAura {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.14;
  }
  50% {
    transform: scale(1.07);
    opacity: 0.26;
  }
}
@keyframes bossBlink {
  0%,
  92%,
  100% {
    transform: scaleY(0);
  }
  95%,
  97% {
    transform: scaleY(1);
  }
}
@keyframes bossOrbit {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
@keyframes bossShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-9px) rotate(-2deg);
  }
  75% {
    transform: translateX(9px) rotate(2deg);
  }
}
@keyframes bossLunge {
  0%,
  100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.06) translateY(6px);
  }
}
@keyframes feedIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media print {
  .topbar,
  .battle,
  .feed {
    display: none;
  }
}
