:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --border: rgba(148, 163, 184, 0.2);
  --shadow: 0 18px 55px rgba(15, 23, 42, 0.45);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.16), transparent 30%),
    linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: var(--text);
}

.shell {
  width: min(760px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero {
  padding: 12px 4px 20px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.02;
  margin-bottom: 12px;
}

.subtle {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}

.card {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(17, 24, 39, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge--pending {
  background: rgba(148, 163, 184, 0.14);
  color: var(--muted);
}

.badge--ok {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
}

.badge--warn {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
}

.badge--error {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

.badge-inline {
  display: block;
  margin-top: 10px;
}

.stack,
.actions {
  display: grid;
  gap: 12px;
}

.actions {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.92rem;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

button {
  border: 0;
  border-radius: 14px;
  min-height: 48px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button:not(:disabled):active {
  transform: translateY(1px);
}

.primary {
  background: linear-gradient(135deg, var(--accent), #60a5fa);
  color: #082f49;
}

.secondary {
  background: linear-gradient(135deg, #34d399, #22c55e);
  color: #052e16;
}

.ghost {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
}

.panel {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.macro-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.macro-card {
  padding: 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--border);
}

.macro-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.macro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.output {
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
}

.output--live {
  min-height: 120px;
}

.history {
  display: grid;
  gap: 10px;
}

.history-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
}

.history-item__title {
  font-weight: 700;
  margin-bottom: 6px;
}

.history-item__meta {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.history-item__details {
  margin-top: 8px;
  white-space: pre-wrap;
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.5;
}

.code-block {
  padding: 20px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.26);
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  margin-bottom: 12px;
}

.hidden {
  display: none;
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.14);
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 16px, 760px);
    padding-top: 12px;
  }

  .card {
    padding: 14px;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .macro-grid {
    grid-template-columns: 1fr;
  }
}
