/* FactsDrill (Fact Blaster) — pairs with teddy/math/math.css for buttons, mute, stars. 390px-first, big tap targets. */
.fd-app { max-width: 560px; padding-bottom: calc(40px + var(--safe-b)); }
.fd-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.fd-top .back-link { margin: 0; }
.fd-best, .fd-streak { margin-left: auto; font-weight: 900; color: #fdba74; }
.fd-streak { font-size: 20px; padding: 6px 12px; border-radius: 999px; background: rgba(251, 146, 60, 0.12); border: 1px solid rgba(251, 146, 60, 0.35); transition: transform .2s; }
.fd-streak.hot { color: #fff7ed; background: linear-gradient(135deg, #f97316, #ef4444); box-shadow: 0 0 22px rgba(249, 115, 22, .6); animation: pulse-go 1.4s ease-in-out infinite; }

.fd-hero { text-align: center; margin: 4px 0 14px; }
.fd-hero h1 {
  margin: 0; font-size: clamp(36px, 10vw, 52px); line-height: 1.05;
  background: linear-gradient(90deg, #fde047, #fb923c, #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(251, 146, 60, 0.35));
}
.fd-tables { display: flex; gap: 10px; justify-content: center; margin: 12px 0 0; flex-wrap: wrap; }
.fd-tables span {
  font-weight: 900; font-size: 26px; padding: 6px 16px; border-radius: 18px; color: #0b1638; background: var(--c);
  box-shadow: 0 0 20px color-mix(in srgb, var(--c) 55%, transparent); animation: node-in .5s cubic-bezier(.3,1.4,.5,1) both; animation-delay: calc(var(--i) * 90ms);
}

.fd-meter { margin: 0 0 14px; text-align: center; }
.fd-meter-bar { height: 14px; border-radius: 999px; background: rgba(20, 31, 69, .9); border: 1px solid var(--line); overflow: hidden; }
.fd-meter-bar span { display: block; height: 100%; background: linear-gradient(90deg, #34d399, #22d3ee); border-radius: 999px; transition: width .6s; }
.fd-meter p { margin: 6px 0 0; color: var(--ink-soft); font-size: 14px; font-weight: 700; }

.fd-modes { display: grid; gap: 12px; margin-bottom: 18px; }
.fd-mode {
  position: relative; display: flex; align-items: center; gap: 14px; text-align: left; min-height: 84px; padding: 14px 18px;
  border-radius: 24px; background: rgba(20, 31, 69, .88); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.fd-mode:active { transform: scale(.98); }
.fd-mode b { display: block; font-size: 22px; }
.fd-mode small { display: block; color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.fd-mode-icon { font-size: 40px; flex: none; }
.fd-mode.go { background: linear-gradient(135deg, rgba(52, 211, 153, .35), rgba(34, 211, 238, .25)), rgba(20, 31, 69, .9); border-color: rgba(52, 211, 153, .7); box-shadow: 0 0 26px rgba(52, 211, 153, .3); }
.fd-mode.fix { border-color: rgba(251, 146, 60, .6); }
.fd-mode.fix.empty { opacity: .55; }
.fd-badge { margin-left: auto; min-width: 36px; height: 36px; padding: 0 10px; border-radius: 999px; display: grid; place-items: center; font-weight: 900; color: #fff; background: #f97316; animation: pulse-go 1.6s ease-in-out infinite; }

.fd-map-wrap h2 { font-size: 18px; margin: 0 0 8px; }
.fd-map-wrap h2 small { color: var(--ink-soft); font-size: 13px; font-weight: 600; margin-left: 6px; }
.fd-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 4px; }
.fd-gh { display: grid; place-items: center; font-weight: 900; color: var(--ink-soft); font-size: 14px; min-height: 26px; }
.fd-gh.row { font-size: 18px; }
.fd-cell { min-height: 38px; border-radius: 10px; font-weight: 800; font-size: 14px; border: 1px solid var(--line); background: rgba(20, 31, 69, .9); color: var(--ink-soft); }
.fd-cell.l1 { background: rgba(251, 146, 60, .28); border-color: rgba(251, 146, 60, .7); color: #fed7aa; }
.fd-cell.l2 { background: rgba(52, 211, 153, .25); border-color: rgba(52, 211, 153, .6); color: #d1fae5; }
.fd-cell.l3 { background: rgba(253, 224, 71, .3); border-color: rgba(253, 224, 71, .8); color: #fef9c3; box-shadow: 0 0 10px rgba(253, 224, 71, .35); }
.fd-legend { display: flex; gap: 10px; justify-content: center; font-size: 12px; color: var(--ink-soft); margin: 8px 0 0; flex-wrap: wrap; }
.fd-legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 4px; vertical-align: -2px; border: 1px solid var(--line); background: rgba(20, 31, 69, .9); }
.fd-legend .l1::before { background: rgba(251, 146, 60, .5); }
.fd-legend .l2::before { background: rgba(52, 211, 153, .5); }
.fd-legend .l3::before { background: rgba(253, 224, 71, .6); }

.fd-settings { margin: 20px 0 0; padding: 12px 14px; border-radius: 18px; background: rgba(20, 31, 69, .6); border: 1px solid var(--line); font-size: 14px; }
.fd-settings summary { cursor: pointer; font-weight: 800; color: var(--ink-soft); }
.fd-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.fd-chip { min-width: 52px; min-height: 44px; border-radius: 14px; font-weight: 800; border: 1px solid var(--line); background: rgba(20, 31, 69, .9); }
.fd-chip.on { background: var(--teddy); color: #062016; border-color: transparent; }
.fd-hint { color: var(--ink-soft); }
.fd-hint code { color: var(--ink); }

/* Round */
.fd-track { position: relative; height: 32px; margin: 0 4px 2px; }
.fd-track::before { content: ""; position: absolute; left: 0; right: 30px; top: 15px; height: 4px; border-radius: 4px; background: repeating-linear-gradient(90deg, rgba(165, 243, 252, .35) 0 8px, transparent 8px 14px); }
.fd-track-fill { position: absolute; left: 0; top: 14px; height: 6px; border-radius: 6px; background: linear-gradient(90deg, #34d399, #fde047); transition: width .5s; box-shadow: 0 0 12px rgba(52, 211, 153, .6); }
.fd-rocket { position: absolute; top: 0; left: 0; font-size: 26px; transform: rotate(45deg); transition: left .5s cubic-bezier(.3, 1.3, .5, 1); }
.fd-planet { position: absolute; right: 0; top: 0; font-size: 28px; }
.fd-count { text-align: center; margin: 0 0 6px; color: var(--ink-soft); font-weight: 800; font-size: 15px; min-height: 1.4em; }

.fd-card {
  position: relative; border-radius: 28px; padding: 12px 14px 14px; text-align: center;
  background: rgba(15, 24, 58, .9); border: 2px solid rgba(165, 243, 252, .2); box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s;
}
.fd-card.enter { animation: card-in .35s cubic-bezier(.3, 1.3, .5, 1); }
.fd-card.good { border-color: #34d399; box-shadow: 0 0 30px rgba(52, 211, 153, .45); }
.fd-card.bad { border-color: #fb7185; box-shadow: 0 0 24px rgba(251, 113, 133, .35); }

.fd-vert { display: inline-grid; justify-items: end; font-weight: 900; font-size: clamp(46px, 13vw, 70px); line-height: 1; font-variant-numeric: tabular-nums; padding: 4px 18px 0; }
.fd-vert .fd-n2 i { font-style: normal; color: #67e8f9; margin-right: 14px; font-size: .8em; }
.fd-line { width: 100%; height: 6px; border-radius: 4px; background: var(--ink); margin: 6px 0 4px; }
.fd-ans { min-width: 1.6em; text-align: right; color: #fde047; text-shadow: 0 0 18px rgba(253, 224, 71, .5); }
.fd-ans.empty { color: rgba(165, 243, 252, .35); text-shadow: none; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .4; } }
.fd-vert.right .fd-ans { color: #34d399; animation: eq-pop .45s cubic-bezier(.3, 1.8, .5, 1); }
.fd-vert.wrong .fd-ans { color: #fb7185; text-decoration: line-through; animation: shake .4s ease; }

.fd-feedback { min-height: 30px; }
.fd-yay, .fd-hint-line { line-height: 1.2; }
.fd-yay { margin: 2px 0; font-size: 22px; font-weight: 900; color: #6ee7b7; animation: eq-pop .4s ease; }
.fd-yay.big { font-size: 28px; color: #fdba74; }
.fd-hint-line { margin: 6px 0; font-size: 18px; color: var(--ink-soft); }
.fd-hint-line b { color: var(--ink); }
.fd-oops { margin: 6px 0 10px; font-size: 19px; }
.fd-oops b { color: #fde047; }
.fd-miss-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }

.fd-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 8px; }
.fd-key {
  min-height: 66px; border-radius: 22px; font-size: 34px; font-weight: 900;
  background: linear-gradient(180deg, #22305f, #141f45); border: 2px solid rgba(165, 243, 252, .28); box-shadow: 0 5px 0 rgba(0, 0, 0, .35);
}
.fd-key.tap { animation: key-tap .18s ease; }
@keyframes key-tap { 50% { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); } }
.fd-key.del { color: #fda4af; font-size: 28px; }
.fd-key.ok { background: linear-gradient(135deg, #34d399, #22d3ee); color: #062016; border-color: transparent; }

/* Pictures: groups-of + array */
.fd-pic-head { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.fd-pic-head b { color: #fde047; font-size: 1.2em; }
.fd-pic { display: grid; place-items: center; }
.fd-groups { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.fd-pod {
  position: relative; padding: 8px 8px 20px; border-radius: 50%/42%; border: 3px dashed color-mix(in srgb, var(--c) 70%, transparent);
  background: color-mix(in srgb, var(--c) 10%, transparent); opacity: .12; transform: scale(.8); transition: opacity .3s, transform .35s cubic-bezier(.3, 1.6, .5, 1);
  min-width: 52px; min-height: 52px; display: grid; place-items: center;
}
.fd-pod.on { opacity: 1; transform: none; border-style: solid; }
.fd-dots { display: grid; grid-template-columns: repeat(var(--n), 12px); gap: 4px; }
.fd-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
.fd-empty { font-size: 11px; color: var(--ink-soft); }
.fd-array { display: grid; gap: 4px; }
.fd-row { display: flex; align-items: center; gap: 8px; opacity: .12; transform: translateX(-12px); transition: opacity .3s, transform .35s; }
.fd-row.on { opacity: 1; transform: none; }
.fd-stars { display: grid; grid-template-columns: repeat(var(--cols), 22px); }
.fd-stars i { font-style: normal; font-size: 20px; line-height: 22px; color: var(--c); text-shadow: 0 0 8px var(--c); }
.fd-run { font-weight: 900; color: #fde047; min-width: 26px; text-align: left; font-size: 15px; }
.fd-pod .fd-run { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; }
.fd-skip { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; min-height: 34px; align-items: center; }
.fd-skip span { font-weight: 900; font-size: 18px; padding: 2px 10px; border-radius: 12px; background: rgba(20, 31, 69, .9); border: 1px solid var(--line); }
.fd-skip span.now { background: #fde047; color: #0b1638; animation: eq-pop .3s ease; }
.fd-skip .eq { flex-basis: 100%; background: none; border: 0; font-size: 26px; animation: eq-pop .5s cubic-bezier(.3, 1.8, .5, 1); }
.fd-skip .eq b { color: #fde047; }
.fd-zero { font-size: 20px; font-weight: 800; padding: 18px; color: #f0abfc; }
.fd-zero b { font-size: 1.3em; }

.fd-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(4, 8, 24, .72); display: grid; place-items: center; padding: 16px; animation: toast-in .2s ease; }
.fd-sheet { width: min(520px, 100%); max-height: 90dvh; overflow: auto; border-radius: 26px; padding: 18px 14px; background: #121c44; border: 1px solid rgba(165, 243, 252, .3); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); text-align: center; }
.fd-sheet-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

.fd-done { padding: 8px 0; }
.fd-done-rocket { font-size: 54px; animation: orb-float 2s ease-in-out infinite; }
.fd-done h2 { margin: 4px 0; font-size: 30px; color: var(--teddy-ink); }
.fd-sum { margin: 6px 0; font-size: 17px; }
.fd-sum b { color: #fde047; }
.fd-miss-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.fd-miss-chips button { min-height: 44px; padding: 6px 14px; border-radius: 14px; font-weight: 900; font-size: 18px; background: rgba(251, 146, 60, .2); border: 1px solid rgba(251, 146, 60, .6); }
.fd-done-actions { display: grid; gap: 10px; justify-items: center; margin-top: 14px; }

@media (min-width: 700px) {
  .fd-key { min-height: 84px; font-size: 38px; }
  .fd-stars { grid-template-columns: repeat(var(--cols), 28px); }
  .fd-stars i { font-size: 26px; line-height: 28px; }
  .fd-dots { grid-template-columns: repeat(var(--n), 15px); }
  .fd-dots i { width: 15px; height: 15px; }
}
@media (max-width: 360px) {
  .fd-key { min-height: 62px; font-size: 30px; }
  .fd-stars { grid-template-columns: repeat(var(--cols), 18px); }
  .fd-stars i { font-size: 16px; line-height: 18px; }
}
@media (prefers-reduced-motion: reduce) { .fd-card.enter, .fd-streak.hot, .fd-badge, .fd-done-rocket { animation: none; } }
