﻿/* ==========================================================================
   Игровые экраны: классический маджонг, Коннект, Бабочки
   ========================================================================== */

html[data-theme="moon"],
html[data-theme="vector"] {
  --game-accent: #9bdcb9;
  --game-accent-soft: #f5e8c9;
  --game-board: radial-gradient(ellipse at 50% 8%, rgba(62, 160, 108, 0.22), transparent 62%), #084330;
  --game-panel: #0a4d38;
  --game-ink: #f5eedf;
  --game-muted: rgba(245, 238, 223, 0.58);
  --game-line: rgba(245, 238, 223, 0.14);

  --tile-shadow: rgba(0, 0, 0, 0.62);



}

.game-page main {
  overflow: visible;
}

.game-first {
  padding-top: 12px;
}

.game-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: clamp(12px, 2vw, 20px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.025), transparent 55%),
    var(--game-panel);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.22);
}

.game-shell:fullscreen,
.game-shell.is-pseudo-fullscreen {
  width: 100%;
  height: 100%;
  padding: clamp(10px, 2vw, 22px);
  border: 0;
  border-radius: 0;
  overflow: auto;
  background: var(--game-panel);
}

.game-shell:fullscreen::backdrop {
  background: #04130e;
}

.game-shell.is-pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 300;
}

body.is-locked .site-header,
body.is-locked .site-footer {
  visibility: hidden;
}

/* ---------- HUD ---------- */

.game-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 18px;
}

.game-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  min-width: 0;
}

.stat {
  display: grid;
  gap: 1px;
  min-width: 72px;
}

