/* ===========================================================
   БОТ-РАССЛЕДОВАНИЕ — чат-квиз
   =========================================================== */

.game-bg::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background: url("../img/bg-interrogation.jpg") center 35% / cover no-repeat;
}
.game-bg::after {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 680px at 76% 10%, rgba(160,124,58,.20) 0%, transparent 60%),
    linear-gradient(180deg, rgba(8,6,5,.72) 0%, rgba(8,6,5,.80) 55%, rgba(8,6,5,.93) 100%);
}

.game-intro {
  max-width: 720px;
  margin: 0 auto;
  padding: 44px 22px 6px;
  text-align: center;
}
.game-intro .back-link { display: flex; width: max-content; }
.game-intro .eyebrow { display: block; margin-bottom: 14px; }
.game-intro h1 {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .2em;
  padding-left: .2em;
  font-size: clamp(30px, 7vw, 50px);
  line-height: 1;
  margin: 0 0 12px;
  color: var(--ink);
  text-shadow: 0 2px 30px rgba(0,0,0,.6);
}
.game-intro .sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
}

/* ---------- Чат ---------- */
.game {
  max-width: 680px;
  margin: 0 auto;
  padding: 26px 18px 150px;
}

#chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg { display: flex; }
.msg--bot { justify-content: flex-start; }
.msg--user { justify-content: flex-end; }

.msg__bubble {
  max-width: 82%;
  padding: 13px 17px;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.5;
  border-radius: 14px;
  animation: msg-in .32s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

.msg--bot .msg__bubble {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(26,18,13,.92) 0%, rgba(16,11,8,.94) 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-deep);
  border-top-left-radius: 4px;
}
.msg--user .msg__bubble {
  color: #3c2d1c;
  background: linear-gradient(168deg, #f4ebd7 0%, #e7d9bd 100%);
  box-shadow: 0 6px 18px -10px rgba(0,0,0,.7);
  border-top-right-radius: 4px;
  font-weight: 500;
}

.msg__stage {
  display: inline-block;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 10.5px;
  color: var(--gold);
}
.msg--bot:has(.msg__stage) .msg__bubble,
.msg__bubble .msg__stage { }
.msg--bot .msg__bubble .msg__stage { color: var(--gold-2); }

/* индикатор «печатает…» */
.typing { display: inline-flex; gap: 4px; padding: 2px 0; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold-deep);
  animation: blink 1.2s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .3 } 40% { opacity: 1 } }

/* ---------- Композер (ввод) ---------- */
.composer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  padding: 16px clamp(18px, 4vw, 40px) calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(8,6,5,0) 0%, rgba(8,6,5,.85) 32%, rgba(8,6,5,.97) 100%);
}
.composer__form,
.composer .suspects,
.composer > .composer__advance,
.composer .game-done {
  max-width: 680px;
  margin: 0 auto;
}

