:root {
  --bg: #f4f6f9;
  --bg-accent: #e8eef5;
  --surface: #ffffff;
  --border: #dde3ec;
  --border-focus: #93b4f5;
  --text: #1a2332;
  --muted: #5c6b7f;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --error: #dc2626;
  --error-soft: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 8px 32px rgba(16, 24, 40, 0.1);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(37, 99, 235, 0.08), transparent),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.25rem 1.5rem;
}

.container {
  width: 100%;
  max-width: 560px;
}

.brand {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--accent-soft);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

h1 {
  font-size: 1.625rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.subtitle {
  color: var(--muted);
  font-size: 0.975rem;
  margin: 0;
  max-width: 420px;
  margin-inline: auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: var(--text);
  letter-spacing: 0.01em;
}

.label-hint {
  color: var(--muted);
  font-weight: 400;
}

input[type="text"],
input[type="password"],
input[type="url"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-size: 0.975rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  margin-bottom: 1.1rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input::placeholder {
  color: #9aa8b8;
}

input:hover {
  border-color: #c5ced9;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.url-input {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", monospace;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.72rem 1.25rem;
  font-size: 0.975rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 4px 12px rgba(37, 99, 235, 0.18);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2), 0 6px 16px rgba(37, 99, 235, 0.22);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-success {
  background: var(--success);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.2), 0 4px 12px rgba(22, 163, 74, 0.15);
}

.btn-success:hover {
  background: #15803d;
}

.btn-secondary {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  color: var(--text);
  border-color: #b8c4d4;
  background: var(--bg);
}

.error-msg {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--error-soft);
  border-radius: 8px;
  border: 1px solid #fecaca;
}

.hidden {
  display: none !important;
}

.progress-panel {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.phase-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.progress-bar-wrap {
  height: 10px;
  background: var(--bg-accent);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.5rem 0 0.6rem;
  border: 1px solid var(--border);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 999px;
  width: 0%;
  transition: width 0.25s ease;
}

.progress-stats {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
}

.log {
  margin-top: 1rem;
  max-height: 140px;
  overflow-y: auto;
  font-size: 0.78rem;
  font-family: ui-monospace, "Cascadia Code", monospace;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.75rem 0.85rem;
}

.log-line {
  margin: 0.2rem 0;
  line-height: 1.4;
}

.actions {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.actions .btn {
  width: 100%;
}

.footer {
  text-align: center;
  padding: 1.5rem 1.25rem 2rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.footer-heart {
  color: #e11d48;
}

.hint-box {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--accent-soft);
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  font-size: 0.8125rem;
  color: #1e40af;
  line-height: 1.5;
}

.hint-box strong {
  font-weight: 600;
}

.hint-box code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-icon {
  font-size: 1.25rem;
  line-height: 1;
  margin-bottom: 0.35rem;
  opacity: 0.9;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-meta {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin: -0.5rem 0 1.25rem;
}

@media (max-width: 520px) {
  .stats-panel {
    grid-template-columns: 1fr;
  }

  .stat-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 0 0.75rem;
    text-align: left;
    align-items: center;
    padding: 0.85rem 1rem;
  }

  .stat-icon {
    grid-row: 1 / 3;
    font-size: 1.5rem;
    margin: 0;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .stat-label {
    margin-top: 0;
  }
}
