:root {
  --bg: #0f1115;
  --bg-soft: #171a21;
  --panel: #1d2230;
  --text: #f5f7fa;
  --muted: #9aa4b2;
  --accent: #3ddc97;
  --accent-dark: #2cb67d;
  --danger: #ff7a7a;
  --border: #2a2f3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at top, #1b2030 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

main {
  width: min(1080px, 100% - 32px);
  margin: 20px auto 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.breadcrumb {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}

.breadcrumb:hover {
  color: var(--text);
}

.card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

h1 {
  margin: 0 0 8px;
  font-size: 1.45rem;
}

p,
label,
small {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

input,
textarea,
select,
button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

input,
textarea,
select {
  background: #0f131b;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  min-height: 140px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

button {
  background: var(--accent);
  color: #04120c;
  font-weight: 700;
  padding: 10px 12px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: #233142;
  color: var(--text);
}

button.secondary:hover {
  background: #2a3a4f;
}

button.ghost {
  background: transparent;
  color: var(--text);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.actions > * {
  width: auto;
}

.status {
  min-height: 20px;
  font-size: 0.9rem;
  margin-top: 6px;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.kv {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0f131b;
  padding: 10px;
  max-height: 220px;
  overflow: auto;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.list li:last-child {
  border-bottom: 0;
}

.tools-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin-top: 14px;
}

.tool-link {
  display: block;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #151a24;
  padding: 12px;
}

.tool-link:hover {
  border-color: var(--accent);
}

.tool-link h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.tool-link p {
  margin: 0;
  font-size: 0.9rem;
}

.preview {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: #0f131b;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px;
}

code.output {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f131b;
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 10px;
  min-height: 60px;
}

@media (max-width: 640px) {
  main {
    width: min(1080px, 100% - 20px);
  }

  .card {
    padding: 14px;
  }
}
