/* Clean brand (tryclean.ai): warm charcoal page, cream ink, blue accent. */
:root {
  --page: #161413; --raised: #1e1c1a; --raised2: #292624; --edge: #3b3835;
  --ink: #f4f1ec; --ink2: #c3bdb6; --soft: #988f86;
  --blue: #1772e7; --blue-l: #5eb1ff; --green: #4ade80; --red: #f87171; --amber: #fbbf24;
  --serif: 'Libertinus Serif', Georgia, serif; --sans: 'Geist', system-ui, sans-serif; --mono: 'Geist Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: var(--blue-l); text-decoration: none; }
button, textarea, input { font: inherit; color: inherit; }
.mono { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; }
.label { color: var(--soft); }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; background: rgba(22, 20, 19, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--edge); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.tile { width: 34px; height: 34px; border-radius: 9px; background: var(--blue); display: grid; place-items: center; box-shadow: 0 6px 20px rgba(23, 114, 231, 0.35); }
.tile img { width: 20px; height: 19px; }
.brand .name { font-family: var(--serif); font-size: 24px; }
.machine { color: var(--ink2); text-align: right; }
.machine b { color: var(--ink); font-weight: 500; }

.layout { display: grid; grid-template-columns: 400px 1fr; min-height: calc(100vh - 63px); }
.side { border-right: 1px solid var(--edge); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.main { padding: 28px 36px 60px; min-width: 0; }

.card { background: var(--raised); border: 1px solid var(--edge); border-radius: 14px; padding: 16px; }
.new { display: flex; flex-direction: column; gap: 10px; }
.tpls { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl { border: 1px solid var(--edge); background: transparent; color: var(--ink2); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.tpl[aria-pressed='true'] { background: var(--blue); border-color: var(--blue); color: #fff; }
.tpl:disabled { opacity: 0.4; cursor: not-allowed; }
.blurb { margin: 0; color: var(--soft); font-size: 13px; min-height: 2.6em; }
textarea { width: 100%; resize: vertical; background: var(--page); border: 1px solid var(--edge); border-radius: 10px; padding: 10px 12px; outline: none; }
textarea:focus { border-color: var(--blue); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.attach { color: var(--ink2); font-size: 13px; cursor: pointer; border-bottom: 1px dashed var(--edge); }
.attach:hover { color: var(--ink); }
.primary { background: var(--blue); color: #fff; border: 0; border-radius: 10px; padding: 9px 18px; font-weight: 600; cursor: pointer; }
.primary:disabled { opacity: 0.5; cursor: default; }
.ghost { background: transparent; border: 1px solid var(--edge); color: var(--ink2); border-radius: 10px; padding: 8px 14px; cursor: pointer; }
.ghost:hover { color: var(--ink); border-color: var(--soft); }
.hint { color: var(--soft); text-align: right; font-size: 10px; }
.files { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--raised2); border: 1px solid var(--edge); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--ink2); }
.chip button { border: 0; background: none; color: var(--soft); cursor: pointer; padding: 0; }

.jobs-label { margin-top: 6px; }
.jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.jobs li a { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; padding: 8px; border-radius: 10px; color: var(--ink); border: 1px solid transparent; }
.jobs li a:hover { background: var(--raised); }
.jobs li a.on { background: var(--raised); border-color: var(--edge); }
.thumb { width: 44px; height: 56px; border-radius: 6px; background: var(--raised2) center / cover no-repeat; border: 1px solid var(--edge); display: grid; place-items: center; color: var(--soft); font-size: 18px; }
.jt { font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.jm { display: flex; gap: 8px; align-items: center; margin-top: 3px; color: var(--soft); font-size: 12px; }

.status { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink2); }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--soft); }
.status.running::before { background: var(--blue-l); box-shadow: 0 0 0 0 rgba(94, 177, 255, 0.7); animation: pulse 1.6s infinite; }
.status.queued::before { background: var(--amber); }
.status.done::before { background: var(--green); }
.status.failed::before { background: var(--red); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(94, 177, 255, 0.6); } 70% { box-shadow: 0 0 0 7px rgba(94, 177, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(94, 177, 255, 0); } }

/* Empty state */
.empty { max-width: 640px; margin: 8vh auto 0; text-align: center; }
.empty h1 { font-family: var(--serif); font-weight: 400; font-size: 54px; line-height: 1.05; margin: 0 0 14px; }
.empty h1 i { color: var(--blue-l); }
.empty p { color: var(--ink2); }
.examples { display: grid; gap: 10px; margin-top: 26px; text-align: left; }
.example { background: var(--raised); border: 1px solid var(--edge); border-radius: 12px; padding: 12px 14px; cursor: pointer; color: var(--ink2); }
.example:hover { border-color: var(--blue); color: var(--ink); }
.example .mono { color: var(--blue-l); display: block; margin-bottom: 4px; }

/* Job view */
.jhead { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 18px; }
.jhead h1 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; margin: 0 0 8px; }
.meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--soft); font-size: 13px; align-items: center; }
/* Fixed columns: the screen's width comes from the frame shape, never from what's inside it. */
.stage { display: grid; grid-template-columns: min(400px, 42vh) minmax(0, 1fr); gap: 28px; align-items: start; }
.stage.wide { grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); }
.stage > * { min-width: 0; }
.screen { width: 100%; aspect-ratio: 9 / 16; background: #000; border: 1px solid var(--edge); border-radius: 16px; overflow: hidden; display: grid; place-items: center; }
.screen > * { width: 100%; height: 100%; min-height: 0; }
.screen video, .screen img { display: block; width: 100%; height: 100%; object-fit: contain; }
.screen .wait { padding: 24px; text-align: center; color: var(--ink2); display: grid; place-content: center; gap: 10px; }
.screen .wait .big { font-family: var(--serif); font-size: 28px; color: var(--ink); }
.screen .wait .note { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.prevtag { position: relative; }
.prevtag::after { content: 'PREVIEW · STILL RENDERING'; position: absolute; left: 12px; top: 12px; font: 500 10px var(--mono); letter-spacing: 0.14em; background: rgba(0, 0, 0, 0.7); padding: 4px 8px; border-radius: 6px; color: var(--ink2); }
.versions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.versions button { border: 1px solid var(--edge); background: transparent; color: var(--ink2); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-family: var(--mono); font-size: 12px; }
.versions button.on { border-color: var(--blue); color: var(--ink); background: rgba(23, 114, 231, 0.18); }
.versions a { margin-left: auto; font-size: 13px; }

/* The chat column: the feed scrolls in its own box, the composer stays under it. */
.feedcol { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.feed { display: flex; flex-direction: column; gap: 10px; min-width: 0; overflow-y: auto; overscroll-behavior: contain; max-height: 60vh; padding-right: 6px; scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
.feedwrap { position: relative; display: flex; flex-direction: column; min-height: 0; }
.latest { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); border: 1px solid var(--edge); background: var(--raised2); color: var(--ink); border-radius: 999px; padding: 4px 14px; font-size: 12px; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
.latest[hidden] { display: none; }
.bubble { border-radius: 12px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { background: rgba(23, 114, 231, 0.16); border: 1px solid rgba(94, 177, 255, 0.3); }
.bubble.claude { background: var(--raised); border: 1px solid var(--edge); }
.bubble.result { background: var(--raised); border: 1px solid var(--blue); }
.bubble.err { background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.4); color: #fecaca; }
.who { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--soft); margin-bottom: 3px; }
.steps { font-family: var(--mono); font-size: 12px; color: var(--soft); border-left: 2px solid var(--edge); padding: 2px 0 2px 12px; display: flex; flex-direction: column; gap: 2px; }
.steps div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps .bad { color: var(--red); }
.steps details summary { cursor: pointer; color: var(--ink2); list-style: none; }
.steps details summary::-webkit-details-marker { display: none; }
.vchip { align-self: flex-start; background: rgba(74, 222, 128, 0.1); border: 1px solid rgba(74, 222, 128, 0.4); color: #bbf7d0; border-radius: 999px; padding: 3px 12px; font-size: 13px; cursor: pointer; }
.composer { flex: none; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.composer .row { justify-content: flex-end; }
.note { color: var(--soft); font-size: 13px; }

/* Sign-in page */
body.signin { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.signin-card { width: min(100%, 420px); background: var(--raised); border: 1px solid var(--edge); border-radius: 18px; padding: 28px; }
.signin-card h1 { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.05; margin: 16px 0 14px; }
.signin-card h1 i { color: var(--blue-l); }
.signin-card ol { margin: 0 0 14px; padding-left: 20px; color: var(--ink2); display: grid; gap: 8px; }
.signin-card b { color: var(--ink); font-weight: 600; }
.signin-card code { font-family: var(--mono); background: var(--raised2); border: 1px solid var(--edge); border-radius: 6px; padding: 1px 6px; color: var(--ink); }
.signin-card .expired { color: #fecaca; background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.4); border-radius: 10px; padding: 8px 12px; margin: 0 0 14px; }
.signout { color: var(--soft); margin-left: 10px; }
.signin-btn { width: 100%; padding: 12px 18px; font-size: 16px; margin-bottom: 14px; }

/* Desktop: an app shell. The sidebar and main pane scroll on their own, never the page. */
@media (min-width: 821px) {
  .layout { height: calc(100dvh - 63px); min-height: 0; }
  .side, .main { overflow-y: auto; min-height: 0; }
}
/* Wide desktop: the job view fills the pane; the video stays put and only the chat scrolls. */
@media (min-width: 1101px) {
  body.has-job .main { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 20px; }
  body.has-job .stage { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  /* a 9:16 frame sized to the window height, so the whole video fits without scrolling */
  .stage:not(.wide) { grid-template-columns: min(400px, calc((100dvh - 270px) * 0.5625)) minmax(0, 1fr); }
  .stage > :first-child { overflow-y: auto; min-height: 0; }
  .feedwrap { flex: 1; }
  .feed { flex: 1; max-height: none; }
}
@media (max-width: 1100px) {
  .stage, .stage.wide { grid-template-columns: minmax(0, 1fr); }
  .stage:not(.wide) .screen { width: min(100%, 400px, 42vh); margin: 0 auto; }
  .stage:not(.wide) .versions { justify-content: center; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--edge); padding: 16px; }
  .jobs { max-height: 260px; }
  .main { padding: 20px 16px 40px; }
  body.has-job .main { order: -1; border-bottom: 1px solid var(--edge); } /* links from Slack open on the video */
  .jhead { flex-direction: column; }
  .empty h1 { font-size: 40px; }
  .machine { display: none; }
}
