@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600;700&family=Lora:ital,wght@0,500;0,600;0,700;1,500&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --chalkboard: #141414;
  --chalkboard-dark: #0a0a0a;
  --chalk: #f4f4f2;
  --chalk-dim: #b9b9b5;
  --paper: #fbf7ec;
  --paper-line: #d8cfb8;
  --marigold: #e1a335;
  --marigold-dark: #c68a22;
  --ink: #22281f;
  --ink-soft: #4a5245;
  --rule-blue: #7c8fb0;
  --correct: #3f7d5c;
  --wrong: #b8532f;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
}

h1, h2, h3, .brand {
  font-family: 'Lora', serif;
}

.chalk-header {
  position: relative;
  background: var(--chalkboard);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.02) 0, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.015) 0, transparent 40%);
  color: var(--chalk);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 4px solid var(--marigold);
  overflow: hidden;
}

.chalk-header .brand {
  font-family: 'Caveat', cursive;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  transform: rotate(-0.6deg);
}

.chalk-header .brand small {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 12px;
  color: var(--marigold);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.chalk-header .user-info {
  font-size: 13px;
  color: rgba(246,243,233,0.7);
  display: flex;
  align-items: center;
  gap: 14px;
}

.chalk-header button.link-btn {
  background: none;
  border: none;
  color: var(--marigold);
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
  padding: 0;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  overflow: hidden;
  background: var(--chalkboard);
  background-image:
    radial-gradient(ellipse at 15% 20%, rgba(255,255,255,0.04) 0, transparent 45%),
    radial-gradient(ellipse at 85% 75%, rgba(255,255,255,0.03) 0, transparent 45%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.008) 0px, transparent 1px, transparent 3px);
}

.login-screen::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(244,244,242,0.08);
  border-radius: 4px;
  pointer-events: none;
}

.doodle-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.doodle {
  position: absolute;
  font-family: 'Caveat', cursive;
  color: var(--chalk-dim);
  opacity: 0.28;
  white-space: nowrap;
  animation: drift linear infinite;
}

.doodle:nth-child(1)  { top: 12%; left: 6%;  font-size: 30px; animation-duration: 34s; }
.doodle:nth-child(2)  { top: 22%; left: 78%; font-size: 26px; animation-duration: 29s; animation-delay: -6s; }
.doodle:nth-child(3)  { top: 68%; left: 10%; font-size: 34px; animation-duration: 38s; animation-delay: -12s; }
.doodle:nth-child(4)  { top: 78%; left: 70%; font-size: 24px; animation-duration: 26s; animation-delay: -3s; }
.doodle:nth-child(5)  { top: 45%; left: 88%; font-size: 28px; animation-duration: 31s; animation-delay: -18s; }
.doodle:nth-child(6)  { top: 8%;  left: 42%; font-size: 22px; animation-duration: 27s; animation-delay: -9s; }
.doodle:nth-child(7)  { top: 85%; left: 38%; font-size: 30px; animation-duration: 33s; animation-delay: -21s; }
.doodle:nth-child(8)  { top: 55%; left: 3%;  font-size: 26px; animation-duration: 30s; animation-delay: -14s; }
.doodle:nth-child(9)  { top: 30%; left: 20%; font-size: 20px; animation-duration: 25s; animation-delay: -4s; }
.doodle:nth-child(10) { top: 62%; left: 60%; font-size: 24px; animation-duration: 36s; animation-delay: -17s; }

.doodle-svg {
  position: absolute;
  opacity: 0.25;
  animation: drift linear infinite;
}

.doodle-svg:nth-child(11) { top: 15%; left: 55%; width: 54px; animation-duration: 32s; animation-delay: -8s; }
.doodle-svg:nth-child(12) { top: 40%; left: 30%; width: 60px; animation-duration: 40s; animation-delay: -22s; }
.doodle-svg:nth-child(13) { top: 72%; left: 82%; width: 50px; animation-duration: 28s; animation-delay: -5s; }
.doodle-svg:nth-child(14) { top: 5%;  left: 65%; width: 46px; animation-duration: 35s; animation-delay: -15s; }
.doodle-svg:nth-child(15) { top: 60%; left: 45%; width: 58px; animation-duration: 30s; animation-delay: -25s; }

