/* css/game.css - Версия для Планшета */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  user-select: none; 
  -webkit-user-select: none; /* Safari */
  -webkit-touch-callout: none; /* iOS long press */
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #2a2a3e;
  color: #cdd6f4;
  min-height: 100vh;
  padding: 12px;
  display: flex;
  justify-content: center;
  overflow: hidden; /* Запрет скролла страницы */
}

#app { width: 100%; max-width: 860px; height: 100%; display: flex; flex-direction: column; }

.screen {
  background: #313244;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen.hidden { display: none; }

/* Старт */
#screen-start { text-align: center; padding: 48px 24px; justify-content: center; }
.start-icon { font-size: 80px; margin-bottom: 12px; animation: bounce 2s infinite; }
@keyframes bounce { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-10px);} }

#screen-start h1 { color: #f9e2af; font-size: 32px; margin-bottom: 4px; }
.subtitle { color: #89b4fa; font-size: 18px; font-weight: 500; margin-bottom: 24px; }

.rules {
  text-align: left; max-width: 460px; margin: 0 auto 28px;
  line-height: 1.9; font-size: 16px;
}

/* Уровни */
#screen-levels h1 { color: #f9e2af; margin-bottom: 8px; }
#screen-levels .muted { color: #a6adc8; margin-bottom: 24px; }

.level-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; overflow-y: auto; }

.level-card {
  display: flex; align-items: center; gap: 16px;
  background: #45475a; border-radius: 14px; padding: 18px;
  cursor: pointer; transition: all 0.2s;
  border: 3px solid transparent;
  min-height: 80px; /* Удобно для пальца */
}

.level-card:hover:not(.locked), .level-card:active:not(.locked) {
  transform: translateX(6px);
  border-color: #89b4fa;
  background: #585b70;
}

