/* ============================================================
   GraspMaths 10-Minute Flashcard Test — v3.0
   Design: Exam-paper precision. Ink-black on chalk-white.
   DM Serif Display headlines + DM Sans body.
   No card flip. Instant reveal. Timer pressure.
============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300..900;1,9..40,300..900&display=swap');

/* ── base reset ─────────────────────────────────────── */
body.gmft-active{ overflow:hidden !important; height:100% !important; }
body.gmft-active #wpadminbar,
body.gmft-active header, body.gmft-active nav, body.gmft-active footer,
body.gmft-active .site-header, body.gmft-active .site-footer,
body.gmft-active .wp-site-blocks > header,
body.gmft-active .wp-site-blocks > footer,
body.gmft-active .elementor-location-header,
body.gmft-active .elementor-location-footer { display:none !important; }
body.gmft-active .site, body.gmft-active #page,
body.gmft-active #content { margin:0 !important; padding:0 !important; }

/* ── design tokens ──────────────────────────────────── */
.gmft-wrap {
  --ink:     #0a0e17;
  --ink2:    #2c3547;
  --muted:   #6b7585;
  --rule:    #dee3ec;
  --paper:   #f9fafb;
  --white:   #ffffff;
  --blue:    #1d4ed8;
  --blue-lt: #dbeafe;
  --green:   #16a34a;
  --green-lt:#dcfce7;
  --red:     #dc2626;
  --red-lt:  #fee2e2;
  --amber:   #d97706;
  --r:       16px;  /* border radius unit */

  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  color: var(--ink);

  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  height: 100vh;
  background: var(--white);
  z-index: 999999;
  box-sizing: border-box;
  overflow: hidden;
}

/* ── START SCREEN ────────────────────────────────────── */
.gmft-start {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  z-index: 10;
  padding: clamp(20px, 5vw, 60px);
}

.gmft-start-inner {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.gmft-brand {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.0rem, 2vw, 1.15rem);
  color: var(--blue);
  letter-spacing: .04em;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.gmft-brand::before, .gmft-brand::after {
  content:'';
  flex:1;
  max-width:60px;
  height:1px;
  background: var(--rule);
}

.gmft-start-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.4rem, 7vw, 4rem);
  font-weight: 400;
  line-height: 1.0;
  color: var(--ink);
  margin: 0 0 14px;
  letter-spacing: -.02em;
}

.gmft-start-desc {
  font-size: clamp(.95rem, 2.2vw, 1.1rem);
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 22px;
  letter-spacing: .01em;
}

.gmft-start-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 32px;
}

.gmft-badge {
  display: inline-block;
  background: var(--paper);
  border: 1.5px solid var(--rule);
  color: var(--ink2);
  font-size: .8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.gmft-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 16px 36px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .02em;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  box-shadow: 0 8px 24px rgba(10,14,23,.22);
}
.gmft-start-btn:hover {
  background: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(29,78,216,.28);
}
.gmft-start-btn:active { transform: translateY(0); }

.gmft-retry-btn { margin-top: 8px; }

.gmft-start-note {
  margin-top: 18px;
  font-size: .82rem;
  color: var(--muted);
  font-weight: 500;
}

/* ── TEST STAGE ─────────────────────────────────────── */
.gmft-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 2.5vw, 24px);
  box-sizing: border-box;
  gap: clamp(12px, 2vh, 20px);
}
.gmft-stage[hidden] { display: none; }

/* top bar */
.gmft-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.gmft-progress-wrap {
  flex: 1;
  height: 6px;
  background: var(--rule);
  border-radius: 999px;
  overflow: hidden;
}

.gmft-rail {
  height: 100%;
  display: flex;
  gap: 3px;
}

.gmft-dot {
  flex: 1;
  height: 100%;
  border-radius: 3px;
  background: var(--rule);
  transition: background .3s ease;
}
.gmft-dot.answered-correct  { background: var(--green); }
.gmft-dot.answered-wrong    { background: var(--red); }
.gmft-dot.current           { background: var(--blue); opacity: .5; }

.gmft-timer {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  color: var(--ink);
  letter-spacing: .04em;
  min-width: 5ch;
  text-align: right;
  transition: color .3s ease;
}
.gmft-timer.urgent  { color: var(--red); }
.gmft-timer.warning { color: var(--amber); }

/* question area */
.gmft-q-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 0 clamp(8px, 3vw, 40px);
}

.gmft-q-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gmft-qnum {
  font-size: .85rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.gmft-skill-tag {
  font-size: .78rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-lt);
  border-radius: 999px;
  padding: 3px 10px;
  letter-spacing: .02em;
  text-transform: capitalize;
  display: none;
}
.gmft-skill-tag:not(:empty) { display: inline-block; }

.gmft-question {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.4rem, 8vw, 5.5rem);
  font-weight: 400;
  line-height: 1.08;
  color: var(--ink);
  letter-spacing: -.01em;
  max-width: 100%;
  word-break: break-word;
}

/* ── 2×2 answer grid ──────────────────────────────── */
.gmft-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(10px, 2vw, 16px);
  width: min(800px, 100%);
  margin: 0 auto;
  flex-shrink: 0;
}

.gmft-choice {
  border: 2px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--r);
  padding: clamp(14px, 2.8vh, 26px) clamp(14px, 2.4vw, 28px);
  font-family: 'DM Sans', sans-serif;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  font-size: clamp(1.1rem, 2.8vw, 1.9rem);
  line-height: 1.15;
  transition: border-color .12s ease, background .12s ease, transform .12s ease, box-shadow .12s ease;
  position: relative;
  overflow: hidden;
  user-select: none;
}
.gmft-choice::before {
  content: attr(data-letter);
  position: absolute;
  top: 8px; left: 12px;
  font-size: .72rem;
  font-weight: 900;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .6;
}
.gmft-choice:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(29,78,216,.12);
}
.gmft-choice:active:not(:disabled) { transform: translateY(0); }

