:root {
  color-scheme: light;
  --pine: #182f26;
  --pine-soft: #29483b;
  --mint: #d9e6d5;
  --ink: #1c2a22;
  --muted: #58645a;
  --paper: #f5f4ec;
  --card: #fffdf7;
  --line: #d7dbcc;
  --coral: #b8482f;
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; display: grid; grid-template-columns: 17rem minmax(0, 1fr); min-height: 100dvh; background: var(--paper); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
:focus-visible { outline: 3px solid #ae6d42; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sidebar { height: 100dvh; position: sticky; top: 0; display: flex; flex-direction: column; padding: 1.65rem 1.15rem 1rem; background: var(--pine); color: #fbf9ed; min-height: 0; }
.library-backdrop { display: none; }
.brand { display: flex; gap: 0.8rem; align-items: center; padding: 0 0.4rem 1.5rem; font: 600 1.4rem/1.03 Georgia, serif; letter-spacing: -0.025em; }
.brand-mark { position: relative; width: 2.2rem; height: 2.2rem; border-radius: 0.44rem; margin-right: 0.15rem; background: #e7ad75; transform: rotate(-10deg); flex: none; }
.brand-mark i { position: absolute; width: 0.3rem; height: 0.3rem; border-radius: 100%; background: var(--pine); left: 50%; top: 50%; transform: translate(-50%, -50%); }
.brand-mark i:first-child { left: 27%; top: 28%; }
.brand-mark i:last-child { left: 73%; top: 72%; }
.new-chat { padding: 0.65rem 0.9rem; border: 1px solid #738c78; background: transparent; border-radius: 0.55rem; color: #fffdf5; text-align: left; }
.new-chat:hover { background: var(--pine-soft); }
.new-chat span { margin-right: 0.45rem; font-size: 1.15rem; }
.library-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 1.6rem 0.25rem 0.5rem; }
.library-heading h2 { font-size: 0.86rem; font-weight: 650; margin: 0; color: #dbe8d8; }
.library-heading span { color: #c9d8c5; font-size: 0.82rem; }
.search-label { position: absolute; clip-path: inset(50%); }
#filter { background: #213b30; border: 1px solid #6a8170; color: #fffdf5; width: 100%; min-height: 2.55rem; padding: 0.4rem 0.7rem; border-radius: 0.45rem; }
#filter::placeholder { color: #c2d1bf; }
.game-list { flex: 1; min-height: 0; overflow: auto; padding: 0.38rem 0; margin: 0.4rem 0; list-style: none; scrollbar-color: #6a8170 transparent; }
.game-list button { font-size: 0.87rem; color: inherit; background: transparent; border: 0; border-radius: 0.35rem; width: 100%; padding: 0.43rem 0.6rem; text-align: left; }
.game-list button:hover, .game-list button:focus-visible { background: var(--pine-soft); }
.library-note { margin: 0.4rem; font-size: 0.85rem; color: #dbe8d8; }
.library-note:empty { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }
.topbar { display: none; }
.conversation { flex: 1; width: min(100%, 54rem); min-height: 0; align-self: center; display: flex; flex-direction: column; padding: 2.3rem 2rem 1.25rem; }
.welcome { margin: auto 0; padding: clamp(1rem, 4vh, 3.5rem) 0; }
.table-mark { position: relative; width: 4.6rem; height: 3.9rem; margin: 0 0 1rem; }
.table-mark i { position: absolute; display: block; width: 2.6rem; height: 2.6rem; border: 1px solid #4a614f; border-radius: 0.45rem; left: 0.35rem; top: 0.8rem; background: #bdd2b6; transform: rotate(-14deg); }
.table-mark i:nth-child(2) { left: 1.3rem; top: 0.62rem; background: #f3d39a; transform: rotate(2deg); }
.table-mark i:nth-child(3) { left: 1.75rem; top: 0.24rem; background: #e9ab87; transform: rotate(15deg); }
.table-mark i:nth-child(3)::after { content: ""; position: absolute; width: 0.25rem; height: 0.25rem; top: 48%; left: 46%; background: #52382e; border-radius: 100%; box-shadow: -0.55rem -0.55rem #52382e, 0.55rem 0.55rem #52382e; }
h1 { font: 500 clamp(2.65rem, 6vw, 5rem)/0.98 Georgia, "Times New Roman", serif; letter-spacing: -0.062em; margin: 0; }
.welcome > p { color: var(--muted); max-width: 33rem; margin: 1.15rem 0 1.65rem; font-size: 1.04rem; }
.starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.starters button { text-align: left; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 0.65rem; padding: 0.85rem 0.9rem; min-height: 4.3rem; }
.starters button:hover { border-color: #809480; background: #ecf2e8; }
.starters strong, .starters span { display: block; }
.starters strong { font-size: 0.85rem; }
.starters span { color: var(--muted); font-size: 0.86rem; margin-top: 0.12rem; }
.messages { display: grid; gap: 1.1rem; }
.messages:empty { display: none; }
.bubble { overflow-wrap: anywhere; }
.bubble.user { justify-self: end; max-width: min(87%, 39rem); background: var(--mint); border-radius: 0.9rem 0.9rem 0.2rem 0.9rem; padding: 0.7rem 1rem; }
.bubble.answer { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 0.85rem; padding: clamp(0.75rem, 2vw, 1.35rem); }
.bubble p { white-space: pre-wrap; margin: 0; }
.voice-label { display: block; font-size: 0.78rem; font-weight: 750; color: var(--muted); margin-bottom: 0.2rem; }
.sources { padding: 0.8rem 0 0; margin: 0.85rem 0 0; border-top: 1px solid var(--line); }
.sources ul { display: grid; margin: 0.2rem 0 0; padding-left: 1.15rem; gap: 0.26rem; }
.sources a { color: #225744; font-size: 0.86rem; text-underline-offset: 0.16em; }
.composer-region { position: sticky; bottom: 0; width: min(100%, 54rem); align-self: center; padding: 0.75rem 2rem max(0.65rem, env(safe-area-inset-bottom)); background: var(--paper); }
.status { color: #69392b; margin: 0 0 0.45rem; font-size: 0.875rem; }
.status[data-state="waiting"] { color: var(--muted); }
#composer { padding: 0.55rem; display: flex; align-items: end; gap: 0.55rem; border: 1px solid #a5af9e; border-radius: 0.8rem; background: var(--card); }
#question { display: block; width: 100%; flex: 1; min-width: 0; resize: vertical; max-height: 10rem; padding: 0.45rem 0.55rem; background: transparent; border: 0; color: var(--ink); }
#question:focus { outline-offset: -2px; }
#send { padding: 0.54rem 0.85rem; border: 0; border-radius: 0.47rem; background: var(--pine); color: #fffdf4; white-space: nowrap; }
.topbar button, #send { min-width: 2.75rem; min-height: 2.75rem; }
#send span { margin-left: 0.2rem; }
.composer-note { margin: 0.38rem 0 0; color: var(--muted); font-size: 0.72rem; text-align: center; }
@media (max-width: 830px) {
  body { --library-width: min(19rem, 84vw); display: block; }
  .sidebar { position: fixed; visibility: hidden; inset: 3.35rem auto 0 0; height: auto; width: var(--library-width); z-index: 3; box-shadow: 0.75rem 0 2rem #14282030; }
  .sidebar.open { visibility: visible; }
  .library-backdrop { display: block; position: fixed; inset: 3.35rem 0 0 var(--library-width); z-index: 2; background: #182f2633; }
  .topbar { display: flex; justify-content: space-between; align-items: center; position: sticky; z-index: 4; top: 0; height: 3.35rem; padding: 0 0.75rem; background: var(--pine); color: #fffdf4; }
  .topbar-title { font: 600 1.12rem Georgia, serif; }
  .topbar button { color: inherit; background: transparent; border: 1px solid #738c78; border-radius: 0.38rem; padding: 0.3rem 0.48rem; font-size: 0.75rem; }
  .conversation { padding: 1.25rem 1.1rem 0.65rem; }
  .composer-region { padding-inline: 1.1rem; }
}
@media (max-width: 370px) {
  .starters { grid-template-columns: 1fr; }
  .title-break { display: none; }
}
