/* mr shakir's Say It Right
 *
 * The teaching idea drives the design: syllables are beats, and stress is the
 * big beat. Words are shown as syllable columns with a bubble above each one,
 * the way stress is marked on a whiteboard. Everything else stays quiet so the
 * word is the only loud thing on screen, readable from the back of a classroom.
 */

:root {
  --ink: #101a3d;
  --ink-soft: #4a5578;
  --paper: #ffffff;
  --panel: #eef2fb;
  --edge: #d3dcf0;
  --blue: #1b49e0;
  --magenta: #e5006d;
  --green: #0b8f5b;
  --amber: #ffb01f;
  --red: #d92d20;

  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --ui: "Lexend", system-ui, -apple-system, Segoe UI, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-weight: 350;
  font-size: 19px;
  line-height: 1.5;
}

.screen { max-width: 1060px; margin: 0 auto; padding: 28px 20px 56px; }
.hidden { display: none !important; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ---------------- masthead ---------------- */
.masthead { margin: 8px 0 30px; }

.mr {
  font-family: var(--ui);
  font-size: clamp(13px, 2vw, 16px);
  font-weight: 400;
  color: var(--magenta);
  margin: 0 0 2px 3px;
  letter-spacing: 0.02em;
}

.masthead h1 {
  font-family: var(--display);
  font-size: clamp(42px, 10vw, 86px);
  font-variation-settings: "wdth" 92, "wght" 750;
  line-height: 0.92;
  margin: 0;
  color: var(--ink);
}

.tag {
  font-size: clamp(19px, 2.5vw, 24px);
  color: var(--ink-soft);
  margin: 12px 0 0;
  max-width: 46ch;
}


/* ---------------- bilingual primer ----------------
 * Students meet the two words "syllable" and "stress" before they play, in
 * English and Russian. Russian uses the system stack because the display and
 * UI faces carry no Cyrillic. */
.primer {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px; margin: 0 0 34px;
  padding: 20px 0 0; border-top: 2px solid var(--edge);
}
.term { max-width: 52ch; }
.term .beats { display: flex; align-items: flex-end; gap: 6px; height: 18px; margin-bottom: 10px; }
.term .b { display: block; border-radius: 50%; background: var(--edge); }
.term .b.s { width: 8px; height: 8px; }
.term .b.l { width: 17px; height: 17px; background: var(--amber); }
.term h2 {
  font-family: var(--display);
  font-size: clamp(25px, 3.6vw, 31px);
  font-variation-settings: "wdth" 90, "wght" 700;
  margin: 0 0 6px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 9px;
}
.ru-term {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.62em; font-weight: 400; color: var(--magenta);
}
.term p { margin: 0 0 6px; font-size: 19px; color: var(--ink-soft); }
.term p b { color: var(--ink); font-weight: 600; }
.term .ru {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 18px; color: var(--ink-soft);
}

/* ---------------- setup ---------------- */
.setup { display: flex; flex-direction: column; gap: 26px; }

fieldset { border: 0; padding: 0; margin: 0; }

legend {
  font-size: clamp(22px, 2.9vw, 27px);
  font-weight: 500;
  color: var(--ink);
  padding: 0 0 12px;
}

.picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.picks-two { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); max-width: 640px; }

