/* Cyber Squad — chunky "toy game" look: thick navy outlines, solid offset
   shadows, flat bright fills. Big targets for Chromebook trackpads. */

:root {
  --sky:   #cdeaff;
  --ink:   #1d2b53;
  --ink-2: #4a5885;
  --cloud: #ffffff;
  --sun:   #ffd23f;
  --grass: #37c26b;
  --berry: #ff5c8a;
  --grape: #7a5cff;
  --ocean: #2f8fe8;
  --ember: #ff8a3d;
  --forest: #1f7a4d;   /* Girl Scouts; white text on it is 5.3:1 */
  --lake:   #24589e;   /* Boy Scouts; white text on it is 7.1:1 */

  --line: 4px solid var(--ink);
  --drop: 6px 6px 0 var(--ink);
  --drop-sm: 4px 4px 0 var(--ink);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 12%, #ffffff 0 60px, transparent 61px),
    radial-gradient(circle at 22% 10%, #ffffff 0 42px, transparent 43px),
    radial-gradient(circle at 85% 18%, #ffffff 0 50px, transparent 51px),
    var(--sky);
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Fredoka", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: 22px;
  line-height: 1.35;
}

.shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 18px 60px;
}

/* ---------- home ---------- */

.home { text-align: center; margin: 12px 0 30px; }

.home-badge {
  font-size: 64px;
  line-height: 1;
}

.home-title {
  margin: 8px 0 4px;
  font-size: clamp(48px, 10vw, 76px);
  font-weight: 700;
  line-height: 1;
}

.home-sub {
  margin: 0;
  font-size: 26px;
  font-weight: 500;
  color: var(--ink-2);
}

.grades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
}

.grade {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 12px 16px;
  border: var(--line);
  border-radius: 26px;
  box-shadow: var(--drop);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.grade:hover,
.grade:focus-visible {
  transform: translate(-2px, -3px);
  box-shadow: 8px 9px 0 var(--ink);
}

.grade:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }

.grade-3 { background: var(--sun); }
.grade-4 { background: var(--ember); }
.grade-5 { background: var(--grape); color: var(--cloud); }
.grade-6 { background: var(--grass); }

.grade-buddy { font-size: 54px; line-height: 1; }
.grade-word  { margin-top: 8px; font-size: 20px; font-weight: 600; }
.grade-num   { font-size: 72px; font-weight: 700; line-height: 0.9; }

/* ---------- groups (played instead of a grade) ---------- */

.groups-label {
  margin: 30px 0 14px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink-2);
}

.groups { display: grid; gap: 20px; }

.group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 20px;
  border: var(--line);
  border-radius: 26px;
  box-shadow: var(--drop);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.group:hover,
.group:focus-visible {
  transform: translate(-2px, -3px);
  box-shadow: 8px 9px 0 var(--ink);
}

.group:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }

.group-buddy { font-size: 48px; line-height: 1; }
.group-name  { font-size: 36px; font-weight: 700; line-height: 1.05; }

.group-girl-scouts { background: var(--forest); color: var(--cloud); }
.group-boy-scouts  { background: var(--lake);   color: var(--cloud); }

/* inside the game: the chat and voice screens pick up the group's colour */
.theme-girl-scouts .screen-bar { background: var(--forest); }
.theme-girl-scouts .msg-name   { color: var(--forest); }
.theme-boy-scouts .screen-bar  { background: var(--lake); }
.theme-boy-scouts .msg-name    { color: var(--lake); }

.empty { grid-column: 1 / -1; text-align: center; }

/* ---------- panels (start + results) ---------- */

.panel {
  background: var(--cloud);
  border: var(--line);
  border-radius: 30px;
  box-shadow: var(--drop);
  padding: 34px 24px 30px;
  text-align: center;
}

.panel-buddy { font-size: 96px; line-height: 1; }

.panel-title {
  margin: 10px 0 6px;
  font-size: 46px;
  font-weight: 700;
  line-height: 1.05;
}

