/* English Time Vocabulary — mobile-first, no framework. */

@font-face {
  font-family: "Archivo Black";
  src: url("fonts/archivo-black.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --yellow: #FFEE00;      /* sampled from the logo */
  --ink: #000;
  --paper: #fff;
  --right: #138a3e;       /* white text on it: 4.9:1 */
  --wrong: #d0182a;       /* white text on it: 5.3:1 */
  --muted: rgba(0, 0, 0, .66);
  --track: rgba(0, 0, 0, .14);

  --display: "Archivo Black", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 18px;
  --border: 3px;
  --lift: 5px;            /* height of the hard shadow under keys */
  --key-h: 62px;

  --pad-x: max(20px, env(safe-area-inset-left), env(safe-area-inset-right));
  --pad-top: max(16px, env(safe-area-inset-top));
  --pad-bottom: max(18px, env(safe-area-inset-bottom));
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--yellow);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior-y: none;
}

button { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Bilingual pairs: Turkish leads, English follows quieter. */
.tr { display: block; font-weight: 800; }
.en { display: block; font-weight: 500; font-size: .78em; color: var(--muted); }

/* ---------- layout ---------- */

.app {
  max-width: 480px;
  margin: 0 auto;
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--pad-top) var(--pad-x) var(--pad-bottom);
}

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

.btn {
  display: block;
  width: 100%;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 var(--lift) 0 var(--ink);
  padding: 12px 18px;
  min-height: var(--key-h);
  cursor: pointer;
  text-align: center;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:active:not(:disabled) {
  transform: translateY(calc(var(--lift) - 1px));
  box-shadow: 0 1px 0 var(--ink);
}
.btn:disabled { cursor: default; }
.btn:focus-visible,
.choice:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.btn--primary {
  background: var(--ink);
  color: var(--yellow);
  min-height: 72px;
  box-shadow: 0 var(--lift) 0 rgba(0, 0, 0, .35);
}
.btn--primary .tr { font-family: var(--display); font-weight: 400; font-size: 1.45rem; line-height: 1.1; letter-spacing: .01em; }
.btn--primary .en { color: rgba(255, 238, 0, .78); font-size: .9rem; }
.btn--primary:active:not(:disabled) { box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.btn--primary:disabled { opacity: .35; }

.btn--quiet,
.btn--install {
  min-height: 52px;
  padding: 8px 16px;
  box-shadow: 0 3px 0 var(--ink);
}
.btn--quiet .tr, .btn--install .tr { font-size: 1rem; }
.btn--quiet .en, .btn--install .en { font-size: .82rem; }

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

.screen--start { gap: 20px; }

.start__brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(20px, 5vh, 40px);
  padding: 12px 4px;
}

.start__logo {
  margin: 0;
  line-height: 0;
}
.start__logo img {
  display: block;
  width: 100%;
  height: auto;
}

.start__tagline {
  margin: 0;
  text-align: center;
  font-size: 1.35rem;
  line-height: 1.25;
}
.start__tagline .tr { font-family: var(--display); font-weight: 400; font-size: 1.6rem; }
.start__tagline .en { font-size: 1.05rem; }

.start__actions {
  display: grid;
  gap: 14px;
}
.start__status {
  margin: 0;
  min-height: 2.6em;
  text-align: center;
  font-size: .95rem;
}

.start__extras {
  display: grid;
  gap: 12px;
}

/* ---------- editions (teens, juniors): badge, level bar, level screen ---------- */

/* Black "TEENS" sticker so teachers can tell the editions apart at a glance. */
.edition-badge {
  display: inline-block;
  background: var(--ink);
  color: var(--yellow);
  font-family: var(--display);
  font-weight: 400;
  font-size: .95rem;
  line-height: 1;
  letter-spacing: .12em;
  padding: 6px 10px 6px 12px;
  border-radius: 8px;
  transform: rotate(-4deg);
  white-space: nowrap;
}
.start__logo--badged { position: relative; }
.start__logo--badged .edition-badge {
  position: absolute;
  right: 0;
  top: 0;
  transform: translateY(-115%) rotate(-4deg);
  font-size: clamp(.95rem, 4.4vw, 1.2rem);
}

.level-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  padding: 8px 8px 8px 14px;
}
.level-bar__pill {
  flex: 1;
  min-width: 0;
  margin: 0;
  line-height: 1.2;
}
.level-bar__name { display: block; font-weight: 800; font-size: 1.05rem; }
.level-bar__name b { font-family: var(--display); font-weight: 400; font-size: 1.3rem; }
.level-bar__hint { display: block; font-size: .85rem; line-height: 1.25; margin-top: 2px; }
.level-bar__hint b, .level-bar__hint span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.level-bar__hint b { font-weight: 700; }
.level-bar__hint span { color: var(--muted); font-weight: 500; font-size: .92em; }
.level-bar__change {
  width: auto;
  flex: none;
  min-height: 48px;
  padding: 6px 12px;
  border-radius: 12px;
  border-width: 2px;
  box-shadow: 0 3px 0 var(--ink);
  background: var(--yellow);
}
.level-bar__change .tr { font-size: .9rem; }
.level-bar__change .en { font-size: .75rem; color: rgba(0, 0, 0, .7); }

