:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface2: rgba(18, 24, 38, 0.03);
  --text: rgba(18, 24, 38, 0.92);
  --muted: rgba(18, 24, 38, 0.62);
  --placeholder: rgba(18, 24, 38, 0.42);
  --border: rgba(18, 24, 38, 0.12);
  --shadow: 0 10px 28px rgba(18, 24, 38, 0.10);
  --primary: #2563eb;
  --primaryHover: #1d4ed8;
  --primaryBorder: rgba(37, 99, 235, 0.32);
  --danger: #dc2626;
  --ring: rgba(37, 99, 235, 0.22);
  --btnHover: rgba(18, 24, 38, 0.04);
  --radius: 16px;
  --radius2: 14px;
  --paneHeight: 520px;
  --textareaHeight: 360px;
  --sans: "LXGW WenKai Screen", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17;
    --surface: rgba(255, 255, 255, 0.06);
    --surface2: rgba(255, 255, 255, 0.04);
    --text: rgba(255, 255, 255, 0.92);
    --muted: rgba(255, 255, 255, 0.62);
    --placeholder: rgba(255, 255, 255, 0.42);
    --border: rgba(255, 255, 255, 0.12);
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
    --primary: #60a5fa;
    --primaryHover: #3b82f6;
    --primaryBorder: rgba(96, 165, 250, 0.42);
    --ring: rgba(96, 165, 250, 0.25);
    --btnHover: rgba(255, 255, 255, 0.08);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  font-family: var(--sans);
  font-synthesis: weight;
}

body {
  margin: 0;
  font-family: inherit;
  font-weight: 400;
  color: var(--text);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), transparent 240px), var(--bg);
  line-height: 1.5;
}

button,
input,
textarea {
  font-family: inherit;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 16px 44px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin: 6px 0 18px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.2px;
  font-weight: 600;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  align-self: flex-start;
}

.status-pill [data-kind="error"],
.status-pill[data-kind="error"] {
  color: var(--danger);
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 980px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

.pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  height: var(--paneHeight);
}

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

.pane-head h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.2px;
  font-weight: 600;
  color: var(--muted);
}

.pane-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.textarea {
  width: 100%;
  flex: 0 0 auto;
  height: var(--textareaHeight);
  resize: none;
  border-radius: var(--radius2);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
}

.textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px var(--ring);
}

.textarea::placeholder {
  color: var(--placeholder);
}

.pane-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 9px 12px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.06s ease, background 0.12s ease, border-color 0.12s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-weight: 600;
  font-size: 13px;
}

.btn:hover {
  background: var(--btnHover);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
  border-color: rgba(37, 99, 235, 0.55);
}

.btn-primary {
  border-color: var(--primaryBorder);
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primaryHover);
}

.btn-ghost {
  background: transparent;
}

.footer {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 520px) {
  .status-pill {
    width: 100%;
  }

  .pane-foot .btn {
    width: 100%;
  }

  :root {
    --paneHeight: 480px;
    --textareaHeight: 320px;
  }
}