.panel-line {
  margin: 0 0 22px;
  font-size: 24px;
  color: var(--ink-2);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  padding: 16px 44px;
  border: var(--line);
  border-radius: 20px;
  box-shadow: var(--drop-sm);
  font: inherit;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn:hover,
.btn:focus-visible { transform: translate(-1px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.btn:active        { transform: translate(3px, 3px);   box-shadow: 1px 1px 0 var(--ink); }

.btn-go   { background: var(--sun); }
.btn-next { background: var(--cloud); }

.btn-back {
  display: inline-block;
  margin-top: 18px;
  font-size: 20px;
  color: var(--ink-2);
}

.say-btn {
  flex: none;
  width: 60px;
  height: 60px;
  border: var(--line);
  border-radius: 50%;
  background: var(--cloud);
  box-shadow: var(--drop-sm);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.say-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

/* ---------- play screen ---------- */

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

.dots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dot {
  width: 20px;
  height: 20px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cloud);
}

.dot-done { background: var(--grass); }
.dot-now  { background: var(--sun); transform: scale(1.25); }

.stars-pill {
  flex: none;
  padding: 6px 16px;
  border: var(--line);
  border-radius: 999px;
  background: var(--cloud);
  box-shadow: var(--drop-sm);
  font-size: 24px;
  font-weight: 700;
}

.scene { margin-bottom: 22px; }

/* game "device" screen for chat + voice */
.screen {
  background: var(--cloud);
  border: var(--line);
  border-radius: 26px;
  box-shadow: var(--drop);
  overflow: hidden;
}

.screen-bar {
  padding: 10px 18px;
  background: var(--ocean);
  border-bottom: var(--line);
  color: var(--cloud);
  font-size: 20px;
  font-weight: 600;
}

.msg {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 18px 24px;
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border: var(--line);
  border-radius: 50%;
  background: #e9f4ff;
  font-size: 40px;
  line-height: 1;
}

.msg-body { flex: 1; min-width: 0; }

.msg-name {
  display: block;
  margin-bottom: 6px;
  font-size: 19px;
  font-weight: 600;
  color: var(--ocean);
}

.bubble {
  position: relative;
  margin: 0;
  padding: 16px 20px;
  border: var(--line);
  border-radius: 6px 22px 22px 22px;
  background: #eef6ff;
  font-size: 27px;
  font-weight: 500;
  line-height: 1.3;
}

.bubble-voice { background: #f3efff; font-style: italic; }

.wave {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  margin-bottom: 10px;
}

.wave i {
  display: block;
  width: 7px;
  border-radius: 4px;
  background: var(--grape);
}

.wave i:nth-child(odd)  { height: 60%; }
.wave i:nth-child(even) { height: 100%; }
.wave i:nth-child(3n)   { height: 35%; }

/* scam pop-up */
.popup {
  background: var(--sun);
  border: var(--line);
  border-radius: 22px;
  box-shadow: var(--drop);
  padding: 0 22px 26px;
  text-align: center;
}

.popup-bar {
  display: flex;
  gap: 8px;
  padding: 12px 0 4px;
}

.popup-bar i {
  width: 16px;
  height: 16px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cloud);
}

.popup-art { font-size: 80px; line-height: 1.1; }

.popup-text {
  margin: 8px 0 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

/* plain question */
.ask {
  background: var(--cloud);
  border: var(--line);
  border-radius: 26px;
  box-shadow: var(--drop);
  padding: 24px 22px 28px;
  text-align: center;
}

.ask-art  { font-size: 84px; line-height: 1.1; }
.ask-text { margin: 10px 0 0; font-size: 29px; font-weight: 600; line-height: 1.25; }

/* question + choices */
.question-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.question {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);   /* every scene has two answers */
  gap: 16px;
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 18px 10px 16px;
  border: var(--line);
  border-radius: 22px;
  background: var(--cloud);
  box-shadow: var(--drop-sm);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.choice:hover,
.choice:focus-visible { background: #fff7d6; transform: translate(-1px, -3px); box-shadow: 6px 7px 0 var(--ink); }
.choice:active        { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

.choice-emoji { font-size: 58px; line-height: 1; }
.choice-text  { font-size: 22px; font-weight: 600; line-height: 1.2; text-align: center; }

/* ---------- result after answering ---------- */

.result {
  border: var(--line);
  border-radius: 26px;
  box-shadow: var(--drop);
  padding: 22px 22px 24px;
  text-align: center;
  animation: pop 0.28s ease-out;
}

.result-best { background: var(--grass); }
.result-ok   { background: var(--sun); }
.result-try  { background: #ffc2d4; }

.result-emoji { font-size: 76px; line-height: 1; }
.result-head  { margin: 6px 0 4px; font-size: 38px; font-weight: 700; }
.result-body  { margin: 0 auto; max-width: 30ch; font-size: 25px; font-weight: 500; }

.best-pick {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
  padding: 10px 20px;
  border: var(--line);
  border-radius: 18px;
  background: var(--cloud);
}

.best-label  { font-size: 17px; font-weight: 600; color: var(--grass); }
.best-choice { font-size: 24px; font-weight: 600; }

.result-actions,
.done-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

/* phones: two buttons side by side must fit, never spill off the edge */
@media (max-width: 480px) {
  .done-actions .btn { padding: 14px 20px; font-size: 22px; }
}

@keyframes pop {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* ---------- results page ---------- */

.stars-row { display: flex; justify-content: center; gap: 10px; }

.big-star {
  font-size: 76px;
  line-height: 1;
  filter: grayscale(1);
  opacity: 0.3;
}

.big-star.is-on { filter: none; opacity: 1; }
.big-star.is-on:nth-child(2) { transform: translateY(-14px) scale(1.15); }

.score {
  margin: 0 0 20px;
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
}

.score-of { font-size: 30px; color: var(--ink-2); }

.rules {
  display: grid;
  gap: 10px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
  text-align: left;
}

.rules li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #f2f8ff;
  font-size: 22px;
  font-weight: 600;
}

.rule-emoji { font-size: 34px; line-height: 1; }

/* ---------- focus, motion, small screens ---------- */

a:focus-visible,
button:focus-visible {
  outline: 5px solid var(--grape);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media (max-width: 560px) {
  body          { font-size: 20px; }
  .choices      { grid-template-columns: 1fr; }
  .choice       { flex-direction: row; justify-content: flex-start; padding: 14px 16px; }
  .choice-emoji { font-size: 42px; }
  .choice-text  { text-align: left; }
  .bubble       { font-size: 23px; }
  .popup-text   { font-size: 27px; }
  .ask-text     { font-size: 25px; }
  .question     { font-size: 27px; }
}

/* ==========================================================================
   Level picker  (beginner / intermediate / advanced)
   ========================================================================== */

.home-title-sm { font-size: clamp(38px, 8vw, 58px); }

.levels {
  display: grid;
  gap: 16px;
  margin: 0 0 26px;
}

.level {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--cloud);
  border: var(--line);
  border-radius: 22px;
  box-shadow: var(--drop);
  padding: 16px 18px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.level:hover,
.level:focus-visible { transform: translate(-2px, -3px); box-shadow: 8px 9px 0 var(--ink); }
.level:active        { transform: translate(3px, 3px);   box-shadow: 2px 2px 0 var(--ink); }

.level-beginner     { background: #d8f8e4; }
.level-intermediate { background: #fff3c9; }
.level-advanced     { background: #ffe0e8; }

.level-emoji { font-size: 44px; line-height: 1; }
.level-body  { display: flex; flex-direction: column; flex: 1; }
.level-name  { font-size: 30px; font-weight: 700; line-height: 1.1; }
.level-blurb { font-size: 18px; color: var(--ink-2); font-weight: 500; }

.level-count {
  background: var(--cloud);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 2px 14px;
  font-size: 18px;
  font-weight: 700;
}

.level-soon {
  opacity: 0.55;
  box-shadow: none;
  border-style: dashed;
  cursor: default;
}
.level-soon:hover { transform: none; box-shadow: none; }

.track-tag {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-2);
}

/* ==========================================================================
   Device scene  (a tablet the player taps directly)
   ========================================================================== */

.device-form { margin: 0; }

.device {
  background: var(--ink);
  border: var(--line);
  border-radius: 34px;
  box-shadow: var(--drop);
  padding: 16px 14px 26px;
  position: relative;
}

.device-cam {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ink-2);
  margin: 0 auto 12px;
}

.device-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--grass);
  border: 4px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  /* grows with its content instead of being pinned to one height, so a
     pop-up whose text wraps on a narrow phone makes the screen taller
     rather than spilling out of it. Explicit px, not vh: under mobile
     emulation vh resolves against the visual viewport and collapses this
     to its floor. */
  min-height: 400px;
}

.game-bar {
  flex: none;            /* never squeezed by a tall pop-up */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ocean);
  border-bottom: 4px solid var(--ink);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 20px;
  color: var(--cloud);
}

.game-world {
  position: relative;    /* the pop-up is positioned against THIS, not the
                            whole screen, so it can never reach the bar */
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  background:
    radial-gradient(circle at 20% 78%, #2aa85a 0 46px, transparent 47px),
    radial-gradient(circle at 76% 84%, #2aa85a 0 38px, transparent 39px),
    linear-gradient(var(--grass) 0 60%, #2aa85a 60% 100%);
}
.game-world .sprite { position: absolute; font-size: 44px; }
.game-world .s1 { left: 14%; top: 44%; }
.game-world .s2 { left: 64%; top: 52%; }
.game-world .s3 { left: 40%; top: 30%; font-size: 34px; }

.report-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 4px solid var(--cloud);
  border-radius: 999px;
  background: var(--berry);
  color: var(--cloud);
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  padding: 5px 14px;
  cursor: pointer;
}
.report-btn:disabled { opacity: 0.5; cursor: default; }

/* the bait pop-up sitting on top of the game */
.ad {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(88%, 380px);
  max-width: calc(100% - 20px);
  max-height: calc(100% - 16px);
  overflow-y: auto;
  background: var(--sun);
  border: var(--line);
  border-radius: 20px;
  box-shadow: var(--drop);
  padding: 14px 16px 18px;
  text-align: center;
}

.ad-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 44px; height: 44px;
  border: var(--line);
  border-radius: 50%;
  background: var(--cloud);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
}
.ad-close:disabled { opacity: 0.5; cursor: default; }

.ad-art  { font-size: 58px; line-height: 1; }
.ad-text { margin: 2px 0 12px; font-size: 28px; font-weight: 700; line-height: 1.15; }

.ad-cta {
  display: block;
  width: 100%;
  border: var(--line);
  border-radius: 14px;
  background: var(--berry);
  color: var(--cloud);
  font-family: inherit;
  font-size: 24px;
  font-weight: 700;
  padding: 12px 10px;
  cursor: pointer;
  box-shadow: var(--drop-sm);
}
.ad-cta:disabled { opacity: 0.5; cursor: default; }

.hint {
  margin: 14px 0 0;
  text-align: center;
  font-size: 20px;
  color: var(--ink-2);
  font-weight: 500;
}

/* intermediate: the same answers echoed as words under the tablet */
.choices-echo { margin-top: 18px; }

/* ==========================================================================
   Results rules  (hover or tap to open)
   ========================================================================== */

.rules-hint {
  margin: 18px 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: center;
}

/* the older `.rules li` rule is a flex row; a rule card needs to stack */
.rules li.rule {
  display: block;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 0;
  list-style: none;
}

.rule-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: var(--line);
  border-radius: 16px;
  background: var(--cloud);
  box-shadow: var(--drop-sm);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 21px;
  font-weight: 600;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.rule-short { flex: 1; }

.rule-more {
  width: 30px; height: 30px;
  flex: 0 0 auto;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--sun);
  font-size: 17px;
  font-weight: 700;
  line-height: 25px;
  text-align: center;
}

.rule-detail {
  display: none;
  border: 4px dashed var(--ink);
  border-radius: 16px;
  margin: 8px 0 0;
  padding: 14px 16px;
  background: #fffbe9;
  font-size: 19px;
  line-height: 1.4;
  font-weight: 500;
}

.rule:hover .rule-detail,
.rule:focus-within .rule-detail,
.rule.is-open .rule-detail { display: block; }

.rule:hover .rule-more,
.rule.is-open .rule-more { background: var(--grass); color: var(--cloud); }

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 500px) {
  /* the decorative clouds bunch up in the corner on a phone */
  body { background: var(--sky); }
  .device-screen { min-height: 300px; }
  .game-world { height: 210px; }
  .ad-text { font-size: 24px; }
}

/* ==========================================================================
   Squad card: avatar picker, handle, player chip
   ========================================================================== */

.avatars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 14px;
  margin: 0 0 24px;
}

.avatar-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--cloud);
  border: var(--line);
  border-radius: 20px;
  box-shadow: var(--drop-sm);
  padding: 14px 8px 10px;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.avatar-pick:hover,
.avatar-pick:focus-visible {
  background: #fff7d6;
  transform: translate(-2px, -3px);
  box-shadow: 7px 8px 0 var(--ink);
}
.avatar-pick:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

.avatar-emoji { font-size: 50px; line-height: 1; }
.avatar-word  { font-size: 17px; font-weight: 600; color: var(--ink-2); }

.privacy-note {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-2);
  margin: 0 0 20px;
}

.already {
  text-align: center;
  font-size: 19px;
  margin: 0 0 18px;
  color: var(--ink-2);
}

/* the reveal card after picking */
.card-reveal { text-align: center; }
.card-label  { margin: 0; font-size: 20px; font-weight: 600; color: var(--ink-2); }
.card-avatar { font-size: 92px; line-height: 1.05; }

.card-handle {
  margin: 2px 0 2px;
  font-size: clamp(34px, 7vw, 50px);
  font-weight: 700;
  line-height: 1.05;
  word-break: break-word;
}

.card-rank {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-2);
}

/* the chip that follows the player around */
.chip-row { display: flex; justify-content: center; margin: 0 0 18px; }

.chip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--cloud);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--drop-sm);
  padding: 6px 16px 6px 10px;
  text-decoration: none;
  color: inherit;
  max-width: 100%;
}

