/* imagebath: calm white, water and soap-bubble light, black pill buttons. Light and dark. */
:root {
  --bg: #ffffff; --side: #f7f8f8; --ink: #0d0d0d; --ink-2: #4b5257; --ink-3: #8a9196;
  --line: #e6e8ea; --soft: #f2f4f5; --pill: #f0f2f3; --btn: #0d0d0d; --btn-ink: #ffffff;
  --water: linear-gradient(135deg, #e3f4f1 0%, #d4ece9 40%, #e9f1fb 100%);
  --ring: rgba(13, 13, 13, .08); --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.06);
  --accent: #2b8a92; --bad: #b4232c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161819; --side: #101213; --ink: #f2f4f5; --ink-2: #bcc4c8; --ink-3: #848c91;
    --line: #2a2e30; --soft: #1f2224; --pill: #262a2c; --btn: #f2f4f5; --btn-ink: #0d0d0d;
    --water: linear-gradient(135deg, #12312e 0%, #15292c 50%, #182235 100%);
    --ring: rgba(255,255,255,.08); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35);
    --accent: #6cc6cd; --bad: #ff8a8f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161819; --side: #101213; --ink: #f2f4f5; --ink-2: #bcc4c8; --ink-3: #848c91;
  --line: #2a2e30; --soft: #1f2224; --pill: #262a2c; --btn: #f2f4f5; --btn-ink: #0d0d0d;
  --water: linear-gradient(135deg, #12312e 0%, #15292c 50%, #182235 100%);
  --ring: rgba(255,255,255,.08); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35);
  --accent: #6cc6cd; --bad: #ff8a8f; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; letter-spacing: -0.006em; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

/* sidebar */
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 12px 10px; min-height: 0; }
.side-top { padding: 4px 8px 14px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 650; font-size: 17px; letter-spacing: -0.02em; text-decoration: none; }
.new { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 10px; cursor: pointer; font-weight: 500; }
.new:hover, .baths a:hover { background: var(--soft); }
.side-h { margin: 18px 10px 6px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.baths { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.baths li.muted { padding: 4px 10px; }
.baths a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; text-decoration: none; font-size: 14px; }
.baths a.on { background: var(--soft); }
.baths a img, .baths .ph { width: 26px; height: 26px; border-radius: 7px; object-fit: cover; flex: none; background: var(--water); }
.baths a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { border-top: 1px solid var(--line); padding: 12px 8px 2px; display: grid; gap: 10px; font-size: 13px; }
.who { display: flex; justify-content: space-between; gap: 8px; }
.who a { font-weight: 600; text-decoration: none; }
.links { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--ink-3); }
.links a { text-decoration: none; }
.links a:hover { color: var(--ink); }
.scrim { display: none; }

/* main column */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; height: 54px; flex: none; }
.bar-t { font-weight: 600; font-size: 16px; }
.ib { border: 0; background: none; width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; cursor: pointer; color: var(--ink-2); }
.ib:hover { background: var(--soft); color: var(--ink); }
#menu { visibility: hidden; }
.scroll { flex: 1; overflow-y: auto; min-height: 0; padding: 0 16px; }
.msgs { list-style: none; margin: 0 auto; padding: 8px 0 32px; max-width: 760px; display: flex; flex-direction: column; gap: 26px; }

.hello { display: none; text-align: center; max-width: 640px; margin: 0 auto; padding: 0 0 18px; }
.hello-mark { margin: 0 auto 14px; width: 56px; height: 56px; }
.hello h1 { font-size: clamp(26px, 4vw, 34px); line-height: 1.15; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 8px; }
.hello-tag { margin: 0 0 6px; font-size: 18px; color: var(--ink); letter-spacing: -0.012em; }
.hello-p { color: var(--ink-3); margin: 0; font-size: 15px; }