.level-card.locked { opacity: 0.45; cursor: not-allowed; }
.level-card.done { border-color: #a6e3a1; }

.level-icon { font-size: 40px; }
.level-info { flex: 1; text-align: left; }
.level-info .name { font-size: 18px; font-weight: 700; margin-bottom: 4px; color: #f9e2af; }
.level-info .desc { font-size: 14px; color: #a6adc8; }

.level-status {
  font-size: 12px; padding: 4px 10px; border-radius: 10px;
  background: #313244; color: #a6adc8; font-weight: bold;
}

.level-card.done .level-status { background: #a6e3a1; color: #1e1e2e; }

/* Топбар */
.topbar {
  display: flex; align-items: center; gap: 12px;
  background: #45475a; border-radius: 14px;
  padding: 10px 16px; margin-bottom: 10px;
}

.scene-title { font-size: 16px; font-weight: 700; color: #f9e2af; flex: 1; }

.insights-counter {
  display: flex; align-items: center; gap: 8px;
  background: #313244; padding: 6px 12px;
  border-radius: 20px; font-size: 13px;
}

.icons-mini { display: flex; gap: 4px; }

.icons-mini .mini {
  width: 22px; height: 22px; border-radius: 50%;
  background: #585b70; display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all 0.3s;
}

.icons-mini .mini.got {
  background: #a6e3a1; transform: scale(1.15);
  box-shadow: 0 0 8px rgba(166,227,161,0.6);
}

.topbar-btn {
  background: #313244; border: none; color: #cdd6f4;
  width: 44px; height: 44px; border-radius: 50%; /* Больше для пальца */
  cursor: pointer; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}

.topbar-btn:hover, .topbar-btn:active { background: #585b70; }

/* Комната - ГЛАВНОЕ: touch-action: none */
.room {
  position: relative; width: 100%; flex: 1; /* Растягиваем */
  aspect-ratio: 4 / 3;
  max-height: 70vh;
  background: linear-gradient(135deg, #f5d7a0 0%, #f0c98a 100%);
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  border: 6px solid #8b6b3f;
  transition: filter 0.5s;
  
  /* ОТКЛЮЧЕНИЕ СКРОЛЛА И ЗУМА БРАУЗЕРА */
  touch-action: none; 
  -ms-touch-action: none;
}

.room.night { filter: brightness(0.65) hue-rotate(-10deg); }

.room::before {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(0deg, transparent 0 34px, rgba(139,107,63,0.25) 34px 36px);
  pointer-events: none; z-index: 1;
}

/* Окно и Луна-таймер */
.window {
  position: absolute; top: 6%; left: 5%; width: 22%; height: 26%;
  background: linear-gradient(180deg, #1a1a2e 0%, #2d2d5a 100%);
  border: 5px solid #8b6b3f; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; z-index: 2;
  overflow: hidden;
}

.window .moon { 
  font-size: 36px; 
  position: absolute;
  left: 10%;
  transition: left 1s linear, transform 1s ease, filter 1s ease;
  filter: drop-shadow(0 0 8px rgba(249, 226, 175, 0.6));
}
.window .stars { color: #f9e2af; font-size: 10px; letter-spacing: 4px; position: absolute; bottom: 10%; opacity: 0.6;}

.carpet {
  position: absolute; bottom: 12%; left: 22%; width: 42%; height: 34%;
  background: radial-gradient(circle, #e07a5f 0%, #c45e42 100%);
  border-radius: 50%; opacity: 0.55; pointer-events: none; z-index: 1;
}

.bed {
  position: absolute; top: 8%; right: 5%; width: 34%; height: 50%;
  background: #d4a574; border-radius: 12px; border: 4px solid #8b6b3f;
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  transition: all 0.3s; z-index: 3; cursor: pointer;
  touch-action: none;
}

.bed .pillow {
  position: absolute; top: 6%; left: 10%; width: 80%; height: 22%;
  background: #f5f0e8; border-radius: 10px; pointer-events: none;
}

.bed .blanket {
  position: absolute; bottom: 6%; left: 8%; width: 84%; height: 55%;
  background: #89b4fa; border-radius: 10px;
  transition: all 0.4s; pointer-events: none;
}

.bed .blanket.on-girl { background: #f38ba8; transform: scale(0.95); }

/* Свечение кровати */
.bed.active-bed {
  box-shadow: 0 0 15px 5px rgba(249, 226, 175, 0.8), 0 6px 16px rgba(0,0,0,0.3);
  border-color: #f9e2af;
  animation: bedPulse 2s infinite alternate;
}

@keyframes bedPulse {
  0% { box-shadow: 0 0 10px 2px rgba(249, 226, 175, 0.5), 0 6px 16px rgba(0,0,0,0.3); }
  100% { box-shadow: 0 0 25px 8px rgba(249, 226, 175, 0.9), 0 6px 16px rgba(0,0,0,0.3); }
}

.bed-label {
  position: absolute; bottom: -24px; left: 50%;
  transform: translateX(-50%);
  font-size: 12px; font-weight: 700; white-space: nowrap;
  background: rgba(255,255,255,0.85); padding: 3px 10px;
  border-radius: 10px; pointer-events: none; color: #5a3e1f;
}

/* Предметы */
.toy {
  position: absolute; width: 80px; height: 80px; /* Чуть больше для пальца */
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.3s;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
  z-index: 6; border-radius: 16px;
  background: rgba(255,255,255,0.35);
  border: 2px solid rgba(139,107,63,0.4);
  touch-action: none;
}

.toy-icon { font-size: 40px; line-height: 1; }

.toy-label {
  font-size: 11px; font-weight: 700;
  color: #3a2a1a; margin-top: 2px; text-transform: uppercase;
}

.toy.highlight {
  transform: scale(1.18);
  box-shadow: 0 0 20px rgba(249,226,175,0.9);
  background: rgba(249,226,175,0.5);
  border-color: #f9e2af;
}

.toy.taken, .toy.disabled {
  opacity: 0.25;
  filter: grayscale(0.8);
  pointer-events: none;
}

/* Позиции предметов */
#teddy  { top: 82%; left: 72%; }
#book   { top: 75%; left: 25%; }
#phone  { top: 18%; left: 32%; }
#tablet { top: 42%; left: 50%; }
#water  { top: 68%; left: 42%; }
#rattle { top: 30%; left: 8%; }

/* Персонажи */
.girl, .mom {
  position: absolute;
  z-index: 10;
  transition: left 1.2s cubic-bezier(0.4, 0, 0.2, 1),
              top 1.2s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.6s;
  touch-action: none;
}

.chibi { width: 100%; height: 100%; pointer-events: none; }

.girl { width: 70px; height: 110px; cursor: grab; filter: drop-shadow(0 6px 8px rgba(0,0,0,0.4)); }
.girl:active { cursor: grabbing; }
.girl.dragging {
  filter: drop-shadow(0 12px 16px rgba(0,0,0,0.5));
  z-index: 100;
  transition: none;
}
.girl.sleeping {
  filter: drop-shadow(0 0 16px rgba(166,227,161,0.7)) brightness(0.85);
}

/* МИШКА ПРИЛИПАЕТ К МИРЕ */
.girl.has-teddy::after {
  content: "🧸";
  position: absolute;
  top: -10px;
  right: -15px;
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  animation: teddyBounce 2s infinite ease-in-out;
  z-index: 101;
}

@keyframes teddyBounce {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-3px) rotate(5deg); }
}

.mom {
  top: 48%;
  left: 2%;
  width: 95px;
  height: 155px;
  opacity: 0;
  animation: fadeIn 1s 0.3s forwards;
  z-index: 8;
  cursor: pointer;
  transition: filter 1s, left 1.2s, top 1.2s, transform 0.4s;
}

.mom.highlight {
  transform: scale(1.05);
  filter: brightness(1.15);
}

.mom.hugging {
  transform: scale(1.08);
  filter: brightness(1.2) saturate(1.2);
}

.mom.blush-1 { filter: brightness(1.02) saturate(1.15) hue-rotate(-5deg); }
.mom.blush-2 { filter: brightness(1.05) saturate(1.35) hue-rotate(-10deg); }
.mom.blush-3 { filter: brightness(1.1) saturate(1.6) hue-rotate(-15deg); }
.mom.blush-4 { filter: brightness(1.15) saturate(1.9) hue-rotate(-20deg); }

@keyframes fadeIn { to { opacity: 1; } }

.chibi-label {
  position: absolute; bottom: -24px; left: 50%;
  transform: translateX(-50%);
  font-size: 12px; font-weight: 700; white-space: nowrap;
  background: rgba(30,30,46,0.85); color: #f9e2af;
  padding: 3px 10px; border-radius: 10px; pointer-events: none;
}

.mom-speech {
  position: absolute; top: -56px; left: 70px;
  background: #f9e2af; color: #1e1e2e;
  padding: 10px 16px; border-radius: 14px;
  font-size: 14px; font-weight: 600; line-height: 1.35;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0; transform: translateX(-10px);
  transition: all 0.3s; pointer-events: none;
  max-width: 220px; width: max-content;
  z-index: 102;
}

.mom-speech.show { opacity: 1; transform: translateX(0); }

/* Сердечко при объятиях */
.hug-heart {
  position: absolute;
  top: -30px; left: 50%;
  transform: translateX(-50%) scale(0);
  font-size: 48px;
  opacity: 0;
  transition: all 0.4s;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(243,139,168,0.8));
  z-index: 102;
}

.hug-heart.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  animation: heartPulse 0.8s infinite;
}

@keyframes heartPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.15); }
}

.thought-bubble {
  position: absolute; top: -56px; left: 50%;
  transform: translateX(-50%) scale(0);
  background: white; color: #1e1e2e;
  padding: 10px 16px; border-radius: 16px;
  font-size: 14px; font-weight: 600;
  white-space: normal; max-width: 220px; width: max-content;
  text-align: center; line-height: 1.3;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0; transition: all 0.3s; pointer-events: none;
  z-index: 102;
}

.thought-bubble::after {
  content: ""; position: absolute;
  bottom: -8px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid white;
}

.thought-bubble.show { opacity: 1; transform: translateX(-50%) scale(1); }

/* Табло выбора (Уровень 4) */
.choice-board {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(49, 50, 68, 0.95);
  border: 2px solid #f9e2af;
  border-radius: 16px;
  padding: 24px;
  z-index: 200;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  text-align: center;
  max-width: 90%;
  width: 400px;
}

.choice-board.hidden { display: none; }

.choice-text {
  color: #f9e2af;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  line-height: 1.4;
}

.choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  text-align: center;
}

.hint {
  text-align: center; padding: 12px;
  color: #a6adc8; font-size: 14px; margin-top: 10px;
}

.toast {
  position: fixed; top: 90px; left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #313244; color: #cdd6f4;
  padding: 14px 22px; border-radius: 14px;
  font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none;
  transition: all 0.35s; z-index: 500;
  max-width: 90%; text-align: center;
  border-left: 4px solid #89b4fa;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.good { border-left-color: #a6e3a1; }
.toast.bad  { border-left-color: #f38ba8; }

#screen-end { text-align: center; padding: 40px 24px; justify-content: center; }
.end-icon { font-size: 72px; margin-bottom: 16px; }
#screen-end h1 { color: #a6e3a1; font-size: 26px; margin-bottom: 12px; }
#screen-end h1.fail { color: #f9e2af; }
#screen-end .muted { color: #a6adc8; margin-bottom: 24px; line-height: 1.5; }

.insight-symbols {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: center; margin: 20px 0;
}

.insight-symbols .sym {
  width: 60px; height: 60px; background: #45475a;
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 28px; animation: pop 0.5s backwards;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

@keyframes pop {
  0% { transform: scale(0) rotate(-180deg); }
  70% { transform: scale(1.2) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}

.end-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* Салют */
.firework-particle {
  position: absolute;
  font-size: 24px;
  pointer-events: none;
  animation: fall linear forwards;
}

@keyframes fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}
