/* Stack Master — parchment/ink theme with chat + card panel. */

@font-face {
  font-family: 'Phyrexian';
  src: url('/static/fonts/phyrexian.otf') format('opentype');
}

:root {
  --parchment-primary:   #FFFAF5;
  --parchment-secondary: #FFF6ED;
  --parchment-tertiary:  #F5EFE4;
  --ink-primary:         #2C3E50;
  --ink-secondary:       #34495E;
  --ink-muted:           rgba(44, 62, 80, 0.55);
  --message-assistant:       #3498DB;
  --message-assistant-hover: #2980B9;
  --assistant-text:          #F7FBFE;
  --accent-shadow: rgba(44, 62, 80, 0.1);
  --border-light:  #DEE2E6;
  --border-strong: #CBD2D9;
  --success: #27AE60;
  --error:   #E74C3C;

  --transition: all 0.2s ease;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-lift: 0 6px 18px rgba(44, 62, 80, 0.12);
  --radius: 8px;
  --sidebar-width: 260px;
  --header-height: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--parchment-primary);
  color: var(--ink-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

kbd {
  font-family: 'SF Mono', ui-monospace, 'Menlo', monospace;
  font-size: 0.75em;
  background: var(--parchment-tertiary);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 5px;
}

/* =============================================================== sidebar */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--parchment-secondary);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 20;
  transform: translateX(0);
  transition: transform 0.22s ease;
}

body[data-sidebar="closed"] .sidebar { transform: translateX(-100%); }

.sidebar-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.new-chat {
  flex: 1;
  padding: 10px 14px;
  background: var(--ink-primary);
  color: var(--parchment-primary);
  border: none;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-width: 0;
}
.new-chat:hover { background: var(--ink-secondary); }

#collapse-sidebar { flex-shrink: 0; }

.chat-list { list-style: none; padding: 8px; margin: 0; overflow-y: auto; flex: 1; }

.chat-list li {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink-secondary);
  line-height: 1.35;
  transition: background 0.12s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}
.chat-list li:hover { background: var(--parchment-tertiary); }
.chat-list li.active { background: var(--parchment-tertiary); color: var(--ink-primary); font-weight: 500; }
.chat-list .empty { font-style: italic; color: var(--ink-muted); cursor: default; }
.chat-list .empty:hover { background: transparent; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 80, 0.35);
  z-index: 15;
}

/* =============================================================== card panel */

/* Close button inside the card panel is always clickable. */

/* =============================================================== app shell */

.app {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--parchment-primary);
  transition: left 0.22s ease, right 0.22s ease;
}

body[data-sidebar="open"]       .app { left: var(--sidebar-width); }
/* =============================================================== header */

header {
  flex-shrink: 0;
  height: var(--header-height);
  background: linear-gradient(to bottom, #fff, var(--parchment-primary));
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
}

.icon-button {
  background: transparent;
  border: none;
  color: var(--ink-primary);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-button:hover { background: var(--parchment-tertiary); }

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-logo { height: 32px; width: auto; flex-shrink: 0; }

header h1 {
  font-family: 'Cinzel', 'Inter', serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 0;
  white-space: nowrap;
}

.tagline {
  color: var(--ink-secondary);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.patreon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 6px 10px;
  border-radius: 6px;
  transition: var(--transition);
}
.patreon-link:hover { background: var(--parchment-tertiary); color: var(--ink-primary); }

/* =============================================================== about dropdown */

.about { position: relative; }

.about-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 300px;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-lift);
  z-index: 40;
  font-size: 0.9rem;
  color: var(--ink-primary);
}

.about-dropdown[hidden] { display: none; }

.about-dropdown a {
  display: block;
  padding: 7px 10px;
  color: var(--ink-primary);
  text-decoration: none;
  border-radius: 5px;
}
.about-dropdown a:hover { background: var(--parchment-secondary); }

.bug-report {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bug-report label {
  font-size: 0.8rem;
  color: var(--ink-secondary);
  font-weight: 500;
}
.bug-report textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  max-height: 160px;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.45;
  padding: 6px 8px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--parchment-secondary);
  color: var(--ink-primary);
  box-sizing: border-box;
}
.bug-report textarea:focus {
  outline: none;
  border-color: var(--ink-primary);
  box-shadow: 0 2px 10px var(--accent-shadow);
}
.bug-report-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bug-report-status {
  font-size: 0.75rem;
  color: var(--ink-muted);
}
.bug-report-status.error { color: var(--error); }
.bug-report-status.success { color: var(--success); }
#bug-report-submit {
  background: var(--ink-primary);
  color: var(--parchment-primary);
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
#bug-report-submit:hover:not(:disabled) { background: var(--ink-secondary); }
#bug-report-submit:disabled { opacity: 0.55; cursor: wait; }

