:root {
  color-scheme: light dark;
  --ink: #101b28;
  --muted: #647184;
  --surface: #ffffff;
  --page: #eeeae3;
  --line: #d9dde2;
  --navy: #13283a;
  --red: #e9251b;
  --red-soft: #fff0ee;
  --green: #23845e;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button, a { font: inherit; }

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

.recovery-card {
  width: min(100%, 520px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 18px 55px rgba(16, 27, 40, .13);
}

.recovery-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.recovery-header img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--red);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(1.55rem, 6vw, 2rem); line-height: 1.05; }

.intro {
  margin: 18px 0;
  color: var(--muted);
  line-height: 1.5;
}

.recovery-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 48px;
  padding: 13px 14px;
  border: 1px solid #f0b7b2;
  border-radius: 14px;
  background: var(--red-soft);
  font-weight: 800;
  line-height: 1.35;
}

.recovery-status[data-state="ok"] { border-color: #8bc9b2; background: #edf9f4; }
.recovery-status[data-state="busy"] .status-dot { animation: pulse 1s ease-in-out infinite; }

.status-dot {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--red);
}

.recovery-status[data-state="ok"] .status-dot { background: var(--green); }

.recovery-actions {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.recovery-actions button,
.back-link,
.device-reset button {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  font-weight: 850;
  cursor: pointer;
}

.recovery-actions button span,
.recovery-actions button small { display: block; }
.recovery-actions button small { margin-top: 2px; color: var(--muted); font-weight: 650; line-height: 1.3; }
.recovery-actions button.primary { border-color: var(--red); background: var(--red); color: #fff; }
.recovery-actions button.primary small { color: rgba(255,255,255,.82); }
.recovery-actions button:disabled, .device-reset button:disabled { cursor: wait; opacity: .58; }
.back-link { display: grid; place-items: center; text-align: center; }

.device-reset {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--red) 4%, var(--panel));
  color: var(--muted);
}

.device-reset h2 { margin: 0; color: var(--ink); font-size: 1rem; }
.device-reset p { font-size: .88rem; line-height: 1.45; }
.device-reset button.danger { color: #b31d16; border-color: #e6aaa6; text-align: center; }
.device-reset.is-recommended { border-color: var(--red); box-shadow: 0 0 0 3px rgba(234, 32, 22, .1); }
.version { margin: 17px 0 0; color: var(--muted); font-size: .78rem; text-align: center; }

@keyframes pulse { 50% { opacity: .28; transform: scale(.72); } }

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f5f7fa;
    --muted: #aeb9c8;
    --surface: #142231;
    --page: #0b141e;
    --line: #344355;
    --red-soft: #2c2023;
  }
  .recovery-status[data-state="ok"] { background: #152b25; }
}

@media (max-width: 420px) {
  .recovery-card { padding: 20px 17px; border-radius: 20px; }
  .recovery-header img { width: 50px; height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
  .recovery-status[data-state="busy"] .status-dot { animation: none; }
}
