/* 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 ---------- */
/* Since the Nov 2026 redesign the app is English only: buttons hold plain text. The .tr/.en pairs below are
   for the teacher page, which stays bilingual. */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  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;
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1.2;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn--icon { flex-direction: row; gap: 10px; }
.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,
.icon-btn:focus-visible,
.pill-btn:focus-visible,
.avatar-btn:focus-visible,
.rank-card:focus-visible,
.daily-card:focus-visible,
.link-btn:focus-visible,
.switch:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.btn--primary {
  background: var(--ink);
  color: var(--yellow);
  min-height: 70px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: .01em;
  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; font-family: var(--body); }
.btn--primary:active:not(:disabled) { box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.btn--primary:disabled { opacity: .35; }

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

.icon { flex: none; display: block; }
.icon-btn {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: var(--border) solid var(--ink);
  background: var(--paper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.icon-btn--bare { border: 0; background: transparent; width: 44px; height: 44px; }

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: center;
  min-height: 44px;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.link-btn--danger { color: var(--wrong); font-weight: 800; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px 0 16px;
  border: var(--border) solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--display);
  font-size: 1.05rem;
  cursor: pointer;
}

.avatar, .avatar-btn {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: var(--border) solid var(--ink);
  background: var(--paper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.avatar { background: var(--ink); color: var(--yellow); font-family: var(--display); font-size: .95rem; letter-spacing: .02em; }
.avatar--big { width: 64px; height: 64px; font-size: 1.35rem; cursor: default; }

.bar { display: block; height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--ink); }
.bar--dark { background: rgba(255, 238, 0, .25); }
.bar--dark > span { background: var(--yellow); }

.stat {
  flex: 1;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--paper);
  border: var(--border) solid var(--ink);
  border-radius: 16px;
  padding: 10px 6px;
  line-height: 1.1;
}
.stat b { font-family: var(--display); font-weight: 400; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stat__label { font-size: .85rem; font-weight: 700; text-align: center; }

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

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

.topbar { display: flex; align-items: center; gap: 10px; }
.topbar__space { flex: 1; }

.start__brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 8px;
}
.start__logo { margin: 0; line-height: 0; }
.start__logo img { display: block; width: min(100%, 300px); height: auto; margin: 0 auto; }

.start__cards { display: grid; gap: 14px; }
.start__cards:empty { display: none; }
.start__status { margin: 0; text-align: center; font-size: .95rem; font-weight: 600; }
.start__status:empty { display: none; }
.start__extras { display: flex; justify-content: center; }
.start__extras:not(:has(:not([hidden]))) { display: none; }

/* my weekly rank (account.js) */
.rank-card {
  display: grid;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: var(--ink);
  color: #fff;
  border: var(--border) solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 var(--lift) 0 rgba(0, 0, 0, .3);
  padding: 14px 18px;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
.rank-card:active { transform: translateY(calc(var(--lift) - 1px)); box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.rank-card__top { display: flex; align-items: center; gap: 10px; color: var(--yellow); }
.rank-card__label { font-weight: 700; font-size: .95rem; }
.rank-card__rank { margin-left: auto; font-family: var(--display); font-size: 2.1rem; line-height: 1; }
.rank-card__of { font-weight: 700; color: rgba(255, 255, 255, .78); }
.rank-card__none { margin-left: auto; font-weight: 700; color: #fff; }
.rank-card__goal { font-weight: 700; font-size: .95rem; }
.rank-card--guest {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 var(--lift) 0 var(--ink);
}
.rank-card--guest:active { box-shadow: 0 1px 0 var(--ink); }
.rank-card__text { flex: 1; font-weight: 800; font-size: 1.02rem; line-height: 1.25; }
.rank-card__link { font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

/* daily challenge entry (daily.js) */
.daily-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: var(--border) solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 var(--lift) 0 var(--ink);
  padding: 12px 14px;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
.daily-card:active { transform: translateY(calc(var(--lift) - 1px)); box-shadow: 0 1px 0 var(--ink); }
.daily-card__icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.daily-card__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.daily-card__title { font-family: var(--display); font-size: 1.15rem; line-height: 1.15; white-space: nowrap; }
.daily-card__sub { font-size: .9rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daily-card__right { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: .95rem; white-space: nowrap; }
.daily-card.is-done .daily-card__right { color: var(--right); }

/* ---------- editions with levels: badge and 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: .85rem;
  line-height: 1;
  letter-spacing: .12em;
  padding: 6px 10px 6px 12px;
  border-radius: 8px;
  transform: rotate(-4deg);
  white-space: nowrap;
}

.screen--level { gap: 18px; 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; font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 9vw, 2.3rem); }

.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;
  gap: 2px;
  min-height: 100px;
  padding: 10px 6px 12px;
  border: var(--border) solid var(--ink);
  border-radius: 20px;
  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.95rem; line-height: 1.05; }
.level-btn__name { font-weight: 700; font-size: .95rem; }
.level-btn[aria-current="true"] { background: var(--ink); color: var(--yellow); box-shadow: 0 var(--lift) 0 rgba(0, 0, 0, .35); }
.level__list--five .level-btn:last-child { grid-column: 1 / -1; }
.level__note { margin: 0; text-align: center; font-size: .95rem; color: var(--muted); font-weight: 600; }
.screen--level .btn--quiet { margin-top: 4px; }

/* bottom sheets: iPhone "Add to Home Screen" guide, exit dialog (dialogs), delete confirm (div) */
.guide {
  width: min(480px, 100vw);
  max-width: 100vw;
  max-height: calc(100dvh - 24px);
  margin: auto auto 0;
  overflow: auto;
  border: 0;
  border-top: var(--border) solid var(--ink);
  border-radius: 26px 26px 0 0;
  background: var(--paper);
  color: var(--ink);
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  display: none;
  flex-direction: column;
  gap: 14px;
}
.guide[open] { display: flex; }
.guide::backdrop { background: rgba(0, 0, 0, .55); }
.guide__title { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }
.guide__steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.guide__steps li {
  counter-increment: step;
  position: relative;
  padding: 14px 0 14px 50px;
  border-top: 1.5px solid #E6E6E6;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
}
.guide__steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--yellow);
  font-family: var(--display);
  display: grid;
  place-items: center;
}
.guide__steps .note { display: block; font-size: .88rem; font-weight: 500; color: var(--muted); margin-top: 4px; }
.guide .key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0 7px;
  font-weight: 800;
  white-space: nowrap;
  vertical-align: middle;
  background: var(--yellow);
}
.guide .key svg { width: 1em; height: 1em; }
.guide__ok { min-height: 62px; }

.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-wrap__dim { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.sheet-panel {
  position: relative;
  width: min(480px, 100%);
  margin: 0 auto;
  background: var(--paper);
  border-top: var(--border) solid var(--ink);
  border-radius: 26px 26px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
}
.sheet-panel p { margin: 0; font-size: 1.02rem; }
.sheet-panel__title { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }

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

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

.q__top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 8px;
}
.q__round {
  grid-column: 1 / -1;
  justify-self: center;
  margin: 0;
  background: var(--ink);
  color: var(--yellow);
  border-radius: 999px;
  padding: 4px 14px 5px;
  font-family: var(--display);
  font-size: .95rem;
}
.q__progress { margin: 0; font-family: var(--display); font-variant-numeric: tabular-nums; font-size: 1rem; }

.pips { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.pips li { flex: 1; height: 10px; border-radius: 999px; background: var(--track); }
.pips li.is-current { background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink); }
.pips li.is-right { background: var(--right); }
.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: 12px;
  padding: 8px 0;
  min-height: 0;
}
.q__emoji {
  font-size: 5.2rem;
  line-height: 1;
  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.2rem, 12vw, 3.3rem);
  line-height: 1.05;
  letter-spacing: -.005em;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.q__word[data-size="l"] { font-size: clamp(1.75rem, 8.4vw, 2.6rem); }
.q__word[data-size="xl"] { font-size: clamp(1.45rem, 6.6vw, 2.1rem); }
.q__pos {
  margin: 0;
  display: inline-block;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 4px 14px 5px;
  font-weight: 800;
  font-size: .95rem;
}

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

.choice {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 64px;
  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.35rem;
  font-weight: 800;
  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 {
  background: var(--paper);
  color: rgba(0, 0, 0, .4);
  border-color: rgba(0, 0, 0, .28);
  box-shadow: 0 var(--lift) 0 rgba(0, 0, 0, .14);
}
.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 { gap: 24px; text-align: center; }
.second__body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.second__count {
  margin: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 4rem;
  line-height: 1;
}
.second__title { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(2.3rem, 11vw, 2.8rem); line-height: 1.05; }
.second__text { margin: 0; font-size: 1.15rem; font-weight: 600; }

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

.screen--results { gap: 14px; text-align: center; }
.score { margin: clamp(10px, 4vh, 40px) 0 0; font-family: var(--display); line-height: .9; font-variant-numeric: tabular-nums; }
.score__num { font-size: clamp(5.5rem, 30vw, 7.5rem); }
.score__of { font-size: clamp(2.4rem, 12vw, 3.2rem); margin-left: 4px; }
.r__message { margin: 0; font-family: var(--display); font-size: 1.7rem; line-height: 1.1; }
.r__chips { display: flex; gap: 10px; }
.r__chips:empty { display: none; }
.r__breakdown { margin: 0; font-size: .85rem; color: var(--muted); font-weight: 600; }

.missed {
  text-align: left;
  background: var(--paper);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 16px 4px;
}
.missed__title { margin: 0 0 4px; font-family: var(--display); font-weight: 400; font-size: 1.05rem; line-height: 1.2; }
.missed__list { list-style: none; margin: 0; padding: 0; }
.missed__list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--track);
  font-size: 1.05rem;
}
.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; }

.r__points { display: grid; gap: 10px; }
.r__points:empty { display: none; }
.r__points p { margin: 0; }
.r__points-note { font-size: .95rem; font-weight: 600; line-height: 1.3; }

/* black rank card (results, leaderboard, daily result) */
.rank-hero {
  text-align: left;
  background: var(--ink);
  color: #fff;
  border-radius: 22px;
  padding: 16px 20px;
  box-shadow: 0 var(--lift) 0 rgba(0, 0, 0, .3);
  display: grid;
  gap: 8px;
}
.rank-hero p { margin: 0; }
.rank-hero__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rank-hero__label { font-size: .9rem; font-weight: 700; color: var(--yellow); }
.rank-hero__move {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--yellow);
  color: var(--ink);
  border-radius: 999px;
  padding: 3px 10px 3px 6px;
  font-weight: 800;
  font-size: .85rem;
}
.rank-hero__row { display: flex; align-items: baseline; gap: 8px; }
.rank-hero__rank { font-family: var(--display); font-size: clamp(3.6rem, 18vw, 4.6rem); line-height: 1; color: var(--yellow); }
.rank-hero__of { font-size: 1.15rem; font-weight: 700; color: rgba(255, 255, 255, .8); }
.rank-hero__pts { margin-left: auto; font-family: var(--display); font-size: 1.35rem; }
.rank-hero__goal { font-size: 1rem; font-weight: 800; }
.rank-hero__private { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: rgba(255, 255, 255, .75); }

