/* Доски и специфичные элементы каждой игры.
   Соглашение: у каждой игры свой префикс класса (g-ttt, g-c4, g-dots,
   g-sea, g-ice, g-draw, g-card). Чужие префиксы не трогаем. */

/* ── общее для карточных игр (правда/знаешь/выбор) ───────────────────────── */
.g-card {
  background: linear-gradient(150deg, var(--card), var(--card-2));
  border-radius: var(--r-lg);
  padding: 22px 18px;
  box-shadow: var(--sh-2);
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  min-height: 130px;
  display: grid;
  place-items: center;
  animation: pop 0.3s var(--ease);
}
.g-card.truth {
  background: linear-gradient(150deg, #fff4fa, #ffe7f2);
}
.g-card.dare {
  background: linear-gradient(150deg, #fff8ec, #ffeddd);
}
.g-choice {
  border: 2.5px solid var(--line);
  background: var(--card);
  border-radius: var(--r);
  padding: 18px 14px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  min-height: 88px;
  transition: transform var(--dur) var(--ease), border-color var(--dur),
    background var(--dur);
}
.g-choice:active {
  transform: scale(0.96);
}
.g-choice.is-mine {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.g-choice.is-both {
  border-color: var(--mint);
  background: #e6faf1;
}
.g-answer {
  border-radius: var(--r);
  padding: 12px 14px;
  background: var(--seat-soft);
  border: 2px solid var(--seat);
  font-weight: 700;
}

/* ── крестики-нолики ─────────────────────────────────────────────────────── */
.g-ttt {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 340px;
  width: 100%;
  margin: auto;
}
.g-ttt button {
  aspect-ratio: 1;
  border: none;
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--sh-1);
  font-size: clamp(34px, 12vw, 52px);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform var(--dur) var(--ease), background var(--dur);
}
.g-ttt button:active:not(:disabled) {
  transform: scale(0.94);
}
.g-ttt button > span {
  animation: pop 0.25s var(--ease);
}
.g-ttt button.is-win {
  background: linear-gradient(140deg, #fff0c9, #ffe1ef);
}

/* ── четыре в ряд ────────────────────────────────────────────────────────── */
.g-c4 {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: var(--accent-soft);
  padding: 6px;
  border-radius: var(--r);
  width: 100%;
  margin: auto;
}
.g-c4 button {
  aspect-ratio: 1;
  border: none;
  border-radius: 50%;
  background: var(--card);
  font-size: clamp(14px, 4.6vw, 22px);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.g-c4 button > span {
  animation: drop-in 0.28s var(--ease);
}
@keyframes drop-in {
  from {
    transform: translateY(-140%);
  }
}
.g-c4 button.is-win {
  background: var(--sun);
}
.g-c4 button.is-last {
  box-shadow: 0 0 0 3px var(--accent);
}

/* ── точки и квадратики ──────────────────────────────────────────────────── */
.g-dots {
  display: grid;
  width: 100%;
  max-width: 360px;
  margin: auto;
  aspect-ratio: 1;
}
.g-dots .dot {
  border-radius: 50%;
  background: var(--ink-2);
  width: 9px;
  height: 9px;
  place-self: center;
}
.g-dots .edge {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  position: relative;
  border-radius: 4px;
}
/* Полоска рисуется псевдоэлементом, а кнопка остаётся большой для пальца. */
.g-dots .edge::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 4px;
  background: var(--line);
  transition: background var(--dur);
}
.g-dots .edge.h::after {
  height: 6px;
}
.g-dots .edge.v::after {
  width: 6px;
}
.g-dots .edge.taken-0::after {
  background: var(--p0);
}
.g-dots .edge.taken-1::after {
  background: var(--p1);
}
.g-dots .box {
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 16px;
  transition: background 0.3s;
}
.g-dots .box.own-0 {
  background: var(--p0-soft);
}
.g-dots .box.own-1 {
  background: var(--p1-soft);
}

/* ── морской бой ─────────────────────────────────────────────────────────── */
.g-sea-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  width: 100%;
  aspect-ratio: 1;
  background: var(--p1-soft);
  padding: 3px;
  border-radius: var(--r-sm);
}
.g-sea-grid.small {
  max-width: 210px;
}
.g-sea-grid button {
  border: none;
  padding: 0;
  aspect-ratio: 1;
  border-radius: 3px;
  background: #f4fcff;
  cursor: pointer;
  font-size: clamp(8px, 2.6vw, 14px);
  display: grid;
  place-items: center;
  line-height: 1;
}
.g-sea-grid button.ship {
  background: var(--accent-soft);
}
.g-sea-grid button.miss {
  background: #e3edf2;
  color: var(--muted);
}
.g-sea-grid button.hit {
  background: var(--p0);
}
.g-sea-grid button.ship.hit {
  background: var(--p0);
}
.g-sea-grid button.preview {
  background: var(--mint);
}
.g-sea-grid button.bad {
  background: var(--warn);
}
.g-sea-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 4px;
}
.g-sea-fleet {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.g-sea-ship {
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-xs);
  background: var(--card-2);
  border: 2px solid var(--line);
}
.g-sea-ship.is-next {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.g-sea-ship.is-done {
  opacity: 0.3;
}
.g-sea-ship i {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--accent);
  display: block;
}

/* ── спаси мороженко ─────────────────────────────────────────────────────── */
.g-ice-scene {
  text-align: center;
  font-size: 72px;
  line-height: 1;
  min-height: 92px;
  display: grid;
  place-items: center;
  transition: filter 0.4s, transform 0.4s;
}
.g-ice-scene.melt-1 {
  transform: scale(0.96) rotate(-2deg);
}
.g-ice-scene.melt-2 {
  transform: scale(0.9) rotate(3deg);
  filter: saturate(0.9);
}
.g-ice-scene.melt-3 {
  transform: scale(0.84) rotate(-5deg) skewX(4deg);
  filter: saturate(0.75);
}
.g-ice-scene.melt-4 {
  transform: scale(0.76) rotate(7deg) skewX(8deg);
  filter: saturate(0.6) blur(0.4px);
}
.g-ice-scene.melt-5 {
  transform: scale(0.66) rotate(-10deg) skewX(14deg);
  filter: saturate(0.4) blur(0.9px);
  opacity: 0.75;
}
.g-ice-scene.melt-6 {
  transform: scale(0.5) rotate(16deg) skewX(22deg);
  filter: saturate(0.15) blur(1.6px);
  opacity: 0.4;
}
.g-ice-word {
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.02em;
}
.g-ice-word span {
  min-width: 26px;
  border-bottom: 3px solid var(--accent);
  text-align: center;
  line-height: 1.2;
}
.g-ice-word span.gap {
  border-bottom: none;
  min-width: 14px;
}
.g-ice-keys {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 4px;
}
.g-ice-keys button {
  aspect-ratio: 1;
  border: none;
  border-radius: var(--r-xs);
  background: var(--card);
  box-shadow: var(--sh-1);
  font-size: clamp(11px, 3.2vw, 15px);
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}
.g-ice-keys button.hit {
  background: var(--mint);
  color: #fff;
}
.g-ice-keys button.miss {
  background: var(--line);
  color: var(--muted);
}
.g-ice-keys button:disabled {
  cursor: default;
}

/* ── рисовалка ───────────────────────────────────────────────────────────── */
.g-draw-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--sh-1);
  background: #fff;
}
.g-draw-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  touch-action: none; /* иначе браузер съест жест как скролл */
}
.g-draw-tools {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.g-draw-color {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 0;
}
.g-draw-color.is-on {
  border-color: var(--ink);
  transform: scale(1.12);
}
.g-draw-size {
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: var(--r-pill);
  min-width: 38px;
  height: 32px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.g-draw-size.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.g-draw-size i {
  display: block;
  border-radius: 50%;
  background: var(--ink);
}
.g-guesses {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 130px;
  overflow-y: auto;
}
.g-guess {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--card-2);
  border: 1.5px solid var(--line);
  font-size: 14px;
  align-self: flex-start;
}
.g-guess.ok {
  background: #e6faf1;
  border-color: var(--mint);
  font-weight: 800;
}
.g-timer {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
}
.g-timer i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--sun), var(--p0));
  border-radius: var(--r-pill);
  transition: width 0.25s linear;
}