/* empty chat: greeting and composer in the middle, ideas above the composer */
.is-empty .main { overflow-y: auto; }
.is-empty .scroll { flex: none; overflow: visible; margin-top: auto; }
.is-empty .hello { display: block; }
.is-empty .msgs { display: none; }
.is-empty .dock { margin-bottom: auto; }
.starters { display: none; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 4px 0 14px; }
.is-empty .starters { display: flex; }
.about-strip { display: none; max-width: 760px; margin: 0 auto; padding: 28px 16px 36px; color: var(--ink-3); font-size: 13px; }
.about-strip h2 { font-size: 13px; font-weight: 600; margin: 0 0 4px; color: var(--ink-2); }
.about-strip p { margin: 0 0 8px; }
.is-empty .about-strip { display: block; }
.is-empty .fine-dock { display: none; }

/* messages */
.msg-user { align-self: flex-end; max-width: 82%; display: grid; gap: 8px; justify-items: end; }
.u-pill { background: var(--pill); border-radius: 22px; padding: 10px 16px; white-space: pre-wrap; word-break: break-word; }
.u-thumbs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.u-thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; }
.msg-assistant { display: grid; grid-template-columns: 28px 1fr; gap: 14px; }
.a-mark { width: 28px; height: 28px; border-radius: 50%; background: url(/img/icon-192.png) center/cover; box-shadow: 0 0 0 1px var(--ring); margin-top: 1px; }
.a-body { min-width: 0; }
.a-body > p { margin: 3px 0 10px; }
.a-body > p:last-child { margin-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 7px 14px; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.chip:hover { background: var(--soft); color: var(--ink); }

.steps { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 9px; }
.st { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; }
.st-i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; margin-top: 2px; }
.st-done .st-i { background: var(--ink); color: var(--bg); }
.st-done .st-i svg { width: 12px; height: 12px; }
.st-fail .st-i { background: var(--bad); color: #fff; }
.st-fail .st-i svg { width: 11px; height: 11px; }
.st-t { display: block; }
.st-run .st-t { color: var(--ink-2); }
.st-n { display: block; color: var(--ink-3); font-size: 13.5px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }

/* the set */
.set { display: grid; gap: 10px; margin-top: 6px; }
.native { display: grid; grid-template-columns: minmax(0, 220px) 1fr; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 18px; padding: 10px; background: var(--bg); box-shadow: var(--shadow); max-width: 560px; }
.native img { border-radius: 11px; aspect-ratio: 1200/628; object-fit: cover; width: 100%; }
.native b { display: block; font-size: 16px; line-height: 1.25; letter-spacing: -0.015em; }
.native p { margin: 4px 0 8px; color: var(--ink-2); font-size: 14px; line-height: 1.4; }
.sp { display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 3px; }
.btn-sm { display: inline-block; background: var(--btn); color: var(--btn-ink); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; }
.row-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 12px; }
.row-h h3 { margin: 0; font-size: 14px; font-weight: 600; }
.row-h .muted { font-size: 13px; }
.carousel { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 12px; align-items: flex-start; scrollbar-width: thin; }
.fmt { flex: none; scroll-snap-align: start; border: 0; background: none; padding: 0; cursor: zoom-in; display: grid; gap: 6px; text-align: left; }
.fmt-img { display: block; height: auto; max-height: 190px; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px var(--ring), var(--shadow); background: var(--soft); }
.fmt-img img { width: 100%; height: 100%; object-fit: cover; }
.fmt-l { font-size: 13px; font-weight: 500; display: flex; gap: 6px; align-items: baseline; }
.fmt-l small { color: var(--ink-3); font-weight: 400; }
.vids .vid { flex: none; margin: 0; height: 240px; display: grid; grid-template-rows: 1fr auto; gap: 6px; scroll-snap-align: start; aspect-ratio: auto !important; }
.vid video, .vid-wait { height: 214px; width: auto; border-radius: 12px; background: #000; box-shadow: 0 0 0 1px var(--ring); }
.vid-wait { display: grid; place-items: center; width: 140px; background: var(--water); }
.vid figcaption { font-size: 13px; font-weight: 500; }
.opts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.opt { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; }
.opt b { font-weight: 600; font-size: 14px; line-height: 1.3; }
.opt span { color: var(--ink-3); font-size: 13px; line-height: 1.35; }
.opt.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--btn); color: var(--btn-ink); border: 1px solid var(--btn); border-radius: 999px; padding: 0 18px; height: 40px; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { opacity: .88; }
.btn-o { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-o:hover { background: var(--soft); opacity: 1; }
.fine { font-size: 12.5px; color: var(--ink-3); margin: 2px 0 0; }

/* composer */
.dock { flex: none; padding: 0 16px 10px; }
.composer { max-width: 760px; margin: 0 auto; background: var(--bg); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); padding: 8px; }
.composer:focus-within { border-color: color-mix(in srgb, var(--ink) 22%, var(--line)); }
.c-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: none; color: var(--ink); font: inherit; font-size: 16px; line-height: 24px; padding: 7px 4px; max-height: 220px; min-height: 38px; }
.composer textarea::placeholder { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach { border-radius: 50%; }
.send { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--btn); color: var(--btn-ink); display: grid; place-items: center; cursor: pointer; }
.send:disabled { opacity: .35; cursor: default; }
.is-busy .send { opacity: .35; }
.tray { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 4px 8px; }
.att { position: relative; }
.att img { width: 58px; height: 58px; object-fit: cover; border-radius: 12px; }
.att button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--bg); background: var(--ink); color: var(--bg); display: grid; place-items: center; padding: 0; cursor: pointer; }
.att button svg { width: 11px; height: 11px; }
.fine-dock { max-width: 760px; margin: 8px auto 0; text-align: center; font-size: 12px; color: var(--ink-3); }
.fine-dock a { color: inherit; }

