/* timorahome.tv — cinematic, restrained. One accent, no gradients, posters first. */

:root {
  --bg: #0e0e10;
  --surface: #17171a;
  --surface-2: #1e1e22;
  --text: #f0efec;
  --muted: #94938c;
  --faint: #55544f;
  --accent: #d4a44c;
  --danger: #c96a5a;
  --radius: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--bg); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(76px + var(--safe-b));
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* ---------- chrome ---------- */

.top {
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-t)) 20px 6px;
}

.wordmark {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
}

main {
  padding: 12px 20px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.tabs {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px calc(12px + var(--safe-b));
  background: rgba(14, 14, 16, 0.92);
  -webkit-backdrop-filter: saturate(120%) blur(14px);
  backdrop-filter: saturate(120%) blur(14px);
  z-index: 30;
}

.tab {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 180ms var(--ease), background-color 180ms var(--ease);
}

.tab.active {
  color: var(--bg);
  background: var(--accent);
}

@media (hover: hover) {
  .tab:not(.active):hover,
  .chip:not(.active):hover,
  .season-chip:not(.on):hover { color: var(--text); }
  .cta:not(:disabled):hover { opacity: 0.9; }
  .linklike:hover { text-decoration: underline; }
}

/* ---------- discover ---------- */

.searchbar {
  display: block;
  width: 100%;
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  padding: 14px 16px;
  margin: 4px 0 20px;
  outline: none;
  transition: background-color 180ms var(--ease);
}

.searchbar::placeholder { color: var(--muted); }
.searchbar:focus { background: var(--surface-2); }

.chips {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
}

.chip {
  appearance: none;
  border: 0;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}

.chip.active { background: var(--surface-2); color: var(--text); }

/* ---------- poster grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 22px 14px;
}

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 28px 18px; }
}

.card {
  /* real <button> so posters are keyboard-reachable; undo button chrome */
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  display: block;
  width: 100%;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.card.skel { cursor: default; }

.poster {
  display: block;
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: transform 200ms var(--ease);
}

.card:active .poster { transform: scale(0.965); }

@media (hover: hover) {
  .card:hover .poster { transform: scale(1.03); }
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Visible by default; the fade only runs on fresh (non-cached) loads so a
   paused transition in a background tab can never leave posters invisible. */
.poster img.fade { animation: poster-in 220ms var(--ease); }

@keyframes poster-in {
  from { opacity: 0; }
}

.card .meta, .card .meta .sub { display: block; }

.poster .fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 7px;
  border-radius: 4px;
  background: rgba(14, 14, 16, 0.85);
  color: var(--accent);
}

.badge.available { color: var(--muted); }

.card .meta {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.3;
}

.card .meta .title {
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .meta .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* skeletons */

.skel .poster { background: var(--surface); animation: pulse 1.4s ease-in-out infinite; }
.skel .line { height: 12px; border-radius: 3px; background: var(--surface); margin-top: 8px; width: 80%; animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---------- sections / empty states ---------- */

.section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 26px 0 14px;
}

.section-title:first-child { margin-top: 4px; }

.scroll-sentinel { height: 1px; }

.feed-end {
  text-align: center;
  color: var(--faint);
  font-size: 13px;
  padding: 36px 0 12px;
}

.empty {
  padding: 72px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.empty .hint { color: var(--faint); font-size: 13px; margin-top: 6px; }

/* recently-added shelf */

.shelf {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -20px;
  padding: 0 20px 8px;
  -webkit-overflow-scrolling: touch;
}

.shelf::-webkit-scrollbar { display: none; }

.shelf .card { flex: 0 0 108px; }

@media (min-width: 640px) { .shelf .card { flex-basis: 140px; } }

/* ---------- detail sheet ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 40;
  transition: background-color 220ms var(--ease);
}

.sheet-backdrop.open { background: rgba(0, 0, 0, 0.6); }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 14px 14px 0 0;
  padding: 20px 20px calc(28px + var(--safe-b));
  z-index: 41;
  transform: translateY(100%);
  transition: transform 240ms var(--ease);
  -webkit-overflow-scrolling: touch;
}

.sheet.open { transform: translateY(0); }

/* The dialog panel takes programmatic focus on open; a ring around the whole
   sheet is noise — keyboard focus indication continues on its inner controls. */
.sheet:focus-visible { outline: none; }

@media (min-width: 720px) {
  .sheet {
    left: 50%; right: auto; bottom: 50%;
    transform: translate(-50%, calc(50% + 40px));
    opacity: 0;
    width: 640px;
    max-height: 80vh;
    border-radius: 12px;
    transition: transform 240ms var(--ease), opacity 240ms var(--ease);
  }
  .sheet.open { transform: translate(-50%, 50%); opacity: 1; }
}

.sheet .grabber {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--faint);
  margin: 0 auto 18px;
}

@media (min-width: 720px) { .sheet .grabber { display: none; } }

.sheet .head { display: flex; gap: 18px; }

.sheet .head .poster {
  flex: 0 0 34%;
  max-width: 180px;
}

.sheet h2 { font-size: 22px; font-weight: 650; line-height: 1.2; margin-top: 6px; }

.sheet .facts { color: var(--muted); font-size: 14px; margin-top: 8px; }

.sheet .facts .dotsep { margin: 0 6px; color: var(--faint); }

.sheet .overview {
  margin-top: 18px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}

.sheet .note {
  margin-top: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.sheet label.field {
  display: block;
  margin-top: 22px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.sheet select {
  display: block;
  width: 100%;
  margin-top: 8px;
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%2394938c' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 12px 40px 12px 14px;
}

.disclosure {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 12px 14px;
  margin-top: 14px;
  cursor: pointer;
}

.disclosure .lab {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.disclosure .right { display: flex; align-items: center; gap: 10px; }
.disclosure .chev {
  color: var(--muted);
  transition: transform 200ms var(--ease);
}
.disclosure.open .chev { transform: rotate(180deg); }

.season-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.season-chip {
  appearance: none;
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}

.season-chip.on { background: var(--accent); color: var(--bg); font-weight: 600; }

.linklike {
  appearance: none;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  margin-top: 16px;
  padding: 4px 0;
}

.ep-list { margin-top: 10px; }

.ep-season-label { font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }

.ep-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  cursor: pointer;
  font-size: 15px;
}

.ep-row .num { color: var(--muted); font-variant-numeric: tabular-nums; width: 2.4em; }

.ep-row .have { margin-left: auto; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.ep-row input { accent-color: var(--accent); width: 18px; height: 18px; }

.cta {
  display: block;
  width: 100%;
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  padding: 15px;
  margin-top: 26px;
  cursor: pointer;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
}

.cta:active { transform: scale(0.985); }
.cta:disabled { background: var(--surface-2); color: var(--muted); cursor: default; }

.cta.secondary { background: var(--surface-2); color: var(--text); }

/* ---------- downloading cards (library) ---------- */

.bar {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-2);
  margin-top: 8px;
  overflow: hidden;
}

.bar .fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: 2px;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 400ms var(--ease);
}

.dl-card .meta { margin-top: 6px; }
.dl-card .sub { font-variant-numeric: tabular-nums; }

.badge.attention { color: var(--danger); }

/* download detail sheet */

.sheet .dl-status {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.sheet > .bar { margin-top: 20px; }

.file-list { margin-top: 4px; }

.file-heading {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 4px;
}

.file-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  font-size: 14px;
}

.file-row + .file-row { border-top: 1px solid var(--surface-2); }

.file-row .num {
  flex: none;
  width: 2.4em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.file-row .fname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row .fpct {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.file-row.done .fname { color: var(--muted); }

.file-hint { color: var(--muted); font-size: 14px; padding: 14px 0; }

/* ---------- item screen ---------- */

.backlink {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  padding: 8px 0;
  margin-bottom: 6px;
  cursor: pointer;
  display: block;
}

@media (hover: hover) {
  .backlink:hover { color: var(--text); }
}

.item-head { display: flex; gap: 18px; }

.item-head .poster { flex: 0 0 30%; max-width: 170px; }

.item-head h2 { font-size: 22px; font-weight: 650; line-height: 1.2; margin-top: 6px; }

.item-head .facts { color: var(--muted); font-size: 14px; margin-top: 8px; }

.cta.inline {
  display: inline-block;
  width: auto;
  padding: 10px 18px;
  font-size: 14px;
  margin-top: 18px;
}

.files-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 30px 0 4px;
}

.files-head .section-title { margin: 0; }
.files-head .linklike { margin: 0; }

.vfile-list { padding-bottom: 56px; }

.vfile-row {
  /* button (tap to play) or label (edit mode) — same skin for both */
  appearance: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  font-size: 14px;
  border: 0;
  border-top: 1px solid var(--surface-2);
  cursor: pointer;
}

.vfile-list .vfile-row:first-child,
.ep-season-label + .vfile-row { border-top: 0; }

.vfile-row input {
  flex: none;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.vthumb {
  flex: none;
  width: 98px;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
  display: block;
}

.vthumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vmeta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.vmeta .vname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.vsub {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vsub .vsize {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.vplay {
  flex: none;
  color: var(--faint);
  font-size: 11px;
  padding-right: 4px;
  transition: color 160ms var(--ease);
}

@media (hover: hover) {
  button.vfile-row:hover .vplay { color: var(--accent); }
}

/* quality tier chips: 4K gold, 1080p bright, 720p/SD muted */

.q {
  flex: none;
  min-width: 44px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
}

.q.q4k { color: var(--accent); }
.q.qhd { color: var(--text); }
.q.qhdr { min-width: auto; }

/* floating selection bar in edit mode */

.edit-actions {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(84px + var(--safe-b));
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 8px 8px 8px 20px;
  z-index: 35;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  max-width: 92vw;
}

.edit-actions[hidden] { display: none; }

.edit-actions .count {
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.edit-actions .cta {
  width: auto;
  margin: 0;
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 999px;
}

.cta.danger { background: var(--danger); color: var(--bg); }
.edit-actions .cta.danger:disabled { background: var(--surface); color: var(--muted); }

/* ---------- activity ---------- */

/* quick doorways to sibling services (Jellyfin, mirror) */

.quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 4px 0 8px;
}

.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  transition: background-color 160ms var(--ease), transform 160ms var(--ease);
}

.quick-link:active { transform: scale(0.985); }

@media (hover: hover) {
  .quick-link:hover { background: var(--surface-2); }
  .quick-link:hover .ql-arrow { color: var(--accent); }
}

.ql-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ql-label { font-weight: 600; font-size: 15px; }
.ql-sub {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ql-arrow { flex: none; color: var(--faint); font-size: 15px; transition: color 160ms var(--ease); }

.banner {
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--danger);
  font-size: 14px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.ev-row {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  font-size: 14px;
  line-height: 1.45;
}

.ev-row + .ev-row { border-top: 1px solid var(--surface-2); }

.ev-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.ev-body { overflow-wrap: anywhere; }
.ev-body .detail { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ev-body.error { color: var(--danger); }

/* ---------- chat ---------- */

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: calc(100dvh - 260px);
  padding-bottom: 88px; /* room for the fixed composer above the tab bar */
}


/* empty state */

.chat-hero {
  margin: auto;
  text-align: center;
  padding: 48px 12px 24px;
  max-width: 480px;
}

.chat-glyph {
  font-size: 26px;
  color: var(--accent);
  margin-bottom: 18px;
}

.chat-hero h2 { font-size: 24px; font-weight: 650; letter-spacing: -0.01em; }

.chat-hero p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin-top: 10px;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
}

.chat-suggestions .chip { font-size: 14px; padding: 10px 16px; }

/* messages */

.msg.user {
  align-self: flex-end;
  max-width: 82%;
  background: var(--surface-2);
  border-radius: 16px 16px 4px 16px;
  padding: 11px 15px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.bot {
  align-self: flex-start;
  max-width: 100%;
  width: 100%;
  font-size: 15px;
  line-height: 1.65;
}

.msg.bot .md > * + * { margin-top: 12px; }
/* prose measure: shelves may run wide, text must not */
.msg.bot p, .msg.bot ul, .msg.bot ol, .msg.bot h3, .msg.bot h4, .msg.bot pre {
  max-width: 68ch;
}
.msg.bot p { overflow-wrap: anywhere; }
.msg.bot h3, .msg.bot h4 { font-size: 16px; font-weight: 650; margin-top: 18px; }
.msg.bot ul, .msg.bot ol { padding-left: 22px; }
.msg.bot li { margin: 4px 0; }
.msg.bot li::marker { color: var(--muted); }
.msg.bot a { color: var(--accent); text-decoration: none; }
.msg.bot a:hover { text-decoration: underline; }
.msg.bot code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  background: var(--surface);
  border-radius: 4px;
  padding: 2px 6px;
}
.msg.bot pre {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
}
.msg.bot pre code { background: none; padding: 0; }

/* poster shelves inside a reply */

.chat-shelf { margin: 14px -20px 6px; padding: 0 20px 4px; }
.chat-shelf .card { flex: 0 0 118px; }
@media (min-width: 640px) { .chat-shelf .card { flex-basis: 132px; } }

/* status line while the agent works */

.chat-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  margin-top: 12px;
}

.chat-status .dots { display: inline-flex; gap: 4px; }

.chat-status .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: chat-dot 1.2s ease-in-out infinite;
}

.chat-status .dot:nth-child(2) { animation-delay: 0.15s; }
.chat-status .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes chat-dot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.chat-error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 12px;
}

/* composer pinned above the tab bar */

.composer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(70px + var(--safe-b));
  width: calc(100% - 32px);
  max-width: 720px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 999px;
  padding: 6px;
  z-index: 31;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* start-over button: quiet ghost circle, mirrors the send button's shape */
.composer .clear {
  flex: none;
  appearance: none;
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms var(--ease), transform 160ms var(--ease);
}

.composer .clear:active { transform: scale(0.94); }
.composer .clear:disabled { opacity: 0.35; cursor: default; }

@media (hover: hover) {
  .composer .clear:not(:disabled):hover { color: var(--text); }
}

.chat-input {
  flex: 1;
  min-width: 0;
  appearance: none;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 8px 0;
  outline: none;
}

.chat-input::placeholder { color: var(--muted); }

.composer .send {
  flex: none;
  appearance: none;
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
}

.composer .send:active { transform: scale(0.94); }
.composer .send:disabled { background: var(--surface-2); color: var(--muted); cursor: default; }

@media (hover: hover) {
  .composer .send:not(:disabled):hover { opacity: 0.9; }
}

/* ---------- toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-b));
  transform: translate(-50%, 12px);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
  z-index: 60;
  max-width: 86vw;
  text-align: center;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* the chat composer occupies the toast's band; float toasts above it */
body:has(.composer) #toast { bottom: calc(148px + var(--safe-b)); }
