/* ═══════════════════════════════════════════════
   MagicListen PWA — main.css  v5.0  Figma-exact
   Primary: #001D6C · Font: Noto Sans SC
   ═══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #001D6C;
  --blue-mid:   #0043CE;
  --blue-light: #E6F1FF;
  --blue-faint: #EEF3FF;
  --green:      #22C55E;
  --green-dark: #16A34A;
  --grey-50:    #F8F9FA;
  --grey-100:   #F1F3F5;
  --grey-200:   #E9ECEF;
  --grey-300:   #DEE2E6;
  --grey-400:   #ADB5BD;
  --grey-600:   #6C757D;
  --grey-800:   #343A40;
  --white:      #FFFFFF;
  --danger:     #DC3545;
  --font:       'Noto Sans SC', 'Source Han Sans', system-ui, sans-serif;
  --nav-h:      64px;
  --safe-b:     env(safe-area-inset-bottom, 0px);
  --safe-t:     env(safe-area-inset-top, 0px);
  --r-pill:     100px;
  --r-lg:       20px;
  --r-md:       14px;
  --r-sm:       10px;
}

html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--grey-800);
  background: var(--grey-50);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ────────────────────────────────── */
#ml-app {
  position: fixed;
  top: var(--safe-t); left: 0; right: 0; bottom: var(--nav-h);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--white);
}

/* ── Splash ───────────────────────────────────── */
#ml-splash {
  position: fixed; inset: 0; z-index: 999;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .35s;
}
#ml-splash img { width: 80px; }

/* ── Bottom nav ───────────────────────────────── */
#ml-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--blue); /* dark navy per Figma */
  display: flex; align-items: stretch; z-index: 100;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.55);
  font-size: 11px; font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.nav-btn.active { color: var(--white); }
.nav-btn svg { stroke: currentColor; }

/* ── Screens ──────────────────────────────────── */
.screen { min-height: 100%; display: flex; flex-direction: column; background: var(--white); }