.chip-avatar { font-size: 32px; line-height: 1; }
.chip-body   { display: flex; flex-direction: column; min-width: 0; }

.chip-handle {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-rank   { font-size: 15px; font-weight: 600; color: var(--ink-2); }

.chip-points {
  /* white like .stars-pill: a gold star on a yellow pill vanishes */
  background: var(--cloud);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 2px 12px 3px;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 700;
  white-space: nowrap;
}

/* ==========================================================================
   Leaderboard
   ========================================================================== */

/* minmax(0, 1fr): long handles shrink with an ellipsis instead of widening the page */
.board { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }

.board-row,
.board-you {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--cloud);
  border: var(--line);
  border-radius: 18px;
  box-shadow: var(--drop-sm);
  padding: 10px 14px;
}

.board-row.is-me,
.board-you { background: #fff3c9; }

.board-you { margin: 0 0 18px; border-style: dashed; }

.board-place {
  flex: 0 0 auto;
  min-width: 42px;
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  color: var(--ink-2);
}

.board-row:nth-child(1) .board-place { color: #d99b00; }
.board-row:nth-child(2) .board-place { color: #7f8c9b; }
.board-row:nth-child(3) .board-place { color: #b2703a; }

.board-avatar { font-size: 36px; line-height: 1; }
.board-body   { display: flex; flex-direction: column; flex: 1; min-width: 0; }

.board-handle {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-handle em { font-style: normal; color: var(--ink-2); font-weight: 600; }

.board-rank { font-size: 16px; font-weight: 600; color: var(--ink-2); }

.board-points {
  /* white like .stars-pill: a gold star on a yellow pill vanishes */
  background: var(--cloud);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 3px 14px 4px;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 700;
  white-space: nowrap;
}

.board-empty {
  text-align: center;
  padding: 26px 16px;
  font-size: 20px;
  color: var(--ink-2);
  border: 4px dashed var(--ink);
  border-radius: 18px;
}

.board-next,
.to-next {
  text-align: center;
  font-size: 19px;
  font-weight: 600;
  color: var(--ink-2);
  margin: 0 0 18px;
}

/* ==========================================================================
   Scoring feedback and the fix-your-misses button
   ========================================================================== */

.gained {
  margin: 8px 0 0;
  font-size: 28px;
  font-weight: 700;
  color: #1a8a4a;
}

.btn-fix {
  display: inline-block;
  background: var(--grass);
  margin: 4px 0 10px;
}

.all-clear {
  margin: 10px 0;
  font-size: 22px;
  font-weight: 700;
  color: #1a8a4a;
}

.panel-progress { font-size: 19px; color: var(--ink-2); font-weight: 600; }

.level-done { color: var(--grass); font-size: 22px; font-weight: 700; }

/* ==========================================================================
   Rooms: landing, code entry, teacher
   ========================================================================== */

.teacher-link { text-align: center; margin: 4px 0 24px; }

.teacher-link a {
  font-size: 19px;
  font-weight: 600;
  color: var(--ink-2);
}

.code-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 18px 0 10px;
}

.code-input {
  width: 100%;
  max-width: 340px;
  border: var(--line);
  border-radius: 18px;
  box-shadow: var(--drop-sm);
  background: var(--cloud);
  font-family: inherit;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  padding: 12px 14px;
  color: var(--ink);
}

/* the teacher's room name is ordinary prose, not a PIN */
.code-input-text {
  font-size: 24px;
  letter-spacing: normal;
  font-weight: 600;
}

.code-input::placeholder { color: #b8c4d8; }
.code-input:focus-visible { outline: none; box-shadow: 6px 7px 0 var(--ink); }

.form-error {
  background: #ffe0e8;
  border: 4px solid var(--ink);
  border-radius: 16px;
  padding: 10px 14px;
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 600;
}

.room-code {
  font-size: clamp(54px, 13vw, 86px);
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.05;
  margin: 2px 0 6px;
}

.room-tag {
  margin: 4px 0 0;
  font-size: 19px;
  font-weight: 600;
  color: var(--ink-2);
}

.solo-note {
  text-align: center;
  font-size: 19px;
  font-weight: 600;
  color: var(--ink-2);
  border: 4px dashed var(--ink);
  border-radius: 18px;
  padding: 14px 16px;
  margin: 0 0 18px;
}

/* ------------------------------------------------------------------ */
/* keep-playing strip, teacher room list, secondary button            */
/* ------------------------------------------------------------------ */

.btn-ghost {
  background: var(--cloud);
  color: var(--ink);
}

.keep-playing {
  background: var(--cloud);
  border: var(--line);
  border-radius: 20px;
  box-shadow: var(--drop-sm);
  padding: 14px 16px 16px;
  margin: 0 0 18px;
  text-align: center;
}

.keep-line {
  margin: 0 0 12px;
  font-size: 20px;
  color: var(--ink);
}
.keep-ava { font-size: 28px; vertical-align: -4px; margin-right: 4px; }
.keep-room {
  display: inline-block;
  margin-left: 6px;
  font-size: 17px;
  color: var(--ink-2);
}

.leave-form { margin: 10px 0 0; }

.btn-leave {
  border: 3px solid var(--ink-2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  padding: 7px 16px;
  cursor: pointer;
}
.btn-leave:hover { background: var(--sky); }

.leave-note {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink-2);
}

.rooms { margin: 20px 0 0; }

.rooms-title {
  margin: 0 0 10px;
  font-size: 19px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.room-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--cloud);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 9px 12px;
  margin-bottom: 8px;
}

.room-row-code {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.room-row-label {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-row-board {
  flex: none;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--sun);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  padding: 4px 13px;
  text-decoration: none;
}

.rooms-note {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-2);
}

/* ------------------------------------------------------------------ */
/* text-message scene: a phone, one text from a number that is not     */
/* in contacts, and the real saved contact sitting right underneath    */
/* ------------------------------------------------------------------ */

.device-phone .device-screen {
  background: var(--cloud);
  display: flex;
  flex-direction: column;
}

.msgs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--sky);
  border-bottom: 4px solid var(--ink);
  padding: 8px 12px;
}

.msgs-back {
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
  color: var(--ink-2);
}

.msgs-who { display: flex; flex-direction: column; min-width: 0; }

.msgs-num {
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* the tell. deliberately plain, not a flashing warning */
.msgs-tag {
  font-size: 15px;
  color: var(--ink-2);
  font-style: italic;
}

.sms { padding: 16px 14px 6px; }

.sms-bubble {
  position: relative;
  margin: 0;
  max-width: 92%;
  background: #eef2fb;
  border: 3px solid var(--ink);
  border-radius: 18px 18px 18px 5px;
  padding: 12px 14px;
  font-size: 21px;
  line-height: 1.3;
  color: var(--ink);
}

.sms-time {
  display: block;
  margin: 5px 0 0 6px;
  font-size: 14px;
  color: var(--ink-2);
}

.sms-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 14px;
  margin-top: auto;
}

/* the bait: looks exactly like a normal friendly quick reply */
.quick-reply {
  flex: 1 1 auto;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--ocean);
  color: var(--cloud);
  font-family: inherit;
  font-size: 19px;
  font-weight: 700;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: var(--drop-sm);
}
.quick-reply:disabled { opacity: 0.5; cursor: default; }

.msg-delete {
  flex: 0 0 auto;
  border: 3px solid var(--ink-2);
  border-radius: 999px;
  background: var(--cloud);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  padding: 9px 15px;
  cursor: pointer;
}
.msg-delete:disabled { opacity: 0.5; cursor: default; }

.contacts {
  border-top: 4px solid var(--ink);
  background: #f4f7fd;
  padding: 10px 14px 14px;
}

.contacts-label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.contact-call {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--cloud);
  font-family: inherit;
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
}
.contact-call:hover { background: var(--sky); }
.contact-call:disabled { opacity: 0.5; cursor: default; }

