/* icefallai.com/chat: a familiar chat layout in icefallai's own colors (blue on cool gray). */
:root {
  --bg: #ffffff;
  --side: #eef2f8;
  --side-hover: #e1e8f3;
  --side-on: #d6e2f5;
  --text: #1f2430;
  --muted: #5f6b7a;
  --line: #dde3ec;
  --accent: #1a73e8;
  --accent-dark: #1558b0;
  --accent-soft: #e8f0fe;
  --good: #15803d;
  --bad: #b91c1c;
  --warn: #b45309;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { font-size: 15.5px; line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* sidebar */
.side { width: 260px; flex: none; background: var(--side); display: flex; flex-direction: column; padding: .6rem; gap: .3rem; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: .3rem .4rem .5rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.05rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand svg { width: 1.5rem; height: 1.5rem; stroke: var(--accent); stroke-width: 2.5; }
.new-chat { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .6rem .75rem; border: 1px solid var(--line);
  background: #fff; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .92rem; }
.new-chat:hover { border-color: var(--accent); color: var(--accent); }
.new-chat svg { width: 1.1rem; height: 1.1rem; }
.side-label { font-size: .75rem; font-weight: 600; color: var(--muted); padding: .8rem .6rem .2rem; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.chat-item { display: flex; align-items: center; border-radius: 8px; }
.chat-item:hover { background: var(--side-hover); }
.chat-item.on { background: var(--side-on); }
.chat-item a { flex: 1; min-width: 0; padding: .5rem .6rem; color: var(--text); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item a:hover { text-decoration: none; }
.chat-item button { border: 0; background: none; padding: .35rem .5rem; color: var(--muted); cursor: pointer; visibility: hidden; }
.chat-item:hover button, .chat-item.on button { visibility: visible; }
.chat-item button:hover { color: var(--bad); }
.chat-item button svg { width: 1rem; height: 1rem; }
.side-foot { font-size: .75rem; color: var(--muted); padding: .5rem .6rem .2rem; border-top: 1px solid var(--line); }
.side-foot p { margin: .2rem 0; }

/* main column */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.bar { display: flex; align-items: center; gap: .6rem; padding: .6rem 1rem; min-height: 3.2rem; }
.bar-title { font-weight: 700; font-size: 1.05rem; }
.status { margin-left: auto; font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .35rem; white-space: nowrap; }
.status i { width: .5rem; height: .5rem; border-radius: 50%; background: var(--line); }
.status.on i { background: var(--good); }
.status.off i { background: var(--bad); }
.status.wait i { background: var(--warn); }
.icon-btn { border: 0; background: none; padding: .4rem; border-radius: 8px; cursor: pointer; display: flex; color: var(--muted); }
.icon-btn:hover { background: var(--side); color: var(--text); }
.only-mobile { display: none; }

.scroll { flex: 1; overflow-y: auto; }
.thread { max-width: 768px; margin: 0 auto; padding: 1rem 1.25rem 2rem; display: flex; flex-direction: column; gap: 1.6rem; }
.thread:empty { display: none; }
.msg-user { align-self: flex-end; max-width: 80%; background: var(--accent-soft); color: var(--text); padding: .6rem 1rem;
  border-radius: 1.25rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-ai { display: flex; gap: .9rem; align-items: flex-start; }
.msg-ai .av { width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 1px solid var(--line); display: flex; align-items: center;
  justify-content: center; flex: none; margin-top: .1rem; background: #fff; }
.msg-ai .av svg { width: 1.05rem; height: 1.05rem; stroke: var(--accent); stroke-width: 2.6; }
.msg-ai .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.body p { margin: 0 0 .8rem; } .body > :last-child { margin-bottom: 0; }
.body ul, .body ol { margin: .2rem 0 .8rem; padding-left: 1.4rem; }
.body li { margin: .25rem 0; }
.body h4 { margin: 1.1rem 0 .4rem; font-size: 1.05rem; }
.body pre { background: #0f1b2d; color: #e6edf6; border-radius: 10px; padding: .8rem 1rem; overflow-x: auto; font-size: .85rem; line-height: 1.5; }
.body code { background: #eef2f8; border-radius: 5px; padding: .1rem .3rem; font-size: .88em; }
.body pre code { background: none; padding: 0; color: inherit; }
.body.note { color: var(--muted); background: #f5f7fb; border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem; }
.cut { color: var(--muted); font-style: italic; }
.thinking { color: var(--muted); display: inline-flex; align-items: center; gap: .5rem; }
.thinking::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }

/* empty state */
.empty { max-width: 768px; margin: 0 auto; padding: 12vh 1.25rem 2rem; text-align: center; }
.empty[hidden] { display: none; }
.empty .logo { width: 3.2rem; height: 3.2rem; margin: 0 auto 1rem; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.empty .logo svg { width: 1.8rem; height: 1.8rem; stroke: var(--accent); stroke-width: 2.5; }
.empty h1 { font-size: 1.7rem; margin: 0 0 .3rem; letter-spacing: -.01em; }
.empty p { color: var(--muted); margin: 0 0 1.8rem; }
.examples { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; text-align: left; }
.examples button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: .75rem .9rem; cursor: pointer;
  color: var(--muted); font-size: .9rem; line-height: 1.4; text-align: left; }
.examples button b { display: block; color: var(--text); font-weight: 600; }
.examples button:hover { border-color: var(--accent); background: var(--accent-soft); }

/* composer */
.composer-wrap { padding: 0 1.25rem .6rem; }
.composer { max-width: 768px; margin: 0 auto; display: flex; align-items: flex-end; gap: .5rem; background: #f4f6fa;
  border: 1px solid var(--line); border-radius: 1.6rem; padding: .45rem .45rem .45rem 1.1rem; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
.composer textarea { flex: 1; border: 0; outline: 0; background: none; resize: none; font: inherit; line-height: 1.5;
  padding: .45rem 0; max-height: 12rem; color: var(--text); }
.send { width: 2.3rem; height: 2.3rem; border-radius: 50%; border: 0; background: var(--accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex: none; }
.send:hover:not(:disabled) { background: var(--accent-dark); }
.send:disabled { background: #c3cfdf; cursor: default; }
.send svg { width: 1.15rem; height: 1.15rem; stroke-width: 2.5; }
.send .stop { display: none; fill: currentColor; stroke: none; }
.send.streaming .arrow { display: none; }
.send.streaming .stop { display: block; }
.fine { max-width: 768px; margin: .45rem auto 0; text-align: center; font-size: .74rem; color: var(--muted); }
.fine b { color: var(--text); font-weight: 600; }

.shade { display: none; }

/* start screen: the message box sits right under the greeting; once a chat starts it moves to the bottom */
.main.fresh .scroll { flex: none; margin-top: auto; overflow: visible; }
.main.fresh .empty { padding-top: 0; }
.main.fresh .composer-wrap { margin-bottom: auto; padding-bottom: 10vh; }
.main.fresh .examples { margin-top: 0; }

/* phones: sidebar slides in behind the menu button */
@media (max-width: 800px) {
  .only-mobile { display: flex; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 20; width: min(82vw, 300px); transform: translateX(-100%);
    transition: transform .2s ease; }
  .app.menu .side { transform: none; box-shadow: 0 0 24px rgba(0, 0, 0, .15); }
  .app.menu .shade { display: block; position: fixed; inset: 0; background: rgba(15, 27, 45, .35); z-index: 10; }
  .bar { border-bottom: 1px solid var(--line); }
  .bar-title { flex: 1; text-align: center; }
  .status { margin-left: 0; }
  .status span { display: none; }
  .examples { grid-template-columns: 1fr; }
  .examples button:nth-child(n+3) { display: none; }
  .empty { padding-top: 8vh; }
  .thread { padding: 1rem .9rem 1.5rem; }
  .msg-user { max-width: 88%; }
  .msg-ai .av { display: none; }
  .composer-wrap { padding: 0 .7rem calc(.5rem + env(safe-area-inset-bottom)); }
  .composer textarea { font-size: 16px; }   /* stops iPhone zooming in on tap */
}
