/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }
:root {
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --card-border: rgba(0,0,0,.05);
  --card-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  --accent: #707C35;
  --accent-soft: rgba(112,124,53,.10);
  --accent-soft2: rgba(112,124,53,.16);
  --success: #34C759;
  --success-soft: rgba(52,199,89,.12);
  --error: #FF3B30;
  --error-soft: rgba(255,59,48,.10);
  --warning: #FF9500;
  --warning-soft: rgba(255,149,0,.12);
  --text: #1C1D21;
  --text2: #3A3B40;
  --muted: #86878B;
  --muted2: #C7C7CC;
  --divider: rgba(60,60,67,.12);
  --radius-lg: 20px;
  --radius: 16px;
  --radius-sm: 12px;
}
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  letter-spacing: -0.011em;
}
.container { max-width: 600px; margin: 0 auto; padding: 16px; padding-bottom: 120px; }
.hidden { display: none !important; }
button { font-family: inherit; letter-spacing: inherit; cursor: pointer; }
input, textarea { font-family: inherit; letter-spacing: inherit; }

/* Focus ring (accessibility) */
button:focus-visible, input:focus-visible, [role="button"]:focus-visible {
  outline: 3px solid var(--accent-soft2);
  outline-offset: 2px;
}

/* ===== ONBOARDING ===== */
.onb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 16px 32px;
  max-width: 400px;
  margin: 0 auto;
}
.onb-logo {
  width: 200px;
  height: 70px;
  margin-bottom: 28px;
  background-color: var(--accent);
  -webkit-mask: url(lilica-logo.svg) center/contain no-repeat;
  mask: url(lilica-logo.svg) center/contain no-repeat;
}
.onb-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
}
.onb-sub {
  font-size: 15px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
  font-weight: 500;
}
.onb-avatar-wrap {
  margin-bottom: 24px;
}
.onb-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--card);
  border: 2px dashed var(--card-border);
  cursor: pointer;
  position: relative;
  background-size: cover;
  background-position: center;
  transition: border-color .2s, transform .12s;
  overflow: hidden;
}
.onb-avatar:active { transform: scale(.97); }
.onb-avatar:hover { border-color: var(--accent); }
.onb-avatar-placeholder {
  font-size: 42px;
  font-weight: 300;
  color: var(--muted2);
}
.onb-avatar-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px;
  text-align: center;
  opacity: 0;
  transition: opacity .2s;
}
.onb-avatar:hover .onb-avatar-overlay,
.onb-avatar[style*="background-image"] .onb-avatar-overlay { opacity: 1; }
.onb-input {
  width: 100%;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.011em;
  box-shadow: var(--card-shadow);
  outline: none;
  margin-bottom: 18px;
  transition: border-color .2s;
}
.onb-input:focus { border-color: var(--accent); }
.onb-input::placeholder { color: var(--muted); }
.onb-wrap .next-btn { width: 100%; }
.onb-note {
  margin-top: 20px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* ===== LANDING HEADER (greeting + avatar) ===== */
.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 4px 8px;
}
.greeting .greeting-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 2px;
}
.greeting .greeting-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.025em;
}
.header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--accent-soft);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.01em;
  box-shadow: var(--card-shadow);
  flex-shrink: 0;
  font-family: inherit;
  transition: transform .12s;
}
.header-avatar:active { transform: scale(.95); }

/* ===== PROFILE SCREEN ===== */
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 24px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  margin-bottom: 14px;
}
.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 2px solid var(--accent-soft2);
  cursor: pointer;
  position: relative;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  margin-bottom: 22px;
}
.profile-avatar:active { transform: scale(.97); }
.profile-avatar-placeholder {
  font-size: 40px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.025em;
}
.profile-avatar-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px;
  text-align: center;
}
.profile-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  font-weight: 500;
}

