/* Route 66 Copilot, part 2: answers (the answer is the hero), markdown, composer island, login, motion. */

/* ---------- Messages ---------- */
.msg { margin: 0 0 22px; }
.msg-user { display: flex; justify-content: flex-end; animation: rise .5s var(--ease) both; }
.bubble-user {
  max-width: 86%; padding: 12px 18px; border-radius: 22px 22px 6px 22px; background: var(--sand);
  border: 1px solid var(--hair); font-size: 1.06rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-ai { animation: rise .55s var(--ease) both; }
/* Double bezel: sand shell around a paper core */
.bezel { background: var(--shell); border: 1px solid var(--hair); border-radius: var(--r-shell); padding: 7px; box-shadow: var(--shadow-warm); }
.bezel-core { background: var(--paper); border-radius: var(--r-core); padding: 18px 20px; box-shadow: var(--inner-hl), 0 0 0 1px rgba(110, 82, 52, 0.08); min-width: 0; }
.msg-ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.msg-ai-head img { border-radius: 50%; }
.status-chip {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 14px; border-radius: var(--r-pill);
  background: var(--cream); border: 1px solid var(--hair); font-size: 0.95rem; color: var(--ink-2);
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rust); flex-shrink: 0; animation: pulse 1.6s var(--ease) infinite; }
.skeleton { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; }
.sk-line {
  display: block; height: 18px; border-radius: 9px; width: 100%;
  background: linear-gradient(90deg, var(--sand) 0%, #ECECE9 40%, var(--sand) 80%); background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}
.side-sk { padding: 12px 8px; }
.error-box, .inline-error {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--error-bg); color: var(--error-ink);
  border: 1.5px solid var(--error-ink); border-radius: 16px; padding: 12px 14px; font-size: 1rem; font-weight: 600; margin-top: 8px;
}
.error-box .btn { margin-left: auto; }
.sources { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 0.9rem; color: var(--ink-2); display: flex; gap: 8px; align-items: flex-start; }
.sources strong { color: var(--ink); }
.sources + .sources-web { margin-top: 6px; padding-top: 0; border-top: 0; }
.sources-web a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.sources-web .web-host { color: var(--ink-2); }
.answer-tools { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.95rem; }
.feedback .btn { min-width: 92px; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.feedback-form { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin-top: 4px; }
.feedback-form input { flex: 1; min-width: 180px; min-height: 48px; font-size: 1rem; padding: 8px 14px; border: 1.5px solid var(--line-strong); border-radius: 14px; background: #fff; }
.thanks { color: var(--ink-2); font-size: 0.95rem; }
.page-title { font-family: var(--head); font-weight: 800; font-size: 2.2rem; line-height: 1; letter-spacing: -0.01em; margin: 8px 0 18px; }

/* ---------- Markdown ---------- */
.md { font-size: 1.06rem; line-height: 1.62; color: var(--ink); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 14px; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--head); font-weight: 800; line-height: 1.1; margin: 22px 0 10px; letter-spacing: -0.005em; }
.md h1 { font-size: 1.7rem; } .md h2 { font-size: 1.5rem; } .md h3 { font-size: 1.35rem; } .md h4 { font-size: 1.2rem; }
.md ul, .md ol { margin: 0 0 14px; padding-left: 26px; }
.md li { margin: 0 0 8px; } .md li::marker { color: var(--rust-ink); }
.md a { color: var(--rust-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.md blockquote { margin: 14px 0; padding: 10px 16px; border-left: 3px solid var(--yellow); background: var(--cream); border-radius: 0 12px 12px 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.md code { font-size: 0.9em; background: var(--sand); padding: 2px 5px; border-radius: 4px; }
.md pre { background: var(--sand); padding: 12px; border-radius: 12px; overflow-x: auto; }
.md table { display: block; overflow-x: auto; border-collapse: collapse; margin: 14px 0; font-size: 1rem; font-variant-numeric: tabular-nums; }
.md th, .md td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.md th { background: var(--sand); }
.md a.map-btn {
  display: flex; width: max-content; max-width: 100%; align-items: center; gap: 8px; min-height: 48px; padding: 10px 18px; margin: 8px 0;
  border-radius: var(--r-pill); border: 1.5px solid var(--line-strong); background: var(--cream); color: var(--ink); font-weight: 700; text-decoration: none;
}

/* ---------- Composer island ---------- */
.composer { flex-shrink: 0; padding: 8px 16px 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, rgba(255,255,255,0) 0%, var(--cream) 40%); }
.island {
  max-width: 820px; margin: 0 auto; display: flex; gap: 6px; align-items: flex-end; padding: 6px;
  background: var(--paper); border: 1px solid var(--hair); border-radius: 30px; box-shadow: var(--inner-hl), var(--shadow-float);
}
.island textarea {
  flex: 1; min-width: 0; resize: none; font-size: 1.06rem; line-height: 1.5; padding: 12px 14px 12px 16px; min-height: 56px;
  border: 0; border-radius: 24px; background: transparent; color: var(--ink);
}
.island textarea:focus-visible { outline: 3px solid var(--ink); outline-offset: 0; }
.island textarea::placeholder { color: #66686F; }
.mic {
  min-width: 56px; min-height: 56px; border-radius: var(--r-pill); border: 0; background: var(--sand); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; font-weight: 700;
}
.mic-on { background: var(--ink); color: var(--paper); }
.send {
  min-height: 56px; border: 0; border-radius: var(--r-pill); background: var(--yellow); color: var(--ink); font-weight: 700; font-size: 1.06rem;
  display: inline-flex; align-items: center; gap: 10px; padding: 0 8px 0 20px; box-shadow: none;
  transition: background-color .25s var(--ease), transform .25s var(--ease);
}
.send-ico { width: 40px; height: 40px; border-radius: 50%; background: rgba(22,23,26,.10); display: flex; align-items: center; justify-content: center; transition: transform .4s var(--ease); }
.send:hover:not(:disabled) { background: var(--yellow-press); }
.send:hover:not(:disabled) .send-ico { transform: translateX(3px); }
.send:active:not(:disabled) { transform: scale(.98); }
.send:disabled { background: var(--shell); color: var(--ink); cursor: not-allowed; }

/* ---------- Login ---------- */
.login { height: 100%; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; }
.login-card { width: 100%; max-width: 480px; background: var(--paper); border: 1px solid var(--hair); border-radius: var(--r-shell); padding: 28px 22px; box-shadow: var(--inner-hl), var(--shadow-float); }
.login-card img { border-radius: 50%; }
.login-card h1 { font-family: var(--head); font-weight: 800; font-size: 2.2rem; line-height: 1; letter-spacing: -0.01em; margin: 14px 0 10px; }
.login-card p { font-size: 1.06rem; margin: 0 0 20px; }
.field-label { display: block; font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.field { width: 100%; min-height: 60px; font-size: 1.1rem; padding: 10px 16px; border: 1.5px solid var(--line-strong); border-radius: 16px; background: #fff; margin-bottom: 16px; }
.field-code { font-size: 1.65rem; letter-spacing: 0.35em; text-align: center; font-weight: 700; }
.field[aria-invalid="true"] { border-color: var(--error-ink); }
.login-card .btn { min-height: 56px; font-size: 1.1rem; }
.link-btn { background: none; border: 0; padding: 12px 0; min-height: 48px; font-size: 1rem; text-decoration: underline; color: var(--ink); font-weight: 600; }

/* ---------- Motion (gentle, transform/opacity only) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  .bezel-core { padding: 16px; }
  .brand-long { display: none; }
}
@media (max-width: 560px) {
  .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mic-label { display: none; }
  .mic { padding: 0; }
  .send { padding-left: 16px; }
  .btn-drive > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .btn-drive { min-width: 48px; padding: 8px; }
}
@media (max-width: 460px) {
  .btn-bar span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .btn-bar { min-width: 48px; padding: 8px; }
}

/* ---------- Answers, light look (20/11): no card around the answer, the question as a small grey heading,
   the first paragraph of the answer large ("the answer is the hero") ---------- */
.msg-user { display: block; }
.msg-user:not(:first-child) { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 10px; }
.ask-q { margin: 0; font-size: 1.05rem; font-weight: 600; line-height: 1.45; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-q-label { display: block; font-size: 0.85rem; font-weight: 700; color: var(--ink-2); margin-bottom: 2px; }
.bezel { background: none; border: 0; padding: 0; box-shadow: none; border-radius: 0; }
.bezel-core { background: none; padding: 0; box-shadow: none; border-radius: 0; }
.md-answer > p:first-child { font-family: var(--head); font-size: 1.45rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; margin-bottom: 16px; }
.md h1, .md h2, .md h3, .md h4 { font-weight: 700; letter-spacing: -0.01em; }
.btn-listen { background: var(--sand); border-color: var(--sand); }
.answer-tools { padding-top: 14px; border-top: 1px solid var(--line); }
@media (max-width: 767px) { .bezel-core { padding: 0; } }
