@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@300;400;500&display=swap");

:root {
  color-scheme: light;
  --bg: #0f1d1a;
  --bg-soft: #142420;
  --panel: #f7f3ed;
  --panel-deep: #ece4d8;
  --ink: #1a1a1a;
  --muted: #505050;
  --accent: #ff6b35;
  --accent-dark: #d64a19;
  --teal: #1ec7b6;
  --shadow: 0 30px 80px rgba(9, 20, 18, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top left, #214037, transparent 55%),
    radial-gradient(circle at bottom right, #112b25, transparent 55%),
    linear-gradient(135deg, #0a1513 0%, #152b25 50%, #0a1513 100%);
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(0px);
  opacity: 0.6;
  mix-blend-mode: screen;
  animation: float 12s ease-in-out infinite;
}

.orb-one {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(255, 107, 53, 0.9), transparent 60%);
  top: -80px;
  left: -60px;
}

.orb-two {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(30, 199, 182, 0.9), transparent 60%);
  bottom: -140px;
  right: -120px;
  animation-delay: -4s;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.25;
}

.page {
  position: relative;
  z-index: 1;
  padding: clamp(24px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f4efe8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: grid;
  place-items: center;
  color: #141414;
  font-weight: 700;
  letter-spacing: 1px;
}

.eyebrow {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(244, 239, 232, 0.7);
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(24px, 3vw, 36px);
  color: #f4efe8;
}

.status-pill {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(244, 239, 232, 0.12);
  color: #f4efe8;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: rise 0.8s ease both;
}

.panel-head h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
}

.tabbar {
  display: flex;
  gap: 12px;
}

.tab {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fdf8f2;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab.active {
  background: var(--panel-deep);
  border-color: rgba(0, 0, 0, 0.2);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

.field input,
textarea {
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  background: #fffaf4;
}

textarea {
  resize: vertical;
}

.primary {
  border: none;
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 24px rgba(255, 107, 53, 0.3);
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px rgba(255, 107, 53, 0.4);
}

.notice {
  min-height: 20px;
  font-size: 13px;
  color: var(--muted);
}

.hidden {
  display: none;
}

.chat-panel {
  min-height: 520px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.chat-header h2 {
  margin: 0 0 6px;
}

.chat-header p {
  margin: 0;
  color: var(--muted);
}

.chat-actions {
  display: flex;
  gap: 10px;
}

.ghost {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.2);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.messages {
  flex: 1;
  min-height: 240px;
  padding: 12px;
  border-radius: 18px;
  background: #fffaf4;
  border: 1px solid rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: pop 0.3s ease;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #ffe1d3, #ffd3b8);
}

.message.assistant {
  align-self: flex-start;
  background: #e5f7f3;
}

.message.system {
  align-self: center;
  background: rgba(0, 0, 0, 0.07);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.composer {
  display: flex;
  gap: 14px;
  align-items: flex-end;
}

.input-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-stack label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

#sendButton {
  min-width: 120px;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(18px);
  }
}

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

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .composer {
    flex-direction: column;
    align-items: stretch;
  }

  #sendButton {
    width: 100%;
  }
}