/* ===== LANDING ===== */
#landing .brand {
  text-align: center;
  padding: 56px 0 36px;
}
#landing .brand-compact { padding: 24px 0 28px; }
#landing .brand .logo {
  margin: 0 auto;
}
#landing .brand .tagline {
  color: var(--muted);
  font-size: 15px;
  margin-top: 14px;
  font-weight: 500;
}
#landing .section-title, .section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 28px 4px 12px;
}
.subject-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}
.subject-card:active { transform: scale(.985); }
.subject-card .sc-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.subject-card .sc-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.subject-card .sc-name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.subject-card .sc-desc { font-size: 13px; color: var(--muted); margin-top: 2px; font-weight: 500; }
.subject-card .sc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.subject-card .sc-stat {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}
.subject-card .sc-stat .sv { font-size: 22px; font-weight: 800; letter-spacing: -0.025em; }
.subject-card .sc-stat .sl { font-size: 10px; color: var(--muted); margin-top: 2px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.subject-card .sc-progress {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  margin-top: 16px;
  overflow: hidden;
}
.subject-card .sc-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .8s ease;
}

/* Resume / Continue card on landing */
.resume-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: linear-gradient(135deg, var(--accent), #5d6a2c);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(112,124,53,.28);
  transition: transform .12s ease;
}
.resume-card:active { transform: scale(.985); }
.resume-card .rc-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.resume-card .rc-body { flex: 1; min-width: 0; }
.resume-card .rc-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: rgba(255,255,255,.7);
}
.resume-card .rc-name { font-size: 17px; font-weight: 700; margin-top: 2px; }
.resume-card .rc-chev { color: rgba(255,255,255,.7); font-size: 22px; }

