:root {
  --bg: #0b0d12;
  --surface: #141820;
  --border: #252b38;
  --text: #e8ecf4;
  --muted: #8b95a8;
  --accent: #6ee7b7;
  --accent-dim: #34d399;
  --danger: #f87171;
  --radius: 10px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.logo {
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--muted);
  font-weight: 400;
}

.badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.ok {
  border-color: #166534;
  color: var(--accent);
}

.badge.err {
  border-color: #7f1d1d;
  color: var(--danger);
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}

.hero p {
  color: var(--muted);
  max-width: 52ch;
  margin: 0 0 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 1rem;
  font-weight: 500;
}

.upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.upload-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  flex: 1 1 200px;
}

input[type="text"],
input[type="file"] {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
}

button {
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.1rem;
  background: var(--accent-dim);
  color: #052e1f;
}

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

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

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

.sites li {
  border-top: 1px solid var(--border);
  padding: 1rem 0;
}

.sites li:first-child {
  border-top: none;
  padding-top: 0;
}

.sites li.is-new {
  background: rgba(110, 231, 183, 0.06);
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: 6px;
}

.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.status-badge {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.status-badge.verified {
  border-color: #166534;
  color: var(--accent);
}

.status-badge.pinned {
  border-color: #1e3a5f;
  color: #93c5fd;
}

.status-badge.failed {
  border-color: #7f1d1d;
  color: var(--danger);
}

.status-badge.pending,
.status-badge.uploaded {
  border-color: #854d0e;
  color: #fcd34d;
}

.status-badge.gateway-slow {
  border-color: #4b5563;
  color: var(--muted);
}

.site-actions {
  margin-top: 0.5rem;
}

.site-actions button {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
}

.site-versions {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
}

.versions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.versions-list li {
  font-size: 0.85rem;
}

.site-name {
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.cid {
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.links a {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  word-break: break-all;
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

.hint code {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

#toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#toast.show {
  opacity: 1;
}

#toast.error {
  border-color: #7f1d1d;
  color: var(--danger);
}

.last-result {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.last-result.hidden {
  display: none;
}

.last-result h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.last-result.is-loading h3 {
  color: var(--muted);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.result-actions a,
.result-actions button {
  font-size: 0.85rem;
  text-decoration: none;
}

.result-actions .primary {
  background: var(--accent-dim);
  color: #052e1f;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-weight: 500;
}

.result-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.result-row label {
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 3rem;
}

.result-row code {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.78rem;
  word-break: break-all;
  background: var(--bg);
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.result-preview {
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

.result-preview iframe {
  display: block;
  width: 100%;
  min-height: 280px;
  border: 0;
  background: #fff;
}
