/* ============================================================
   StudyBuddy.in — Bright energetic education aesthetic
   Mint + warm yellow + soft pink · playful but premium
   ============================================================ */

:root {
  --bg: #FFFCF7;
  --bg-card: #FFFFFF;
  --bg-elev: #F7F2E8;
  --bg-tint: #E8F5EF;

  --ink: #1A1F36;
  --ink-soft: #2D3450;
  --ink-mute: #5A627A;
  --ink-faint: #8E94A8;

  --line: #E8E1D0;
  --line-soft: #F0EBDB;

  --mint: #19A982;
  --mint-deep: #0F7B5E;
  --mint-soft: #D5F0E5;
  --mint-bright: #2DC99B;

  --yellow: #F5B400;
  --yellow-soft: #FFF0BD;
  --yellow-deep: #B8810D;

  --pink: #F26B95;
  --pink-soft: #FCDCE6;
  --pink-deep: #C03A6A;

  --coral: #FF8A5B;
  --purple: #8B5CF6;
  --blue: #3B82F6;

  --display: 'Fraunces', Georgia, serif;
  --body: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow-sm: 0 1px 2px rgba(26, 31, 54, 0.04);
  --shadow-md: 0 6px 24px rgba(26, 31, 54, 0.06);
  --shadow-lg: 0 16px 48px rgba(26, 31, 54, 0.1);
  --shadow-mint: 0 8px 28px rgba(25, 169, 130, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--mint); color: #fff; }

/* ===== NAV ===== */
.nav {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 32px;
  flex-wrap: wrap;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}
.brand-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--mint);
  color: #fff;
  border-radius: var(--r-md);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
  box-shadow: var(--shadow-mint);
}
.brand-icon.dark { background: var(--bg); color: var(--mint-deep); box-shadow: none; }
.brand:hover .brand-icon { transform: rotate(-8deg) scale(1.05); }
.brand-text {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.dot { color: var(--mint); }

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
}
.nav-links a:not(.cta-link) { color: var(--ink-mute); transition: color .2s; }
.nav-links a:not(.cta-link):hover { color: var(--ink); }

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--yellow-soft);
  border: 1.5px solid var(--yellow);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--yellow-deep);
  font-family: var(--body);
}
.streak-flame { font-size: 16px; }
.streak-pill b { color: var(--ink); font-weight: 700; }

.cta-link {
  background: var(--ink) !important;
  color: var(--bg) !important;
  padding: 11px 22px;
  border-radius: 999px;
  transition: all .25s;
  font-weight: 600;
}
.cta-link:hover { background: var(--mint) !important; transform: translateY(-2px); box-shadow: var(--shadow-mint); }

@media (max-width: 800px) {
  .nav-links a:not(.cta-link), .streak-pill { display: none; }
}

/* ===== REVEAL ===== */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  animation: reveal 1s cubic-bezier(.16,1,.3,1) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes reveal { to { opacity: 1; transform: translateY(0); } }

/* ===== HERO ===== */
.hero {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 60px 32px 100px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 60px;
  align-items: center;
}
@media (max-width: 1000px) { .hero-grid { grid-template-columns: 1fr; gap: 60px; } }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  padding: 8px 16px 8px 12px;
  border-radius: 999px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}
.badge-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(25, 169, 130, 0.2);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(25, 169, 130, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(25, 169, 130, 0.3); }
}

.hero-title {
  font-family: var(--display);
  font-size: clamp(48px, 8vw, 108px);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin-bottom: 28px;
}
.hero-title .line { display: block; }
.hero-title em {
  font-style: italic;
  font-weight: 500;
  color: var(--mint);
  position: relative;
}
.hero-title em::after {
  content: '';
  position: absolute;
  left: -2%; bottom: 4px;
  width: 104%; height: 8px;
  background: var(--yellow);
  opacity: 0.5;
  border-radius: 999px;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: left;
  animation: underline 1.2s cubic-bezier(.16,1,.3,1) .8s forwards;
}
@keyframes underline { to { transform: scaleX(1); } }

