/* Quiz Studio: installer and admin shell */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-accent), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
code { font-size: .92em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
h1 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem); line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
.lead { color: var(--muted); font-size: 1.05rem; }
.muted { color: var(--muted); font-size: .94rem; }

.install { max-width: 760px; margin: 0 auto; padding: 28px 16px 56px; }
.install-narrow { max-width: 460px; padding-top: 8vh; }
.install-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #ec4899); color: #fff; font-weight: 800;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}
.step-count { margin: 0; color: var(--muted); font-size: .9rem; }

.rail { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; flex: 1 1 0; min-width: 0; padding: 8px 4px; border-radius: 14px; color: var(--muted); font-size: .78rem; line-height: 1.25; background: transparent; }
.rail li.is-current { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.rail-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); }
.rail li.is-current .rail-dot { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.rail li.is-done .rail-dot { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
@media (max-width: 900px) {
  .rail { justify-content: space-between; }
  .rail li:not(.is-current) .rail-label { display: none; }
  .rail li { flex: 0 0 auto; padding: 6px 8px; }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 36px); box-shadow: var(--shadow); animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 18px 0; }
.panel p:last-child { margin-bottom: 0; }

.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: .96rem; }
.alert-error { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.alert-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }

.form { margin-top: 8px; }
.field { margin-bottom: 16px; min-width: 0; }
.field label { display: block; font-weight: 600; font-size: .93rem; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 46px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.hint { color: var(--muted); font-size: .86rem; margin: 6px 0 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-2 .field-narrow { max-width: 140px; }
.field-narrow { max-width: 220px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } .grid-2 .field-narrow, .field-narrow { max-width: none; } }
.lang-switch { margin-top: 8px; max-width: 280px; }

.meter { height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--bad); transition: width .2s, background-color .2s; }
.meter span[data-level="1"] { background: var(--warn); }
.meter span[data-level="2"], .meter span[data-level="3"] { background: var(--ok); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 24px; }
.actions form { margin: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  font: inherit; font-weight: 600; border-radius: 12px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .12s, box-shadow .15s, background-color .15s;
}
.btn:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--btn-primary, var(--primary)); color: var(--btn-primary-ink, var(--primary-ink)); box-shadow: 0 6px 18px color-mix(in srgb, var(--btn-primary, var(--primary)) 35%, transparent); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.btn-small { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.btn.is-busy::after { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) { .actions { justify-content: stretch; } .actions > *, .actions .btn { flex: 1 1 auto; } .actions form .btn { width: 100%; } }

.checks { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 8px; }
.checks li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.check-icon { flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--surface-2); color: var(--muted); }
.checks li.is-ok .check-icon { background: var(--ok-soft); color: var(--ok); }
.checks li.is-bad { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: var(--bad-soft); }
.checks li.is-bad .check-icon { background: var(--bad); color: #fff; }
.checks li.is-warn .check-icon { background: var(--warn-soft); color: var(--warn); }
.check-label { font-weight: 500; overflow-wrap: anywhere; }
.check-fix { margin: 4px 0 0; font-size: .9rem; color: var(--text); }
.tag { display: inline-block; margin-inline-start: 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.done-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--ok), #22c55e); margin-bottom: 16px; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.next { margin: 0; padding-inline-start: 1.2em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* icons inside server-rendered pages */
.brand-mark .icon { width: 18px; height: 18px; color: #fff; stroke-width: 2; }
.rail-dot .icon, .check-icon .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.done-mark .icon { width: 32px; height: 32px; stroke-width: 2.5; }

.done-art img { display: block; width: 220px; max-width: 70%; height: auto; margin: -12px 0 8px; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }

/* ---------- sign-in: the form on one side, a live miniature of a real quiz on the other ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(400px, 5fr) 7fr; background: var(--surface); }
.auth-side { display: flex; flex-direction: column; padding: clamp(24px, 4vw, 48px); min-width: 0; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.auth-body { width: 100%; max-width: 380px; margin: auto; padding: 40px 0; }
.auth-title { font-size: clamp(1.9rem, 1.4rem + 1.4vw, 2.5rem); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 10px; }
.auth-lead { color: var(--text-2); margin: 0 0 28px; font-size: 1.02rem; }
.auth-foot { color: var(--muted); font-size: .85rem; }
.auth .field input { min-height: 48px; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-inline-end: 50px; }
.pass-toggle {
  position: absolute; inset-inline-end: 5px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: color 150ms ease, background-color 150ms ease;
}
.pass-toggle:hover { color: var(--text); background: var(--surface-2); }
.pass-toggle .icon { width: 18px; height: 18px; }
.pass-toggle .when-shown, .pass-toggle[aria-pressed="true"] .when-hidden { display: none; }
.pass-toggle[aria-pressed="true"] .when-shown { display: block; }
.auth-submit { min-height: 50px; margin-top: 8px; font-size: 1rem; transition: transform 160ms var(--ease-out), filter 150ms ease; }
.auth-submit:active { transform: scale(.97); }
.demo-note {
  display: grid; gap: 4px; padding: 12px 14px; margin-bottom: 18px; border-radius: var(--r-sm); font-size: .92rem;
  background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
}
.demo-note strong { display: flex; align-items: center; gap: 6px; color: var(--primary); }
.demo-note .icon { width: 15px; height: 15px; }

/* Entrance: heading, text, then the form fields, each 60ms after the last. */
.auth-body > *, .auth-form > * { animation: auth-in 560ms var(--ease-out) both; }
.auth-body > :nth-child(2) { animation-delay: 60ms; }
.auth-body > :nth-child(3) { animation-delay: 120ms; }
.auth-body > :nth-child(4) { animation-delay: 180ms; }
.auth-form > :nth-child(2) { animation-delay: 200ms; }
.auth-form > :nth-child(3) { animation-delay: 260ms; }
.auth-form > :nth-child(4) { animation-delay: 320ms; }
@keyframes auth-in { from { opacity: 0; transform: translateY(14px); } }

.auth-art { position: relative; overflow: hidden; isolation: isolate; background: #0b0820; display: grid; place-items: center; }
/* Each scene drifts slowly while it is on screen, and fades into the next one. */
.auth-scene { position: absolute; inset: 0; background: center / cover no-repeat; opacity: 0; transform: scale(1.08); transition: opacity 1000ms ease, transform 7s linear; }
.auth-scene.is-on { opacity: 1; transform: scale(1); }
.auth-art::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, transparent 58%, rgb(5 6 15 / .6)); }
.auth-card {
  position: relative; z-index: 2; width: min(400px, 72%); padding: 24px; border-radius: 22px; background: var(--s); color: var(--t); font-family: var(--f, inherit);
  box-shadow: 0 2px 6px rgb(0 0 0 / .14), 0 36px 90px rgb(0 0 0 / .38); transition: background-color 700ms ease, color 700ms ease;
  animation: auth-card-in 900ms var(--ease-out) 240ms both;
}
@keyframes auth-card-in { from { opacity: 0; transform: translateY(28px) scale(.96); } }
.auth-card-top { display: flex; align-items: center; justify-content: space-between; font-size: .82rem; font-weight: 700; }
.auth-chip { padding: 2px 10px; border-radius: 99px; background: var(--p); color: var(--i); font-weight: 800; transition: background-color 700ms ease, color 700ms ease; }
.auth-steps { display: flex; gap: 4px; margin: 14px 0 16px; }
.auth-steps b { flex: 1; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--t) 14%, transparent); }
.auth-steps b:nth-child(-n+3) { background: var(--r); }
.auth-q { margin: 0 0 14px; font-weight: 800; font-size: 1.12rem; line-height: 1.3; }
.auth-a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; font-weight: 700; font-size: .95rem;
  border: 2px solid color-mix(in srgb, var(--t) 14%, transparent); transition: border-color 300ms ease, background-color 300ms ease;
}
.auth-a b { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: .82rem; color: var(--p); background: color-mix(in srgb, var(--t) 8%, transparent); }
.auth-card.is-revealed .auth-a.is-right { border-color: var(--r); background: color-mix(in srgb, var(--r) 16%, transparent); }
.auth-card.is-revealed .auth-a.is-right b { animation: auth-pop 380ms var(--ease-out); }
@keyframes auth-pop { 40% { transform: scale(1.18); } }
.auth-claim { position: absolute; z-index: 2; inset-inline: clamp(24px, 4vw, 48px); bottom: clamp(24px, 4vw, 44px); margin: 0; max-width: 30ch; color: #fff; font-size: 1.15rem; font-weight: 650; line-height: 1.35; text-shadow: 0 1px 3px rgb(0 0 0 / .45); }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-body { padding: 28px 0; }
  /* On phones the scene becomes a band across the top. */
  .auth-side::before { content: ""; display: block; height: 128px; margin: calc(-1 * clamp(24px, 4vw, 48px)) calc(-1 * clamp(24px, 4vw, 48px)) 24px; background: var(--auth-scene) center / cover no-repeat; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-body > *, .auth-form > *, .auth-card { animation: none; }
  .auth-scene { transform: none; transition: opacity 300ms ease; }
}

.brand-icon { width: 34px; height: 34px; border-radius: 10px; }
.auth-logo img { display: block; max-height: 40px; max-width: 220px; object-fit: contain; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); }

/* Sign-in help and recovery */
.recover-note { display: grid; gap: 8px; padding: 14px; margin-bottom: 18px; border-radius: var(--r-sm); font-size: .92rem; line-height: 1.45; background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 28%, transparent); }
.recover-note strong { display: flex; align-items: center; gap: 6px; color: var(--ok); }
.recover-note .icon { width: 16px; height: 16px; flex: none; }
.recover-note .btn { margin-top: 4px; }
.recover-email { overflow-wrap: anywhere; font-size: 1.02rem; }
.recover-help { margin-top: 22px; font-size: .92rem; color: var(--text-2); }
.recover-help summary { cursor: pointer; padding: 8px 0; color: var(--muted); font-weight: 600; list-style-position: inside; }
.recover-help summary:hover { color: var(--text); }
.recover-help summary:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; border-radius: 6px; }
.recover-help ol { margin: 6px 0 0; padding-inline-start: 1.4em; display: grid; gap: 8px; line-height: 1.5; }
.recover-help code { overflow-wrap: anywhere; }
