/* The create chat (templates/create_chat.html, static/js/createchat.js): the AI-chat layout in the site's dark theme.
   A sidebar | one full-height column: a slim top row, the conversation (scrolls), the message box docked at the bottom.
   On a new chat (.is-empty) the greeting and the box sit together in the middle; on phones the box stays at the bottom.
   Colours, radii and type come from theme.css tokens; the only blue is an action (send, New build, Sign in, Export, Play). */

.cc-page { background: #0a0b0d; overflow: hidden; }

/* ---------------------------------------------------------------- BACKDROP + GLASS
   (the owner: the header's "transparent blur trick" on the sidebar). A flat black page would make a see-through sidebar
   look the same as a solid one, so the page gets a faint backdrop: one of our own build renders as a heavily blurred haze,
   a blue glow from the top and the landing's cartoon clouds low down, all very dim (the text sits on near-black). A fixed,
   transform-free layer behind everything; the sidebar floats over it as glass, inset from the window's edges. */
.cc-backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(60% 50% at 78% -6%, rgba(47, 123, 255, 0.20), transparent 70%),
              radial-gradient(45% 40% at 8% 105%, rgba(124, 108, 255, 0.10), transparent 70%), #0a0b0d; }
.cc-bd-haze { position: absolute; inset: -8%; width: 116%; height: 116%; max-width: none; object-fit: cover; opacity: 0.2; filter: blur(46px) saturate(1.25); }
.cc-bd-clouds { position: absolute; left: -4%; right: -4%; bottom: -2%; width: 108%; height: auto; max-width: none; opacity: 0.07; filter: blur(2px); }
.cc-backdrop::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(70% 80% at 60% 50%, rgba(10, 11, 13, 0.55), rgba(10, 11, 13, 0.2) 80%); }
.cc-app { position: relative; z-index: 1; }
.cc-page .app-grid-bg, .cc-page.app-page { background-color: #0a0b0d; }
@media (prefers-reduced-transparency: reduce) { .cc-bd-haze, .cc-bd-clouds { display: none; } }
.cc-page::after { display: none; }                 /* (no film grain over a reading surface) */
.cc-page .announce { display: none; }
.cc-app { height: 100vh; height: 100dvh; min-height: 0; }

/* ---------------------------------------------------------------- sidebar (the shell's, chat-flavoured) */
/* the sidebar: floating glass (a solid fallback where backdrop-filter isn't supported); New build and the plan card
   stay solid so they pop */
.cc-side { gap: 10px; padding: 12px 10px; top: 10px; height: calc(100vh - 20px); height: calc(100dvh - 20px); margin: 10px 0 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 16px; background: rgba(13, 14, 17, 0.94);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.04); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .cc-side { background: rgba(14, 15, 18, 0.46); -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3); }
}
.cc-side .app-plan { background: linear-gradient(180deg, rgba(47, 123, 255, 0.12), rgba(47, 123, 255, 0.03)), #121317; }
.cc-side .app-side-top { padding: 2px 2px 2px 6px; }
.cc-ghost-btn { border-color: transparent; background: transparent; }
html .cc-ghost-btn:hover, html .cc-ghost-btn:active { border-color: transparent; background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.cc-new { justify-content: flex-start; width: 100%; min-height: 44px; padding: 10px 14px; font-size: 0.95rem; }
.cc-links { display: grid; gap: 1px; }
.cc-link { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 7px 10px; border-radius: 10px; color: var(--ink-2);
  text-decoration: none; font-size: 0.9rem; font-weight: 500; }
.cc-link .i { width: 17px; height: 17px; flex: none; }
.cc-link:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.cc-history { flex: 1 1 auto; min-height: 60px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin: 0 -4px; padding: 0 4px; }
.cc-hgroup { margin: 14px 0 0; }
.cc-hgroup h2 { margin: 0 0 4px; padding: 0 10px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; color: var(--ink-3); line-height: 1.6; }
.cc-hgroup ul { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; margin: 0; padding: 0; list-style: none; }
.cc-hgroup li { min-width: 0; }
.cc-hitem { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 6px 10px; border-radius: 10px; color: var(--ink-2);
  text-decoration: none; font-size: 0.88rem; }
.cc-hitem:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.cc-hitem[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.09); }
.cc-hitem span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.cc-hitem small { flex: none; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; color: var(--ink-3); text-transform: uppercase; }
.cc-hitem .cc-live { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); flex: none; box-shadow: 0 0 8px var(--blue); }
.cc-history-empty { margin: 14px 10px 4px; font-size: 0.82rem; color: var(--ink-3); }
.cc-hcount { flex: none; font-style: normal; font-size: 0.72rem; font-weight: 600; color: var(--ink-3); }
.cc-hall { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin: 10px 0 4px; padding: 6px 10px; border-radius: 10px;
  color: var(--ink-3); text-decoration: none; font-size: 0.84rem; font-weight: 500; }