/* ── Buttons ──────────────────────────────────── */
.btn-primary {
  width: 100%; padding: 16px;
  background: var(--blue); color: var(--white);
  border: none; border-radius: var(--r-pill);
  font-size: 16px; font-weight: 700; font-family: var(--font);
  cursor: pointer; letter-spacing: .01em;
  transition: opacity .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary:not(:disabled):active { transform: scale(.98); opacity: .9; }

.btn-outline {
  width: 100%; padding: 15px;
  background: transparent; color: var(--blue);
  border: 1.5px solid var(--blue); border-radius: var(--r-pill);
  font-size: 16px; font-weight: 600; font-family: var(--font);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.btn-outline:active { background: var(--blue-faint); }

.btn-ghost {
  width: 100%; padding: 12px;
  background: transparent; border: none;
  color: var(--grey-600); font-size: 14px; font-family: var(--font);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn-back {
  width: 36px; height: 36px;
  background: var(--grey-100); border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ── Inputs ───────────────────────────────────── */
.ml-input {
  width: 100%; padding: 15px 18px;
  background: var(--grey-100);
  border: 1.5px solid transparent; border-radius: var(--r-pill);
  font-size: 15px; font-family: var(--font); color: var(--grey-800);
  outline: none; transition: border-color .15s, background .15s;
}
.ml-input:focus { border-color: var(--blue); background: var(--white); }
.ml-input::placeholder { color: var(--grey-400); }

.field-label { display: block; font-size: 13px; color: var(--grey-600); margin-bottom: 8px; }
.field-err   { font-size: 13px; color: var(--danger); margin-top: 8px; }

/* ── Loader ───────────────────────────────────── */
.loader-full {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
  color: var(--grey-600); font-size: 15px;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--grey-200); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════
   LANDING — Figma exact
════════════════════════════════════ */
.screen-landing {
  min-height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 0 28px;
  background: var(--white);
  gap: 32px;
}
.land-hero {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 0;
}
.land-logo { width: 100px; margin-bottom: 14px; }
.land-title {
  font-size: 28px; font-weight: 900;
  color: var(--blue); letter-spacing: -.01em;
  margin-bottom: 4px; text-align: center;
  font-style: italic;
}
.land-sub {
  font-size: 15px; font-weight: 700; color: var(--blue);
  text-align: center; margin-bottom: 0;
}
.land-actions {
  width: 100%;
  display: flex; flex-direction: column; gap: 14px;
}
.land-login-btn {
  width: 100%; padding: 18px;
  background: var(--blue); color: var(--white);
  border: none; border-radius: var(--r-pill);
  font-size: 18px; font-weight: 700; font-family: var(--font);
  cursor: pointer; letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s;
}
.land-login-btn:active { opacity: .9; }
.agree-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 13px; color: var(--grey-600); cursor: pointer;
  text-align: center; line-height: 1.5;
}
.agree-chk { width: 18px; height: 18px; accent-color: var(--blue); flex-shrink: 0; }

/* Password show/hide wrapper */
.pw-wrap {
  position: relative;
  display: flex; align-items: center;
}
.pw-wrap .ml-input {
  width: 100%; padding-right: 48px;
}
.pw-eye {
  position: absolute; right: 14px;
  background: none; border: none; cursor: pointer;
  color: var(--grey-400); padding: 4px;
  display: flex; align-items: center;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.pw-eye:hover { color: var(--blue); }

@keyframes ml-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
.link-blue { color: var(--blue-mid); text-decoration: underline; }

/* ── Login modal overlay (slides up from bottom) */
.login-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.4);
  display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity .28s;
}
.login-overlay.open { opacity: 1; pointer-events: auto; }
.login-overlay.open .login-sheet { transform: translateY(0); }
.login-sheet {
  width: 100%; background: var(--white);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 28px 24px calc(32px + var(--safe-b));
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.login-sheet-logo { display: block; width: 64px; margin: 0 auto 20px; }
.login-step { display: flex; flex-direction: column; gap: 12px; }
.pin-sent-msg { font-size: 14px; color: var(--grey-600); text-align: center; line-height: 1.6; }
.pin-sent-msg strong { color: var(--blue); display: block; font-size: 15px; }
.pin-inputs { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
.pin-box {
  width: 46px; height: 56px;
  border: 1.5px solid var(--grey-300); border-radius: var(--r-sm);
  text-align: center; font-size: 26px; font-weight: 700;
  color: var(--blue); font-family: var(--font);
  background: var(--grey-50); outline: none;
  transition: border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.pin-box:focus { border-color: var(--blue); background: var(--white); }

/* ════════════════════════════════════
   ONBOARDING — Figma exact
════════════════════════════════════ */
.screen-onboard {
  min-height: 100%; background: var(--white);
  display: flex; flex-direction: column;
  justify-content: center; padding: 0 20px;
}
.ob-topbar {
  padding: 20px 4px 0;
  font-size: 18px; font-weight: 700; color: var(--blue);
}
.ob-body {
  flex: 1; display: flex; flex-direction: column;
  padding: 24px 4px;
}
.ob-heading {
  font-size: 22px; font-weight: 900; color: var(--blue);
  margin-bottom: 24px;
}
.grade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.grade-card {
  border: 2px solid var(--grey-300); border-radius: var(--r-lg);
  padding: 16px 14px 20px;
  background: var(--white); cursor: pointer;
  display: flex; flex-direction: column;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s;
  position: relative;
}
.grade-card.selected { border-color: var(--blue); }
.grade-card-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--grey-300); margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.grade-card.selected .grade-card-check {
  border-color: var(--blue); background: var(--blue);
}
.grade-card.selected .grade-card-check::after {
  content: ''; width: 5px; height: 9px;
  border: 2px solid white; border-top: none; border-left: none;
  transform: rotate(45deg) translateY(-1px);
}
.gc-code {
  font-size: 26px; font-weight: 900; color: var(--blue);
  display: block; margin-bottom: 12px;
}
.gc-dots { display: flex; gap: 4px; margin-top: auto; }
.gc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--grey-300);
}
.grade-card.selected .gc-dot { background: var(--blue); }
.gc-dot:last-child { background: var(--grey-200); }

.ob-email-block { margin-bottom: 20px; }
.ob-footer { padding-bottom: 0; }

/* ════════════════════════════════════
   DASHBOARD — Figma exact
════════════════════════════════════ */
.dash-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 10px;
}
.dash-logo { height: 30px; width: auto; }
.dash-title { font-size: 16px; font-weight: 900; color: var(--blue); }
.dash-grade { font-size: 14px; color: var(--grey-600); font-weight: 400; margin-left: 6px; }

/* Active lesson hero card */
.active-lesson-card {
  margin: 0 16px 20px;
  border: 1.5px solid var(--blue-light);
  border-radius: var(--r-lg);
  padding: 16px;
  background: var(--white);
}
.alc-name {
  font-size: 17px; font-weight: 900; color: var(--blue);
  margin-bottom: 12px; line-height: 1.3;
}
.alc-prog-wrap { margin-bottom: 14px; }
.alc-prog-track {
  width: 100%; height: 10px;
  background: var(--grey-200); border-radius: 5px;
  overflow: hidden; position: relative;
}
.alc-prog-fill {
  height: 100%; background: var(--green);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 6px;
  width: 0;
  animation: prog-grow .8s .1s ease forwards;
}
@keyframes prog-grow { to { width: var(--prog-w, 0%); } }
.alc-prog-pct { font-size: 10px; font-weight: 700; color: var(--white); }
.alc-photo-btn {
  width: 100%; padding: 14px;
  background: var(--blue); color: var(--white);
  border: none; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 700; font-family: var(--font);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
/* Enabled: strong 3-ring pop-out like Duolingo */
.alc-photo-btn:not(:disabled) {
  animation: btn-pop 1.6s cubic-bezier(.4,0,.6,1) infinite;
}
/* Disabled: clear gray so user knows it is not clickable */
.alc-photo-btn:disabled {
  background: #C8CDD6;
  color: #8A909B;
  cursor: not-allowed;
  opacity: 1;
  animation: none;
}
.alc-photo-btn svg { flex-shrink: 0; }

/* Lesson list */
.dash-section-title {
  font-size: 18px; font-weight: 900; color: var(--blue);
  padding: 0 16px 12px;
}
.lesson-timeline { padding: 0 16px 100px; display: flex; flex-direction: column; }
.lesson-row {
  display: flex; align-items: stretch; gap: 12px;
  margin-bottom: 10px;
}
.lesson-icon-col {
  display: flex; flex-direction: column; align-items: center;
  flex-shrink: 0; width: 36px;
}
.lesson-circle {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
}
.lc-done    { background: var(--green); color: var(--white); }
.lc-active  { background: var(--blue-faint); border: 2px solid var(--blue); color: var(--blue); }
.lc-locked  { background: var(--grey-100); color: var(--grey-400); }
.lesson-connector {
  flex: 1; width: 2px; background: var(--grey-200);
  margin: 3px auto 0; min-height: 14px;
}
.lesson-card-item {
  flex: 1; padding: 12px 14px;
  border: 1px solid var(--grey-200); border-radius: var(--r-md);
  background: var(--white); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 52px;
  transition: border-color .15s, background .15s;
}
.lesson-card-item:active { background: var(--grey-50); }
.lci-done { border-color: var(--green); }
.lci-locked { opacity: .6; }
.lci-name { font-size: 14px; font-weight: 600; color: var(--grey-800); }
.lci-locked .lci-name { color: var(--grey-600); }
.lci-tag {
  font-size: 11px; font-weight: 700;
  background: var(--blue); color: var(--white);
  padding: 3px 8px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
}
.lci-free-tag {
  font-size: 11px; color: var(--blue);
  background: var(--blue-light); padding: 2px 8px;
  border-radius: 20px; font-weight: 600;
  flex-shrink: 0;
}
/* Lesson card pulse — strong expanding ring */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0   rgba(0,29,108,.6); }
  60%  { box-shadow: 0 0 0 12px rgba(0,29,108,0); }
  100% { box-shadow: 0 0 0 0   rgba(0,29,108,0); }
}
@keyframes photo-btn-pulse {
  0%   { box-shadow: 0 0 0 0    rgba(0,29,108,.8); }
  60%  { box-shadow: 0 0 0 18px rgba(0,29,108,0);  }
  100% { box-shadow: 0 0 0 0    rgba(0,29,108,0);  }
}
.lci-pulse {
  animation: pulse-ring 1.6s cubic-bezier(.4,0,.6,1) infinite;
  border: 2px solid var(--blue) !important;
}

