:root {
  color-scheme: light;
  --navy: #003c4f;
  --navy-deep: #002c3a;
  --aqua: #00a8c5;
  --aqua-soft: #e8f8fb;
  --sky: #d7edf3;
  --ink: #17313a;
  --muted: #64777e;
  --line: #dbe5e8;
  --surface: #ffffff;
  --canvas: #eef5f6;
  --danger: #963f45;
  --shadow: 0 24px 70px rgba(0, 44, 58, 0.16);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 50% -20%, #ffffff 0, var(--canvas) 52%, #e3eef0 100%); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, textarea { font: inherit; }
button { cursor: pointer; }
.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; }
.app-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.chat-card { width: min(100%, 860px); min-height: min(820px, calc(100vh - 56px)); display: grid; grid-template-rows: auto auto minmax(300px, 1fr) auto auto; overflow: hidden; border: 1px solid rgba(0, 60, 79, 0.12); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 24px; color: white; background: linear-gradient(135deg, var(--navy-deep), var(--navy)); }
.identity { display: flex; align-items: center; min-width: 0; gap: 14px; }
.logo-wrap { width: 52px; height: 52px; flex: 0 0 52px; display: grid; place-items: center; overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.7); border-radius: 50%; background: white; }
.logo-wrap img { width: 100%; height: 100%; object-fit: cover; }
.company { margin: 0 0 3px; color: #bdebf3; font-size: 0.65rem; font-weight: 800; letter-spacing: 0.15em; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.25rem, 3vw, 1.7rem); font-weight: 500; line-height: 1.1; }
.presence { display: flex; align-items: center; gap: 6px; margin: 5px 0 0; color: #d9f3f7; font-size: 0.76rem; }
.presence span { width: 7px; height: 7px; border-radius: 50%; background: #65d5a7; box-shadow: 0 0 0 3px rgba(101, 213, 167, 0.16); }
.restart { flex: 0 0 auto; border: 1px solid rgba(255, 255, 255, 0.42); border-radius: 999px; padding: 8px 12px; color: white; background: transparent; font-size: 0.78rem; font-weight: 700; }
.restart:hover, .restart:focus-visible { background: rgba(255, 255, 255, 0.12); }
.protocol-line { display: flex; align-items: center; justify-content: center; gap: 9px; border-bottom: 1px solid var(--line); padding: 11px 18px; color: var(--navy); background: #fbfdfd; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.04em; }
.protocol-line i { width: 22px; height: 1px; background: var(--sky); }
.messages { overflow-y: auto; padding: 30px 30px 24px; scroll-behavior: smooth; }
.message-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px; }
.message-row.user-row { justify-content: flex-end; }
.avatar { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 50%; color: white; background: linear-gradient(145deg, var(--navy), var(--aqua)); font-family: Georgia, "Times New Roman", serif; font-weight: 700; }
.speaker { margin: 0 0 5px; color: var(--muted); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.03em; }
.message { max-width: min(650px, 82vw); border-radius: 18px; padding: 13px 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.58; }
.message.assistant { border: 1px solid var(--line); border-top-left-radius: 5px; background: #f8fbfb; }
.message.user { border-bottom-right-radius: 5px; color: white; background: var(--navy); }
.message.safety, .message.error { border-color: #e3b6b9; color: #71343a; background: #fff5f5; }
.message.thinking { color: var(--muted); font-style: italic; }
.starter-area { max-width: 680px; margin: 8px 0 0 44px; }
.starter-area > p { margin: 0 0 10px; color: var(--muted); font-size: 0.78rem; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; }
.starter { border: 1px solid #b8d7df; border-radius: 999px; padding: 9px 12px; color: var(--navy); background: white; font-size: 0.78rem; text-align: left; }
.starter:hover, .starter:focus-visible { border-color: var(--aqua); background: var(--aqua-soft); }
.composer { border-top: 1px solid var(--line); padding: 16px 24px 10px; background: white; }
.composer-box { display: flex; align-items: flex-end; gap: 10px; border: 1px solid #a9c0c6; border-radius: 20px; padding: 8px 8px 8px 15px; background: white; box-shadow: 0 4px 18px rgba(0, 60, 79, 0.07); }
.composer-box:focus-within { border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(0, 168, 197, 0.12); }
textarea { width: 100%; min-height: 40px; max-height: 150px; resize: none; border: 0; padding: 10px 0 7px; color: var(--ink); background: transparent; line-height: 1.42; outline: none; }
textarea::placeholder { color: #87979c; }
#send-button { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border: 0; border-radius: 50%; color: white; background: var(--aqua); font-size: 1.35rem; font-weight: 800; }
#send-button:hover, #send-button:focus-visible { background: var(--navy); }
#send-button:disabled { cursor: wait; opacity: 0.55; }
.composer-meta { display: flex; justify-content: space-between; gap: 14px; padding: 8px 3px 0; color: var(--muted); font-size: 0.7rem; }
footer { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid #edf2f3; padding: 10px 24px 14px; color: #74858a; background: #fbfdfd; font-size: 0.66rem; line-height: 1.4; }
footer p { max-width: 48%; margin: 0; }

@media (max-width: 650px) {
  body { background: white; }
  .app-shell { display: block; padding: 0; }
  .chat-card { width: 100%; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .chat-header { padding: max(14px, env(safe-area-inset-top)) 15px 14px; }
  .logo-wrap { width: 44px; height: 44px; flex-basis: 44px; }
  .company { font-size: 0.57rem; }
  h1 { font-size: 1.15rem; }
  .restart { padding: 7px 9px; font-size: 0.7rem; }
  .protocol-line { gap: 7px; font-size: 0.66rem; }
  .protocol-line i { width: 13px; }
  .messages { padding: 22px 14px 18px; }
  .message { max-width: calc(100vw - 78px); }
  .starter-area { margin-left: 44px; }
  .starters { flex-direction: column; align-items: flex-start; }
  .starter { border-radius: 15px; }
  .composer { position: sticky; bottom: 0; z-index: 2; padding: 10px 10px max(10px, env(safe-area-inset-bottom)); }
  .composer-meta { padding-inline: 5px; }
  #character-count { display: none; }
  footer { display: block; padding: 9px 14px 12px; }
  footer p { max-width: none; }
  footer p + p { margin-top: 4px; }
}

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