:root {
  color-scheme: light;
  font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  background-color: #f3f6fc;
  color: #1f2933;
  --surface: #ffffff;
  --border: #d8e0f0;
  --accent: #1d4ed8;
  --accent-alt: #1e40af;
  --assistant-bg: #ffffff;
  --user-bg: #e3ebff;
  --shadow-soft: 0 18px 32px rgba(23, 37, 84, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f3f6fc;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  background: var(--surface);
}

.chat-header {
  padding: 46px clamp(24px, 7vw, 108px) 28px;
  border-bottom: 1px solid rgba(209, 223, 252, 0.7);
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: linear-gradient(180deg, rgba(29, 78, 216, 0.12) 0%, rgba(29, 78, 216, 0.02) 100%);
  box-shadow: 0 22px 40px rgba(15, 23, 42, 0.08);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-text {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 24px 34px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  border: 1px solid rgba(209, 223, 252, 0.8);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(12px);
}

.header-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(29, 78, 216, 0.25);
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-weight: 600;
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  box-shadow: 0 12px 30px rgba(29, 78, 216, 0.12);
}

.header-text h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3.2vw, 2.6rem);
  font-weight: 600;
  color: #0e1c37;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.prototype-tag {
  font-size: 0.65em;
  font-weight: 500;
  color: rgba(31, 41, 51, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(29, 78, 216, 0.25);
  background: rgba(255, 255, 255, 0.8);
}

.chat-disclaimer {
  list-style: none;
  margin: 0;
  padding: 16px 22px;
  display: flex;
  justify-content: center;
  gap: 18px;
  max-width: 760px;
  margin-inline: auto;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  border: 1px solid rgba(209, 223, 252, 0.7);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.06);
  font-size: 0.82rem;
  color: #4b5563;
}

.chat-disclaimer li {
  position: relative;
  padding-left: 16px;
}

.chat-disclaimer li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1d4ed8;
}

.prompt-dock {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  transition: opacity 200ms ease;
}

.prompt-dock:empty {
  display: none;
}

.prompt-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5b6b84;
}

.prompt-panel.docked .prompt-label {
  margin-right: 6px;
}

.prompt-button {
  border: 1px solid rgba(29, 78, 216, 0.35);
  background: #1d4ed8;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.prompt-button:hover,
.prompt-button:focus {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(29, 78, 216, 0.22);
  background: #1e40af;
}

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 clamp(24px, 6vw, 92px) 36px;
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 36px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}

.prompt-overlay {
  margin: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: min(360px, 50vh);
  animation: fade-in 160ms ease;
}

.prompt-overlay.hidden {
  display: none;
}

.prompt-panel {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 18px;
  padding: 42px clamp(22px, 6vw, 48px) 28px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.3);
  max-width: min(1040px, 96vw);
  animation: panel-rise 200ms ease;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.prompt-panel .prompt-label {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5b6b84;
}

.prompt-card {
  background: #ffffff;
  color: #0e1c37;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 20px;
  padding: 20px;
  width: 240px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.45;
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border 160ms ease;
  word-break: break-word;
}

.prompt-card:hover,
.prompt-card:focus {
  transform: translateY(-4px);
  box-shadow: 0 20px 34px rgba(15, 23, 42, 0.12);
  border-color: rgba(29, 78, 216, 0.55);
}

.prompt-panel.docked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  border: none;
  background: transparent;
  max-width: none;
  position: static;
  overflow: visible;
}

.prompt-panel.docked .prompt-card {
  width: 200px;
  min-height: 200px;
  border-radius: 16px;
  padding: 18px;
  font-size: 0.92rem;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.12);
}

.prompt-panel.docked .prompt-label {
  position: static;
  transform: none;
  flex: 1 0 100%;
  text-align: center;
  margin-bottom: 4px;
}

.chat-bubble {
  max-width: min(720px, 88vw);
  width: fit-content;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  line-height: 1.55;
  background: var(--assistant-bg);
  box-shadow: var(--shadow-soft);
  animation: bubble-in 180ms ease;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--user-bg);
  border-color: rgba(29, 78, 216, 0.45);
}

.chat-bubble.assistant {
  align-self: flex-start;
}

.chat-bubble.pending {
  opacity: 0.7;
}