/* Unlock pulse — first locked lesson when payment needed */
@keyframes unlock-pulse {
  0%   { box-shadow: 0 0 0 0    rgba(245,158,11,.7); }
  60%  { box-shadow: 0 0 0 12px rgba(245,158,11,0);  }
  100% { box-shadow: 0 0 0 0    rgba(245,158,11,0);  }
}
.lci-pulse-unlock {
  animation: unlock-pulse 1.8s cubic-bezier(.4,0,.6,1) infinite !important;
  border: 2px solid #F59E0B !important;
  opacity: 1 !important;
}
.lci-pulse-unlock .lci-name { color: var(--grey-800) !important; }

/* Red dot indicator */
.red-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #EF4444; margin-left: auto; margin-right: 4px; flex-shrink: 0;
}

/* ════════════════════════════════════
   MODALS
════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; transition: opacity .25s;
  pointer-events: none;
}
.modal-overlay.modal-on { pointer-events: auto; }
.modal-overlay.modal-on { opacity: 1; }
.modal-overlay.modal-on .modal-box { transform: scale(1); }
.modal-box {
  background: var(--white); border-radius: var(--r-lg);
  padding: 28px 24px;
  width: 100%; max-width: 340px;
  transform: scale(.92);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
  position: relative;
  max-height: 90vh; overflow-y: auto;
}
.modal-close-x {
  position: absolute; top: 12px; right: 14px;
  background: var(--grey-100); border: none;
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 14px; color: var(--grey-600); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
/* Material Sent modal */
.m-check-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--blue); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; font-size: 22px;
}
.m-title { font-size: 20px; font-weight: 900; color: var(--blue); text-align: center; margin-bottom: 12px; }
.m-body  { font-size: 14px; color: var(--grey-600); line-height: 1.7; margin-bottom: 14px; }
.m-body strong { color: var(--grey-800); }
.m-email { color: var(--blue); font-weight: 700; }
.m-steps { padding-left: 18px; margin: 10px 0 14px; }
.m-steps li { font-size: 14px; color: var(--grey-600); margin-bottom: 6px; line-height: 1.5; }
.m-steps li strong { color: var(--grey-800); }
.m-change-link {
  font-size: 13px; color: var(--grey-600); text-align: center;
  display: block; margin-bottom: 16px; line-height: 1.5;
}
.m-change-link a { color: var(--blue); font-weight: 700; text-decoration: none; }
/* Unlock modal */
.m-pigeon { display: block; width: 80px; margin: 0 auto 12px; }
.m-contact {
  background: var(--blue-faint); border: 1px solid var(--blue-light);
  border-radius: var(--r-md); padding: 14px;
  font-size: 16px; font-weight: 700; color: var(--blue);
  text-align: center; margin: 12px 0; word-break: break-all;
}
.m-contact-link { color: var(--blue); text-decoration: underline; }
.m-note { font-size: 12px; color: var(--grey-400); text-align: center; margin-top: 10px; }
.m-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ════════════════════════════════════
   UPLOAD SOURCE SCREEN
