/* tapqyr shell + components. Mobile-first. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); background: var(--paper); color: var(--ink);
  font-size: 16px; line-height: 1.55;
}
a { color: var(--turquoise-dk); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
button { font-family: inherit; }

/* ---------- shell ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--maxw-wide); margin: 0 auto; padding: 14px 16px;
}
.logo { font-weight: 800; font-size: 22px; color: var(--ink); letter-spacing: -.02em; }
.logo:hover { text-decoration: none; }
.logo .dot { color: var(--turquoise); }
.site-nav a { color: var(--ink-soft); font-weight: 600; font-size: 14px; margin-left: 16px; }
.site-nav a:hover { color: var(--turquoise-dk); text-decoration: none; }

.ornament { display: block; margin: 4px auto 0; width: 140px; opacity: .85; }
.ornament--footer { margin: 0 auto 10px; }

main { max-width: var(--maxw-wide); margin: 0 auto; padding: 8px 16px 48px; }
main.narrow { max-width: var(--maxw); }

.site-footer {
  border-top: 1px solid var(--tile-border); background: var(--paper-dim);
  padding: 28px 16px 36px; text-align: center; color: var(--ink-soft); font-size: 14px;
}
.site-footer nav { margin-bottom: 10px; }
.site-footer nav a { margin: 0 10px; color: var(--ink-soft); font-weight: 600; }
.sa-badge { margin-top: 12px; }

/* ---------- shared bits ---------- */
h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.8px; line-height: 1.15; margin: 18px 0 8px; }
.lead { color: var(--ink-soft); font-size: 17px; margin: 0 0 20px; }
.btn {
  display: inline-block; border: 0; cursor: pointer; border-radius: var(--radius);
  font-weight: 600; font-size: 16px; padding: 13px 24px; min-height: 44px;
  transition: background .15s;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-dk); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--tile-border); }
.btn-ghost:hover { background: var(--paper-dim); text-decoration: none; }
.card {
  background: var(--tile); border: 1px solid var(--tile-border);
  border-radius: var(--radius-lg); padding: 22px;
}
.chip {
  display: inline-block; background: var(--paper-dim);
  border-radius: 999px; padding: 6px 15px; margin: 0 6px 8px 0; font-size: 14px;
  font-weight: 500; color: var(--ink);
}
.chip:hover { background: var(--gold-soft); text-decoration: none; }

/* ---------- hub ---------- */
.hero { text-align: center; padding: 44px 0 18px; position: relative; }
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%; z-index: -1;
}
.hero::before { width: 130px; height: 130px; background: var(--turquoise-bg); left: -30px; top: 6px; }
.hero::after { width: 90px; height: 90px; background: var(--gold-soft); right: -14px; bottom: -6px; }
.hero h1 { font-size: 46px; letter-spacing: -1.3px; margin: 14px 0 10px; line-height: 1.12; }
.hero .hl {
  background: linear-gradient(transparent 58%, var(--gold-soft) 58%);
  border-radius: 4px; padding: 0 4px;
}
.hero .lead { margin-bottom: 26px; font-size: 19px; }
.btn-big { font-size: 19px; padding: 16px 34px; border-radius: 16px; }
.hero-note { color: var(--ink-soft); font-size: 14px; margin-top: 12px; }
.section-title { font-size: 27px; font-weight: 600; letter-spacing: -0.5px; margin: 38px 0 0; }
.games-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 18px 0 30px; }
@media (min-width: 560px) { .games-grid { grid-template-columns: 1fr 1fr; } }