.message-meta {
  font-size: 0.75rem;
  color: #667085;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.message-content p {
  margin: 0 0 0.6em;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content p:empty {
  margin: 0;
}

.message-content ul,
.message-content ol {
  margin: 0.35em 0 0.35em 1.2em;
  padding: 0;
}

.message-content li {
  margin-bottom: 0.3em;
}

.message-content strong {
  color: #0f172a;
}

.message-content a {
  color: var(--accent);
  text-decoration: underline;
}

.message-content code {
  font-family: 'IBM Plex Mono', 'SFMono-Regular', Consolas, Menlo, monospace;
  background: rgba(15, 23, 42, 0.06);
  padding: 2px 5px;
  border-radius: 6px;
}

.message-content pre {
  margin: 0.7em 0;
  padding: 12px 14px;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 12px;
  overflow-x: auto;
}

.message-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.citation-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
}

.citation-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(29, 78, 216, 0.14);
  color: var(--accent);
  border: 1px solid rgba(29, 78, 216, 0.22);
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
  width: fit-content;
}

.citation-toggle .chevron {
  display: inline-block;
  transition: transform 160ms ease;
}

.citation-toggle:hover,
.citation-toggle:focus {
  background: rgba(29, 78, 216, 0.22);
  transform: translateY(-1px);
}

.citation-toggle.expanded .chevron {
  transform: rotate(90deg);
}

.citation-items {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.citation-items.visible {
  display: flex;
}

.citation-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(29, 78, 216, 0.12);
  color: var(--accent);
  border: 1px solid rgba(29, 78, 216, 0.2);
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.citation-pill:hover,
.citation-pill:focus {
  background: rgba(29, 78, 216, 0.18);
  transform: translateY(-1px);
}

.citation-pill span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-input {
  border-top: 1px solid var(--border);
  padding-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: center;
  width: min(560px, 92vw);
}

.input-wrapper {
  position: relative;
}

.input-guideline {
  height: 1px;
  background: rgba(29, 78, 216, 0.28);
  border-radius: 999px;
  width: 60px;
  margin: 0 auto 8px;
}

.chat-input textarea {
  resize: none;
  min-height: 58px;
  max-height: 220px;
  padding: 18px 58px 18px 20px;
  font-size: 0.97rem;
  font-family: 'IBM Plex Sans', 'Inter', 'Segoe UI', sans-serif;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #ffffff;
  line-height: 1.52;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  overflow-y: auto;
  width: 100%;
}

.chat-input textarea:focus {
  outline: none;
  border-color: rgba(29, 78, 216, 0.7);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.18);
}

.chat-input textarea[readonly] {
  cursor: not-allowed;
}

.chat-input textarea::placeholder {
  font-family: 'IBM Plex Sans', 'Inter', 'Segoe UI', sans-serif;
  color: #94a3b8;
}

.cooldown-bar {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.15);
  color: #0f172a;
  font-weight: 500;
  z-index: 2;
}

.cooldown-bar.visible {
  display: flex;
  animation: fade-in 150ms ease;
}

.cooldown-shell {
  width: 88%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  font-family: 'Inter', sans-serif;
}

.cooldown-label,
.cooldown-note {
  font-size: 0.82rem;
  color: #0e1c37;
  text-align: center;
}

.cooldown-note {
  font-size: 0.74rem;
  color: #4b5563;
}

.cooldown-track {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.cooldown-progress {
  position: absolute;
  top: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-alt));
  right: 0;
  transform-origin: right center;
  transition: transform 200ms linear;
}

.send-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 150ms ease, filter 150ms ease;
  box-shadow: 0 14px 26px rgba(29, 78, 216, 0.28);
  z-index: 1;
}

.send-button svg {
  display: block;
}

.send-button:disabled {
  filter: grayscale(40%);
  cursor: not-allowed;
  box-shadow: none;
}

.send-button:not(:disabled):hover,
.send-button:not(:disabled):focus {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.connection-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
  font-size: 0.9rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 800px) {
  .prompt-panel {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .chat-panel {
    padding: 0 20px 32px;
  }

  .chat-window {
    gap: 16px;
    padding: 24px 0 20px;
  }

  .chat-input {
    width: 100%;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes bubble-in {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes panel-rise {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
