:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #151c25;
  --surface-2: #1d2633;
  --border: #2b3746;
  --text: #edf2f7;
  --muted: #9aa7b4;
  --accent: #ff2e4d;
  --accent-2: #ff6f7f;
  --success: #30d787;
  --danger: #ff5b5b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top right, #2b1420 0, var(--bg) 32%);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

.shell { max-width: 1500px; margin: 0 auto; padding: 24px; }
header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; margin-bottom: 18px;
}
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: .3px; }
h2 { font-size: 15px; margin: 0 0 12px; color: #f2f4f6; }
p { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: "SFMono-Regular", Consolas, monospace; }

header p { color: var(--muted); font-size: 14px; }
.status {
  padding: 8px 14px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); font-size: 13px; white-space: nowrap;
}
.status.ok { color: var(--success); border-color: rgba(48,215,135,.4); }
.status.error { color: var(--danger); border-color: rgba(255,91,91,.4); }

main { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; }
aside, .panel {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(10px);
}
aside section { margin-bottom: 20px; }
aside section:last-child { margin-bottom: 0; }
.workspace { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }

button {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  padding: 8px 11px; border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: .18s ease;
}
button:hover { border-color: #59677a; transform: translateY(-1px); }
button.primary { background: linear-gradient(120deg, var(--accent), #d61b3b); border-color: transparent; }
button.ghost { background: transparent; }
button.full { width: 100%; }
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.presets button { width: 100%; }
.auth-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.auth-buttons button { width: 100%; }
.qr-box {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px;
  margin-top: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 12px;
  background: #fff;
}
.qr-box img { width: 220px; height: 220px; background: #fff; }
.qr-box pre {
  margin: 0; height: 220px; overflow: auto; color: #111;
  background: transparent; white-space: pre-wrap; font-size: 12px; line-height: 1.5;
}

.tree { max-height: 330px; overflow: auto; margin-top: 10px; }
.tree button {
  display: block; width: 100%; text-align: left; margin-bottom: 4px;
  padding: 7px 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree button.active { border-color: var(--accent); color: var(--accent-2); }

.history { max-height: 220px; overflow: auto; }
.history-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin-bottom: 7px;
  cursor: pointer; font-size: 12px;
}
.history-item.ok { border-left: 3px solid var(--success); }
.history-item.failed { border-left: 3px solid var(--danger); }

.usage {
  min-height: 24px; color: #c8d1da; font-size: 12px;
  padding: 8px 10px; background: #0c121a; border-radius: 8px;
  overflow-wrap: anywhere; margin-bottom: 14px;
}
.row { margin-bottom: 12px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  background: #0f151d; color: var(--text); padding: 9px 10px; font-size: 13px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
.row.small { max-width: 180px; }
.option-rows { display: grid; gap: 8px; }
.option-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(0, 2fr) 80px 34px; gap: 8px; }
.option-row select, .option-row button { width: 100%; }
.empty { color: var(--muted); font-size: 13px; padding: 8px 0; }
.preview {
  margin-top: 6px; padding: 10px; min-height: 40px; border-radius: 8px;
  background: #0c121a; color: #e0e6ea; white-space: pre-wrap; word-break: break-word; font-size: 12px;
}

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.card {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px;
  background: #101822; font-size: 13px;
}
.card-title { color: #fff; font-weight: 600; margin-bottom: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.card a { color: var(--accent-2); text-decoration: none; }
.output {
  height: 360px; overflow: auto; background: #080d13; border-radius: 10px;
  padding: 12px; font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.output.error { color: #ffd0d0; }
.grid { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; align-items: center; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

@media (max-width: 1000px) {
  main { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .option-row { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .auth-buttons { grid-template-columns: 1fr 1fr; }
  .qr-box { grid-template-columns: 1fr; }
}
