/* Alphabet trainer (Learn → Alphabet) */
.ab-page { display: flex; flex-direction: column; gap: 14px; }
.ab-tabs { align-self: center; }
.ab-start { gap: 14px; }
.ab-dir { display: flex; flex-direction: column; gap: 6px; text-align: start; }
.ab-dir-opt { display: flex; align-items: center; gap: 8px; font-size: .95rem; cursor: pointer; }
.ab-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ab-chip { padding: 7px 12px; border-radius: 999px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
.ab-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ab-tip { text-align: center; font-size: .85rem; }
.ab-group-title { font-size: 1rem; margin: 6px 0 8px; }
.ab-group.off { opacity: .55; }
.ab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.ab-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 66px; padding: 6px 4px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ab-cell.learning { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.ab-cell.known { border-color: var(--success); background: var(--success-soft); }
/* A tick as well as the colour, so learned letters stand out without relying on green. */
.ab-cell { position: relative; }
.ab-cell.known::after { content: '✓'; position: absolute; top: 3px; right: 6px; font-size: .7rem; font-weight: 700; color: var(--success); }
.ab-ch { font-size: 1.6rem; line-height: 1.2; }
.ab-rom { font-size: .78rem; color: var(--text-muted); }
.ab-hint { font-size: .72rem; color: var(--text-muted); text-align: center; }
.ab-q-ch { font-size: 4.2rem; line-height: 1.2; padding: 4px 18px; border: none; background: none; color: var(--text); cursor: pointer; font-family: inherit; }
.ab-q-rom { font-size: 1.6rem; font-weight: 700; }
.ab-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ab-opt-ch { font-size: 2rem; line-height: 1.2; }
.ab-opt-rom { font-weight: 600; }
.ab-opt-hint { font-size: .78rem; color: var(--text-muted); }
.ab-strokes { display: flex; gap: 2px; justify-content: center; }
.ab-strokes .ks-svg, .ab-strokes .ks-missing { width: 62px; height: 62px; font-size: 1.4rem; }

/* Letter popup: centred card over a dimmed page */
.ab-pop { width: min(92vw, 380px); max-height: 90vh; padding: 0; overflow: auto; }
.ab-pop-body { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 18px 18px; text-align: center; }
.ab-pop-x { position: absolute; top: 8px; right: 8px; }
.ab-pop-group { font-size: .82rem; color: var(--text-muted); padding: 0 34px; }
.ab-pop-known { color: var(--success); font-weight: 600; }
.ab-pop-learning { color: var(--primary); font-weight: 600; }
.ab-pop-ch { font-size: 5.5rem; line-height: 1.15; padding: 4px 22px; border: none; background: none; color: var(--text); font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ab-pop-rom { font-size: 1.6rem; font-weight: 700; margin-top: -6px; }
.ab-pop-hint { font-size: .9rem; color: var(--text-muted); }
.ab-pop-strokes { flex-wrap: wrap; gap: 8px; }
.ab-pop-strokes .ks-svg, .ab-pop-strokes .ks-missing { width: 132px; height: 132px; font-size: 3rem; }
.ab-pop-nav { display: flex; gap: 8px; width: 100%; margin-top: 4px; }
.ab-pop-nav .btn { flex: 1; padding-left: 6px; padding-right: 6px; white-space: nowrap; }