.about-dropdown hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 6px 4px;
}
.about-content { padding: 8px 10px; }
.about-content h3 {
  margin: 0 0 6px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}
.about-content ul {
  margin: 0 0 10px;
  padding-left: 20px;
  font-size: 0.88rem;
}
.about-content li { margin: 2px 0; }
.attribution {
  font-size: 0.72rem;
  color: var(--ink-muted);
  line-height: 1.5;
  margin: 10px 0 8px;
  font-style: italic;
}

.phyrexian-button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  font-family: 'Phyrexian', serif;
  font-size: 1.2rem;
  color: var(--ink-muted);
  opacity: 0.4;
  padding: 6px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.phyrexian-button:hover { opacity: 0.9; color: var(--ink-primary); }

.build-version {
  margin: 8px 0 0;
  font-size: 0.65rem;
  color: var(--ink-muted);
  text-align: center;
  font-family: 'SF Mono', ui-monospace, 'Menlo', monospace;
  letter-spacing: 0.02em;
}

/* Phyrexian mode flips major headings over the whole app. */
body.phyrexian-mode,
body.phyrexian-mode header h1,
body.phyrexian-mode .center-message,
body.phyrexian-mode .message,
body.phyrexian-mode .hint,
body.phyrexian-mode .new-chat,
body.phyrexian-mode .example,
body.phyrexian-mode .card-card-name,
body.phyrexian-mode .sidebar-header,
body.phyrexian-mode input,
body.phyrexian-mode textarea {
  font-family: 'Phyrexian', 'Inter', sans-serif !important;
}

/* =============================================================== main */

main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.center-message {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 1.6rem;
  font-weight: 600;
  max-width: 640px;
  padding: 0 1rem;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.center-message.hidden { opacity: 0; }

.thread {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* =============================================================== messages */

.message {
  position: relative;
  padding: 0.9rem 1.1rem;
  border-radius: 12px;
  line-height: 1.6;
  max-width: 82%;
  box-shadow: var(--shadow);
  animation: fadeIn 0.22s ease;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--ink-primary), var(--ink-secondary));
  color: var(--parchment-primary);
  white-space: pre-wrap;
}

.message.assistant {
  align-self: flex-start;
  /* Fix the assistant bubble to its natural width from the moment it's
     created so streaming tokens don't make it resize horizontally. */
  width: 82%;
  background: #fff;
  color: var(--ink-primary);
  border: 1px solid var(--border-light);
  padding-bottom: 2.3rem;
  font-size: 0.95rem;
}

.message.assistant.streaming .message-body::after {
  content: '▍';
  color: var(--message-assistant);
  margin-left: 2px;
  animation: blink 1s steps(2, start) infinite;
}

.ghost-notice {
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-style: italic;
  margin-top: 6px;
}

.card-preview {
  position: fixed;
  z-index: 100;
  width: 240px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  filter: drop-shadow(0 10px 28px rgba(44, 62, 80, 0.3));
}
.card-preview.visible {
  opacity: 1;
  transform: translateY(0);
}
.card-preview img {
  width: 100%;
  display: block;
  border-radius: 12px;
}

.text-preview {
  position: fixed;
  z-index: 100;
  width: 360px;
  max-width: calc(100vw - 20px);
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px 10px;
  box-shadow: var(--shadow-lift);
  color: var(--ink-primary);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
  font-size: 0.88rem;
  line-height: 1.5;
}
.text-preview.visible {
  opacity: 1;
  transform: translateY(0);
}
.text-preview-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-primary);
  margin-bottom: 4px;
}
.text-preview-body {
  color: var(--ink-secondary);
  font-style: italic;
}
.text-preview-footer {
  display: block;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-decoration: none;
  pointer-events: auto;
}
.text-preview-footer:hover { color: var(--ink-primary); }

/* =============================================================== agentic activity */