.contact-ava { font-size: 26px; line-height: 1; }

.contact-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

/* ------------------------------------------------------------------ */
/* privacy notice                                                      */
/* ------------------------------------------------------------------ */

.privacy-link { margin: 14px 0 0; text-align: center; }
.privacy-link a {
  font-size: 17px;
  color: var(--ink-2);
}

.policy { text-align: left; }

.policy-date {
  margin: -6px 0 16px;
  font-size: 16px;
  color: var(--ink-2);
}

.policy-lead {
  font-size: 21px;
  line-height: 1.45;
  color: var(--ink);
  margin: 0 0 22px;
}

.policy-h {
  margin: 26px 0 8px;
  font-size: 21px;
  color: var(--ink);
}

.policy p {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink-2);
}

.policy-list {
  margin: 0 0 12px;
  padding-left: 22px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink-2);
}
.policy-list li { margin-bottom: 5px; }

/* deliberately ugly so it cannot be published by accident */
.policy-todo {
  border: 3px dashed var(--berry);
  border-radius: 12px;
  background: #fff3f6;
  padding: 12px 14px;
  font-weight: 700;
  color: var(--ink) !important;
}

/* ------------------------------------------------------------------ */
/* phones. the tablet scene has the most to lose here: the pop-up grows */
/* as its text wraps, and the report button must stay tappable          */
/* ------------------------------------------------------------------ */

