* { box-sizing: border-box; }

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

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

.head h1 { margin: 0 0 4px; color: #4a6b2a; font-size: 28px; }
.head .sub { margin: 0 0 14px; color: #8a7a4a; font-size: 14px; }

/* панель настроек */
.bar {
  background: #fffdf5;
  border: 1.5px solid #b8862c;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
  margin-bottom: 12px;
}

.pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pick-label { font-weight: 700; color: #4a6b2a; font-size: 13px; }

.target-tiles { display: flex; gap: 4px; flex-wrap: wrap; }

.t-tile {
  border: 1.5px solid #b8a86c;
  border-radius: 8px;
  background: #fff;
  padding: 2px;
  cursor: pointer;
  line-height: 0;
}
.t-tile[aria-pressed="true"] { background: #c8d8a4; border-color: #5a8835; }
.t-tile:hover { border-color: #5a8835; }

.t-tile.theme-tile {
  font-size: 21px;
  line-height: 34px;
  min-width: 40px;
  text-align: center;
}

.cnt-btn, .lvl, .btn {
  font-family: inherit;
  font-size: 14px;
  padding: 7px 12px;
  border: 1.5px solid #b8a86c;
  border-radius: 8px;
  background: #fff;
  color: #3a3320;
  cursor: pointer;
}
.cnt-btn { min-width: 38px; font-weight: 700; }
.cnt-btn[aria-pressed="true"], .lvl[aria-pressed="true"] {
  background: #c8d8a4; border-color: #5a8835; color: #3a5520; font-weight: 700;
}
.cnt-btn:hover, .lvl:hover, .btn:hover { border-color: #5a8835; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.btn.primary { background: #c8d8a4; border-color: #5a8835; color: #3a5520; font-weight: 700; }

/* игровое поле */
.board {
  position: relative;
  background: #fffdf5;
  border: 1.5px solid #b8862c;
  border-radius: 12px;
  padding: 10px;
}

.status { display: flex; align-items: center; gap: 14px; margin: 2px 4px 8px; }
.counter { font-weight: 700; color: #4a6b2a; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.counter .spr-icon { vertical-align: middle; }
.pips { display: flex; gap: 5px; }
.pip { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #5a8835; background: #fff; }
.pip.on { background: #7cb342; }

.scene-box { line-height: 0; }
.scene-box .scene-svg {
  width: 100%;
  height: auto;
  border: 2px solid #b8862c;
  border-radius: 10px;
  background: #fff;
  touch-action: manipulation;
}
.scene-svg .tgt { cursor: pointer; }

/* полноэкранный режим: разворачивается контейнер с настройками И полем,
   чтобы подсказка/новая картинка/сцены были под рукой */
.game-area:fullscreen {
  display: flex;
  flex-direction: column;
  background: #f3f0e4;
  padding: 8px 10px;
  overflow: auto;
}
.game-area:fullscreen .bar { margin-bottom: 8px; }
.game-area:fullscreen .board { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.game-area:fullscreen .scene-box { flex: 1; min-height: 0; display: flex; justify-content: center; }
.game-area:fullscreen .scene-svg { width: auto; max-width: 100%; height: 100%; }

/* на телефоне в фуллскрине панель сворачивается в кнопку «⚙ Настройки»,
   чтобы картинке доставался почти весь экран */
#cfg-btn { display: none; }
@media (max-width: 820px) {
  .game-area:fullscreen #cfg-btn { display: inline-block; }
  .game-area:fullscreen .bar:not(.open) .pick { display: none; }
  .game-area:fullscreen .bar { margin-bottom: 6px; padding: 6px 10px; gap: 8px 14px; }
  .game-area:fullscreen .actions { margin-left: 0; }
}

/* найдено / промах */
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
.found-ring { animation: pop 0.35s ease-out; transform-origin: center; transform-box: fill-box; }
@keyframes pulse { 0%,100% { opacity: 0.15; } 50% { opacity: 0.9; } }
.hint-ring { animation: pulse 0.7s ease-in-out 3; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background: #4a6b2a;
  color: #fff;
  font-size: 15px;
  padding: 9px 18px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* победа */
.win[hidden] { display: none; }
.win {
  position: absolute;
  inset: 0;
  background: rgba(58, 51, 32, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 5;
}
.win-card {
  background: #fffdf5;
  border: 2px solid #5a8835;
  border-radius: 16px;
  padding: 28px 40px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.win-emoji { font-size: 52px; }
.win-card h2 { margin: 8px 0 4px; color: #4a6b2a; }
.win-card p { margin: 0 0 16px; color: #8a7a4a; }

@media (max-width: 640px) {
  body { padding: 12px 6px 24px; }
  .head h1 { font-size: 22px; }
  .actions { margin-left: 0; }
}
