/* Memory-trick notes (card tool, see wordNotes.js) */
.word-note-line { margin: 8px auto 10px; max-width: 520px; padding: 8px 12px; border-radius: 4px; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--text); font-size: .95rem; text-align: center; overflow-wrap: anywhere; }
.word-note-editor { margin: 8px auto 0; max-width: 520px; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); }
.word-note-label { font-size: .85rem; color: var(--text-muted); }
.word-note-editor textarea { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; font-size: 1rem; padding: 10px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); color: var(--text); }
.word-note-editor textarea:focus { outline: none; border-color: var(--accent); }
.word-note-actions { display: flex; justify-content: flex-end; }

/* Share or import words (Words tab) */
.share-words-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.share-words-formats { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.share-words-formats .btn { width: 100%; }
.share-words-hint { font-size: .8rem; color: var(--text-muted); margin: 0 0 6px; }
.share-words-dialog textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); color: var(--text); resize: vertical; }
.share-words-dialog select, .share-words-dialog input[type="file"] { width: 100%; box-sizing: border-box; }
.share-words-dialog select { margin-top: 4px; padding: 10px; font: inherit; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); color: var(--text); }

/* Stroke order (card tool, see kanjiStrokes.js) */
.ks-panel { margin: 8px auto 10px; max-width: 520px; padding: 12px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.ks-chars { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ks-char { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: none; padding: 0; color: var(--text); cursor: pointer; font: inherit; }
.ks-count { font-size: .78rem; color: var(--text-muted); }
.ks-svg { width: 132px; height: 132px; border-radius: 4px; background: var(--surface-2); }
.ks-grid { stroke: var(--border); stroke-width: .6; stroke-dasharray: 2 2; }
.ks-ghost { fill: none; stroke: var(--border); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ks-stroke { fill: none; stroke: var(--text); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; animation: ks-draw .4s ease-in-out forwards, ks-show .01s forwards; }
.ks-num { font-size: 7px; fill: var(--primary); font-family: inherit; opacity: 0; animation: ks-show .1s forwards; }
@keyframes ks-draw { to { stroke-dashoffset: 0; } }
@keyframes ks-show { to { opacity: 1; } }
.ks-missing { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 132px; height: 132px; border-radius: 4px; background: var(--surface-2); font-size: 3rem; }
.ks-missing span { font-size: .7rem; color: var(--text-muted); }
.ks-actions { display: flex; justify-content: center; gap: 8px; }
.ks-hint { font-size: .8rem; color: var(--text-muted); text-align: center; }
@media (prefers-reduced-motion: reduce) { .ks-stroke { animation-duration: .01s; } }

/* Numbers trainer (Learn → Numbers) */
.nt-missed { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.nt-missed .sq-option { display: flex; align-items: center; justify-content: center; gap: 6px; }

/* Progress page → Tricky words */
.pg-sub-top { margin: -4px 0 10px; text-align: start; }
.pg-tricky { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pg-tricky-row { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 10px 12px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); }
.pg-tricky-word { display: flex; flex-direction: column; }
.pg-tricky-target { font-size: 1.25rem; font-weight: 600; }
.pg-tricky-reading { font-size: .8rem; color: var(--text-muted); }
.pg-tricky-en { display: flex; flex-direction: column; text-align: end; }
.pg-tricky-en small { color: var(--primary); font-size: .78rem; }
.pg-tricky-note { grid-column: 1 / -1; font-size: .9rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pg-tricky-note textarea { flex: 1 1 100%; box-sizing: border-box; font: inherit; padding: 8px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); color: var(--text); }
.pg-link { background: none; border: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }

/* Build the sentence (Learn) */
.sb-en { font-size: 1.15rem; font-weight: 600; }
.sb-answer { min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; border-radius: 4px; border: 2px dashed var(--border); background: var(--surface); }
.sb-answer.right { border-style: solid; border-width: 3px; border-color: var(--good-fill); background: color-mix(in srgb, var(--good-fill) 14%, var(--surface)); position: relative; }
.sb-answer.wrong { border-style: dashed; border-color: var(--bad); background: var(--bad-soft); position: relative; }
.sb-answer.right::after, .sb-answer.wrong::after { position: absolute; top: 4px; right: 8px; font-weight: 800; }
/* Room for the ✓ / ✗ so the pieces never sit under it. */
.sb-answer.right, .sb-answer.wrong { padding-right: 28px; }
.sb-answer.right::after { content: '✓'; color: var(--good); }
.sb-answer.wrong::after { content: '✗'; color: var(--bad); }
.sb-placeholder { color: var(--text-muted); font-size: .9rem; }
.sb-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sb-piece { padding: 10px 12px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 1.1rem; cursor: pointer; line-height: 1.6; }
.sb-piece.placed { border-color: var(--accent); background: var(--accent-soft); }
.sb-piece.ghost { visibility: hidden; }
.sb-piece rt { font-size: .55em; color: var(--text-muted); }
.sb-correct { font-size: 1.2rem; line-height: 1.8; text-align: center; }
.sb-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.sb-explain { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.sb-ex-tile.selected { border-color: var(--accent); border-width: 3px; background: var(--accent-soft); text-decoration: underline; text-underline-offset: 4px; }
.sb-ex-words { margin: 0; padding-left: 0; list-style: none; font-size: 1.05rem; display: flex; flex-direction: column; gap: 4px; }

/* Undo last answer (review) */
.undo-row { display: flex; justify-content: center; margin-top: 10px; }
.undo-answer-btn { background: none; border: none; color: var(--text-muted); font: inherit; font-size: .9rem; padding: 6px 10px; border-radius: 4px; cursor: pointer; }
.undo-answer-btn:hover { color: var(--accent); background: var(--accent-soft); }

/* Japanese counters (Learn → Counters) */
.ct-q { font-size: 3rem; font-weight: 700; }
.ct-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--text-muted); }
.ct-list b { color: var(--text); display: inline-block; min-width: 1.6em; }

/* Thai tones (Learn → Tones) */
.tt-shape { width: 40px; height: 26px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.tt-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tt-legend-item { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .85rem; }
.tt-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tt-option { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; font-size: .85rem; }
@media (max-width: 420px) { .tt-options { grid-template-columns: repeat(5, 1fr); } }
.tt-word { font-size: 2.4rem; }
.note-action { opacity: .55; }
.note-action.has-note { opacity: 1; color: var(--new-word, #e6a700); }
.card-edit-form textarea#note-dialog-input { width: 100%; box-sizing: border-box; font: inherit; padding: 10px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); color: var(--text); resize: vertical; }

/* Keyboard shortcuts list (? during a review) */
.shortcut-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0 0 8px; align-items: center; }
.shortcut-list dt { margin: 0; text-align: end; }
.shortcut-list dd { margin: 0; font-size: .95rem; }
.shortcut-list .keycap { display: inline-block; min-width: 1.6em; text-align: center; padding: 2px 6px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface-2); font: inherit; font-size: .85rem; font-weight: 600; color: var(--text); }
.kr-word { font-size: 3rem; line-height: 1.2; margin: 0.5rem 0; }
/* Noun genders trainer */
.gt-word { font-size: 2rem; font-weight: 600; margin: 0.5rem 0; }
.gt-blank { color: var(--text-muted, #999); }
.gt-m { color: #2f6fdb; }
.gt-f { color: #d6336c; }
.gt-n { color: #2b9a66; }
.gt-options { display: flex; gap: 10px; }
.gt-options .gt-option { flex: 1; font-size: 1.2rem; font-weight: 600; }
/* Korean particles */
.kp-job { font-weight: 600; text-transform: capitalize; }
.kp-eg { font-weight: 400; color: var(--text-muted, #888); text-transform: none; }
.kp-word { font-size: 2.2rem; font-weight: 600; margin: 0.5rem 0; }
.kp-filled { color: #2f6fdb; }
/* Conjugation practice */
.cq-verb { font-size: 1.8rem; font-weight: 600; }
.cq-what { margin-top: 8px; font-weight: 600; color: var(--accent, #6b5bd6); }
.cq-options { display: grid; gap: 10px; }
.cq-kana { display: block; font-size: 0.8em; opacity: 0.7; }
.cq-missed { display: grid; gap: 6px; }
.cq-missed-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 4px; background: var(--surface, #fff); }
.cq-missed-what { opacity: 0.75; }
.kr-nikud { display: block; margin: 0 auto 12px; }
.tc-phrase { font-size: 2rem; font-weight: 600; margin: 0.4rem 0; }
.sp-sentence { font-size: 1.5rem; font-weight: 600; line-height: 1.4; }
.add-missed-btn { display: block; margin: 12px auto 0; }

/* Learn: Resources / Practice / Tools sections of compact tiles */
/* Learn tab: starts as close under the tabs as Review's card does. */
.study-view-toggle + .tools-section { margin-top: 4px; }
.tools-section .study-tools-heading { margin: 22px 4px 8px; }
.tools-section .study-tools-heading:first-child { margin-top: 0; }
.review-practice-heading { margin: 22px 4px 8px; }
.tool-subheading { margin: 12px 4px 6px; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.study-tools-heading + .tool-subheading, .review-practice-heading + .tool-subheading { margin-top: 0; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tool-tile {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; min-width: 0;
  padding: 10px 12px; border: 2px solid var(--border); border-radius: 4px;
  background: var(--surface); color: inherit; font: inherit; text-align: start;
  cursor: pointer; transition: border-color 0.2s;
}
.tool-tile:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.tool-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool-tile-icon { flex-shrink: 0; display: flex; color: var(--accent); margin-top: 2px; }
.tool-tile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tool-tile-text b { font-size: 0.92rem; font-weight: 600; line-height: 1.25; }
.tool-tile-text small {
  font-size: 0.74rem; line-height: 1.3; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tool-group { min-width: 0; }
.tool-group[open] { grid-column: 1 / -1; }
.tool-group > summary { list-style: none; }
.tool-group > summary::-webkit-details-marker { display: none; }
.tool-group-chevron { align-self: center; font-size: 1.2rem; color: var(--text-muted); transition: transform 0.2s; }
.tool-group[open] .tool-group-chevron { transform: rotate(90deg); }
.tool-group-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; padding-inline-start: 12px; border-inline-start: 2px solid var(--border); }

/* Type the answer: article reminder under a correct answer */
.type-answer-note { font-size: 0.85em; font-weight: 400; margin-top: 4px; opacity: 0.85; }

/* Numbers and Counters guides (Learn → Resources): numbersGuide.js, countersGuide.js */
.ng-page { display: flex; flex-direction: column; gap: 6px; }
.ng-intro { margin: 0; color: var(--text-muted); font-size: .92rem; line-height: 1.45; }
.ng-tap-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 2px 0 0; font-size: .8rem; color: var(--text-muted); }
.ng-tap-hint > span { display: inline-flex; align-items: center; gap: 5px; }
.ng-tap-hint > .ng-key { margin-inline-start: 8px; }
.ng-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.ng-section { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.ng-section .tools-heading { margin: 0 4px; }
.ng-section > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.ng-section > summary::-webkit-details-marker { display: none; }
.ng-section > summary::after { content: '▾'; font-size: .8em; color: var(--text-muted); transition: transform .15s; }
.ng-section:not([open]) > summary::after { transform: rotate(-90deg); }
.ng-section[open] > summary { margin-bottom: 2px; }
.ng-rule { align-self: flex-start; width: fit-content; margin: 0 4px; padding: 4px 10px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-size: .85rem; font-weight: 600; }
.ng-note { margin: 0 4px; font-size: .85rem; color: var(--text-muted); line-height: 1.4; }
.ng-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.ng-rows.wide { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ng-row { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-width: 0; padding: 6px 9px; border: 2px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.ng-row:hover, .cg-ex:hover { border-color: var(--accent); }
.ng-digits { font-size: .8rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.ng-words { display: flex; flex-direction: column; gap: 1px; min-width: 0; max-width: 100%; }
.ng-main { font-size: 1.05rem; font-weight: 600; text-align: left; overflow-wrap: anywhere; }
.ng-words small { font-size: .78rem; color: var(--text-muted); white-space: pre-line; line-height: 1.3; }
.ng-row.irregular::after { content: ''; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.ng-row.irregular, .cg-ex.irregular { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
.ng-say { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.ng-say .tools-heading { margin: 0 4px; }
.ng-say-input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 2px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); font: inherit; font-size: 1.05rem; }
.ng-say-input:focus { outline: none; border-color: var(--accent); }
.ng-say-out { display: flex; flex-direction: column; gap: 6px; }
.ng-say-card { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 2px solid var(--border); border-radius: 4px; background: var(--surface); }
.ng-say-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.ng-say-digits { font-size: .8rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.ng-say-main { font-size: 1.15rem; font-weight: 600; text-align: left; overflow-wrap: anywhere; }
.ng-say-card small { font-size: .85rem; color: var(--text-muted); overflow-wrap: anywhere; }
.cg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-top: 6px; }
.cg-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 9px 11px; border: 2px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.cg-tile:hover { border-color: var(--accent); }
.cg-tile-head { font-size: 1.45rem; font-weight: 700; line-height: 1.2; }
.cg-tile-read { font-size: .85rem; font-weight: 600; color: var(--accent); }
.cg-tile-use { font-size: .78rem; color: var(--text-muted); line-height: 1.3; }
.cg-detail-read { margin: 0; font-size: .95rem; color: var(--text-muted); }
.cg-card { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 2px solid var(--border); border-radius: 4px; background: var(--surface); }
.cg-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.cg-counter { font-size: 1.5rem; font-weight: 700; }
.cg-sub { font-size: .85rem; font-weight: 600; color: var(--accent); }
.cg-use { flex-basis: 100%; font-size: .82rem; color: var(--text-muted); }
.cg-examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.cg-ex { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 8px; border: 2px solid var(--border); border-radius: 4px; background: var(--surface-2); color: var(--text); font: inherit; text-align: start; cursor: pointer; min-width: 0; }
.cg-ex small { font-size: .7rem; color: var(--text-muted); }
.cg-ex span { font-size: .95rem; font-weight: 600; overflow-wrap: anywhere; }

/* Verb Library (Learn → Verbs): verbLibrary.js */
.vl-explain { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 4px; background: var(--surface-2); }
.vl-explain p { margin: 0; font-size: .88rem; line-height: 1.45; }
.vl-example { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: .95rem; }
.vl-example b { flex-basis: 100%; font-size: .85rem; color: var(--accent); }
.vl-example span { display: flex; flex-direction: column; font-weight: 600; }
.vl-example small { font-size: .7rem; font-weight: 400; color: var(--text-muted); }
.vl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.vl-verb { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; padding: 7px 10px; border: 2px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.vl-verb:hover { border-color: var(--accent); }
.vl-verb-head { font-size: 1.1rem; font-weight: 600; }
.vl-verb-en { font-size: .78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.vl-more { font-size: .88rem; }
.vl-more summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 4px; }
.vl-more .vl-list { margin-top: 6px; }

/* Grammar guides (Learn → Grammar): grammarGuide.js */
.gg-rule b { font-size: .8rem; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.gg-pairs { display: flex; flex-direction: column; gap: 6px; }
.gg-compare { display: grid; grid-template-columns: 1fr 1fr; }
.gg-pair { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 12px; border: 2px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); font: inherit; text-align: start; cursor: pointer; min-width: 0; }
.gg-pair:hover { border-color: var(--accent); }
.gg-ja { font-size: 1.15rem; line-height: 1.9; }
.gg-pair small { font-size: .8rem; color: var(--text-muted); line-height: 1.35; }
.gg-hit { background: var(--accent-soft); color: var(--accent); font-weight: 800; border-radius: 4px; padding: 0 2px; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.gg-quiz { margin-top: 18px; align-self: center; display: inline-flex; align-items: center; gap: 6px; }

/* Sentences you've seen (experimental, seenSentences.js) */
.sb-list-link { align-self: center; background: none; border: none; color: var(--accent); font: inherit; font-size: .9rem; text-decoration: underline; cursor: pointer; padding: 2px 6px; }
.sb-seen-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sb-seen-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 4px; border: 2px solid var(--border); background: var(--surface); }
.sb-seen-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 1.05rem; line-height: 1.8; }
.sb-seen-text rt { font-size: .55em; color: var(--text-muted); }
.sb-seen-date { font-size: .78rem; color: var(--text-muted); }
.tool-grid-full .tool-tile-text small { display: block; -webkit-line-clamp: unset; overflow: visible; }

/* Review Exercises: a full page over the Review tab (see reviewPracticeHtml). */
.practice-page { position: fixed; inset: 0; z-index: 50; overflow-y: auto; padding: 20px 16px 40px; background: var(--bg); }
.practice-page[hidden] { display: none; }
.practice-page .tool-subheading:first-of-type { margin-top: 4px; }
body:has(.practice-page:not([hidden])) { overflow: hidden; }
