:root {
  --paper: #f3efe5;
  --paper-deep: #e8e0d0;
  --ink: #24241f;
  --muted: #79776d;
  --line: rgba(36, 36, 31, 0.18);
  --coral: #d85f3f;
  --coral-dark: #b7452b;
  --white: #fffdf8;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--paper); }
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(36, 36, 31, 0.065) 0.7px, transparent 0.7px);
  background-size: 7px 7px;
  content: "";
  opacity: 0.35;
  pointer-events: none;
}

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 4vw, 58px);
  background: rgba(243, 239, 229, 0.82);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 10px; color: inherit; font: 600 20px/1 "Manrope", sans-serif; letter-spacing: -0.04em; text-decoration: none; }
.brand-mark { width: 19px; height: 19px; border: 5px solid var(--coral); border-right-color: transparent; border-radius: 50%; transform: rotate(-25deg); }
.model-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font: 500 10px/1 "DM Mono", monospace; letter-spacing: 0.08em; text-transform: uppercase; }
.model-label i { width: 7px; height: 7px; border-radius: 50%; background: #5b8c63; box-shadow: 0 0 0 4px rgba(91, 140, 99, 0.13); }

main { min-height: 100vh; min-height: 100dvh; }
.welcome { width: min(820px, calc(100% - 36px)); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: auto; padding: 110px 0 70px; text-align: center; }
.eyebrow { margin: 0 0 20px; color: var(--coral-dark); font: 500 11px/1 "DM Mono", monospace; letter-spacing: 0.13em; text-transform: uppercase; }
h1 { margin: 0; font: 500 clamp(52px, 8vw, 92px)/0.88 "Newsreader", serif; letter-spacing: -0.055em; }
h1 em { color: var(--coral); font-weight: 400; }
.intro { max-width: 490px; margin: 26px auto 38px; color: var(--muted); font-size: 15px; line-height: 1.7; }

.composer { position: relative; width: 100%; }
.composer textarea { width: 100%; display: block; resize: none; overflow-y: hidden; border: 1px solid var(--line); background: rgba(255, 253, 248, 0.86); color: var(--ink); outline: none; transition: border-color 150ms ease, box-shadow 150ms ease; }
.composer textarea::placeholder { color: #999489; }
.composer textarea:focus { border-color: var(--coral); box-shadow: 0 0 0 4px rgba(216, 95, 63, 0.1), 0 16px 42px rgba(60, 48, 34, 0.08); }
.composer-large textarea { min-height: 76px; max-height: 190px; padding: 25px 82px 22px 28px; border-radius: 9px; font-size: 16px; box-shadow: 0 16px 42px rgba(60, 48, 34, 0.08); }
.send { position: absolute; right: 12px; bottom: 12px; width: 52px; height: 52px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: var(--coral); color: white; cursor: pointer; transition: background 140ms ease, transform 140ms ease; }
.send:hover { background: var(--coral-dark); }
.send:active { transform: scale(0.96); }
.send:disabled { opacity: 0.5; cursor: wait; }
.send svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hint { width: 100%; display: flex; justify-content: space-between; margin: 10px 2px 0; color: #999489; font: 400 10px/1.4 "DM Mono", monospace; }

.chat { min-height: 100vh; min-height: 100dvh; padding: 94px max(20px, calc((100% - 820px) / 2)) 150px; }
.chat-topbar { display: flex; align-items: center; justify-content: space-between; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.back { display: flex; align-items: center; gap: 6px; padding: 8px 0; border: 0; background: transparent; color: var(--ink); font-size: 13px; cursor: pointer; }
.back svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.chat-status { color: var(--muted); font: 400 10px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: 0.08em; }
.messages { display: flex; flex-direction: column; gap: 34px; padding: 42px 0; }
.message { animation: reveal 260ms ease both; }
.message.user { align-self: flex-end; max-width: 72%; padding: 13px 17px; border-radius: 14px 14px 3px 14px; background: var(--ink); color: var(--white); font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.message.assistant { max-width: 100%; padding-right: 8%; font-family: "Newsreader", serif; font-size: 20px; line-height: 1.65; white-space: pre-wrap; }
.message.assistant::before { display: block; margin-bottom: 10px; color: var(--coral); font: 500 10px/1 "DM Mono", monospace; letter-spacing: 0.1em; content: "ARC / INTUITIZE 6"; }
.message.loading { color: var(--muted); }
.message.loading span { display: inline-block; animation: pulse 1s ease-in-out infinite alternate; }
.message.error { color: #9e3425; }
.message.auth-required { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; color: var(--muted); }
.oauth-button { padding: 12px 16px; border: 0; border-radius: 5px; background: var(--ink); color: var(--white); font: 500 12px/1 "Manrope", sans-serif; cursor: pointer; transition: background 140ms ease, transform 140ms ease; }
.oauth-button:hover { background: var(--coral-dark); }
.oauth-button:active { transform: scale(0.98); }
.oauth-button:disabled { opacity: 0.55; cursor: wait; }

.chat-footer { position: fixed; inset: auto 0 0; z-index: 5; padding: 22px max(20px, calc((100% - 820px) / 2)) 15px; background: linear-gradient(transparent, var(--paper) 22px, var(--paper)); }
.composer-small textarea { min-height: 60px; max-height: 150px; padding: 19px 70px 17px 20px; border-radius: 8px; }
.composer-small .send { right: 8px; bottom: 8px; width: 44px; height: 44px; }
.disclaimer { margin: 8px 0 0; color: var(--muted); font: 400 9px/1.4 "DM Mono", monospace; text-align: center; }

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

@media (max-width: 600px) {
  .site-header { height: 64px; padding: 0 18px; }
  .welcome { justify-content: center; padding-top: 90px; }
  h1 { font-size: clamp(47px, 15vw, 66px); }
  .intro { margin: 22px auto 30px; font-size: 14px; }
  .hint span { display: none; }
  .chat { padding-top: 78px; }
  .message.user { max-width: 88%; }
  .message.assistant { padding-right: 0; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