@media (max-width: 480px) {
  .device { padding: 12px 10px 18px; border-radius: 26px; }
  .device-cam { margin-bottom: 9px; }

  .game-bar { font-size: 17px; padding: 7px 9px; gap: 7px; }
  .report-btn { font-size: 16px; padding: 5px 11px; border-width: 3px; }

  .ad { padding: 12px 12px 14px; border-radius: 16px; }
  .ad-art  { font-size: 42px; }
  .ad-text { font-size: 21px; margin-bottom: 10px; }
  .ad-cta  { font-size: 19px; padding: 10px 8px; }
  .ad-close { width: 38px; height: 38px; font-size: 19px; top: 6px; right: 6px; }

  .game-world .sprite { font-size: 34px; }
  .game-world .s3 { font-size: 26px; }

  /* the text-message scene */
  .msgs-num { font-size: 19px; }
  .sms-bubble { font-size: 19px; padding: 10px 12px; }
  .quick-reply { font-size: 17px; padding: 8px 13px; }
  .msg-delete { font-size: 16px; padding: 8px 12px; }
  .contact-name { font-size: 18px; }
}

/* very small phones (iPhone SE and the like) */
@media (max-width: 380px) {
  .ad-text { font-size: 19px; }
  .ad-art  { font-size: 36px; }
  .game-bar { font-size: 15px; }
  .report-btn { font-size: 15px; padding: 5px 9px; }
}

