:root {
  --bg: #0e1621;
  --panel: #17212b;
  --chat-bg: #0e1621;
  --bubble-bot: #182533;
  --bubble-user: #2b5278;
  --accent: #5aa7e4;
  --kbd: #232e3c;
  --kbd-hover: #2b3848;
  --text: #e7eef5;
  --muted: #7e94a8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #060a0f;
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
  padding: 24px 20px;
  background: var(--panel);
  border-right: 1px solid #0a0f15;
}
.sidebar h1 { font-size: 18px; margin: 0 0 4px; }
.sidebar .sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; line-height: 1.4; }
.sidebar h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.scenario {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--kbd);
  color: var(--text);
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  margin-bottom: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background .12s;
}
.scenario:hover { background: var(--kbd-hover); }
.scenario .hint { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 18px; }
.note code { background: #0a0f15; padding: 1px 5px; border-radius: 4px; }

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.phone {
  width: 390px;
  height: 800px;
  max-height: 92vh;
  background: var(--chat-bg);
  border-radius: 34px;
  border: 10px solid #1c1c1e;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.phone-header {
  background: var(--panel);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #0a0f15;
}
.phone-header .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #5aa7e4, #8e7cc3);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.phone-header .meta b { font-size: 15px; }
.phone-header .meta span { display: block; font-size: 12px; color: var(--muted); }

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-image: radial-gradient(circle at 20% 30%, #14202c 0, transparent 40%),
                    radial-gradient(circle at 80% 70%, #131d28 0, transparent 40%);
}
.chat::-webkit-scrollbar { width: 7px; }
.chat::-webkit-scrollbar-thumb { background: #2b3848; border-radius: 4px; }

.msg {
  max-width: 84%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.42;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: pop .16s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.bot { background: var(--bubble-bot); align-self: flex-start; border-bottom-left-radius: 5px; }
.msg.user { background: var(--bubble-user); align-self: flex-end; border-bottom-right-radius: 5px; }

.kbd { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; align-self: flex-start; max-width: 84%; width: 84%; }
.kbd-row { display: flex; gap: 5px; }
.kbd button {
  flex: 1;
  background: var(--kbd);
  color: var(--text);
  border: none;
  border-radius: 9px;
  padding: 9px 6px;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .12s;
}
.kbd button:hover { background: var(--accent); }

.composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel);
  border-top: 1px solid #0a0f15;
}
.composer input {
  flex: 1;
  background: var(--kbd);
  border: none;
  border-radius: 18px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.composer input::placeholder { color: var(--muted); }
.composer button {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  color: #fff; font-size: 17px; cursor: pointer;
}
.composer.disabled { opacity: .5; pointer-events: none; }

.toast {
  position: fixed;
  bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #000a; color: #fff; padding: 10px 18px; border-radius: 20px;
  font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
