@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Source+Sans+3:wght@400;600&display=swap");

:root {
  --bg0: #0f1c18;
  --bg1: #1a2f28;
  --ink: #e8f2ee;
  --muted: #9bb5ab;
  --accent: #3dba8b;
  --accent-2: #c4a35a;
  --danger: #e07a5f;
  --panel: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.12);
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 186, 139, 0.22), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(196, 163, 90, 0.18), transparent 55%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
}

.shell {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.hero {
  margin-bottom: 1.75rem;
  animation: rise 0.7s ease both;
}

.brand {
  margin: 0 0 0.4rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
}

h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 38rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1.35rem 1.4rem;
  margin-bottom: 1rem;
  backdrop-filter: blur(8px);
  animation: rise 0.8s ease both;
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.panel.dimmed { opacity: 0.45; pointer-events: none; }
.panel.error { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }

label, fieldset {
  display: block;
  margin-bottom: 0.9rem;
  font-size: 0.92rem;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1rem;
}

.radio {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  margin: 0.35rem 0;
}

input[type="url"],
input[type="text"] {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  font: inherit;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  background: linear-gradient(135deg, var(--accent), #2a9d6f);
  color: #06281d;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.device-box {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed var(--line);
}

.device-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  margin: 0.4rem 0;
  color: var(--accent-2);
}

.muted { color: var(--muted); font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.88rem; margin: 0.75rem 0 0; }
.hidden { display: none !important; }

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 0.75rem 0 0.35rem;
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}

.pct { margin: 0 0 0.75rem; font-weight: 600; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.stats div {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.stats dt { margin: 0; color: var(--muted); font-size: 0.78rem; }
.stats dd { margin: 0.2rem 0 0; font-weight: 600; }

.errors {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  color: var(--danger);
  font-size: 0.85rem;
}

.errors li { margin-bottom: 0.35rem; }

.actions { display: flex; gap: 0.5rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
}