════════════════════════════════════ */
.upload-hdr {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--grey-200);
}
.upload-hdr-text { display: flex; flex-direction: column; }
.upload-hdr-grade { font-size: 12px; color: var(--grey-400); }
.upload-hdr-title { font-size: 15px; font-weight: 900; color: var(--blue); }
.upload-source-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; padding: 20px 16px 0;
}
.upload-source-subtitle {
  font-size: 14px; font-weight: 700; color: var(--blue);
  margin-bottom: 20px; align-self: flex-start;
}
.upload-drop-zone {
  width: 100%; aspect-ratio: 4/3;
  border: 2px dashed var(--grey-300);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; margin-bottom: 16px;
  background: var(--grey-50);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.upload-drop-zone:active { border-color: var(--blue); background: var(--blue-faint); }
.upload-cam-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--grey-200);
  display: flex; align-items: center; justify-content: center;
  color: var(--grey-600); font-size: 22px;
}
.upload-foot {
  width: 100%; margin-top: auto;
  padding: 0 0 calc(20px + var(--safe-b));
  display: flex; flex-direction: column; gap: 12px;
}

/* ════════════════════════════════════
   15-SLOT GRID
════════════════════════════════════ */
.grid-hdr {
  padding: 0 16px 10px;
}
.grid-hdr-title { font-size: 18px; font-weight: 900; color: var(--blue); margin-bottom: 2px; }
.grid-hdr-sub   { font-size: 13px; color: var(--grey-600); }
.upload-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 8px; padding: 0 16px;
}
.grid-slot { aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; position: relative; }

/* Filled slot */
.gs-filled { background: var(--white); box-shadow: 0 1px 6px rgba(0,0,0,.10); }
.gs-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gs-check {
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--green); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.gs-uploading {
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--blue);
  animation: spin .7s linear infinite;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: white;
}

