/* Cùng bộ màu, font, bo góc với slider_template / verify_template */
:root {
  --bg-page: #f6f8fa;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #eff6ff;
  --green: #10b981;
  --green-light: #ecfdf5;
  --red: #ef4444;
  --red-light: #fef2f2;
  --border: #f1f5f9;
}

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

[hidden] { display: none !important; }

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.card {
  width: 100%;
  max-width: 390px;
  padding: 36px 24px 28px;
  border-radius: 24px;
  background: var(--card-bg);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.03),
    0 12px 28px -4px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  user-select: none;
}

.card.shake { animation: shake 0.35s; }

@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.badge-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.06);
}

.badge-icon svg { width: 30px; height: 30px; }

.card-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 22px;
}

/* ---------- Phép tính ---------- */
.problem {
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 22px 48px;
  border-radius: 14px;
  background: #f8fafc;
  box-shadow: 0 0 0 1px var(--border);
}

.problem span {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.problem .blank { color: var(--blue); }

.refresh {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
  transition: color 0.2s;
}

.refresh:hover { color: var(--blue); }
.refresh svg { width: 16px; height: 16px; }

/* ---------- Đáp án ---------- */
.options {
  width: 100%;
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.option {
  padding: 15px 0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: var(--text-main);
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.option:hover { border-color: var(--blue); background: var(--blue-light); }
.option:active { transform: scale(0.97); }
.option:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.option.ok { border-color: #a7f3d0; background: var(--green-light); color: #047857; }
.option.err { border-color: #fecaca; background: var(--red-light); color: #dc2626; }
.options.locked .option { pointer-events: none; }

.caption {
  margin-top: 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.caption.ok { color: #047857; }
.caption.err { color: #dc2626; }

.btn-submit {
  width: 100%;
  margin-top: 18px;
  padding: 15px 24px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  box-shadow: 0 10px 20px -3px rgba(37, 99, 235, 0.4);
}

@media (max-width: 380px) {
  .card { padding: 30px 18px 24px; }
  .card-title { font-size: 18px; }
  .problem span { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .card.shake { animation: none; }
}
