@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;600;700&family=IBM+Plex+Mono:wght@400;600&display=swap');

:root {
  --bg: #f7f4ef;
  --bg-accent: #e8f3f0;
  --ink: #1d1f1f;
  --muted: #5d6663;
  --primary: #2a7a6f;
  --primary-strong: #1d5e55;
  --danger: #d1633c;
  --card: #ffffff;
  --line: rgba(0, 0, 0, 0.08);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 10% 10%, rgba(42, 122, 111, 0.12), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(209, 99, 60, 0.15), transparent 45%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
  opacity: 0.9;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  display: grid;
  gap: 24px;
}

.tabs {
  display: inline-flex;
  gap: 6px;
  align-items: flex-end;
}

.tab {
  border: 1px solid var(--line);
  border-bottom: none;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  padding: 8px 16px;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 -6px 12px rgba(0, 0, 0, 0.04);
}

.tab.active {
  background: var(--card);
  color: var(--primary-strong);
  position: relative;
  top: 1px;
}

.mode-section.hidden {
  display: none;
}

.cluster-body.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.hero {
  padding: 28px 28px 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero.compact {
  padding-bottom: 14px;
}

.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(42, 122, 111, 0.12);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(42, 122, 111, 0.12);
  color: var(--primary-strong);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.hero h1 {
  margin: 12px 0 6px;
  font-size: 32px;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.panel,
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-title,
.card-title {
  font-weight: 600;
  margin-bottom: 12px;
}

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.row.wrap {
  flex-wrap: wrap;
}

.actions {
  gap: 10px;
  margin-top: 6px;
}

.actions .btn {
  flex: 1 1 160px;
  text-align: center;
  justify-content: center;
}

.field {
  flex: 1;
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #fff;
}

.field input[type="file"] {
  padding: 6px 10px;
  height: 40px;
}

.field input[type="file"]::file-selector-button {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-family: inherit;
  margin-right: 10px;
  cursor: pointer;
}

.field input[type="file"]::-webkit-file-upload-button {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-family: inherit;
  margin-right: 10px;
  cursor: pointer;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(42, 122, 111, 0.6);
  box-shadow: 0 0 0 3px rgba(42, 122, 111, 0.12);
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(42, 122, 111, 0.08);
  color: var(--muted);
  font-size: 13px;
}

.details {
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
}

.details > summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 20px;
  font-weight: 600;
}

.details > summary::-webkit-details-marker {
  display: none;
}

.details > summary::after {
  content: "＋";
  float: right;
  color: var(--muted);
}

.details[open] > summary::after {
  content: "－";
}

.details-body {
  padding: 0 20px 20px;
  display: grid;
  gap: 20px;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.08);
}

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

.btn.ghost {
  background: transparent;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0 16px;
}

.stat {
  padding: 12px;
  border-radius: 12px;
  background: rgba(42, 122, 111, 0.08);
  text-align: center;
}

.stat-num {
  font-size: 22px;
  font-weight: 700;
}

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

.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(42, 122, 111, 0.12);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2a7a6f, #4aa79a);
  transition: width 0.2s ease;
}

.progress-meta {
  margin: 8px 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.meta {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.meta b {
  color: var(--ink);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(42, 122, 111, 0.08);
  color: var(--muted);
  font-size: 12px;
}

.tag.ok {
  background: rgba(42, 122, 111, 0.12);
  color: var(--primary-strong);
}

.tag.bad {
  background: rgba(209, 99, 60, 0.14);
  color: var(--danger);
}

.node-card .node-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.node-card .node-name {
  font-weight: 600;
}

.node-card .node-url {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
  margin-top: 4px;
}

.node-card .node-meta {
  display: grid;
  gap: 4px;
  margin: 10px 0;
  font-size: 12px;
  color: var(--muted);
}

.node-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.node-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.log-box {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #0f1514;
  color: #e2f3ee;
  padding: 12px;
  border-radius: 12px;
  min-height: 120px;
  max-height: 260px;
  overflow: auto;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.stagger {
  animation: fadeUp 0.6s ease both;
}

.stagger:nth-child(2) { animation-delay: 0.05s; }
.stagger:nth-child(3) { animation-delay: 0.1s; }
.stagger:nth-child(4) { animation-delay: 0.15s; }
.stagger:nth-child(5) { animation-delay: 0.2s; }
.stagger:nth-child(6) { animation-delay: 0.25s; }

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}
