/* ============================================================
   Игры на развитие памяти — стили
   (подключается после style.css только на страницах игр)
   ============================================================ */
.g-hero { padding: 44px 0 18px; position: relative; }
.g-crumbs { font-size: 14px; color: var(--text-mute); margin-bottom: 14px; font-family: var(--font-head); font-weight: 600; }
.g-crumbs a { color: var(--brand-deep); }
.g-hero h1 { font-size: clamp(30px, 4.5vw, 46px); margin-bottom: 12px; }
.g-hero .lead { color: var(--text-soft); font-size: 18px; max-width: 720px; }
.g-hero .g-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.g-meta span { font-family: var(--font-head); font-weight: 700; font-size: 13px; color: var(--brand-deep); background: rgba(255,255,255,.7); border: 1px solid var(--glass-brd); border-radius: 999px; padding: 6px 14px; }

.g-play { padding: 10px 0 60px; }
.g-wrap { max-width: 760px; margin: 0 auto; }
.g-levels { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 0 0 18px; }
.g-levels button {
  font-family: var(--font-head); font-weight: 700; font-size: 15px; padding: 10px 20px; border-radius: 999px;
  background: rgba(255,255,255,.6); backdrop-filter: blur(6px); border: 1px solid var(--glass-brd);
  color: var(--text-soft); cursor: pointer; transition: all .2s;
}
.g-levels button:hover, .g-levels button.active { background: var(--grad-btn); color: #fff; border-color: transparent; }

.g-stage {
  position: relative; background: rgba(255,255,255,.7); backdrop-filter: blur(12px);
  border: 1px solid var(--glass-brd); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-soft); min-height: 340px; overflow: hidden;
}
.g-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; font-family: var(--font-head); font-weight: 700; color: var(--text-soft); font-size: 15px; }
.g-top span b { color: var(--brand-deep); font-size: 18px; }
.g-top .g-ico { background: none; border: 1px solid var(--line); border-radius: 999px; width: 38px; height: 38px; cursor: pointer; font-size: 17px; display: grid; place-items: center; }
.g-center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 260px; gap: 16px; }
.g-center p { color: var(--text-soft); max-width: 460px; font-size: 16px; }
.g-center .big { font-family: var(--font-head); font-weight: 800; font-size: 22px; color: var(--text); }
.g-msg { text-align: center; font-family: var(--font-head); font-weight: 700; color: var(--brand-deep); min-height: 26px; margin-top: 12px; }
.g-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0 16px; }
.g-bar i { display: block; height: 100%; width: 100%; background: var(--grad-btn); transition: width .25s linear; }
.g-input { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.g-input input {
  width: 260px; max-width: 100%; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px;
  font-family: var(--font-head); font-weight: 700; font-size: 22px; letter-spacing: .12em; text-align: center; background: #fff; color: var(--text);
}
.g-input input:focus { outline: none; border-color: var(--berry); }
.g-lives { letter-spacing: 2px; }

/* экран результата */
.g-result {
  position: absolute; inset: 0; z-index: 5; overflow: auto;
  background: rgba(253,247,243,.97); backdrop-filter: blur(10px); border-radius: var(--radius);
  padding: 26px 22px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  animation: gfade .3s ease;
}
@keyframes gfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.g-res-title { font-family: var(--font-head); font-weight: 800; font-size: 22px; }
.g-res-score { font-family: var(--font-head); font-weight: 800; font-size: 50px; line-height: 1; color: var(--brand-deep); }
.g-res-sub { color: var(--text-soft); font-size: 15px; }
.g-stats { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; font-size: 14px; color: var(--text-soft); }
.g-stats b { color: var(--text); font-family: var(--font-head); }
.g-name { background: #fff; border: 1px solid var(--glass-brd); border-radius: 16px; padding: 14px 18px; width: 100%; max-width: 420px; }
.g-name-lbl { font-family: var(--font-head); font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.g-name-row { display: flex; gap: 8px; }
.g-name-row input { flex: 1; min-width: 0; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px; font-family: var(--font-body); font-size: 16px; }
.g-name-row input:focus { outline: none; border-color: var(--berry); }
.g-name-row .btn { padding: 10px 18px; font-size: 14px; }
.g-res-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.g-res-btns .btn { padding: 12px 22px; font-size: 15px; }
.g-cta { background: var(--grad-soft); border-radius: 16px; padding: 14px 18px; font-size: 14.5px; line-height: 1.5; max-width: 520px; color: var(--text); }
.g-cta a { color: var(--brand-deep); font-weight: 800; text-decoration: underline; white-space: nowrap; }

/* таблица рекордов */
.g-lb { width: 100%; max-width: 420px; margin: 0 auto; }
.g-board { margin-top: 22px; background: rgba(255,255,255,.6); border: 1px solid var(--glass-brd); border-radius: var(--radius-sm); padding: 18px 20px; }
.g-lb-head { font-family: var(--font-head); font-weight: 800; font-size: 16px; margin-bottom: 8px; text-align: center; }
.g-lb-empty { font-size: 14px; color: var(--text-mute); text-align: center; }
.g-lb-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.g-lb-table td { padding: 6px 6px; border-bottom: 1px dashed var(--line); text-align: left; }
.g-lb-table td.r { width: 44px; color: var(--text-mute); font-family: var(--font-head); font-weight: 800; white-space: nowrap; }
.g-lb-table td.n { font-weight: 700; }
.g-lb-table td.s { text-align: right; font-family: var(--font-head); font-weight: 800; color: var(--brand-deep); white-space: nowrap; }
.g-lb-table td.d { text-align: right; color: var(--text-mute); font-size: 12.5px; width: 48px; }
.g-lb-table tr.me td { background: rgba(222,147,172,.18); }
.g-lb-table tr:first-child td.r::before { content: '\1F947'; margin-right: 2px; }
.g-lb-table tr:nth-child(2) td.r::before { content: '\1F948'; margin-right: 2px; }
.g-lb-table tr:nth-child(3) td.r::before { content: '\1F949'; margin-right: 2px; }

/* --- Найди пару --- */
.mem-grid { display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); gap: 10px; max-width: 520px; margin: 0 auto; }
.mem-card { aspect-ratio: 1; perspective: 700px; background: none; border: none; cursor: pointer; padding: 0; }
.mem-inner { display: block; position: relative; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.mem-card.open .mem-inner, .mem-card.done .mem-inner { transform: rotateY(180deg); }
.mem-front, .mem-back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 14px; display: grid; place-items: center; }
.mem-front { background: var(--grad-warm); color: #fff; font-family: var(--font-head); font-weight: 800; font-size: 26px; box-shadow: 0 4px 12px rgba(216,139,166,.3); }
.mem-back { background: #fff; border: 2px solid var(--brand-soft); transform: rotateY(180deg); font-size: clamp(26px, 6vw, 40px); }
.mem-card.done .mem-back { border-color: #8fd3a8; background: #f2fbf5; }

/* --- Таблица Шульте --- */
.sh-grid { display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); gap: 6px; max-width: 440px; margin: 0 auto; }
.sh-cell {
  aspect-ratio: 1; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); cursor: pointer;
  font-family: var(--font-head); font-weight: 800; font-size: clamp(18px, 4.5vw, 28px); color: var(--text); transition: background .15s;
}
.sh-cell:hover { background: var(--brand-tint); }
.sh-cell.done { opacity: .3; }
.sh-cell.shake { animation: shake .3s; background: #fde4e4; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* --- Запомни числа --- */
.num-show { font-family: var(--font-head); font-weight: 800; font-size: clamp(40px, 9vw, 72px); letter-spacing: .12em; color: var(--brand-deep); }

/* --- Запомни слова --- */
.w-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.w-item { padding: 12px 10px; border-radius: 12px; background: #fff; border: 2px solid var(--line); font-family: var(--font-head); font-weight: 700; font-size: 16px; text-align: center; cursor: pointer; transition: all .15s; color: var(--text); }
.w-item.sel { background: var(--grad-btn); color: #fff; border-color: transparent; }
.w-item.hit { background: #eafaf0; border-color: #6cc48f; color: #2e7d4a; }
.w-item.miss { background: #fff; border: 2px dashed #e0a5a5; color: #b04545; }
.w-item.wrong { background: #fde4e4; border-color: #e08a8a; color: #b04545; text-decoration: line-through; }
.w-static { cursor: default; }

/* --- Что пропало --- */
.mg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; max-width: 520px; margin: 0 auto; }
.mg-item { aspect-ratio: 1; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: clamp(28px, 6vw, 38px); }
.mg-item.gone { background: var(--brand-tint); border: 2px dashed var(--berry); color: var(--brand-deep); font-family: var(--font-head); font-weight: 800; }
.mg-opts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.mg-opts button { width: 72px; height: 72px; border-radius: 16px; background: #fff; border: 2px solid var(--line); font-size: 36px; cursor: pointer; transition: all .15s; }
.mg-opts button:hover { border-color: var(--berry); transform: translateY(-2px); }

/* --- Повтори последовательность --- */
.sm-pads { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(100%, 340px); margin: 0 auto; }
.sm-pad { aspect-ratio: 1; border-radius: 26px; border: none; cursor: pointer; opacity: .5; transition: opacity .12s, transform .12s; box-shadow: 0 6px 16px rgba(62,54,48,.08); }
.sm-pad.lit { opacity: 1; transform: scale(1.05); box-shadow: 0 10px 26px rgba(168,80,107,.28); }
.sm-pad:disabled { cursor: default; }

/* --- Лица и имена --- */
.fn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.fn-card { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fn-face { font-size: 44px; line-height: 1.1; }
.fn-name { font-family: var(--font-head); font-weight: 800; font-size: 15px; color: var(--brand-deep); }
.fn-big { font-size: 84px; line-height: 1.1; }
.fn-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(100%, 380px); }

/* --- Фото-память --- */
.pm-grid { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 8px; width: min(100%, 320px); margin: 0 auto; }
.pm-cell { aspect-ratio: 1; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); cursor: pointer; transition: background .12s, transform .12s; }
.pm-cell.static { cursor: default; }
.pm-cell:not(.static):hover { border-color: var(--berry); }
.pm-cell.on { background: var(--grad-btn); border-color: transparent; }
.pm-cell.miss { border: 2px dashed var(--brand-deep); background: var(--brand-tint); }
.pm-cell.wrong { background: #e08a8a; border-color: transparent; }
.pm-cell:disabled { cursor: default; }

/* --- N-back --- */
.nb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(100%, 300px); margin: 0 auto; }
.nb-cell { aspect-ratio: 1; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); transition: background .1s; }
.nb-cell.on { background: var(--grad-btn); border-color: transparent; box-shadow: 0 6px 16px rgba(168,80,107,.3); }
.nb-btn { padding: 16px 34px; font-size: 18px; }
.nb-btn small { font-size: 12px; opacity: .8; font-weight: 600; }

/* --- Хаб игр --- */
.g-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.g-card {
  background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--glass-brd); border-radius: var(--radius);
  padding: 26px 24px; display: flex; flex-direction: column; transition: transform .25s, box-shadow .25s;
}
.g-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--berry); }
.g-card .g-emoji { width: 64px; height: 64px; border-radius: 20px; background: var(--grad-warm); display: grid; place-items: center; font-size: 32px; margin-bottom: 16px; box-shadow: 0 6px 16px rgba(216,139,166,.28); }
.g-card h3 { font-size: 21px; margin-bottom: 8px; }
.g-card p { color: var(--text-soft); font-size: 15px; margin-bottom: 14px; flex: 1; }
.g-card .g-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.g-card .g-tags span { font-size: 12px; font-family: var(--font-head); font-weight: 700; color: var(--brand-deep); background: rgba(251,228,222,.85); border-radius: 999px; padding: 4px 10px; }
.g-card .arrow { font-family: var(--font-head); font-weight: 700; color: var(--brand-deep); font-size: 15px; }

/* --- SEO-текст на страницах игр --- */
.g-text { max-width: 760px; margin: 0 auto; }
.g-text h2 { font-size: clamp(22px, 3vw, 28px); margin: 36px 0 12px; }
.g-text h2:first-child { margin-top: 0; }
.g-text p, .g-text li { color: var(--text-soft); font-size: 16.5px; line-height: 1.7; }
.g-text p { margin-bottom: 12px; }
.g-text ul, .g-text ol { margin: 0 0 14px 22px; display: grid; gap: 6px; }
.g-text a { color: var(--brand-deep); font-weight: 700; text-decoration: underline; }

/* --- Тизер игр на других страницах --- */
.g-teaser { background: var(--grad-soft); border: 1px solid var(--glass-brd); border-radius: var(--radius); padding: 28px 32px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.g-teaser .g-emoji { font-size: 46px; }
.g-teaser h3 { font-size: 22px; margin-bottom: 6px; }
.g-teaser p { color: var(--text-soft); font-size: 16px; }
.g-teaser .btn { margin-left: auto; }

@media (max-width: 900px) { .g-cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) {
  .g-cards { grid-template-columns: 1fr; }
  .g-stage { padding: 16px; }
  .g-result { padding: 20px 14px; }
  .g-res-score { font-size: 42px; }
  .g-teaser .btn { margin-left: 0; }
}