.daily-done-card {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: var(--paper);
  border: var(--border) solid var(--ink);
  border-radius: 18px;
  padding: 12px 16px;
}
.daily-done-card__title { font-family: var(--display); font-size: 1.15rem; }
.daily-done-card__sub { font-weight: 700; font-size: .95rem; }

/* ---------- accounts, leaderboards (account.js) ---------- */

.screen--board, .screen--signin, .screen--profile, .screen--daily { gap: 14px; }
.acc__head { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.acc__title { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.75rem; line-height: 1.05; }
.acc__title .tr { font-family: var(--display); font-weight: 400; font-size: 1.7rem; }
.acc__lead { margin: 0; font-size: 1rem; }
.acc__small { margin: 0; font-size: .9rem; line-height: 1.35; color: var(--muted); font-weight: 600; }
.acc__small .en { font-size: .8rem; }
.acc__small--icon { display: flex; align-items: center; gap: 6px; }
.acc__foot { margin: auto 0 0; text-align: center; font-size: .9rem; color: var(--muted); font-weight: 600; }
.acc__msg { margin: 0; min-height: 1.4em; text-align: center; font-size: .95rem; font-weight: 700; }
.acc__msg:empty { min-height: 0; }
.acc__msg[data-kind="error"], .acc__msg[data-kind="error"] .tr { color: var(--wrong); }
.acc__msg[data-kind="ok"], .acc__msg[data-kind="ok"] .tr { color: var(--right); }
.acc__form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field__label { font-weight: 800; font-size: .95rem; }
.field__label .tr { font-size: .95rem; }
.field__label .en { font-size: .78rem; }
.field input {
  font: inherit;
  font-size: 1.15rem;
  min-height: 54px;
  padding: 10px 16px;
  border: var(--border) solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
.field input:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.signin__main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.signin__lead { margin: 0; font-family: var(--display); font-size: 1.85rem; line-height: 1.15; }
#signin-google { display: grid; gap: 14px; }
.btn--google { flex-direction: row; gap: 12px; }
.btn--google svg { flex: none; }
.btn--danger { background: var(--wrong); color: var(--paper); border-color: var(--ink); font-family: var(--display); font-weight: 400; font-size: 1.25rem; }
.btn--danger .en { color: rgba(255, 255, 255, .85); }

.pf__who { display: flex; align-items: center; gap: 14px; }
.pf__name { margin: 0; font-family: var(--display); font-size: 1.5rem; line-height: 1.1; overflow-wrap: anywhere; }
.pf__level { margin: 2px 0 0; font-weight: 700; color: var(--muted); }
.acc__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.acc__stats .stat b { font-size: 1.45rem; }
.acc__stats .stat__label { font-size: .8rem; }
.acc__bottom { display: grid; gap: 6px; margin-top: auto; padding-top: 8px; }

.board__levels { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  padding: 6px 14px;
  min-width: 52px;
  min-height: 42px;
  font-family: var(--display);
  font-size: .95rem;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--yellow); }
.board__period {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: var(--border) solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
}
.seg { flex: 1; border: 0; border-radius: 999px; background: transparent; min-height: 42px; font-weight: 800; font-size: .98rem; cursor: pointer; }
.seg[aria-pressed="true"] { background: var(--ink); color: var(--yellow); }
.board__body { display: grid; gap: 12px; }
.board__empty { margin: 8px 0; text-align: center; font-weight: 600; }
.board__h3 { margin: 4px 0 0; font-family: var(--display); font-weight: 400; font-size: 1.2rem; line-height: 1.2; }
.board__list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--paper);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
}
.board__list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1.5px solid #E6E6E6; font-size: 1.05rem; }
.board__list li:first-child { border-top: 0; }
.board__list li.is-me { background: var(--yellow); font-weight: 800; }
.board__rank {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--yellow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 1rem;
}
.board__list li.is-me .board__rank { background: var(--yellow); color: var(--ink); border: 2px solid var(--ink); }
.board__nick { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board__you { font-size: .85rem; font-weight: 700; }
.board__pts { flex: none; font-family: var(--display); font-variant-numeric: tabular-nums; }
.board__me { margin: 0; text-align: center; font-weight: 700; }
.board__note { margin: auto 0 0; font-size: .85rem; text-align: center; color: var(--muted); font-weight: 600; }

/* ---------- daily challenge (P6) ---------- */

.daily__meta { margin: -6px 0 0 60px; font-weight: 800; }
.daily__body { display: grid; gap: 12px; }
.daily__body p, .daily__card p { margin: 0; }
.daily__msg { text-align: center; font-weight: 600; }
.daily__streak { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.daily__streak-text { font-family: var(--display); font-size: 1.7rem; line-height: 1.1; }
.daily__sub { font-size: .95rem; font-weight: 600; color: var(--muted); text-align: center; }
.daily__note { font-size: .9rem; line-height: 1.35; font-weight: 600; color: var(--muted); }
.daily__body .daily__note { text-align: center; }
.daily__result-row { display: flex; align-items: center; gap: 16px; }
.daily__result-left { display: flex; flex-direction: column; }
.daily__result-right { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.daily__score { font-family: var(--display); font-size: 1.9rem; line-height: 1; font-variant-numeric: tabular-nums; }
.daily__fact { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.daily__fact--streak .icon { color: var(--yellow); }
.daily__card { display: grid; gap: 10px; }
.daily__h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.daily__players { font-family: var(--body); font-size: .9rem; font-weight: 700; }
.daily__list .board__pts { text-align: right; line-height: 1.05; }
.daily__extra { display: flex; align-items: center; justify-content: flex-end; gap: 3px; font-family: var(--body); font-size: .75rem; font-weight: 700; color: var(--muted); }
.daily__extra .icon { display: inline-block; }
.daily__fire { display: inline-flex; align-items: center; gap: 1px; margin-left: 6px; font-size: .8rem; font-weight: 800; vertical-align: middle; }

.toggle-card { background: var(--paper); border: var(--border) solid var(--ink); border-radius: var(--radius); padding: 12px 16px; display: grid; gap: 10px; margin-top: auto; }
.toggle-card__row { display: flex; align-items: center; gap: 12px; }
.toggle-card__text { flex: 1; min-width: 0; }
.toggle-card__title { margin: 0; font-weight: 800; font-size: 1.05rem; }
.toggle-card__sub { margin: 0; font-size: .9rem; color: var(--muted); font-weight: 600; }
#daily-push-body:empty { display: none; }
.switch {
  position: relative;
  flex: none;
  width: 56px;
  height: 34px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: #CFCFCF;
  cursor: pointer;
  padding: 0;
}
.switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  transition: left .15s ease;
}
.switch[aria-checked="true"] { background: var(--right); }
.switch[aria-checked="true"] span { left: 24px; }
.switch:disabled { opacity: .5; }

/* ---------- mouse / trackpad: hover feedback (phones never see this) ---------- */

@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled),
  .choice:hover:not(:disabled),
  .level-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 calc(var(--lift) + 2px) 0 var(--ink);
  }
  .btn--primary:hover:not(:disabled),
  .rank-card:not(.rank-card--guest):hover,
  .level-btn[aria-current="true"]:hover { box-shadow: 0 calc(var(--lift) + 2px) 0 rgba(0, 0, 0, .35); }
  .rank-card:hover, .daily-card:hover { transform: translateY(-2px); }
  .daily-card:hover, .rank-card--guest:hover { box-shadow: 0 calc(var(--lift) + 2px) 0 var(--ink); background: #FFFBCC; }
  .icon-btn:hover:not(.icon-btn--bare), .pill-btn:hover, .avatar-btn:not(.avatar):hover { background: #FFFBCC; }
  .link-btn:hover { text-decoration: underline; }
  .choice:hover:not(:disabled) { background: #FFFBCC; }
  .btn--quiet:hover { background: #FFFBCC; }
  .btn--danger:hover { background: var(--wrong); }
  .chip:hover:not([aria-pressed="true"]), .seg:hover:not([aria-pressed="true"]) { background: #FFFBCC; }
  .btn:active:not(:disabled), .choice:active:not(:disabled), .level-btn:active {
    transform: translateY(calc(var(--lift) - 1px));
    box-shadow: 0 1px 0 var(--ink);
  }
}

/* ---------- tablets and computers: the app sits in a card instead of a stretched strip ---------- */

@media (min-width: 640px) and (min-height: 700px) {
  html, body {
    background-color: var(--yellow);
    background-image: radial-gradient(rgba(0, 0, 0, .11) 1.2px, transparent 1.4px);
    background-size: 22px 22px;
  }
  body {
    display: grid;
    place-items: center;
    padding: 32px 24px 40px;
  }
  .app {
    width: 100%;
    max-width: 480px;
    background: var(--yellow);
    border: var(--border) solid var(--ink);
    border-radius: 32px;
    box-shadow: 0 10px 0 var(--ink);
    overflow: hidden;
  }
  .screen {
    min-height: min(calc(100dvh - 72px), 860px);
    padding: 28px 28px 30px;
  }
  /* a missed-word list or a long leaderboard can still grow the card */
}

/* ---------- 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 { font-size: 1.8rem; }
  .level__note { display: none; }
}

/* ---------- phones held sideways: use the width instead of scrolling ---------- */

@media (orientation: landscape) and (max-height: 540px) and (min-width: 560px) {
  .app { max-width: 900px; }
  .screen { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }

  .screen--start {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    grid-auto-rows: min-content;
    align-content: center;
    column-gap: 32px;
    row-gap: 12px;
  }
  .screen--start > * { grid-column: 2; }
  .screen--start > .start__brand { grid-column: 1; grid-row: 1 / span 10; align-self: center; padding: 0; }
  .screen--start .btn--primary { min-height: 60px; }

  .screen--question {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      "top  top"
      "card choices"
      "card choices"
      "card after";
    column-gap: 24px;
    row-gap: 8px;
  }
  .q__top { grid-area: top; }
  .q__card { grid-area: card; padding: 0; }
  .choices { grid-area: choices; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
  .choice { min-height: 52px; padding: 8px 40px; font-size: 1.12rem; }
  .choice.is-right::after, .choice.is-wrong::after { right: 12px; font-size: 1.1rem; }
  .q__after { grid-area: after; min-height: 56px; }
  .q__after .btn--primary { min-height: 56px; }
  .q__emoji { font-size: 3rem; }
  .q__word { font-size: clamp(1.8rem, 5vw, 2.6rem); }

  .screen--second { gap: 18px; }
  .second__count { width: 80px; height: 80px; font-size: 2.8rem; }
  .screen--second .btn { max-width: 420px; margin: 0 auto; }

  .screen--level { justify-content: flex-start; }
  .level__list { grid-template-columns: repeat(3, 1fr); }
  .level__list--five { grid-template-columns: repeat(5, 1fr); }
  .level__list--five .level-btn:last-child { grid-column: auto; }
  .level-btn { min-height: 84px; }
  .level__brand { padding-top: 0; }
  .level__logo { width: 200px; }

  .screen--results { max-width: 560px; width: 100%; margin: 0 auto; gap: 12px; }
  .score { margin-top: 4px; }
  .score__num { font-size: 5rem; }
  .screen--board, .screen--signin, .screen--profile, .screen--daily { max-width: 620px; margin: 0 auto; }
}


@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; }
}

/* back button on the home screen: "Close the app?" (back.js) */
.exit__actions { display: grid; gap: 12px; }
.exit-note {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--yellow);
  text-align: center;
  z-index: 50;
}
.exit-note { font-weight: 700; }
.exit-note[hidden] { display: none; }