/* Phones are tall, so give the simulated screen more room - the green world
   was barely bigger than the pop-up sitting on it, which read as squashed. */
@media (max-width: 480px) {
  .device-screen { min-height: 420px; }
}

/* Landscape phone: almost no vertical room. Shrink the pop-up hard so all
   three answers stay on screen - a clipped bait button looks broken, and a
   clipped report button would be a scoring bug. */
@media (max-height: 560px) {
  .device-screen { min-height: 250px; }
  .game-bar { font-size: 16px; padding: 5px 9px; }
  .report-btn { font-size: 15px; padding: 4px 10px; }
  .ad { padding: 8px 10px 10px; }
  .ad-art  { font-size: 24px; }
  .ad-text { font-size: 17px; margin: 0 0 7px; line-height: 1.1; }
  .ad-cta  { font-size: 16px; padding: 7px 6px; }
  .ad-close { width: 32px; height: 32px; font-size: 17px; top: 5px; right: 5px; }
}

/* ==========================================================================
   No-mistakes badges: Cyber Scout, Cyber Warrior, Cyber Wizard
   The medal itself is templates/cybergame/_badge.html (SVG).
   ========================================================================== */

.badge-svg { display: block; width: 100%; height: auto; overflow: visible; }
.badge-svg.is-locked { filter: grayscale(1) brightness(1.15); opacity: 0.4; }

