/* styles.css — hero english.
   Kid only. One thing at a time. The scene is the card. */

:root {
  --paper:  #fff8ec;
  --card:   #ffffff;
  --ink:    #23201c;
  --soft:   #7a6f5f;
  --accent: #f25c1f;
  --right:  #2f7a52;
  --wrong:  #b8392f;

  --r: 22px;
  --pad: 20px;
  --sticker: 6px 6px 0 var(--accent);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; height: 100%; overscroll-behavior: none; }

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* halftone corner */
body::before {
  content: "";
  position: fixed;
  top: 0; right: 0;
  width: 200px; height: 200px;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle, rgba(242, 92, 31, .28) 1.4px, transparent 1.5px);
  background-size: 11px 11px;
  -webkit-mask-image: radial-gradient(circle at 100% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(circle at 100% 0%, #000 0%, transparent 70%);
}

#stage {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: max(14px, env(safe-area-inset-top)) var(--pad) max(18px, env(safe-area-inset-bottom));
}

.screen { display: none; flex: 1; min-height: 0; flex-direction: column; }
.screen.active { display: flex; }

/* ---------------- start / done ---------------- */

.start-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 7vh;
}

.brandmark { margin-bottom: 22px; }
.brandmark svg { display: block; filter: drop-shadow(4px 4px 0 rgba(242, 92, 31, .28)); }

.display {
  font-size: clamp(46px, 14vw, 70px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: .92;
  margin: 0;
  text-shadow: 5px 5px 0 var(--accent);
}

.lead {
  color: var(--soft);
  font-size: 16px;
  font-weight: 600;
  margin: 16px 0 26px;
}

.done-num {
  font-size: clamp(84px, 28vw, 140px);
  font-weight: 800;
  letter-spacing: -.055em;
  line-height: .82;
  margin: 0;
  color: var(--accent);
  text-shadow: 5px 5px 0 var(--ink);
}

.cta {
  font-family: inherit;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--card);
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 18px;
  min-height: 64px;
  padding: 0 46px;
  cursor: pointer;
  box-shadow: var(--sticker);
  transition: box-shadow .1s, transform .1s;
}
.cta:active { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--accent); }

/* ---------------- card ---------------- */

#s-card { position: relative; }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  flex: none;
}

.tick {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
}

.quit {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--soft);
  background: none;
  border: none;
  padding: 10px 2px 10px 16px;
  cursor: pointer;
}

.spacer-top { flex: 1 1 0; min-height: 8px; }

/* everything below the header sits as one centred group */
.card-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* the scene — video with the English line burned in as a subtitle */
.scene {
  position: relative;
  flex: none;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--r);
  border: 3px solid var(--ink);
  overflow: hidden;
  background: #0e0d0c;
  box-shadow: var(--sticker);
  /* Eases up instead of snapping. A new card should arrive, not appear. */
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .28s ease-out, transform .28s ease-out;
}

.scene.is-in { opacity: 1; transform: none; }

#clip {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #0e0d0c;
}

/* subtitle sits on the video, like the anime subs he already reads */
.subtitle {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  margin: 0;
  padding: 34px 14px 13px;
  text-align: center;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.28;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 12px rgba(0, 0, 0, .8);
  background: linear-gradient(to top, rgba(0, 0, 0, .9), rgba(0, 0, 0, .55) 55%, rgba(0, 0, 0, 0));
  pointer-events: none;
}

/* the target word — the only thing in colour */
.subtitle .w {
  color: #ffb27a;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 14px rgba(242, 92, 31, .7);
}

/* the Hindi meaning */
.hindi {
  flex: none;
  text-align: center;
  font-family: "Noto Sans Devanagari", sans-serif;
  font-size: clamp(36px, 11vw, 52px);
  font-weight: 700;
  line-height: 1.15;
  margin: 22px 0 0;
  color: var(--ink);
}

/* the mic — the only control on the card */
.mic {
  flex: none;
  width: 86px;
  height: 86px;
  margin: 22px auto 0;
  display: grid;
  place-items: center;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: var(--sticker);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s, box-shadow .12s, background .15s, border-color .15s, color .15s;
}

.mic:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }

.mic-icon { width: 34px; height: 34px; display: block; }

/* a microphone problem, never a "you were wrong" message */
.hint {
  flex: none;
  height: 20px;
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--accent);
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}

.hint.show { opacity: 1; }

/* The way out after three misses. It appears and waits — we never move on for
   him, because being wrong three times and then watching the card vanish on its
   own is worse than being wrong. */
.later {
  display: none;
  flex: none;
  align-self: center;
  margin: 14px auto 0;
  padding: 11px 26px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--sticker);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s, box-shadow .12s;
}

.later.show { display: block; }

.later:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }

/* waiting for him to start */
.mic.is-listening {
  border-color: var(--accent);
  color: var(--accent);
  animation: micRing 1.2s ease-out infinite;
}

/* he is talking right now */
.mic.is-hearing {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff8ec;
  animation: micRing .55s ease-out infinite;
}

@keyframes micRing {
  0%   { box-shadow: 0 0 0 0 rgba(242, 92, 31, .55), var(--sticker); }
  70%  { box-shadow: 0 0 0 20px rgba(242, 92, 31, 0), var(--sticker); }
  100% { box-shadow: 0 0 0 0 rgba(242, 92, 31, 0), var(--sticker); }
}

/* sent off to be transcribed */
.mic.is-thinking { animation: micWait .85s ease-in-out infinite; }

@keyframes micWait { 50% { opacity: .4; } }

/* the answer, big enough to read from across a room.

   One glance has to be enough. The mic turns into the tick or the cross, so
   there is nothing to read and nothing to interpret — the shape alone says it. */
.mic { position: relative; }

.mic.is-correct,
.mic.is-wrong {
  color: #fff8ec;
  animation: micPop .28s cubic-bezier(.2, 1.5, .4, 1);
}

.mic.is-correct {
  background: #2f9e5f;
  border-color: #1c6b3f;
  box-shadow: 5px 5px 0 #1c6b3f;
}

.mic.is-wrong {
  background: #e5484d;
  border-color: #a32a2e;
  box-shadow: 5px 5px 0 #a32a2e;
}

/* the microphone glyph gets out of the way */
.mic.is-correct .mic-icon,
.mic.is-wrong .mic-icon { visibility: hidden; }

/* tick */
.mic.is-correct::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 29px;
  margin: -19px 0 0 -9px;
  border-right: 7px solid #fff8ec;
  border-bottom: 7px solid #fff8ec;
  border-radius: 2px;
  transform: rotate(42deg);
}

/* cross */
.mic.is-wrong::before,
.mic.is-wrong::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 7px;
  margin: -3.5px 0 0 -21px;
  background: #fff8ec;
  border-radius: 4px;
}

.mic.is-wrong::before { transform: rotate(45deg); }
.mic.is-wrong::after  { transform: rotate(-45deg); }

@keyframes micPop {
  0%   { transform: scale(.55); }
  100% { transform: scale(1); }
}

/* nothing came through — say it again */
.mic.is-nothing {
  border-color: var(--wrong);
  color: var(--wrong);
  animation: micShake .3s ease-in-out;
}

@keyframes micShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-7px); }
  75%      { transform: translateX(7px); }
}

/* ---------------- wider screens ---------------- */

@media (min-width: 640px) {
  :root { --pad: 28px; }
  #stage { max-width: 460px; margin: 0 auto; }
  .subtitle { font-size: 16px; }
}
