/* Fact Trainer. Builds on engine.css tokens and buttons. */
#app { gap: 14px; }
h2 { font-family: var(--display); font-weight: 600; font-size: 22px; margin: 0; }
.muted { color: var(--muted); font-weight: 600; margin: 0; }
.center { text-align: center; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.panel { background: var(--paper); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 2px 20px rgba(0, 0, 0, .06); }
.intro { text-align: center; font-size: 17px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.intro p { margin: 0; }
.streak { background: #fff1e0; border: 2px solid var(--s3); border-radius: 999px; padding: 4px 12px; font-weight: 800; }
.go { width: 100%; padding: 14px; font-size: 18px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button.link { background: none; box-shadow: none; color: var(--muted); font-size: 13px; text-decoration: underline; padding: 4px; }
a.homebtn, button.homebtn { padding: 0; color: var(--ink); }

/* decks */
.decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.deck { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 22px; text-align: left; white-space: normal; box-shadow: 0 2px 20px rgba(0, 0, 0, .06); }
.deck:hover { box-shadow: 0 0 0 2px var(--ink); }
.deck-top { display: flex; align-items: center; gap: 10px; }
.demo { font-size: 30px; }
.dname { font-family: var(--display); font-weight: 600; font-size: 22px; }
.dstat { font-weight: 700; color: var(--muted); }
.bar, .sbar { height: 8px; background: var(--line); border-radius: 9px; overflow: hidden; }
.bar i, .sbar i { display: block; height: 100%; background: var(--s2); border-radius: 9px; }
.sbar { height: 10px; }
.sbar i { background: var(--s3); transition: width .2s linear; }

/* fact map: levels 0 (new) → 5 (power) */
.fmap { display: grid; gap: 3px; width: 100%; max-width: 520px; margin: 0 auto; }
.fmap.mini { gap: 3px; max-width: none; margin: 0; }
.fh { font-family: var(--display); font-weight: 600; font-size: 12px; color: var(--muted); display: grid; place-items: center; padding: 0 3px; }
.fh.corner { color: var(--ink); font-size: 15px; }
.fc { aspect-ratio: 1; border-radius: 5px; padding: 0; min-width: 0; font: 700 11px var(--display); display: grid; place-items: center; box-shadow: none; border: 0; }
.fmap.mini .fc { border-radius: 2px; }
.fc.l0 { background: #eceef2; }
.fc.l1 { background: #dfe9fb; }
.fc.l2 { background: #b9d2fb; }
.fc.l3 { background: #bfe8d2; }
.fc.l4 { background: #7fd3a8; }
.fc.l5 { background: var(--gold); color: #6b5300; }
button.fc.sel { box-shadow: 0 0 0 3px var(--ink); }
button.fc.flash { animation: pop .9s ease 2; }
@keyframes pop { 50% { transform: scale(1.3); box-shadow: 0 0 0 3px var(--s3); } }
.legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 14px; aspect-ratio: auto; display: inline-block; }

/* study panel + fact family */
.study { border: 2px solid var(--line); border-radius: 16px; padding: 14px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.study p { margin: 0; font-size: 16px; font-weight: 600; }
.sq { font-family: var(--display); font-weight: 600; font-size: 32px; }
.sfam { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ffam { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.ffam span { background: var(--clue-soft); border-radius: 999px; padding: 3px 10px; font: 600 14px var(--display); }
.ffam .lbl { background: none; font: 800 11px var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fvis { width: 100%; height: auto; }
.dm { fill: var(--s1); }
.dt.a { fill: var(--s1); } .dt.b { fill: var(--s3); } .dt.gone { fill: #d5d9e0; }

/* chips */
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-row.center { justify-content: center; }
.chip-btn { padding: 7px 12px; font-size: 14px; }
.chip-btn small { color: var(--muted); font-weight: 700; }
.chip-btn.on { background: var(--ink); color: #fff; box-shadow: none; }
.chip-btn.on small { color: #c8ccd6; }
.chip-up { background: #fff8d6; border: 2px solid var(--gold); border-radius: 999px; padding: 4px 12px; font: 600 15px var(--display); }

/* mission card */
.sdots { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.sdots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.sdots i.d { background: var(--s2); }
.sdots i.on { background: var(--ink); transform: scale(1.3); }
.fcard { background: var(--paper); border-radius: 22px; padding: 22px 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; border-top: 8px solid var(--line); box-shadow: 0 2px 20px rgba(0, 0, 0, .06); min-height: 210px; justify-content: center; }
.fcard.learn { border-color: var(--s1); }
.fcard.power { border-color: var(--gold); background: linear-gradient(#fff8d6, var(--paper) 60%); }
.fcard.ok { border-color: var(--s2); background: linear-gradient(var(--s2-soft), var(--paper) 60%); }
.fcard.clue { border-color: var(--clue); background: linear-gradient(var(--clue-soft), var(--paper) 50%); }
.fcard .tag { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.big { font-family: var(--display); font-weight: 600; font-size: 52px; line-height: 1.1; }
.slot { display: inline-block; min-width: 1.4em; padding: 0 8px; border-bottom: 4px solid var(--ink); }
.slot.empty { color: #b7bdc8; }
.fbk { font-family: var(--display); font-weight: 700; font-size: 24px; }
.power .fbk { color: #9a7400; } .ok .fbk { color: var(--s2); } .clue .fbk { color: var(--clue); }
.hint { margin: 0; font-size: 18px; font-weight: 600; max-width: 32ch; }

/* keypad */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 360px; width: 100%; margin: 0 auto; }
.keypad button { height: 62px; font: 600 28px var(--display); border-radius: 16px; }
.keypad .kbs { color: var(--muted); }
.keypad .kok { background: var(--s2); color: #fff; box-shadow: none; }

/* summary */
.trophy { font-size: 56px; line-height: 1; }
.stats { display: flex; justify-content: center; gap: 22px; }
.stats div { display: flex; flex-direction: column; }
.stats b { font: 700 30px var(--display); }
.stats span { font-size: 13px; font-weight: 700; color: var(--muted); }

@media (max-width: 560px) {
  .big { font-size: 42px; }
  .fh { font-size: 10px; padding: 0 1px; }
  .fc { font-size: 9px; border-radius: 4px; }
  .fmap { gap: 2px; }
  .keypad button { height: 58px; }
}
