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

:root {
  --bg: #f8f7f4;
  --bg2: #ffffff;
  --surface: #f1efe8;
  --border: rgba(0,0,0,0.1);
  --border2: rgba(0,0,0,0.06);
  --text: #1a1917;
  --text2: #5f5e5a;
  --text3: #888780;
  --blue: #185fa5;
  --blue-bg: #e6f1fb;
  --blue-text: #0c447c;
  --green: #3b6d11;
  --green-bg: #eaf3de;
  --green-text: #27500a;
  --amber: #854f0b;
  --amber-bg: #faeeda;
  --amber-text: #633806;
  --purple: #534ab7;
  --purple-bg: #eeedfe;
  --purple-text: #3c3489;
  --teal: #0f6e56;
  --teal-bg: #e1f5ee;
  --teal-text: #085041;
  --coral: #993c1d;
  --coral-bg: #faece7;
  --coral-text: #712b13;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1917;
    --bg2: #232220;
    --surface: #2c2c2a;
    --border: rgba(255,255,255,0.1);
    --border2: rgba(255,255,255,0.06);
    --text: #e8e6e0;
    --text2: #9c9a92;
    --text3: #666460;
    --blue: #85b7eb;
    --blue-bg: #0c447c;
    --blue-text: #b5d4f4;
    --green: #97c459;
    --green-bg: #27500a;
    --green-text: #c0dd97;
    --amber: #ef9f27;
    --amber-bg: #633806;
    --amber-text: #fac775;
    --purple: #afa9ec;
    --purple-bg: #3c3489;
    --purple-text: #cecbf6;
    --teal: #5dcaa5;
    --teal-bg: #085041;
    --teal-text: #9fe1cb;
    --coral: #f0997b;
    --coral-bg: #712b13;
    --coral-text: #f5c4b3;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
  }
}

html { font-size: 16px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
#root { min-height: 100vh; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
h1 { font-size: 1.75rem; font-weight: 600; line-height: 1.3; }
h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }
h3 { font-size: 1rem; font-weight: 600; }
p { color: var(--text2); }
.container { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }
.card {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-blue { background: var(--blue-bg); color: var(--blue-text); }
.badge-green { background: var(--green-bg); color: var(--green-text); }
.badge-amber { background: var(--amber-bg); color: var(--amber-text); }
.badge-purple { background: var(--purple-bg); color: var(--purple-text); }
.badge-teal { background: var(--teal-bg); color: var(--teal-text); }
.badge-coral { background: var(--coral-bg); color: var(--coral-text); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn:hover { background: var(--surface); }
.btn-primary { background: var(--text); color: var(--bg); border-color: transparent; }
.btn-primary:hover { opacity: 0.88; background: var(--text); }
.progress-track { height: 6px; background: var(--surface); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--blue); transition: width 0.4s ease; }
.bubble-user {
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius) var(--radius) 4px var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  max-width: 85%;
  align-self: flex-end;
}
.bubble-ai {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius) var(--radius) var(--radius) 4px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  max-width: 92%;
  align-self: flex-start;
  line-height: 1.65;
}
.bubble-ai p { color: var(--text); margin-bottom: 0.5rem; }
.bubble-ai p:last-child { margin-bottom: 0; }
.module-card { cursor: pointer; transition: all 0.15s; }
.module-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.flashcard { perspective: 1000px; cursor: pointer; }
.flashcard-inner {
  transition: transform 0.5s;
  transform-style: preserve-3d;
  position: relative;
  min-height: 160px;
}
.flashcard-inner.flipped { transform: rotateY(180deg); }
.flashcard-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 160px;
}
.flashcard-back {
  transform: rotateY(180deg);
  position: absolute;
  inset: 0;
  background: var(--blue-bg);
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.25s ease forwards; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.typing-dot { animation: pulse 1s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
