:root {
  color-scheme: dark;
  --bg: #101316;
  --panel: #181d22;
  --text: #edf2f7;
  --muted: #aab4c0;
  --line: #303943;
  --input: #11161b;
  --primary: #2f9bb7;
  --primary-dark: #237f99;
  --soft: #172830;
  --notice-line: #2f6979;
  --button-muted: #3a424c;
  --button-muted-text: #c7d0da;
  --log-bg: #070a0d;
  --log-text: #dce7ef;
  --shadow: rgba(0, 0, 0, 0.35);
  --error: #ff8a78;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #202327;
  --muted: #5b6370;
  --line: #d9dde3;
  --input: #ffffff;
  --primary: #176b87;
  --primary-dark: #0f5067;
  --soft: #eef7fa;
  --notice-line: #b6dae5;
  --button-muted: #cbd2da;
  --button-muted-text: #5b6370;
  --log-bg: #101820;
  --log-text: #dce7ef;
  --shadow: rgba(31, 42, 55, 0.08);
  --error: #a13d2d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(920px, calc(100% - 32px));
  margin: 32px auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 16px 45px var(--shadow);
}

.heading,
.actions,
.progress-header,
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: 0;
}

.status {
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.stack label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stack label:nth-child(3) {
  grid-column: 1 / -1;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
  padding: 12px 13px;
  color: var(--text);
  font: inherit;
}

input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

input:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(23, 107, 135, 0.14);
}

.field-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

button,
.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  padding: 10px 14px;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: var(--primary-dark);
}

button:disabled {
  border-color: var(--line);
  background: var(--button-muted);
  color: var(--button-muted-text);
  cursor: not-allowed;
}

.secondary {
  background: var(--panel);
  color: var(--primary);
}

.secondary:hover {
  background: var(--soft);
}

.actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 22px;
}

.notice {
  margin-top: 20px;
  border: 1px solid var(--notice-line);
  border-radius: 8px;
  background: var(--soft);
  padding: 14px;
}

.notice p {
  margin: 3px 0 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

.progress {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.progress-header {
  color: var(--muted);
  font-weight: 700;
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
  margin-top: 12px;
}

#bar-fill {
  width: 0%;
  height: 100%;
  background: var(--primary);
  transition: width 180ms ease;
}

pre {
  min-height: 170px;
  max-height: 330px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--log-bg);
  color: var(--log-text);
  line-height: 1.5;
  margin: 16px 0 0;
  padding: 14px;
  white-space: pre-wrap;
}

.theme-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  margin-top: 22px;
  padding-top: 18px;
}

.theme-switch {
  display: inline-flex;
  height: 28px;
  position: relative;
  width: 52px;
}

.theme-switch input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.theme-slider {
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  inset: 0;
  position: absolute;
  transition: background 160ms ease, border-color 160ms ease;
}

.theme-slider::before {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
  height: 22px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: transform 160ms ease;
  width: 22px;
}

.theme-switch input:checked + .theme-slider {
  background: var(--primary);
  border-color: var(--primary);
}

.theme-switch input:checked + .theme-slider::before {
  transform: translateX(24px);
}

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

@media (max-width: 720px) {
  .heading,
  .notice {
    align-items: stretch;
    flex-direction: column;
  }

  .stack {
    grid-template-columns: 1fr;
  }
}