.hero-sub {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--ink-mute);
  max-width: 540px;
  margin-bottom: 36px;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 48px;
}

.btn-primary {
  background: var(--mint);
  color: #fff;
  padding: 14px 26px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all .25s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(25, 169, 130, 0.25);
}
.btn-primary:hover { background: var(--mint-deep); transform: translateY(-2px); box-shadow: 0 12px 32px rgba(25, 169, 130, 0.4); }
.btn-arrow { transition: transform .25s; }
.btn-primary:hover .btn-arrow { transform: translateX(4px); }
.btn-primary.big { padding: 18px 32px; font-size: 16px; }
.btn-primary.full { width: 100%; justify-content: center; }
.btn-primary.small { padding: 8px 16px; font-size: 13px; }

.btn-ghost {
  color: var(--ink);
  padding: 14px 22px;
  font-weight: 600;
  font-size: 15px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-card);
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-ghost:hover { border-color: var(--mint); color: var(--mint); }
.btn-ghost.small { padding: 8px 14px; font-size: 13px; }

.hero-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 480px;
}
.hero-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  transition: all .2s;
}
.hero-feature:hover { border-color: var(--mint); transform: translateY(-2px); }
.hf-icon { font-size: 22px; }

/* ===== HERO VISUAL ===== */
.hero-visual {
  position: relative;
  height: 540px;
  display: grid;
  place-items: center;
}
@media (max-width: 1000px) { .hero-visual { height: 460px; } }

.card-stack { position: relative; width: 100%; max-width: 380px; }

.float-card {
  position: absolute;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 26px;
  box-shadow: var(--shadow-md);
  width: 100%;
}
.fc-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.card-1 {
  top: 0; left: 0;
  z-index: 3;
  transform: rotate(-3deg);
  background: linear-gradient(135deg, var(--mint-soft) 0%, var(--bg-card) 100%);
  animation: float1 6s ease-in-out infinite;
}
.card-1 .fc-tag { background: var(--mint); color: #fff; }
@keyframes float1 {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  50% { transform: rotate(-1deg) translateY(-12px); }
}

.card-2 {
  top: 130px; right: 0;
  z-index: 2;
  transform: rotate(4deg);
  background: linear-gradient(135deg, var(--yellow-soft) 0%, var(--bg-card) 100%);
  animation: float2 7s ease-in-out infinite;
}
.card-2 .fc-tag { background: var(--yellow-deep); color: #fff; }
@keyframes float2 {
  0%, 100% { transform: rotate(4deg) translateY(0); }
  50% { transform: rotate(2deg) translateY(-10px); }
}

.card-3 {
  top: 280px; left: 30px;
  z-index: 1;
  transform: rotate(-2deg);
  background: linear-gradient(135deg, var(--pink-soft) 0%, var(--bg-card) 100%);
  animation: float3 8s ease-in-out infinite;
}
.card-3 .fc-tag { background: var(--pink); color: #fff; }
@keyframes float3 {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  50% { transform: rotate(0deg) translateY(-8px); }
}

.fc-q {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 14px;
}
.fc-q-serif {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
  font-style: italic;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 12px;
}
.fc-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
}
.fc-options { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.fc-opt {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}
.fc-opt.correct {
  background: var(--mint-soft);
  border-color: var(--mint);
  color: var(--mint-deep);
  font-weight: 700;
}
.fc-mnem {
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.6;
}
.fc-mnem strong { color: var(--pink); font-weight: 800; }

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
}
.orb-mint {
  width: 220px; height: 220px;
  background: var(--mint);
  top: -50px; right: -60px;
  opacity: 0.25;
}
.orb-pink {
  width: 260px; height: 260px;
  background: var(--pink);
  bottom: -80px; left: -60px;
  opacity: 0.2;
}
.hero-shape {
  position: absolute;
  font-family: var(--display);
  font-weight: 700;
  z-index: 4;
  animation: bob 4s ease-in-out infinite;
}
.shape-1 { top: -10px; right: 20%; font-size: 32px; color: var(--yellow); }
.shape-2 { bottom: 20px; right: -10px; font-size: 28px; color: var(--mint); animation-delay: 1.5s; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(8deg); }
}

/* ===== SECTION COMMON ===== */
.section-head {
  max-width: 900px;
  margin: 0 auto 64px;
  padding: 0 32px;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mint);
  margin-bottom: 18px;
  font-weight: 600;
}
.section-title {
  font-family: var(--display);
  font-size: clamp(40px, 6.5vw, 80px);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.05;
}
.section-title em { color: var(--mint); font-style: italic; font-weight: 500; }

