/* BeeNet Chat: the same look as the website and the console. One honey accent;
   10px for controls, 16px for panels. */
:root {
  --bg: #f6f7f8; --card: #ffffff; --ink: #14161a; --muted: #565c64; --line: #dfe2e6;
  --accent: #f2b01e; --accent-ink: #14161a; --accent-text: #7a5000; --good: #16803c; --bad: #b42318;
  --radius: 16px; --radius-s: 10px; --side: 288px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0d0e11; --card: #15171b; --ink: #ecedef; --muted: #9ba1a9; --line: #272b31; --accent-text: #f2b01e; --good: #4ade80; --bad: #f87171; }
}
:root[data-theme="dark"] { --bg: #0d0e11; --card: #15171b; --ink: #ecedef; --muted: #9ba1a9; --line: #272b31; --accent-text: #f2b01e; --good: #4ade80; --bad: #f87171; }
* { box-sizing: border-box; }
html { font: 15px/1.55 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
body { margin: 0; background: var(--bg); color: var(--ink); height: 100dvh; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 7px 14px; transition: background .15s, transform .1s; }
.btn:hover { background: var(--bg); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(.96); background: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 2px 4px; color: var(--muted); }
.link:hover { color: var(--ink); }
input[type="text"], input[type="password"], input[type="search"], select, textarea { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 11px; }
.muted { color: var(--muted); }
.msg.bad, .err { color: var(--bad); }
.msg { margin: 8px 0 0; min-height: 1.4em; }

/* sign in */
.start { max-width: 520px; margin: 0 auto; padding: 8vh 16px 32px; height: 100dvh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-bottom: 20px; }
.brand img { width: 30px; height: 30px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 12px 0; }
.panel h2 { font-size: 16px; margin: 0 0 8px; }
.panel p { margin: 6px 0; }
.panel input { width: 100%; margin: 8px 0; }
.note { border-left: 3px solid var(--accent); padding: 6px 12px; margin: 12px 0; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* the app */
.shell { display: grid; grid-template-columns: var(--side) 1fr; height: 100dvh; }
.side { background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side .top { padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 8px; }
.side .brand { margin: 0 0 4px; font-size: 16px; }
.side .brand img { width: 24px; height: 24px; }
.side input[type="search"] { width: 100%; }
.convs { flex: 1; overflow-y: auto; padding: 4px 8px; min-height: 0; }
.convs h3 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 6px 4px; }
.conv { display: flex; align-items: center; gap: 2px; border-radius: var(--radius-s); }
.conv:hover, .conv.on { background: var(--bg); }
.conv .title { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 8px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.on .title { font-weight: 600; }
.conv .acts { display: none; }
.conv:hover .acts, .conv:focus-within .acts { display: flex; }
.conv .acts button { font-size: 12px; padding: 4px 5px; }
.side .foot { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.side .foot .who { display: flex; justify-content: space-between; gap: 8px; }
.side .foot .bal { font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.bar .menu { display: none; }
.bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.log { flex: 1; overflow-y: auto; padding: 20px 16px; min-height: 0; }
.log .inner { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.empty { max-width: 820px; margin: 12vh auto 0; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 22px; margin: 0 0 6px; letter-spacing: -.3px; }
.empty .tips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.msgrow { display: flex; flex-direction: column; gap: 4px; }
.msgrow.user { align-items: flex-end; }
.bubble { max-width: 100%; word-break: break-word; }
.msgrow.user .bubble { background: var(--accent); color: var(--accent-ink); border-radius: var(--radius); padding: 9px 14px; max-width: 85%; white-space: pre-wrap; }
.msgrow.assistant .bubble { padding: 2px 0; }
.bubble p { margin: 0 0 10px; white-space: pre-wrap; }
.bubble > :last-child { margin-bottom: 0; }
.bubble h3, .bubble h4 { margin: 14px 0 6px; font-size: 15px; }
.bubble ul, .bubble ol { margin: 4px 0 10px; padding-left: 24px; }
.bubble blockquote { margin: 6px 0 10px; padding: 2px 12px; border-left: 3px solid var(--line); color: var(--muted); }
.bubble table { border-collapse: collapse; margin: 6px 0 10px; display: block; overflow-x: auto; }
.bubble th, .bubble td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.bubble pre { position: relative; margin: 8px 0; padding: 12px 14px; overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-s); }
.bubble pre .copy { position: absolute; top: 6px; right: 6px; font-size: 12px; padding: 2px 8px; }
.bubble code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.bubble :not(pre) > code { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.bubble img, .bubble video { max-width: 100%; max-height: 70vh; border-radius: var(--radius-s); border: 1px solid var(--line); display: block; }
.bubble .wait { color: var(--muted); }
.meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.meta button { font-size: 12px; }

.composer { padding: 8px 16px 14px; }
.composer .box { max-width: 820px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.composer textarea { width: 100%; border: 0; background: none; resize: none; padding: 4px; max-height: 40vh; display: block; }
.composer textarea:focus { outline: none; }
.composer .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.composer .tools .grow { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.seg button { background: none; border: 0; padding: 5px 12px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.composer .hint { max-width: 820px; margin: 6px auto 0; font-size: 12px; color: var(--muted); text-align: center; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); padding: 18px; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { margin: 0 0 10px; font-size: 16px; }
dialog label { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
dialog textarea, dialog input { width: 100%; }
dialog .row { justify-content: flex-end; margin-top: 14px; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(var(--side), 86vw); z-index: 5; transform: translateX(-100%); transition: transform .2s; }
  .shell.open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .bar .menu { display: inline-block; }
  .conv .acts { display: flex; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.convs > p { padding: 0 8px; }
.btn { text-decoration: none; color: inherit; display: inline-block; }

/* picture and video progress */
.gen { width: min(100%, 460px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); display: flex; flex-direction: column; }
.gen.image { aspect-ratio: 1 / 1; }
.gen.video { width: min(100%, 560px); aspect-ratio: 16 / 9; }
.gen-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 12px; text-align: center;
  background: linear-gradient(110deg, var(--card) 30%, var(--bg) 50%, var(--card) 70%); background-size: 200% 100%; animation: shimmer 2.2s linear infinite; }
.gen-what { font-weight: 600; }
.gen-note { font-size: 13px; color: var(--muted); }
.gen progress { width: 100%; height: 6px; display: block; appearance: none; border: 0; background: var(--line); }
.gen progress::-webkit-progress-bar { background: var(--line); }
.gen progress::-webkit-progress-value { background: var(--accent); transition: width .4s; }
.gen progress::-moz-progress-bar { background: var(--accent); }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .gen-body { animation: none; } }

.btn.think[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.bubble .thought { margin: 0 0 8px; color: var(--muted); font-size: .92em; }
.bubble .thought summary { cursor: pointer; }
.bubble .thought-text { white-space: pre-wrap; margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--line); }

.bubble .sources { margin-top: 8px; font-size: .85em; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.bubble .sources a { color: inherit; text-decoration: underline; max-width: 22em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.secret-note { margin-top: 8px; font-size: 12px; color: var(--muted, #6b7280); }

.wallet-note { font-size: 12px; color: var(--muted); }


.svg-art { margin: 8px 0; max-width: 520px; }
.svg-art img { display: block; width: 100%; max-height: 480px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.svg-acts { display: flex; gap: 12px; margin-top: 4px; }

/* code blocks, as the well-known chat apps draw them */
:root { --tok-k: #8a3fb5; --tok-s: #1a7f37; --tok-c: #6e7781; --tok-n: #b35900; --tok-f: #0b5fb0; --tok-t: #a3306b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tok-k: #d2a8ff; --tok-s: #7ee787; --tok-c: #8b949e; --tok-n: #ffa657; --tok-f: #79c0ff; --tok-t: #ff9bce; } }
:root[data-theme="dark"] { --tok-k: #d2a8ff; --tok-s: #7ee787; --tok-c: #8b949e; --tok-n: #ffa657; --tok-f: #79c0ff; --tok-t: #ff9bce; }
.tok-k { color: var(--tok-k); } .tok-s { color: var(--tok-s); } .tok-c { color: var(--tok-c); font-style: italic; }
.tok-n { color: var(--tok-n); } .tok-f { color: var(--tok-f); } .tok-t { color: var(--tok-t); }
.codeblock { margin: 8px 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.code-head { display: flex; align-items: center; gap: 12px; padding: 4px 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.code-lang { font-family: ui-monospace, Consolas, monospace; }
.codeblock pre { margin: 0; border: 0; border-radius: 0; background: transparent; }
.codeblock pre.wrap code { white-space: pre-wrap; word-break: break-word; }
.code-preview { border-top: 1px solid var(--line); background: #fff; }
.code-preview iframe { display: block; width: 100%; height: 340px; border: 0; background: #fff; }

/* answering: counter, jump to the end, failed answers, editing a message, stopped */
.composer { position: relative; }
.count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.count.over { color: var(--bad); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.bar h1 { margin: 0; font-size: inherit; line-height: inherit; }
.meta button { min-height: 24px; padding: 3px 6px; }
.snip { display: block; font-size: 12px; color: var(--muted); padding: 0 11px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.versions { display: inline-flex; align-items: center; gap: 2px; }
.versions button:disabled { opacity: .35; }
.jump { position: absolute; top: -44px; left: 50%; transform: translateX(-50%); border-radius: 999px; padding: 6px 14px; background: var(--card); box-shadow: 0 2px 10px rgb(0 0 0 / .12); font-size: 13px; }
.msgrow.user .meta { justify-content: flex-end; }
.msgrow.user .bubble textarea { display: block; width: min(560px, 100%); min-width: 240px; min-height: 72px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; white-space: pre-wrap; }
.edit { justify-content: flex-end; margin-top: 8px; }
.failed { max-width: min(85%, 560px); border: 1px solid var(--bad); border-radius: var(--radius); padding: 10px 14px; }
.failed .err { margin: 0 0 8px; }
.bubble del { color: var(--muted); }
