:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --panel: #f7f8fa;
  --border: #e2e5ea;
  --text: #111418;
  --muted: #5b6472;
  --accent: #2457e6;
  --on-accent: #ffffff;
  --danger: #b42318;
  --radius: 10px;
  --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --panel: #151a21;
    --border: #262d37;
    --text: #e8ecf1;
    --muted: #98a3b3;
    --accent: #6f97ff;
    --on-accent: #0e1116;
    --danger: #ff8a80;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

main {
  width: min(100% - 2.5rem, 44rem);
  margin: 0 auto;
  padding: 3.5rem 0 2rem;
}

header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0 0 2rem;
  color: var(--muted);
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tabs button {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: none;
  border: 0;
  border-radius: calc(var(--radius) - 3px);
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.tabs button[aria-selected='true'] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Forms */
.panel {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.875rem;
}

input::placeholder {
  color: var(--muted);
  opacity: 0.55;
}

input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}

.rows {
  display: grid;
  gap: 0.75rem;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.actions .primary {
  margin-left: auto;
}

/* Buttons */
.button {
  padding: 0.55rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.button:hover {
  border-color: var(--muted);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.button.primary:hover {
  filter: brightness(1.08);
}

.button.small {
  padding: 0.25rem 0.6rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.button.icon {
  align-self: end;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
}

/* Output */
.outputs {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.output h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
}

#license-url {
  font-size: 0.8125rem;
}

.error {
  margin: 1rem 0 0;
  color: var(--danger);
  font-size: 0.875rem;
}

footer {
  width: min(100% - 2.5rem, 44rem);
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
}

footer p {
  margin: 0;
}

@media (max-width: 34rem) {
  main {
    padding-top: 2.5rem;
  }

  .row {
    grid-template-columns: 1fr 2.35rem;
  }

  .row .field:first-child,
  .row .field:nth-child(2) {
    grid-column: 1 / -1;
  }

  .row .icon {
    grid-column: 2;
    justify-self: end;
  }

  .actions .primary {
    margin-left: 0;
  }
}
