:root {
  color-scheme: dark;
  --background: #090d16;
  --surface: #111827;
  --surface-raised: #172033;
  --border: #2a3853;
  --text: #edf2ff;
  --muted: #9daccc;
  --accent: #7c8cff;
  --accent-strong: #9e78ff;
  --success: #36d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgb(84 70 190 / 25%), transparent 32rem),
    radial-gradient(circle at 90% 20%, rgb(39 116 174 / 18%), transparent 28rem),
    var(--background);
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-header,
main,
footer {
  width: min(1080px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding: 3.5rem 0 2rem;
}

.eyebrow,
.step {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  letter-spacing: -0.055em;
}

h2 {
  font-size: 1.35rem;
}

.subtitle,
.hint,
.message {
  color: var(--muted);
}

.subtitle {
  max-width: 38rem;
  margin: 0.65rem 0 0;
}

.status-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.settings-menu {
  position: relative;
}

.menu-button {
  display: grid;
  align-content: center;
  justify-items: center;
  width: 2.8rem;
  min-width: 2.8rem;
  padding-inline: 0.7rem;
  gap: 0.25rem;
}

.menu-button span {
  width: 1.15rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.settings-panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.7rem);
  right: 0;
  width: min(34rem, calc(100vw - 2rem));
  max-height: min(44rem, calc(100vh - 7rem));
  padding: 1.25rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: #111827;
  box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 45%);
}

.settings-panel[hidden] {
  display: none;
}

.settings-actions,
.settings-heading-actions,
.field-heading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.settings-actions {
  flex-wrap: wrap;
}

.field-heading {
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.field-heading label {
  margin-bottom: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(8rem, 0.7fr) minmax(12rem, 1.3fr);
  gap: 1rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgb(17 24 39 / 80%);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.status::before {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-good {
  border-color: rgb(54 211 153 / 45%);
  color: var(--success);
}

.status-warning {
  border-color: rgb(251 191 36 / 45%);
  color: var(--warning);
}

.status-bad {
  border-color: rgb(251 113 133 / 45%);
  color: var(--danger);
}

main {
  display: grid;
  gap: 1rem;
}

.card {
  padding: clamp(1.15rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 1.15rem;
  background: linear-gradient(145deg, rgb(23 32 51 / 94%), rgb(13 20 34 / 96%));
  box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 20%);
}

.section-heading,
.credential-row,
.submit-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

label {
  display: block;
  margin-bottom: 0.45rem;
  color: #dbe4fa;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  outline: none;
  background: #0b1220;
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input,
select {
  min-height: 2.8rem;
  padding: 0.65rem 0.8rem;
}

textarea {
  min-height: 5rem;
  padding: 0.8rem;
  line-height: 1.5;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible,
.result:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(124 140 255 / 22%);
}

.credential-row input {
  flex: 1 1 24rem;
}

.button {
  min-height: 2.65rem;
  padding: 0.58rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.button:hover:not(:disabled) {
  filter: brightness(1.08);
}

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

.button-secondary {
  border-color: var(--border);
  background: var(--surface-raised);
  color: var(--text);
}

.button-primary {
  min-width: 9rem;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
}

.button-small {
  min-height: 2.1rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.button-danger {
  border-color: rgb(251 113 133 / 35%);
  background: rgb(127 29 54 / 30%);
  color: #fecdd3;
}

.hint,
.message,
.field-hint {
  margin: 0.7rem 0 0;
  font-size: 0.84rem;
}

.field-hint {
  color: var(--muted);
}

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

.message-success {
  color: var(--success);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(8rem, 0.6fr) minmax(10rem, 0.8fr);
  gap: 1rem;
}

.field {
  margin-bottom: 1rem;
}

.optional {
  color: var(--muted);
  font-weight: 500;
}

.submit-row {
  min-height: 2.8rem;
}

.submit-row .message {
  margin: 0;
}

.result {
  min-height: 12rem;
  max-height: 38rem;
  margin: 0;
  padding: 1rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #080d17;
  color: #e5edff;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.usage {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.9rem 0 0;
}

.usage[hidden] {
  display: none;
}

.usage div {
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: rgb(8 13 23 / 55%);
}

.usage dt {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
}

.usage dd {
  margin: 0.25rem 0 0;
  overflow-wrap: anywhere;
}

footer {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 0 2.5rem;
}

footer a {
  color: var(--muted);
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 2rem;
  }

  .status-group {
    justify-content: flex-start;
  }

  .header-actions {
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
  }

  .settings-panel {
    position: fixed;
    top: 1rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    max-height: calc(100vh - 2rem);
  }

  .settings-actions,
  .submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-actions .button,
  .submit-row .button {
    width: 100%;
  }

  .settings-grid,
  .usage {
    grid-template-columns: 1fr;
  }
}
