:root {
  --bg: #17120f;
  --panel: rgba(255, 250, 241, 0.94);
  --panel-dark: #2a211b;
  --text: #241914;
  --muted: #6c5a50;
  --brand: #d8893a;
  --brand-2: #7fd1b9;
  --brand-3: #f5cf74;
  --danger: #b95151;
  --ok: #3d8f6f;
  --shadow: 0 18px 55px rgba(0,0,0,.26);
  --radius: 28px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(245, 207, 116, .25), transparent 30rem),
    radial-gradient(circle at bottom right, rgba(127, 209, 185, .22), transparent 28rem),
    linear-gradient(135deg, #17120f 0%, #2b211a 48%, #0f1715 100%);
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .35;
  pointer-events: none;
  z-index: -1;
}

.orb-one { background: var(--brand); top: 4rem; right: -7rem; }
.orb-two { background: var(--brand-2); bottom: -7rem; left: -5rem; }

.hero {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  color: #fff7ea;
}

.hero__badge {
  width: 82px;
  height: 82px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  font-size: 48px;
  background: rgba(255,255,255,.12);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.18);
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2.1rem, 5vw, 4.1rem); line-height: .98; letter-spacing: -0.04em; }
h2 { margin-bottom: 12px; font-size: clamp(1.35rem, 2.5vw, 2rem); letter-spacing: -0.02em; }
h3 { margin-bottom: 8px; }
.lead { max-width: 760px; font-size: 1.1rem; color: #f7e4c9; }
.eyebrow { margin-bottom: 8px; text-transform: uppercase; letter-spacing: .12em; font-size: .76rem; font-weight: 800; color: var(--brand-2); }

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.sidebar {
  position: sticky;
  top: 14px;
}

.raccoon-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(216,137,58,.16), rgba(127,209,185,.16));
  margin-bottom: 22px;
}

.raccoon-face {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  font-size: 46px;
  border-radius: 24px;
  background: #fff7e8;
}

.input-label {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
}

.input {
  width: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  border: 2px solid rgba(36,25,20,.12);
  font-size: 1rem;
  outline: none;
  background: #fff;
}

.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(216,137,58,.15);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0;
}

.mode-card {
  border: 2px solid rgba(36,25,20,.1);
  background: #fffaf2;
  border-radius: 22px;
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, border .16s ease, background .16s ease;
}

.mode-card:hover { transform: translateY(-2px); }
.mode-card.active { border-color: var(--brand); background: #fff0d6; }
.mode-card span { display: block; font-size: 1.9rem; margin-bottom: 8px; }
.mode-card strong, .mode-card small { display: block; }
.mode-card small { color: var(--muted); margin-top: 4px; line-height: 1.25; }

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

.actions.between { justify-content: space-between; }
.actions.center { justify-content: center; }

button {
  font: inherit;
}

.primary, .secondary, .tiny {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 850;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.primary {
  padding: 14px 22px;
  background: linear-gradient(135deg, var(--brand), var(--brand-3));
  color: #261409;
  box-shadow: 0 10px 20px rgba(216,137,58,.25);
}

.secondary {
  padding: 14px 20px;
  background: #efe6da;
  color: var(--text);
}

.tiny {
  padding: 9px 12px;
  background: #efe6da;
  color: var(--text);
  font-size: .88rem;
}

.primary:hover, .secondary:hover, .tiny:hover { transform: translateY(-1px); }
.primary:disabled, .secondary:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.teacher-note {
  margin-top: 18px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(127,209,185,.18);
  color: #24423a;
}

.stat-card {
  padding: 18px;
  border-radius: 24px;
  background: var(--panel-dark);
  color: #fff3e2;
  margin-bottom: 18px;
}

.stat-label, .score-row span {
  display: block;
  font-size: .78rem;
  color: #cfbda9;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
  margin-bottom: 5px;
}

.stat-card strong { font-size: 1.15rem; }

.progress-wrap { margin-bottom: 18px; }
.progress-top { display: flex; justify-content: space-between; font-weight: 800; color: var(--muted); margin-bottom: 8px; }
.progress-bar { height: 12px; border-radius: 999px; background: #e7d8c9; overflow: hidden; }
.progress-bar div { width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .25s ease; }

.score-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.score-row div {
  padding: 12px;
  border-radius: 18px;
  background: #fffaf2;
}
.score-row strong { font-size: 1.45rem; }

.leaderboard {
  padding-left: 26px;
  margin: 0 0 12px;
}
.leaderboard li {
  margin: 8px 0;
  padding: 10px 10px 10px 4px;
  border-bottom: 1px solid rgba(36,25,20,.08);
}
.leaderboard small { display: block; color: var(--muted); margin-top: 2px; }

.hidden { display: none !important; }

.question-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.difficulty {
  padding: 9px 12px;
  border-radius: 999px;
  background: #291f19;
  color: #fff1de;
  font-weight: 900;
  white-space: nowrap;
}

.hint, .feedback {
  padding: 15px 16px;
  border-radius: 18px;
  margin: 14px 0;
  line-height: 1.45;
}
.hint { background: #fff4d6; border: 1px solid #f1d58a; }
.feedback.ok { background: rgba(61,143,111,.14); border: 1px solid rgba(61,143,111,.35); }
.feedback.bad { background: rgba(185,81,81,.12); border: 1px solid rgba(185,81,81,.35); }

.answer-area {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 14px 15px;
  border: 2px solid rgba(36,25,20,.1);
  border-radius: 18px;
  background: #fffaf4;
  cursor: pointer;
}

.option:hover { border-color: rgba(216,137,58,.5); }
.option input { transform: scale(1.15); }

.truefalse-grid, .order-list, .match-grid {
  display: grid;
  gap: 10px;
}

.tf-button {
  padding: 16px;
  border: 2px solid rgba(36,25,20,.1);
  background: #fffaf4;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 850;
}
.tf-button.active { border-color: var(--brand); background: #fff0d6; }

.order-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: #fffaf4;
  border: 1px solid rgba(36,25,20,.1);
}
.order-item button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: #efe6da;
  cursor: pointer;
  font-weight: 900;
}

.match-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1.4fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: #fffaf4;
}

.match-row strong { color: var(--text); }
select, .fill-input {
  width: 100%;
  border: 2px solid rgba(36,25,20,.12);
  border-radius: 14px;
  padding: 12px;
  font: inherit;
  background: #fff;
}

.learn-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.learn-card {
  padding: 18px;
  border-radius: 22px;
  background: #fffaf2;
  border: 1px solid rgba(36,25,20,.08);
}
.learn-card .topic-pill {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 900;
  background: rgba(127,209,185,.22);
  color: #24423a;
}

.result { text-align: center; }
.result-hero { font-size: 4.4rem; margin-bottom: 10px; }
.badge-box {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: #fff0d6;
  font-weight: 900;
}

.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 28px;
  color: #ead9c8;
  text-align: center;
  font-size: .95rem;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .mode-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .panel { padding: 18px; border-radius: 22px; }
  .question-head, .match-row { grid-template-columns: 1fr; }
  .actions.between { justify-content: stretch; }
  .actions.between button, .actions .primary, .actions .secondary { flex: 1; }
}
