:root {
  --gold: #d6a11d;
  --gold-soft: #fff1c7;
  --brown: #4a2f1b;
  --brown-soft: #f2e2ce;
  --purple: #6f3ba8;
  --purple-soft: #f0e4ff;
  --cream: #fff9ec;
  --ink: #241a13;
  --muted: #6f5e50;
  --card: #ffffff;
  --success: #2e7d32;
  --danger: #b3261e;
  --warning: #a06400;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(111, 59, 168, 0.14), transparent 32%),
    linear-gradient(180deg, #fff9ec 0%, #f7ecd8 45%, #ead6b9 100%);
  color: var(--ink);
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 249, 236, 0.97);
  border-bottom: 1px solid #dfc28a;
  padding: 14px 16px;
  backdrop-filter: blur(8px);
}

.brand {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--brown);
  letter-spacing: -0.5px;
}

.logo span { color: var(--purple); }

.subtitle {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 2px;
}

.badge {
  background: linear-gradient(135deg, var(--gold-soft), var(--purple-soft));
  border: 1px solid #d4b46a;
  color: var(--brown);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 14px 90px;
}

.hero {
  background:
    linear-gradient(135deg, rgba(214, 161, 29, 0.95), rgba(111, 59, 168, 0.9)),
    linear-gradient(90deg, var(--gold), var(--purple));
  color: #fffdf7;
  border-radius: 26px;
  padding: 22px;
  box-shadow: 0 14px 34px rgba(74, 47, 27, 0.23);
  margin-bottom: 14px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "R $";
  position: absolute;
  right: 20px;
  bottom: -18px;
  font-size: 4rem;
  opacity: 0.14;
  font-weight: 900;
  letter-spacing: 7px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  line-height: 1.1;
}

.hero p {
  margin: 0;
  max-width: 760px;
  line-height: 1.45;
}

.nav {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 18px;
}

button { font-family: inherit; }

.nav button,
.difficulty button,
.action-button {
  border: 0;
  border-radius: 16px;
  padding: 11px 8px;
  background: #fff;
  color: var(--brown);
  box-shadow: 0 4px 14px rgba(74, 47, 27, 0.10);
  font-weight: 900;
  cursor: pointer;
}

.nav button.active,
.difficulty button.active {
  background: var(--brown);
  color: #fff;
  outline: 2px solid rgba(111, 59, 168, 0.35);
}

section { display: none; }
section.active { display: block; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.card {
  background: var(--card);
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(74, 47, 27, 0.09);
  border: 1px solid #ead4aa;
  margin-bottom: 12px;
}

.card h2, .card h3 { margin-top: 0; }

.flashcard { border-left: 6px solid var(--gold); }
.purple-card { border-left: 6px solid var(--purple); }
.warning-card { border-left: 6px solid var(--warning); background: #fffaf0; }

.learn-list li {
  margin-bottom: 8px;
  line-height: 1.45;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill {
  display: inline-flex;
  background: var(--gold-soft);
  border: 1px solid #e2bf5a;
  color: var(--brown);
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.82rem;
}

.pill.purple {
  background: var(--purple-soft);
  border-color: #c7a8ea;
  color: var(--purple);
}

.difficulty {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.scorebox {
  background: #fff;
  border-radius: 22px;
  padding: 14px;
  border: 2px solid #d9b75b;
  margin-bottom: 12px;
  font-weight: 900;
  line-height: 1.45;
}

.scorebox.purple { border-color: #b98be8; }

.test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.action-button.primary {
  background: var(--brown);
  color: #fff;
  padding-left: 16px;
  padding-right: 16px;
}

.action-button.purple {
  background: var(--purple);
  color: #fff;
  padding-left: 16px;
  padding-right: 16px;
}

.action-button.secondary {
  background: var(--gold-soft);
  color: var(--brown);
  border: 1px solid #d9b75b;
  padding-left: 16px;
  padding-right: 16px;
}

.action-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.quiz-card { margin-bottom: 12px; }

.question {
  font-weight: 900;
  margin-bottom: 10px;
  line-height: 1.35;
}

.option {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #e5d0a8;
  border-radius: 14px;
  background: #fffdf8;
  padding: 11px;
  margin: 8px 0;
  cursor: pointer;
  font-size: 0.96rem;
  line-height: 1.35;
}

.option.selected {
  border-color: var(--purple);
  background: var(--purple-soft);
  font-weight: 900;
}

.option.correct {
  border-color: var(--success);
  background: #eaf6eb;
}

.option.wrong {
  border-color: var(--danger);
  background: #fdeceb;
}

.option:disabled {
  cursor: default;
  opacity: 1;
}

.feedback {
  font-weight: 800;
  margin-top: 8px;
  min-height: 22px;
  line-height: 1.45;
}

.hidden-card {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hidden-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 22px rgba(74, 47, 27, 0.13);
}

.hidden-answer,
.definition {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #d7b465;
  line-height: 1.45;
}

.hidden-answer.revealed,
.definition.revealed {
  display: block;
}

.keyword {
  font-weight: 900;
  color: var(--purple);
}

.tap-note {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 900;
}

.status-line {
  color: var(--warning);
  font-weight: 900;
  margin-bottom: 8px;
  line-height: 1.4;
}

.improvement {
  display: none;
  margin-bottom: 12px;
  border-left: 6px solid var(--purple);
}

.improvement.active { display: block; }

.small {
  color: var(--muted);
  font-size: 0.9rem;
}

.points-big {
  font-size: 2rem;
  font-weight: 900;
  color: var(--purple);
  margin: 6px 0;
}

.progress-bar {
  width: 100%;
  height: 16px;
  background: var(--brown-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--purple));
  transition: width 0.4s ease;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid #ead4aa;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  min-width: 680px;
}

th, td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid #efdfc1;
  font-size: 0.92rem;
}

th {
  background: var(--brown);
  color: #fff;
}

tr.missed td {
  background: #fff2f0;
}

tr.completed td {
  background: #f4fff4;
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding-top: 18px;
}

@media (max-width: 920px) {
  .nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .difficulty { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.42rem; }
  .brand { align-items: flex-start; }
  .badge { white-space: normal; text-align: right; }
}
