:root {
  --bg: #0f0f11;
  --surface: #18181b;
  --surface-hover: #27272a;
  --border: #3f3f46;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --accent: #10b981;
  --accent-hover: #059669;
  --radius: 8px;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo,
    Consolas, "DejaVu Sans Mono", monospace;
  --font-sans: ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
}

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

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

main {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

textarea#prompt {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea#prompt:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.slider-group label {
  min-width: 7rem;
}

input[type="range"]#maxTokens {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

input[type="range"]#maxTokens::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: background 0.15s ease;
}

input[type="range"]#maxTokens::-webkit-slider-thumb:hover {
  background: var(--accent-hover);
}

input[type="range"]#maxTokens::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  transition: background 0.15s ease;
}

input[type="range"]#maxTokens::-moz-range-thumb:hover {
  background: var(--accent-hover);
}

.slider-value {
  font-variant-numeric: tabular-nums;
  min-width: 3.5rem;
  text-align: right;
  color: var(--text);
  font-weight: 500;
}

.actions {
  display: flex;
  justify-content: flex-end;
}

button#send {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

button#send:hover {
  background: var(--accent-hover);
}

button#send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.response-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.response-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.response-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.response-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.copy-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  line-height: 1;
}

.copy-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--accent);
}

.copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-btn .copy-label {
  display: none;
}

.copy-btn.copied .copy-icon {
  display: none;
}

.copy-btn.copied .copy-label {
  display: inline;
}

#response {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  min-height: 200px;
  max-height: 60vh;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

#response:empty::before {
  content: "Agent response will appear here...";
  color: var(--text-muted);
  font-style: italic;
}

.status {
  font-size: 0.875rem;
  color: var(--text-muted);
  min-height: 1.25rem;
}

.status.sending {
  color: var(--accent);
}

.status.error {
  color: #ef4444;
}

@media (max-width: 600px) {
  body {
    padding: 1rem;
  }

  header h1 {
    font-size: 1.5rem;
  }
}