.cc-hall:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.cc-hall .i { width: 14px; height: 14px; }
.cc-plan { margin-top: 0; }
/* a closed sidebar is gone (not an icon rail): the chat column takes the whole width */
@media (min-width: 901px) {
  .side-min .cc-app { grid-template-columns: 0 minmax(0, 1fr); }
  /* (the shell paints its sidebar's colour as a stripe on .app: a closed chat sidebar has none, nor does the glass one) */
  .cc-app, .side-min .cc-app { background: none; }
  /* (the owner: "add a tween when i open the burger menu") the glass slides out of / back to the left edge while the
     chat column widens / narrows with it; it keeps its width the whole way, so nothing inside squashes */
  .cc-side { width: calc(var(--side-w) - 10px); }
  .side-min .cc-side { visibility: hidden; transform: translateX(calc(-100% - 14px)); opacity: 0; }
  .side-anim .cc-app { transition: grid-template-columns 0.34s var(--ease-out); }
  .side-anim .cc-side { transition: transform 0.34s var(--ease-out), opacity 0.22s ease, visibility 0s linear 0s; }
  .side-anim.side-min .cc-side { transition: transform 0.3s var(--ease-out), opacity 0.22s ease 0.06s, visibility 0s linear 0.3s; }
  .cc-top-new { display: none; }
  .side-min .cc-top-new { display: inline-grid; }
  /* the two top buttons a closed sidebar leaves come in softly */
  .side-anim.side-min .cc-top #app-side-toggle, .side-anim.side-min .cc-top-new { animation: cc-btn-in 0.3s var(--ease-out) both; }
}
@keyframes cc-btn-in { from { opacity: 0; transform: translateX(-8px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes cc-scrim-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .side-anim .cc-app, .side-anim .cc-side, .side-anim.side-min .cc-side { transition: none; }
  .side-anim.side-min .cc-top #app-side-toggle, .side-anim.side-min .cc-top-new { animation: none; }
}

/* ---------------------------------------------------------------- the main column */
.cc-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; height: 100dvh; }
/* the top row: no band at all (like the site header's transparent bar): the backdrop runs up behind it; the kind picker
   and the account button are small dark glass pills that read over anything. On a wide screen its row lines up with
   the sidebar's logo row (the glass sidebar starts 10px down: 10 + 1 + 12 + 22 = the logo row's centre, 45px) */
.cc-top { flex: none; display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 12px; background: none; border: 0; box-shadow: none; }
@media (min-width: 901px) { .cc-top { box-sizing: content-box; padding: 17px 16px 0; } }
.cc-kind-btn, .cc-page .cc-top .avatar-btn, .cc-page .cc-top #header-login { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.cc-kind-btn { background: rgba(10, 10, 12, 0.5); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--r-pill); padding: 6px 14px 6px 16px; }
.cc-kind-btn[aria-expanded="true"] { background: rgba(22, 23, 27, 0.6); }
.cc-page .cc-top .avatar-btn { background: rgba(10, 10, 12, 0.5); border: 1px solid rgba(255, 255, 255, 0.08); }
.cc-page .cc-top .avatar-btn:hover { background: rgba(10, 10, 12, 0.5); border-color: rgba(255, 255, 255, 0.08); }
/* the account button: a circle the size of the other top buttons (the name it has elsewhere is hidden here) */
.cc-page .cc-top .avatar-btn { box-sizing: border-box; flex: none; display: inline-grid; place-items: center; gap: 0; width: 38px; height: 38px;
  min-height: 0; padding: 0; border-radius: 50%; }
.cc-page .cc-top .avatar-btn .name { display: none; }
.cc-page .cc-top .avatar-btn .avatar { width: 30px; height: 30px; }
@media (max-width: 900px) {
  .cc-page .cc-top .avatar-btn { width: 44px; height: 44px; }
  .cc-page .cc-top .avatar-btn .avatar { width: 34px; height: 34px; }
}
/* the top-left set: the two icon buttons identical (38px circles, 18px icons, optically centred) and the Auto pill the
   same height and glass, 8px apart, one line with the sidebar's logo row. Hover / press: scale only (the site rule) */
.cc-top { gap: 8px; }
.cc-tbtn { flex: none; display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; margin: 0; border-radius: var(--r-pill);
  background: rgba(10, 10, 12, 0.5); border: 1px solid rgba(255, 255, 255, 0.08); color: var(--ink-2); cursor: pointer; text-decoration: none;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: transform 0.14s var(--ease); }
.cc-tbtn .i { display: block; width: 18px; height: 18px; stroke-width: 2; }
.cc-tbtn:hover { color: var(--ink-2); transform: scale(0.95); }
.cc-tbtn:active { transform: scale(0.9); transition-duration: 0.06s; }
.cc-kind-btn { height: 38px; min-height: 38px; padding: 0 14px 0 16px; font-size: 1rem; transition: transform 0.14s var(--ease); }
.cc-kind-btn:hover { transform: scale(0.95); }
.cc-kind-btn:active { transform: scale(0.9); }
@media (prefers-reduced-motion: reduce) { .cc-tbtn:hover, .cc-tbtn:active, .cc-kind-btn:hover, .cc-kind-btn:active { transform: none; } }
.cc-top-right { margin-left: auto; }
.side-min .cc-top #app-side-toggle, .cc-top #app-side-toggle { flex: none; }
@media (min-width: 901px) { html:not(.side-min) .cc-top #app-side-toggle { display: none; } }
.cc-col { width: 100%; max-width: 800px; margin: 0 auto; padding: 0 20px; }

/* signed out, the account slot's Sign in is an action: the glossy blue (app.js draws it as a dark button elsewhere) */
.cc-page #header-login, .cc-page #header-login:hover, .cc-page #header-login:active { color: #fff; background: var(--grad-blue); border: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -1px 0 rgba(0, 0, 0, 0.18), var(--glow-blue); }
/* the kind picker (the top row's "model" menu) */
.cc-kind { position: relative; }
.cc-kind-btn { display: inline-flex; align-items: center; gap: 6px; box-sizing: border-box;
  color: var(--ink); font: inherit; font-size: 1.05rem; font-weight: 600; cursor: pointer; }
.cc-kind-btn .i { width: 16px; height: 16px; color: var(--ink-3); }
.cc-kind-guess { font-weight: 500; color: var(--ink-3); font-size: 0.95rem; }
.cc-kind-guess:empty { display: none; }
.cc-menu { position: absolute; z-index: 40; min-width: 260px; padding: 6px; border-radius: 16px; background: #18191c; border: 1px solid var(--line-2);
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.9); }
.cc-kind-menu { top: calc(100% + 6px); left: 0; }
.cc-menu button { display: grid; gap: 1px; width: 100%; padding: 9px 36px 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink);
  text-align: left; font: inherit; cursor: pointer; position: relative; min-height: 44px; }
