@font-face { font-family: "Inter"; src: url("/fonts/Inter-VF.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Ugly Dave"; src: url("/fonts/UglyDave.otf") format("opentype"); font-display: swap; }

:root {
  --lime: #DCFFA7;
  --blue: #B7EAFD;
  --ink: #121212;
  --paper: #FBFBF7;
  --card: #FFFFFF;
  --line: #E6E6DD;
  --muted: #66665E;
  --danger: #B3261E;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; background: var(--paper); color: var(--ink); font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }

#app { height: 100%; height: 100dvh; max-width: 780px; margin: 0 auto; background: var(--paper); position: relative; }
@media (min-width: 800px) { #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

.brand { font-weight: 900; letter-spacing: -0.02em; margin: 0; font-size: 34px; line-height: 1.1; }
.brand.small { font-size: 19px; }

/* ---------- buttons and inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--card); font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--lime); }
.btn.small { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn.link { border: 0; background: none; text-decoration: underline; min-height: 40px; padding: 0 6px; font-weight: 500; }
.btn:focus-visible, .icon-btn:focus-visible, .send:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn[disabled] { opacity: 0.55; cursor: default; }
input[type="email"], input[type="text"] { width: 100%; min-height: 48px; padding: 0 16px; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--card); }
label { display: block; font-weight: 600; font-size: 14px; margin: 18px 0 6px; }
form .btn.primary { width: 100%; margin-top: 16px; }

/* ---------- sign in ---------- */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 20px; padding-top: calc(24px + env(safe-area-inset-top)); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.login-card { width: 100%; max-width: 400px; }
.lede { font-size: 18px; margin: 10px 0 8px; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0; }
.error { color: var(--danger); font-weight: 500; margin: 16px 0 0; }
.fineprint { color: var(--muted); font-size: 14px; margin-top: 24px; }
#code { letter-spacing: 0.4em; font-size: 22px; text-align: center; font-weight: 700; }

/* ---------- chat frame ---------- */
.chat { height: 100%; display: flex; flex-direction: column; }
.topbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--lime); padding: calc(8px + env(safe-area-inset-top)) 10px 8px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: 50%; cursor: pointer; }
.icon-btn:active { background: rgba(0, 0, 0, 0.08); }

.messages { flex: 1; overflow-y: auto; padding: 18px 14px 8px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.empty { margin: auto 0; padding: 0 6px 40px; }
.hello { font-weight: 900; font-size: 34px; letter-spacing: -0.02em; margin: 0; line-height: 1.1; }
.sub { font-size: 20px; margin: 6px 0 0; color: var(--muted); }

.msg { max-width: 92%; padding: 11px 15px; border-radius: 20px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--blue); border-bottom-right-radius: 6px; white-space: pre-wrap; max-width: 86%; }
.msg.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.notice { align-self: flex-start; background: transparent; border: 1.5px dashed var(--line); color: var(--muted); }
.msg.error { align-self: flex-start; border: 1.5px solid var(--danger); color: var(--danger); background: var(--card); }

.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 0.75em; }
.md h3, .md h4 { margin: 1em 0 0.35em; font-weight: 800; line-height: 1.25; font-size: 1.05em; }
.md ul, .md ol { margin: 0 0 0.75em; padding-left: 1.35em; }
.md li { margin: 0.2em 0; }
.md code { background: #F0F0E8; border-radius: 5px; padding: 0.1em 0.35em; font-size: 0.92em; }
.md pre { background: #F0F0E8; border-radius: 10px; padding: 10px 12px; overflow-x: auto; margin: 0 0 0.75em; }
.md pre code { background: none; padding: 0; }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md blockquote { margin: 0 0 0.75em; padding-left: 12px; border-left: 3px solid var(--lime); color: var(--muted); }

.typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: 0.35; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.chip { align-self: flex-start; font-family: "Ugly Dave", "Inter", sans-serif; font-size: 21px; line-height: 1.1; color: var(--ink); background: var(--lime); border-radius: 12px; padding: 5px 12px 6px; transform: rotate(-1.2deg); margin: -4px 0 0 6px; max-width: 90%; }

/* ---------- Lounge post card ---------- */
.draft { align-self: stretch; background: var(--card); border: 1.5px solid var(--ink); border-radius: 18px; padding: 14px; }
.draft .label { font-family: "Ugly Dave", "Inter", sans-serif; font-size: 24px; line-height: 1; margin: 0 0 8px; }
.draft input, .draft textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 10px 12px; }
.draft input { min-height: 44px; font-weight: 700; margin-bottom: 8px; }
.draft textarea { min-height: 150px; resize: vertical; line-height: 1.45; }
.draft .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.draft .status { color: var(--muted); font-size: 14px; }
.draft .status.error { color: var(--danger); }
.draft.done { border-color: var(--line); background: var(--paper); }

/* ---------- composer ---------- */
.composer { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); }
.composer textarea { flex: 1; min-height: 48px; max-height: 180px; resize: none; border: 1.5px solid var(--ink); border-radius: 24px; background: var(--card); padding: 12px 16px; line-height: 1.4; }
.send { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--lime); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.send[disabled] { opacity: 0.5; cursor: default; }
.send.stop { background: var(--card); }

