@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
}

:root {
  --bg: #FFF9ED;
  --primary: #2447D8;
  --signal: #FF5A1F;
  --ink: #171714;
  --rule: #C9C1B3;
  --text: #171714;
  --muted: #5D594F;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* height:100% chain instead of viewport units: this page lives in an iframe,
   where the dock already hands us the exact box — vh/dvh inside an iframe
   resolve inconsistently on mobile and made the panel taller than the screen. */
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.panel {
  width: 100%;
  max-width: 720px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

header h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  padding: 8px 4px 14px;
  border-bottom: 1px solid var(--ink);
}

.chat {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px;
}

.msg {
  max-width: 85%;
  border-radius: 0;
  padding: 10px 14px;
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg.user {
  align-self: flex-end;
  background: var(--signal);
  border: 1px solid var(--ink);
}

.msg.assistant {
  align-self: flex-start;
  background: #F3EFE5;
  border: 1px solid var(--rule);
}

.msg.typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rule);
  margin: 0 2px;
  animation: typing-dot 1s infinite;
}

.msg.typing span:nth-child(2) { animation-delay: 0.2s; }
.msg.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.msg a {
  color: var(--primary);
  word-break: break-all;
}

.msg code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  background: #E5DED0;
  border-radius: 0;
  padding: 1px 5px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  font-size: 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: 0;
  padding: 3px 10px;
  cursor: pointer;
}

.chip:hover {
  color: var(--ink);
  background: var(--signal);
  border-color: var(--ink);
}

.composer {
  display: flex;
  gap: 8px;
  padding-top: 14px;
}

.composer textarea {
  flex: 1;
  resize: none;
  background: #F3EFE5;
  border: 1px solid var(--ink);
  border-radius: 0;
  color: var(--text);
  font: inherit;
  /* 1rem (=16px at default) minimum — anything smaller makes iOS Safari auto-zoom the page on
     focus, which permanently widens the layout and breaks keyboard tracking. */
  font-size: 1rem;
  padding: 10px 12px;
}

.composer textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.composer button {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 0;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0 20px;
  cursor: pointer;
}

.composer button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.composer button:hover:not(:disabled) {
  color: var(--ink);
  background: var(--signal);
}

.caption {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  padding: 10px 0 2px;
}
