* { box-sizing: border-box; }

:root {
  --green: #4a6b2a;
  --green-d: #3a5520;
  --green-l: #5a8835;
  --cream: #fffdf5;
  --cream-d: #f3f0e4;
  --gold: #b8862c;
  --gold-l: #b8a86c;
  --orange: #e0762e;
}

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  padding: 18px 12px 40px;
  background: linear-gradient(180deg, #f3f0e4 0%, #e7e0c8 100%);
  font-family: Georgia, 'Times New Roman', serif;
  color: #3a3320;
  -webkit-tap-highlight-color: transparent;
}

.wrap { max-width: 920px; margin: 0 auto; }

.head { text-align: center; margin-bottom: 14px; }
h1 { margin: 0 0 4px; color: var(--green); font-size: 30px; }
.sub { margin: 0; color: #8a7a4a; font-size: 15px; }

/* ---- bar ---- */
.bar {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: space-between; align-items: center;
  background: var(--cream);
  border: 1.5px solid var(--gold);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.levels, .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.lvl, .btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1.5px solid var(--gold-l);
  background: #fff;
  color: #5a4a20;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
}
.lvl:hover, .btn:hover { border-color: var(--green-l); }
.lvl:active, .btn:active { transform: scale(0.96); }
.lvl[aria-pressed="true"] {
  background: #c8d8a4; border-color: var(--green-l); color: var(--green-d);
}
.btn { background: #c8d8a4; border-color: var(--green-l); color: var(--green-d); }
.btn:hover { background: #d6e4b6; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }

.lvl:focus-visible, .btn:focus-visible, .scene:focus-visible,
.cell:focus-visible {
  outline: 3px solid var(--green-l); outline-offset: 2px;
}

/* ---- status ---- */
.status {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.counter {
  font-size: 18px; font-weight: 700; color: var(--green-d);
}
.pips { display: flex; gap: 5px; flex-wrap: wrap; }
.pip {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--gold-l); background: #fff;
  transition: background .2s, transform .2s, border-color .2s;
}
.pip.on { background: var(--green-l); border-color: var(--green-d); transform: scale(1.15); }

/* ---- boards ---- */
.boards { display: flex; gap: 16px; }
.board-col { flex: 1; min-width: 0; }
.board-label {
  text-align: center; font-weight: 700; color: var(--green-l);
  margin-bottom: 6px; font-size: 16px;
}

.scene {
  display: grid;
  gap: 0;
  border: 2px solid var(--gold);
  border-radius: 12px;
  background: rgba(255, 253, 245, 0.7);
  overflow: hidden;
  aspect-ratio: 6 / 4;
}

.cell {
  border: 1px dashed #e3d8b6;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  font-size: clamp(14px, 4.2vw, 34px);
  line-height: 1;
  user-select: none;
}
/* кликабельны только клетки правой картинки */
.scene.interactive .cell { cursor: pointer; }
.scene.interactive .cell:hover { background: rgba(200, 216, 164, 0.35); }

.emoji { display: inline-block; pointer-events: none; }
.two { font-size: 0.66em; letter-spacing: -1px; }

/* верный клик — кружок */
.cell.found::after {
  content: "";
  position: absolute; inset: 8%;
  border: 4px solid var(--orange);
  border-radius: 50%;
  animation: pop .35s ease;
  pointer-events: none;
}
@keyframes pop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* подсказка — мягкое мигание */
.cell.hint::before {
  content: "";
  position: absolute; inset: 10%;
  border: 4px dashed var(--green-l);
  border-radius: 50%;
  animation: blink 1s ease 2;
  pointer-events: none;
}
@keyframes blink { 0%,100% { opacity: 0; } 50% { opacity: 1; } }

/* неверный клик — мягкая тряска */
.cell.wrong { animation: shake .4s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--green-d); color: #fff;
  padding: 12px 22px; border-radius: 30px;
  font-size: 16px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- win ---- */
.win {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(58, 85, 32, 0.45);
  padding: 20px;
}
.win[hidden] { display: none; }
.win-card {
  background: var(--cream);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 30px 36px;
  text-align: center;
  max-width: 360px; width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  animation: pop .4s ease;
}
.win-emoji { font-size: 64px; animation: bounce 1s ease infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.win-card h2 { margin: 6px 0 8px; color: var(--green); font-size: 30px; }
.win-card p { margin: 0 0 20px; color: #5a4a20; font-size: 16px; }
.win-card .btn { width: 100%; font-size: 17px; padding: 12px; }

/* ---- адаптив: узкий экран — картинки друг под другом ---- */
@media (max-width: 560px) {
  .boards { flex-direction: column; gap: 14px; }
  h1 { font-size: 24px; }
  .cell { font-size: clamp(20px, 9vw, 40px); }
  .bar { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .cell.found::after, .cell.hint::before, .cell.wrong,
  .win-emoji, .win-card, .toast { animation: none; }
}
