/* Стили игры «Близняшки»; общие (шапка, подвал, кнопки) — в /static/site.css. */

main {
  max-width: 760px;
}

section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.hint {
  margin: 0;
}

.records-hint {
  margin: 0;
  max-width: 460px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.85;
}

.offscreen {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: url(#sketch);
}

/* Стартовый экран */

#set-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.set-card {
  width: 220px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  color: var(--stroke);
  border: 3px solid var(--stroke);
  border-radius: 16px;
  font: inherit;
  cursor: pointer;
}

.set-card:hover {
  box-shadow: 0 4px 0 var(--stroke);
  transform: translateY(-2px);
}

.set-card:focus-visible,
.cell:focus-visible {
  outline: 3px solid var(--stroke);
  outline-offset: 2px;
}

.set-preview {
  display: flex;
  gap: 8px;
}

.set-preview .icon {
  width: 48px;
  height: 48px;
}

.set-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.set-info {
  font-size: 0.9rem;
}

/* Игра */

.hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
}

.hud .frozen {
  opacity: 0.6;
}

.hud .frozen b::after {
  content: " ❄";
}

.timer-row {
  width: min(100%, 420px);
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer {
  flex: 1;
  height: 12px;
  border: 2px solid var(--stroke);
  border-radius: 999px;
  overflow: hidden;
}

#timer-bar {
  height: 100%;
  background: var(--stroke);
  transform-origin: left;
}

.timer.urgent #timer-bar {
  background: var(--bad);
}

#timer-text {
  min-width: 2ch;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

#board {
  --n: 3;
  --cell: min(96px, calc(min(72vw, 58vh) / var(--n)));
  display: flex;
}

.column {
  display: flex;
  flex-direction: column;
  padding: 0 calc(var(--cell) * 0.08);
}

.column + .column {
  border-left: max(3px, calc(var(--cell) * 0.07)) solid var(--stroke);
}

.cell {
  position: relative;
  width: var(--cell);
  height: var(--cell);
  padding: calc(var(--cell) * 0.14);
  background: none;
  color: inherit;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.cell:hover {
  background: rgb(255 255 255 / 0.2);
}

#board.locked .cell {
  pointer-events: none;
}

.cell.correct {
  background: rgb(255 255 255 / 0.4);
}

.cell.correct::after {
  content: "✓";
  position: absolute;
  top: 0;
  right: 4%;
  font-size: calc(var(--cell) * 0.36);
  font-weight: 700;
  line-height: 1;
  color: var(--ok);
}

.cell.wrong {
  color: var(--bad);
  animation: shake 0.35s;
}

.cell.reveal {
  box-shadow: inset 0 0 0 3px var(--stroke);
}

#status {
  min-height: 1.4em;
  margin: 0;
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

@keyframes shake {
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .cell.wrong {
    animation: none;
  }

  .set-card:hover {
    transform: none;
  }
}