/* ===== HOW IT WORKS ===== */
.how {
  padding: 80px 0;
  position: relative;
  z-index: 1;
}
.how-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .how-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .how-grid { grid-template-columns: 1fr; } }

.how-card {
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 32px 28px;
  transition: all .25s;
  position: relative;
}
.how-card:hover {
  border-color: var(--mint);
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
}
.how-num {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--mint);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}
.how-card h3 {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: var(--ink);
}
.how-card p {
  color: var(--ink-mute);
  font-size: 14px;
  line-height: 1.6;
}

/* ===== EXAMS ===== */
.exams {
  padding: 80px 0;
  background: linear-gradient(180deg, transparent 0%, var(--bg-elev) 100%);
}
.exams-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .exams-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .exams-grid { grid-template-columns: 1fr; } }

.exam-card {
  background: var(--bg-card);
  border: 2px solid;
  border-radius: var(--r-lg);
  padding: 28px;
  transition: all .25s;
  position: relative;
  overflow: hidden;
}
.exam-card:hover { transform: translateY(-4px) scale(1.02); }
.e-blue   { border-color: var(--blue);   background: linear-gradient(135deg, #DBEAFE 0%, var(--bg-card) 60%); }
.e-pink   { border-color: var(--pink);   background: linear-gradient(135deg, var(--pink-soft) 0%, var(--bg-card) 60%); }
.e-yellow { border-color: var(--yellow); background: linear-gradient(135deg, var(--yellow-soft) 0%, var(--bg-card) 60%); }
.e-mint   { border-color: var(--mint);   background: linear-gradient(135deg, var(--mint-soft) 0%, var(--bg-card) 60%); }
.e-coral  { border-color: var(--coral);  background: linear-gradient(135deg, #FFE0D1 0%, var(--bg-card) 60%); }
.e-purple { border-color: var(--purple); background: linear-gradient(135deg, #EDE5FC 0%, var(--bg-card) 60%); }

.exam-emoji { font-size: 36px; margin-bottom: 14px; }
.exam-card h3 {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: var(--ink);
}
.exam-card p {
  color: var(--ink-mute);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================================
   APP / STUDY
   ============================================================ */
.app {
  padding: 80px 0 100px;
  position: relative;
  z-index: 1;
}
.app-frame {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

.screen { display: none; }
.screen.active { display: block; animation: fadeIn .35s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== INPUT SCREEN ===== */
.templates-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
}
.tmpl-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  margin-right: 4px;
}
.tmpl-chip {
  background: var(--bg-elev);
  border: 1.5px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all .2s;
}
.tmpl-chip:hover {
  background: var(--mint-soft);
  border-color: var(--mint);
  color: var(--mint-deep);
  transform: translateY(-2px);
}

.input-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}
@media (max-width: 900px) { .input-grid { grid-template-columns: 1fr; } }

.input-main, .input-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.input-side { gap: 18px; }

.input-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}
.input-label.small { font-size: 10px; }
.input-hint {
  font-size: 12px;
  color: var(--ink-faint);
  font-style: italic;
}
.input-hint.center { text-align: center; }

#contentInput {
  width: 100%;
  padding: 22px 24px;
  background: var(--bg-card);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  resize: vertical;
  min-height: 320px;
  transition: border .2s;
}
#contentInput:focus { outline: none; border-color: var(--mint); }

.input-foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  padding: 0 8px;
}

.input-card {
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#topicInput {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-elev);
  font-size: 14px;
  color: var(--ink);
  transition: border .2s;
}
#topicInput:focus { outline: none; border-color: var(--mint); background: var(--bg-card); }

.seg-control {
  display: flex;
  background: var(--bg-elev);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
}
.seg-control button {
  flex: 1;
  padding: 9px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-mute);
  border-radius: 4px;
  transition: all .2s;
}
.seg-control button.active {
  background: var(--ink);
  color: #fff;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all .2s;
  background: var(--bg-elev);
}
.check-item:hover { border-color: var(--mint); }
.check-item input { accent-color: var(--mint); width: 16px; height: 16px; }
.check-item:has(input:checked) { background: var(--mint-soft); border-color: var(--mint); }

/* Library */
.library-section {
  margin-top: 56px;
  padding-top: 36px;
  border-top: 1.5px solid var(--line);
}
.library-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.library-title {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.link-btn {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.link-btn:hover { color: var(--pink-deep); }

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.library-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px;
  background: var(--bg-elev);
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  color: var(--ink-mute);
  font-size: 14px;
  font-style: italic;
}

.library-card {
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all .2s;
}
.library-card:hover { border-color: var(--mint); transform: translateY(-2px); }

.lc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.lc-head h4 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.2;
}
.lc-del {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink-faint);
  font-size: 18px;
  line-height: 1;
  transition: all .2s;
  flex-shrink: 0;
}
.lc-del:hover { background: var(--pink-soft); color: var(--pink-deep); }
.lc-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lc-meta span {
  background: var(--bg-elev);
  padding: 2px 8px;
  border-radius: 999px;
}
.lc-stats {
  display: flex;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.lc-open {
  align-self: flex-start;
  color: var(--mint);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 0;
  margin-top: auto;
}
.lc-open:hover { color: var(--mint-deep); }

/* ===== LOADING SCREEN ===== */
.loading-wrap {
  text-align: center;
  padding: 80px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.loading-bounce {
  width: 80px; height: 80px;
  background: var(--mint-soft);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 40px;
  animation: bounce 1.2s ease-in-out infinite;
  margin-bottom: 12px;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}
.loading-text {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.loading-sub {
  font-size: 14px;
  color: var(--ink-mute);
}
.loading-steps {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.ls-step {
  font-size: 14px;
  color: var(--ink-faint);
  padding: 8px 16px;
  background: var(--bg-elev);
  border-radius: var(--r-sm);
  transition: all .35s;
}
.ls-step.done {
  color: var(--mint-deep);
  background: var(--mint-soft);
  font-weight: 600;
}

/* ===== DECK SCREEN ===== */
.deck-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.back-btn {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-mute);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  transition: all .2s;
}
.back-btn:hover { background: var(--bg-elev); color: var(--ink); }
.deck-title {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  flex: 1;
}
.deck-actions { display: flex; gap: 8px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab {
  padding: 12px 18px;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-mute);
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab small {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--bg-elev);
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--ink-faint);
}
.tab.active {
  background: var(--ink);
  color: #fff;
}
.tab.active small { background: rgba(255,255,255,0.2); color: #fff; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .35s ease-out; }

/* ===== SUMMARY PANEL ===== */
.summary-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--mint-soft) 100%);
  border: 1.5px solid var(--mint);
  border-radius: var(--r-lg);
  padding: 36px;
}
.panel-title {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 14px;
}
.summary-text {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 28px;
}
.key-points {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 22px 26px;
}
.key-points h4 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--ink);
}
.key-points ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.key-points li {
  position: relative;
  padding-left: 28px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.key-points li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--mint);
  font-weight: 700;
}

