* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  font-family: Arial, sans-serif;
  overflow: hidden;
}

.app {
  height: 100dvh;
  max-width: 420px;
  margin: 0 auto;
  background: #0b0b0b;
  display: flex;
  flex-direction: column;
}

/* ================= HEADER ================= */

.header {
  padding: 14px;
  text-align: center;
  font-weight: bold;
  background: #111;
  border-bottom: 1px solid #222;
  color: #fff;
  position: relative;
}

/* ================= SCREENS ================= */

.screen {
  flex: 1;
  display: none;
  flex-direction: column;
  padding: 16px;
  gap: 14px;
  color: #fff;

  /* ❗ ВАЖНО: не ломаем экраны */
  overflow: hidden;
}

.screen.active {
  display: flex;
}

/* ================= CENTER ================= */

.center {
  margin: auto;
  text-align: center;
}

/* ================= OPTIONS ================= */

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option {
  flex: 1 1 45%;
  padding: 12px;
  text-align: center;
  background: #111;
  border-radius: 10px;
  border: 1px solid #222;
  cursor: pointer;
}

.option.selected {
  background: #4E6F5D;
  color: #eafff1;
}

/* ================= INPUTS ================= */

input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #333;
  background: #000;
  color: #fff;
  font-size: 16px;
}

/* ================= BUTTONS ================= */

button {
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: #4E6F5D;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.4;
}

/* ================= CHAT ================= */

.chat-top {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ❗ КЛЮЧЕВОЙ ФИКС */
.chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;

  /* 🔑 без этого скролл НЕ работает */
  min-height: 0;
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;

  /* ✅ ВКЛЮЧАЕМ СКРОЛЛ */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  /* 🔑 критично для mobile */
  min-height: 0;
}

.message {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.user {
  align-self: flex-end;
  background: #7CFF9B;
  color: #000;
}

.ai {
  align-self: flex-start;
  background: #4E6F5D;
  color: #eafff1;
}

/* ================= INPUT AREA ================= */

.input-area {
  display: flex;
  gap: 8px;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ================= MISC ================= */

.muted {
  opacity: 0.6;
}