.thinking {
  margin: 0 0 10px;
  border-left: 2px solid var(--border-strong);
  padding-left: 10px;
}
.thinking summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 0;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary::before {
  content: '';
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  transition: transform 0.15s ease;
}
.thinking[open] summary::before { transform: rotate(90deg); }
.thinking summary:hover { color: var(--ink-secondary); }
.thinking[open] summary { color: var(--ink-secondary); }
.thinking-body {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--ink-secondary);
  font-style: italic;
  line-height: 1.55;
  white-space: pre-wrap;
  opacity: 0.9;
}

.tool-activity {
  margin: 0 0 10px;
  background: var(--parchment-tertiary);
  border-radius: 6px;
  padding: 2px 0;
}
.tool-summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--ink-secondary);
  padding: 6px 10px;
  user-select: none;
  list-style: none;
}
.tool-summary::-webkit-details-marker { display: none; }
.tool-activity[open] .tool-summary {
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}
.tool-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 6px 4px;
}
.tool-call {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-muted);
  padding: 3px 6px;
  border-radius: 4px;
}
.tool-call .tool-icon { width: 14px; text-align: center; flex-shrink: 0; }
.tool-call .tool-label { flex: 1; }
.tool-call.done { color: var(--ink-secondary); }
.tool-call.error { color: var(--error); }
.tool-call.pending .tool-icon {
  animation: spin 1.2s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* markdown inside assistant bubbles */
.message-body { max-width: 100%; }
.message.assistant .message-body > *:first-child { margin-top: 0; }
.message.assistant .message-body > *:last-child  { margin-bottom: 0; }

.message.assistant .message-body h1,
.message.assistant .message-body h2,
.message.assistant .message-body h3,
.message.assistant .message-body h4 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink-primary);
  margin: 1.1em 0 0.45em;
}
.message.assistant .message-body h1 { font-size: 1.15rem; border-bottom: 1px solid var(--border-light); padding-bottom: 4px; }
.message.assistant .message-body h2 { font-size: 1.05rem; color: var(--ink-secondary); }
.message.assistant .message-body h3 { font-size: 0.98rem; color: var(--ink-secondary); }
.message.assistant .message-body h4 { font-size: 0.92rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); }

.message.assistant .message-body p { margin: 0.55em 0; }

.message.assistant .message-body ul,
.message.assistant .message-body ol { margin: 0.5em 0 0.5em 1.4em; padding: 0; }
.message.assistant .message-body li { margin: 0.25em 0; }
.message.assistant .message-body li > p { margin: 0.2em 0; }

.message.assistant .message-body strong { color: var(--ink-primary); font-weight: 700; }
.message.assistant .message-body em     { color: var(--ink-secondary); font-style: italic; }

.message.assistant .message-body code {
  background: var(--parchment-tertiary);
  border: 1px solid var(--border-light);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', ui-monospace, 'Menlo', monospace;
  font-size: 0.85em;
}
.message.assistant .message-body pre {
  background: var(--parchment-tertiary);
  border: 1px solid var(--border-light);
  padding: 10px 12px;
  border-radius: 6px;
  margin: 0.6em 0;
  overflow-x: auto;
  font-size: 0.85em;
}
.message.assistant .message-body pre code { background: transparent; border: none; padding: 0; }

.message.assistant .message-body a {
  color: var(--message-assistant);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message.assistant .message-body blockquote {
  border-left: 3px solid var(--message-assistant);
  margin: 0.6em 0;
  padding: 0.2em 0.9em;
  color: var(--ink-secondary);
  background: var(--parchment-secondary);
  border-radius: 4px;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.card-chip {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--parchment-primary);
  cursor: pointer;
  transition: background 0.15s ease;
}
.card-chip:hover { background: rgba(255, 255, 255, 0.28); }

/* themed feedback buttons */
.feedback {
  position: absolute;
  right: 0.65rem;
  bottom: 0.5rem;
  display: flex;
  gap: 0.25rem;
}

.feedback-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--ink-muted);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  padding: 0;
}
.feedback-btn:hover { color: var(--ink-primary); border-color: var(--ink-primary); }
.feedback-btn.active[data-rating='1']  { color: var(--success); border-color: var(--success); background: rgba(39, 174, 96, 0.08); }
.feedback-btn.active[data-rating='-1'] { color: var(--error);   border-color: var(--error);   background: rgba(231, 76, 60, 0.08); }
.feedback-btn.copy-btn.active          { color: var(--success); border-color: var(--success); }
.feedback-btn:disabled { cursor: default; opacity: 0.85; }
.feedback-btn svg { display: block; }