.stat span {
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat strong {
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.stat strong.is-wide {
  font-family: var(--font-sans);
  font-size: 13px;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.game-actions .button {
  min-height: 44px;
  padding: 9px 13px;
  font-size: 11px;
}

.game-actions .button svg {
  width: 14px;
  height: 14px;
}

.game-select {
  min-height: 44px;
  max-width: 210px;
  padding: 8px 30px 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--cream);
  background-color: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  cursor: pointer;
}

.game-select option {
  color: #17231e;
  background: #f3ead8;
}

/* Одна строка HUD на широком экране: показатели и кнопки-иконки. */
@media (min-width: 1101px) {
  .game-topbar {
    flex-wrap: nowrap;
    align-items: center;
  }

  .game-stats {
    flex-wrap: nowrap;
  }

  .game-actions {
    flex-wrap: nowrap;
  }

  .game-actions .button {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .game-actions .button span {
    display: none;
  }

  .game-select {
    width: 190px;
    max-width: 190px;
  }
}

.game-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  align-items: start;
}

.game-main--wide {
  grid-template-columns: minmax(0, 1fr);
}

.game-stage {
  position: relative;
  min-width: 0;
}

.game-stage__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
}

.game-stage__bar span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.game-stage__bar svg {
  width: 13px;
  height: 13px;
  color: var(--game-accent);
}

.status {
  min-height: 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.status strong {
  color: var(--cream);
}

/* ---------- Лоток на четыре фишки ---------- */

.tray {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: max-content;
  margin: 0 auto 10px;
  padding: 6px 10px;
  border: 1px solid rgba(245, 238, 223, 0.2);
  border-radius: 14px;
  background: rgba(4, 32, 23, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.tray__label {
  color: var(--game-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tray__slots {
  display: flex;
  gap: 5px;
}

.tray-slot {
  display: grid;
  place-items: center;
  width: 58px;
  height: 78px;
  border: 1px dashed rgba(245, 238, 223, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.tray-slot .tray-tile {
  width: 100%;
  height: 100%;
}

.tray-tile {
  position: relative;
  display: block;
}

.tray-tile .game-tile__face {
  border-radius: 6px;
}

.tray-tile .game-tile__art img {
  object-fit: contain;
}

.tray.is-full {
  border-color: rgba(226, 138, 111, 0.7);
}

.tray.is-full .tray-slot {
  border-color: rgba(226, 138, 111, 0.45);
}

.game-tile.is-flying-source {
  opacity: 0.12 !important;
}

.game-actions [hidden] {
  display: none !important;
}

.save-note {
  color: var(--muted-2);
  font-size: 9px;
  white-space: nowrap;
}

/* ---------- Классика ---------- */

.solitaire-viewport {
  position: relative;
  height: clamp(430px, 64vh, 720px);
  overflow: hidden;
  border: 1px solid var(--game-line);
  border-radius: 16px;
  background: var(--game-board);
  background-size: var(--board-bg-size, auto);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  touch-action: none;
  cursor: grab;
}

.solitaire-viewport.is-panning {
  cursor: grabbing;
}

.solitaire-board {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.solitaire-layer {
  display: contents;
}

/* Общая тень яруса ложится на фишки под ним. */
.solitaire-layer.is-raised {
  position: absolute;
  inset: 0;
  display: block;
  z-index: calc(var(--layer-height) * 1000);
  translate: calc(var(--layer-height) * -3px) calc(var(--layer-height) * -4px);
  pointer-events: none;
  filter:
    drop-shadow(0 0 4px #000)
    drop-shadow(1px 3px 12.5px #000);
}

.game-shell:fullscreen .solitaire-viewport,
.game-shell.is-pseudo-fullscreen .solitaire-viewport {
  height: calc(100vh - 170px);
  min-height: 330px;
}

.game-tile {
  position: absolute;
  display: block;
  width: 64px;
  height: 86px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.18s ease, transform 0.18s ease, opacity 0.22s ease;
}

.game-tile__face {
  position: absolute;
  inset: 0;
  display: block;
  box-sizing: border-box;
  border-right: 2px solid #2f6d4c;
  border-bottom: 2px solid #2f6d4c;
  border-radius: 5px;
  background: linear-gradient(180deg, #f7f2e8 0%, #e8e1d4 62%, #d4cbbb 100%);
  box-shadow:
    inset -6px 0 6px -4px rgba(70, 60, 45, 0.16),
    inset 0 -6px 6px -4px rgba(70, 60, 45, 0.2);
  isolation: isolate;
  transform: translateY(0);
  transition: transform 0.18s ease;
}

.game-tile__art {
  position: absolute;
  inset: 5px 9px 9px 5px;
  z-index: 1;
  display: block;
  overflow: hidden;
  border-radius: 4px 2px 2px 4px;
  background: #fffdf8;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset -2px -2px 3px rgba(70, 60, 45, 0.1);
}

.game-tile__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.09);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.game-tile[data-symbol="white"] .game-tile__art::after,
.connect-tile[data-symbol="white"] .connect-tile__art::after {
  content: "白";
  position: absolute;
  inset: 12% 18%;
  display: grid;
  place-items: center;
  border: 2px solid #2f5f9e;
  border-radius: 7px;
  color: #2f5f9e;
  font: 600 clamp(19px, 3.1vw, 30px) / 1 Georgia, "Times New Roman", serif;
  line-height: 1;
  pointer-events: none;
}

.game-tile__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.game-tile::after {
  content: "";
  z-index: 3;
  position: absolute;
  inset: 1px;
  border: 2px solid var(--game-accent-soft);
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.94);
  transition: opacity 0.16s ease, transform 0.16s ease;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--game-accent) 20%, transparent);
}

.game-tile.is-raised {
  filter:
    drop-shadow(2px 3px 2px rgba(0, 0, 0, 0.4))
    drop-shadow(7px 11px 9px var(--tile-shadow, rgba(0, 0, 0, 0.55)));
}

.game-tile.is-free:hover {
  transform: translateY(-4px);
}

.game-tile.is-selected::after {
  opacity: 1;
  transform: scale(1);
}

.game-tile.is-selected {
  transform: translateY(-5px);
}

.game-tile.is-blocked {
  cursor: default;
}

.game-tile.is-blocked .game-tile__face img {
  filter: brightness(0.92) drop-shadow(0 4px 5px rgba(0, 0, 0, 0.2));
}

/* Лунная керамика: основание, фаска и лицевая плоскость. */
.game-tile__face {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #294f27 10%, #346b26 55%, #58aa39 88%, #3c872e);
  box-shadow: 0 0 0 0.5px #254424, 0 2px 3px #03110d91;
}

.game-tile__face::before {
  content: "";
  position: absolute;
  inset: 0 1.5px 2px 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, transparent 62%, #53665e26),
    linear-gradient(135deg, #deded1 20%, #b9c4bb 64%, #83928f 100%);
}

.game-tile__art {
  inset: 0 4px 6px 0;
  border-radius: 7px;
  background: linear-gradient(#fcfcf5, #f5f3e7);
  box-shadow: 0.5px 0.75px 1px #56645a40;
}

/* Оставляем поле вокруг рисунка и скрываем старую рамку спрайта. */
html[data-theme="moon"] .game-tile .game-tile__art img {
  position: absolute;
  top: 4%;
  left: 4%;
  width: 92%;
  height: 92%;
  object-fit: fill;
  transform: none;
  filter: brightness(1.17) saturate(0.62) contrast(1.14);
  mix-blend-mode: multiply;
  mask-image:
    linear-gradient(90deg, transparent 4%, #000 6% 94%, transparent 96%),
    linear-gradient(transparent 3.5%, #000 5.5% 94.5%, transparent 96.5%);
  mask-composite: intersect;
}
html[data-theme="vector"] .game-tile .game-tile__art img {
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
  filter: none;
  mix-blend-mode: normal;
  mask-image: none;
}

html[data-theme="vector"] .game-tile__art {
  background: #fbf8ee;
}

.game-tile.is-raised {
  filter: none;
}

.game-tile::after {
  border-radius: 8px;
}

.game-tile.is-removed {
  pointer-events: none;
  opacity: 0;
  transform: scale(0.65) rotate(5deg);
}

.game-tile.is-hint {
  animation: game-hint 0.85s ease 2;
}

.game-tile.is-mismatch {
  animation: game-shake 0.34s ease;
}

.game-tile.is-shake {
  animation: game-shake 0.34s ease;
}

@keyframes game-hint {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-9px); }
}

@keyframes game-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  65% { transform: translateX(3px); }
}

.zoom-controls {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(7, 24, 18, 0.78);
  backdrop-filter: blur(10px);
}

.zoom-controls button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: #f5eedf;
  background: transparent;
  font-size: 17px;
  cursor: pointer;
  touch-action: manipulation;
}

.zoom-controls button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.zoom-controls span {
  min-width: 40px;
  color: rgba(245, 238, 223, 0.75);
  font-family: var(--font-mono);
  font-size: 9px;
  text-align: center;
}

/* ---------- Боковая колонка ---------- */

.game-aside {
  display: grid;
  gap: 10px;
}

.aside-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.aside-card h3 {
  margin-bottom: 7px;
  color: var(--cream);
  font-size: 11px;
  font-weight: 700;
}

.aside-card p,
.aside-card li {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.aside-card ul {
  display: grid;
  gap: 5px;
}

.aside-card li::before {
  content: "—";
  margin-right: 5px;
  color: var(--game-accent);
}

.aside-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.aside-actions a,
.aside-actions button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--game-accent-soft);
  background: transparent;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.aside-actions a:hover,
.aside-actions button:hover {
  border-color: var(--game-accent);
}

/* ---------- Оверлей ---------- */

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 16px;
  background: rgba(4, 18, 13, 0.76);
  backdrop-filter: blur(7px);
}

.game-overlay[hidden] {
  display: none;
}

.game-overlay__card {
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid rgba(215, 174, 104, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(400px 240px at 100% 0%, rgba(215, 174, 104, 0.12), transparent 65%),
    #0d2a20;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  text-align: center;
}

.game-overlay__card h2 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.game-overlay__card p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.game-overlay__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

/* ---------- Connect / Butterflies ---------- */

.connect-stage {
  display: grid;
  place-items: center;
  width: 100%;
}

.connect-frame {
  position: relative;
  width: min(100%, 760px);
  margin-inline: auto;
  padding: 4px;
  border: 1px solid var(--game-line);
  border-radius: 18px;
  background: var(--game-board);
  background-size: var(--board-bg-size, auto);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  isolation: isolate;
}

.connect-board {
  display: grid;
  width: 100%;
  gap: 0;
}

.connect-cell {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  padding: 3px;
}

.connect-cell--edge {
  pointer-events: none;
}

.connect-cell--wall {
  background:
    radial-gradient(circle at 50% 50%, rgba(215, 174, 104, 0.18) 0 2px, transparent 3px);
  background-size: 12px 12px;
  opacity: 0.6;
}

.connect-tile {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: max(5px, 9%);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s ease, opacity 0.2s ease;
}

.connect-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.25));
}

.connect-tile--mahjong {
  border-radius: 8%;
}

.connect-tile__face {
  position: relative;
  display: block;
  height: 100%;
  aspect-ratio: 3 / 4;
  box-sizing: border-box;
  border-right: 2px solid #2f6d4c;
  border-bottom: 2px solid #2f6d4c;
  border-radius: 5px;
  background: linear-gradient(180deg, #f7f2e8 0%, #e8e1d4 62%, #d4cbbb 100%);
  isolation: isolate;
}

.connect-tile__art {
  position: absolute;
  inset: 4px 7px 7px 4px;
  z-index: 1;
  display: block;
  overflow: hidden;
  border-radius: 4px 2px 2px 4px;
  background: #fffdf8;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset -2px -2px 3px rgba(70, 60, 45, 0.09);
}

.connect-tile__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.09);
  pointer-events: none;
}


.connect-tile--mahjong.is-selected {
  outline: 2px solid var(--game-accent-soft);
  outline-offset: 1px;
  transform: translateY(-2px);
}

.connect-tile--mahjong.is-hint {
  animation: game-hint 0.8s ease 2;
}

.connect-tile--mahjong.is-mismatch {
  animation: game-shake 0.3s ease;
}

.connect-tile--butterfly {
  padding: 2px;
}

.butterfly-tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 4px;
  border: 1px solid rgba(106, 77, 54, 0.18);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.9), transparent 60%),
    linear-gradient(150deg, #fffaf0, color-mix(in srgb, var(--wing) 15%, #f1e4ce));
  box-shadow:
    0 5px 0 #b68f5e,
    0 9px 12px rgba(0, 0, 0, 0.3),
    inset 0 2px 1px rgba(255, 255, 255, 0.7),
    inset 2px 0 1px rgba(255, 255, 255, 0.4),
    inset 0 -4px 2px rgba(0, 0, 0, 0.12),
    inset -2px 0 1px rgba(0, 0, 0, 0.08);
}

.butterfly-tile img {
  width: 92%;
  height: 92%;
  filter: drop-shadow(0 3px 3px rgba(40, 24, 16, 0.32));
}

.butterfly-tile__name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.connect-tile--butterfly.is-selected .butterfly-tile {
  outline: 2px solid #fff4cc;
  outline-offset: 1px;
  transform: translateY(-2px) scale(1.02);
}

.connect-tile--butterfly.is-hint .butterfly-tile {
  animation: butterfly-hint 0.8s ease 2;
}

.connect-tile--butterfly.is-mismatch {
  animation: game-shake 0.3s ease;
}

@keyframes butterfly-hint {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px) rotate(-2deg); filter: drop-shadow(0 0 10px rgba(255, 235, 177, 0.8)); }
}