/* Today's task empty slot */
.gs-today {
  border: 2px dashed var(--blue); border-radius: var(--r-sm);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px; cursor: pointer; background: var(--white);
  -webkit-tap-highlight-color: transparent;
}
.gs-today:active { background: var(--blue-faint); }
.gs-today-plus { font-size: 28px; color: var(--blue); line-height: 1; font-weight: 300; }
.gs-today-label { font-size: 10px; font-weight: 600; color: var(--blue); }

/* Future empty slot */
.gs-empty {
  background: var(--grey-100); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--grey-300); font-size: 24px;
}
.grid-foot { padding: 16px 16px calc(16px + var(--safe-b)); }

/* ════════════════════════════════════
   SUCCESS SCREEN
════════════════════════════════════ */
.success-screen {
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 20px calc(32px + var(--safe-b));
  text-align: center;
}
.suc-header {
  display: flex; align-items: center; gap: 10px;
  align-self: flex-start; margin-bottom: 24px;
}
.suc-title { font-size: 28px; font-weight: 900; color: var(--blue); margin-bottom: 4px; }
.suc-title-sub { font-size: 22px; font-weight: 900; color: var(--blue); margin-bottom: 4px; text-align:center; }
.suc-brewing { font-size: 14px; color: var(--blue); text-align: center; margin-bottom: 8px; font-weight:500; }
.suc-sub   { font-size: 14px; color: var(--grey-600); margin-bottom: 20px; }
.suc-pigeon { width: 130px; margin-bottom: 24px; }

.suc-prog-wrap { width: 100%; margin-bottom: 6px; }
.suc-prog-track {
  width: 100%; height: 8px; background: var(--grey-200);
  border-radius: 4px; overflow: hidden;
}
.suc-prog-fill {
  height: 100%; background: var(--blue); border-radius: 4px;
  transition: width .8s ease;
}
.suc-prog-pct { font-size: 12px; color: var(--grey-600); text-align: right; margin-top: 4px; }
.suc-count    { font-size: 14px; color: var(--grey-700); margin-bottom: 20px; }

/* Streak row */
.streak-section { width: 100%; margin-bottom: 24px; }
.streak-labels {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--grey-400); margin-bottom: 8px;
}
.streak-row { display: flex; align-items: center; gap: 6px; width: 100%; }
.sk-day { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 1; }
.sk-dot {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--grey-200);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--grey-400);
  transition: background .2s;
}
.sk-on .sk-dot    { background: var(--blue); color: var(--white); }
.sk-today .sk-dot { background: var(--blue); color: var(--white); box-shadow: 0 0 0 4px rgba(0,29,108,.15); }
.sk-lbl { font-size: 11px; color: var(--grey-400); font-weight: 600; }
.sk-on .sk-lbl, .sk-today .sk-lbl { color: var(--blue); }
/* Treasure chest special slot */
.sk-chest .sk-dot { background: #F59E0B; font-size: 18px; color: white; }
.suc-back-btn { margin-top: auto; width: 100%; }

/* ════════════════════════════════════
   PROFILE / EMPTY STATE
════════════════════════════════════ */
.app-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--grey-200);
  position: sticky; top: 0; z-index: 10;
  background: var(--white); flex-shrink: 0;
}
.h-logo  { height: 28px; }
.h-grade { font-size: 13px; font-weight: 700; color: var(--blue); }

.profile-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 24px 24px; gap: 6px;
}
.pf-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--blue); color: var(--white);
  font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.pf-name  { font-size: 18px; font-weight: 700; }
.pf-grade { font-size: 13px; color: var(--blue); font-weight: 600; }
.pf-email { font-size: 13px; color: var(--grey-400); }

.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  padding: 40px 24px; text-align: center;
  color: var(--grey-600); font-size: 15px; line-height: 1.7;
}
.empty-pigeon { width: 80px; animation: float 2.8s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.err-msg { padding: 40px 24px; text-align: center; color: var(--danger); font-size: 15px; }

/* ── Loading state with pigeon ────────────────── */
.loading-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; gap: 20px;
}
.load-pigeon { width: 90px; animation: float 2.8s ease-in-out infinite; }
.load-txt { font-size: 18px; font-weight: 700; color: var(--blue); }

