:root {
  --bg: #f9fafb;
  --bg-card: #ffffff;
  --border-subtle: #e5e7eb;
  --text-main: #111827;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --success: #16a34a;
  --danger: #dc2626;
  --radius-lg: 14px;
  --radius-md: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.page {
  width: 100%;
  max-width: 1120px;
  padding: 35px 20px 28px;
  margin: auto;
  min-height: 100vh;
}

.header-row {
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.github-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-main);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.github-button:hover {
  filter: brightness(1.03);
}

.github-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  background: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.github-stars {
  display: inline-flex;
  align-items: center;
  gap: 3px 1px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.github-star-icon {
  width: 10px;
  height: 10px;
  display: inline-block;
  background: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='black' d='M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
}

@media (max-width: 880px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .page {
    padding-top: 20px;
  }
}

.card {
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 20px 18px 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 14px;
  margin-top: 6px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.thread-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.thread-row input[type="text"] {
  flex: 1;
}

.thread-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

label {
  font-size: 12px;
  color: var(--text-muted);
}

label span {
  text-transform: none;
  letter-spacing: normal;
  font-size: 11px;
  color: var(--text-muted);
}

input[type="text"],
textarea,
select {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-main);
  padding: 8px 9px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast),
    box-shadow var(--transition-fast), background-color var(--transition-fast),
    transform 120ms ease-out;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
}

input::placeholder,
textarea::placeholder {
  color: #6b7280;
}

textarea {
  resize: vertical;
  min-height: 80px;
  max-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.4;
}

select {
  appearance: none;
  background-color: #ffffff;
  padding-right: 26px;
  position: relative;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 50%;
  width: 8px;
  height: 5px;
  margin-top: -2px;
  background-image: linear-gradient(to bottom, #e5e7eb, #9ca3af);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  opacity: 0.8;
  pointer-events: none;
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

button {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: #ffffff;
}

button.secondary {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

button.ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding-inline: 10px;
}

button.tiny {
  font-size: 11px;
  padding: 4px 9px;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}
button:not(:disabled):hover {
  filter: brightness(1.03);
}

button:not(:disabled):active {
  filter: brightness(0.97);
}

.stacked {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.output-block {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  padding: 8px 10px 8px;
}

.output-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.output-label {
  font-size: 11px;
  color: var(--text-muted);
}

.output-content {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-main);
}

.pill-mini {
  font-size: 10px;
  border-radius: 999px;
  padding: 1px 6px;
  border: 1px solid var(--border-subtle);
  background: var(--accent-soft);
  color: var(--text-muted);
}

.status-bar {
  margin-top: 14px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--text-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
}

.status-pill.success {
  border-color: rgba(22, 163, 74, 0.4);
  color: var(--success);
}

.status-pill.error {
  border-color: rgba(220, 38, 38, 0.4);
  color: var(--danger);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.status-dot.ok {
  background: var(--success);
}

.status-dot.err {
  background: var(--danger);
}

.status-dot.idle {
  background: var(--text-muted);
}

.small-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  color: var(--text-muted);
}