.pick {
  display: flex; flex-direction: column; gap: 4px;
  text-align: left; cursor: pointer;
  padding: 16px 18px 15px;
  background: var(--panel);
  border: 2px solid transparent;
  border-bottom: 4px solid var(--edge);
  border-radius: 16px;
  font-family: var(--ui); font-size: 22px; color: var(--ink);
}
.pick strong { font-weight: 600; }
.pick-sub { font-size: 17px; color: var(--ink-soft); }
.pick:hover { background: #e4ebfa; }
.pick[aria-pressed="true"] {
  background: #fff;
  border-color: var(--blue);
  border-bottom-color: var(--blue);
}
.pick[aria-pressed="true"] .pick-sub { color: var(--blue); }

/* little beat diagrams on the game choices */
.pick-demo { display: flex; align-items: flex-end; gap: 5px; height: 20px; margin-bottom: 6px; }
.pick-demo .b { display: block; border-radius: 50%; background: var(--ink-soft); }
.pick-demo .b.s { width: 7px; height: 7px; }
.pick-demo .b.l { width: 15px; height: 15px; background: var(--amber); }
.pick[aria-pressed="true"] .pick-demo .b.s { background: var(--blue); }
.pick-ipa {
  font-family: var(--display); font-size: 19px; font-weight: 700;
  color: var(--magenta); height: 20px; line-height: 1;
}

.settings { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.settings label { font-size: 19px; color: var(--ink-soft); }
.switch { display: inline-flex; align-items: center; gap: 8px; }
.switch input { width: 18px; height: 18px; accent-color: var(--blue); }

select {
  font-family: var(--ui); font-size: 19px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--edge);
  border-radius: 10px; padding: 9px 12px;
}

.go {
  align-self: flex-start;
  font-family: var(--ui); font-size: 23px; font-weight: 600;
  color: #fff; background: var(--blue);
  border: 0; border-bottom: 4px solid #0e2f9c;
  border-radius: 14px; padding: 16px 34px; cursor: pointer;
}
.go:hover { background: #2554ea; }
.go:active { transform: translateY(2px); border-bottom-width: 2px; }

.ghost {
  font-family: var(--ui); font-size: 20px; color: var(--ink-soft);
  background: transparent; border: 2px solid var(--edge);
  border-radius: 14px; padding: 14px 24px; cursor: pointer;
}
.ghost:hover { border-color: var(--ink-soft); color: var(--ink); }

.keys { font-size: 17px; color: var(--ink-soft); margin: 0; }
kbd {
  font-family: var(--ui); font-size: 15px;
  background: var(--panel); border: 1px solid var(--edge);
  border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px;
}

.credit { margin-top: 44px; font-size: 15px; color: var(--ink-soft); max-width: 60ch; }
.credit p { margin: 0; }


/* ---------------- how to play ----------------
 * A quiet link that opens in place, so a substitute teacher or the students can
 * run the game without being told how. */
.howto { margin: -6px 0 0; }
.howto summary {
  display: inline-block; cursor: pointer;
  font-size: 18px; color: var(--blue);
  border-bottom: 1px solid var(--edge); padding-bottom: 1px;
  list-style: none;
}
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: " \203A"; }
.howto[open] summary::after { content: " \2039"; }
.howto summary:hover { border-bottom-color: var(--blue); }
.howto-body {
  margin-top: 16px; padding: 22px 26px;
  background: var(--panel); border-radius: 16px;
  max-width: 68ch;
}
.howto-body p { margin: 0 0 14px; font-size: 18px; color: var(--ink-soft); }
.howto-body p:last-child { margin-bottom: 0; }
.howto-body b { color: var(--ink); font-weight: 600; }
.howto-body i { font-style: normal; font-weight: 600; color: var(--ink); }
.howto-body h3 {
  font-family: var(--display);
  font-size: 21px; font-variation-settings: "wdth" 90, "wght" 700;
  margin: 22px 0 10px; color: var(--ink);
}
.howto-body ul, .howto-body ol { margin: 0; padding-left: 22px; }
.howto-body li { font-size: 18px; color: var(--ink-soft); margin-bottom: 9px; }
.howto-body li:last-child { margin-bottom: 0; }

/* ---------------- play ---------------- */
.statusbar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.status { font-size: 18px; color: var(--ink-soft); }
.status + .status::before { content: ""; }
.turn {
  color: #fff; background: var(--magenta);
  border-radius: 999px; padding: 5px 16px; font-weight: 500;
}
.quit {
  margin-left: auto; font-family: var(--ui); font-size: 18px;
  color: var(--ink-soft); background: transparent;
  border: 0; border-bottom: 1px solid var(--edge);
  padding: 2px 0; cursor: pointer;
}
.quit:hover { color: var(--ink); border-bottom-color: var(--ink); }

.stage { text-align: center; padding: 6px 0 4px; }

.ask {
  font-size: clamp(21px, 3.2vw, 29px);
  font-weight: 400; color: var(--ink-soft);
  margin: 0 0 26px; max-width: 34ch; margin-inline: auto;
}

/* the word, as syllable columns with a beat bubble above each */
.word {
  display: flex; justify-content: center; align-items: flex-end;
  gap: clamp(14px, 3vw, 34px); flex-wrap: wrap;
  min-height: clamp(96px, 18vw, 170px);
}
.col { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.4vw, 16px); }
.bubble {
  width: clamp(14px, 2.4vw, 23px); height: clamp(14px, 2.4vw, 23px);
  border-radius: 50%; background: var(--edge);
  transition: none;
}
.col.strong .bubble {
  width: clamp(31px, 5.6vw, 54px); height: clamp(31px, 5.6vw, 54px);
  background: var(--amber);
}
.syl {
  font-family: var(--display);
  font-size: clamp(46px, 10.5vw, 108px);
  font-variation-settings: "wdth" 88, "wght" 700;
  line-height: 0.95; color: var(--ink);
}
.col.strong .syl { font-variation-settings: "wdth" 88, "wght" 800; }
.col.quiet .syl { color: var(--ink-soft); font-variation-settings: "wdth" 88, "wght" 500; }
.symbol {
  font-family: var(--display);
  font-size: clamp(66px, 15vw, 142px);
  font-variation-settings: "wdth" 90, "wght" 700;
  color: var(--magenta); line-height: 1;
}