/* results: a badge just earned */
.badge-reveal {
  position: relative;
  margin-bottom: 22px;
  padding: 20px 20px 24px;
  overflow: hidden;
  border: var(--line);
  border-radius: 30px;
  background: radial-gradient(circle at 50% 36%, #fff6c8 0 28%, var(--cloud) 68%);
  box-shadow: var(--drop);
  text-align: center;
}

.badge-reveal-kicker { margin: 0; font-size: 22px; font-weight: 700; color: var(--ink-2); }
.badge-reveal-medal { position: relative; width: min(250px, 66%); margin: 4px auto 0; }
.badge-reveal-medal .badge-svg { position: relative; animation: badge-in 0.9s cubic-bezier(0.2, 1.4, 0.4, 1) both; }

.badge-rays {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 175%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 210, 63, 0.4) 0 9deg, transparent 9deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 68%);
  mask: radial-gradient(circle, #000 25%, transparent 68%);
  transform: translate(-50%, -50%);
  animation: badge-spin 22s linear infinite;
}

.badge-reveal-title { margin: 6px 0 4px; font-size: 32px; line-height: 1.1; }
.badge-reveal-line { margin: 0 0 16px; font-size: 20px; color: var(--ink-2); }

@keyframes badge-in { from { transform: scale(0.2) rotate(-25deg); opacity: 0; } 60% { opacity: 1; } }
@keyframes badge-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* results + start: a line about the badge for this level */
.badge-note,
.badge-teaser {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 36ch;
  margin: 16px auto 0;
  padding: 8px 16px 8px 8px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: #fff6c8;
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
}

