:root {
  --bg: #0b1220;
  --card: #121a2b;
  --fg: #e8ecf4;
  --muted: #94a3b8;
  --accent: #4f46e5;
  --accent-fg: #ffffff;
  --border: #243049;
  --ok: #22c55e;
  --err: #ef4444;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --fg: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
  }
}

* { box-sizing: border-box; }

/* Ensure the `hidden` attribute always wins over author `display` rules
   (e.g. .link { display: inline-block } would otherwise keep it visible). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100dvh;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 800px at 50% -10%, color-mix(in srgb, var(--accent) 22%, var(--bg)), var(--bg));
  color: var(--fg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 20px;
  text-align: center;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 28px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.45);
}

.logo img {
  border-radius: 20px;
  box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--accent) 60%, transparent);
}

h1 {
  font-size: 1.6rem;
  margin: 20px 0 8px;
  letter-spacing: -0.02em;
}

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

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  width: 100%;
  padding: 15px 20px;
  font-size: 1.05rem;
  font-weight: 650;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-fg);
  transition: transform 0.06s ease, filter 0.15s ease;
}

.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px) scale(0.995); }
.btn[disabled] { opacity: 0.55; cursor: default; }

.hint {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.link {
  display: inline-block;
  margin-top: 18px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}
.link:hover { color: var(--fg); text-decoration: underline; }

.status {
  margin: 16px 0 0;
  min-height: 1.2em;
  font-size: 0.9rem;
  color: var(--muted);
}
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

.footer {
  color: var(--muted);
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Client website rendered as the app's full-screen main content */
.client-frame {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 9999;
  background: var(--bg);
}
body.embedded { overflow: hidden; }
body.embedded .card,
body.embedded .footer { display: none; }

/* Notification pre-prompt shown as a centered modal over the client site */
.notify-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: nb-fade 0.25s ease;
}
.notify-modal {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 30px 24px 22px;
  text-align: center;
  box-shadow: 0 28px 80px -20px rgba(0, 0, 0, 0.65);
  animation: nb-pop 0.3s ease;
}
.notify-modal .nb-icon { font-size: 42px; line-height: 1; }
.notify-modal h2 { margin: 14px 0 8px; font-size: 1.3rem; letter-spacing: -0.01em; }
.notify-modal p { margin: 0 0 22px; color: var(--muted); line-height: 1.45; }
.notify-modal button {
  appearance: none;
  border: 0;
  cursor: pointer;
  width: 100%;
  border-radius: 13px;
}
.notify-modal .nb-allow {
  padding: 14px;
  font-size: 1rem;
  font-weight: 650;
  background: var(--accent);
  color: var(--accent-fg);
}
.notify-modal .nb-dismiss {
  margin-top: 8px;
  padding: 12px;
  font-size: 0.95rem;
  background: transparent;
  color: var(--muted);
}
@keyframes nb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nb-pop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Post-install confirmation: big success check */
.done-check {
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  color: var(--ok);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  font-weight: 700;
}

.spin {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid color-mix(in srgb, var(--muted) 40%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -3px;
  margin-right: 8px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
