/* chat.css — the Gemini-style AI design chat (24 Oct 2026). Mobile first (390px), one column, composer pinned. */
:root {
  --ink: #14181f; --ink-2: #4a5160; --ink-3: #7a8191; --line: #e6e8ee; --soft: #f4f5f8; --bg: #ffffff;
  --red: #d6202b; --red-ink: #b3141e; --ok: #127a43; --warn: #9a5b00;
  --r: 18px; --r-sm: 12px; --gutter: 16px; --maxw: 760px;
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { overflow: hidden; }
a { color: var(--red-ink); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #1a5fd6; outline-offset: 2px; border-radius: 8px; }
.ch-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ch { height: 100dvh; display: flex; flex-direction: column; }
.ch-top { display: flex; align-items: center; gap: 10px; padding: 10px var(--gutter); padding-top: max(10px, env(safe-area-inset-top)); border-bottom: 1px solid transparent; }
.ch[data-state="chat"] .ch-top { border-bottom-color: var(--line); }
.ch-back { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 50%; color: var(--ink); text-decoration: none; }
.ch-back:hover { background: var(--soft); }
.ch-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; flex: 1; }
.ch-mark { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(from 200deg, #d6202b, #ff7a59, #ffb000, #d6202b); box-shadow: inset 0 0 0 5px rgba(255,255,255,.35); }
.ch-new { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer; min-height: 40px; }
.ch-new:hover { background: var(--soft); }

.ch-main { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--gutter) 12px; scroll-behavior: smooth; }
.ch-hello { max-width: var(--maxw); margin: 0 auto; padding: 8vh 0 12px; }
.ch[data-state="chat"] .ch-hello { display: none; }
.ch-hi { margin: 0 0 6px; font-size: 18px; font-weight: 600; background: linear-gradient(90deg, #d6202b, #ff7a59 45%, #e0a100); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ch-hello h1 { margin: 0 0 10px; font-size: clamp(28px, 7.6vw, 40px); line-height: 1.1; letter-spacing: -.02em; font-weight: 600; }
.ch-sub { margin: 0 0 22px; color: var(--ink-2); font-size: 16px; line-height: 1.5; }
.ch-suggest { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ch-sug { text-align: left; border: 1px solid var(--line); background: var(--soft); border-radius: var(--r-sm); padding: 14px; min-height: 76px; font-size: 15px; line-height: 1.3; cursor: pointer; transition: background .15s, border-color .15s; }
.ch-sug:hover { background: #eceef3; border-color: #d6d9e1; }

.ch-log { max-width: var(--maxw); margin: 0 auto; display: flex; flex-direction: column; gap: 14px; padding-top: 14px; }
.ch-msg { display: flex; gap: 10px; align-items: flex-start; }
.ch-msg.user { justify-content: flex-end; }
.ch-msg.user .ch-text { background: var(--soft); border-radius: 20px 20px 6px 20px; padding: 10px 14px; max-width: 84%; white-space: pre-wrap; overflow-wrap: anywhere; }
.ch-msg.ai .ch-av { flex: 0 0 26px; height: 26px; border-radius: 50%; margin-top: 2px; background: conic-gradient(from 200deg, #d6202b, #ff7a59, #ffb000, #d6202b); box-shadow: inset 0 0 0 6px rgba(255,255,255,.4); }
.ch-msg.ai .ch-body { flex: 1; min-width: 0; }
.ch-msg.ai .ch-text { line-height: 1.55; font-size: 16px; overflow-wrap: anywhere; }
.ch-text p { margin: 0 0 8px; } .ch-text p:last-child { margin: 0; }
.ch-msg.err .ch-text { color: var(--red-ink); }
.ch-typing { display: inline-flex; gap: 5px; padding: 8px 0; }
.ch-slow { display: inline-block; margin-left: 10px; color: #6b7280; font-size: 14px; }
.ch-slow[hidden] { display: none; }
.ch-card-disc { display: block; color: #15803d; font-size: 12.5px; margin-top: 2px; }
.ch-typing i { width: 7px; height: 7px; border-radius: 50%; background: #b9bfcc; animation: chdot 1.1s infinite ease-in-out; }
.ch-typing i:nth-child(2) { animation-delay: .15s; } .ch-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chdot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.ch-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 0 36px; }
.ch-chip { border: 1px solid #d6d9e1; background: #fff; border-radius: 999px; padding: 9px 14px; min-height: 40px; font-size: 14px; cursor: pointer; }
.ch-chip:hover { background: var(--soft); }
.ch-chip.is-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.ch-chips.is-used { display: none; }

/* product cards */
.ch-cards { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 8px; margin: 4px 0 0 36px; }
.ch-card { flex: 0 0 min(250px, 78vw); scroll-snap-align: start; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.ch-card-img { aspect-ratio: 4 / 3; background: var(--soft); width: 100%; object-fit: contain; display: block; }
.ch-card-b { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.ch-card-name { font-weight: 600; font-size: 16px; }
.ch-card-opt { color: var(--ink-2); font-size: 14px; }
.ch-card-why { color: var(--ink-3); font-size: 13px; }
.ch-card-price { font-size: 15px; margin-top: 4px; } .ch-card-price strong { font-size: 19px; }
.ch-card-price small { color: var(--ink-3); }
.ch-card-ship { font-size: 13px; color: var(--ok); line-height: 1.35; }
.ch-card-go { margin-top: auto; border: 0; background: var(--red); color: #fff; border-radius: 999px; padding: 11px 14px; font-weight: 600; cursor: pointer; min-height: 44px; }
.ch-card-go:hover { background: var(--red-ink); }

/* designs */
.ch-designs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 0 36px; }
.ch-designs.n2 { grid-template-columns: repeat(2, 1fr); } .ch-designs.n4 { grid-template-columns: repeat(2, 1fr); }
.ch-design { border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.ch-design[aria-current="true"] { border-color: var(--red); box-shadow: 0 0 0 2px rgba(214,32,43,.2); }
.ch-design-art { border: 0; padding: 0; background: var(--soft); border-radius: 8px; cursor: zoom-in; display: block; width: 100%; }
.ch-design-art svg { display: block; width: 100%; height: auto; border-radius: 8px; }
.ch-design-use { border: 1px solid var(--ink); background: #fff; border-radius: 999px; padding: 7px 8px; font-size: 13px; font-weight: 600; cursor: pointer; min-height: 36px; }
.ch-design-use:hover, .ch-design[aria-current="true"] .ch-design-use { background: var(--ink); color: #fff; }
.ch-big { margin: 6px 0 0 36px; max-width: 330px; }
.ch-big .ch-design-art svg { max-height: 62vh; }
.ch-big-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ch-btn { border: 1px solid #d6d9e1; background: #fff; border-radius: 999px; padding: 10px 16px; font-weight: 600; cursor: pointer; min-height: 44px; font-size: 15px; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.ch-btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.ch-btn.primary:hover { background: var(--red-ink); }
.ch-btn[aria-disabled="true"] { opacity: .55; }

/* progress */
.ch-work { margin: 4px 0 0 36px; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; background: #fff; }
.ch-work-h { display: flex; justify-content: space-between; font-weight: 600; font-size: 15px; }
.ch-work-t { color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 500; }
.ch-work-s { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.ch-frames { display: flex; gap: 8px; margin-top: 12px; }
.ch-frames div { flex: 1; aspect-ratio: var(--ratio, 0.5); max-height: 200px; border-radius: 8px; background: linear-gradient(100deg, #eef0f4 30%, #f8f9fb 50%, #eef0f4 70%); background-size: 300% 100%; animation: chshim 1.4s infinite linear; }
@keyframes chshim { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* order card */
.ch-order { margin: 6px 0 0 36px; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; grid-template-columns: 92px 1fr; gap: 12px; background: #fff; }
.ch-order-art svg { width: 100%; height: auto; border-radius: 8px; display: block; }
.ch-order h3 { margin: 0 0 4px; font-size: 16px; }
.ch-order dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 14px; }
.ch-order dt { color: var(--ink-3); } .ch-order dd { margin: 0; }
.ch-order-actions { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.ch-order-note { grid-column: 1 / -1; font-size: 13px; color: var(--ink-3); margin: 0; }

/* composer */
.ch-compose { padding: 8px var(--gutter) max(10px, env(safe-area-inset-bottom)); background: linear-gradient(to top, #fff 75%, rgba(255,255,255,0)); }
.ch-box { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: flex-end; gap: 4px; border: 1px solid #d6d9e1; border-radius: 26px; padding: 6px 6px 6px 4px; background: #fff; box-shadow: 0 4px 18px rgba(20,24,31,.06); }
.ch-box:focus-within { border-color: #9aa1b0; }
.ch-box textarea { flex: 1; border: 0; outline: 0; resize: none; font: inherit; font-size: 16px; line-height: 1.4; padding: 9px 0; max-height: 140px; background: transparent; color: var(--ink); }
.ch-send { flex: 0 0 44px; height: 44px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ch-send.is-off { background: #c9cdd6; }
.ch-fine { max-width: var(--maxw); margin: 6px auto 0; text-align: center; font-size: 12px; color: var(--ink-3); }

.ch-zoom { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 92dvh; }
.ch-zoom::backdrop { background: rgba(10,12,16,.75); }
.ch-zoom-art svg { display: block; max-width: 92vw; max-height: 86dvh; width: auto; height: auto; border-radius: 10px; background: #fff; }
.ch-zoom-x { position: fixed; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; font-size: 26px; cursor: pointer; }
.ch-noscript { padding: 16px; }

/* logo / image upload (24 Oct, owner 23:34) */
.ch-attach { flex: 0 0 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ch-attach:hover { background: var(--soft); color: var(--ink); }
.ch-addlogo { margin-top: 12px; display: inline-flex; align-items: center; gap: 8px; border: 1px dashed #c3c8d2; background: #fff; border-radius: 999px; padding: 10px 16px; min-height: 44px; font-size: 14.5px; color: var(--ink-2); cursor: pointer; text-align: left; }
.ch-addlogo:hover { border-color: var(--ink-3); color: var(--ink); }
.ch-file { display: inline-flex; align-items: center; gap: 10px; background: var(--soft); border-radius: 18px 18px 6px 18px; padding: 6px 6px 6px 6px; max-width: 84%; }
.ch-file img { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; background: #fff linear-gradient(45deg, #eef0f4 25%, transparent 25%, transparent 75%, #eef0f4 75%) 0 0 / 12px 12px; border: 1px solid var(--line); }
.ch-file-l { font-size: 14px; font-weight: 600; padding-right: 2px; }
.ch-file-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--ink-3); cursor: pointer; }
.ch-file-x:hover { background: #e6e8ee; color: var(--ink); }
.ch-file.is-removed { opacity: .55; } .ch-file.is-removed img { filter: grayscale(1); }
/* 25 Oct: any file (PDF, AI, PSD, EPS, HEIC...) — name, size, upload progress; a file icon when there is no preview */
.ch-file-up { min-width: 0; }
.ch-file-thumb { flex: 0 0 56px; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 10px; background: #fff; border: 1px solid var(--line); color: var(--ink-3); overflow: hidden; }
.ch-file-thumb img { border: 0; border-radius: 0; }
.ch-file-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.ch-file-up .ch-file-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
.ch-file-s { font-size: 12.5px; color: var(--ink-3); }
.ch-file-bar { display: block; height: 4px; border-radius: 2px; background: #e6e8ee; overflow: hidden; width: 120px; max-width: 100%; }
.ch-file-bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width .25s; }
.ch-file[data-status="done"] .ch-file-bar, .ch-file[data-status="removed"] .ch-file-bar { display: none; }
.ch-file[data-status="failed"] .ch-file-s { color: #b42318; } .ch-file[data-status="failed"] .ch-file-bar { display: none; }
.ch-file[data-status="removed"] { opacity: .55; }
.ch-drop { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(255,255,255,.88); align-items: center; justify-content: center; padding: 24px; pointer-events: none; }
.ch-drop div { border: 2px dashed var(--red); border-radius: 22px; padding: 40px 28px; font-size: 18px; font-weight: 600; color: var(--red-ink); background: #fff; }
.ch.is-drag .ch-drop { display: flex; }

@media (min-width: 700px) {
  .ch-suggest { grid-template-columns: repeat(4, 1fr); }
  .ch-hello { padding-top: 14vh; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; scroll-behavior: auto !important; transition: none !important; } }