/* ===== FLASHCARDS PANEL ===== */
.flashcard-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.flashcard-progress {
  width: 100%;
  max-width: 600px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-mute);
}
.fc-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-elev);
  border-radius: 3px;
  overflow: hidden;
}
.fc-progress-bar > div {
  height: 100%;
  background: var(--mint);
  border-radius: 3px;
  transition: width .35s ease;
  width: 0%;
}

.flashcard {
  width: 100%;
  max-width: 600px;
  height: 320px;
  perspective: 1500px;
  cursor: pointer;
}
.flashcard-inner {
  position: relative;
  width: 100%; height: 100%;
  transition: transform .6s cubic-bezier(.34,1.56,.64,1);
  transform-style: preserve-3d;
}
.flashcard-inner.flipped { transform: rotateY(180deg); }

.flashcard-face {
  position: absolute;
  inset: 0;
  border-radius: var(--r-lg);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow-md);
}
.flashcard-face.front {
  background: var(--bg-card);
  border: 2px solid var(--mint);
}
.flashcard-face.back {
  background: linear-gradient(135deg, var(--mint) 0%, var(--mint-deep) 100%);
  color: #fff;
  transform: rotateY(180deg);
}
.fc-side-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--mint);
  align-self: flex-start;
  background: var(--mint-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.flashcard-face.back .fc-side-tag {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.fc-content {
  font-family: var(--display);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: inherit;
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.flashcard-face.back .fc-content { font-weight: 500; }
.fc-flip-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  align-self: center;
}
.flashcard-face.back .fc-flip-hint { color: rgba(255,255,255,0.6); }

.flashcard-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.fc-nav {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  transition: all .2s;
}
.fc-nav:hover { background: var(--mint); color: #fff; border-color: var(--mint); transform: scale(1.05); }

.fc-action {
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 14px;
  border: 1.5px solid;
  transition: all .2s;
}
.fc-action.good {
  background: var(--mint-soft);
  border-color: var(--mint);
  color: var(--mint-deep);
}
.fc-action.good:hover { background: var(--mint); color: #fff; }
.fc-action.review {
  background: var(--yellow-soft);
  border-color: var(--yellow);
  color: var(--yellow-deep);
}
.fc-action.review:hover { background: var(--yellow); color: #fff; }

.fc-mastery {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-mute);
  background: var(--bg-elev);
  padding: 8px 18px;
  border-radius: 999px;
}
.fc-mastery b { color: var(--mint-deep); font-weight: 800; font-size: 16px; }

/* ===== QUIZ PANEL ===== */
.quiz-intro, .quiz-result-card {
  text-align: center;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 56px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.quiz-intro h3 {
  font-family: var(--display);
  font-size: 36px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.quiz-intro p { color: var(--ink-mute); font-size: 16px; max-width: 400px; }

.quiz-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-mute);
}
.quiz-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-elev);
  border-radius: 3px;
  overflow: hidden;
}
.quiz-progress-bar > div {
  height: 100%;
  background: var(--mint);
  border-radius: 3px;
  transition: width .35s ease;
}

.quiz-card {
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 36px;
}
.quiz-question {
  font-family: var(--display);
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
  color: var(--ink);
  margin-bottom: 24px;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quiz-option {
  padding: 16px 20px;
  background: var(--bg-elev);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  transition: all .2s;
}
.quiz-option:not(:disabled):hover {
  border-color: var(--mint);
  background: var(--mint-soft);
  transform: translateY(-1px);
}
.quiz-option.correct {
  background: var(--mint-soft);
  border-color: var(--mint);
  color: var(--mint-deep);
  font-weight: 700;
}
.quiz-option.incorrect {
  background: var(--pink-soft);
  border-color: var(--pink);
  color: var(--pink-deep);
  font-weight: 700;
}
.quiz-option:disabled { cursor: default; }

.quiz-feedback {
  margin-top: 20px;
  padding: 18px 22px;
  border-radius: var(--r-md);
  border: 1.5px solid;
  animation: fadeIn .35s ease-out;
}
.quiz-feedback.good {
  background: var(--mint-soft);
  border-color: var(--mint);
}
.quiz-feedback.bad {
  background: var(--pink-soft);
  border-color: var(--pink);
}
.qfb-tag {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}
.quiz-feedback.good .qfb-tag { color: var(--mint-deep); }
.quiz-feedback.bad .qfb-tag { color: var(--pink-deep); }
.quiz-feedback p { font-size: 14px; color: var(--ink-soft); line-height: 1.5; }

.quiz-actions {
  margin-top: 20px;
  text-align: right;
}

/* Quiz result */
.qr-emoji {
  font-size: 64px;
  line-height: 1;
}
.qr-title {
  font-family: var(--display);
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.qr-score {
  font-family: var(--display);
  font-size: 80px;
  font-weight: 600;
  color: var(--mint);
  line-height: 1;
  letter-spacing: -0.04em;
}
.qr-score small {
  font-size: 32px;
  color: var(--ink-faint);
  margin-left: 4px;
}
.qr-pct {
  font-family: var(--body);
  font-size: 17px;
  color: var(--ink-mute);
  font-weight: 600;
}
.qr-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== MNEMONICS PANEL ===== */
.mnemonics-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.mn-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 32px;
  background: var(--bg-elev);
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
}
.mn-empty p { color: var(--ink-mute); font-size: 14px; line-height: 1.6; margin: 4px 0; }

.mnemonic-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--yellow-soft) 100%);
  border: 1.5px solid var(--yellow);
  border-radius: var(--r-lg);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mn-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--yellow-deep);
  font-weight: 700;
}
.mn-phrase {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 600;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.2;
}
.mn-explain {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* ===== BIG CTA ===== */
.big-cta {
  text-align: center;
  padding: 100px 32px;
  position: relative;
  z-index: 1;
}
.big-cta h2 {
  font-family: var(--display);
  font-size: clamp(36px, 6vw, 76px);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.05;
  max-width: 900px;
  margin: 0 auto 18px;
}
.big-cta h2 em { color: var(--mint); font-style: italic; font-weight: 500; }
.big-cta-sub {
  color: var(--ink-mute);
  font-size: 17px;
  margin-bottom: 32px;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--ink);
  color: var(--bg);
  padding: 80px 0 40px;
  position: relative;
  z-index: 1;
}
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.footer .brand { color: var(--bg); }
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 56px;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-tagline { color: rgba(255,252,247,0.55); font-size: 14px; }