.connect-line {
  position: absolute;
  inset: 0;
  z-index: 8;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.connect-line.is-visible {
  opacity: 1;
}

.connect-line polyline {
  fill: none;
  stroke: var(--game-accent-soft);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--game-accent) 75%, transparent));
}

.connect-line.is-hint polyline {
  stroke-dasharray: 6 6;
  opacity: 0.72;
}

/* ---------- Нектар ---------- */

.nectar-card {
  border-color: rgba(215, 174, 104, 0.28);
}

.nectar-track {
  height: 8px;
  margin: 10px 0 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.nectar-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e7bf6a, #fff1c7);
  transition: width 0.3s ease;
}

.nectar-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 9px;
}

.nectar-button {
  width: 100%;
  margin-top: 10px;
}

.nectar-button:disabled {
  opacity: 0.42;
  cursor: default;
}

/* ---------- Адаптив игр ---------- */

@media (min-width: 721px) {
  .game-page .solitaire-viewport {
    height: clamp(430px, 68vh, 760px);
  }
}

@media (max-width: 980px) {
  .game-main {
    grid-template-columns: 1fr;
  }

  .game-aside {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .game-first {
    padding-top: 8px;
  }

  .game-first .shell {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .game-shell {
    margin: 0;
    padding: 0 0 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .game-topbar {
    gap: 6px;
    padding: 6px 8px 0;
  }

  .game-stats,
  .game-select,
  .game-stage__bar,
  .game-page .game-aside,
  .game-page .game-footnote {
    display: none;
  }

  .game-actions {
    padding: 0 8px;
  }

  .game-page .status {
    padding: 10px 14px 4px;
    font-size: 12px;
    line-height: 1.55;
  }

  .tray {
    gap: 6px;
    margin: 0 auto 6px;
    padding: 4px 6px;
  }

  .tray__label {
    display: none;
  }

  .tray-slot {
    width: 54px;
    height: 72px;
  }

  .stat:has([data-hud-combo]) {
    display: none;
  }

  .game-topbar {
    gap: 8px;
  }

  .game-stats {
    gap: 6px 16px;
  }

  .stat {
    min-width: 62px;
  }

  .stat strong {
    font-size: 13px;
  }

  .game-actions {
    width: 100%;
    gap: 4px;
  }

  .game-select {
    flex: 1 1 100%;
    max-width: none;
  }

  .game-actions .button {
    flex: 0 0 44px;
    width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
  }

  .game-actions .icon-button {
    width: 44px;
    height: 44px;
  }

  .game-actions .button span {
    display: none;
  }

  .game-actions .button svg {
    width: 16px;
    height: 16px;
  }

  .solitaire-viewport {
    height: 64vh;
    min-height: 420px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  /* На телефоне поле вписывается в ширину; ручной зум только мешает. */
  .zoom-controls,
  .game-page .game-aside,
  .game-stage__bar > span:first-child {
    display: none;
  }

  .game-shell:fullscreen .solitaire-viewport,
  .game-shell.is-pseudo-fullscreen .solitaire-viewport {
    height: calc(100vh - 160px);
  }

  .game-aside {
    grid-template-columns: 1fr;
  }

  .game-overlay__card {
    padding: 21px 17px;
  }

  .game-overlay__card h2 {
    font-size: 29px;
  }

  .connect-frame {
    width: 100%;
    padding: 2px;
  }

  .connect-cell {
    padding: 1.5px;
  }

  .butterfly-tile {
    padding: 2px;
    border-radius: 7px;
    box-shadow:
      0 3px 0 #b68f5e,
      0 6px 8px rgba(0, 0, 0, 0.3),
      inset 0 1px 1px rgba(255, 255, 255, 0.65),
      inset 1px 0 1px rgba(255, 255, 255, 0.35),
      inset 0 -3px 1px rgba(0, 0, 0, 0.12),
      inset -1px 0 1px rgba(0, 0, 0, 0.08);
  }
}

@media (max-width: 420px) {
  .solitaire-viewport {
    height: 64vh;
    min-height: 420px;
  }

  .zoom-controls {
    left: 6px;
    bottom: 6px;
  }

  .stat span {
    font-size: 7.5px;
  }

  .game-stage__bar {
    font-size: 9px;
  }
}

@media (max-width: 380px) {
  .game-actions {
    gap: 3px;
  }

  .game-actions .button,
  .game-actions .icon-button {
    flex-basis: 40px;
    width: 40px;
    min-height: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-tile,
  .connect-tile,
  .butterfly-tile,
  .nectar-track span {
    transition-duration: 0.001ms !important;
  }
}