/* ── Toast ─────────────────────────────────────── */
.ml-toast {
  position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--grey-800); color: var(--white);
  padding: 10px 20px; border-radius: 20px; font-size: 13px;
  opacity: 0; pointer-events: none; z-index: 300;
  transition: opacity .2s, transform .2s;
  white-space: nowrap; max-width: calc(100vw - 40px);
}
.ml-toast.toast-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ════════════════════════════════════
   LOGIN SCREENS (full screen, not modal)
   Matches Figma: logo top, input middle, button bottom
════════════════════════════════════ */

/* Shared layout for email + PIN screens */
.screen-login-email,
.screen-login-pin {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--white);
  position: relative;
  padding: 60px 28px 32px;
  gap: 24px;
}

/* Back button top-left */
.login-back-btn {
  position: absolute;
  top: 16px; left: 16px;
  width: 36px; height: 36px;
  background: var(--grey-100); border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10;
  -webkit-tap-highlight-color: transparent;
  color: var(--grey-800);
}
.login-back-btn:active { background: var(--grey-200); }

/* Logo + input area — vertically centered */
.login-screen-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 20px;
}

.login-screen-logo {
  width: 90px;
}

.login-screen-fields {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Login screens use the same pill input but with grey background */
.login-input {
  background: var(--grey-100);
  border: 1.5px solid transparent;
  border-radius: var(--r-pill);
  font-size: 16px;
  padding: 16px 20px;
  text-align: center;
  color: var(--grey-800);
}
.login-input:focus { border-color: var(--blue); background: var(--white); }
.login-input::placeholder { color: var(--grey-400); text-align: center; }

/* PIN card — white rounded card like Figma */
.pin-card {
  width: 100%;
  background: var(--grey-50);
  border-radius: var(--r-lg);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--grey-200);
}
.pin-sent-msg   { font-size: 13px; color: var(--grey-600); text-align: center; }
.pin-sent-email { font-size: 15px; font-weight: 700; color: var(--blue-mid); text-align: center; }

/* PIN boxes */
.pin-inputs { display: flex; gap: 8px; justify-content: center; margin: 4px 0; }
.pin-box {
  width: 44px; height: 52px;
  border: 1.5px solid var(--grey-300);
  border-radius: var(--r-sm);
  text-align: center;
  font-size: 24px; font-weight: 700;
  color: var(--blue); font-family: var(--font);
  background: var(--white); outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s;
}
.pin-box:focus { border-color: var(--blue); }

/* Button fixed at bottom */
.login-screen-foot {
  padding: 8px 28px calc(20px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Camera button — strong Duolingo-style 3-ring pop */
@keyframes btn-pop {
  0%   {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0,29,108,.3), 0 0 0 0 rgba(0,29,108,.15), 0 0 0 0 rgba(0,29,108,.06);
  }
  45%  {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(0,29,108,.15), 0 0 0 5px rgba(0,29,108,.07), 0 0 0 7px rgba(0,29,108,.03);
  }
  75%  {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(0,29,108,.06), 0 0 0 10px rgba(0,29,108,.03), 0 0 0 14px rgba(0,29,108,0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0,29,108,0), 0 0 0 0 rgba(0,29,108,0), 0 0 0 0 rgba(0,29,108,0);
  }
}

/* ════════════════════════════════════════════════
   STUDY SCREEN — Audio Player + PDF Viewer
   The screen-study container is position:fixed like
   #ml-app so the PDF iframe can fill the full height.
════════════════════════════════════════════════ */

/* ── The study screen takes over the full app area ── */
/* screen-study-audio and screen-study-pdf both use  */
/* position:fixed so they fill exactly like #ml-app.  */
.screen-study-audio,
.screen-study-pdf {
  position: fixed;
  top: var(--safe-t);
  left: 0; right: 0; bottom: 0; /* no nav — nav is hidden */
  background: var(--white);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

/* ── Shared header ── */
.study-hdr {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--grey-200);
  flex-shrink: 0;
  background: var(--white);
}
.study-hdr-text { display: flex; flex-direction: column; overflow: hidden; flex: 1; min-width: 0; }
.study-hdr-grade { font-size: 12px; color: var(--grey-400); }
.study-hdr-title {
  font-size: 15px; font-weight: 900; color: var(--blue);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ════════════════════
   AUDIO SCREEN
════════════════════ */
.study-audio-body {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 20px;
  gap: 24px;
  overflow-y: auto;
}

.study-lesson-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--blue-faint); color: var(--blue);
  font-size: 13px; font-weight: 700;
  padding: 8px 18px; border-radius: var(--r-pill);
}

