* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --vanilla: #FBF5ED;       /* фон — ванильный крем */
  --paper: #FFFDF9;         /* карточки-бумага */
  --blush: #F6E4E1;         /* румянец */
  --rose: #CF8490;          /* пыльная роза */
  --rose-deep: #A85B6B;     /* тёмная роза */
  --thread: #C0526A;        /* красная нить судьбы */
  --cocoa: #4C3B37;         /* тёплые чернила */
  --cocoa-soft: #8C7570;    /* приглушённый текст */
  --gold: #C2A06B;          /* золотое тиснение */
  --line: #EEDFD4;          /* тонкие рамки */
  --sage: #8FAE8B;          /* найденная улика */
}

html, body {
  background: var(--vanilla);
  color: var(--cocoa);
  font-family: 'Manrope', system-ui, sans-serif;
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(circle at 15% 8%, rgba(207, 132, 144, 0.10), transparent 42%),
    radial-gradient(circle at 88% 92%, rgba(194, 160, 107, 0.10), transparent 45%);
}

#app { max-width: 480px; margin: 0 auto; padding: 18px 16px; }

.screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 94vh;
  padding-bottom: 24px;
  animation: fadeIn 0.35s ease;
}
.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Иконки ---------- */
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; }

/* ---------- Интро ---------- */
#screen-intro { justify-content: center; text-align: center; }

.intro-badge {
  font-size: 11px;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}

.case-folder {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 22px 26px;
  position: relative;
  box-shadow:
    0 14px 40px rgba(168, 91, 107, 0.13),
    inset 0 0 0 1px rgba(194, 160, 107, 0.0);
}
.case-folder::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(194, 160, 107, 0.45);
  border-radius: 9px;
  pointer-events: none;
}
.folder-tab {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--blush);
  color: var(--rose-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(168, 91, 107, 0.25);
  white-space: nowrap;
}
.case-folder h1 {
  font-family: 'Cormorant', serif;
  font-weight: 600;
  font-size: 46px;
  line-height: 1;
  letter-spacing: 1px;
}
.case-folder h2 {
  font-family: 'Marck Script', cursive;
  font-size: 26px;
  font-weight: 400;
  color: var(--rose);
  margin-top: 2px;
}

