:root {
  --red: #e10600;
  --red-dark: #b60905;
  --ink: #171717;
  --muted: #65676d;
  --line: #e7e3df;
  --soft: #f7f5f2;
  --paper: #ffffff;
  --success: #16845b;
  --shadow: 0 26px 80px rgba(71, 24, 18, .16);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #f5f1ee; }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: "DM Sans", "Segoe UI", sans-serif; background: radial-gradient(circle at 8% 8%, rgba(225, 6, 0, .12), transparent 25rem), linear-gradient(135deg, #faf8f6 0%, #f3eeea 100%); }
button, textarea { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1440px, 100%); min-height: 100vh; margin: 0 auto; padding: 22px clamp(18px, 4vw, 64px) 42px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); font: 800 1rem "Manrope", sans-serif; text-decoration: none; }
.brand img { width: 48px; height: 48px; object-fit: contain; }
.reset-button, .copy-button { border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; color: var(--ink); background: rgba(255,255,255,.75); font-weight: 700; transition: border-color .2s, transform .2s, background .2s; }
.reset-button:hover, .copy-button:hover { border-color: #bdb7b2; background: #fff; transform: translateY(-1px); }

.workspace { display: grid; grid-template-columns: minmax(300px, .78fr) minmax(520px, 1.22fr); gap: clamp(32px, 6vw, 90px); align-items: center; min-height: calc(100vh - 126px); }
.intro-panel { max-width: 550px; padding: 30px 0; }
.eyebrow { margin: 0 0 18px; color: var(--red-dark); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: .78rem; }
h1 { max-width: 12ch; margin: 0 0 24px; font: 800 clamp(2.45rem, 4.7vw, 5.15rem)/.98 "Manrope", sans-serif; letter-spacing: -.055em; }
.intro-copy { max-width: 52ch; margin: 0 0 34px; color: #4f5055; font-size: clamp(1rem, 1.25vw, 1.15rem); line-height: 1.65; }
.benefits { display: grid; gap: 4px; border-top: 1px solid #d8d2cd; border-bottom: 1px solid #d8d2cd; padding: 13px 0; }
.benefits > div { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: baseline; padding: 9px 0; }
.benefits span { color: var(--red); font: 800 .75rem "Manrope", sans-serif; }
.benefits p { margin: 0; color: #525358; line-height: 1.45; }
.benefits strong { color: var(--ink); }
.privacy-note { margin: 20px 0 0; color: #77736f; font-size: .86rem; line-height: 1.5; }

.coach-card { height: min(760px, calc(100vh - 140px)); min-height: 610px; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; border: 1px solid rgba(255,255,255,.9); border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); }
.coach-header { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; padding: 19px 22px; border-bottom: 1px solid var(--line); }
.coach-avatar { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 14px; color: #fff; background: var(--red); font: 800 .87rem "Manrope", sans-serif; box-shadow: 0 8px 20px rgba(225,6,0,.24); }
.coach-header h2 { margin: 0 0 3px; font: 800 1rem "Manrope", sans-serif; }
.coach-header p { margin: 0; color: var(--muted); font-size: .8rem; }
.online-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--success); }
.copy-button { padding: 8px 12px; font-size: .78rem; }

.messages { overflow-y: auto; padding: 26px 22px; scroll-behavior: smooth; }
.message-row { display: flex; gap: 10px; margin: 0 0 18px; animation: enter .25s ease-out; }
.message-row.user { justify-content: flex-end; }
.bubble { max-width: min(84%, 620px); padding: 13px 16px; border-radius: 18px 18px 18px 5px; color: #292929; background: var(--soft); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-row.user .bubble { border-radius: 18px 18px 5px 18px; color: #fff; background: #242424; }
.speaker { margin-top: 4px; flex: 0 0 auto; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: #fff; background: var(--red); font: 800 .58rem "Manrope", sans-serif; }
.thinking .bubble { display: flex; gap: 5px; align-items: center; min-height: 46px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: #8f8b87; animation: pulse 1.1s infinite ease-in-out; }
.thinking i:nth-child(2) { animation-delay: .14s; }
.thinking i:nth-child(3) { animation-delay: .28s; }

.composer { margin: 0 18px 18px; overflow: hidden; border: 1px solid #cdc7c2; border-radius: 19px; background: #fff; box-shadow: 0 8px 28px rgba(35,22,18,.07); transition: border-color .2s, box-shadow .2s; }
.composer:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(225,6,0,.09); }
.composer textarea { display: block; width: 100%; min-height: 74px; max-height: 170px; resize: none; border: 0; outline: 0; padding: 15px 16px 6px; color: var(--ink); background: transparent; font-size: 1rem; line-height: 1.5; }
.composer textarea::placeholder { color: #9a9793; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 9px 9px 16px; }
.composer-footer p { margin: 0; color: #85817d; font-size: .75rem; }
.composer-footer p.error { color: var(--red-dark); }
.composer button { flex: 0 0 auto; border: 0; border-radius: 12px; padding: 10px 15px; color: #fff; background: var(--red); font-weight: 800; }
.composer button:hover { background: var(--red-dark); }
.composer button:disabled { cursor: wait; opacity: .55; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
@keyframes pulse { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

@media (max-width: 900px) {
  .shell { padding-bottom: 24px; }
  .workspace { grid-template-columns: 1fr; min-height: auto; gap: 18px; }
  .intro-panel { max-width: none; padding: 40px 0 20px; }
  h1 { max-width: 15ch; font-size: clamp(2.5rem, 8vw, 4.7rem); }
  .benefits { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .benefits > div { display: block; }
  .benefits span { display: block; margin-bottom: 7px; }
  .coach-card { height: 700px; min-height: 600px; }
}

@media (max-width: 620px) {
  .shell { padding: 12px 12px 20px; }
  .topbar { min-height: 54px; }
  .brand img { width: 40px; height: 40px; }
  .intro-panel { padding-top: 30px; }
  h1 { font-size: clamp(2.35rem, 12vw, 3.25rem); }
  .benefits { grid-template-columns: 1fr; gap: 0; }
  .benefits > div { display: grid; }
  .coach-card { height: calc(100vh - 24px); min-height: 590px; border-radius: 22px; }
  .copy-button { display: none; }
  .coach-header { grid-template-columns: auto 1fr; padding: 15px; }
  .messages { padding: 20px 14px; }
  .bubble { max-width: 88%; }
  .composer { margin: 0 10px 10px; }
  .composer-footer p { display: none; }
  .composer-footer { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