/* Audio player card */
.audio-player-card {
  width: 100%; max-width: 520px;
  background: var(--grey-50);
  border: 1.5px solid var(--grey-200);
  border-radius: var(--r-lg);
  padding: 28px 24px 24px;
  display: flex; flex-direction: column; gap: 24px;
}
.audio-track-name {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 700; color: var(--blue);
  line-height: 1.4;
}

/* Progress bar */
.audio-progress-wrap {
  display: flex; align-items: center; gap: 12px;
}
.audio-time {
  font-size: 12px; font-weight: 600; color: var(--grey-600);
  flex-shrink: 0; min-width: 38px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.audio-progress-track {
  flex: 1; height: 8px;
  background: var(--grey-300); border-radius: 4px;
  cursor: pointer; position: relative;
}
.audio-progress-fill {
  position: absolute; top: 0; left: 0;
  height: 100%; background: var(--blue);
  border-radius: 4px; width: 0%;
  transition: width .2s linear;
  pointer-events: none;
}

/* Controls */
.audio-controls {
  display: flex; align-items: center; justify-content: center; gap: 28px;
}
.audio-ctrl-btn {
  border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s, opacity .15s;
  position: relative; flex-shrink: 0;
}
.audio-ctrl-btn:active { transform: scale(.88); opacity: .8; }

.audio-ctrl-play {
  width: 72px; height: 72px;
  background: var(--blue); color: var(--white);
  border-radius: 50%;
  box-shadow: 0 6px 24px rgba(0,29,108,.32);
}
.audio-ctrl-play:active { background: var(--blue-mid); transform: scale(.94); }

.audio-ctrl-stop,
.audio-ctrl-fwd {
  width: 48px; height: 48px;
  background: var(--white); color: var(--blue);
  border-radius: 50%;
  border: 1.5px solid var(--grey-300);
}
.audio-ctrl-fwd-label {
  position: absolute; bottom: 8px;
  font-size: 9px; font-weight: 800; color: var(--blue);
  line-height: 1; pointer-events: none;
}

.audio-unavail {
  font-size: 13px; color: var(--grey-400); text-align: center;
}
.study-hint {
  font-size: 15px; color: var(--grey-600);
  text-align: center;  line-height: 1.65;
}

/* Audio screen footer */
.study-foot {
  padding: 16px 20px calc(16px + var(--safe-b));
  flex-shrink: 0;
  border-top: 1px solid var(--grey-200);
  background: var(--white);
}

/* ════════════════════
   PDF SCREEN
════════════════════ */

/* "Take Photo" button pinned at top */
.study-pdf-top {
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-200);
  flex-shrink: 0;
  background: var(--white);
}
.study-take-photo-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  animation: photo-btn-pulse 1.4s cubic-bezier(.4,0,.6,1) infinite;
}

/* PDF fills all remaining space — no fixed height needed */
.study-pdf-viewer {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0; /* critical: lets flex child shrink properly */
}
.study-pdf-iframe {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  border: none;
}
.study-pdf-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 16px;
  color: var(--grey-400); padding: 40px 20px;
  text-align: center; font-size: 14px;
}

/* ════════════════════
   RESPONSIVE
════════════════════ */

/* Tablet ≥ 600px */
@media (min-width: 600px) {
  .study-hdr { padding: 16px 24px; }
  .study-audio-body { padding: 32px 40px; gap: 28px; }
  .audio-player-card { padding: 32px 32px 28px; }
  .study-foot { padding: 20px 40px calc(20px + var(--safe-b)); }
  .study-pdf-top { padding: 14px 24px; }
}

/* Desktop ≥ 960px — two-column layout for audio screen */
@media (min-width: 960px) {
  .study-audio-body {
    flex-direction: row;
    align-items: center; justify-content: center;
    padding: 40px 60px;
    gap: 60px;
  }
  .study-audio-body > .study-lesson-badge {
    display: none; /* shown inline in card on desktop */
  }
  .audio-player-card {
    max-width: 540px;
    padding: 40px 36px 36px;
  }
  .study-hint { text-align: center; }
  .study-foot { padding: 24px 60px calc(24px + var(--safe-b)); }
  .study-pdf-top { padding: 16px 48px; }
  .study-pdf-top .btn-primary { max-width: 480px; margin: 0 auto; }
}


