:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: #131824;
  --surface-2: #161d2a;
  --surface-3: #0f1623;
  --border: #232c3b;
  --border-strong: #2b3a50;
  --text: #e9eef7;
  --muted: #a7b2c5;
  --accent: #4cc0ff;
  --accent-2: #6df2c8;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 800px at 10% -10%, rgba(76, 192, 255, 0.15), transparent),
    linear-gradient(180deg, #0b0f14, #0a0c10 42%, #090b0f);
}

.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel {
  width: min(720px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

header {
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.08;
}

.status-text {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.status-text.error {
  color: #ffb4b4;
}

.progress {
  height: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: #0c111a;
  margin-bottom: 18px;
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #0c111a;
  color: var(--text);
  font: inherit;
}

input:focus {
  outline: none;
  border-color: #2a6d73;
  box-shadow: 0 0 0 2px rgba(76, 192, 255, 0.12);
}

input::placeholder {
  color: #66758a;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 18px;
}

button,
.button {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.08s ease,
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

button:hover,
.button:hover {
  background: var(--surface-2);
  color: var(--text);
  transform: translateY(-1px);
}

button:active,
.button:active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #091119;
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

#start {
  color: #b8ffe4;
  border-color: #2f8a57;
  background: #143922;
}

#start:hover {
  background: #18482b;
  color: #d4ffe8;
}

.secondary {
  background: var(--surface-2);
  color: var(--text);
}

.result {
  border: 1px solid #2f8a57;
  border-radius: 12px;
  padding: 14px;
  margin: 0 0 16px;
  color: #d4ffe8;
  background: rgba(47, 138, 87, 0.13);
  font-weight: 700;
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 8, 13, 0.76);
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-panel {
  position: relative;
  width: min(520px, 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.46);
  padding: 22px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-2);
}

.modal-kicker {
  display: inline-flex;
  margin: 0 0 8px;
  border: 1px solid #2f8a57;
  border-radius: 999px;
  padding: 3px 10px;
  color: #b8ffe4;
  background: rgba(47, 138, 87, 0.13);
  font-size: 12px;
  font-weight: 800;
}

h2 {
  margin: 0;
  font-size: 24px;
}

#modal-message {
  color: var(--muted);
  line-height: 1.5;
  margin: 10px 0 18px;
}

.modal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 210px;
  text-align: center;
  color: #091119;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

pre {
  min-height: 180px;
  max-height: 300px;
  overflow: auto;
  margin: 18px 0 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #090d14;
  color: #b8ffe4;
  white-space: pre-wrap;
  font: 12px/1.5 "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

@media (max-width: 680px) {
  .shell {
    padding: 12px;
    place-items: stretch;
  }

  .panel {
    padding: 16px;
  }

  header {
    display: grid;
    grid-template-columns: 1fr;
  }

  button,
  .button {
    width: 100%;
    text-align: center;
  }
}