.screen--level { gap: 16px; justify-content: center; }
.level__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 6px;
}
.level__logo { width: min(62%, 240px); height: auto; display: block; }
.level__title { margin: 0; text-align: center; line-height: 1.1; }
.level__title .tr { font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 9vw, 2.4rem); }
.level__title .en { font-size: 1.05rem; margin-top: 4px; }

.level__list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
}
.level-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 104px;
  padding: 10px 6px 12px;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 var(--lift) 0 var(--ink);
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
  transition: transform .08s ease, box-shadow .08s ease;
}
.level-btn:active {
  transform: translateY(calc(var(--lift) - 1px));
  box-shadow: 0 1px 0 var(--ink);
}
.level-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.level-btn__id {
  font-family: var(--display);
  font-size: 1.85rem;
  line-height: 1.05;
  margin-bottom: 4px;
}
.level-btn .tr { font-size: .98rem; }
.level-btn .en { font-size: .8rem; }
.level-btn[aria-current="true"] { background: var(--ink); color: var(--yellow); box-shadow: 0 var(--lift) 0 rgba(0, 0, 0, .35); }
.level-btn[aria-current="true"] .en { color: rgba(255, 238, 0, .8); }

.level__note { margin: 0; text-align: center; font-size: .92rem; }
.level__note .en { font-size: .82rem; }
.screen--level .btn--quiet { margin-top: 4px; }

/* iPhone "Add to Home Screen" guide */
.guide {
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border: var(--border) solid var(--ink);
  border-radius: 20px;
  background: var(--yellow);
  color: var(--ink);
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 6px 0 var(--ink);
}
.guide::backdrop { background: rgba(0, 0, 0, .55); }
.guide__title { margin: 0 0 14px; text-align: center; line-height: 1.15; }
.guide__title .tr { display: block; font-family: var(--display); font-weight: 400; font-size: 1.5rem; }
.guide__title .en { display: block; font-size: .95rem; font-weight: 600; }
.guide__steps {
  list-style: none;
  counter-reset: step;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 10px;
}
.guide__steps li {
  counter-increment: step;
  position: relative;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 10px 12px 10px 50px;
  font-size: 1rem;
  line-height: 1.35;
}
.guide__steps li::before {
  content: counter(step);
  position: absolute;
  left: 10px;
  top: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--yellow);
  font-weight: 800;
  display: grid;
  place-items: center;
}
.guide__steps .en { display: block; font-size: .82rem; opacity: .75; margin-top: 2px; }
.guide__steps .note { display: block; font-size: .85rem; margin-top: 4px; }
.guide .key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0 6px;
  font-weight: 800;
  white-space: nowrap;
  vertical-align: middle;
  background: var(--yellow);
}
.guide .key svg { width: 1em; height: 1em; }
.guide #btn-guide-copy { margin-bottom: 12px; }
.guide__ok { min-height: 60px; }

/* ---------- question ---------- */

.screen--question { gap: 14px; }

.q__top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 14px;
  row-gap: 8px;
}
.q__round {
  grid-column: 1 / -1;
  justify-self: start;
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  background: var(--ink);
  color: var(--yellow);
  border-radius: 999px;
  padding: 4px 14px 5px;
  font-size: .95rem;
}
.q__round .tr { font-family: var(--display); font-weight: 400; }
.q__round .en { color: rgba(255, 238, 0, .8); font-size: .85rem; }

.q__progress {
  margin: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
}