.composer__form {
  display: flex;
  gap: 10px;
  align-items: center;
}
.composer__input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--ink);
  background: rgba(20,14,10,.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 14px 20px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.composer__input::placeholder { color: var(--ink-faint); }
.composer__input:focus { border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(201,168,106,.14); }

.composer__send {
  flex: none;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #1a1109;
  background: linear-gradient(180deg, var(--gold-2) 0%, var(--gold-deep) 100%);
  box-shadow: 0 10px 24px -10px var(--gold-glow), inset 0 1px 0 rgba(255,240,210,.6);
  transition: transform .12s ease;
}
.composer__send:hover { transform: scale(1.05); }
.composer__send:active { transform: scale(.96); }

/* кнопка «открыть конверт / дальше» */
.composer__advance {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 600;
  font-size: 16px;
  text-align: center;
  color: #1a1109;
  background: linear-gradient(180deg, var(--gold-2) 0%, var(--gold-deep) 100%);
  border: none;
  border-radius: var(--radius-sm);
  padding: 17px 24px;
  cursor: pointer;
  box-shadow: 0 14px 34px -12px var(--gold-glow), inset 0 1px 0 rgba(255,240,210,.6);
  transition: transform .14s ease;
}
.composer__advance:hover { transform: translateY(-2px); color: #1a1109; }

.composer__ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 600;
  font-size: 15px;
  color: var(--gold);
  background: rgba(28,19,15,.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 15px 24px;
}
.composer__ghost:hover { color: var(--gold-2); border-color: var(--gold-deep); }

.game-done { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Финал: выбор подозреваемых ---------- */
/* блок-«пузырь» с сеткой имён — полноширинный, живёт в ленте чата */
.msg__bubble.suspects-block {
  max-width: 100%;
  width: 100%;
  padding: 14px;
  border-left-color: var(--blood-2);
}
.suspects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0;
}
.suspect {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--ink-dim);
  background: rgba(20,14,10,.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  cursor: pointer;
  transition: all .16s ease;
}
.suspect:hover { border-color: var(--gold-deep); color: var(--gold-2); }
.suspect.is-on {
  color: #1a1109;
  background: linear-gradient(180deg, var(--gold-2), var(--gold-deep));
  border-color: var(--gold-2);
  font-weight: 700;
}
.suspects__confirm {
  display: block;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 600;
  font-size: 16px;
  color: #f5ece2;
  background: linear-gradient(180deg, var(--blood-2) 0%, var(--wine) 100%);
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  cursor: pointer;
  box-shadow: 0 14px 34px -12px var(--blood-glow);
  transition: transform .14s ease;
}
.suspects__confirm:hover { transform: translateY(-2px); }

/* ---------- Плеер финального допроса ---------- */
.msg__bubble.fp {
  max-width: 100%;
  width: 100%;
  padding: 18px 20px;
  border-left-color: var(--blood-2);
}
.fp__top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 11px;
  color: var(--ink-dim);
  margin-bottom: 16px;
}
.fp__top > svg { color: var(--gold-deep); flex: none; }
.fp__tag {
  margin-left: auto;
  color: var(--gold-2);
  letter-spacing: .06em;
  text-transform: none;
  font-size: 11.5px;
  white-space: nowrap;
}
.fp__main { display: flex; align-items: center; gap: 16px; }
.fp__play {
  flex: none;
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #1a1109;
  background: linear-gradient(180deg, var(--gold-2) 0%, var(--gold-deep) 100%);
  box-shadow: 0 8px 22px -10px var(--gold-glow), inset 0 1px 0 rgba(255,240,210,.6);
  transition: transform .12s ease;
}
.fp__play:hover { transform: scale(1.05); }
.fp__play:active { transform: scale(.97); }
.fp__body { flex: 1; min-width: 0; }
.fp__bar {
  position: relative;
  height: 32px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.fp__bar:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 4px; }
.fp__bar::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 50%;
  height: 24px; transform: translateY(-50%);
  background: linear-gradient(180deg, #57402a, #382818);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='24'%3E%3Cg fill='%23000'%3E%3Crect x='0' y='9' width='2' height='6'/%3E%3Crect x='4' y='6' width='2' height='12'/%3E%3Crect x='8' y='8' width='2' height='8'/%3E%3Crect x='12' y='3' width='2' height='18'/%3E%3Crect x='16' y='7' width='2' height='10'/%3E%3Crect x='20' y='10' width='2' height='4'/%3E%3Crect x='24' y='5' width='2' height='14'/%3E%3Crect x='28' y='8' width='2' height='8'/%3E%3Crect x='32' y='2' width='2' height='20'/%3E%3Crect x='36' y='7' width='2' height='10'/%3E%3Crect x='40' y='9' width='2' height='6'/%3E%3Crect x='44' y='4' width='2' height='16'/%3E%3Crect x='48' y='8' width='2' height='9'/%3E%3Crect x='52' y='10' width='2' height='4'/%3E%3Crect x='56' y='6' width='2' height='12'/%3E%3Crect x='60' y='8' width='2' height='8'/%3E%3C/g%3E%3C/svg%3E") left center repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='24'%3E%3Cg fill='%23000'%3E%3Crect x='0' y='9' width='2' height='6'/%3E%3Crect x='4' y='6' width='2' height='12'/%3E%3Crect x='8' y='8' width='2' height='8'/%3E%3Crect x='12' y='3' width='2' height='18'/%3E%3Crect x='16' y='7' width='2' height='10'/%3E%3Crect x='20' y='10' width='2' height='4'/%3E%3Crect x='24' y='5' width='2' height='14'/%3E%3Crect x='28' y='8' width='2' height='8'/%3E%3Crect x='32' y='2' width='2' height='20'/%3E%3Crect x='36' y='7' width='2' height='10'/%3E%3Crect x='40' y='9' width='2' height='6'/%3E%3Crect x='44' y='4' width='2' height='16'/%3E%3Crect x='48' y='8' width='2' height='9'/%3E%3Crect x='52' y='10' width='2' height='4'/%3E%3Crect x='56' y='6' width='2' height='12'/%3E%3Crect x='60' y='8' width='2' height='8'/%3E%3C/g%3E%3C/svg%3E") left center repeat-x;
  opacity: .42;
}
.fp__fill {
  position: absolute;
  left: 0; top: 50%;
  height: 3px; width: 0;
  transform: translateY(-50%);
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-2));
  box-shadow: 0 0 10px var(--gold-glow);
  pointer-events: none;
}
.fp__knob {
  position: absolute;
  top: 50%; left: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gold-2);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(151,121,74,.3), 0 2px 6px rgba(0,0,0,.6);
  pointer-events: none;
  display: none;
}
.fp__times {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-dim);
  margin-top: 4px;
}
.fp__times .fp__dur { color: var(--gold); }

@media (max-width: 560px) {
  .msg__bubble { max-width: 88%; font-size: 15px; }
  .msg__bubble.fp { max-width: 100%; }
  .fp__tag { font-size: 10.5px; }
  .game { padding-bottom: 160px; }
}
