:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f7fb;
  color: #162033;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #dceafe 0, transparent 34%), #f4f7fb;
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  background: #e9eef7;
  color: #182235;
  font-weight: 700;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: #2563eb;
  color: white;
}

button.danger {
  background: #fee2e2;
  color: #991b1b;
}

.page {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #2563eb;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
}

h1, h2 {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 54px);
  line-height: 0.95;
}

h2 {
  font-size: 18px;
}

.subtitle {
  margin: 12px 0 0;
  color: #64748b;
  max-width: 650px;
}

.version {
  padding: 8px 12px;
  border-radius: 999px;
  background: #162033;
  color: #fff;
  font-weight: 800;
}

.grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  padding: 18px;
  backdrop-filter: blur(14px);
}

.settings-panel {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

input, select {
  width: 100%;
  border: 1px solid #d6deeb;
  border-radius: 12px;
  padding: 12px 12px;
  background: #fff;
  color: #162033;
  outline: none;
}

input:focus, select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.status {
  margin: 0;
  padding: 12px;
  border-radius: 14px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  line-height: 1.4;
}

.status.live {
  background: #dcfce7;
  color: #166534;
}

.status.error {
  background: #fee2e2;
  color: #991b1b;
}

.hint {
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
  background: #f8fafc;
  border-radius: 14px;
  padding: 12px;
}

.chat-panel {
  min-height: 620px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
}

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

.messages {
  height: 500px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px;
}

.message {
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.4;
  font-size: 15px;
}

.message.user {
  align-self: flex-end;
  background: #2563eb;
  color: white;
  border-bottom-right-radius: 5px;
}

.message.assistant {
  align-self: flex-start;
  background: #eef2ff;
  color: #1e1b4b;
  border-bottom-left-radius: 5px;
}

.message.system {
  align-self: center;
  max-width: 100%;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.small-title {
  margin: 16px 0 8px;
  color: #64748b;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

pre {
  margin: 0;
  overflow: auto;
  min-height: 460px;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 18px;
  padding: 14px;
  font-size: 12px;
}

@media (max-width: 1080px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .messages {
    height: 430px;
  }
}

textarea {
  width: 100%;
  min-height: 330px;
  border: 1px solid #d6deeb;
  border-radius: 14px;
  padding: 12px;
  resize: vertical;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: #162033;
  background: #fff;
  outline: none;
}

textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.prompt-editor {
  display: grid;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

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

.prompt-help {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.prompt-buttons {
  grid-template-columns: 1fr 1fr;
}

.small-pill {
  border-radius: 999px;
  padding: 4px 8px;
  background: #e0f2fe;
  color: #075985;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.small-status {
  font-size: 12px;
  padding: 10px;
}

.message.user.draft {
  opacity: 0.72;
  border: 1px dashed rgba(255, 255, 255, 0.7);
}
