* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(160deg, #eef2f7 0%, #e2e8f0 100%);
  min-height: 100vh;
  color: #0f172a;
  display: flex;
  justify-content: center;
  padding: 28px 16px 60px;
}

.app { width: 100%; max-width: 720px; }

/* ---------- Header ---------- */
.app-header { margin-bottom: 18px; }
.brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4f46e5;
  margin-bottom: 10px;
}
.progress-bar {
  height: 6px;
  background: #dbe2ec;
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 13px;
  color: #64748b;
}
.score-chip b { color: #0f172a; }

/* ---------- Cards ---------- */
.card {
  background: #ffffff;
  border-radius: 20px;
  padding: 30px 32px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

/* ---------- Intro ---------- */
.intro { text-align: center; }
.intro-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 99px;
  padding: 5px 14px;
  margin-bottom: 16px;
}
.intro h1 { font-size: 26px; font-weight: 800; }
.intro-sub { color: #64748b; font-size: 14px; margin: 6px 0 24px; }
.intro-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
  text-align: left;
}
.intro-rule {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
}
.intro-rule-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.intro-rule-body p { font-size: 13px; color: #475569; line-height: 1.5; margin-bottom: 10px; }
.intro-ex {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
}
.rule-mark { font-size: 13px; font-weight: 700; }

/* ---------- Question ---------- */
.q-type {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4f46e5;
  background: #eef2ff;
  border-radius: 99px;
  padding: 4px 12px;
  margin-bottom: 12px;
}
.q-title { font-size: 20px; font-weight: 800; line-height: 1.3; }
.q-sub { color: #64748b; font-size: 14px; margin: 6px 0 22px; }

/* ---------- Glyphs ---------- */
.glyph {
  display: inline-block;
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  user-select: none;
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Letter matching boxes ---------- */
.boxes {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-bottom: 24px;
}
.letter-box {
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  width: 110px;
  padding: 12px 0 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: #fafbfc;
}
.box-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

/* ---------- Options ---------- */
.options {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 8px;
}
.ans-btn {
  width: 64px;
  height: 52px;
  font-size: 20px;
  font-weight: 800;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: #0f172a;
}
.ans-btn:hover { background: #f1f5f9; border-color: #94a3b8; }

.ans-btn.is-correct {
  border-color: #16a34a;
  background: #f0fdf4;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}
.ans-btn.is-wrong {
  border-color: #dc2626;
  background: #fef2f2;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
.ans-btn:disabled { cursor: default; }

/* ---------- Teaching ---------- */
.teaching {
  margin-top: 24px;
  border-top: 1px dashed #cbd5e1;
  padding-top: 20px;
}
.verdict {
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.verdict.ok { background: #f0fdf4; border: 1px solid #bbf7d0; }
.verdict.bad { background: #fef2f2; border: 1px solid #fecaca; }
.banner-detail { margin-top: 4px; color: #475569; }

.teach-rows { display: flex; flex-direction: column; gap: 10px; }
.teach-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
}
.teach-label {
  flex-shrink: 0;
  width: 64px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
}
.teach-stage {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mini-box {
  width: 52px;
  height: 52px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mini-box .glyph { font-size: 28px; }
.mini-arrow { color: #94a3b8; font-size: 16px; font-weight: 700; }
.teach-verdict { font-size: 13px; line-height: 1.5; color: #334155; }
.ok-text { color: #16a34a; }
.bad-text { color: #dc2626; }

.rule-card {
  margin-top: 16px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 14px 16px;
}
.rule-title { font-size: 14px; font-weight: 800; margin-bottom: 6px; }
.rule-card p { font-size: 13px; line-height: 1.6; color: #3730a3; }
.rule-examples {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}
.rule-ex {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 6px 12px;
}
.rule-ex .glyph { font-size: 26px; }

.replay-btn { margin-top: 14px; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-primary {
  background: #4f46e5;
  color: #fff;
}
.btn-primary:hover { background: #4338ca; }
.btn-ghost {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.btn-ghost:hover { background: #e2e8f0; }
.btn-lg { width: 100%; padding: 14px; font-size: 15px; }
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ---------- Results ---------- */
.results { text-align: center; }
.results h2 { font-size: 22px; font-weight: 800; margin-bottom: 14px; }
.final-score { font-size: 44px; font-weight: 800; color: #4f46e5; }
.final-pct { font-size: 18px; font-weight: 700; color: #64748b; margin-top: 2px; }
.final-msg { font-size: 14px; color: #475569; margin: 14px 0 20px; line-height: 1.5; }
.review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  text-align: left;
}
.review-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
}
.review-q { flex: 1; color: #334155; }
.review-btn { padding: 6px 14px; font-size: 13px; }

/* ---------- Ads ---------- */
.ad-slot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed #cbd5e1;
  min-height: 90px;
}
.ad-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 8px;
  text-align: center;
}
body.ads-off .ad-slot { display: none; }

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  align-items: center;
  margin-top: 22px;
  font-size: 12px;
  color: #94a3b8;
}
.site-footer a { color: #64748b; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- Privacy page ---------- */
.privacy-body { display: block; }
.privacy-body .card { max-width: 720px; margin: 0 auto; text-align: left; }
.privacy-body h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.privacy-body .updated { color: #94a3b8; font-size: 13px; margin-bottom: 20px; }
.privacy-body h2 { font-size: 16px; font-weight: 700; margin: 20px 0 8px; }
.privacy-body p, .privacy-body li { font-size: 14px; line-height: 1.7; color: #334155; }
.privacy-body ul { padding-left: 20px; margin: 8px 0; }
.privacy-body a { color: #4f46e5; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .card { padding: 22px 18px; }
  .intro-rules { grid-template-columns: 1fr; }
  .teach-row { flex-wrap: wrap; }
  .teach-verdict { width: 100%; }
  .letter-box { width: 96px; }
}