.cc-menu button:hover, .cc-menu button:focus-visible { background: rgba(255, 255, 255, 0.06); outline: none; }
.cc-menu button b { font-weight: 600; font-size: 0.95rem; }
.cc-menu button span { font-size: 0.8rem; color: var(--ink-3); }
.cc-menu button[aria-checked="true"]::after { content: ""; position: absolute; right: 14px; top: 50%; width: 9px; height: 5px; margin-top: -4px;
  border: solid var(--ink); border-width: 0 0 2px 2px; transform: rotate(-45deg); }

/* ---------------------------------------------------------------- conversation */
.cc-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.cc-thread { display: grid; gap: 26px; margin: 0; padding: 18px 0 28px; list-style: none; }
.cc-hello { text-align: center; padding: 0 0 22px; }
.cc-hello-title { margin: 0; font-size: clamp(1.6rem, 3.2vw, 2.1rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; color: var(--ink); }
.cc-main:not(.is-empty) .cc-hello { display: none; }
.cc-main.is-empty .cc-thread { display: none; }
/* a new chat: the greeting just above the middle, the box right under it */
.cc-main.is-empty .cc-scroll { display: flex; flex-direction: column; justify-content: flex-end; flex: 1 1 0; overflow: hidden; }
.cc-main.is-empty .cc-dock { flex: 1 1 0; padding-top: 0; }
.cc-main:not(.is-empty) .cc-starters { display: none; }

/* the empty state's templates (under the box): real builds as cards, 2 columns in the 800px column, 1 on phones.
   On a wide screen the whole new chat scrolls as one page: the greeting, the box, the chips, the line, then the cards
   (.cc-scroll and its column fold into .cc-main with display: contents, so the box can sit between them) */
.cc-templates { display: none; }
.cc-main.is-empty .cc-templates { display: block; }
.cc-templates-title { margin: 0 0 14px; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-3); }
.cc-tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.cc-tpl { display: grid; width: 100%; height: 100%; padding: 0; overflow: hidden; border-radius: 18px; border: 1px solid var(--line); background: #141518;
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.cc-tpl:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.cc-tpl-pic { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #0b0b0d; }
.cc-tpl-pic img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.45s var(--ease-out); }
.cc-tpl:hover .cc-tpl-pic img { transform: scale(1.05); }
.cc-tpl-body { display: grid; gap: 4px; padding: 12px 14px 14px; align-content: start; }
.cc-tpl-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.cc-tpl-head b { font-weight: 600; font-size: 0.98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-tpl-kind { flex: none; margin-left: auto; padding: 1px 8px; border-radius: var(--r-pill); border: 1px solid var(--line-2); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.cc-tpl-line { font-size: 0.86rem; color: var(--ink-3); line-height: 1.4; }
.cc-tpl-go { justify-self: start; margin-top: 8px; min-height: 32px; font-size: 0.84rem; }
@media (min-width: 901px) {
  .cc-main.is-empty { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .cc-main.is-empty .cc-top { position: sticky; top: 0; z-index: 30; }
  .cc-main.is-empty .cc-scroll, .cc-main.is-empty .cc-scroll > .cc-col { display: contents; }
  .cc-main.is-empty .cc-hello { order: 1; width: 100%; max-width: 800px; margin: 0 auto; padding: clamp(40px, calc(30vh - 90px), 220px) 20px 22px; }
  .cc-main.is-empty .cc-dock { order: 2; flex: none; padding-bottom: 0; background: none; }
  .cc-main.is-empty .cc-templates { order: 3; width: 100%; max-width: 800px; margin: 0 auto; padding: 44px 20px 56px; }
}
@media (max-width: 900px) {
  .cc-tpl-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .cc-main.is-empty .cc-scroll { overflow-y: auto; }
  .cc-main.is-empty .cc-templates { padding: 8px 0 20px; }
  .cc-tpl-go { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) { .cc-tpl-pic img { transition: none; } .cc-tpl:hover .cc-tpl-pic img { transform: none; } }

.cc-msg { display: flex; gap: 14px; min-width: 0; animation: cc-in 0.28s var(--ease-out) both; }
@keyframes cc-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cc-user { justify-content: flex-end; }
.cc-bubble { max-width: min(80%, 560px); padding: 10px 16px; border-radius: 22px; background: #26272b; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.cc-bubble.is-long { max-height: 14.5em; overflow: hidden; position: relative; }
.cc-bubble.is-long::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3em; background: linear-gradient(transparent, #26272b); }
.cc-more { display: block; margin: 6px 6px 0 auto; padding: 4px 8px; border: 0; background: none; color: var(--ink-3); font: inherit; font-size: 0.82rem; cursor: pointer; }
.cc-more:hover { color: var(--ink); }
.cc-user-wrap { display: grid; justify-items: end; max-width: 100%; }
.cc-avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #17181b; border: 1px solid var(--line-2); margin-top: 1px; }
.cc-avatar img { width: 20px; height: 20px; }
.cc-reply { flex: 1; min-width: 0; display: grid; gap: 12px; padding-top: 4px; line-height: 1.6; }
.cc-reply p { margin: 0; }
.cc-why { color: var(--ink); }
.cc-switch { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 0.85rem; color: var(--ink-3); }
.cc-switch button { min-height: 32px; padding: 4px 12px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: transparent;
  color: var(--ink-2); font: inherit; font-size: 0.85rem; cursor: pointer; }
.cc-switch button:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.cc-step { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 0.95rem; }
.cc-step-text { background: linear-gradient(90deg, var(--ink-3) 0%, #fff 50%, var(--ink-3) 100%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: cc-shine 2.2s linear infinite; }
@keyframes cc-shine { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.cc-step small { color: var(--ink-3); font-size: 0.82rem; white-space: nowrap; }
.cc-bar { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; max-width: 420px; }
.cc-bar > i { display: block; height: 100%; width: var(--p, 2%); min-width: 2%; border-radius: inherit; background: linear-gradient(90deg, #1d6bff, #6aa6ff);
  transition: width 0.6s var(--ease-out); }
.cc-note { font-size: 0.88rem; color: var(--ink-3); }
.cc-error { color: var(--ink); }
.cc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cc-row .btn { min-height: 44px; }
.cc-ts { min-height: 66px; }

/* the result card */
.cc-card { display: grid; overflow: hidden; border-radius: 18px; border: 1px solid var(--line-2); background: #141518; max-width: 640px; }
.cc-shot { display: block; position: relative; aspect-ratio: 16 / 9; background: #0b0b0d; }
.cc-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cc-shot.is-ui img { object-fit: contain; }
.cc-thumbs { display: flex; gap: 6px; padding: 8px 10px 0; overflow-x: auto; scrollbar-width: thin; }
.cc-thumbs button { flex: none; width: 64px; height: 40px; padding: 0; border-radius: 8px; border: 1px solid var(--line-2); overflow: hidden; background: #0b0b0d; cursor: pointer; opacity: 0.7; }
.cc-thumbs button[aria-pressed="true"], .cc-thumbs button:hover { opacity: 1; border-color: rgba(255, 255, 255, 0.5); }
.cc-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cc-card-body { display: grid; gap: 10px; padding: 12px 14px 14px; }
.cc-card-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.cc-card-head b { font-weight: 600; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-card-head small { flex: none; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }

/* ---------------------------------------------------------------- the message box */
.cc-dock { flex: none; padding: 6px 0 calc(10px + env(safe-area-inset-bottom, 0px)); background: none; }
/* (no band behind the box over the backdrop: the conversation fades out at its bottom edge instead) */
.cc-main:not(.is-empty) .cc-scroll { -webkit-mask-image: linear-gradient(#000 calc(100% - 26px), transparent); mask-image: linear-gradient(#000 calc(100% - 26px), transparent); }
.cc-box { position: relative; display: grid; gap: 2px; padding: 10px 10px 8px; border-radius: 26px; background: #1b1c20; border: 1px solid var(--line-2);
  box-shadow: 0 10px 40px -18px rgba(0, 0, 0, 0.9); transition: border-color 0.2s; }
.cc-box:focus-within { border-color: rgba(255, 255, 255, 0.22); }
.cc-box textarea { display: block; width: 100%; min-height: 26px; max-height: calc(1.5em * 8 + 12px); resize: none; padding: 6px 10px; border: 0; background: transparent;
  color: var(--ink); font: inherit; font-size: 1rem; line-height: 1.5; overflow-y: auto; }
.cc-box textarea:focus { outline: none; }
.cc-box textarea::placeholder { color: var(--ink-3); }
.cc-box-foot { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.cc-round { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2);
  background: transparent; color: var(--ink-2); cursor: pointer; flex: none; transition: transform 0.14s var(--ease); }
.cc-round:hover { transform: scale(0.95); color: var(--ink); }
.cc-round:active { transform: scale(0.9); }
.cc-round .i { width: 20px; height: 20px; }
.cc-plus[aria-expanded="true"] { background: rgba(255, 255, 255, 0.08); color: #fff; }
.cc-plus[aria-expanded="true"] .i { transform: rotate(45deg); }
.cc-plus .i { transition: transform 0.2s var(--ease); }
.cc-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 2px #1b1c20; }
.cc-opts-said { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; color: var(--ink-3); }
.cc-count { font-size: 0.78rem; color: var(--ink-3); }
.cc-send { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50% !important; flex: none; }
.cc-send .i { width: 19px; height: 19px; }
.cc-send .cc-stop-i { display: none; }
.cc-send.is-stop .cc-send-i { display: none; }
.cc-send.is-stop .cc-stop-i { display: block; }
.cc-send[disabled] { opacity: 1; }
/* Stop pressed: the button waits for the server (cancel.py) */
.cc-send.is-stopping { opacity: 0.55; cursor: progress; }
.cc-stopped { display: grid; gap: 10px; }
.cc-stopped .cc-note { color: var(--ink-2); }
.cc-fine { margin: 8px 0 0; text-align: center; font-size: 0.75rem; color: var(--ink-3); line-height: 1.4; min-height: 1.05em; }
.cc-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0 0; }
.cc-starter { min-height: 40px; font-size: 0.88rem; }
.cc-send.go-pulse { animation: go-pulse 1.2s var(--ease) 2; }

/* attachments over the text */
.cc-attach { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 4px 6px; }
.cc-file { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 6px 6px 8px; border-radius: 14px; background: #26272b; border: 1px solid var(--line); font-size: 0.84rem; }
.cc-file img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }
.cc-file .i { width: 18px; height: 18px; color: var(--ink-2); }
.cc-file span { display: grid; min-width: 0; line-height: 1.3; }
.cc-file b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.cc-file small { color: var(--ink-3); }
.cc-file button { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; }
.cc-file button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

/* the + sheet: opens upward from the box */
.cc-sheet { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 45; width: min(440px, 100%); max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px; border-radius: 20px; background: #18191c; border: 1px solid var(--line-2); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.95); scrollbar-width: thin; }
.cc-sheet.is-down { bottom: auto; top: calc(100% + 8px); }
/* the pop-up menus (createchat.js pop()): grow from their button on the way in, a quick fade on the way out */
.cc-kind-menu { transform-origin: 24px 0; }
.cc-sheet { transform-origin: 22px 100%; }
.cc-sheet.is-down { transform-origin: 22px 0; }
.cc-menu:not([hidden]), .cc-sheet:not([hidden]) { animation: cc-pop-in 0.2s var(--ease-out) both; }
.cc-menu.is-closing, .cc-sheet.is-closing { animation: cc-pop-out 0.14s ease-in both; pointer-events: none; }
.cc-sheet:not(.is-down):not(.is-closing):not([hidden]) { animation-name: cc-pop-up; }
@keyframes cc-pop-in { from { opacity: 0; transform: translateY(-6px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes cc-pop-up { from { opacity: 0; transform: translateY(6px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes cc-pop-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(0.97); } }
@media (prefers-reduced-motion: reduce) { .cc-menu, .cc-sheet { animation: none !important; } }
.cc-sheet-acts { display: grid; gap: 2px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.cc-act { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 12px; background: transparent;
  color: var(--ink); font: inherit; font-size: 0.94rem; text-align: left; cursor: pointer; }
.cc-act:hover, .cc-act:focus-visible { background: rgba(255, 255, 255, 0.06); outline: none; }
.cc-act .i { width: 19px; height: 19px; color: var(--ink-2); flex: none; }
.cc-act small { margin-left: auto; color: var(--ink-3); font-size: 0.78rem; }
.cc-sheet-tabs { display: flex; gap: 4px; padding: 2px 2px 8px; overflow-x: auto; }
.cc-sheet-tab { min-height: 36px; padding: 6px 12px; border-radius: var(--r-pill); border: 1px solid transparent; background: transparent; color: var(--ink-3);
  font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cc-sheet-tab:hover { color: var(--ink); }
.cc-sheet-tab[aria-selected="true"] { color: var(--ink); background: rgba(255, 255, 255, 0.08); border-color: var(--line-2); }
.cc-opts { display: grid; gap: 14px; padding: 4px 6px 8px; }
.cc-opt { display: grid; gap: 6px; }
.cc-opt-label { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.cc-opt-note { margin: 0; font-size: 0.76rem; color: var(--ink-3); line-height: 1.4; }
.cc-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.cc-seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 5px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: transparent; color: var(--ink-2); font: inherit; font-size: 0.86rem; cursor: pointer; }
.cc-seg button:hover { color: #fff; border-color: rgba(255, 255, 255, 0.28); }
.cc-seg button[aria-pressed="true"] { color: #fff; background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.35); }
.cc-seg button.is-locked { color: var(--ink-3); }
.cc-seg button .i { width: 13px; height: 13px; }
.cc-select { width: 100%; min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: #111214; color: var(--ink); font: inherit; font-size: 0.9rem; }
.cc-select:focus { outline: none; border-color: rgba(255, 255, 255, 0.35); }

.cc-starter-phone { display: none; }
@media (max-width: 900px) { .cc-starter-phone { display: inline-flex; } }

/* ---------------------------------------------------------------- phones */
@media (max-width: 900px) {
  /* the drawer: the same glass, inset, over a dimmed blurred scrim */
  .cc-side { inset: 8px auto 8px 8px; height: auto; margin: 0; width: min(84vw, 320px); transform: translateX(calc(-100% - 16px)); }
  .side-open .cc-side { transform: none; }
  .side-anim .cc-side { transition: transform 0.34s var(--ease-out); }
  .cc-page .app-scrim { background: rgba(4, 5, 7, 0.5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .side-anim.side-open .app-scrim { animation: cc-scrim-in 0.3s ease both; }
  .cc-top { height: 52px; padding: 0 8px; }
  .cc-top-new { display: inline-grid; }
  .cc-col { padding: 0 14px; }
  .cc-thread { gap: 22px; padding-top: 10px; }
  .cc-avatar { display: none; }
  .cc-bubble { max-width: 88%; }
  /* a new chat on a phone: the greeting in the middle, the box at the bottom (thumb reach, above the keyboard) */
  /* (the greeting, then the templates under it, scrolling above the box) */
  .cc-main.is-empty .cc-scroll { justify-content: flex-start; flex: 1 1 auto; }
  .cc-main.is-empty .cc-hello { padding: clamp(28px, 14vh, 140px) 0 26px; }
  .cc-main.is-empty .cc-dock { flex: none; }
  .cc-main.is-empty .cc-dock .cc-col { display: flex; flex-direction: column; }
  .cc-main.is-empty .cc-starters { order: -1; margin: 0 0 10px; justify-content: center; flex-wrap: nowrap; overflow: hidden; padding-bottom: 2px; }
  .cc-main.is-empty .cc-starters { gap: 6px; }
  .cc-starter { flex: none; min-height: 36px; padding: 6px 12px; font-size: 0.82rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* (the owner: "do 2-3 game chips whatever fits") a phone shows its own random game ideas (pages.chat_ideas "phone"),
     as many as fit the line (createchat.js fitChips marks the rest .is-over), never a cut-off chip */
  .cc-starter:not(.cc-starter-phone), .cc-starter.is-over { display: none; }
  /* the templates: a row to swipe (one card and a peek of the next), not a tall column under the box */
  .cc-main.is-empty .cc-hello { padding: clamp(20px, 9vh, 90px) 0 20px; }
  .cc-templates-title { margin-bottom: 10px; }
  .cc-tpl-grid { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none;
    margin: 0 -14px; padding: 0 14px 6px; scroll-padding: 0 14px; }
  .cc-tpl-grid::-webkit-scrollbar { display: none; }
  .cc-tpl-grid > li { flex: 0 0 min(76%, 300px); scroll-snap-align: start; }
  .cc-tpl { border-radius: 16px; }
  .cc-tpl-body { padding: 10px 12px 12px; }
  .cc-tpl-line { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .cc-tpl-go { margin-top: 6px; }
  /* what scrolls fades out above the box instead of being cut off */
  .cc-main.is-empty .cc-scroll { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }
  .cc-box { border-radius: 24px; }
  .cc-box textarea { font-size: 16px; }            /* (no zoom on focus in iOS) */
  .cc-round, .cc-send { width: 44px; height: 44px; min-height: 44px; }
  .cc-sheet { width: 100%; max-height: 62vh; }
  .cc-fine { font-size: 0.72rem; }
  .cc-kind-btn { height: 44px; min-height: 44px; }
  .cc-tbtn { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .cc-msg { animation: none; }
  .cc-step-text { animation: none; color: var(--ink-2); background: none; }
  .cc-round:hover, .cc-round:active { transform: none; }
}
