:root {
  --bg: #fffaf2;
  --panel: #ffffff;
  --panel-alt: #fff1d8;
  --primary: #f28c28;
  --primary-dark: #b85d0d;
  --primary-soft: #ffe7c2;
  --accent: #3a9d68;
  --success: #1f8f5f;
  --text: #2d2a26;
  --muted: #665d51;
  --shadow: 0 14px 30px rgba(157, 94, 18, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
  overflow-x: clip;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  background: linear-gradient(180deg, #fffaf4 0%, #fff8ee 42%, #fff4df 100%);
  color: var(--text);
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top);
  backdrop-filter: blur(10px);
  background: rgba(255, 250, 242, 0.85);
  border-bottom: 1px solid rgba(183, 139, 84, 0.12);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #e8a84c);
  color: white;
  font-size: 0.9rem;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem 1rem;
  color: var(--muted);
  font-weight: 600;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 2rem;
  align-items: center;
  padding: 4rem 0 3rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2.3rem, 4vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -0.06em;
}

.lead {
  max-width: 560px;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.hero-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.primary-btn,
.ghost-btn,
.answer-btn {
  border: none;
  border-radius: 14px;
  padding: 0.9rem 1.3rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), #ec9b3d);
  color: white;
  box-shadow: var(--shadow);
}

.ghost-btn {
  background: white;
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.primary-btn:hover,
.ghost-btn:hover,
.answer-btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.hero-card {
  background: linear-gradient(160deg, #1f6f4a 0%, #2fb377 100%);
  color: white;
  border-radius: 28px;
  padding: 2rem 1.5rem;
  box-shadow: 0 18px 40px rgba(31, 111, 74, 0.2);
}

.score-pill {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.score-value {
  margin-top: 1rem;
  font-size: clamp(2.5rem, 4vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.06em;
}

.hero-card ul {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.85rem;
  color: rgba(255, 255, 255, 0.82);
}

.section {
  padding: 2rem 0 4rem;
}

.section-heading {
  margin-bottom: 2rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  letter-spacing: -0.05em;
}

.section-intro {
  max-width: 680px;
  margin: 0.8rem 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.left {
  margin-bottom: 1.5rem;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.2rem;
}

.subject-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

a.subject-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.subject-grid-home {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.subject-tag {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.subject-card h3 {
  margin: 1rem 0 0.5rem;
  font-size: 1.25rem;
}

.subject-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.card-link {
  margin-top: 1rem;
  color: var(--primary-dark);
  font-weight: 700;
}

.welcome-card h2 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.6rem;
  letter-spacing: -0.04em;
}

.welcome-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.65;
}

.subject-intro {
  max-width: 760px;
  margin: 0 auto 1.2rem;
  padding: 1.4rem;
  background: white;
  border: 1px solid rgba(183, 139, 84, 0.16);
  border-radius: var(--radius);
}

.subject-intro h3 {
  margin: 0 0 0.7rem;
}

.subject-intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.subject-intro p + p {
  margin-top: 0.5rem;
}

.lesson-card {
  max-width: 920px;
  margin: 0 auto 1rem;
  padding: 1.4rem;
  background: #fff;
  border: 1px solid rgba(183, 139, 84, 0.2);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.lesson-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.youtube-mark {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.3rem;
  height: 1.65rem;
  border-radius: 0.5rem;
  background: #e62117;
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
}

.lesson-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.lesson-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.lesson-link {
  display: inline-flex;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  color: white;
  background: #c9221a;
  font-weight: 700;
}

.lesson-link:hover {
  background: #a91c16;
}

.lesson-note {
  margin-top: 0.7rem !important;
  font-size: 0.88rem;
}

.activity-details {
  padding: 0;
  overflow: hidden;
}

.activity-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.4rem;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

.activity-summary::-webkit-details-marker {
  display: none;
}

.summary-action {
  flex: 0 0 auto;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  color: white;
  background: var(--primary);
}

.activity-content {
  padding: 0 1.4rem 1.4rem;
  border-top: 1px solid rgba(183, 139, 84, 0.16);
}

.activity-instructions,
.activity-status {
  margin: 1rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.progress-track {
  height: 0.65rem;
  margin-top: 0.8rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--primary-soft);
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

.question-prompt {
  white-space: pre-line;
  line-height: 1.6;
}

.quiz-continue {
  margin-top: 0.9rem;
}

.answer-btn:disabled {
  cursor: default;
}

.activity-content h3 {
  margin: 1.2rem 0 0.4rem;
}

.how-to-section {
  padding-top: 1rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.step-card {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1.2rem;
  background: white;
  border: 1px solid rgba(183, 139, 84, 0.16);
  border-radius: var(--radius);
}

.step-number {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  color: white;
  background: var(--primary);
  font-weight: 800;
}

.step-card h3 {
  margin: 0 0 0.4rem;
}

.step-card p,
.privacy-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.privacy-note {
  margin-top: 1rem;
  text-align: center;
}

.math {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.06), rgba(255, 255, 255, 1));
}

.language {
  background: linear-gradient(180deg, rgba(236, 72, 153, 0.06), rgba(255, 255, 255, 1));
}

.science {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.06), rgba(255, 255, 255, 1));
}

.history {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.06), rgba(255, 255, 255, 1));
}

.politics {
  background: linear-gradient(160deg, rgba(31, 111, 74, 0.13), rgba(255, 255, 255, 1) 76%);
}

.brazil-history {
  background: linear-gradient(160deg, rgba(232, 168, 76, 0.2), rgba(255, 255, 255, 1) 76%);
}

.essay-card {
  background: linear-gradient(160deg, rgba(123, 157, 88, 0.2), rgba(255, 255, 255, 1) 76%);
}

.culture-note {
  max-width: 760px;
  margin: 0 auto 1.2rem;
  padding: 1rem 1.2rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 14px 14px 0;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  line-height: 1.65;
}

.subject-brazilian-politics .culture-note {
  border-left-color: #1f6f4a;
}

.subject-brazilian-history .culture-note {
  border-left-color: #d99125;
}

.challenge-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.4rem;
}

.challenge-panel,
.quiz-panel {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 28px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.challenge-box {
  background: var(--panel-alt);
  border-radius: 20px;
  padding: 1.3rem;
}

.challenge-text {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.7;
  min-height: 90px;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.1rem;
}

.answer-btn {
  background: white;
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text);
  font-weight: 700;
}

.single-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide-panel {
  max-width: 760px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  margin-top: 1rem;
}

.answer-btn.correct {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
  border-color: rgba(22, 163, 74, 0.35);
}

.answer-btn.wrong {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.2);
}

.challenge-result,
.quiz-result {
  min-height: 24px;
  margin-top: 1rem;
  font-weight: 700;
}

.quiz-form {
  display: grid;
  gap: 1rem;
}

.quiz-item {
  background: #f8faff;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  padding: 1rem;
}

.quiz-item p {
  margin: 0 0 0.7rem;
  font-weight: 700;
}

.quiz-item label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.submit-btn {
  width: fit-content;
  margin-top: 0.5rem;
}

.planner-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.planner-item {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  background: white;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 1rem;
}

.check {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  font-weight: 800;
  background: #eef2ff;
  color: var(--primary);
}

.planner-item.done .check {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
}

.planner-item.active .check {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.planner-item h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.planner-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.footer {
  padding: 1.5rem 0 3rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  padding-top: 1.5rem;
  color: var(--muted);
}

.support-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 30;
}

.support-chat {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 0.75rem;
}

.support-chat-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.85rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: #176b3a;
  box-shadow: 0 8px 24px rgba(23, 107, 58, 0.28);
  color: white;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.support-chat-toggle::-webkit-details-marker {
  display: none;
}

.support-chat-toggle::marker {
  content: "";
}

.support-chat-toggle:hover {
  background: #105a2f;
}

.support-chat-toggle:focus-visible,
.support-chat-link:focus-visible {
  outline: 3px solid #f28c28;
  outline-offset: 3px;
}

.support-chat-panel {
  display: grid;
  gap: 0.75rem;
  width: min(22rem, calc(100vw - 2rem));
  max-height: min(60vh, 24rem);
  overflow-y: auto;
  padding: 1.25rem;
  border: 1px solid rgba(183, 139, 84, 0.2);
  border-radius: 18px;
  background: white;
  box-shadow: 0 14px 36px rgba(45, 42, 38, 0.18);
}

.support-chat-title {
  margin: 0;
  font-size: 1.15rem;
}

.support-chat-description,
.support-chat-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.support-chat-link {
  display: inline-flex;
  justify-content: center;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: #176b3a;
  color: white;
  font-weight: 700;
  text-align: center;
}

.support-chat-link:hover {
  background: #105a2f;
}

.support-chat-note {
  font-size: 0.82rem;
}

@media (max-width: 900px) {
  .hero,
  .challenge-layout,
  .subject-grid,
  .subject-grid-home,
  .steps-grid,
  .planner-grid {
    grid-template-columns: 1fr;
  }

  .nav {
    flex-direction: column;
    justify-content: center;
    padding: 1rem 0;
    gap: 0.75rem;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

.study-hub > .section-heading h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  letter-spacing: -0.05em;
}

.study-dashboard,
.study-section-card {
  margin: 0 0 1.25rem;
  padding: clamp(1.15rem, 3vw, 1.6rem);
  border: 1px solid rgba(183, 139, 84, 0.18);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.study-section-heading,
.resource-heading,
.resource-actions,
.goal-controls,
.tool-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.study-section-heading h2,
.study-section-card > h2 {
  margin: 0;
}

.study-section-card > p:not(.eyebrow) {
  line-height: 1.6;
}

.study-stats,
.study-tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.study-stat,
.study-tool-card,
.resource-card,
.subject-progress-item,
.mistake-entry {
  min-width: 0;
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  background: var(--panel);
}

.study-stat {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  line-height: 1.4;
}

.study-stat-value {
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 800;
}

.study-label,
.catalog-filters label {
  display: grid;
  gap: 0.45rem;
  color: var(--text);
  font-weight: 700;
}

.study-dashboard > .study-label {
  margin-top: 1rem;
}

.goal-controls {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 0.55rem;
}

.study-hub input,
.study-hub select,
.study-hub textarea {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(102, 93, 81, 0.34);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
}

.goal-controls input {
  width: 8rem;
}

.study-hub input:focus-visible,
.study-hub select:focus-visible,
.study-hub textarea:focus-visible,
.study-hub button:focus-visible,
.study-hub a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.study-progress-track {
  height: 0.65rem;
  margin-top: 0.6rem;
  overflow: hidden;
  border-radius: 99px;
  background: var(--primary-soft);
}

.study-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

.study-feedback,
.tool-helper,
.resource-subject,
.catalog-result-count,
.goal-progress-label {
  color: var(--muted);
  line-height: 1.5;
}

.achievement-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.achievement-badge,
.resource-format-tag {
  display: inline-flex;
  padding: 0.35rem 0.65rem;
  border-radius: 99px;
  background: var(--panel-alt);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.achievement-badge.is-unlocked {
  background: #e4f3e7;
  color: #25633e;
}

.catalog-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.catalog-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.resource-card h3,
.study-tool-card h3,
.subject-progress-item h3,
.mistake-entry h4 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
}

.resource-card p,
.study-tool-card p,
.mistake-entry p {
  line-height: 1.6;
}

.resource-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.resource-open {
  display: inline-flex;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  font-weight: 700;
}

.mini-infographic {
  display: grid;
  gap: 0.5rem;
  padding-left: 1.3rem;
  color: var(--muted);
  line-height: 1.5;
}

.subject-progress-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.subject-progress-item .resource-heading h3 {
  font-size: 0.98rem;
}

.study-tools-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.study-tool-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
}

.study-tool-card > button {
  margin-top: auto;
}

.pomodoro-display {
  color: var(--text);
  font-size: 2.2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.planner-list {
  display: grid;
  width: 100%;
  gap: 0.55rem;
  padding-left: 1.2rem;
}

.planner-list li {
  padding-left: 0.2rem;
  line-height: 1.5;
}

.planner-list li .ghost-btn {
  padding: 0.4rem 0.6rem;
  margin-left: 0.3rem;
}

.flashcard-prompt,
.flashcard-answer {
  padding: 0.9rem;
  border-radius: 12px;
  background: var(--panel-alt);
  color: var(--text);
  line-height: 1.6;
}

.empty-state {
  padding: 1rem;
  border-radius: 12px;
  background: var(--panel-alt);
  color: var(--muted);
}

.mistake-entry + .mistake-entry {
  margin-top: 0.7rem;
}

.print-sheet {
  display: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #181c19;
  --panel: #242a25;
  --panel-alt: #30392f;
  --primary: #bd7937;
  --primary-dark: #e5a663;
  --primary-soft: #473724;
  --accent: #78b48a;
  --success: #7cc39b;
  --text: #f1eee6;
  --muted: #c5c1b6;
  --shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] body:not(.redacao-page) {
  background: linear-gradient(180deg, #1c211d 0%, #20251f 45%, #24291f 100%);
}

:root[data-theme="dark"] body:not(.redacao-page) .topbar {
  background: rgba(29, 34, 30, 0.94);
  border-bottom-color: rgba(213, 211, 190, 0.15);
}

:root[data-theme="dark"] body:not(.redacao-page) .subject-card,
:root[data-theme="dark"] body:not(.redacao-page) .subject-intro,
:root[data-theme="dark"] body:not(.redacao-page) .lesson-card,
:root[data-theme="dark"] body:not(.redacao-page) .challenge-panel,
:root[data-theme="dark"] body:not(.redacao-page) .step-card,
:root[data-theme="dark"] body:not(.redacao-page) .study-dashboard,
:root[data-theme="dark"] body:not(.redacao-page) .study-section-card,
:root[data-theme="dark"] body:not(.redacao-page) .study-stat,
:root[data-theme="dark"] body:not(.redacao-page) .study-tool-card,
:root[data-theme="dark"] body:not(.redacao-page) .resource-card,
:root[data-theme="dark"] body:not(.redacao-page) .subject-progress-item,
:root[data-theme="dark"] body:not(.redacao-page) .mistake-entry,
:root[data-theme="dark"] body:not(.redacao-page) .answer-btn,
:root[data-theme="dark"] body:not(.redacao-page) .ghost-btn {
  background-color: var(--panel);
  border-color: rgba(213, 211, 190, 0.18);
  color: var(--text);
}

:root[data-theme="dark"] body:not(.redacao-page) .hero-card {
  background: linear-gradient(160deg, #214c37 0%, #287950 100%);
}

:root[data-theme="dark"] body:not(.redacao-page) .nav-links,
:root[data-theme="dark"] body:not(.redacao-page) .subject-intro p,
:root[data-theme="dark"] body:not(.redacao-page) .lesson-card p,
:root[data-theme="dark"] body:not(.redacao-page) .study-stat,
:root[data-theme="dark"] body:not(.redacao-page) .study-section-card p,
:root[data-theme="dark"] body:not(.redacao-page) .footer-inner {
  color: var(--muted);
}

@media (max-width: 900px) {
  .study-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .catalog-filters,
  .study-tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .study-section-heading,
  .resource-heading,
  .resource-actions {
    align-items: flex-start;
  }

  .study-section-heading {
    flex-direction: column;
  }

  .catalog-filters,
  .catalog-results,
  .study-tools-grid,
  .subject-progress-list {
    grid-template-columns: 1fr;
  }

  .goal-controls {
    align-items: flex-start;
    flex-direction: column;
  }
}

.catalog-show-more {
  grid-column: 1 / -1;
  justify-self: center;
}

.study-hub .ghost-btn:hover,
.study-hub .primary-btn:hover,
.resource-open:hover {
  filter: brightness(0.96);
}

:root[data-theme="dark"] body:not(.redacao-page) .study-hub .resource-card,
:root[data-theme="dark"] body:not(.redacao-page) .study-hub .resource-card p,
:root[data-theme="dark"] body:not(.redacao-page) .study-hub .study-tool-card p,
:root[data-theme="dark"] body:not(.redacao-page) .study-hub .planner-list,
:root[data-theme="dark"] body:not(.redacao-page) .study-hub .resource-format-tag {
  color: var(--muted);
}

:root[data-theme="dark"] body:not(.redacao-page) .study-hub .achievement-badge.is-unlocked {
  background: #284934;
  color: #c2e8cb;
}

:root[data-theme="dark"] body:not(.redacao-page) .study-hub .flashcard-prompt,
:root[data-theme="dark"] body:not(.redacao-page) .study-hub .flashcard-answer,
:root[data-theme="dark"] body:not(.redacao-page) .study-hub .empty-state {
  background: var(--panel-alt);
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body > * {
    display: none !important;
  }

  body > .print-sheet {
    display: block !important;
    padding: 1cm;
    color: #000;
    font: 12pt/1.6 Georgia, serif;
  }
}

@media (max-width: 480px) {
  .support-widget {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .support-chat-panel {
    width: min(22rem, calc(100vw - 1.5rem));
  }
}

img,
video,
iframe,
svg {
  max-width: 100%;
}

img,
video {
  height: auto;
}

button,
input,
select,
textarea {
  min-width: 0;
}

input,
select,
textarea {
  font-size: 16px;
}

.container,
main,
section,
article,
header,
footer,
.subject-card,
.lesson-card,
.activity-content,
.study-section-card,
.resource-card,
.study-tool-card {
  min-width: 0;
}

h1,
h2,
h3,
p,
a,
button,
label {
  overflow-wrap: anywhere;
}

a,
button,
summary,
select,
input[type="checkbox"],
input[type="radio"] {
  -webkit-tap-highlight-color: transparent;
}

.nav-menu-toggle {
  display: inline-grid;
  flex: 0 0 2.75rem;
  place-content: center;
  gap: 0.3rem;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.5rem;
  border: 1px solid rgba(102, 93, 81, 0.26);
  border-radius: 0.75rem;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.nav-menu-toggle span {
  display: block;
  width: 1.35rem;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.nav-menu-toggle:focus-visible,
.nav-menu-toggle:active {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.nav-links {
  gap: 0.25rem;
}

.nav-links a,
.hero-actions > a,
.lesson-link,
.back-link,
.card-link,
.essay-video-card a,
.resource-open,
.summary-action {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.nav-links a {
  padding: 0.5rem 0.65rem;
  border-radius: 0.65rem;
}

.primary-btn,
.ghost-btn,
.answer-btn,
.activity-summary,
.support-chat-toggle,
.support-chat-link {
  min-height: 2.75rem;
}

.answer-grid,
.single-grid {
  grid-template-columns: minmax(0, 1fr);
}

.nav {
  position: relative;
  flex-direction: row;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 4rem;
  padding-block: 0.5rem;
}

.brand {
  min-width: 0;
}

.nav-menu-toggle {
  display: inline-grid;
}

.nav-links {
  position: absolute;
  z-index: 20;
  top: calc(100% - 0.1rem);
  right: 0;
  left: 0;
  display: none;
  max-height: min(70dvh, 32rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.5rem;
  border: 1px solid rgba(102, 93, 81, 0.2);
  border-radius: 0 0 1rem 1rem;
  background: #fffaf2;
  box-shadow: 0 12px 24px rgba(45, 42, 38, 0.16);
  color: var(--muted);
}

.nav-links.is-open {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
}

.nav-links a {
  width: 100%;
}

.section {
  padding-top: clamp(1.25rem, 5vw, 2rem);
  padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
}

.section-heading h2,
.study-hub > .section-heading h1,
.essay-heading h1,
.hero-copy h1 {
  font-size: clamp(1.8rem, 7vw, 4.1rem);
  overflow-wrap: anywhere;
}

.section-heading,
.subject-intro,
.lesson-card,
.challenge-panel,
.study-dashboard,
.study-section-card,
.essay-heading,
.essay-section {
  max-width: 100%;
}

.subject-grid,
.subject-grid-home,
.steps-grid,
.challenge-layout,
.planner-grid,
.study-stats,
.catalog-filters,
.catalog-results,
.study-tools-grid,
.subject-progress-list,
.essay-video-grid,
.competency-grid {
  grid-template-columns: minmax(0, 1fr);
}

.activity-summary {
  flex-wrap: wrap;
  padding: 1rem;
}

.activity-content,
.lesson-card,
.subject-intro,
.challenge-panel,
.essay-section {
  padding-inline: clamp(1rem, 4vw, 1.4rem);
}

.answer-btn {
  width: 100%;
  padding: 0.75rem 0.9rem;
  text-align: left;
}

.back-link,
.card-link {
  padding-block: 0.5rem;
}

.submit-btn {
  width: 100%;
}

.footer-inner {
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.support-widget {
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
}

.support-chat-panel {
  width: min(22rem, calc(100vw - 2rem - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-height: min(60dvh, 24rem);
}

body[class] {
  background-attachment: scroll;
}

:root[data-theme="dark"] body[class] {
  background-attachment: scroll;
}

.nav-menu-toggle {
  color: #3b332b;
  background: rgba(255, 250, 242, 0.98);
}

.nav-links.is-open {
  color: #493e31;
}

.nav-links a:focus-visible,
.primary-btn:focus-visible,
.ghost-btn:focus-visible,
.answer-btn:focus-visible,
.activity-summary:focus-visible,
.lesson-link:focus-visible,
.back-link:focus-visible,
.card-link:focus-visible,
.essay-video-card a:focus-visible,
.resource-open:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.primary-btn:active,
.ghost-btn:active,
.answer-btn:not(:disabled):active,
.lesson-link:active,
.subject-card:active,
.essay-video-card a:active,
.resource-open:active {
  filter: brightness(0.94);
}

@media (min-width: 600px) {
  .container {
    width: min(1120px, calc(100% - 2.5rem));
  }

  .nav {
    flex-direction: row;
    align-items: center;
    min-height: 4.5rem;
  }

  .nav-menu-toggle {
    display: none;
  }

  .nav-links,
  .nav-links.is-open {
    position: static;
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-links a {
    width: auto;
  }

  .subject-grid,
  .subject-grid-home,
  .steps-grid,
  .planner-grid,
  .study-stats,
  .catalog-filters,
  .study-tools-grid,
  .essay-video-grid,
  .competency-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .catalog-results,
  .subject-progress-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .answer-grid,
  .single-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .challenge-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .submit-btn {
    width: fit-content;
  }
}

@media (min-width: 1024px) {
  .container {
    width: min(1120px, calc(100% - 3rem));
  }

  .hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 0.8fr);
  }

  .subject-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .subject-grid-home,
  .steps-grid,
  .planner-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .study-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .catalog-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .catalog-results,
  .subject-progress-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .study-tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .challenge-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }
}
