/* Les Gourdiflots — original illustrated identity, no external fonts or assets. */
* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --bg: #f7f0df; --paper: #fffcf2; --ink: #322e23; --muted: #675f4f;
  --line: #d9cdb5; --accent: #52643a; --accent-ink: #fffaf0;
  --wine: #873d42; --user: #e9e1c9; --highlight: #e8e8d2;
  --side: #2e3827; --side-ink: #f8efd9; --side-muted: #d3d0b8;
  --side-line: #56604a; --side-hover: #424e36;
  --shadow: 0 6px 24px #46391912; --card-shadow: 0 2px 7px #4639190c;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #171e25; --paper: #222c32; --ink: #f3ead9; --muted: #c0bcb1;
  --line: #424c4d; --accent: #9eb477; --accent-ink: #1c291d;
  --wine: #e1a3a2; --user: #303b38; --highlight: #303b38;
  --side: #202a26; --side-ink: #f8efd9; --side-muted: #d3d0b8;
  --side-line: #46534b; --side-hover: #354139;
  --shadow: 0 8px 24px #0003; --card-shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #171e25; --paper: #222c32; --ink: #f3ead9; --muted: #c0bcb1;
    --line: #424c4d; --accent: #9eb477; --accent-ink: #1c291d;
    --wine: #e1a3a2; --user: #303b38; --highlight: #303b38;
    --side: #202a26; --side-ink: #f8efd9; --side-muted: #d3d0b8;
    --side-line: #46534b; --side-hover: #354139;
    --shadow: 0 8px 24px #0003; --card-shadow: none;
  }
}
html { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--sans); height: 100vh; height: 100dvh;
  display: flex; overflow: hidden;
}
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: transparent; border-radius: 9px; padding: 8px 12px; }
button:hover { background: var(--highlight); }
button:disabled { opacity: .48; cursor: default; }
button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
a { color: inherit; }
aside {
  width: 270px; flex-shrink: 0; display: flex; flex-direction: column; gap: 20px;
  padding: 25px 18px 18px; background: var(--side); color: var(--side-ink);
  border-right: 1px solid var(--side-line); overflow: hidden;
}
aside button:focus-visible, aside a:focus-visible { outline-color: #e4d6a5; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand img { flex: none; border-radius: 13px; box-shadow: 0 2px 7px #0002; }
.wordmark { display: block; font: 700 25px/1 var(--serif); letter-spacing: -1.1px; white-space: nowrap; }
.wordmark > span { font: 400 14px var(--sans); letter-spacing: -.4px; color: #e1b991; }
.wordmark small { display: block; font: 700 8px/1.3 var(--sans); letter-spacing: .13em; color: var(--side-muted); margin-top: 6px; }
.new {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 650; background: #e9d9b6; color: #303824;
  border: 1px solid #e9d9b6; padding: 11px 12px; min-height: 44px;
  border-radius: 9px; text-align: center;
}
.new:hover { background: #f9e8c5; }
.plus { font-size: 18px; line-height: 1; }
.history-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 3px -12px; }
.label { font-size: 10px; font-weight: 750; letter-spacing: .10em; color: var(--side-muted); }
.history-ornament { color: #e1b991; font-size: 12px; }
nav { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow-y: auto; }
nav button {
  width: 100%; border: 1px solid transparent; border-radius: 7px; text-align: left;
  color: var(--side-ink); padding: 10px 9px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-size: 13px;
}
nav button:hover, nav button.active { background: var(--side-hover); }
nav button.active { border-color: var(--side-line); font-weight: 650; }
nav .empty-history { color: var(--side-muted); font-size: 12px; margin: 4px 8px; font-style: italic; }
.sidefoot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.subtle { display: flex; align-items: center; gap: 8px; border: 0; color: var(--side-muted); text-align: left; padding: 10px 7px; font-size: 13px; }
.subtle:hover { background: var(--side-hover); color: var(--side-ink); }
.side-icon { font-size: 17px; width: 22px; line-height: 1; text-align: center; }
.side-note { color: var(--side-muted); font-size: 10px; padding: 8px 7px 0; border-top: 1px solid var(--side-line); }
main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative;
  background-image: radial-gradient(ellipse at 50% -10%, #bcad7b15, transparent 60%);
}
.topbar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 66px; padding: 12px 30px; border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.model { display: flex; flex-direction: column; min-width: 0; }
.model-name { font: 700 19px/1.15 var(--serif); }
.model-sub { font-size: 10px; letter-spacing: .045em; color: var(--muted); margin-top: 3px; }
.tag { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; padding: 5px 10px; border: 1px solid var(--line); border-radius: 20px; }
.signal { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; }
.tag-dot { color: var(--wine); margin-left: 2px; }
.icon-button { border: 0; font-size: 22px; line-height: 1; min-width: 40px; min-height: 40px; padding: 5px; }
#menu, .close-menu, .scrim { display: none; }
#chat { overflow-y: auto; flex: 1; min-height: 0; padding: 18px 28px 16px; overscroll-behavior-y: contain; container-type: size; }
#welcome { max-width: 790px; margin: 0 auto; padding-bottom: 2px; }
.scene {
  position: relative; width: 100%; margin-inline: auto; overflow: hidden; border-radius: 14px;
  border: 1px solid #75654c88; background: #26323b; box-shadow: var(--shadow);
}
.scene-art { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 390; object-fit: contain; }
.scene-label, .scene-index {
  position: absolute; font-size: clamp(8px, 1.1vw, 10px); font-weight: 700;
  letter-spacing: .13em; color: #fff5df; text-shadow: 0 1px 4px #000;
}
.scene-label { bottom: 12px; left: 15px; }
.scene-index { top: 12px; right: 15px; }
.scene-index span { color: #f1cd85; padding: 0 3px; }
.welcome-copy { text-align: center; padding: 17px 6px 0; container-type: inline-size; }
.welcome-copy h1 {
  font: 700 clamp(14px, 3.8vw, 42px)/1.10 var(--serif);
  font-size: clamp(13px, 5.1cqi, 42px);
  letter-spacing: -.045em; margin: 0;
  text-wrap: initial;
}
.welcome-copy h1 > span { display: block; white-space: nowrap; }
@container (max-width: 230px) {
  .welcome-copy h1 > span { white-space: normal; }
}
.suggestion-heading { margin: 17px 0 7px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .14em; }
.suggestion-heading::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.suggestion-heading span:last-child { color: var(--wine); }
#suggestions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.suggestion {
  display: flex; align-items: center; gap: 9px; padding: 10px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; min-width: 0; min-height: 78px; text-align: left; box-shadow: var(--card-shadow);
}
.suggestion:hover { border-color: var(--accent); background: var(--highlight); }
.suggestion-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.suggestion-icon svg { width: 26px; height: 26px; }
.oxo { background: #dfe6df; color: #3c615e; }
.bombé { background: #e8e8d0; color: #52643a; }
.francine { background: #efded9; color: #873d42; }
.suggestion-text { min-width: 0; flex: 1; }
.suggestion-text strong { display: block; font: 700 14px/1.18 var(--serif); margin: 2px 0 4px; }
.suggestion-text small { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; }
.suggestion-arrow { flex: none; color: var(--muted); font-size: 13px; line-height: 1; }
#messages { max-width: 790px; margin: 0 auto; display: flex; flex-direction: column; gap: 27px; }
.message { min-width: 0; }
.message.user { align-self: flex-end; max-width: 86%; padding: 13px 18px; border: 1px solid var(--line); border-radius: 14px 14px 3px 14px; background: var(--user); }
.message.assistant { display: flex; align-items: flex-start; gap: 13px; }
.avatar { width: 39px; height: 39px; border-radius: 11px; flex-shrink: 0; margin-top: 1px; }
.message-content { min-width: 0; flex: 1; }
.message-author { font: 700 15px/1.2 var(--serif); color: var(--accent); margin: 1px 0 7px; }
.message-body { font-size: 15px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-body p { margin: 0 0 13px; }
.message-body p:last-child { margin-bottom: 0; }
.message-body pre { background: var(--paper); border: 1px solid var(--line); padding: 13px; border-radius: 8px; overflow: auto; white-space: pre; }
.message-body code { font-size: 13px; }
.message-body h2, .message-body h3 { font-size: 17px; margin: 12px 0 5px; }
.copy { display: block; font-size: 11px; color: var(--muted); margin-top: 8px; border: 0; padding: 5px 7px; }
.thinking { color: var(--muted); font-style: italic; }
footer { flex: none; padding: 7px 28px max(10px, env(safe-area-inset-bottom)); }
#composer {
  width: 100%; max-width: 790px; margin: 0 auto; background: var(--paper);
  border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 15px;
  display: flex; flex-direction: column; padding: 10px 13px 9px; gap: 5px;
}
#composer:focus-within { border-color: var(--accent); }
textarea { display: block; width: 100%; min-height: 42px; max-height: 180px; resize: vertical; border: 0; outline: 0 !important; padding: 2px 5px; background: transparent; line-height: 1.4; }
textarea::placeholder { color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.controls small { flex: 1 1 120px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.controls small:empty { flex-basis: 0; }
.controls button { font-size: 12px; }
#send {
  display: flex; align-items: center; gap: 12px; background: var(--accent); color: var(--accent-ink);
  border: 1px solid transparent; border-radius: 9px; padding: 8px 12px; min-height: 38px;
  font-weight: 700; font-size: 13px;
}
#send:hover { filter: brightness(1.08); }
.send-arrow { font-size: 19px; line-height: 1; }
.disclaimer { font-size: 10.5px; color: var(--muted); text-align: center; margin: 9px 0 0; }
.textlink { padding: 0; border: 0; text-decoration: underline; text-underline-offset: 2px; font: inherit; color: inherit; }
dialog { width: min(490px, 92vw); max-height: 85dvh; overflow: auto; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 25px; box-shadow: var(--shadow); }
dialog::backdrop { background: #172019ad; }
.dialog-heading { display: flex; align-items: center; gap: 13px; }
dialog h2 { font: 700 24px/1.15 var(--serif); margin: 0; }
dialog p { color: var(--muted); }
dialog .new { width: 100%; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Adapt the full (uncropped) illustration to the actual scroll pane height,
   reserving room for the two-line heading and the suggestions. */
@media (min-width: 701px) {
  .scene { max-width: min(100%, max(240px, calc((100cqh - 225px) * 2.5641))); }
}
@media (min-width: 701px) and (max-height: 820px) {
  #chat { padding-top: 13px; padding-bottom: 12px; }
  .welcome-copy { padding-top: 13px; }
  .welcome-copy h1 { font-size: clamp(13px, 4.8cqi, 38px); }
  .suggestion-heading { margin-top: 14px; }
  .suggestion { min-height: 72px; }
}
@media (min-width: 701px) and (max-height: 650px) {
  .welcome-copy { padding-top: 9px; }
  .welcome-copy h1 { font-size: clamp(13px, 4.3cqi, 32px); }
  .suggestion-heading { margin-top: 9px; }
  .suggestion { min-height: 65px; padding-block: 7px; }
}
@media (max-width: 1000px) and (min-width: 701px) {
  aside { width: 235px; padding-left: 13px; padding-right: 13px; }
  .topbar { padding-inline: 20px; }
  #chat, footer { padding-inline: 20px; }
  .suggestion { flex-wrap: wrap; }
  .suggestion-text { flex-basis: calc(100% - 46px); }
  .suggestion-arrow { display: none; }
}
@media (max-width: 700px) {
  aside { display: none; position: fixed; z-index: 5; inset: 0 auto 0 0; width: min(310px, 86vw); padding-top: max(22px, env(safe-area-inset-top)); box-shadow: 12px 0 40px #0005; }
  aside.open { display: flex; }
  .close-menu { display: block; color: var(--side-ink); }
  .close-menu:hover { background: var(--side-hover); }
  .scrim:not([hidden]) { display: block; position: fixed; z-index: 4; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: #141c1eb0; }
  #menu { display: block; }
  .topbar { min-height: 57px; padding: 8px 12px; }
  .topbar-left { gap: 4px; }
  .model-name { font-size: 17px; }
  .model-sub { font-size: 9px; }
  .tag { font-size: 10px; gap: 5px; padding: 5px 7px; }
  .tag-dot { display: none; }
  #chat { padding: 14px 12px 20px; }
  .scene { border-radius: 11px; }
  .scene-label { bottom: 9px; left: 9px; }
  .scene-index { top: 9px; right: 9px; }
  .welcome-copy { padding-top: 12px; }
  .suggestion-heading { margin-top: 14px; }
  #suggestions { grid-template-columns: 1fr; gap: 6px; }
  .suggestion { align-items: center; padding: 9px 11px; min-height: 53px; }
  .suggestion-text strong { margin: 0 0 2px; font-size: 14px; }
  .suggestion-text small { font-size: 11px; }
  #messages { gap: 21px; }
  .message.assistant { gap: 9px; }
  .avatar { width: 32px; height: 32px; border-radius: 8px; }
  .message-body { font-size: 14px; }
  .message.user { max-width: 91%; padding: 10px 13px; }
  footer { padding: 7px 12px max(9px, env(safe-area-inset-bottom)); }
  #composer { padding: 10px; }
  textarea { font-size: 16px; }
  .disclaimer { font-size: 10px; }
}
@media (max-width: 340px) { .tag { display: none; } }
@media (max-height: 560px) { aside { gap: 12px; } }
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color .14s, border-color .14s, color .14s; }
}