.suspects {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 20px 0 8px;
}
.locket {
  width: 72px;
  height: 90px;
  border-radius: 50%;
  background: var(--blush);
  border: 1.5px solid var(--gold);
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px rgba(194,160,107,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.locket span {
  font-family: 'Cormorant', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 36px;
  color: var(--rose-deep);
}
.suspect-name {
  font-family: 'Marck Script', cursive;
  font-size: 20px;
  color: var(--cocoa);
  margin-top: 6px;
}
.suspect-heart {
  font-size: 26px;
  color: var(--rose);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

.case-text {
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-line;
  text-align: left;
  margin-top: 12px;
  color: var(--cocoa);
}

/* ---------- Кнопки ---------- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 16px 22px;
  font-family: 'Manrope', sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform 0.1s ease, filter 0.15s ease;
}
.btn .icon { font-size: 18px; }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, #D793A0, var(--rose-deep));
  color: #FFF7F2;
  box-shadow: 0 8px 22px rgba(168, 91, 107, 0.35);
}
.btn-secondary {
  background: var(--paper);
  color: var(--rose-deep);
  border: 1.5px solid rgba(168, 91, 107, 0.3);
}
.btn-back {
  background: none;
  border: none;
  color: var(--rose-deep);
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 8px 6px 0;
}

.btn:focus-visible, .btn-back:focus-visible, .map-card:focus-visible, .scene-item:focus-visible {
  outline: 2px solid var(--rose-deep);
  outline-offset: 2px;
}

/* ---------- Топбар и карта ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.topbar-title {
  font-family: 'Cormorant', serif;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.5px;
}
.progress-pill {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 800;
  color: var(--rose-deep);
  display: flex;
  align-items: center;
  gap: 6px;
}
.progress-pill .icon { font-size: 15px; }
.hint { color: var(--cocoa-soft); font-size: 14px; line-height: 1.55; }

.map-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.map-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 14px 16px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  box-shadow: 0 4px 14px rgba(168, 91, 107, 0.07);
}
.map-card:active { transform: scale(0.96); }
.map-card .loc-icon { font-size: 34px; color: var(--rose-deep); }
.map-card .loc-name { font-weight: 700; margin-top: 10px; font-size: 14.5px; }
.map-card.done { border-color: rgba(143, 174, 139, 0.7); }
.map-card.done::after {
  content: "улика";
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--sage);
  color: #FFFDF9;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}

/* ---------- Локация ---------- */
.scene-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.scene-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 12px 18px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.2s ease;
  box-shadow: 0 4px 14px rgba(168, 91, 107, 0.07);
}
.scene-item:active { transform: scale(0.95); }
.scene-item .item-icon { font-size: 32px; color: var(--rose-deep); }
.scene-item .item-name { font-size: 13.5px; font-weight: 600; margin-top: 10px; color: var(--cocoa-soft); }
.scene-item.inspected { opacity: 0.5; }
.scene-item.was-clue { border-color: var(--rose); opacity: 1; }
.scene-item.was-clue .item-icon { color: var(--thread); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: 432px;
  background: var(--paper);
  color: var(--cocoa);
  border: 1px solid var(--line);
  border-left: 3px solid var(--rose);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 12px 30px rgba(76, 59, 55, 0.18);
  animation: toastUp 0.25s ease;
  z-index: 50;
}
@keyframes toastUp {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Модалка улики ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(76, 59, 55, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}
.clue-card {
  background: var(--paper);
  border-radius: 14px;
  padding: 38px 22px 22px;
  max-width: 380px;
  width: 100%;
  position: relative;
  box-shadow: 0 24px 60px rgba(76, 59, 55, 0.35);
  animation: clueDrop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.clue-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(194, 160, 107, 0.45);
  border-radius: 9px;
  pointer-events: none;
}
@keyframes clueDrop {
  from { opacity: 0; transform: scale(0.85) translateY(-26px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.clue-pin {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--thread);
  box-shadow: 0 4px 10px rgba(192, 82, 106, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.clue-pin .icon { font-size: 16px; color: #FFF7F2; }
.clue-stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 1.5px solid var(--rose);
  color: var(--rose-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 6px;
  transform: rotate(7deg);
}
.clue-card h3 {
  font-family: 'Marck Script', cursive;
  font-weight: 400;
  font-size: 27px;
  color: var(--rose-deep);
  margin-bottom: 10px;
  padding-right: 60px;
}
.clue-card p { font-size: 14.5px; line-height: 1.6; margin-bottom: 20px; position: relative; }
.clue-card .btn { width: 100%; }

/* ---------- Доска улик ---------- */
.board-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  padding-top: 6px;
}
.board-thread {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.board-clue {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 16px 14px;
  position: relative;
  box-shadow: 0 6px 18px rgba(168, 91, 107, 0.1);
  z-index: 1;
  width: 88%;
}
.board-clue:nth-child(odd) { align-self: flex-start; transform: rotate(-0.6deg); }
.board-clue:nth-child(even) { align-self: flex-end; transform: rotate(0.6deg); }
.board-pin {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--thread);
  border: 2px solid var(--paper);
  box-shadow: 0 2px 6px rgba(192, 82, 106, 0.45);
}
.board-clue h4 {
  font-family: 'Marck Script', cursive;
  font-weight: 400;
  font-size: 22px;
  color: var(--rose-deep);
  margin-bottom: 4px;
}
.board-clue p { font-size: 13.5px; line-height: 1.55; color: var(--cocoa); }

/* ---------- Вердикт ---------- */
#screen-verdict { justify-content: center; text-align: center; }
.verdict-title {
  font-family: 'Cormorant', serif;
  font-weight: 600;
  font-size: 44px;
  letter-spacing: 8px;
  text-transform: uppercase;
  color: var(--rose-deep);
}
.meter-wrap { display: flex; flex-direction: column; gap: 10px; }
.meter-label {
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cocoa-soft);
  font-weight: 700;
}
.meter {
  height: 14px;
  background: var(--blush);
  border-radius: 999px;
  position: relative;
}
.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #E9BCC4, var(--rose), var(--rose-deep));
  transition: width 0.18s linear;
}
.meter-charm {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  transition: left 0.18s linear;
  font-size: 24px;
  color: var(--thread);
  filter: drop-shadow(0 2px 4px rgba(192, 82, 106, 0.4));
}
.meter-value {
  font-family: 'Cormorant', serif;
  font-weight: 700;
  font-size: 34px;
  color: var(--rose-deep);
}

.seal-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: stampIn 0.45s cubic-bezier(0.2, 1.5, 0.4, 1);
}
@keyframes stampIn {
  from { opacity: 0; transform: scale(2); }
  to { opacity: 1; transform: scale(1); }
}
.seal {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #D793A0, var(--rose-deep) 75%);
  box-shadow:
    0 10px 26px rgba(168, 91, 107, 0.4),
    inset 0 0 0 5px rgba(255, 247, 242, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-8deg);
}
.seal .icon { font-size: 42px; color: #FFF7F2; }
.seal-word {
  font-family: 'Cormorant', serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 7px;
  text-transform: uppercase;
  color: var(--rose-deep);
}

.verdict-text { text-align: center; }
.case-closed {
  font-family: 'Marck Script', cursive;
  font-size: 26px;
  color: var(--gold);
}
.verdict-actions { display: flex; flex-direction: column; gap: 10px; }

/* Падающие сердечки в финале */
.heart-fall {
  position: fixed;
  top: -40px;
  z-index: 5;
  pointer-events: none;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(300deg); opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