/* Streak banner */
.streak-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--card-shadow);
}
.streak-banner .flame {
  font-size: 28px;
}
.streak-banner .sb-body { flex: 1; }
.streak-banner .sb-num { font-size: 22px; font-weight: 800; color: var(--accent); letter-spacing: -0.025em; }
.streak-banner .sb-num .unit { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.streak-banner .sb-label { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ===== HOME ===== */
#home .home-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0 22px;
}
.subject-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}
.subject-sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin: 0 0 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 10px;
  text-align: center;
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
}
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--accent); letter-spacing: -0.025em; }
.stat-card .label { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

.menu-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  transition: transform .12s ease;
  text-align: left;
  box-shadow: var(--card-shadow);
  letter-spacing: -0.011em;
}
.menu-btn:active { transform: scale(.985); }
.menu-btn .icon-circle {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}
.menu-btn .mb-body { flex: 1; min-width: 0; }
.menu-btn .mb-title { font-size: 16px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.menu-btn .desc { font-size: 13px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.menu-btn .chev { color: var(--muted2); font-size: 18px; font-weight: 600; }
.menu-btn.danger .icon-circle { background: var(--error-soft); color: var(--error); }
.menu-btn.danger .mb-title { color: var(--error); }
.menu-btn.featured {
  background: linear-gradient(135deg, var(--accent), #5d6a2c);
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(112,124,53,.28);
}
.menu-btn.featured .icon-circle { background: rgba(255,255,255,.18); color: #fff; }
.menu-btn.featured .mb-title { color: #fff; }
.menu-btn.featured .desc { color: rgba(255,255,255,.78); }
.menu-btn.featured .chev { color: rgba(255,255,255,.55); }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px;
  padding: 0 7px;
  background: #fff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  letter-spacing: -0.01em;
}

/* ===== TOP BAR / BACK ===== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 14px;
  margin-bottom: 8px;
}
.back-btn {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--card-shadow);
}
.back-btn:active { transform: scale(.95); }
.progress-text { font-size: 14px; color: var(--muted); font-weight: 600; }
.score-text { font-size: 14px; color: var(--accent); font-weight: 700; }

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--divider);
  border-radius: 999px;
  margin-bottom: 22px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .5s ease;
}

/* ===== QUIZ ===== */
.tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 6px;
  margin-right: 4px;
}
#quiz-tags { margin-bottom: 14px; }
.question-text {
  font-size: 17px;
  line-height: 1.55;
  margin-bottom: 22px;
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.014em;
}
.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  cursor: pointer;
  margin-bottom: 10px;
  text-align: left;
  transition: transform .12s ease, border-color .2s ease, background .2s ease;
  box-shadow: var(--card-shadow);
  font-weight: 500;
  letter-spacing: -0.011em;
}
.option-btn:active { transform: scale(.99); }
.option-btn .letter {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid var(--card-border);
}
.option-btn.correct,
.option-btn.reveal-correct { border-color: var(--success); background: var(--success-soft); }
.option-btn.correct .letter,
.option-btn.reveal-correct .letter { background: var(--success); color: #fff; border-color: var(--success); }
.option-btn.wrong { border-color: var(--error); background: var(--error-soft); }
.option-btn.wrong .letter { background: var(--error); color: #fff; border-color: var(--error); }
.option-btn.disabled { pointer-events: none; }

.explanation {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 18px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text2);
  animation: fadeIn .3s;
  font-weight: 500;
}
.explanation strong { color: var(--accent); font-weight: 700; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

.next-btn {
  width: 100%;
  padding: 17px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
  transition: transform .12s ease, opacity .2s;
  letter-spacing: -0.011em;
  box-shadow: 0 8px 20px rgba(112,124,53,.25);
}
.next-btn:active { transform: scale(.985); opacity: .9; }
.secondary-btn {
  width: 100%;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: var(--card-shadow);
}
.secondary-btn:active { transform: scale(.985); }

/* ===== RESULTS ===== */
.results-card {
  text-align: center;
  padding: 24px 0 12px;
}
.score-ring {
  width: 180px; height: 180px;
  margin: 0 auto 18px;
  position: relative;
}
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .sr-bg { fill: none; stroke: var(--divider); stroke-width: 12; }
.score-ring .sr-fg { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.score-ring .sr-num {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-ring .sr-num .pct { font-size: 44px; font-weight: 800; color: var(--text); letter-spacing: -0.035em; }
.score-ring .sr-num .lbl { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.results-card .subtitle { color: var(--muted); margin: 0 0 16px; font-size: 14px; font-weight: 500; }

.topic-perf {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 10px 0;
  text-align: left;
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
}
.topic-perf .tp-name { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.topic-perf .tp-bar-bg { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.topic-perf .tp-bar { height: 100%; border-radius: 999px; transition: width .8s ease; }
.topic-perf .tp-detail { font-size: 12px; color: var(--muted); margin-top: 6px; font-weight: 500; }

/* ===== FLASHCARDS ===== */
.flashcard-container { perspective: 1200px; margin: 20px 0; }
.flashcard {
  width: 100%;
  min-height: 320px;
  position: relative;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.4,.0,.2,1);
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 24px rgba(0,0,0,.06);
}
.flashcard-back { transform: rotateY(180deg); background: var(--accent); border-color: var(--accent); }
.flashcard-front h3 {
  color: var(--accent); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 14px;
  padding: 5px 12px;
  background: var(--accent-soft);
  border-radius: 999px;
}
.flashcard-front p { font-size: 17px; line-height: 1.55; color: var(--text); font-weight: 500; }
.flashcard-back h3 {
  color: rgba(255,255,255,.7); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px;
}
.flashcard-back p { font-size: 16px; line-height: 1.55; color: #fff; font-weight: 500; }
.tap-hint { color: var(--muted); font-size: 12px; margin-top: 18px; font-weight: 500; }

.fc-nav { display: flex; gap: 10px; margin-top: 18px; }
.fc-nav button {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: -0.011em;
}
.fc-nav .fc-prev { background: var(--card); color: var(--text); box-shadow: var(--card-shadow); }
.fc-nav .fc-next { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 6px 16px rgba(112,124,53,.22); }

/* ===== REVIEW LIST ===== */
.review-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
}
.review-item:active { transform: scale(.985); }
.review-item .ri-num {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.review-item .ri-num.ri-correct { background: var(--success-soft); color: var(--success); }
.review-item .ri-num.ri-wrong { background: var(--error-soft); color: var(--error); }
.review-item .ri-num.ri-pending { background: var(--bg); color: var(--muted); border: 1px solid var(--card-border); }
.review-item .ri-body { flex: 1; min-width: 0; }
.review-item .ri-title { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-item .ri-topic { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 500; }

.filter-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  box-shadow: var(--card-shadow);
}
.filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 12px rgba(112,124,53,.2); }

/* ===== LOADING ===== */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--divider);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== EMPTY STATE / ERROR ===== */
.empty-state { color: var(--muted); text-align: center; padding: 60px 20px; font-size: 14px; font-weight: 500; }
.empty-big { padding: 80px 20px; }
.empty-icon { font-size: 48px; margin-bottom: 14px; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

/* Smart review action buttons row */
.smart-actions-row { display: flex; gap: 10px; margin-top: 14px; }
.smart-actions-row .next-btn,
.smart-actions-row .secondary-btn { margin-top: 0; }

/* Loading text */
.loading-text { color: var(--muted); font-size: 14px; }

/* Review item chevron */
.ri-chev { color: var(--muted2); font-size: 18px; font-weight: 600; }

/* Results retry button extra spacing */
.results-card-spacer { margin-top: 20px; }
.error-card {
  background: var(--card);
  border: 1px solid var(--error-soft);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin: 20px 0;
  box-shadow: var(--card-shadow);
}
.error-card .ec-icon { font-size: 34px; margin-bottom: 8px; }
.error-card .ec-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.error-card .ec-msg { font-size: 13px; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }

/* ===== PHARMA ===== */
.pharma-search-row { margin-bottom: 14px; }
.pharma-search {
  width: 100%;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.011em;
  box-shadow: var(--card-shadow);
  outline: none;
  transition: border-color .2s;
}
.pharma-search:focus { border-color: var(--accent); }
.pharma-search::placeholder { color: var(--muted); }

.pharma-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .2s;
}
.pharma-card.open { box-shadow: 0 4px 20px rgba(0,0,0,.06); }
.pharma-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}
.pharma-head-text { flex: 1; min-width: 0; }
.pharma-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.018em;
}
.pharma-class {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 2px;
}
.pharma-toggle {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  transition: transform .25s ease;
}
.pharma-card.open .pharma-toggle { transform: rotate(45deg); }

.pharma-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease, padding .25s ease;
  padding: 0 18px;
}
.pharma-card.open .pharma-body {
  max-height: 800px;
  padding: 0 18px 18px;
}
.pharma-section { padding: 12px 0; border-top: 1px solid var(--divider); }
.ps-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.ps-text {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.55;
  font-weight: 500;
}
.pharma-pearl .ps-label { color: var(--accent); }
.pharma-pearl .ps-text {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
}

/* ===== SMART REVIEW DUAL BUTTONS ===== */
.smart-wrong {
  background: var(--card) !important;
  color: var(--error) !important;
  border: 1px solid var(--error-soft) !important;
  box-shadow: 0 1px 2px rgba(255,59,48,.08), 0 2px 8px rgba(255,59,48,.06) !important;
  font-weight: 700 !important;
}
.smart-right {
  background: var(--success) !important;
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(52,199,89,.28) !important;
}

/* ===== TOAST ===== */
#toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 420px;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toast-in .3s cubic-bezier(.18,.89,.32,1.28);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.info { background: var(--accent); }
.toast.leaving { animation: toast-out .25s ease forwards; }
@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes toast-out {
  to { transform: translateY(20px); opacity: 0; }
}

/* ===== MODAL ===== */
#modal-wrap {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  animation: modal-in .3s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes modal-in {
  from { transform: scale(.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal .m-icon { font-size: 38px; margin-bottom: 10px; }
.modal .m-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.modal .m-text { font-size: 14px; color: var(--muted); line-height: 1.5; margin-bottom: 22px; }
.modal .m-buttons { display: flex; gap: 10px; }
.modal .m-buttons button {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.modal .m-cancel { background: var(--card); color: var(--text); }
.modal .m-confirm { background: var(--error); color: #fff; border-color: var(--error); }
.modal .m-confirm.safe { background: var(--accent); border-color: var(--accent); }

/* ===== HERO BUTTON (Clinical Simulation - main feature) ===== */
.hero-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: linear-gradient(135deg, #0f2438 0%, #1a3a5c 40%, #2563a8 100%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-lg);
  padding: 22px 22px;
  margin-bottom: 14px;
  cursor: pointer;
  text-align: left;
  box-shadow:
    0 12px 32px rgba(15,36,56,.35),
    0 4px 12px rgba(15,36,56,.20),
    inset 0 1px 0 rgba(255,255,255,.10);
  transition: transform .15s ease;
}
.hero-btn:active { transform: scale(.985); }
.hero-shimmer {
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.10) 50%, transparent 70%);
  animation: hero-shimmer 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes hero-shimmer {
  0%, 100% { left: -100%; }
  60% { left: 130%; }
}
.hero-icon {
  flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: 16px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  color: #fff;
  backdrop-filter: blur(4px);
  position: relative;
  z-index: 1;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,.72);
  margin-bottom: 4px;
}
.hero-ai-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52,211,153,.6);
  animation: hero-pulse 2s infinite;
}
@keyframes hero-pulse {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); }
  70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.hero-title {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.022em;
  position: relative;
  z-index: 1;
}
.hero-desc {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.74);
  margin-top: 3px;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}
.hero-chev {
  color: rgba(255,255,255,.55);
  font-size: 22px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

/* ===== SIMULATION (AI chat) ===== */

.sim-finish-btn {
  background: var(--success);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(52,199,89,.28);
  letter-spacing: -0.011em;
}
.sim-finish-btn:active { transform: scale(.95); }

.sim-disclaimer {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft2);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 14px;
  font-weight: 500;
}
.sim-disclaimer strong { color: var(--accent); font-weight: 700; }
.sim-disclaimer em { font-style: normal; font-weight: 700; color: var(--success); }

.sim-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 4px;
}
.sim-bubble {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: -0.011em;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: bubble-in .25s ease;
}
.sim-bubble.patient {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.patient-speech { display: block; }
.patient-narrator {
  display: block;
  background: rgba(60,60,67,.06);
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-style: italic;
  color: var(--text2);
  line-height: 1.55;
  letter-spacing: -0.005em;
}
.sim-bubble.user {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(112,124,53,.22);
}
.sim-bubble.eval {
  background: var(--card);
  border: 1px solid var(--accent-soft2);
  color: var(--text);
  align-self: stretch;
  max-width: 100%;
  border-bottom-left-radius: 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
.sim-bubble.eval h2 { font-size: 14px; font-weight: 800; color: var(--accent); margin: 14px 0 6px; letter-spacing: -0.014em; }
.sim-bubble.eval h2:first-child { margin-top: 0; }
.sim-bubble.eval p { margin: 6px 0; font-size: 14px; line-height: 1.6; }
.sim-bubble.eval ul { margin: 6px 0 6px 18px; }
.sim-bubble.eval li { margin: 4px 0; font-size: 14px; line-height: 1.5; }
.sim-bubble.eval strong { color: var(--text); font-weight: 700; }
.sim-bubble.eval em { font-style: italic; color: var(--text2); }
.sim-bubble.error {
  background: var(--error-soft);
  color: var(--error);
  border: 1px solid var(--error-soft);
  align-self: stretch;
  max-width: 100%;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sim-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  box-shadow: var(--card-shadow);
  margin-bottom: 14px;
  width: fit-content;
}
.sim-typing span {
  width: 7px; height: 7px;
  background: var(--muted2);
  border-radius: 50%;
  animation: typing-dot 1.2s infinite;
}
.sim-typing span:nth-child(2) { animation-delay: 0.15s; }
.sim-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-dot {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.sim-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  box-shadow: var(--card-shadow);
  position: sticky;
  bottom: 16px;
  z-index: 10;
}
.sim-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.011em;
  outline: none;
  padding: 6px 8px;
}
.sim-input::placeholder { color: var(--muted); }
.sim-send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(112,124,53,.28);
}
.sim-send-btn:active { transform: scale(.92); }
.sim-send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== FOOTER / DISCLAIMER ===== */
.disclaimer {
  margin-top: 40px;
  padding: 20px 16px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  border-top: 1px solid var(--divider);
  font-weight: 500;
}
.disclaimer strong { color: var(--text2); font-weight: 700; }
