@font-face {
  font-family: 'Cooper BT';
  src: url('/fonts/cooper-bt-light.woff2') format('woff2');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Cooper BT';
  src: url('/fonts/cooper-bt-light-italic.woff2') format('woff2');
  font-weight: 300; font-style: italic; font-display: swap;
}

:root {
  --serif: 'Cooper BT', Georgia, 'Times New Roman', serif;
  --sans: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bg: #EEF1F2;
  --surface: #FFFFFF;
  --coral: #F57F5B;
  --coral-dark: #D96D4D;
  --slate: #A8CDD7;
  --slate-light: #CBE1E8;
  --ink: #2E3C41;
  --body: #414042;
  --muted: #8A8F94;
  --border: #E2E5E8;
  --incoming: #F3F6F7;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* keep the hidden attribute authoritative over display:flex/grid rules */
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--body);
  background: radial-gradient(1100px 620px at 50% -8%, #F7FAFB 0%, var(--bg) 62%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.phone {
  width: 100%; max-width: 428px;
  background: var(--surface);
  border-radius: 26px;
  box-shadow: 0 1px 0 rgba(46,60,65,.04), 0 30px 60px -24px rgba(46,60,65,.28);
  border: 1px solid #EBEEEF;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 720px;
}

/* Header */
.top { padding: 20px 22px 14px; }
.brandrow { display: flex; align-items: center; justify-content: space-between; }
.wordmark { font-weight: 700; font-size: 12.5px; letter-spacing: .18em; color: var(--ink); text-transform: uppercase; }
.step { font-weight: 700; font-size: 10.5px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; font-variant-numeric: tabular-nums; }
.track { margin-top: 14px; height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.fill {
  height: 100%; width: 12%;
  background: linear-gradient(90deg, var(--coral), #F79574);
  border-radius: 2px; transition: width .5s cubic-bezier(.22,.61,.36,1);
}

/* Body */
.body { flex: 1; padding: 8px 22px 0; display: flex; flex-direction: column; }

.whofrom {
  display: flex; align-items: center; gap: 11px; margin: 10px 0 16px;
  opacity: 0; animation: rise 620ms ease both; animation-delay: 120ms;
}
.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none; display: block;
  background: linear-gradient(135deg, var(--slate-light), var(--slate));
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--slate-light);
  background-size: cover; background-position: center;
}
.avatar.sm { width: 40px; height: 40px; margin-bottom: 12px; }
.who .name { font-weight: 600; font-size: 14px; color: var(--ink); line-height: 1.1; }
.who .role { font-size: 11px; color: var(--muted); margin-top: 2px; }
.placeholder-tag {
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  border: 1px dashed #CFD5D7; border-radius: 4px; padding: 2px 5px; margin-left: 4px; white-space: nowrap;
}

.transcript { display: flex; flex-direction: column; gap: 9px; }
.bubble {
  font-size: 14px; line-height: 1.5; padding: 11px 14px; max-width: 86%;
  border: 1px solid #EAEEEF;
}
.bubble.assistant { background: var(--incoming); border-radius: 14px 14px 14px 4px; align-self: flex-start; color: var(--body); }
.bubble.assistant strong { color: var(--ink); font-weight: 600; }
.bubble.user { background: #FCEDE7; border-color: #F6D9CD; border-radius: 14px 14px 4px 14px; align-self: flex-end; color: #6B4636; }

.typing {
  display: inline-flex; gap: 5px; align-items: center; padding: 13px 16px; margin-top: 12px;
  background: var(--incoming); border: 1px solid #EAEEEF; border-radius: 16px 16px 16px 5px; width: max-content;
}
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #B7C0C3; display: block; animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%,80%,100% { opacity:.35; transform: translateY(0);} 40% { opacity:1; transform: translateY(-2px);} }

.question {
  font-family: var(--serif); font-weight: 300; font-size: 29px; line-height: 1.16; letter-spacing: .1px;
  color: var(--ink); text-wrap: balance; margin: 20px 0 2px;
}
.question em { font-style: italic; color: var(--coral-dark); }
.question.show { animation: rise 600ms cubic-bezier(.22,.61,.36,1) both; }
.hintline { font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.spacer { flex: 1; min-height: 16px; }

/* Composer */
.composer {
  padding: 14px 16px 18px; border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, #FCFDFD);
}
.inputwrap { display: flex; align-items: flex-end; gap: 10px; }
.field {
  flex: 1; background: #F6F8F9; border: 1.5px solid var(--border); border-radius: 14px;
  padding: 13px 15px; font-family: var(--sans); font-size: 15px; color: var(--ink);
  line-height: 1.45; min-height: 50px; max-height: 140px; overflow-y: auto;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.field:focus { outline: none; background: #fff; border-color: var(--slate); box-shadow: 0 0 0 4px rgba(168,205,215,.35); }
.field:empty:before { content: attr(data-ph); color: #A9B0B3; }
.send, .micslot {
  flex: none; width: 50px; height: 50px; border: none; border-radius: 4px;
  display: grid; place-items: center; cursor: pointer; transition: background .15s ease, transform .1s ease;
}
.send { background: var(--coral); color: #fff; }
.send:hover { background: var(--coral-dark); }
.send:active { transform: translateY(1px); }
.send:focus-visible, .micslot:focus-visible, .btn-primary:focus-visible, .btn-ghost:focus-visible {
  outline: 3px solid rgba(168,205,215,.75); outline-offset: 2px;
}
.micslot { background: #EEF3F4; color: var(--ink); }
.send svg, .micslot svg { width: 20px; height: 20px; }

.voicehint { display: flex; align-items: center; gap: 7px; margin-top: 11px; font-size: 11.5px; color: var(--muted); }
.voicehint .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--slate); }
.voicehint b { color: var(--body); font-weight: 600; }

/* Draft view */
.draftview { flex: 1; padding: 22px 22px 18px; display: flex; flex-direction: column; animation: rise 600ms ease both; }
.draft-title { font-family: var(--serif); font-weight: 300; font-size: 30px; line-height: 1.14; color: var(--ink); margin: 0 0 6px; }
.draft-title em { font-style: italic; color: var(--coral-dark); }
.draft-sub { font-size: 13.5px; color: var(--muted); margin: 0 0 16px; }
.draft-box {
  flex: 1; min-height: 190px; resize: vertical; width: 100%;
  font-family: var(--sans); font-size: 15.5px; line-height: 1.6; color: var(--ink);
  background: #F8FAFB; border: 1.5px solid var(--border); border-radius: 12px; padding: 15px 16px;
}
.draft-box:focus { outline: none; border-color: var(--slate); box-shadow: 0 0 0 4px rgba(168,205,215,.35); background: #fff; }
.draft-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-primary {
  flex: 1; background: var(--coral); color: #fff; border: none; border-radius: 4px;
  padding: 15px 16px; font-family: var(--sans); font-weight: 600; font-size: 15px; cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.btn-primary:hover { background: var(--coral-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost {
  flex: 1; text-align: center; text-decoration: none; color: var(--ink);
  background: #fff; border: 1.5px solid var(--border); border-radius: 4px;
  padding: 15px 16px; font-weight: 600; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.btn-ghost:hover { border-color: var(--slate); }
.toast { margin-top: 14px; font-size: 12.5px; color: var(--coral-dark); font-weight: 500; }

@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  *, .question.show, .draftview { animation-duration: .01ms !important; animation-delay: 0ms !important; }
  .fill { transition: none; }
}
