:root {
  --purple: #7871e3;
  --purple-dark: #625ad1;
  --purple-soft: #eeedfc;
  --yellow: #ffe033;
  --yellow-dark: #f2cf18;
  --sky: #7cc4fa;
  --coral: #ff6b6b;
  --mint: #5ce1a0;
  --bg: #ffffff;
  --surface: #f4f5f9;
  --ink: #1b1b27;
  --muted: #7c7e93;
  --border: 1.5px solid #1b1b27;
  --radius-card: 20px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background: #eceef4;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(27, 27, 39, 0.08);
}

.svg-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.svg-tab {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

/* ================= TOP HEADER ================= */
.topbar {
  padding: calc(max(12px, env(safe-area-inset-top)) + 4px) 18px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  z-index: 20;
}
.topbar.hidden {
  display: none;
}

.top-avatar-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: var(--border);
  overflow: hidden;
  background: var(--yellow);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.top-avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.top-progress-wrap {
  flex: 1;
  min-width: 0;
}
.top-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.top-progress-lbl {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.top-xp-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 800;
  color: #e2a400;
}
.ico-star {
  width: 16px;
  height: 16px;
}
.top-prog-track {
  width: 100%;
  height: 9px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.top-prog-fill {
  height: 100%;
  background: var(--purple);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

.top-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.notif-dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  border: 1.5px solid #fff;
}
.notif-dot.done {
  background: var(--mint);
}

/* ================= MAIN VIEW ================= */
.main-view {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 18px calc(92px + env(safe-area-inset-bottom));
}
.main-view.no-top-pad {
  padding: 0 0 calc(92px + env(safe-area-inset-bottom));
}

/* Greeting */
.greeting-sub {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.greeting-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ink);
  margin-bottom: 16px;
  line-height: 1.18;
}

/* Featured Purple Hero Card (matches "Animals Name" card) */
.featured-card {
  position: relative;
  background: var(--purple);
  border: var(--border);
  border-radius: 22px;
  padding: 18px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
  margin-bottom: 22px;
  min-height: 152px;
}
.featured-left {
  flex: 1;
  z-index: 2;
  min-width: 0;
}
.featured-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
  line-height: 1.25;
}
.featured-sub {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  margin-bottom: 10px;
}
.featured-bar-track {
  width: 118px;
  height: 7px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
  overflow: hidden;
}
.featured-bar-fill {
  height: 100%;
  background: #fff;
  border-radius: var(--radius-pill);
}
.btn-yellow-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--yellow);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-pill);
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease, background 0.15s ease;
}
.btn-yellow-pill:active {
  transform: scale(0.97);
}
.btn-yellow-pill.full {
  width: 100%;
  padding: 13px 20px;
  font-size: 14.5px;
}
.btn-purple-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--purple);
  color: #fff;
  border: var(--border);
  border-radius: var(--radius-pill);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
}
.btn-white-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-pill);
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
}
.btn-yellow-pill:disabled,
.btn-purple-pill:disabled,
.btn-white-pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.featured-art {
  width: 126px;
  height: 126px;
  object-fit: contain;
  flex-shrink: 0;
  z-index: 2;
  filter: drop-shadow(0 6px 10px rgba(27, 27, 39, 0.18));
}

/* Section Headers */
.section-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  margin-top: 6px;
}
.section-hdr h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}
.section-link {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
}

/* Weekly Streak Circles Row (inspired by "My Friends" avatars row) */
.week-strip {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 22px;
}
.day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}
.day-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid #e1e3ec;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.day-circle.active {
  background: var(--yellow);
  border: var(--border);
  color: var(--ink);
}
.day-circle.today:not(.active) {
  background: var(--purple-soft);
  border: 1.5px solid var(--purple);
  color: var(--purple);
}
.day-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

/* Category Filter Pills (exact match to All / Science / Math / Music) */
.cat-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 18px;
  scrollbar-width: none;
}
.cat-row::-webkit-scrollbar {
  display: none;
}
.cat-pill {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: 1.5px solid #e5e7f0;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.cat-pill.active {
  background: var(--yellow);
  border: var(--border);
  font-weight: 800;
}

