@import url('https://fonts.googleapis.com/css2?family=Anek+Tamil:wght@400;600;700&family=Noto+Serif+Tamil:wght@400;600;700&display=swap');

:root {
  --ink: #2c2014;
  --muted: #6a5442;
  --accent: #c4572a;
  --accent-2: #2b7a6d;
  --accent-3: #f2b544;
  --paper: #fff7ec;
  --paper-2: #f6e6d2;
  --shadow: rgba(44, 32, 20, 0.18);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: 'Noto Serif Tamil', serif;
  background: radial-gradient(circle at top left, #fff3dc 0%, #f7e1c8 40%, #f2d1b6 100%);
  min-height: 100vh;
}

.page {
  position: relative;
  padding: 32px 36px 60px;
}

.page::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.hero {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: 26px 28px;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 18px 40px var(--shadow);
  border: 1px solid rgba(196, 87, 42, 0.15);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.hero h1 {
  font-family: 'Anek Tamil', sans-serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin: 0 0 6px;
}

.subhead {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.hero-actions {
  display: grid;
  gap: 12px;
  align-items: center;
}

.overall-progress {
  background: rgba(196, 87, 42, 0.08);
  padding: 12px 16px;
  border-radius: 14px;
  font-family: 'Anek Tamil', sans-serif;
  display: grid;
  gap: 6px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(44, 32, 20, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.progress-track.slim {
  height: 6px;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.exam-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: 'Anek Tamil', sans-serif;
  font-weight: 600;
  color: var(--paper);
  background: var(--accent-2);
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(43, 122, 109, 0.35);
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 24px;
  margin-top: 28px;
}

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid rgba(196, 87, 42, 0.15);
  box-shadow: 0 12px 28px var(--shadow);
}

.sidebar h2 {
  font-family: 'Anek Tamil', sans-serif;
  margin: 0 0 16px;
}

.topic-list {
  display: grid;
  gap: 12px;
}

.topic-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(44, 32, 20, 0.1);
  background: var(--paper);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.topic-item.active {
  border-color: rgba(196, 87, 42, 0.6);
  box-shadow: 0 10px 18px rgba(196, 87, 42, 0.18);
  transform: translateY(-2px);
}

.topic-title-text {
  font-family: 'Anek Tamil', sans-serif;
  font-weight: 600;
  margin-bottom: 6px;
}

.topic-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
}

.streak-card {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(43, 122, 109, 0.1);
  border: 1px solid rgba(43, 122, 109, 0.3);
}

.streak-card h3 {
  margin: 0 0 6px;
  font-family: 'Anek Tamil', sans-serif;
}

.content {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 24px 26px 32px;
  border: 1px solid rgba(196, 87, 42, 0.15);
  box-shadow: 0 16px 32px var(--shadow);
}

.stage-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.topic-title {
  margin: 0;
  color: var(--accent-2);
  font-family: 'Anek Tamil', sans-serif;
  font-weight: 600;
}

.stage-header h2 {
  margin: 6px 0 4px;
  font-size: 1.6rem;
}

.stage-meta {
  color: var(--muted);
  margin: 0;
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  font-family: 'Anek Tamil', sans-serif;
  border: none;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

button:active {
  transform: scale(0.97);
}

button.primary {
  background: var(--accent);
  color: var(--paper);
  box-shadow: 0 10px 18px rgba(196, 87, 42, 0.35);
}

button.ghost {
  background: rgba(44, 32, 20, 0.08);
  color: var(--ink);
}

button.is-pulsing {
  animation: pulse 0.4s ease;
}

.stage-progress {
  margin: 18px 0 12px;
  display: grid;
  gap: 12px;
}

.stage-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  gap: 8px;
}

.stage-chip {
  padding: 8px 0;
  border-radius: 10px;
  text-align: center;
  background: rgba(44, 32, 20, 0.08);
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.stage-chip.completed {
  background: rgba(43, 122, 109, 0.2);
  border-color: rgba(43, 122, 109, 0.4);
}

.stage-chip.active {
  border-color: rgba(196, 87, 42, 0.7);
  background: rgba(196, 87, 42, 0.15);
}

.stage-content {
  background: #fffdf7;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(44, 32, 20, 0.08);
  line-height: 1.8;
  max-width: 100%;
}

.stage-content h2,
.stage-content h3,
.stage-content h4 {
  font-family: 'Anek Tamil', sans-serif;
  color: var(--accent);
}

.stage-content table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  margin: 12px 0;
}

.stage-content td,
.stage-content th {
  border: 1px solid rgba(44, 32, 20, 0.2);
  padding: 8px;
  min-width: 120px;
}

.practice {
  margin-top: 28px;
  background: rgba(242, 181, 68, 0.16);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid rgba(242, 181, 68, 0.4);
}

.practice-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.practice-header h3 {
  margin: 0 0 6px;
  font-family: 'Anek Tamil', sans-serif;
}

.practice-actions {
  display: flex;
  gap: 10px;
}

.quiz {
  margin-top: 16px;
  display: grid;
  gap: 16px;
}

.quiz-item {
  background: #fffdf4;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(44, 32, 20, 0.08);
}

.quiz-item h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.quiz-options {
  display: grid;
  gap: 8px;
}

.quiz-option {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(44, 32, 20, 0.12);
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
}

.quiz-option input {
  accent-color: var(--accent-2);
}

.quiz-option.correct {
  background: rgba(43, 122, 109, 0.18);
  border-color: rgba(43, 122, 109, 0.5);
}

.quiz-option.wrong {
  background: rgba(196, 87, 42, 0.2);
  border-color: rgba(196, 87, 42, 0.5);
}

.quiz-result {
  margin-top: 12px;
  font-family: 'Anek Tamil', sans-serif;
  font-weight: 600;
}

.toast {
  position: fixed;
  bottom: 26px;
  right: 24px;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.reward-badge {
  position: fixed;
  top: 28px;
  right: 28px;
  background: var(--accent-3);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 999px;
  font-family: 'Anek Tamil', sans-serif;
  font-weight: 700;
  box-shadow: 0 10px 18px rgba(242, 181, 68, 0.4);
  opacity: 0;
  transform: scale(0.8) rotate(-6deg);
  transition: opacity 0.2s ease, transform 0.3s ease;
  z-index: 60;
}

.reward-badge.show {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 40;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.9;
  animation: confetti-fall 1.2s linear forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(340px) rotate(220deg);
    opacity: 0;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

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

  .sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 20px 16px 40px;
  }

  .stage-actions,
  .practice-actions {
    width: 100%;
  }

  .stage-actions button,
  .practice-actions button {
    flex: 1;
  }

  .hero {
    padding: 20px;
  }
}

.exam-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 24px 60px;
}

.exam-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 16px 32px var(--shadow);
  border: 1px solid rgba(196, 87, 42, 0.2);
}

.exam-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.exam-timer {
  font-family: 'Anek Tamil', sans-serif;
  background: rgba(43, 122, 109, 0.15);
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
}

.exam-question {
  margin-top: 20px;
  background: #fffdf4;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(44, 32, 20, 0.12);
}

.exam-actions {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.exam-summary {
  margin-top: 24px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(196, 87, 42, 0.15);
  font-family: 'Anek Tamil', sans-serif;
}