/* drop overlay */
.drop { position: fixed; inset: 0; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(6px); z-index: 20; }
.drop > div { background: var(--water); border: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 28px; padding: 48px 56px; text-align: center; display: grid; gap: 6px; }
.drop b { font-size: 20px; font-weight: 600; }
.drop span { color: var(--ink-2); font-size: 14px; }
.is-drag .drop { display: grid; }

/* viewer */
.viewer { border: 0; border-radius: 18px; padding: 0; max-width: min(1100px, 94vw); max-height: 92vh; background: var(--bg); color: var(--ink); box-shadow: var(--shadow); }
.viewer::backdrop { background: rgba(0,0,0,.5); }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; font-weight: 500; }
.viewer-bar > span:last-child { display: flex; gap: 6px; align-items: center; }
.viewer img { max-width: 100%; max-height: calc(92vh - 64px); margin: 0 auto; padding: 0 16px 16px; object-fit: contain; }

/* phones */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30; transform: translateX(-100%); transition: transform .2s ease; }
  .side-open .side { transform: none; box-shadow: var(--shadow); }
  .side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 25; }
  #menu { visibility: visible; }
  .native { grid-template-columns: 1fr; }
  .msg-assistant { grid-template-columns: 1fr; gap: 6px; }
  .a-mark { width: 22px; height: 22px; }
  .fmt-img { height: 150px; }
  .composer textarea { font-size: 16px; }
}

/* static pages (about, privacy, terms, upload policy) */
.page { max-width: 720px; margin: 0 auto; padding: 24px 16px 64px; }
.page-top { display: flex; justify-content: space-between; align-items: center; padding: 6px 0 36px; }
.page h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.12; letter-spacing: -0.025em; font-weight: 600; margin: 0 0 14px; }
.page h2 { font-size: 19px; letter-spacing: -0.015em; margin: 32px 0 8px; font-weight: 600; }
.page p, .page li { color: var(--ink-2); }
.page .lede { font-size: 18px; color: var(--ink); }
.page .band { background: var(--water); border-radius: 22px; padding: 28px; margin: 26px 0; color: var(--ink); }
.page .band p { color: var(--ink); margin: 0; }
.page footer { margin-top: 56px; border-top: 1px solid var(--line); padding-top: 16px; font-size: 13px; color: var(--ink-3); display: flex; gap: 14px; flex-wrap: wrap; }
.page footer a { text-decoration: none; }