/* Unit / Latest Quiz Cards */
.unit-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 16px;
}
.unit-card {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--surface);
  border-radius: 18px;
  padding: 12px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.unit-card:active {
  transform: scale(0.99);
  border-color: var(--ink);
}
.unit-thumb {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.unit-info {
  flex: 1;
  min-width: 0;
}
.unit-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unit-desc {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}
.unit-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.unit-prog-bar {
  flex: 1;
  max-width: 110px;
  height: 6px;
  background: #e2e4ee;
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.unit-prog-fill {
  height: 100%;
  background: var(--purple);
  border-radius: var(--radius-pill);
}
.unit-count {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
.unit-chev {
  color: var(--ink);
  opacity: 0.65;
  flex-shrink: 0;
}

/* Generic Soft Cards for Tips / SRS / Widget / Settings */
.soft-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
}
.soft-card.outlined {
  background: #fff;
  border: var(--border);
}
.soft-card.yellow {
  background: var(--yellow);
  border: var(--border);
}
.soft-card.purple {
  background: var(--purple);
  border: var(--border);
  color: #fff;
}
.tag-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--purple-soft);
  color: var(--purple-dark);
}
.tip-list {
  margin-top: 10px;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #2f3042;
}
.tip-list li {
  margin-bottom: 6px;
}

/* ================= PROFILE SCREEN (Right Reference Screen) ================= */
.profile-hero {
  background: var(--purple);
  color: #fff;
  padding: calc(max(16px, env(safe-area-inset-top)) + 8px) 18px 28px;
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}
.profile-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid #fff;
  overflow: hidden;
  background: var(--yellow);
  flex-shrink: 0;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-name {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 2px;
}
.profile-handle {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
}
.profile-body {
  padding: 18px;
}

.streak-banner {
  background: var(--yellow);
  border: var(--border);
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  cursor: pointer;
}
.streak-banner-sub {
  font-size: 12.5px;
  font-weight: 700;
  color: #463d0b;
  margin-bottom: 2px;
}
.streak-banner-val {
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
}
.streak-banner-art {
  width: 78px;
  height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(27, 27, 39, 0.14));
}

.stats-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.stat-tile {
  background: var(--surface);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat-tile-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.stat-tile-val {
  font-size: 19px;
  font-weight: 900;
  color: var(--ink);
}

.big-prog-track {
  width: 100%;
  height: 30px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 14px;
}
.big-prog-fill {
  height: 100%;
  min-width: 52px;
  background: var(--purple);
  border: var(--border);
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  padding-left: 14px;
}

.pg-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.pg-mini-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 10px 8px;
  text-align: center;
}
.pg-mini-card.pass {
  background: #e9fbf2;
  border: 1.5px solid #22c55e;
}
.pg-mini-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
.pg-mini-score {
  font-size: 20px;
  font-weight: 900;
  margin: 2px 0;
}
.pg-mini-sub {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}