.error-banner {
  align-self: center;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  max-width: 82%;
}

/* =============================================================== examples */

.examples {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem 1rem;
  max-width: 820px;
  margin: 0 auto;
  transition: opacity 0.25s ease, max-height 0.3s ease, padding 0.3s ease;
}

.examples.hidden {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.example {
  background: var(--ink-primary);
  color: var(--parchment-primary);
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.example:hover { background: var(--ink-secondary); transform: translateY(-1px); }

/* =============================================================== footer */

footer {
  flex-shrink: 0;
  background: var(--parchment-primary);
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -2px 10px var(--accent-shadow);
  padding: 10px 1rem 14px;
}

.composer {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

/* The Turnstile widget sits in its own row above the composer. With
   appearance="interaction-only" it renders 0×0 when no challenge is
   required, so the row collapses and takes no space. When Cloudflare
   *does* demand a checkbox, the widget expands here instead of cramping
   the input row. */
.turnstile-row {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
}
.turnstile-row:not(:empty):has(iframe) {
  margin-bottom: 10px;
}
.turnstile-row .cf-turnstile { max-width: 100%; }
/* Once a token has been captured, hide the row so the "Success!" badge
   doesn't linger above the composer. reset() on send clears the class. */
body.turnstile-verified .turnstile-row { display: none; }
/* QA bypass mode: Turnstile is server-skipped, so hide the widget
   entirely to keep browser-agent QA runs from trying to solve it. */
body.qa-bypass .turnstile-row { display: none; }

/* Touch devices: once a link has been tapped once, show a subtle cue so
   the user knows a second tap will navigate. */
.preview-primed {
  background: rgba(139, 69, 19, 0.12);
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.12);
}

.input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(to right, #fff, var(--parchment-secondary));
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 6px 14px;
  transition: var(--transition);
  min-height: 44px;
}

.input-wrap:focus-within {
  border-color: var(--ink-primary);
  box-shadow: 0 2px 10px var(--accent-shadow);
}

#input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink-primary);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.5;
  padding: 8px 0;
  resize: none;
  max-height: 200px;
  overflow-y: auto;
}

#input::placeholder { color: var(--ink-muted); }

#send {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: var(--ink-primary);
  color: var(--parchment-primary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

#send:hover:not(:disabled) { background: var(--ink-secondary); transform: translateY(-1px); }
#send:disabled { opacity: 0.4; cursor: not-allowed; }

.hint {
  max-width: 820px;
  margin: 6px auto 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--ink-muted);
}

/* =============================================================== autocomplete */

.suggestions {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  max-height: 240px;
  overflow-y: auto;
  z-index: 30;
}

.suggestions li {
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--ink-primary);
  transition: background 0.1s ease;
}
.suggestions li:hover,
.suggestions li[aria-selected='true'] { background: var(--parchment-secondary); }

/* =============================================================== animations */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink { to { visibility: hidden; } }

/* =============================================================== responsive */

/* ≤ 1280px the sidebar slides over the chat as an overlay instead of
   pushing the main content aside. Keeps the conversation readable on
   mid-size laptops where a 260px sidebar + 820px thread leaves no
   breathing room. */
@media (max-width: 1280px) {
  body[data-sidebar="open"] .app,
  body[data-sidebar="closed"] .app { left: 0; }
  body[data-sidebar="open"] .sidebar { box-shadow: var(--shadow-lift); }
}

/* ≥ 1281px the sidebar becomes a permanent push-column. The external
   hamburger button is redundant while the sidebar is open — the
   collapse button inside it takes over. */
@media (min-width: 1281px) {
  body[data-sidebar="open"] #toggle-sidebar { display: none; }
}

@media (max-width: 640px) {
  .tagline { display: none; }
  .patreon-link span { display: none; }         /* icon only; keep brand-mark visible */
  .hint { display: none; }                      /* Enter/Shift+Enter irrelevant on touch */
  .message { max-width: 94%; padding: 0.8rem 0.95rem; }
  .message.assistant { width: 94%; }
  .center-message { font-size: 1.2rem; top: 32%; }
  .example { font-size: 0.75rem; padding: 0.35rem 0.75rem; }
  .composer { gap: 0.4rem; }
  footer { padding: 8px 0.6rem 12px; }
  .input-wrap { padding: 4px 10px; }
  #send { width: 40px; height: 40px; }
  .card-panel { width: 100vw; }
}