/* ---------- drawer ---------- */
.drawer { position: absolute; inset: 0; z-index: 20; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); }
.panel { position: absolute; left: 0; top: 0; bottom: 0; width: min(88%, 360px); background: var(--card); overflow-y: auto; padding: calc(10px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom)); border-right: 1.5px solid var(--ink); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel h2 { font-size: 15px; font-weight: 800; margin: 24px 0 2px; }
.meter { margin: 10px 0 0; padding: 10px 14px; background: var(--lime); border-radius: 12px; font-size: 14px; font-weight: 600; }
.notes, .chats { list-style: none; padding: 0; margin: 10px 0 0; }
.notes li, .chats li { display: flex; align-items: flex-start; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.notes li span, .chats li button.open { flex: 1; text-align: left; }
.chats li button.open { border: 0; background: none; padding: 0; cursor: pointer; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.chats li.current button.open { font-weight: 800; }
.x { flex: none; width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; border-radius: 50%; }
.x:hover, .x:focus-visible { background: #EFEFE7; color: var(--ink); }
.empty-note { color: var(--muted); font-size: 14px; padding: 8px 0; }
.note-form { display: flex; gap: 8px; margin-top: 12px; }
.note-form input { min-height: 40px; font-size: 14px; }
.panel-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 28px; }

/* ---------- conversation starters ---------- */
.starters { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 24px; }
.starter { min-height: 44px; padding: 8px 18px; border-radius: 22px; border: 1.5px solid var(--ink); background: var(--card); font-weight: 600; text-align: left; cursor: pointer; }
.starter:hover, .starter:focus-visible { background: var(--lime); }

/* ---------- Brand Blueprint ---------- */
.start-area { display: flex; flex-direction: column; gap: 26px; margin-top: 24px; }
.start-area .starters { margin-top: 0; }
.bp-card { background: var(--lime); border: 1.5px solid var(--ink); border-radius: 18px; padding: 14px 16px 12px; }
.bp-card .starter { background: var(--card); }
.bp-label { font-family: "Ugly Dave", "Inter", sans-serif; font-size: 24px; line-height: 1; margin: 0 0 10px; }
.bp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.sheet { position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: var(--card); overflow-y: auto; padding: calc(10px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 800px) { .sheet { left: 6%; right: 6%; top: 4%; bottom: 4%; border: 1.5px solid var(--ink); border-radius: 18px; } }
.bp-body { margin-top: 10px; }

/* ---------- dictation ---------- */
.mic { background: var(--card); }
.mic.on { background: var(--lime); animation: ring 1.4s ease-out infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.35); } 100% { box-shadow: 0 0 0 14px rgba(0, 0, 0, 0); } }
@media (prefers-reduced-motion: reduce) { .mic.on { animation: none; box-shadow: 0 0 0 4px var(--blue); } }
.mic-hint { flex: none; margin: 0; padding: 6px 16px; font-size: 13px; color: var(--muted); background: var(--paper); }

/* ---------- attached screenshots ---------- */
.attach { background: var(--card); }
.attach[disabled] { opacity: 0.5; cursor: default; }
.attach-strip { flex: none; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 16px 2px; background: var(--paper); }
.att { position: relative; width: 64px; height: 64px; border-radius: 12px; border: 1.5px solid var(--ink); background: var(--card); }
.att img { width: 100%; height: 100%; object-fit: cover; border-radius: 10.5px; display: block; }
.att-n { position: absolute; left: 4px; bottom: 4px; font-size: 11px; line-height: 1.3; padding: 0 6px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.att-x { position: absolute; top: -9px; right: -9px; width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--card); font-size: 17px; line-height: 1; cursor: pointer; }
.att-busy { font-size: 13px; color: var(--muted); }
.shots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.msg.user .shots:last-child { margin-bottom: 0; }
.shot { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 1px solid var(--ink); background: var(--card); }
.shot.gone { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; padding: 4px; font-size: 11px; text-align: center; color: var(--muted); }
