/* Shared styles for quiz pages. Load after styles.css. */

:root {
  --right: #12a150;
  --right-bg: #c9f7d9;
  --wrong: #e0352b;
  --wrong-bg: #ffd9d4;
  --select: #ffb703;
  --track: #b9aee0;
  --tile: #ffe066;
  --tile-text: #5a3600;
  --photo-bg: #2b2350;
}

/* Compact hero for category and quiz pages */
.hero--slim { padding: 28px 0 44px; }
.hero--slim h1 { font-size: clamp(1.9rem, 6vw, 2.8rem); }
.hero--trains { background: linear-gradient(120deg, #ff8a3d, #f03e3e 55%, #d6336c); }
.hero--aircraft { background: linear-gradient(120deg, #1c9be8, #2f6bf0 55%, #6a4cf0); }
.theme-aircraft { --qz-accent: var(--aircraft); }
.crumbs { margin: 0 0 12px; font-size: 0.95rem; font-weight: 800; }
.crumbs a {
  display: inline-block;
  padding: 3px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  text-shadow: none;
  box-shadow: 0 2px 0 var(--ink);
}
.crumbs a:hover, .crumbs a:focus-visible { background: var(--accent); }

/* Category page quiz cards */
.quiz-list--big { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.quiz__emoji { font-size: 2.6rem; line-height: 1; margin-bottom: 4px; }
.quiz__levels {
  align-self: flex-start;
  margin-top: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--topic);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}

/* Quiz app */
.quiz-app { max-width: 45rem; padding-top: 20px; }

.qz-card {
  margin-top: 16px;
  padding: 20px;
  background: var(--surface);
  border: 3px solid var(--ink);
  border-top: 12px solid var(--qz-accent, var(--trains));
  border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--ink);
}

.qz-start { text-align: center; }
.qz-start__emoji { display: inline-block; font-size: 4.5rem; line-height: 1; animation: qz-bob 2.4s ease-in-out infinite; }
@keyframes qz-bob { 50% { transform: translateY(-8px) rotate(4deg); } }
.qz-intro { font-size: 1.25rem; font-weight: 700; margin: 12px 0 4px; }
.qz-sub { margin: 20px 0 12px; font-family: var(--font-fun); font-size: 1.35rem; }

.qz-levels { display: grid; gap: 12px; }
.qz-level {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "emoji name" "emoji blurb" "emoji best";
  column-gap: 14px;
  align-items: center;
  text-align: left;
  padding: 14px 18px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--lvl-bg, var(--bg));
  color: inherit;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.15s, box-shadow 0.15s;
}
.qz-level:hover, .qz-level:focus-visible { transform: translateY(-3px); box-shadow: 0 7px 0 var(--ink); }
.qz-level:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.qz-level__emoji { grid-area: emoji; font-size: 2.4rem; }
.qz-level__name { grid-area: name; font-family: var(--font-fun); font-weight: 700; font-size: 1.3rem; }
.qz-level__blurb { grid-area: blurb; color: var(--muted); font-size: 0.95rem; }
.qz-level__best { grid-area: best; font-size: 0.9rem; font-weight: 600; }
.qz-level--easy { --lvl-bg: color-mix(in srgb, #22c55e 18%, var(--surface)); border-left: 12px solid #22c55e; }
.qz-level--medium { --lvl-bg: color-mix(in srgb, #ffb703 22%, var(--surface)); border-left: 12px solid #ffb703; }
.qz-level--hard { --lvl-bg: color-mix(in srgb, #a855f7 18%, var(--surface)); border-left: 12px solid #a855f7; }

/* Progress track with a little train */
.qz-hud { margin-top: 8px; }
.qz-track {
  position: relative;
  height: 34px;
  margin: 0 22px 0 4px;
  background: repeating-linear-gradient(90deg, var(--track) 0 4px, transparent 4px 14px) bottom 6px left / 100% 6px no-repeat;
  border-bottom: 3px solid var(--track);
}
.qz-track__train {
  position: absolute;
  bottom: 4px;
  font-size: 1.7rem;
  line-height: 1;
  transform: translateX(-50%) scaleX(-1);
  transition: left 0.6s ease-out;
}
.qz-track__station { position: absolute; right: -24px; bottom: 4px; font-size: 1.4rem; line-height: 1; }
.qz-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  margin-top: 8px;
  font-weight: 700;
}
.qz-streak { padding: 0 10px; border-radius: 999px; background: #ff8a3d; color: #fff; animation: qz-pop 0.3s; }
@keyframes qz-pop { 0% { transform: scale(0.6); } 70% { transform: scale(1.15); } }

/* The aircraft track: a plane flying to the runway instead of a train */
.qz-track--sky { background: none; border-bottom-style: dashed; }
.qz-track__plane { transform: translateX(-50%); }

/* Photos and credits */
.qz-photo { margin: 0 0 12px; }
.qz-photo img {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  background: var(--photo-bg);
  border: 3px solid var(--ink);
  border-radius: 18px;
}
.qz-photo--small img { max-height: 220px; }
.qz-credit { margin-top: 4px; font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }
.qz-credit a { color: inherit; }

.qz-prompt { margin: 8px 0 14px; font-family: var(--font-fun); font-weight: 600; font-size: 1.45rem; line-height: 1.3; }
.qz-prompt--statement {
  padding: 14px 16px;
  background: color-mix(in srgb, var(--select) 18%, var(--surface));
  border: 3px solid var(--ink);
  border-left: 12px solid var(--select);
  border-radius: 16px;
  font-size: 1.3rem;
  font-weight: 600;
}
.qz-context { margin: 0 0 6px; font-weight: 700; color: var(--muted); }

/* Mystery zoom: a close-up that zooms out once answered */
.qz-zoom__frame {
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--photo-bg);
  border: 3px solid var(--ink);
  border-radius: 18px;
}
.qz-zoom__frame img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 0;
  transition: transform 0.8s ease-out;
}
.qz-row--tight { margin: 0 0 8px; }
.qz-prompt--center { text-align: center; }

/* Head to head: tap one of two aircraft */
.qz-duel { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.qz-duel__vs { display: grid; place-items: center; width: 44px; height: 44px; border: 3px solid var(--ink); border-radius: 50%; background: var(--accent); color: var(--ink); font-family: var(--font-fun); font-weight: 700; font-size: 1.1rem; transform: rotate(-8deg); }
.qz-duel__pick {
  display: grid;
  gap: 6px;
  padding: 6px 6px 10px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
.qz-duel__pick:hover:not(:disabled) { background: color-mix(in srgb, var(--qz-accent, var(--trains)) 14%, var(--surface)); transform: translateY(-3px); box-shadow: 0 7px 0 var(--ink); }
.qz-duel__pick:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.qz-duel__pick:disabled { cursor: default; }
.qz-duel__pick img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: var(--photo-bg); }
.qz-duel__name { font-weight: 800; font-size: 1.05rem; line-height: 1.25; }
.qz-duel__stat:empty { display: none; }
.qz-duel__stat { font-weight: 700; font-size: 0.95rem; }
.qz-duel__pick.is-right { background: var(--right-bg); border-color: var(--right); box-shadow: 0 4px 0 var(--right); }
.qz-duel__pick.is-wrong { background: var(--wrong-bg); border-color: var(--wrong); box-shadow: 0 4px 0 var(--wrong); }
.qz-duel__pick.is-right .qz-duel__name::after { content: " ✔"; }
.qz-duel__pick.is-wrong .qz-duel__name::after { content: " ✘"; }
@media (max-width: 420px) {
  .qz-duel { gap: 6px; }
  .qz-duel__vs { width: 34px; height: 34px; font-size: 0.9rem; }
  .qz-duel__name { font-size: 0.95rem; }
}

/* Answer buttons */
.qz-options { display: grid; gap: 10px; }
@media (min-width: 560px) {
  .qz-options { grid-template-columns: 1fr 1fr; }
}
.qz-options--many { grid-template-columns: 1fr 1fr; }
.qz-options--tf { grid-template-columns: 1fr 1fr; }
.qz-options--tf .qz-option { font-size: 1.4rem; padding: 18px; }

.qz-option, .qz-btn {
  min-height: 56px;
  padding: 12px 16px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-weight: 800;
  font-size: 1.1rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
.qz-option:hover:not(:disabled), .qz-btn:hover { background: color-mix(in srgb, var(--qz-accent, var(--trains)) 14%, var(--surface)); transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.qz-option:active:not(:disabled), .qz-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.qz-option:disabled { cursor: default; opacity: 0.6; box-shadow: 0 2px 0 var(--ink); }
.qz-option.is-right, .qz-pair-name.is-right { opacity: 1; background: var(--right-bg); border-color: var(--right); box-shadow: 0 4px 0 var(--right); }
.qz-option.is-wrong, .qz-pair-name.is-wrong { opacity: 1; background: var(--wrong-bg); border-color: var(--wrong); box-shadow: 0 4px 0 var(--wrong); }
.qz-option.is-right { animation: qz-pop 0.35s; }
.qz-option.is-right::after { content: " ✔"; }
.qz-option.is-wrong::after { content: " ✘"; }

.qz-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.qz-btn--go { background: var(--qz-accent, var(--trains)); color: #fff; font-family: var(--font-fun); font-weight: 700; font-size: 1.15rem; }
.qz-btn--go:hover { background: var(--qz-accent, var(--trains)); filter: brightness(1.1); }

.qz-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.qz-row--center { justify-content: center; }

.qz-feedback:empty { display: none; }
.qz-feedback { margin-top: 16px; }
.qz-verdict { margin: 0 0 6px; font-family: var(--font-fun); font-size: 1.6rem; font-weight: 700; }
.qz-verdict.is-right { color: var(--right); }
.qz-verdict.is-wrong { color: var(--wrong); }
.qz-explain { margin: 0 0 12px; font-size: 1.05rem; }
.qz-muted { color: var(--muted); }

/* Anagram */
.qz-anagram { display: flex; flex-wrap: wrap; gap: 14px 22px; justify-content: center; margin: 8px 0 18px; }
.qz-word { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.qz-slot, .qz-tile {
  width: 2.75rem;
  height: 3.25rem;
  padding: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 900;
  cursor: pointer;
}
.qz-slot { border: 3px dashed var(--track); background: var(--bg); color: inherit; }
.qz-slot.is-filled { border-style: solid; border-color: var(--select); }
.qz-slot.is-locked { border-style: solid; border-color: var(--right); background: var(--right-bg); cursor: default; }
.qz-slot:disabled { color: inherit; }
.qz-anagram.is-solved .qz-slot { border-color: var(--right); background: var(--right-bg); }
.qz-anagram.is-revealed .qz-slot { border-color: var(--select); }
.qz-tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.qz-tile {
  border: 3px solid var(--ink);
  background: var(--tile);
  color: var(--tile-text);
  box-shadow: 0 4px 0 var(--ink);
}
.qz-tile:nth-child(4n + 2) { background: #8fe3ff; }
.qz-tile:nth-child(4n + 3) { background: #ffb3d9; }
.qz-tile:nth-child(4n + 4) { background: #a6f0b8; }
.qz-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.qz-tile:disabled { visibility: hidden; }
@media (max-width: 420px) {
  .qz-slot, .qz-tile { width: 2.25rem; height: 2.75rem; font-size: 1.25rem; }
}
.shake { animation: qz-shake 0.4s; }
@keyframes qz-shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Match the pairs */
.qz-pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.qz-pairs__photos { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 640px) {
  .qz-pairs__photos { grid-template-columns: 1fr 1fr; }
}
.qz-pairs__names { display: grid; gap: 8px; }
.qz-pair-photo {
  position: relative;
  padding: 0;
  border: 4px solid var(--ink);
  border-radius: 16px;
  background: var(--photo-bg);
  cursor: pointer;
  overflow: hidden;
}
.qz-pair-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.qz-pair-photo.is-selected { border-color: var(--select); transform: scale(1.03); }
.qz-pair-photo.is-right { border-color: var(--right); cursor: default; }
.qz-pair-num, .qz-pair-tag {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--select);
  color: var(--ink);
  font-weight: 900;
  font-size: 0.9rem;
}
.qz-pair-num { position: absolute; top: 6px; left: 6px; }
.qz-pair-photo.is-right .qz-pair-num { background: var(--right); color: #fff; }
.qz-pair-tag { margin-right: 6px; background: var(--right); color: #fff; }
.qz-pair-name {
  min-height: 52px;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}
.qz-pair-name:disabled { cursor: default; }
.qz-credits { margin-top: 16px; font-size: 0.8rem; color: var(--muted); }
.qz-credits ol { padding-left: 20px; }
.qz-credits > p { margin: 0 0 4px; font-weight: 700; }
.qz-credits .qz-credit { margin: 0 0 4px; }

/* Word search (board from /assets/word-search.js) */
.ws { display: grid; gap: 14px; }
.ws-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--ws-n), 1fr);
  width: 100%;
  max-width: min(560px, 68vh);
  margin: 0 auto;
  aspect-ratio: 1;
  padding: 4px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 5px 0 var(--ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
  /* Letters scale with the grid: about half a cell tall. */
  font-size: calc(min(100vw - 72px, 552px, 68vh - 14px) / var(--ws-n) * 0.55);
}
.ws-grid:focus-visible { outline: 3px solid var(--qz-accent, var(--trains)); outline-offset: 2px; }
.ws-grid.is-done { cursor: default; }
.ws-cell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  font-weight: 800;
  line-height: 1;
  border-radius: 50%;
}
.ws-cell.is-anchor { background: var(--select); color: var(--ink); }
.ws-cell.is-cursor { box-shadow: inset 0 0 0 2px var(--qz-accent, var(--trains)); }
.ws-cell.is-hint { animation: ws-glow 1s ease-in-out infinite alternate; }
@keyframes ws-glow {
  from { background: transparent; }
  to { background: var(--select); color: var(--ink); }
}
.ws-marks { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); pointer-events: none; }
.ws-marks line { stroke-width: 0.78; stroke-linecap: round; }
.ws-mark { opacity: 0.45; }
.ws-mark--shown { stroke: var(--muted); opacity: 0.3; stroke-dasharray: 0.01 0.25; }
.ws-live { stroke: var(--select); opacity: 0.55; }
.ws-miss { animation: qz-shake 0.35s; }

.ws-words { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0; padding: 0; list-style: none; }
.ws-word {
  padding: 6px 12px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 3px 0 var(--ink);
  font-weight: 900;
  letter-spacing: 0.04em;
}
.ws-word.is-found { border-color: var(--right); background: var(--right-bg); text-decoration: line-through; text-decoration-thickness: 3px; }
.ws-word.is-found::before { content: "✔ "; }
.ws-word.is-shown { border-style: dashed; color: var(--muted); }
/* Fun facts pile up under the grid as words are found. Turn off scroll
   anchoring on word search pages, or the browser scrolls the grid away. */
html:has(.ws-app) { overflow-anchor: none; }
.ws-log { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.ws-log li { padding: 8px 12px; border: 2px solid var(--border); border-left: 8px solid var(--right); border-radius: 12px; background: var(--bg); }
.ws-log b { letter-spacing: 0.04em; }
.ws-log .is-hinted { border-left-color: var(--select); }
.ws-log .is-shown { border-left-color: var(--track); color: var(--muted); }

/* End screen */
.qz-end { text-align: center; }
.qz-end__stars { font-size: 3.4rem; letter-spacing: 6px; color: #ffb703; text-shadow: 0 3px 0 var(--ink); animation: qz-pop 0.6s; }
.qz-end__title { margin: 8px 0; font-size: 2rem; }
.qz-end__score { font-size: 1.3rem; font-weight: 700; }
.qz-end__best { display: inline-block; padding: 2px 12px; border-radius: 999px; background: var(--right-bg); font-weight: 900; color: var(--right); }

/* Confetti */
.qz-confetti {
  position: fixed;
  top: -40px;
  z-index: 10;
  pointer-events: none;
  animation: qz-fall 2.2s ease-in forwards;
}
@keyframes qz-fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0.6; }
}
@media (prefers-reduced-motion: reduce) {
  .qz-track__train { transition: none; }
  .qz-zoom__frame img { transition: none; }
  .shake, .ws-miss, .ws-cell.is-hint, .qz-start__emoji, .qz-streak, .qz-option.is-right, .qz-end__stars { animation: none; }
  .qz-level, .qz-option, .qz-btn, .qz-duel__pick { transition: none; }
  .ws-cell.is-hint { background: var(--select); color: var(--ink); }
}

/* Rockets: purple accent, a rocket flying to the Moon, and tall photos */
.hero--rockets {
  background:
    radial-gradient(circle at 15% 30%, #fff 1.5px, transparent 2.5px),
    radial-gradient(circle at 70% 60%, #fff 1px, transparent 2px),
    radial-gradient(circle at 40% 80%, #ffe066 1.5px, transparent 2.5px),
    linear-gradient(120deg, #a35cff, #6a3cf0 50%, #2f2bb0);
  background-size: 90px 70px, 60px 50px, 120px 90px, auto;
}
.theme-rockets { --qz-accent: var(--rockets); }
.qz-track--space { background: radial-gradient(circle, var(--track) 1.5px, transparent 2px) bottom 8px left / 18px 6px repeat-x; border-bottom: none; }
.qz-track__rocket { transform: translateX(-50%) rotate(45deg); }
.theme-rockets .qz-duel__pick img { aspect-ratio: 3 / 4; object-fit: cover; }
.qz-duel--four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 560px) {
  .qz-duel--four { grid-template-columns: 1fr 1fr; }
}

/* Height chart: two rockets next to a 9-year-old */
.qz-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  height: 220px;
  margin: 8px 0 16px;
  padding: 0 8px;
}
.qz-bars__col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; width: 84px; }
.qz-bars__bar { width: 34px; background: var(--qz-accent, var(--rockets)); border: 3px solid var(--ink); border-radius: 17px 17px 4px 4px; transition: height 0.8s ease-out; }
.qz-bars__bar--kid { width: 18px; background: var(--select); border-radius: 9px 9px 2px 2px; }
.qz-bars__value { font-weight: 800; font-size: 0.9rem; margin-bottom: 4px; }
.qz-bars__label { margin-top: 6px; font-size: 0.8rem; font-weight: 700; text-align: center; line-height: 1.2; min-height: 2.4em; border-top: 3px solid var(--track); padding-top: 4px; width: 100%; }

/* General knowledge: Malaysia green and blue, a tiger running to the finish, flags on a light card */
.hero--general { background: linear-gradient(120deg, #20b356, #12a07a 50%, #1c86d6); }
.theme-general { --qz-accent: var(--general); }
.qz-photo--flag img { max-height: 200px; background: #fff; padding: 10px; box-sizing: border-box; }
.qz-duel__noimg {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  font-size: 3rem;
  background: color-mix(in srgb, var(--qz-accent, var(--general)) 14%, var(--surface));
  border-radius: 12px;
}
.theme-general .qz-duel__name { font-size: 0.95rem; line-height: 1.25; }

/* Russian alphabet: pink and blue, letters drawn as big text instead of photos */
.hero--russian { background: linear-gradient(120deg, #ff4fa8, #c63ad8 50%, #3f63f0); }
.theme-russian { --qz-accent: var(--russian); }
.hero--coptic { background: linear-gradient(120deg, #f5a623, #e2603a 45%, #0e9aa7); }
.theme-coptic { --qz-accent: var(--coptic); }
.ru-show { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 12px; text-align: center; }
.ru-show p { margin: 0; }
.ru-glyph {
  min-width: 2.4em;
  padding: 0.12em 0.3em;
  font-family: var(--font-body);
  font-size: clamp(4rem, 18vw, 6.5rem);
  font-weight: 900;
  line-height: 1.1;
  color: #fff;
  background: linear-gradient(135deg, var(--qz-accent, var(--russian)), #1d4ed8);
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 6px 0 var(--ink);
  text-align: center;
}
.ru-glyph--vowel { background: linear-gradient(135deg, #e11d48, #f97316); }
.ru-glyph--consonant { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.ru-glyph--sign { background: linear-gradient(135deg, #64748b, #334155); }
.ru-bigword { font-family: var(--font-body); font-size: clamp(2.2rem, 10vw, 3.4rem); font-weight: 900; letter-spacing: 0.06em; color: var(--qz-accent, var(--russian)); }
.ru-bigword--clue { font-size: clamp(1.8rem, 8vw, 2.6rem); }
.ru-emoji { font-size: 5rem; line-height: 1.1; }
.ru-clue { font-size: 1.2rem; font-weight: 700; }
.qz-option--glyph { font-family: var(--font-body); font-size: 2.2rem; font-weight: 900; line-height: 1; }
.qz-options--glyphs { grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); }
.ru-say { min-height: 40px; padding: 6px 14px; }
.ru-wordcard {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--bg);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 3px 0 var(--ink);
}
.ru-wordcard__emoji { font-size: 2.4rem; line-height: 1; }
.ru-wordcard__text { flex: 1; }
.ru-pairs__letters { grid-template-columns: 1fr 1fr; }
.ru-pair-letter {
  min-height: 64px;
  font: inherit;
  font-family: var(--font-body);
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--qz-accent, var(--russian)), #1d4ed8);
}
.ru-pair-letter.is-right { opacity: 0.7; }

/* Meet the Letters chart */
.ru-chart { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; margin-top: 12px; }
.ru-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 6px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  color: #fff;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.12s;
}
.ru-tile:hover { transform: translateY(-2px); }
.ru-tile[aria-pressed="true"] { outline: 4px solid var(--select); outline-offset: 1px; transform: scale(1.08); }
.ru-tile--vowel { background: linear-gradient(135deg, #e11d48, #f97316); }
.ru-tile--consonant { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.ru-tile--sign { background: linear-gradient(135deg, #64748b, #334155); }
.ru-tile__big { font-family: var(--font-body); font-size: 1.8rem; font-weight: 900; line-height: 1; }
.ru-tile__small { font-size: 1rem; opacity: 0.9; }
.ru-detail__head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.ru-detail__head .ru-glyph { font-size: 4.5rem; }
.ru-detail__name { margin: 4px 0; font-size: 1.4rem; }
.ru-detail__head p { margin: 4px 0; }
.ru-lore { font-size: 1.1rem; }

/* Letter characters: original googly-eyed faces drawn over each Russian letter */
.ru-char {
  position: relative;
  display: inline-grid;
  place-items: center;
  font-family: var(--font-body);
  font-weight: 900;
  line-height: 1;
}
.ru-char--big { font-size: clamp(5rem, 24vw, 8rem); min-width: 1em; }
.ru-char--mid { font-size: 3rem; min-width: 1em; }
.ru-char--small { font-size: 2.1rem; min-width: 1em; }
.ru-char__letter {
  grid-area: 1 / 1;
  color: var(--c);
  -webkit-text-stroke: 0.04em var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 0.05em 0 var(--ink);
}
.ru-char__face, .ru-char__planet { grid-area: 1 / 1; width: 0.9em; height: 0.9em; pointer-events: none; }
.ru-char__face { transform: translateY(0.02em); }
.ru-char__planet { width: 1.15em; height: 1.15em; }
.ru-char--planet .ru-char__letter { color: #fff7d6; font-size: 0.6em; }
.ru-char--planet .ru-char__face { width: 0.75em; height: 0.75em; }
.ru-char__badge { position: absolute; top: -0.05em; right: -0.15em; font-size: 0.3em; }
.ru-char--jumpy { animation: ru-hop 1.6s ease-in-out infinite; }
@keyframes ru-hop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-0.12em); } }
@media (prefers-reduced-motion: reduce) { .ru-char--jumpy { animation: none; } }
.ru-show__pair { display: flex; align-items: flex-end; gap: 10px; }
.ru-show__lower { font-size: 2.6rem; font-weight: 900; color: var(--muted); }
.qz-option--glyph .ru-char--mid { font-size: 2.6rem; }
/* Chart tiles: white stickers with a colour stripe for vowels, consonants and signs */
.ru-tile, .ru-tile--vowel, .ru-tile--consonant, .ru-tile--sign {
  background: var(--surface);
  color: var(--text);
  border: 3px solid var(--ink);
  box-shadow: var(--pop-sm);
  padding-bottom: 8px;
}
.ru-tile--vowel { border-bottom: 8px solid #ff4f6d; }
.ru-tile--consonant { border-bottom: 8px solid #3f63f0; }
.ru-tile--sign { border-bottom: 8px solid #8b8fa8; }
.ru-tile .ru-char--small { font-size: 2rem; }
.ru-credit { margin-top: 14px; }

/* Coptic: letters come from the Noto Sans Coptic web font (most devices have no Coptic letters
   built in). Anything marked lang="cop" uses it; Latin text and emoji fall back to the normal fonts. */
[lang="cop"], [lang="cop"] * { font-family: "Noto Sans Coptic", var(--font-body); }
/* Coptic letters inside ordinary English sentences fall through to the Coptic font too. */
.theme-coptic {
  --font-body: "Nunito", "Noto Sans Coptic", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-fun: "Fredoka", "Nunito", "Noto Sans Coptic", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.ru-char__badge--left { right: auto; left: -0.2em; }