/* Hexagonal Badges Grid (exact match to My Badges / Locked Badges) */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}
.hex-badge {
  width: 66px;
  height: 72px;
  clip-path: polygon(50% 0%, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%);
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}
.hex-badge-inner {
  width: 100%;
  height: 100%;
  clip-path: polygon(50% 0%, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hex-badge.locked .hex-badge-inner {
  background: #9ca3af;
}
.badge-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.badge-item.locked .badge-lbl {
  color: var(--muted);
}

/* Settings rows inside Profile */
.setting-row {
  background: var(--surface);
  border-radius: 16px;
  padding: 13px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.toggle-pill {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: var(--border);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.toggle-pill.on {
  background: var(--yellow);
}

/* ================= WIDGET PREVIEW (2-Mode GIMO Streak Card) ================= */
.ios-widget-preview {
  width: 236px;
  height: 236px;
  margin: 0 auto 12px;
  background: linear-gradient(180deg, #7f0d0a 0%, #c82b08 56%, #f45d01 100%);
  border: var(--border);
  border-radius: 34px;
  padding: 18px 16px 8px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  box-shadow: 0 14px 28px rgba(198, 40, 8, 0.25);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.ios-widget-preview.done {
  background: linear-gradient(180deg, #5249c7 0%, #7871e3 56%, #968ff5 100%);
  box-shadow: 0 14px 28px rgba(120, 113, 227, 0.28);
}
.ios-widget-preview.done .widget-streak {
  color: var(--yellow);
}
.widget-mode-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}
.widget-streak {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 40px;
  font-weight: 900;
  color: #ff9f1c;
  line-height: 1;
  margin-bottom: 6px;
}
.widget-message {
  font-size: 16px;
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.2px;
}
.widget-mascot {
  width: 144px;
  height: 112px;
  object-fit: contain;
  object-position: bottom center;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
}
.step-item {
  font-size: 13px;
  line-height: 1.5;
  color: #2f3042;
  margin-bottom: 8px;
}

/* ================= BOTTOM TAB BAR ================= */
.tabbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid #eceef4;
  display: flex;
  justify-content: space-around;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
}
.tab-btn.active {
  color: var(--purple);
}

/* ================= FULLSCREEN PURPLE QUIZ SCREEN (Center Reference) ================= */
.quiz-overlay {
  position: fixed;
  inset: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--purple);
  color: #fff;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.quiz-overlay.open {
  transform: translateY(0);
}

.quiz-topbar {
  padding: calc(max(14px, env(safe-area-inset-top)) + 4px) 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.quiz-circle-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.quiz-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.2px;
  text-align: center;
  flex: 1;
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiz-seg-wrap {
  padding: 4px 18px 12px;
}
.quiz-seg-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}
#quizCountLabel {
  color: rgba(255, 255, 255, 0.72);
}
.quiz-segments {
  display: flex;
  gap: 6px;
}
.quiz-seg {
  flex: 1;
  height: 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.22);
  transition: background 0.2s ease;
}
.quiz-seg.done,
.quiz-seg.current {
  background: #fff;
  border: 1.5px solid var(--ink);
}

.quiz-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 18px 20px;
}

.quiz-art-timer-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}
.quiz-buddy-img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(27, 27, 39, 0.2));
}
.quiz-timer-pill {
  background: var(--yellow);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 13.5px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.quiz-timer-pill.low {
  background: var(--coral);
  color: #fff;
}

.q-sub-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 10px;
}
.q-sub-badge.retry {
  background: var(--yellow);
  color: var(--ink);
  border: 1.5px solid var(--ink);
}
.drill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.drill-chip-card {
  background: #fff;
  border: var(--border);
  border-radius: 16px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: transform 0.1s ease;
}
.drill-chip-card:active {
  transform: scale(0.98);
}
.drill-chip-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}
.drill-chip-meta {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.q-text {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  margin-bottom: 14px;
}
.q-choose-lbl {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
  margin-bottom: 12px;
}

.q-svg-card {
  background: #fff;
  border: var(--border);
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 16px;
  color: var(--ink);
}

.opt-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.opt-list.two-col {
  grid-template-columns: 1fr 1fr;
}
.opt-btn {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid transparent;
  border-radius: 26px;
  padding: 14px 18px;
  font-size: 14.5px;
  font-weight: 700;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  line-height: 1.38;
  transition: transform 0.1s ease, background 0.15s ease;
}
.opt-btn:active {
  transform: scale(0.985);
}
.opt-letter {
  font-weight: 900;
  flex-shrink: 0;
}
.opt-btn.selected {
  background: var(--yellow);
  border: var(--border);
}
.opt-btn.correct {
  background: #a7f3d0;
  border: var(--border);
}
.opt-btn.wrong {
  background: #fecaca;
  border: var(--border);
}
.tkp-score-tag {
  font-size: 11px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: #e5e7eb;
  color: var(--ink);
  flex-shrink: 0;
  margin-left: auto;
}
.tkp-score-tag.s5 { background: #22c55e; color: #fff; }
.tkp-score-tag.s4 { background: var(--yellow); color: var(--ink); }

.quiz-footer {
  padding: 10px 18px calc(16px + env(safe-area-inset-bottom));
  background: var(--purple);
}
.feedback-card {
  display: none;
  background: #ffffff;
  color: var(--ink);
  border: var(--border);
  border-radius: 22px;
  padding: 15px 16px;
  margin-bottom: 12px;
  max-height: 44vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -4px 20px rgba(27, 27, 39, 0.14);
}
.feedback-card.show {
  display: block;
}
.fb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.fb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--ink);
}
.fb-badge.good { background: #a7f3d0; color: #065f46; }
.fb-badge.warn { background: var(--yellow); color: var(--ink); }
.fb-badge.bad { background: #fecaca; color: #991b1b; }
.fb-time {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}
.fb-key-box {
  background: var(--purple-soft);
  border-left: 4px solid var(--purple);
  border-radius: 10px;
  padding: 8px 11px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
}
.fb-section-lbl {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.fb-explain {
  font-size: 14px;
  line-height: 1.65;
  color: #252736;
}
.fb-explain p {
  margin-bottom: 7px;
}
.fb-explain p:last-child {
  margin-bottom: 0;
}
.fb-explain ul {
  padding-left: 18px;
  margin: 4px 0 0;
}
.fb-explain li {
  margin-bottom: 6px;
}
.fb-explain li:last-child {
  margin-bottom: 0;
}
.fb-explain strong {
  color: #11111d;
  font-weight: 800;
}

.quiz-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.quiz-pill-ghost {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.quiz-hint-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--sky);
  border: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.hint-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quiz-pill-primary {
  background: #fff;
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-pill);
  padding: 12px 22px;
  font-size: 14.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.quiz-pill-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Result screen inside purple overlay */
.result-card {
  background: #fff;
  color: var(--ink);
  border: var(--border);
  border-radius: 24px;
  padding: 22px 18px;
  text-align: center;
  margin-top: 8px;
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.result-stat-box {
  background: var(--surface);
  border-radius: 14px;
  padding: 10px 6px;
}
.result-stat-lbl {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--muted);
}
.result-stat-val {
  font-size: 20px;
  font-weight: 900;
  margin-top: 2px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 200;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
