/* ============================================================
   «Ребусы» — стили (docs/09-games.md)
   Позиционные ребусы (буква над буквой, под, в, за) рисуются
   здесь вёрсткой: игра работает с диска, картинок в ней нет.
   ============================================================ */

:root {
  --accent: #FF7A59;
  --accent2: #4EC5F1;
  --ok: #3BC97D;
  --bad: #FF5A6E;
  --ink: #2E2A4F;
  --card: #FFFFFF;
  --soft: #FFF3E9;
  /* фон и акцент темы — переопределяются из game.js при смене темы */
  --bg1:#FFF6E5; --bg2:#FFE3F1; --bg3:#E6F4FF;
  --theme-accent:#FF7A59;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: "Naukino Emoji", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  transition: background .6s ease;
  background-attachment: fixed;
  padding: 72px 12px 40px;      /* сверху место для кнопок звука */
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 900px; position: relative; z-index: 1; margin: 0 auto; }
.hidden { display: none !important; }

.card {
  background: var(--card);
  border-radius: 28px;
  padding: clamp(14px, 3.5vw, 30px);
  box-shadow: 0 14px 34px rgba(46, 42, 79, 0.14);
}

.title {
  font-size: clamp(28px, 6vw, 42px);
  margin: 0 0 10px;
  text-align: center;
  color: var(--accent);
}
.subtitle {
  font-size: clamp(17px, 3.4vw, 21px);
  line-height: 1.45;
  text-align: center;
  margin: 0 0 18px;
}
.section-title {
  font-size: clamp(19px, 3.6vw, 24px);
  text-align: center;
  margin: 20px 0 12px;
}

/* ---------- Верхние кнопки звука ---------- */
.top-buttons {
  position: fixed; top: 10px; right: 10px;
  display: flex; gap: 8px; z-index: 30;
}
.icon-btn {
  font-size: 24px; width: 52px; height: 52px;
  border: none; border-radius: 18px; background: #fff;
  box-shadow: 0 5px 14px rgba(46, 42, 79, 0.18);
  cursor: pointer;
  transition: transform .12s ease, opacity .15s ease;
}
.icon-btn:hover { transform: translateY(-2px) scale(1.05); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.off { opacity: .45; }

/* ---------- Совёнок Наум ---------- */
.hero-panel {
  display: flex; align-items: center; gap: 12px;
  background: var(--soft); border-radius: 22px;
  padding: 12px 14px; margin: 14px 0;
}
.hero-panel.compact { padding: 8px 10px; margin: 10px 0; }
.hero-art { font-size: clamp(34px, 7vw, 50px); line-height: 1; flex: 0 0 auto; }
.bubble {
  background: #fff; border-radius: 18px; padding: 10px 14px;
  font-size: clamp(15px, 3vw, 19px); line-height: 1.4;
  box-shadow: 0 3px 10px rgba(46, 42, 79, 0.10);
  flex: 1 1 auto; min-width: 0;
}

@keyframes jump {
  0%, 100% { transform: translateY(0) rotate(0); }
  30%      { transform: translateY(-16px) rotate(-8deg); }
  60%      { transform: translateY(-6px) rotate(6deg); }
}
@keyframes wobble {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-11deg); }
  75%      { transform: rotate(11deg); }
}
.hero-jump  { animation: jump .6s ease; }
.hero-shake { animation: wobble .5s ease; }