/* saturated card cycle — never two alike in a row. NYT-style: illustration is the hero */
.game-card {
  display: block; color: inherit; position: relative; overflow: hidden;
  border: 0; border-radius: var(--radius-xl); padding: 30px 24px 26px;
  text-align: center; transition: transform .15s;
}
.game-card:hover { text-decoration: none; transform: translateY(-3px) scale(1.01); }
.game-card .illo { margin: 4px auto 12px; animation: illo-float 3.6s ease-in-out infinite; }
@keyframes illo-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .game-card .illo { animation: none; } }
.game-card h2 { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
.game-card p { margin: 0 auto; font-size: 16px; opacity: .85; line-height: 1.5; max-width: 300px; }
.game-card .play {
  display: inline-block; margin-top: 16px; font-weight: 700; font-size: 16px;
  background: #fff; color: var(--ink); border-radius: 999px; padding: 10px 30px;
}
.gc-teal  { background: var(--turquoise); color: #fff; }
.gc-teal .icon { background: rgba(255,255,255,.2); }
.gc-gold  { background: var(--gold); color: var(--ink); }
.gc-sage  { background: var(--sage); color: var(--ink); }
.gc-coral { background: var(--coral); color: #fff; }
.gc-coral .icon { background: rgba(255,255,255,.22); }
.soon-badge {
  position: absolute; top: 16px; right: -34px; transform: rotate(38deg);
  background: var(--ink); color: #fff; font-size: 11px; font-weight: 600;
  padding: 4px 38px; letter-spacing: 1px;
}
.seo-block { margin-top: 48px; color: var(--ink-soft); font-size: 16px; }
.seo-block h2 { color: var(--ink); font-size: 22px; font-weight: 600; letter-spacing: -0.3px; }

/* ---------- game ---------- */
.mode-hint { font-weight: 700; font-size: 17px; margin: 22px 0 10px; }
.mode-select { display: grid; gap: 12px; margin: 12px 0 20px; }
.mode-card { text-align: left; cursor: pointer; width: 100%; }
.mode-card:hover { border-color: var(--turquoise); transform: translateY(-2px); }
.mode-go {
  display: inline-block; margin-top: 12px; background: var(--turquoise); color: #fff;
  border-radius: 999px; padding: 9px 26px; font-weight: 700; font-size: 15px;
}
.mode-card:hover .mode-go { background: var(--turquoise-dk); }
.mode-go--alt { background: transparent; color: var(--turquoise-dk); border: 2px solid var(--turquoise); padding: 7px 24px; }
.mode-card:hover .mode-go--alt { background: var(--turquoise-bg); color: var(--turquoise-dk); }
.mode-card h2 { margin: 0 0 3px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.mode-card p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.mode-card .best { margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--gold); }

#game { display: none; }
.hud {
  display: flex; justify-content: space-between; align-items: center;
  margin: 14px 0 12px; font-weight: 700; font-size: 17px; min-height: 28px;
}
.hud .lives { display: flex; gap: 7px; align-items: center; }
.pip { width: 13px; height: 13px; border-radius: 50%; background: var(--coral); }
.pip.lost { background: var(--tile-border); }

.proverb-card {
  min-height: 130px; display: flex; align-items: center;
  text-align: left; font-size: 21px; font-weight: 600; line-height: 1.6; padding: 22px 20px;
}
.proverb-card .blank {
  display: inline-block; min-width: 64px; text-align: center;
  border-bottom: 3px solid var(--gold);
  color: var(--turquoise-dk); font-weight: 800; margin: 0 2px;
}
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.answers button {
  min-height: 54px; padding: 10px 8px; font-size: 16px; font-weight: 600; cursor: pointer;
  background: var(--tile); color: var(--ink); border: 2px solid var(--tile-border);
  border-radius: var(--radius); transition: background .12s, border-color .12s;
  overflow-wrap: break-word; word-break: break-word;
}
@media (max-width: 400px) { .answers button { font-size: 15px; } }
.answers button:hover { border-color: var(--turquoise); }
.answers button.correct { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.answers button.wrong { background: var(--error-bg); border-color: var(--error); color: var(--error); animation: shake .35s; }
.answers button:disabled { cursor: default; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

.feedback { text-align: center; min-height: 24px; margin-top: 12px; font-weight: 700; }
.next-wrap { text-align: center; margin-top: 14px; min-height: 48px; }
#next-btn { display: none; }
.emoji-display { font-size: 42px; letter-spacing: 8px; justify-content: center; text-align: center; }
.emoji-display.xl { font-size: 64px; min-height: 200px; }
img.emoji { height: 1em; width: 1em; vertical-align: -0.12em; display: inline-block; }
.emoji-display img.emoji { margin: 0 5px; }
.answers--stack { grid-template-columns: 1fr; }
.answers--stack button { text-align: left; font-size: 15px; }
#answer-reveal {
  display: none; text-align: center; font-size: 24px; font-weight: 600;
  line-height: 1.5; margin-top: 18px; color: var(--turquoise-dk);
}
#reveal-btn { display: none; }
.feedback.good { color: var(--success); }
.feedback.bad { color: var(--error); }

/* run over */
#gameover { display: none; text-align: center; }
.score-card { padding: 28px 20px; }
.score-card .big { font-size: 56px; font-weight: 800; color: var(--turquoise-dk); line-height: 1; }
.score-card .mode-label { color: var(--ink-soft); font-weight: 600; margin-top: 4px; }
.score-card .best-line { margin-top: 10px; font-weight: 700; color: var(--gold); }
.score-card .brand { margin-top: 14px; font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.share-row { display: flex; gap: 10px; justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.share-box { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 18px 0 6px; }
.sh-btn {
  display: inline-block; cursor: pointer; border-radius: 999px; font-weight: 700;
  font-size: 15px; padding: 10px 18px; border: 2px solid; background: var(--tile);
  transition: transform .1s;
}
.sh-btn:hover { text-decoration: none; transform: translateY(-1px); }
.sh-wa { color: #1DA851; border-color: #25D366; }
.sh-tg { color: #1E96C8; border-color: #2AABEE; }
.sh-th { color: var(--ink); border-color: var(--ink); }
.sh-copy, .sh-more { color: var(--ink-soft); border-color: var(--tile-border); }
.missed { text-align: left; margin-top: 22px; }
.missed h2 { font-size: 18px; }
.missed li { margin-bottom: 8px; }
.missed .ans { color: var(--turquoise-dk); font-weight: 700; }

/* ---------- game intro demos (looping, css-only) ---------- */
.g-demo, .e-demo { max-width: 340px; margin: 18px auto 24px; }
.g-demo-q, .e-demo-emoji {
  background: var(--tile); border: 1px solid var(--tile-border);
  border-radius: var(--radius-lg); padding: 16px; text-align: center;
  font-weight: 600; font-size: 18px;
}
.e-demo-emoji { font-size: 30px; }
.e-demo-emoji img.emoji { margin: 0 4px; }
.g-demo-blank {
  display: inline-block; min-width: 76px; border-bottom: 3px solid var(--gold);
  color: var(--turquoise-dk); font-weight: 800; position: relative; text-align: center;
}
.g-demo-blank i { font-style: normal; }
.g-demo-blank .q { animation: gd-q 5s infinite; }
.g-demo-blank .a { position: absolute; left: 0; right: 0; top: 0; opacity: 0; animation: gd-a 5s infinite; }
@keyframes gd-q { 0%, 44% { opacity: 1; } 50%, 92% { opacity: 0; } 98%, 100% { opacity: 1; } }
@keyframes gd-a { 0%, 46% { opacity: 0; } 52%, 90% { opacity: 1; } 96%, 100% { opacity: 0; } }
.g-demo-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.e-demo-opts { display: grid; gap: 8px; margin-top: 10px; }
.g-demo-opts span, .e-demo-opts span {
  background: var(--tile); border: 2px solid var(--tile-border); border-radius: var(--radius-sm);
  padding: 9px 8px; text-align: center; font-weight: 600; font-size: 14px;
}
.g-demo-opts .dc, .e-demo-opts .dc { animation: gd-c 5s infinite; }
@keyframes gd-c {
  0%, 28%  { background: var(--tile); border-color: var(--tile-border); color: var(--ink); }
  34%, 44% { background: var(--ink); border-color: var(--ink); color: #fff; }
  50%, 90% { background: var(--success-bg); border-color: var(--success); color: var(--success); }
  96%, 100% { background: var(--tile); border-color: var(--tile-border); color: var(--ink); }
}

/* ---------- байланыс ---------- */
.b-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.b-tile {
  min-height: 56px; padding: 4px 2px; cursor: pointer; border-radius: var(--radius-sm);
  background: var(--tile); color: var(--ink); border: 2px solid var(--tile-border);
  font-weight: 600; font-size: 13px; overflow-wrap: break-word; word-break: break-word;
  transition: background .1s, border-color .1s;
}
@media (max-width: 400px) { .b-tile { font-size: 11px; min-height: 50px; } }
.b-tile.selected { background: var(--ink); border-color: var(--ink); color: #fff; }
.b-tile.shake { animation: shake .35s; }
.b-controls { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.b-mistakes {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  margin-top: 14px; color: var(--ink-soft); font-weight: 600; font-size: 14px;
}
.b-mistakes .lives { display: flex; gap: 7px; }
.b-solved {
  min-height: 56px; display: flex; flex-direction: column; justify-content: center;
  border-radius: var(--radius-sm); padding: 6px 12px; margin-bottom: 8px; text-align: center;
  animation: b-solved-in .35s ease-out;
}
@keyframes b-solved-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; } }
.b-solved .b-theme { font-weight: 800; font-size: 13.5px; letter-spacing: .02em; text-transform: uppercase; line-height: 1.3; }
.b-solved .b-words { font-size: 13.5px; opacity: .9; line-height: 1.3; }
@media (max-width: 400px) { .b-solved { min-height: 50px; } }
/* intro demo: a 4×4 board where one hidden group lights up, then merges into
   a theme row (looping) */
.b-demo { max-width: 340px; margin: 22px auto; cursor: pointer; animation: b-demo-fade 10s infinite; }
.b-demo-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.b-demo-tiles span {
  display: block; text-align: center; padding: 8px 2px; font-size: 11px; font-weight: 600;
  background: var(--tile); color: var(--ink); border: 2px solid var(--tile-border);
  border-radius: var(--radius-sm); overflow-wrap: break-word;
}
.b-demo-tiles .dm {
  animation: b-demo-tile 10s infinite;
  animation-delay: calc(var(--i) * 0.45s);
  position: relative; z-index: 2;
}
/* slow narrative loop: words get picked one by one, fly into the banner slot,
   the banner appears only AFTER the last (most-delayed) tile has landed, the
   result HOLDS, then the whole demo fades out and starts fresh (no revert). */
@keyframes b-demo-fade {
  0% { opacity: 0; }
  5%, 86% { opacity: 1; }
  91%, 100% { opacity: 0; }
}
@keyframes b-demo-tile {
  0%, 6%   { background: var(--tile); color: var(--ink); border-color: var(--tile-border); transform: none; opacity: 1; }
  12%, 30% { background: var(--ink); color: #fff; border-color: var(--ink); transform: none; opacity: 1; }
  34%, 40% { background: var(--ink); color: #fff; border-color: var(--ink);
             transform: translate(var(--tx), var(--ty)) scale(.92); opacity: .95; }
  42%, 90% { transform: translate(var(--tx), var(--ty)) scale(.9); opacity: 0; }
  95%, 100% { background: var(--tile); color: var(--ink); border-color: var(--tile-border); transform: none; opacity: 1; }
}
.b-demo-solved { margin-bottom: 8px; opacity: 0; animation: b-demo-row 10s infinite; }
@keyframes b-demo-row {
  0%, 52%  { opacity: 0; transform: translateY(6px); }
  58%, 92% { opacity: 1; transform: translateY(0); }
  96%, 100% { opacity: 0; }
}

.b-solved.g0 { background: var(--gold); color: var(--ink); }
.b-solved.g1 { background: var(--sage); color: var(--ink); }
.b-solved.g2 { background: var(--turquoise); color: #fff; }
.b-solved.g3 { background: var(--coral); color: #fff; }

/* ---------- topic pages ---------- */
.breadcrumbs { font-size: 13px; color: var(--ink-soft); margin-top: 12px; }
.proverb-list { padding-left: 22px; }
.proverb-list li { margin-bottom: 10px; font-size: 17px; }
.topic-cta { margin: 26px 0; text-align: center; }
.topics-grid { display: flex; flex-wrap: wrap; margin-top: 18px; }

.center { text-align: center; }
.mt { margin-top: 20px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- question sets (жинақ) ---------- */
.set-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0 26px; }
.set-chip {
  font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; cursor: pointer;
  border-radius: 999px; border: 1.5px solid var(--tile-border); background: #fff; color: var(--ink);
}
.set-chip i { font-style: normal; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-left: 5px; }
.set-chip.done { border-color: var(--sage); }
.set-chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.set-chip.on i { color: rgba(255, 255, 255, .75); }
.set-chip img.emoji { width: 15px; height: 15px; margin-right: 2px; }
.set-tag { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

/* ---------- question feedback ---------- */
.qfb { min-height: 34px; margin-top: 10px; display: flex; justify-content: center; align-items: center; }
.qfb-in { display: flex; align-items: center; gap: 8px; }
.qfb-q { font-size: 13px; color: var(--ink-soft); }
.qfb-btn {
  font-size: 15px; line-height: 1; padding: 6px 11px; cursor: pointer;
  background: #fff; border: 1.5px solid var(--tile-border); border-radius: 999px;
}
.qfb-btn:hover { border-color: var(--ink); }
.qfb-btn img.emoji { width: 16px; height: 16px; display: block; }
.qfb-done { font-size: 13px; color: var(--ink-soft); }
.fb-box { display: flex; gap: 8px; align-items: stretch; max-width: 440px; margin: 18px auto 0; }
.fb-box textarea {
  flex: 1; font: inherit; font-size: 14px; padding: 10px 12px; resize: vertical; min-height: 44px;
  background: #fff; color: var(--ink); border: 1.5px solid var(--tile-border); border-radius: var(--radius-sm);
}
.fb-box textarea:focus { outline: none; border-color: var(--turquoise); }
.fb-box .qfb-done { margin: auto; }

/* answered: the blank fills with the correct word */
.proverb-card .blank.filled { border-bottom-color: var(--sage); min-width: 0; padding: 0 4px; }

/* onboarding demos are clickable shortcuts into the game */
.g-demo, .e-demo { cursor: pointer; }
