:root {
  --bg: #f5f7f2;
  --card: rgba(255, 255, 255, 0.88);
  --ink: #18201c;
  --muted: #66716b;
  --line: #dfe6df;
  --accent: #3b7a57;
  --accent-soft: #dcecdf;
  --danger: #b54141;
  --shadow: 0 24px 70px rgba(24, 32, 28, 0.12);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(142, 190, 151, 0.23), transparent 34rem),
    radial-gradient(circle at 90% 85%, rgba(142, 164, 190, 0.18), transparent 32rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.card {
  width: min(100%, 540px);
  padding: clamp(28px, 7vw, 48px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 30px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: clamp(38px, 9vw, 64px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  color: white;
  background: var(--ink);
  font-size: 15px;
}

.status-icon {
  position: relative;
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  display: grid;
  place-items: center;
}

.status-ring {
  position: absolute;
  inset: 2px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin 1.05s linear infinite;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 7px var(--accent-soft);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 440px;
  font-size: clamp(30px, 7vw, 44px);
  line-height: 1.06;
  letter-spacing: -0.045em;
}

.message {
  min-height: 3em;
  margin: 18px 0 30px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.progress-copy span:first-child { min-width: 0; }
.progress-copy span:last-child { flex: 0 0 auto; white-space: nowrap; }

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 450ms cubic-bezier(.2, .8, .2, 1);
}

.meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0 0;
}

.meta div {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.meta dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.meta dd {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.connection-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.connection[data-state="stale"] .connection-dot { background: #c28b2c; }
.connection[data-state="error"] .connection-dot { background: var(--danger); }

button {
  width: 100%;
  margin-top: 18px;
  padding: 13px 16px;
  border: 0;
  border-radius: 14px;
  color: white;
  background: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button[hidden] { display: none; }

body[data-state="success"] .status-ring {
  border-color: var(--accent);
  animation: none;
}

body[data-state="success"] .status-dot {
  box-shadow: 0 0 0 7px var(--accent-soft);
}

body[data-state="failed"] .status-ring {
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
  animation: none;
}

body[data-state="failed"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--danger) 16%, transparent);
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 420px) {
  .card { padding: 26px 22px; border-radius: 24px; }
  .brand { margin-bottom: 36px; }
  .meta { gap: 8px; }
  .meta div { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .status-ring { animation-duration: 2.4s; }
  .progress-track span { transition: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111713;
    --card: rgba(24, 32, 27, 0.9);
    --ink: #f0f5f1;
    --muted: #a8b4ac;
    --line: #344039;
    --accent: #7fc494;
    --accent-soft: #294435;
    --danger: #ef8585;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  }
  .brand-mark { color: #152019; background: #e8f2eb; }
  .card { border-color: rgba(255, 255, 255, 0.06); }
}