.pips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 5px;
}
.pips li {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: var(--track);
}
.pips li.is-current { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
.pips li.is-right { background: var(--ink); }
.pips li.is-wrong { background: var(--wrong); }

.q__card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 8px 0;
  min-height: 0;
}
.q__emoji {
  font-size: 4.6rem;
  line-height: 1;
  margin-bottom: 4px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.q__word {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.1rem, 10.5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -.005em;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.q__pos {
  margin: 4px 0 0;
  display: inline-block;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 14px 4px;
  font-weight: 700;
  font-size: .95rem;
}

.q__ask {
  margin: 0;
  text-align: center;
  font-size: .95rem;
  line-height: 1.25;
}
.q__ask .tr { font-weight: 700; }

.choices {
  display: grid;
  gap: 12px;
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--key-h);
  padding: 10px 52px;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 var(--lift) 0 var(--ink);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, background-color .15s ease, opacity .2s ease;
}
.choice:active:not(:disabled) {
  transform: translateY(calc(var(--lift) - 1px));
  box-shadow: 0 1px 0 var(--ink);
}
.choice:disabled { cursor: default; }
.choice.is-faded { opacity: .45; }
.choice.is-right,
.choice.is-wrong { color: var(--paper); opacity: 1; }
.choice.is-right { background: var(--right); }
.choice.is-wrong { background: var(--wrong); }
.choice.is-right::after,
.choice.is-wrong::after {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.35rem;
  font-weight: 900;
}
.choice.is-right::after { content: "✓"; }
.choice.is-wrong::after { content: "✕"; }
.choice.is-picked { transform: translateY(2px); box-shadow: 0 3px 0 var(--ink); }

.q__after {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.btn--next { animation: rise .18s ease-out; }

@keyframes rise {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---------- second-chance intro ---------- */

.screen--second {
  justify-content: center;
  gap: 28px;
  text-align: center;
}
.second__title { margin: 0; line-height: 1.05; }
.second__title .tr { font-family: var(--display); font-weight: 400; font-size: clamp(2.6rem, 13vw, 3.6rem); }
.second__title .en { font-size: 1.3rem; margin-top: 6px; }
.second__text { margin: 0; font-size: 1.2rem; }
.second__text .en { font-size: 1rem; margin-top: 2px; }

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

.screen--results {
  gap: 18px;
  text-align: center;
}
.score {
  margin: clamp(16px, 7vh, 64px) 0 0;
  font-family: var(--display);
  line-height: .9;
  font-variant-numeric: tabular-nums;
}
.score__num { font-size: clamp(5.5rem, 30vw, 8rem); }
.score__of { font-size: clamp(2.4rem, 12vw, 3.4rem); margin-left: 4px; }

.r__message { margin: 0; font-size: 1.25rem; }
.r__message .en { font-size: 1rem; }
.r__fixed { margin: 0; font-size: 1.05rem; }
.r__fixed:empty { display: none; }
.r__fixed b { font-size: 1.15em; }

.missed {
  text-align: left;
  background: var(--paper);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  padding: 14px 16px 6px;
}
.missed__title { margin: 0 0 6px; font-size: 1.05rem; line-height: 1.2; }
.missed__title .en { font-size: .82rem; }
.missed__list { list-style: none; margin: 0; padding: 0; }
.missed__list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--track);
  font-size: 1.1rem;
}
.missed__list li:first-child { border-top: 0; }
.missed__list .m-tr { font-weight: 800; }
.missed__list .m-arrow { color: var(--muted); }
.missed__list .m-en { font-weight: 500; }

.screen--results .btn--primary { margin-top: auto; }

/* ---------- small / short screens ---------- */

@media (max-height: 700px) {
  :root { --key-h: 54px; --lift: 4px; }
  .screen--question { gap: 10px; }
  .choices { gap: 10px; }
  .q__emoji { font-size: 3.4rem; }
  .q__word { font-size: clamp(1.9rem, 9.5vw, 2.6rem); }
  .q__after { min-height: 64px; }
  .btn--primary { min-height: 62px; }
  .choice { font-size: 1.18rem; }
}

@media (max-height: 700px) {
  .screen--level { gap: 12px; }
  .level-btn { min-height: 88px; padding: 6px 6px 8px; }
  .level-btn__id { font-size: 1.6rem; margin-bottom: 2px; }
  .level__logo { width: min(52%, 200px); }
  .level__title .tr { font-size: 1.8rem; }
  .level__note { display: none; }
}

@media (max-width: 340px) {
  :root { --pad-x: max(14px, env(safe-area-inset-left), env(safe-area-inset-right)); }
}

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