.footer-cross { margin-bottom: 56px; }
.footer-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--yellow);
  margin-bottom: 24px;
}
.cross-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.cross-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255,252,247,0.04);
  border: 1px solid rgba(255,252,247,0.1);
  padding: 18px 22px;
  border-radius: var(--r-md);
  transition: all .25s;
  color: var(--bg);
}
.cross-card:hover { border-color: var(--yellow); background: rgba(255,252,247,0.08); transform: translateY(-2px); }
.cross-icon {
  font-size: 24px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: rgba(255,252,247,0.06);
  border-radius: var(--r-sm);
}
.cross-card div:not(.cross-icon) { flex: 1; }
.cross-card strong {
  display: block;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
}
.cross-card em {
  display: block;
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,252,247,0.5);
  margin-top: 2px;
  letter-spacing: 0.04em;
}
.cross-arrow { color: rgba(255,252,247,0.3); font-size: 20px; transition: all .25s; }
.cross-card:hover .cross-arrow { color: var(--yellow); transform: translateX(4px); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  padding-top: 32px;
  border-top: 1px solid rgba(255,252,247,0.1);
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,252,247,0.4);
  flex-wrap: wrap;
  gap: 12px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(140%);
  background: var(--ink);
  color: var(--bg);
  padding: 14px 24px;
  border-radius: var(--r-md);
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform .35s cubic-bezier(.16,1,.3,1);
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01s !important; }
  .reveal { opacity: 1; transform: none; }
}
