:root {
  color-scheme: light;
  --ink: #18231d;
  --muted: #66736b;
  --paper: #f3f1ea;
  --panel: #fbfaf6;
  --line: #d9ded7;
  --accent: #1e6744;
  --accent-soft: #dcecdf;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 5%, rgba(255,255,255,.95), transparent 30rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button, textarea { font: inherit; }
button { cursor: pointer; }

.shell { height: 100vh; height: 100dvh; display: grid; grid-template-rows: 72px minmax(0, 1fr) auto; overflow: hidden; }
.topbar { height: auto; display: flex; align-items: center; justify-content: space-between; padding: 0 5vw; border-bottom: 1px solid rgba(24,35,29,.1); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 720; letter-spacing: -.02em; }
.brand-mark { position: relative; display: block; flex: 0 0 30px; width: 30px; height: 30px; overflow: hidden; border-radius: 5px; background: transparent; }
.brand-mark img { position: absolute; inset: 0 auto auto 0; display: block; width: 51px; max-width: none; height: 30px; mix-blend-mode: multiply; }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status, .account-button { display: none; }
.account-button { margin-left: 16px; padding: 7px 13px; border: 1px solid rgba(30,103,68,.28); border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 650; }
.account-button:hover { background: var(--accent); color: white; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #c38c45; box-shadow: 0 0 0 4px rgba(195,140,69,.12); }
.status-dot.ready { background: #3a9a69; box-shadow: 0 0 0 4px rgba(58,154,105,.12); }

.workspace { width: min(1120px, 94vw); margin: 0 auto; min-height: 0; overflow-y: scroll; overscroll-behavior: contain; padding: 9vh 16px 40px 0; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: rgba(30,103,68,.45) transparent; }
.workspace::-webkit-scrollbar { width: 8px; }
.workspace::-webkit-scrollbar-track { background: transparent; }
.workspace::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(30,103,68,.32); }
.workspace::-webkit-scrollbar-thumb:hover { background: rgba(30,103,68,.55); }
.intro { max-width: 720px; }
.intro[hidden] { display: none; }
.eyebrow { margin: 0 0 18px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 8vw, 82px); line-height: .98; letter-spacing: -.055em; font-weight: 500; }
h1 em { color: var(--accent); font-weight: 500; }
.lede { max-width: 570px; margin: 28px 0; color: var(--muted); font-size: 17px; line-height: 1.75; }
.suggestions { display: flex; flex-wrap: wrap; gap: 10px; }
.suggestions button, #new-chat { border: 1px solid var(--line); background: rgba(255,255,255,.55); color: var(--ink); border-radius: 999px; padding: 10px 15px; transition: .2s ease; }
.suggestions button:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

.chat { display: grid; gap: 34px; }
.message { display: grid; grid-template-columns: 105px 1fr; gap: 20px; animation: reveal .25s ease-out; }
.message-label { padding-top: 4px; color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.message-text { white-space: pre-wrap; font-size: 16px; line-height: 1.75; }
.message-text h2, .message-text h3, .message-text h4 { margin: 1em 0 .35em; line-height: 1.3; }
.message-text h2 { font-size: 1.35em; }
.message-text h3 { font-size: 1.15em; }
.message-text:has(.team-card) { display: block; }
.team-card { display: block; width: 100%; margin: 0 0 10px; min-width: 0; overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; }
.team-card h3 { margin: 0 0 8px; color: var(--accent); }
.message-text ul { margin: .4em 0; padding-left: 1.3em; }
.message-text table { width: max-content; min-width: 100%; margin: 0 0 4px; border: 1px solid var(--line); border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; font-size: 12px; line-height: 1.35; background: rgba(255,255,255,.45); }
.message-text th, .message-text td { padding: 6px 7px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.message-text th { color: var(--accent); font-weight: 750; background: var(--accent-soft); }
.message-text tr:last-child td { border-bottom: 0; }
.message-text h4 + table { margin-top: 8px; }
.message-meta { grid-column: 2; color: var(--accent); font-size: 11px; letter-spacing: .04em; }
.message-meta.local-data { color: #58708b; }
.message-meta.boxscore-data { color: #7d5f42; }
.message.user .message-text { font-family: Georgia, serif; font-size: 24px; line-height: 1.45; }
.message.assistant { padding-top: 30px; border-top: 1px solid var(--line); }
.message.pending { opacity: .55; }
.message.error .message-text { color: #a3443d; }
.auth-panel { position: fixed; inset: 72px 0 0; z-index: 5; display: grid; place-items: center; padding: 24px; background: rgba(243,241,234,.92); backdrop-filter: blur(8px); }
.auth-panel[hidden] { display: none; }
.auth-card { width: min(360px, 100%); display: grid; gap: 12px; padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 18px 60px rgba(32,48,39,.14); }
.auth-card h2 { margin: 0 0 8px; font-family: Georgia, serif; font-weight: 500; }
.auth-card input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); outline-color: var(--accent); }
.auth-submit { padding: 10px; border: 0; border-radius: 10px; background: var(--accent); color: white; font-weight: 700; }
.auth-hint { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
.auth-error { min-height: 18px; margin: 0; color: #a3443d; font-size: 12px; }

.composer-wrap { position: relative; padding: 14px 5vw 20px; border-top: 1px solid rgba(24,35,29,.08); background: var(--paper); }
.composer { width: min(1120px, 94vw); margin: 0 auto; display: flex; align-items: flex-end; gap: 12px; padding: 10px 10px 10px 20px; border: 1px solid rgba(24,35,29,.16); border-radius: 20px; background: var(--panel); box-shadow: 0 18px 60px rgba(32,48,39,.12); }
textarea { flex: 1; min-height: 44px; max-height: 160px; padding: 10px 0; border: 0; resize: none; outline: 0; background: transparent; color: var(--ink); line-height: 1.5; }
textarea::placeholder { color: #939b95; }
.send { order: 3; flex: 0 0 58px; width: 58px; height: 44px; border: 0; border-radius: 14px; background: var(--accent); color: white; font-size: 13px; transition: .2s ease; }
.send:hover { transform: translateY(-2px); background: #155837; }
.send:disabled { opacity: .45; cursor: wait; transform: none; }
.stop { order: 2; flex: 0 0 58px; width: 58px; height: 44px; border: 1px solid rgba(163,68,61,.35); border-radius: 14px; background: #fff8f6; color: #a3443d; font-size: 12px; transition: .2s ease; }
.stop:hover { background: #a3443d; color: white; }
.stop[hidden] { display: none; }
.footer-row { width: min(1120px, 94vw); margin: 9px auto 0; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }
.legal-note { width: min(1120px, 94vw); margin: 5px auto 0; color: var(--muted); font-size: 10px; line-height: 1.45; opacity: .82; }
#new-chat { padding: 7px 13px; border: 1px solid rgba(30,103,68,.28); border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 650; transition: .2s ease; }
#new-chat::before { content: "+"; display: inline-block; margin-right: 5px; font-size: 16px; font-weight: 500; line-height: 10px; vertical-align: -1px; }
#new-chat:hover { border-color: var(--accent); background: var(--accent); color: white; transform: translateY(-1px); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 620px) {
  .shell { grid-template-rows: 62px minmax(0, 1fr) auto; }
  .topbar { height: auto; }
  .workspace { padding-top: 7vh; padding-bottom: 32px; }
  .lede { font-size: 15px; }
  .message { grid-template-columns: 1fr; gap: 7px; }
  .message-meta { grid-column: 1; }
  .message.assistant { padding-top: 22px; }
  .message.user .message-text { font-size: 21px; }
  .team-card { display: block; width: 100%; margin: 0 0 10px; }
  .footer-row > span { max-width: 72%; }
}