.badge-note.is-locked { background: #eef2f9; }
.badge-teaser { margin: 4px auto 22px; }
.badge-teaser.is-have { background: #def6e6; }
.badge-note-medal,
.badge-teaser-medal { flex: none; width: 56px; }

/* leaderboard: tiny medals after a name */
.board-badge { display: inline-block; width: 24px; margin-left: 3px; vertical-align: -6px; }

/* My badges */
.shelf {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.shelf-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 12px 18px;
  border: var(--line);
  border-top: 12px solid var(--c1);
  border-radius: 24px;
  background: var(--cloud);
  box-shadow: var(--drop);
  text-align: center;
}

.shelf-item.is-locked { border-top-color: #b8c2d6; background: #f1f4fa; }
.shelf-medal { position: relative; width: 100%; max-width: 170px; }
.shelf-lock { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: 40px; }
.shelf-name { margin: 6px 0 0; font-size: 23px; line-height: 1.1; }
.shelf-level { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.shelf-where,
.shelf-how { margin: 8px 0 14px; color: var(--ink-2); font-size: 16px; }
.shelf-print { margin-top: auto; padding: 8px 24px; font-size: 18px; }
.shelf-privacy { color: var(--ink-2); font-size: 17px; text-align: center; }

@media (max-width: 560px) {
  .shelf { grid-template-columns: 1fr; }
  .shelf-medal { max-width: 140px; }
}

/* ---------- the certificate (sizes scale with its width, screen and paper) */

.cert-tools { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cert-tools .btn-back { margin-top: 0; }

.cert {
  container-type: inline-size;
  aspect-ratio: 11 / 8.5;
  padding: 1.6cqw;
  border: 6px solid var(--ink);
  border-radius: 18px;
  background:
    radial-gradient(circle at 0 0, var(--c2) 0 4cqw, transparent calc(4cqw + 1px)),
    radial-gradient(circle at 100% 0, var(--c2) 0 4cqw, transparent calc(4cqw + 1px)),
    radial-gradient(circle at 0 100%, var(--c2) 0 4cqw, transparent calc(4cqw + 1px)),
    radial-gradient(circle at 100% 100%, var(--c2) 0 4cqw, transparent calc(4cqw + 1px)),
    #fffdf5;
  box-shadow: var(--drop);
  color: var(--ink);
}

.cert-frame {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 2.4cqw 4cqw 2cqw;
  border: 0.7cqw double var(--c1);
  border-radius: 1.4cqw;
  background: repeating-linear-gradient(45deg, rgba(29, 43, 83, 0.025) 0 2px, transparent 2px 9px), #fffdf5;
}

.cert-kicker { margin: 0; color: var(--c1); font-size: 1.9cqw; font-weight: 700; letter-spacing: 0.35cqw; text-align: center; text-transform: uppercase; }
.cert-main { display: flex; flex: 1; align-items: center; gap: 3.5cqw; }
.cert-medal { flex: none; width: 29cqw; }
.cert-text { flex: 1; text-align: center; }
.cert-small { margin: 0; color: var(--ink-2); font-size: 2.1cqw; }

.cert-handle {
  display: inline-block;
  margin: 0.6cqw 0 1cqw;
  padding: 0 2cqw 0.5cqw;
  border-bottom: 0.35cqw solid var(--c2);
  font-size: 4.6cqw;
  font-weight: 700;
  line-height: 1.15;
}

.cert-title { margin: 0.4cqw 0 0.3cqw; color: var(--c3); font-size: 7.2cqw; letter-spacing: 0.3cqw; line-height: 1; text-transform: uppercase; }
.cert-motto { margin: 0; color: var(--ink-2); font-size: 2.5cqw; font-style: italic; }
.cert-why { margin: 1.6cqw 0 0; font-size: 2.1cqw; }

.cert-foot { display: grid; grid-template-columns: 1.4fr 1fr 1.4fr; gap: 3.5cqw; align-items: end; margin-top: 1.2cqw; }
.cert-line { display: flex; flex-direction: column; text-align: center; }
.cert-fill { display: block; min-height: 3.4cqw; border-bottom: 0.25cqw solid var(--ink); font-size: 2.2cqw; font-weight: 600; }
.cert-line small { margin-top: 0.5cqw; color: var(--ink-2); font-size: 1.45cqw; }
.cert-rule { margin: 1.6cqw 0 0; color: var(--c1); font-size: 1.75cqw; font-weight: 700; letter-spacing: 0.2cqw; text-align: center; text-transform: uppercase; }

/* Ownership notice: tiny and quiet, tucked into the certificate's bottom edge. */
.cert { position: relative; }
.cert-legal { position: absolute; right: 5cqw; bottom: 0.15cqw; margin: 0; color: var(--ink-2); font-size: 0.95cqw; opacity: 0.6; }

/* Site-wide notice under every page. Small and muted so kids never notice it. */
.legal { padding: 0 18px 18px; color: var(--ink-2); font-size: 11px; opacity: 0.55; text-align: center; }

@media (max-width: 560px) {
  .cert { aspect-ratio: auto; }
  .cert-main { flex-direction: column; gap: 2cqw; }
  .cert-medal { width: 46cqw; }
  .cert-kicker, .cert-rule { font-size: 3.4cqw; }
  .cert-small, .cert-why, .cert-motto { font-size: 4.2cqw; }
  .cert-handle { font-size: 7.5cqw; }
  .cert-title { font-size: 10cqw; }
  .cert-foot { grid-template-columns: 1fr; gap: 4cqw; margin-top: 5cqw; }
  .cert-fill { min-height: 7cqw; font-size: 4.2cqw; }
  .cert-line small { font-size: 3.2cqw; }
}

@media print {
  @page { size: letter landscape; margin: 0.3in; }
  html, body { background: #fff !important; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  .no-print, .chip-row { display: none !important; }
  .shell { max-width: none !important; margin: 0 !important; padding: 0 !important; }
  .cert { width: 10.4in; height: 7.85in; aspect-ratio: auto; margin: 0 auto; box-shadow: none; break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  .badge-rays, .badge-reveal-medal .badge-svg { animation: none; }
}