/* ---------- Выбор возрастной группы ---------- */
.levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.level-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 4px solid transparent; border-radius: 22px;
  background: var(--soft); padding: 14px 10px;
  cursor: pointer; font-family: inherit; color: var(--ink);
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.level-btn:hover { transform: translateY(-3px); background: #FFE9D8; }
.level-btn:active { transform: scale(.97); }
.level-btn.selected { border-color: var(--accent); background: #FFEDE6; }
.level-emoji { font-size: 34px; }
.level-name { font-size: 21px; font-weight: 700; }
.level-desc { font-size: 14px; opacity: .75; text-align: center; }

.start-progress { text-align: center; font-size: 16px; font-weight: 600; opacity: .8; margin: 4px 0 6px; }
.start-bar { max-width: 420px; margin: 0 auto; }

/* ---------- Кнопки ---------- */
.big-btn {
  display: block; width: 100%; max-width: 420px; margin: 16px auto 0;
  padding: 15px 20px;
  font-size: clamp(18px, 3.6vw, 23px); font-weight: 700; font-family: inherit;
  color: #fff; background: linear-gradient(160deg, #FF9A78, var(--accent));
  border: none; border-radius: 22px;
  box-shadow: 0 8px 18px rgba(255, 122, 89, .38);
  cursor: pointer; transition: transform .14s ease, box-shadow .14s ease;
}
.big-btn:hover { transform: translateY(-3px); box-shadow: 0 12px 22px rgba(255, 122, 89, .45); }
.big-btn:active { transform: scale(.97); }
.big-btn.ghost {
  background: #F2EFFF; color: var(--ink);
  box-shadow: 0 6px 14px rgba(46, 42, 79, .12);
}
.mini-btn {
  border: none; background: var(--soft); color: var(--ink);
  font-family: inherit; font-size: 15px; padding: 9px 13px;
  border-radius: 14px; cursor: pointer; white-space: nowrap;
}
.mini-btn:hover { background: #FFE0CC; }

:focus-visible { outline: 4px solid var(--accent2); outline-offset: 3px; }

/* ---------- Шапка игры ---------- */
.game-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.progress-info { flex: 1 1 160px; min-width: 130px; font-size: 15px; font-weight: 600; }
.progress-bar {
  height: 12px; background: #F0ECFA; border-radius: 10px;
  overflow: hidden; margin-top: 5px;
}
.progress-fill {
  height: 100%; width: 0; border-radius: 10px;
  background: linear-gradient(90deg, var(--accent2), var(--ok));
  transition: width .35s ease;
}
.score-badge {
  background: #FFF6DA; border-radius: 14px; padding: 8px 12px;
  font-weight: 700; font-size: 17px; white-space: nowrap;
}

/* ---------- Карточка ребуса ---------- */
.rebus-card {
  background: #FBF9FF; border: 3px solid #EAE3FB;
  border-radius: 22px; padding: 12px 14px; margin-top: 10px;
}
.rebus-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.type-chip {
  background: var(--theme-accent); color: #fff;
  font-weight: 800; font-size: 14px; border-radius: 999px;
  padding: 5px 13px; transition: background .4s ease;
}
.rebus-tools { margin-left: auto; display: flex; gap: 6px; }
.tool-btn {
  border: none; background: #fff;
  box-shadow: 0 3px 9px rgba(46, 42, 79, .12);
  border-radius: 14px; height: 42px; min-width: 42px; padding: 0 10px;
  font-size: 18px; font-family: inherit; cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.tool-btn:hover { transform: translateY(-2px); background: #FFF3E9; }
.tool-btn:active { transform: scale(.93); }
.hint-btn { font-weight: 800; font-size: 16px; background: #FFF6DA; }
.hint-btn.empty { opacity: .45; }

/* ---------- Сама строка ребуса ---------- */
.rebus {
  display: flex; flex-wrap: wrap;
  align-items: flex-end; justify-content: center;
  gap: 4px 6px;
  /* высота держится ровной, чтобы карточка не прыгала между заданиями,
     но и не оставляла дыру под коротким ребусом */
  min-height: clamp(92px, 24vw, 128px);
  margin: 10px 0 4px;
  user-select: none;
}
.plus {
  font-size: clamp(26px, 5.5vw, 38px); font-weight: 800;
  color: #9187C4; align-self: flex-end; padding: 0 2px 6px;
}

.chip { display: inline-flex; flex-direction: column; align-items: center; }
.chip-row { display: inline-flex; align-items: center; gap: 2px; }
.chip-body { display: inline-flex; flex-direction: column; align-items: center; }

/* картинка: подпись словом появляется по нажатию, по 🔎 и после проверки */
.chip.pic { cursor: pointer; border-radius: 16px; padding: 2px 4px; }
.chip.pic:hover { background: #F3EEFF; }
.emo { font-size: clamp(46px, 12vw, 68px); line-height: 1.05; }
.cap {
  font-size: 14px; font-weight: 700; letter-spacing: .02em;
  color: #6B628F; opacity: 0; height: 18px;
  transition: opacity .25s ease;
}
.chip.pic.shown .cap { opacity: 1; }

.ltr {
  font-size: clamp(38px, 9vw, 56px); font-weight: 800; line-height: 1.05;
  letter-spacing: .04em; color: var(--ink);
}
.num {
  font-size: clamp(38px, 9vw, 56px); font-weight: 800; line-height: 1.05;
  color: #2E7BC4;
}

/* Запятые, которые убирают буквы. Держатся на высоте картинки: запятая,
   отставшая вниз, читается как случайная закорючка. Но и вплотную к
   картинке ей нельзя: красный крючок у щеки смайлика ребёнок принимал
   за слезу, а у лапки зверя — за коготь. Поэтому запятая идёт своим
   знаком — с просветом и на светлой подложке. */
.cm {
  display: inline-flex; align-items: center; justify-content: center;
  width: .74em; height: .74em;
  /* Georgia, а не системный шрифт: у системного жирная запятая в таком
     кегле выходит красным клином и читается как косая черта. У Georgia
     она с шариком и хвостиком — знак узнаётся с одного взгляда. */
  font-family: "Naukino Emoji", Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 9vw, 56px); font-weight: 700; line-height: 1;
  color: var(--bad);
  align-self: center;
  margin: 0 5px;
  border-radius: 30%;
  background: rgba(255, 90, 110, .14);
}
/* Сама запятая внутри подложки: ink у неё внизу коробки, поэтому
   поднимаем глиф, а не всю плашку. */
.cm > span { display: block; transform: translateY(-0.26em); }

/* знаки над куском: «наоборот» и замена буквы */
.marks { display: flex; gap: 4px; margin-bottom: 4px; }
.mark {
  font-size: 18px; font-weight: 800; line-height: 1;
  border-radius: 999px; padding: 6px 11px;
}
.mk-rev { background: #D9EBFB; color: #17608F; font-size: 22px; padding: 4px 12px; }
.mk-sub { background: #FFE8C2; color: #925A0C; }

/* ---------- Положение как предлог ---------- */
.pos { display: inline-flex; flex-direction: column; align-items: center; }

/* «в»: буквы внутри большой буквы-основы */
.pos-outer {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
}
.pos-glyph {
  display: block;
  font-size: clamp(70px, 17vw, 112px); font-weight: 300; line-height: 1.05;
  color: #B7AADF;
  /* растягивается по ширине из game.js — по числу букв внутри */
  transform-origin: 50% 50%;
}
.pos-inner {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(19px, 4.6vw, 28px); font-weight: 800; line-height: 1;
  color: var(--ink); letter-spacing: .02em; white-space: nowrap;
}

/* «за»: буквы прячутся за буквой-основой */
.pos-za { position: relative; flex-direction: row; align-items: center; }
/* Прячется ровно край последней буквы: остальное ребёнок обязан прочитать */
.pos-behind {
  font-size: clamp(30px, 7vw, 44px); font-weight: 800; line-height: 1;
  color: #8F86BC; letter-spacing: .03em;
  margin-right: -0.20em;
}
.pos-front {
  position: relative; z-index: 2;
  font-size: clamp(52px, 13vw, 78px); font-weight: 800; line-height: 1;
  color: var(--ink);
  background: #FBF9FF;
  border-radius: 10px; padding: 2px 5px;
  box-shadow: -3px 0 0 rgba(46, 42, 79, .10);
}

/* «над» и «под»: стопка с чертой посередине */
.pos-nad, .pos-pod { gap: 2px; }
.pos-top, .pos-bottom {
  font-size: clamp(30px, 7vw, 44px); font-weight: 800; line-height: 1.1;
  letter-spacing: .03em; color: var(--ink);
}
.pos-line {
  display: block; width: 100%; min-width: 2.4em; height: 4px;
  border-radius: 4px; background: #C9BFEA;
}

/* ---------- Клетки ответа ---------- */
.cells {
  --n: 5;
  display: flex; flex-wrap: nowrap; justify-content: center;
  gap: clamp(3px, 1vw, 6px);
  margin: 14px auto 4px;
}
.cell {
  --side: min(52px, calc((100vw - 60px) / var(--n) - 6px));
  width: var(--side); height: var(--side);
  display: inline-flex; align-items: center; justify-content: center;
  border: 3px solid #DCD4F5; border-radius: 12px;
  background: #fff;
  font-size: calc(var(--side) * 0.52); font-weight: 800;
  color: var(--ink);
  transition: border-color .15s ease, background .15s ease;
}
.cell.filled { border-color: var(--accent2); }
.cell.locked { background: #FFF6DA; border-color: #F0C96A; }
.cell.good { animation: cell-flash .6s ease both; animation-delay: var(--wave, 0s); }

@keyframes cell-flash {
  0%   { background: #FFF3B0; transform: scale(1); }
  35%  { background: #B7F2D2; transform: scale(1.16) rotate(-4deg); }
  100% { background: #E4FBEE; transform: scale(1) rotate(0); }
}
@keyframes cell-pop {
  0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); }
}
.cell.pop { animation: cell-pop .22s ease; }

@keyframes row-bad {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.cells.bad { animation: row-bad .45s ease; }
.cells.bad .cell { border-color: var(--bad); background: #FFE0E4; }

.cells-note { text-align: center; font-size: 15px; opacity: .7; margin: 2px 0 8px; }

/* ---------- Разбор ---------- */
.explain {
  background: #FFF8E4; border-radius: 16px; padding: 10px 14px;
  font-size: clamp(15px, 3vw, 18px); line-height: 1.45;
  margin: 6px 0 10px;
}
.explain ol { margin: 6px 0 0; padding-left: 22px; }
.explain li { margin-bottom: 4px; }
.explain.is-new { animation: rise-in .35s ease both; }
@keyframes rise-in {
  0%   { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ---------- Экранная клавиатура ---------- */
.keyboard {
  margin: 6px auto 4px; max-width: 620px;
  display: flex; flex-direction: column; gap: 5px;
}
.krow { display: flex; gap: 4px; justify-content: center; }
.kkey {
  flex: 1 1 0; min-width: 0;
  height: clamp(38px, 8.4vw, 48px);
  border: none; border-radius: 11px;
  background: #F5F2FF; box-shadow: 0 3px 0 #DFD8F5;
  font-family: inherit; font-size: clamp(15px, 3.6vw, 20px); font-weight: 700;
  color: var(--ink); cursor: pointer;
  transition: background .12s ease, transform .08s ease;
}
.kkey:hover { background: #E9E3FF; }
.kkey:active { transform: translateY(3px); box-shadow: none; background: #DDD3FA; }
.kkey.wide { flex: 1.6 1 0; background: #FFE9DC; box-shadow: 0 3px 0 #F2C9B4; }

/* ---------- Плашка награды ---------- */
.reward-pop {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: #FFF6DA; border: 3px solid #FFD86B; border-radius: 999px;
  padding: 10px 20px; font-weight: 800; font-size: 17px;
  box-shadow: 0 10px 24px rgba(46, 42, 79, .18); z-index: 40;
}
@keyframes reward-in {
  0%   { transform: translate(-50%, 30px) scale(.7); opacity: 0; }
  55%  { transform: translate(-50%, 0) scale(1.12); opacity: 1; }
  100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}
.reward-pop.is-new { animation: reward-in .55s ease both; }

/* ---------- Награды ---------- */
.awards-box {
  background: #F6F4FF; border-radius: 20px; padding: 10px 14px; margin-top: 14px;
}
.awards-box summary { cursor: pointer; font-weight: 700; font-size: 17px; padding: 4px 0; }
.aw-counter { font-weight: 600; opacity: .7; font-size: 15px; }
.award-shelf {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px; margin-top: 8px;
}
.award {
  background: #fff; border-radius: 16px; padding: 10px 8px;
  text-align: center; opacity: .5; filter: grayscale(1);
}
.award.got { opacity: 1; filter: none; }
.award .aw-ico { display: block; font-size: 30px; line-height: 1.1; }
.award .aw-name { display: block; font-size: 13px; font-weight: 700; margin-top: 3px; }
.award .aw-desc { display: block; font-size: 12px; opacity: .7; margin-top: 2px; }
@keyframes award-in {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  70% { transform: scale(1.2) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.award.new { animation: award-in .6s ease both; }

.new-awards {
  background: #FFF8E4; border: 3px solid #FFE2A8; border-radius: 22px;
  padding: 12px 14px; margin: 12px 0;
}
.na-head {
  margin: 0 0 8px; text-align: center; font-weight: 800;
  font-size: clamp(18px, 3.6vw, 22px); color: #B4790F;
}
.na-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }

/* ---------- Результаты ---------- */
.stars { display: flex; justify-content: center; gap: 10px; margin: 10px 0; }
.star { font-size: clamp(48px, 12vw, 74px); animation: star-pop .55s ease both; }
.star-off { opacity: .35; }
@keyframes star-pop {
  0%   { transform: scale(0) rotate(-90deg); opacity: 0; }
  70%  { transform: scale(1.35) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.result-score {
  text-align: center; font-size: clamp(18px, 3.8vw, 24px);
  font-weight: 700; margin: 6px 0;
}
.best-line { text-align: center; font-size: 16px; opacity: .75; margin: 6px 0 14px; }
.result-buttons {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px;
}
.result-buttons .big-btn { flex: 1 1 220px; margin: 0; }

/* Блок для родителей */
.parents { background: #F6F4FF; border-radius: 20px; padding: 12px 16px; margin-top: 10px; }
.parents summary { cursor: pointer; font-weight: 700; font-size: 17px; padding: 4px 0; }
.parents-body { font-size: 16px; }
.parents-intro { margin: 8px 0; opacity: .8; }
.parents-list { list-style: none; padding: 0; margin: 0; }
.parents-list li {
  background: #fff; border-radius: 14px; padding: 10px 12px;
  margin-bottom: 9px; line-height: 1.4;
}
.pm-sentence { font-weight: 700; margin-bottom: 4px; }
.pm-row { font-size: 15px; opacity: .85; }
.ok-line { margin: 8px 0; }

/* ---------- Конфетти ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i {
  position: absolute; top: -20px; width: 10px; height: 16px;
  border-radius: 3px; animation: fall linear both;
}
@keyframes fall {
  0%   { transform: translateY(-20px) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: .2; }
}

/* ---------- Адаптив ---------- */
@media (max-width: 560px) {
  body { padding: 58px 6px 26px; font-size: 17px; }
  .card { border-radius: 20px; padding: 12px 10px; }
  .top-buttons { top: 6px; right: 6px; }
  .icon-btn { width: 44px; height: 44px; font-size: 20px; }
  .levels { gap: 8px; }
  .level-btn { padding: 9px 6px; border-width: 3px; }
  .level-emoji { font-size: 26px; }
  .level-name { font-size: 18px; }
  .level-desc { font-size: 13px; }
  .hero-panel { padding: 9px; gap: 8px; }
  .rebus-card { padding: 10px; border-radius: 18px; }
  .rebus-tools { width: 100%; margin-left: 0; justify-content: space-between; }
  .tool-btn { height: 40px; min-width: 40px; font-size: 17px; }
  .cell { --side: min(46px, calc((100vw - 34px) / var(--n) - 5px)); }
  .award-shelf { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================================================================
   ОФОРМЛЕНИЕ РАУНДА (темы)
   Сами темы описаны в game.js (массив THEMES) — здесь только то,
   как выглядят фоновые украшения и табличка с названием темы.
   ================================================================ */
.theme-deco {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.theme-deco i {
  position: absolute; display: block;
  transform: translate(-50%, -50%); font-style: normal;
}
.theme-deco span {
  display: block; opacity: .45; will-change: transform;
  filter: drop-shadow(0 4px 10px rgba(46, 42, 79, .10));
}
@keyframes thFloat { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-15px) } }
@keyframes thBob { 0%,100% { transform: rotate(-8deg) } 50% { transform: rotate(8deg) } }
@keyframes thDrift { 0% { transform: translateX(-5vw) } 100% { transform: translateX(5vw) } }
@keyframes thTwinkle { 0%,100% { transform: scale(1); opacity: .30 } 50% { transform: scale(1.18); opacity: .62 } }
.th-float { animation: thFloat 5s ease-in-out infinite }
.th-bob { animation: thBob 4.4s ease-in-out infinite }
.th-drift { animation: thDrift 15s ease-in-out infinite alternate }
.th-drift2 { animation: thDrift 21s ease-in-out infinite alternate-reverse }
.th-twinkle { animation: thTwinkle 3.4s ease-in-out infinite }

.theme-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  border: 2px solid rgba(255, 255, 255, .92);
  box-shadow: 0 4px 12px rgba(46, 42, 79, .10);
  font-size: 15px; font-weight: 800; color: var(--ink);
  white-space: nowrap; vertical-align: middle;
}
.theme-chip .th-ico { font-size: 20px; line-height: 1 }
.theme-chip.is-new { animation: thPop .7s ease }
@keyframes thPop { 0% { transform: scale(.7); opacity: 0 } 55% { transform: scale(1.14) } 100% { transform: scale(1) } }

@media (max-width: 560px) {
  .theme-chip .th-name { display: none }
  .theme-chip { padding: 5px 9px }
  .theme-deco span { opacity: .32 }
}
@media (prefers-reduced-motion: reduce) {
  .theme-deco span { animation: none !important }
  .theme-chip.is-new { animation: none }
}

/* ---------- кнопка возврата на страницу игры ---------- */
/* Игра открыта в рамке сайта (docs/09-games.md), и эта кнопка — её выход:
   она просит страницу закрыть окно игры. Открытая отдельной вкладкой игра
   кнопку убирает — возвращаться неоткуда. */
.exit-btn{
  display:inline-flex; align-items:center; gap:6px;
  height:46px; padding:0 16px; flex:none;
  border:none; border-radius:16px;
  background:#fff; color:#3D3455;
  font:inherit; font-size:16px; font-weight:800; line-height:1;
  white-space:nowrap; cursor:pointer;
  box-shadow:0 3px 0 rgba(61,52,85,.12);
}
.exit-btn:hover{ background:#F2EFFF; }
.exit-btn:active{ transform:translateY(2px); box-shadow:0 1px 0 rgba(61,52,85,.12); }
.exit-btn:focus-visible{ outline:3px solid var(--accent2); outline-offset:2px; }
/* Вариант для игр без собственной верхней панели. */
.exit-btn--float{ position:fixed; top:10px; left:10px; z-index:60; }
@media (max-width:480px){
  .exit-btn{ height:40px; padding:0 12px; font-size:14px; }
  .exit-btn--float{ top:6px; left:6px; }
}

/* На окне ноутбука нижний ряд клавиатуры уходил под сгиб: буквы Я, Ч, С, М, И
   оказывались за краем, а без них слово не набрать. Ужимаем шапку, карточку
   ребуса и сами клавиши. */
@media (max-height: 800px) {
  .hero-panel { padding: 7px 11px; margin: 8px 0; }
  .hero-panel.compact { padding: 6px 9px; margin: 6px 0; }
  .hero-art { font-size: clamp(26px, 5vw, 34px); }
  .bubble { padding: 7px 11px; font-size: clamp(14px, 2.4vw, 16px); }
  .rebus-card { padding: 8px 12px; margin-top: 6px; }
  .keyboard { margin: 4px auto 2px; gap: 3px; }
  .krow { gap: 3px; }
  .kkey { height: clamp(26px, 5vw, 34px); font-size: clamp(13px, 2.6vw, 16px); }
}