.gmft-choice.is-correct {
  border-color: var(--green);
  background: var(--green-lt);
  color: var(--green);
}
.gmft-choice.is-wrong {
  border-color: var(--red);
  background: var(--red-lt);
  color: var(--red);
}
.gmft-choice.is-picked.is-correct,
.gmft-choice.is-picked.is-wrong {
  box-shadow: none;
}
.gmft-choice:disabled {
  cursor: default;
  transform: none !important;
}
/* Dim unchosen answers after pick */
.gmft-choice.dimmed { opacity: .35; }

/* ── feedback strip ─────────────────────────────────── */
.gmft-feedback {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  font-size: clamp(.9rem, 1.8vw, 1.05rem);
  font-weight: 700;
  border-radius: var(--r);
  padding: 10px 18px;
  transition: opacity .2s ease;
}
.gmft-feedback[hidden] { display: none; }
.gmft-feedback.correct {
  background: var(--green-lt);
  color: var(--green);
  border: 1.5px solid rgba(22,163,74,.2);
}
.gmft-feedback.wrong {
  background: var(--red-lt);
  color: var(--red);
  border: 1.5px solid rgba(220,38,38,.2);
}

/* ── RESULTS SCREEN ─────────────────────────────────── */
.gmft-results {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  z-index: 10;
  padding: clamp(20px, 5vw, 60px);
  overflow-y: auto;
}
.gmft-results[hidden] { display: none; }

.gmft-results-inner {
  max-width: 460px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* Score ring */
.gmft-ring-wrap {
  position: relative;
  width: clamp(120px, 28vw, 160px);
  height: clamp(120px, 28vw, 160px);
  margin: 0 auto;
}
.gmft-ring-svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}
.gmft-ring-bg {
  fill: none;
  stroke: var(--rule);
  stroke-width: 8;
}
.gmft-ring-arc {
  fill: none;
  stroke: var(--blue);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 1.0s cubic-bezier(.4,0,.2,1), stroke .5s ease;
}
.gmft-ring-arc.high   { stroke: var(--green); }
.gmft-ring-arc.mid    { stroke: var(--blue); }
.gmft-ring-arc.low    { stroke: var(--amber); }
.gmft-ring-arc.poor   { stroke: var(--red); }

.gmft-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gmft-ring-pct {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 400;
  color: var(--ink);
  line-height: 1;
}
.gmft-ring-word {
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.gmft-result-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.gmft-stat-pill {
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--ink2);
}

.gmft-level-line {
  font-size: clamp(.9rem, 2vw, 1.0rem);
  font-weight: 700;
  color: var(--muted);
  min-height: 1.4em;
}

/* ── toast ──────────────────────────────────────────── */
.gmft-toast {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  border-radius: 999px;
  padding: 12px 22px;
  font-size: .92rem;
  font-weight: 700;
  box-shadow: 0 14px 36px rgba(0,0,0,.25);
  z-index: 1000010;
  max-width: min(94vw, 600px);
  text-align: center;
  animation: gmft-toast-in .2s ease;
}
.gmft-toast[hidden] { display: none; }
@keyframes gmft-toast-in {
  from { opacity:0; transform:translateX(-50%) translateY(12px); }
  to   { opacity:1; transform:translateX(-50%) translateY(0); }
}

/* ── fraction rendering ─────────────────────────────── */
.gmft-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  font-size: .88em;
  line-height: 1.1;
  margin: 0 .15em;
}
.gmft-frac .top {
  padding: 0 .3em;
  border-bottom: 2px solid currentColor;
  font-weight: 800;
}
.gmft-frac .bar { display: none; }
.gmft-frac .bottom { padding: 0 .3em; font-weight: 800; }

/* ── blank placeholder ──────────────────────────────── */
.gmft-blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  min-width: 1.4em;
  height: 1.0em;
  padding: 0 .3em;
  margin: 0 .1em;
  border: 2px solid var(--blue);
  border-radius: 5px;
  color: var(--blue);
  background: var(--blue-lt);
  font-weight: 900;
  font-size: .88em;
}

/* ── loading spinner ────────────────────────────────── */
.gmft-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: var(--muted);
  font-weight: 700;
  font-size: 1rem;
}
.gmft-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--rule);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: gmft-spin .7s linear infinite;
}
@keyframes gmft-spin { to { transform: rotate(360deg); } }

/* ── entry animations ────────────────────────────────── */
@keyframes gmft-slide-up {
  from { opacity:0; transform:translateY(20px); }
  to   { opacity:1; transform:translateY(0); }
}

.gmft-q-area.entering  { animation: gmft-slide-up .22s ease; }
.gmft-choices.entering { animation: gmft-slide-up .26s ease .04s both; }

/* ── responsive ─────────────────────────────────────── */
@media (max-width: 600px) {
  .gmft-question { font-size: clamp(2.0rem, 10vw, 3.4rem); }
  .gmft-choice   { font-size: clamp(1.0rem, 5vw, 1.55rem); padding: 14px 10px; }
  .gmft-choice::before { display: none; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .gmft-stage { gap: 8px; padding: 8px clamp(12px, 4vw, 24px); }
  .gmft-question { font-size: clamp(1.8rem, 5vw, 3rem); }
  .gmft-choice   { padding: 10px 14px; font-size: clamp(.95rem, 2.2vw, 1.4rem); }
}
