/* ── Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] { display: none !important; }

:root {
  --blue:        #eea012;
  --blue-hover:  #d4890a;
  --blue-light:  #fef3dc;
  --sky:         #26beea;
  --sky-hover:   #1da8d4;
  --sky-light:   #e0f6fd;
  --green:       #1A7F4B;
  --green-light: #E6F4EC;
  --red:         #e54b48;
  --red-light:   #fdf0f0;
  --text:        #111827;
  --text-muted:  #6B7280;
  --bg:          #F0F4F8;
  --card:        #FFFFFF;
  --border:      #D1D5DB;
  --radius-sm:   8px;
  --radius:      16px;
  --shadow:      0 4px 24px rgba(0, 0, 0, 0.08);
  --transition:  0.15s ease;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Page wrapper ──────────────────────────────────────────────────────── */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  gap: 28px;
}

/* ── Brand header ──────────────────────────────────────────────────────── */
.brand {
  text-align: center;
}

.brand-wordmark {
  font-size: 32px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -1px;
  line-height: 1;
}

.brand-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 6px;
}

.brand--small .brand-wordmark { font-size: 22px; }
.brand--small .brand-subtitle { font-size: 12px; margin-top: 3px; }

/* ── Card ──────────────────────────────────────────────────────────────── */
.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 24px;
}

.card__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.card__body {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ── Form fields ───────────────────────────────────────────────────────── */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  height: 52px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;         /* 16px prevents iOS zoom */
  padding: 0 16px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(238, 160, 18, 0.2);
}

.field input::placeholder {
  color: #9CA3AF;
}

/* Code input — big digits, centred */
.field input.input--code {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
  padding: 0 12px;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition), opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--blue);
  color: #fff;
  margin-top: 8px;
}

.btn--primary:not(:disabled):active { background: #b8780c; }
.btn--primary:not(:disabled):hover  { background: var(--blue-hover); }

.btn--ghost {
  background: none;
  color: var(--blue);
  font-size: 15px;
  font-weight: 500;
  height: auto;
  padding: 10px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn--ghost:not(:disabled):hover { opacity: 0.75; }

/* Loading spinner on button */
.btn--loading .btn-label { opacity: 0.7; }
.btn--loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

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

/* ── Alert / error strip ───────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 16px;
}

.alert--error {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #FECACA;
}

.alert--info {
  background: var(--sky-light);
  color: var(--sky);
  border: 1px solid #93e3f7;
}

.alert[hidden] { display: none; }

/* ── Divider links row ─────────────────────────────────────────────────── */
.link-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.page-footer {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  max-width: 380px;
  line-height: 1.6;
}

/* ── Step visibility ───────────────────────────────────────────────────── */
.step[hidden] { display: none; }

/* ── Completion card ───────────────────────────────────────────────────── */
.check-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.check-circle svg {
  width: 36px;
  height: 36px;
  stroke: var(--green);
  stroke-width: 2.5;
  fill: none;
}

.card--complete {
  text-align: center;
}

.card--complete .card__title {
  font-size: 24px;
  margin-bottom: 10px;
}

.completion-meta {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Player page ───────────────────────────────────────────────────────── */
.page--player {
  justify-content: flex-start;
  padding-top: 16px;
}

.player-header {
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.player-card {
  width: 100%;
  max-width: 720px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.video-placeholder {
  aspect-ratio: 16 / 9;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  opacity: 0.7;
}

.player-info {
  padding: 20px 24px;
}

.player-info h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.player-info p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Spinner (standalone) ──────────────────────────────────────────────── */
.spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  color: var(--text-muted);
  font-size: 15px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card {
    border-radius: 12px;
    padding: 28px 20px;
  }
}

@media (min-width: 640px) {
  .page { gap: 32px; }
  .brand-wordmark { font-size: 36px; }
}
