:root {
  --ink: #22201e;
  --muted: #6c6863;
  --coral: #e94e3d;
  --coral-dark: #d94131;
  --cream: #f7f4ee;
  --sand: #ede5d8;
  --white: #fff;
  --line: #e8e3dc;
  --green: #32a66a;
  --shadow: 0 24px 70px rgba(43, 34, 27, 0.13);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); font-family: "DM Sans", sans-serif; background: var(--cream); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.chatty-shell { min-height: 100vh; }
.brand { display: inline-flex; align-items: center; gap: 8px; font: 800 26px/1 "Manrope", sans-serif; letter-spacing: -1px; }
.brand-mark { width: 28px; height: 28px; background: var(--coral); border-radius: 9px 9px 9px 3px; display: grid; place-items: center; transform: rotate(-8deg); }
.brand-mark > span { width: 11px; height: 14px; border: 2px solid white; border-radius: 8px 8px 4px 4px; position: relative; }
.brand-mark > span::before { content: ""; position: absolute; width: 5px; height: 4px; border: 1.8px solid white; border-bottom: 0; border-radius: 5px 5px 0 0; top: -6px; left: 1px; }

.lock-screen { min-height: 100vh; padding: 36px clamp(22px, 5vw, 72px); background: radial-gradient(circle at 80% 10%, #f8d9d4 0, transparent 28%), var(--cream); }
.lock-card { width: min(560px, 100%); margin: clamp(90px, 17vh, 180px) auto 60px; padding: clamp(30px, 6vw, 60px); border-radius: 24px; background: var(--white); box-shadow: var(--shadow); }
.eyebrow { color: var(--coral); text-transform: uppercase; letter-spacing: 1.8px; font: 700 11px "Manrope", sans-serif; }
.lock-card h1 { margin: 14px 0; font: 700 clamp(44px, 8vw, 66px)/1 "Manrope", sans-serif; letter-spacing: -3px; }
.lock-card > p { color: var(--muted); font-size: 16px; line-height: 1.65; margin: 0 0 32px; }
.lock-card label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.password-row { display: flex; gap: 10px; }
.password-row input { min-width: 0; flex: 1; height: 52px; border: 1px solid var(--line); border-radius: 10px; padding: 0 15px; outline: none; }
.password-row input:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(233, 78, 61, 0.12); }
.password-row button { border: 0; border-radius: 10px; padding: 0 20px; background: var(--coral); color: white; font-weight: 700; cursor: pointer; }
.password-row button:hover { background: var(--coral-dark); }
.password-row button:disabled { opacity: 0.55; cursor: wait; }
.form-status { min-height: 18px; color: var(--coral-dark); font-size: 12px; margin: 10px 0 0; }

.chat-app { width: 100%; min-height: 100vh; margin: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: white; }
.agent-stage { min-width: 0; height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; justify-content: center; overflow: hidden; padding: clamp(28px, 4vw, 64px); background: linear-gradient(145deg, #fff4f7 0%, #f9d7e6 48%, #f49bc4 100%); }
.agent-stage::before, .agent-stage::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.agent-stage::before { width: 340px; height: 340px; top: -170px; right: -90px; background: rgba(255, 255, 255, 0.38); }
.agent-stage::after { width: 230px; height: 230px; bottom: -120px; left: -70px; background: rgba(233, 78, 61, 0.12); }
.agent-stage-copy, .mascot-frame, .voice-hint { position: relative; z-index: 1; }
.agent-stage-copy { width: min(560px, 100%); margin: 0 auto 22px; }
.agent-stage-copy h2 { margin: 8px 0 7px; font: 700 clamp(30px, 4vw, 54px)/1.05 "Manrope", sans-serif; letter-spacing: -2px; }
.agent-stage-copy p { margin: 0; color: #6f4c58; font-size: 13px; }
.mascot-frame { width: min(560px, 82vh, 100%); aspect-ratio: 1; margin: 0 auto; overflow: hidden; border: clamp(6px, 0.8vw, 12px) solid rgba(255, 255, 255, 0.74); border-radius: 34% 34% 46% 46%; background: #f37fbc; box-shadow: 0 32px 80px rgba(109, 44, 75, 0.24); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.mascot-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.agent-stage.is-speaking .mascot-frame { transform: translateY(-3px) scale(1.008); box-shadow: 0 36px 90px rgba(109, 44, 75, 0.31); }
.voice-hint { margin: 18px auto 0; color: #6f4c58; text-align: center; font-size: 11px; }
.chat-panel { min-width: 0; height: 100vh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: white; box-shadow: -20px 0 60px rgba(43, 34, 27, 0.08); }
.chat-header { min-height: 86px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.94); position: relative; z-index: 10; backdrop-filter: blur(14px); }
.agent-title { display: flex; align-items: center; gap: 12px; }
.agent-avatar, .message-avatar { flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--coral); font-weight: 800; }
.agent-avatar { width: 42px; height: 42px; }
.agent-title h1 { margin: 0; font: 700 16px "Manrope", sans-serif; }
.agent-title p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.online-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 4px; }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 14px; }
.voice-toggle { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; cursor: pointer; }
.voice-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.voice-toggle span { width: 31px; height: 18px; padding: 2px; border-radius: 20px; background: #cbc6c0; transition: 0.2s; }
.voice-toggle span::after { content: ""; display: block; width: 14px; height: 14px; border-radius: 50%; background: white; transition: 0.2s; }
.voice-toggle input:checked + span { background: var(--coral); }
.voice-toggle input:checked + span::after { transform: translateX(13px); }
.quiet-button { border: 1px solid var(--line); border-radius: 9px; background: white; padding: 8px 11px; font-size: 11px; font-weight: 700; cursor: pointer; }

.conversation { min-height: 0; padding: 46px clamp(20px, 5vw, 72px) 28px; overflow-y: auto; }
.message { display: flex; align-items: flex-end; gap: 10px; max-width: 78%; margin-bottom: 22px; animation: rise 0.28s ease; }
.message-avatar { width: 30px; height: 30px; font-size: 11px; }
.message-bubble { padding: 14px 17px; border-radius: 16px 16px 16px 4px; background: var(--cream); line-height: 1.6; font-size: 14px; }
.message-bubble p { margin: 0; white-space: pre-wrap; }
.user-message { margin-left: auto; flex-direction: row-reverse; }
.user-message .message-avatar { background: var(--ink); }
.user-message .message-bubble { color: white; background: var(--ink); border-radius: 16px 16px 4px 16px; }
.typing-dots { display: flex; gap: 4px; padding: 4px 1px; }
.typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: #aaa39d; animation: blink 1s infinite alternate; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
.starter-area { margin: 38px 0 10px 40px; }
.starter-area > p { margin: 0 0 10px; color: #9a948f; text-transform: uppercase; letter-spacing: 1.3px; font-size: 9px; font-weight: 700; }
.suggestions { display: flex; flex-wrap: wrap; gap: 9px; }
.suggestions button { padding: 10px 13px; border: 1px solid var(--line); border-radius: 20px; background: white; color: #58534e; font-size: 12px; cursor: pointer; transition: 0.2s; }
.suggestions button:hover { border-color: var(--coral); color: var(--coral); transform: translateY(-1px); }

.composer-wrap { padding: 14px clamp(18px, 4vw, 56px) 18px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(14px); }
.composer { display: grid; grid-template-columns: 1fr auto auto; align-items: end; gap: 7px; padding: 7px; border: 1px solid #ddd8d2; border-radius: 17px; box-shadow: 0 10px 30px rgba(43, 34, 27, 0.08); }
.composer:focus-within { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(233, 78, 61, 0.1); }
.composer textarea { width: 100%; max-height: 130px; resize: none; border: 0; outline: 0; padding: 10px 8px; background: transparent; line-height: 1.45; }
.mic-button, .send-button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 11px; cursor: pointer; }
.mic-button { background: var(--cream); }
.mic-button.listening { color: white; background: var(--coral); animation: pulse 1.2s infinite; }
.send-button { color: white; background: var(--coral); }
.send-button:disabled { opacity: 0.5; cursor: wait; }
.mic-button svg, .send-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.composer-status { min-height: 14px; margin: 8px 5px 0; color: #99928c; text-align: center; font-size: 10px; }

@keyframes blink { to { opacity: 0.25; transform: translateY(-2px); } }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(233, 78, 61, 0.15); } }

@media (max-width: 680px) {
  .lock-screen { padding: 24px 18px; }
  .lock-card { margin-top: 90px; }
  .password-row { display: grid; }
  .password-row button { height: 50px; }
  .chat-header { grid-template-columns: 1fr auto; padding: 14px 16px; }
  .chat-header > .brand { display: none; }
  .agent-title { justify-self: start; }
  .voice-toggle { font-size: 0; }
  .conversation { padding: 28px 16px 20px; }
  .message { max-width: 91%; }
  .starter-area { margin-left: 0; }
  .suggestions { display: grid; }
  .suggestions button { text-align: left; }
  .composer-wrap { padding: 10px 10px 14px; }
}

@media (max-width: 900px) {
  .chat-app { grid-template-columns: 1fr; }
  .agent-stage { height: auto; min-height: 42vh; position: relative; padding: 28px 24px 22px; }
  .agent-stage-copy { margin-bottom: 14px; text-align: center; }
  .agent-stage-copy h2 { font-size: clamp(28px, 7vw, 42px); }
  .mascot-frame { width: min(290px, 48vh, 78vw); border-radius: 50%; }
  .voice-hint { margin-top: 12px; }
  .chat-panel { height: max(58vh, 620px); }
}

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