/* the oOo notation teachers already use */
.pattern {
  font-family: var(--display);
  font-size: clamp(25px, 3.8vw, 36px);
  letter-spacing: 0.22em; color: var(--ink-soft);
  min-height: 1.4em; margin: 14px 0 0;
}

.again {
  font-family: var(--ui); font-size: 19px; color: var(--blue);
  background: transparent; border: 2px solid var(--edge);
  border-radius: 999px; padding: 9px 22px; margin: 18px 0 0; cursor: pointer;
}
.again:hover { border-color: var(--blue); }

/* answer keys: a sound-board row, not a grid of cards */
.keypad {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 12px; margin: 30px 0 0;
}
.key {
  font-family: var(--display);
  font-size: clamp(29px, 5.2vw, 46px);
  font-variation-settings: "wdth" 90, "wght" 700;
  color: var(--ink); background: var(--panel);
  border: 2px solid var(--edge); border-bottom-width: 6px;
  border-radius: 18px; padding: 20px 30px 16px;
  min-width: clamp(104px, 14vw, 150px); cursor: pointer;
}
.key .tap {
  display: block; font-family: var(--ui); font-size: 15px; font-weight: 400;
  color: var(--ink-soft); margin-bottom: 5px;
}
.key:hover:not(:disabled) { background: #e4ebfa; border-color: #bfcdeb; }
.key:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 3px; }
.key:disabled { cursor: default; }
.key.right {
  color: #fff; background: var(--green);
  border-color: var(--green); border-bottom-color: #086b44;
}
.key.right .tap { color: #d3f3e4; }
.key.wrong {
  color: #fff; background: var(--red);
  border-color: var(--red); border-bottom-color: #a21d13;
}
.key.wrong .tap { color: #ffd9d5; }

.verdict {
  text-align: center; font-size: clamp(20px, 3vw, 27px);
  margin: 26px auto 0; max-width: 56ch; min-height: 2.2em;
}
.verdict strong { font-weight: 600; }
.verdict.ok { color: var(--green); }
.verdict.no { color: var(--red); }

#play .go, #results .go { align-self: center; display: block; margin: 8px auto 0; }

/* ---------------- results ---------------- */
.scorecard { text-align: center; padding: 20px 0 10px; }
.scorecard h2 {
  font-family: var(--display);
  font-size: clamp(38px, 7.4vw, 70px);
  font-variation-settings: "wdth" 92, "wght" 750;
  margin: 0; line-height: 1;
}
.tally { font-size: clamp(21px, 3.2vw, 28px); color: var(--ink-soft); margin: 14px 0 0; }

.review-head { font-size: 21px; font-weight: 500; margin: 36px 0 14px; }
.review { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 14px 2px; border-top: 1px solid var(--edge);
}
.review .row:last-child { border-bottom: 1px solid var(--edge); }
.row .w {
  font-family: var(--display); font-size: 30px;
  font-variation-settings: "wdth" 90, "wght" 700;
}
.row .pat {
  font-family: var(--display); font-size: 22px;
  letter-spacing: 0.2em; color: var(--amber);
}
.row .how { font-size: 18px; color: var(--ink-soft); }
.review:empty + .endbuttons { margin-top: 10px; }

.endbuttons { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 34px; }
#results .go, #results .ghost { margin-top: 0; }

/* one deliberate moment: the strong beat lands when the answer is shown */
@keyframes land {
  0% { transform: scale(0.72); }
  55% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
.col.strong.reveal .bubble { animation: land 420ms cubic-bezier(.34, 1.3, .64, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .col.strong.reveal .bubble { animation: none; }
  .go:active, .key:active:not(:disabled) { transform: none; }
}

@media (max-width: 520px) {
  .word { gap: 8px; }
  .key { min-width: 72px; padding: 14px 16px 11px; }
  .keypad { gap: 8px; }
}
