:root {
  --bg0: #070a12;
  --bg1: #10182b;
  --card: rgba(18, 24, 42, 0.82);
  --line: rgba(148, 163, 184, 0.18);
  --text: #e8eefc;
  --muted: #9aa8c7;
  --accent: #6ea8ff;
  --accent2: #8b5cf6;
  --ok: #34d399;
  --err: #fb7185;
  --warn: #fbbf24;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  font-family: "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg0);
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(110, 168, 255, 0.28), transparent 60%),
    radial-gradient(700px 480px at 100% 0%, rgba(139, 92, 246, 0.22), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  z-index: -1;
}

.card {
  width: min(720px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 28px;
}

header h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}
.sub { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }

form { display: grid; gap: 10px; }
label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}
input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(7, 10, 18, 0.55);
  color: var(--text);
  padding: 12px 14px;
  font-size: 1rem;
  outline: none;
}
input:focus {
  border-color: rgba(110, 168, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(110, 168, 255, 0.15);
}

button[type="submit"] {
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  font-weight: 650;
  font-size: 1rem;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}
button[type="submit"]:hover { filter: brightness(1.05); }
button[type="submit"]:active { transform: translateY(1px); }
button[type="submit"]:disabled {
  opacity: 0.7;
  cursor: wait;
  filter: grayscale(0.15);
}

.result {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.result h2, .logs-panel h2 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.45;
}
pre.ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.35); }
pre.err { color: #fecdd3; border-color: rgba(251, 113, 133, 0.35); }

.logs-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.log-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.25rem;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #dbe7ff;
  background: rgba(110, 168, 255, 0.16);
  border: 1px solid rgba(110, 168, 255, 0.28);
}
.log-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.logs {
  margin-top: 0;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #b7c3de;
  font-size: 0.8rem;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.logs .log-ok { color: var(--ok); }
.logs .log-err { color: #fda4af; }
.logs .log-warn { color: var(--warn); }
.logs .log-info { color: #b7c3de; }
.logs .log-muted { color: #7f8db0; }

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}
.ghost:hover {
  border-color: rgba(110, 168, 255, 0.45);
  background: rgba(110, 168, 255, 0.08);
}

@media (max-width: 520px) {
  .card { padding: 20px; }
  .result-head { flex-direction: column; align-items: flex-start; }
}