.header-doodles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.header-doodles .doodle {
  opacity: 0.18;
  font-size: 20px !important;
}

@keyframes drift {
  0%   { transform: translate(0, 0) rotate(-2deg); }
  50%  { transform: translate(14px, -18px) rotate(2deg); }
  100% { transform: translate(0, 0) rotate(-2deg); }
}

@media (prefers-reduced-motion: reduce) {
  .doodle { animation: none; }
}

.login-card { max-width: 460px; position: relative; z-index: 2; }

.chalk-title {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 74px;
  line-height: 1;
  color: var(--chalk);
  letter-spacing: 1px;
  margin: 0 0 4px;
  text-shadow:
    0 0 1px rgba(244,244,242,0.5),
    0 0 8px rgba(244,244,242,0.15);
  transform: rotate(-1.2deg);
}

.chalk-underline {
  width: 220px;
  height: 14px;
  margin: 0 auto 22px;
  opacity: 0.85;
}

.chalk-tagline {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  color: var(--chalk-dim);
  margin-bottom: 28px;
  transform: rotate(0.5deg);
}

.login-card p.desc {
  color: var(--chalk-dim);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 34px;
  font-family: 'Inter', sans-serif;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--chalk);
  color: var(--chalkboard-dark);
  border: none;
  padding: 14px 30px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: transform 0.15s ease, background 0.15s ease;
  position: relative;
  z-index: 2;
}

.google-btn:hover { background: #fff; transform: translateY(-1px); }

.notebook-card {
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-left: 4px solid var(--marigold);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 14px;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 27px,
    var(--paper-line) 28px
  );
  background-position: 0 40px;
}

.notebook-card:hover {
  transform: translateX(3px);
  box-shadow: 3px 3px 0 rgba(31,58,46,0.08);
}

.notebook-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--chalkboard);
}

.notebook-card .meta {
  font-size: 13px;
  color: var(--ink-soft);
  font-family: 'IBM Plex Mono', monospace;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--rule-blue);
  font-weight: 600;
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--paper-line);
}

.breadcrumb {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--rule-blue);
  cursor: pointer;
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.group-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.group-tile {
  background: var(--chalkboard);
  color: var(--chalk);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.group-tile:hover { transform: translateY(-3px); }

.group-tile h3 { margin: 0 0 6px; color: var(--marigold); font-size: 20px; }
.group-tile p { margin: 0; font-size: 13px; color: rgba(246,243,233,0.65); }

@media (max-width: 560px) {
  .group-grid { grid-template-columns: 1fr; }
}

.generate-btn {
  background: var(--marigold);
  color: var(--chalkboard-dark);
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
}

.generate-btn:hover { background: var(--marigold-dark); }
.generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(31,58,46,0.25);
  border-top-color: var(--chalkboard-dark);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.question-card {
  background: white;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}

.question-card .q-number {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--marigold-dark);
  font-weight: 600;
  margin-bottom: 6px;
}

.question-card .q-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  line-height: 1.5;
}

.option-row {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
}

.option-row:hover { border-color: var(--rule-blue); }
.option-row.selected { border-color: var(--rule-blue); background: #eef1f7; }
.option-row.correct { border-color: var(--correct); background: #eaf5ee; }
.option-row.incorrect { border-color: var(--wrong); background: #fbeae3; }

.explanation-box {
  margin-top: 14px;
  padding: 16px;
  background: var(--chalkboard);
  color: var(--chalk);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.7;
  display: none;
}

.explanation-box.show { display: block; }
.explanation-box .label {
  color: var(--marigold);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-bottom: 8px;
}

.explanation-box .explanation-text {
  white-space: pre-line;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}

.trial-banner {
  background: var(--marigold);
  color: var(--chalkboard-dark);
  padding: 10px 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.hidden { display: none !important; }