:root {
  --bg: #0f0f12;
  --surface: #18181d;
  --border: #2a2a32;
  --text: #e8e8ec;
  --muted: #8888a0;
  --accent: #7c6cf9;
  --accent-hover: #9388ff;
  --success: #4ade80;
  --error: #f87171;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Outfit", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.header {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}

.header-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.user-badge {
  font-size: 0.85rem;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.btn-logout:hover {
  color: var(--error);
  border-color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.main {
  display: grid;
  gap: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.card h2 {
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 1rem 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field {
  margin-bottom: 1rem;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field:last-of-type {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

.field-check {
  margin-bottom: 1rem;
}
.field-check label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.field-check input[type="checkbox"] {
  width: auto;
}

.btn {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
}

.btn-row .btn {
  flex: 1;
}

.btn-stop {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0;
  background: var(--error);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  flex-shrink: 0;
}

.btn-stop:hover {
  background: #ef4444;
}

.btn-stop[hidden] {
  display: none;
}

.status {
  min-height: 1.5rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.status.loading {
  color: var(--muted);
}

.status.error {
  color: var(--error);
}

.status.success {
  color: var(--success);
}

.usage {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  display: none;
}

.thinking-block {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: rgba(124, 108, 249, 0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.thinking-block summary {
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--muted);
  user-select: none;
}
.thinking-output {
  display: block;
  margin: 0.5rem 0 0;
  padding: 1rem;
  max-height: 25vh;
  overflow: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.output-wrapper {
  position: relative;
}

.output {
  margin: 0;
  padding: 1rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 40vh;
  overflow: auto;
  display: none;
}

.btn-icon-copy[hidden] {
  display: none;
}

.btn-icon-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.btn-icon-copy:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(124, 108, 249, 0.12);
}

.btn-icon-copy.copied {
  color: var(--success);
  border-color: var(--success);
}

.footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer code {
  background: var(--surface);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
}
