* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

body {
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ----- TOP BAR ----- */
.top-bar {
  background: linear-gradient(135deg, #0b2b4f 0%, #123a66 100%);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.logo-square {
  width: 70px;
  height: 70px;
  background: #eab308;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  font-weight: 800;
  color: #0b2b4f;
  box-shadow: 0 6px 12px rgba(0,0,0,0.2);
  border: 2px solid #facc15;
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 1.9rem;
  letter-spacing: 1px;
  font-weight: 700;
  line-height: 1.2;
}

.brand-text h1 small {
  font-size: 1.1rem;
  font-weight: 400;
  color: #cbd5e1;
  display: block;
  margin-top: 0.2rem;
}

.top-bar-right {
  margin-left: auto;
  min-width: 180px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 40px;
  padding: 0.2rem 1.2rem;
  color: #94a3b8;
  font-size: 0.95rem;
  font-style: italic;
  border: 1px dashed #475569;
}

/* ----- SUBHEADING BANNER ----- */
.subhead-banner {
  background: #0f2e4f;
  color: #e2e8f0;
  text-align: center;
  padding: 0.8rem 2rem;
  font-size: 1.15rem;
  font-style: italic;
  letter-spacing: 0.5px;
  border-bottom: 3px solid #eab308;
  font-weight: 400;
}

.subhead-banner span {
  display: inline-block;
  padding: 0 1rem;
}

.subhead-banner i {
  color: #eab308;
  margin: 0 0.8rem;
  font-style: normal;
}

/* ----- NAVIGATION ----- */
.main-nav {
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  padding: 0.2rem 2rem;
  border-bottom: 1px solid #e2e8f0;
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 2.5rem;
  justify-content: center;
}

.main-nav a {
  text-decoration: none;
  color: #1e293b;
  font-weight: 600;
  font-size: 1.1rem;
  padding: 1rem 0.2rem;
  display: inline-block;
  border-bottom: 4px solid transparent;
  transition: all 0.2s;
}

.main-nav a:hover, .main-nav a.active {
  color: #0b2b4f;
  border-bottom-color: #eab308;
}

/* ----- CONTENT ----- */
.container {
  max-width: 1300px;
  margin: 2.5rem auto;
  padding: 0 2rem;
  flex: 1;
  width: 100%;
}

h2 {
  font-size: 2.2rem;
  font-weight: 700;
  color: #0b2b4f;
  margin-bottom: 1.5rem;
  border-left: 8px solid #eab308;
  padding-left: 1.2rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #0f3b66;
  margin: 1.8rem 0 1rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.8rem;
  margin: 2rem 0;
}

/* ----- SUBJECT CARDS (works as div AND link) ----- */
.subject-card,
a.subject-card {
  background: white;
  border-radius: 24px;
  padding: 1.8rem 1.5rem;
  box-shadow: 0 10px 20px -5px rgba(0,0,0,0.05);
  border: 1px solid #e9eef3;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
}

.subject-card:hover,
a.subject-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 30px -10px rgba(11,43,79,0.15);
  border-color: #cbd5e1;
  text-decoration: none;
  color: inherit;
}

.subject-card i {
  font-size: 2.6rem;
  color: #eab308;
  margin-bottom: 1rem;
}

.subject-card h3 {
  margin: 0.5rem 0 0.5rem;
  font-size: 1.4rem;
  color: #0f3b66;
}

.subject-card p {
  color: #475569;
  font-size: 0.95rem;
}

/* ----- BREADCRUMB ----- */
.breadcrumb {
  font-size: 0.95rem;
  color: #64748b;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.breadcrumb a {
  color: #0b2b4f;
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb a:hover {
  color: #eab308;
}

.breadcrumb span {
  color: #94a3b8;
}

/* ----- BUTTONS ----- */
.btn {
  background: #0b2b4f;
  color: white;
  border: none;
  padding: 0.8rem 1.8rem;
  border-radius: 40px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 6px 12px rgba(11,43,79,0.2);
  text-decoration: none;
}

.btn:hover {
  background: #123a66;
  transform: scale(1.02);
}

.btn-outline {
  background: transparent;
  color: #0b2b4f;
  border: 2px solid #0b2b4f;
  box-shadow: none;
}

.btn-outline:hover {
  background: #f1f5f9;
}

/* ----- EXERCISE PANEL ----- */
.exercise-panel {
  background: white;
  border-radius: 28px;
  padding: 2rem;
  box-shadow: 0 20px 35px -8px rgba(0,0,0,0.1);
  border: 1px solid #dce5ec;
  margin-top: 1.5rem;
}

.question-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 2px dashed #cbd5e1;
  padding-bottom: 1rem;
}

.score-badge {
  background: #eab308;
  color: #0b2b4f;
  font-weight: 700;
  padding: 0.4rem 1.2rem;
  border-radius: 30px;
  font-size: 1.2rem;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.topic-tag {
  background: #eef2f6;
  color: #0b2b4f;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ----- TOPIC GRID ----- */
.topic-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1.5rem 0 2rem;
}

.topic-btn {
  background: white;
  border: 2px solid #cbd5e1;
  color: #0b2b4f;
  padding: 0.7rem 1.4rem;
  border-radius: 40px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
}

.topic-btn i {
  color: #eab308;
}

.topic-btn:hover {
  border-color: #eab308;
  background: #fffbeb;
  transform: translateY(-2px);
}

.topic-btn.active-topic {
  background: #0b2b4f;
  color: white;
  border-color: #0b2b4f;
}

.topic-btn.active-topic i {
  color: #eab308;
}

/* ----- STEPS / INPUTS ----- */
.step-container {
  margin: 1.8rem 0;
  padding: 1.2rem 0;
}

.step-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.6rem;
  margin-bottom: 1.8rem;
  font-size: 1.15rem;
  line-height: 2.2;
}

.step-label {
  font-weight: 700;
  color: #0b2b4f;
  min-width: 60px;
}

.blank-input {
  display: inline-block;
  width: 110px;
  padding: 0.5rem 0.6rem;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  font-size: 1rem;
  font-family: 'Courier New', monospace;
  text-align: center;
  background: #f9fcff;
  transition: border 0.15s;
  margin: 0 0.2rem;
}

.blank-input:focus {
  border-color: #eab308;
  outline: none;
  box-shadow: 0 0 0 3px rgba(234,179,8,0.2);
}

.blank-input.correct {
  border-color: #10b981;
  background: #ecfdf5;
}

.blank-input.wrong {
  border-color: #ef4444;
  background: #fef2f2;
}

.feedback-icon {
  font-size: 1.4rem;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.fa-check-circle { color: #10b981; }
.fa-times-circle { color: #ef4444; }

.exercise-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
  align-items: center;
}

.score-display {
  font-size: 1.4rem;
  font-weight: 700;
  background: #f1f5f9;
  padding: 0.5rem 1.5rem;
  border-radius: 40px;
  color: #0b2b4f;
}

/* ----- FOOTER ----- */
.footer {
  background: #0b2b4f;
  color: #cbd5e1;
  padding: 2rem;
  text-align: center;
  margin-top: 3rem;
  font-size: 0.95rem;
  border-top: 6px solid #eab308;
}

.footer a {
  color: #eab308;
  text-decoration: none;
  margin: 0 0.5rem;
}

.footer a:hover {
  text-decoration: underline;
}

.social-links {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 1.3rem;
}

.text-muted { color: #64748b; }

/* Explanation box */
.explanation-box {
  background: #fffbeb;
  border-left: 5px solid #eab308;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  margin-bottom: 1.2rem;
  font-size: 1rem;
  color: #78350f;
}

.explanation-box i {
  color: #eab308;
  margin-right: 0.5rem;
}

/* Subtopic selection */
.subtopic-section {
  background: #f8fafc;
  border-radius: 20px;
  padding: 1.5rem;
  border: 1px dashed #cbd5e1;
}

.subtopic-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.subtopic-btn {
  background: white;
  border: 2px solid #cbd5e1;
  color: #0b2b4f;
  padding: 0.6rem 1.1rem;
  border-radius: 30px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: inherit;
  text-align: left;
}

.subtopic-btn strong {
  color: #eab308;
  font-weight: 800;
  margin-right: 0.3rem;
}

.subtopic-btn:hover {
  border-color: #eab308;
  background: #fffbeb;
  transform: translateY(-2px);
}

.subtopic-btn.active-subtopic {
  background: #0b2b4f;
  color: white;
  border-color: #0b2b4f;
}

.subtopic-btn.active-subtopic strong {
  color: #eab308;
}

/* ----- RESPONSIVE ----- */
@media (max-width: 800px) {
  .top-bar { flex-direction: column; align-items: flex-start; }
  .top-bar-right { margin-left: 0; width: 100%; justify-content: center; }
  .main-nav ul { gap: 1.2rem; flex-wrap: wrap; }
  .brand-text h1 { font-size: 1.5rem; }
  .step-line { font-size: 1rem; }
  .blank-input { width: 90px; }
}