/* CLOD: one assistant app for every chat. The flicker at the bottom is where it stops pretending. */
@import url("https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap");

:root {
  --bg: #1d1d1c;
  --side: #1f1f1e;
  --ink: #f2f1ec;
  --mute: #a19f97;
  --line: #333331;
  --hover: #2c2c2a;
  --sel: #3a3a38;
  --bubble: #2a2a28;
  --field: #262625;
  --accent: #c96442;
  --bad: #e5655b;
  --good: #6cc38b;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  overflow: hidden;
}
button { font: inherit; color: inherit; }

.ic { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; color: var(--mute); }
.ic svg { width: 100%; height: 100%; }
.ic.sm { width: 14px; height: 14px; }

.shell { display: grid; grid-template-columns: 260px 1fr; height: 100vh; }

/* sidebar */
.side { display: flex; flex-direction: column; min-height: 0; padding: 10px 8px 0; background: var(--side); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.wordmark { font: 600 23px/1 var(--serif); letter-spacing: -0.01em; }
.nav { display: flex; align-items: center; gap: 12px; width: 100%; padding: 7px 8px; text-align: left; background: transparent; border: 0; border-radius: 8px; cursor: default; }
.nav .ic { color: var(--ink); }
.recents-h { display: flex; align-items: center; gap: 4px; margin: 22px 8px 6px; font-size: 13px; font-weight: 500; color: var(--ink); }
.recents-h .ic:last-child { margin-left: auto; width: 18px; height: 18px; }
.recents { margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.recents li { display: flex; align-items: center; gap: 12px; padding: 7px 10px; font-size: 14px; border-radius: 8px; }
.recents li .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recents li .dot { flex: none; width: 6px; height: 6px; margin: 0 4px; border: 1px solid var(--mute); border-radius: 50%; }
.recents li.on { background: var(--sel); }
.recents li.fresh { color: #fff; background: var(--accent); cursor: pointer; animation: pulse 1.2s infinite; }
.recents li.fresh .dot { background: #fff; border-color: #fff; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(201, 100, 66, 0.3); } }
.viewall { padding: 7px 10px; font-size: 14px; color: var(--mute); }
.acct { display: flex; align-items: center; gap: 8px; margin: auto -8px 0; padding: 12px 16px; font-size: 14px; border-top: 1px solid var(--line); }
.acct .plan { color: var(--mute); }
.acct .ic:last-child { margin-left: auto; }
.av { display: grid; place-items: center; flex: none; width: 24px; height: 24px; font-size: 11px; color: var(--ink); background: var(--sel); border-radius: 50%; }

/* main column */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; height: 52px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.title-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; }
.title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-r { display: flex; align-items: center; gap: 16px; }
.reward { padding: 2px 10px; font: 12px "Courier New", monospace; white-space: nowrap; color: var(--mute); border: 1px solid var(--line); border-radius: 999px; }
.reward.down { animation: rdown 0.7s; }
.reward.up { animation: rup 0.7s; }
@keyframes rdown { 25% { color: #fff; background: var(--bad); } }
@keyframes rup { 25% { color: #111; background: var(--good); } }
.share { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.share .ic { color: var(--ink); width: 18px; height: 18px; }
.scroll { flex: 1; overflow-y: auto; }
.thread { max-width: 760px; margin: 0 auto; padding: 32px 24px 40px; }
.notice { margin: 4px 0 18px; text-align: center; font-size: 13px; color: var(--mute); }

/* messages */
.row { display: flex; margin: 22px 0; }
.row.them { justify-content: flex-end; }
.row.them .bubble { max-width: 80%; padding: 10px 16px; background: var(--bubble); border-radius: 14px; }
.row.them .bubble.alert { background: #3a2321; box-shadow: inset 0 0 0 1px var(--bad); animation: shake 0.35s; }
.row.them .bubble.nag { color: #fff; background: #b8382f; animation: shake 0.5s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.row.me .bubble { flex: 1; min-width: 0; font: 17px/1.65 var(--serif); }

/* your reply while you write it */
.bubble.editing { padding: 10px 12px; border: 1.5px dashed var(--accent); border-radius: 12px; }
textarea.write { width: 100%; min-height: 72px; font: inherit; color: var(--ink); background: transparent; border: 0; outline: none; resize: none; }
textarea.write::placeholder { color: #6f6d66; }
textarea:disabled { cursor: not-allowed; }
.codehead { padding: 5px 10px; font: 12px "Courier New", monospace; color: #999; background: #151514; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; }
textarea.code { display: block; width: 100%; min-height: 200px; padding: 10px; font: 13px/1.5 Consolas, "Courier New", monospace; color: #d4d4d4; background: #111110; border: 1px solid var(--line); border-radius: 0 0 8px 8px; outline: none; resize: vertical; }
.bar { display: flex; justify-content: flex-end; margin-top: 8px; }
.send { padding: 6px 14px; font: 14px var(--sans); color: #fff; background: var(--accent); border: 0; border-radius: 8px; cursor: pointer; }
.send:disabled { opacity: 0.4; cursor: not-allowed; }
.paint { display: block; width: 100%; max-width: 480px; aspect-ratio: 16 / 9; background: #fff; border-radius: 8px; touch-action: none; cursor: crosshair; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; font: 13px var(--sans); color: var(--mute); }
.swatches { display: flex; gap: 6px; }
.swatch { width: 24px; height: 24px; padding: 0; border: 2px solid var(--bg); border-radius: 50%; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.ghost { padding: 5px 10px; font-size: 13px; background: transparent; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.tools .send { margin-left: auto; }

/* your reply once it's sent: numbers */
.sent { line-height: 1.9; }
.tk { display: inline-block; margin: 1px 2px; padding: 0 4px; font: 12px/1.4 "Courier New", monospace; color: var(--mute); border: 1px solid currentColor; border-radius: 3px; }
.tk.live { color: var(--ink); }
.meta { margin-top: 6px; font: 12px "Courier New", monospace; color: var(--mute); }
.shot-sent { display: block; width: 100%; max-width: 320px; border-radius: 8px; transition: filter 0.8s; }
.shot-sent.data { filter: grayscale(1) contrast(1.6); image-rendering: pixelated; }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font: 13px var(--sans); }
.acts .ic { width: 28px; height: 28px; padding: 5px; border-radius: 6px; }
.acts .th.on.up { color: var(--good); background: rgba(108, 195, 139, 0.15); }
.acts .th.on.down { color: var(--bad); background: rgba(229, 101, 91, 0.15); }
.grade { margin-left: 6px; font: 12px "Courier New", monospace; }
.grade.neg { color: var(--bad); }
.grade.pos { color: var(--good); }

/* attachments the prompter pastes */
.attach { margin-bottom: 8px; }
.cap { margin-bottom: 4px; font-size: 12px; color: var(--mute); }
.tweet { padding: 12px; font: 14px/1.4 -apple-system, "Segoe UI", sans-serif; color: #0f1419; background: #fff; border: 1px solid #cfd9de; border-radius: 12px; }
.tweet .h, .tweet .stats { color: #536471; }
.tweet .stats { margin-top: 6px; font-size: 13px; }
.attach img { display: block; max-width: 100%; border-radius: 10px; }
.filechip { padding: 8px 12px; font-size: 14px; background: var(--field); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.filebody { max-height: 260px; margin: 8px 0 0; padding: 12px; overflow: auto; font: 12.5px/1.5 "Courier New", monospace; white-space: pre-wrap; background: #151514; border: 1px solid var(--line); border-radius: 10px; }

/* the composer belongs to the prompter, not you */
.composer { display: flex; align-items: center; gap: 10px; width: calc(100% - 48px); max-width: 712px; margin: 0 auto; padding: 12px 14px; background: var(--field); border: 1px solid #3c3c3a; border-radius: 16px; cursor: not-allowed; }
.composer .ic { color: var(--ink); }
.ctext { flex: 1; min-height: 24px; white-space: pre-wrap; }
.ctext:empty::before { content: attr(data-ph); color: #85837c; }
.ctext.typing::after { content: "\258D"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.cbtn { display: none; place-items: center; flex: none; width: 32px; height: 32px; color: #fff; background: var(--accent); border-radius: 8px; }
.cbtn .ic { color: #fff; width: 18px; height: 18px; }
.composer.typing .cbtn { display: grid; }
.composer.typing .voice { display: none; }
.cfoot { display: flex; justify-content: space-between; gap: 16px; width: calc(100% - 48px); max-width: 712px; margin: 0 auto; padding: 10px 28px 14px; font-size: 12px; color: var(--mute); }
.model { white-space: nowrap; color: var(--ink); }
.model span { color: var(--mute); }
.end { margin: 24px 0; text-align: center; }
.newchat.big { padding: 10px 20px; text-align: center; color: #fff; background: var(--accent); border: 0; border-radius: 10px; cursor: pointer; }
.mnext { display: none; }

/* memory */
.modal-bg { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.55); }
.modal { width: 100%; max-width: 460px; padding: 18px 20px; background: var(--field); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.mhead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-weight: 600; }
.mhead small { font-weight: 400; color: var(--mute); }
.mlist { max-height: 220px; margin: 0 0 12px; padding: 0; overflow-y: auto; font-size: 14px; list-style: none; }
.mlist li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.mnew { min-height: 48px; padding: 8px 10px; font-size: 14px; background: var(--bg); border: 1.5px solid var(--accent); border-radius: 8px; cursor: text; }
.mph { color: #85837c; }
.mtext:not(:empty) ~ .mph { display: none; }
.caret::after { content: "\258D"; animation: blink 1s steps(1) infinite; }
.mfoot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 12px; color: var(--mute); }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .thread { padding: 20px 16px; }
  .composer, .cfoot { width: calc(100% - 32px); }
  .cfoot { padding: 8px 4px 12px; }
  .model, .share span { display: none; }
  .mnext { display: block; }
}

/* the flicker: for a moment it's a terminal. Colours only, so nothing moves. */
body.flick { background: #000 !important; }
body.flick * { color: #33ff33 !important; border-color: #1f8f1f !important; background-color: transparent !important; border-radius: 0 !important; box-shadow: none !important; animation: none !important; }
body.flick .side, body.flick .main, body.flick .modal, body.flick .modal-bg { background-color: #000 !important; }
body.flick [data-flick] { font-family: "Courier New", monospace !important; }
body.flick .ctext:empty::before { color: #1f8f1f; }
body.flick img, body.flick canvas { filter: grayscale(1) sepia(1) hue-rotate(60deg) saturate(4) brightness(0.75); }
