/*
 * Zen study — styles for study.html only.
 *
 * A quiet study desk: today's session first, then hairline-separated
 * sections instead of cards, section labels (Japanese word + small uppercase
 * English), mincho for every study item, one seal-red accent for the number
 * of items due. `.study.is-empty` (no items, no session) leaves only the
 * study list's intro and its Import and sample grammar buttons.
 *
 * Load after /css/tailwind.css and /css/zen-base.css.
 */

/* ------------------------------------------------------------------ */
/* Shared bits: section labels (base in zen-base.css) and badges       */
/* ------------------------------------------------------------------ */

.section-label {
  flex-wrap: wrap;
  gap: 2px 10px;
}
.section-label .ja { font-family: var(--font-ui); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  color: var(--text-2);
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.6;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Page head                                                            */
/* ------------------------------------------------------------------ */

.study { display: block; outline: none; }

.study-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
  padding-bottom: 32px;
}

.study-heading { max-width: 36em; }

.study-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  font-weight: 400;
}
.study-title .ja {
  font-size: 40px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.08em;
}
.study-title .en {
  color: var(--stone);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.study-sub {
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.8;
}

/* Today's figures: due (the one seal-red thing), items, accuracy */
.study-figures {
  display: flex;
  gap: 0;
  margin: 0;
}
.study-figure {
  min-width: 96px;
  padding: 0 24px;
  border-inline-start: 1px solid var(--hair);
}
.study-figure:first-child { padding-inline-start: 0; border-inline-start: 0; }
.study-figure dt {
  color: var(--stone);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.study-figure dt .ja {
  margin-inline-end: 4px;
  color: var(--text-2);
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.study-figure dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 32px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.study-figure.is-due dd { color: var(--seal); }
.study-figure.is-due.is-clear dd { color: var(--ink); }

/* ------------------------------------------------------------------ */
/* Sections                                                             */
/* ------------------------------------------------------------------ */

.study-section { border-top: 1px solid var(--hair); }

.study-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 14px 0;
  list-style: none;
  cursor: pointer;
}
.study-summary::-webkit-details-marker { display: none; }
.study-summary::marker { content: ''; }

/* A thin chevron, turning down when open */
.study-summary::after {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  margin-inline-end: 4px;
  border-right: 1px solid var(--stone);
  border-bottom: 1px solid var(--stone);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
.study-section[open] > .study-summary::after { transform: rotate(45deg); }
.study-summary:hover::after { border-color: var(--ink); }
.study-summary:hover .section-label .en { color: var(--ink); }
.study-summary:focus-visible { outline-offset: 2px; }

.study-body { padding: 4px 0 40px; }

.study-lead {
  max-width: 42em;
  margin: 0 0 16px;
  color: var(--text-2);
  font-size: 14px;
}
.study-meta {
  color: var(--stone);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.study-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 18px;
}
.study-toolbar .study-meta { margin-inline-start: 4px; }

/* Today: the session buttons, their options and the running session */
.study-today { padding: 18px 0 40px; border-top: 1px solid var(--hair); }
.today-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 24px;
  margin-bottom: 18px;
}
.study-today .study-lead { margin-bottom: 14px; }

.today-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.today-actions .study-act { margin-inline-start: 12px; font-size: 13px; }
.today-count {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* No items and no session: only the study list's intro and its add buttons */
.study.is-empty .study-figures,
.study.is-empty .study-today,
.study.is-empty .browse-show,
.study.is-empty .browse-filters,
.study.is-empty .browse .study-list,
.study.is-empty .browse-foot { display: none; }
.study:not(.is-empty) .study-intro { display: none; }

.study-intro { padding-bottom: 18px; }
.study-intro .study-lead { margin: 0; }
.study-intro-title {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 16px;
}

/* ------------------------------------------------------------------ */
/* Controls                                                             */
/* ------------------------------------------------------------------ */

.study .export-btn { gap: 6px; white-space: nowrap; }

/* Quiet text action used inside rows and footers */
.study-act,
.export-modal .study-act {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-decoration-color: var(--hair);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.study-act:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}
.study-act.is-danger:hover { color: var(--seal); }
.study-act:disabled {
  color: var(--stone-soft);
  text-decoration-color: transparent;
  cursor: default;
}

.study .z-link { font-size: 13px; }

/* Fields */
.study-field {
  display: grid;
  gap: 4px;
}
.study-field-label,
.practice-types legend,
.study-inline-field > span {
  color: var(--stone);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.study select,
.study input[type='search'],
.study input[type='text'] {
  min-height: 36px;
  padding: 4px 10px;
  background-color: transparent;
  border: 1px solid var(--hair);
  border-radius: 2px;
  color: var(--ink);
  font-size: 14px;
}
.study select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--stone) 50%),
    linear-gradient(135deg, var(--stone) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.study select option { background: var(--surface); color: var(--ink); }
.study select:hover,
.study input[type='search']:hover,
.study input[type='text']:hover { border-color: var(--stone-soft); }
.study select:focus-visible,
.study input:focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
.study input::placeholder { color: var(--stone); }

.study-inline-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.study-inline-field select { min-height: 32px; font-size: 13px; }

.study-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.study-check input { width: 14px; height: 14px; margin: 0; }

/* ------------------------------------------------------------------ */
/* The study list                                                       */
/* ------------------------------------------------------------------ */

.study-list { border-top: 1px solid var(--ink); }

.study-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 14px 0 13px;
  border-bottom: 1px solid var(--hair-soft);
}
.study-row-main { flex: 1; min-width: 0; }

/* Tick to practise or remove several at once */
.study-select {
  flex: none;
  align-self: flex-start;
  width: 16px;
  height: 16px;
  margin: 9px 0 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.study-term {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.study-reading {
  color: var(--text-2);
  font-size: 14px;
  letter-spacing: 0.04em;
}
.study-meaning {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.study-example {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.study-row-meta {
  margin-top: 4px;
  color: var(--stone);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.study-row-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px 18px;
}
.study-row-actions .export-btn { min-height: 32px; padding: 0 14px; font-size: 12px; }

/* Missed, In session; a leech (missed again and again) in seal red */
.study-tag {
  padding: 0 6px;
  border: 1px solid var(--hair);
  color: var(--text-2);
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.12em;
  line-height: 1.6;
  text-transform: uppercase;
}
.study-tag.is-leech { border-color: var(--seal); color: var(--seal); }

.study-empty {
  padding: 22px 0 20px;
  border-bottom: 1px solid var(--hair-soft);
  color: var(--stone);
  font-size: 13px;
  line-height: 1.8;
}
.study-empty p { margin: 0; }
.study-empty .study-empty-title {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}
.study-empty ul { margin: 6px 0 0; padding: 0; list-style: none; }
.study-empty li { position: relative; padding-inline-start: 1.2em; }
.study-empty li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.9em;
  width: 0.6em;
  height: 1px;
  background: var(--stone-soft);
}
.study-empty strong { color: var(--text-2); font-weight: 500; }

/* ------------------------------------------------------------------ */
/* Browse                                                               */
/* ------------------------------------------------------------------ */

/* The views (All, Due, Missed, Leeches) and the add buttons, then the filters */
.browse-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  margin-bottom: 14px;
}
.browse-show { font-size: 13px; }
.browse-show .z-seg-btn { padding: 6px 0 4px; }
.browse-show-count {
  color: var(--stone);
  font-variant-numeric: tabular-nums;
}
.browse-show .z-seg-btn[aria-pressed='true'] .browse-show-count { color: var(--text-2); }

.browse-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  min-width: 0;
  margin-bottom: 20px;
}
.browse-filters .study-field { flex: 0 1 140px; min-width: 0; }
.browse-filters .browse-search { flex: 1 1 240px; max-width: 360px; }
.browse-filters select,
.browse-filters input { width: 100%; }
/* A filter that hides items: seal-red rule beside the field, so a filtered list never passes for the whole set */
.study .browse-filters .is-active {
  border-color: var(--ink);
  border-inline-start: 3px solid var(--seal);
}
.browse-clear-filters { font-size: 13px; }

.browse-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
/* Beside the filters they match the fields; alone (empty list) they are the page's main buttons */
.study:not(.is-empty) .browse-sources .export-btn { min-height: 36px; padding: 0 14px; font-size: 12px; }

/* The ticked items' actions, kept in view at the bottom of the window */
.browse-selection {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 10px 0;
  background: var(--paper);
  border-top: 1px solid var(--ink);
}
.browse-selection .export-btn { min-height: 34px; padding: 0 14px; font-size: 12px; }

.browse-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  padding-top: 12px;
}
.browse-foot-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
}

/* ------------------------------------------------------------------ */
/* Practice                                                             */
/* ------------------------------------------------------------------ */

.practice-options { margin-top: 12px; }
.practice-options-summary {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  min-height: 32px;
  padding: 6px 0;
  color: var(--text-2);
  font-size: 13px;
  list-style: none;
  cursor: pointer;
}
.practice-options-summary::-webkit-details-marker { display: none; }
.practice-options-summary::marker { content: ''; }
/* A small chevron before the label, turning down when open */
.practice-options-summary::before {
  content: '';
  flex: none;
  align-self: center;
  width: 5px;
  height: 5px;
  border-right: 1px solid var(--stone);
  border-bottom: 1px solid var(--stone);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
.practice-options[open] > .practice-options-summary::before { transform: rotate(45deg); }
.practice-options-summary:hover { color: var(--ink); }
.practice-options-summary:hover::before { border-color: var(--ink); }

.practice-options-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 32px;
  padding: 10px 0 4px 15px;
}
.practice-types {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.practice-types legend {
  float: left;
  margin-inline-end: 4px;
  padding: 0;
}

.session-area { margin-top: 22px; }

.practice-status {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 24px;
  padding: 10px 0 8px;
  background: var(--paper);
}
.practice-clock {
  display: flex;
  gap: 20px;
  color: var(--text-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.practice-progress {
  height: 1px;
  background: var(--hair);
}
.practice-progress > div {
  height: 1px;
  background: var(--ink);
  box-shadow: 0 0 0 0.5px var(--ink);
  transition: width 0.3s ease;
}

/* Scrolled to on Next: clear of the sticky status line above it */
.session-view { min-height: 120px; scroll-margin-top: 56px; }
/* Focused by script (keyboard flow), not a control: no ring */
.session-card:focus { outline: none; }
.session-hint {
  margin: 0 0 18px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
}
.session-view > .study-empty { border-bottom: 0; }

.session-card {
  max-width: 760px;
  padding: 28px 0 8px;
}

.session-meta {
  display: flex;
  align-items: baseline;
  gap: 14px;
  color: var(--stone);
  font-size: 12px;
  letter-spacing: 0.06em;
}
.session-count { font-variant-numeric: tabular-nums; }
.session-type {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.session-prompt {
  margin: 14px 0 0;
  color: var(--text-2);
  font-size: 14px;
}
.session-target {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: var(--read-size);
  line-height: 1.45;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

/* The blank in a fill-in-the-gap sentence; once answered, what fills it */
.session-gap {
  display: inline-block;
  min-width: 3em;
  border-bottom: 1px solid var(--ink);
  color: var(--stone);
  text-align: center;
}
.session-gap.is-filled { color: var(--ink); background: var(--wash); }

/* A meaning in English (Which word means …): the interface font, smaller than Japanese */
.session-target.is-meaning {
  font-family: var(--font-ui);
  font-size: 24px;
  letter-spacing: 0.01em;
}
.session-target.is-meaning:empty { min-height: 1.45em; }

.session-kanji:empty { display: none; }
.session-kanji {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0 32px;
  margin-top: 18px;
}
.kanji-entry {
  padding: 12px 0 14px;
  border-top: 1px solid var(--hair-soft);
  font-size: 13px;
}
.kanji-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.kanji-char { font-size: 30px; line-height: 1.3; }
.kanji-meta { color: var(--stone); font-size: 11px; letter-spacing: 0.06em; }
.kanji-grid {
  display: grid;
  grid-template-columns: 5.5em minmax(0, 1fr);
  gap: 2px 10px;
  margin: 6px 0 8px;
}
.kanji-grid dt { color: var(--stone); }
.kanji-grid dd { margin: 0; overflow-wrap: anywhere; }
.kanji-strokes:empty { display: none; }
.kanji-strokes { margin-top: 8px; }
html.dark .kanji-strokes img { filter: invert(0.9); }

/* Answer choices */
.session-choices {
  margin-top: 22px;
  border-top: 1px solid var(--hair);
}
.study-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 52px;
  padding: 10px 44px 10px 14px;
  border-bottom: 1px solid var(--hair-soft);
  border-inline-start: 2px solid transparent;
  cursor: pointer;
}
@media (hover: hover) {
  .study-choice:hover { background: var(--wash); }
}
.study-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}
.study-letter {
  flex: none;
  width: 1.4em;
  color: var(--stone);
  font-size: 12px;
  letter-spacing: 0.06em;
}
.study-choice-text {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.study-choice:has(input:checked) {
  background: var(--wash);
  border-inline-start-color: var(--ink);
}
.study-choice:has(input:checked) .study-letter { color: var(--ink); }
.study-choice:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

/* After submitting: ○ for the right answer, × for a wrong pick */
.study-choice.correct,
.study-choice.incorrect { background: transparent; }
.study-choice.correct,
.study-choice.correct:has(input:checked) { border-inline-start-color: var(--pos-adv); }
.study-choice.incorrect,
.study-choice.incorrect:has(input:checked) { border-inline-start-color: var(--seal); }
.study-choice.correct::after,
.study-choice.incorrect::after {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-jp);
  font-size: 20px;
  line-height: 1;
}
.study-choice.correct::after { content: '○'; color: var(--pos-adv); }
.study-choice.incorrect::after { content: '×'; color: var(--seal); }
.session-choices.is-answered .study-choice:not(.correct):not(.incorrect) .study-choice-text { color: var(--stone); }

.session-input { width: 100%; margin-top: 4px; }

.session-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 22px;
}
.session-actions .study-act { margin-inline-start: 4px; }

.session-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin-inline-start: auto;
  color: var(--text-2);
  font-size: 13px;
}
.session-feedback:empty { display: none; }
.fb-ok,
.fb-bad {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  letter-spacing: 0.04em;
}
/* Pine green alone is 4.46:1 on paper; a touch of ink brings it past AA in both themes (as .badge-common) */
.fb-ok { color: color-mix(in srgb, var(--pos-adv) 80%, var(--ink)); }
.fb-bad { color: var(--seal); }
.fb-mark { font-size: 16px; }
.fb-answer { color: var(--ink); font-size: 16px; }

.session-done { padding: 28px 0 8px; }
.session-score {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 44px;
  line-height: 1.2;
}
.session-score span { color: var(--stone); font-size: 24px; }

/* What was missed, then the next steps */
.session-done-label {
  margin: 24px 0 6px;
  color: var(--stone);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.session-missed {
  max-width: 760px;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hair);
  list-style: none;
}
.session-missed li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hair-soft);
}
.session-missed .ja { color: var(--ink); font-size: 18px; }
.session-missed-answer { color: var(--text-2); font-size: 14px; }
.session-done .study-meta { margin: 14px 0 0; }
.session-done .session-overall { margin-top: 4px; }

/* ------------------------------------------------------------------ */
/* History and favourites modals (markup from core/history-favorites)   */
/* ------------------------------------------------------------------ */

.export-modal .study-toolbar { margin-bottom: 12px; }

.study-saved-list { border-top: 1px solid var(--hair); }
.study-saved-list .study-row:last-child { border-bottom: 0; }
.study-saved-list .study-example { font-size: 16px; }

/* ------------------------------------------------------------------ */
/* Small screens and touch                                              */
/* ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .study-head { align-items: flex-start; }
}

@media (max-width: 560px) {
  .study-title .ja { font-size: 32px; }
  .study-head { padding-bottom: 24px; }
  .study-figures { width: 100%; }
  /* Three figures share a phone's width: a long label ("Reviewed today", "Révisés aujourd'hui") wraps
     within its own column, and breaks inside a word only when a word alone is too wide. The numbers
     stay on one line whatever the labels above them take. */
  .study-figure { display: flex; flex: 1; flex-direction: column; min-width: 0; padding: 0 12px; }
  .study-figure dt {
    margin-bottom: 2px;
    letter-spacing: 0.06em;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .study-figure dd { margin-top: auto; font-size: 26px; }
  .study-figure dt .ja { display: block; }

  .study-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .study-row-actions { flex-wrap: wrap; }
  /* The study list keeps its tick box beside the term; the actions go under, in line with the text */
  .browse .study-row { flex-flow: row wrap; gap: 6px 16px; }
  .browse .study-row-actions { flex-basis: 100%; padding-inline-start: 32px; }

  .today-actions .export-btn { flex: 1 1 calc(50% - 5px); }
  .today-actions .study-act { margin-inline-start: 0; }
  .practice-options-body { padding-inline-start: 0; }
  .browse-filters .browse-search { flex-basis: 100%; max-width: none; }
  .browse-filters .study-field:not(.browse-search) { flex: 1 1 calc(50% - 8px); }
  .browse-sources .export-btn { flex: 1 1 auto; }
  .practice-status { flex-direction: column; }
  .session-target { font-size: 28px; }
  .session-feedback { flex-basis: 100%; margin-inline-start: 0; }
  .browse-foot { flex-direction: column; align-items: flex-start; }
}

/* Toasts with an action (Undo): the base toast ignores the pointer */
.jga-toast.has-action {
  display: flex;
  align-items: baseline;
  gap: 16px;
  pointer-events: auto;
}
.jga-toast-action {
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.jga-toast-action:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* Touch screens have no keys to press */
@media (hover: none) and (pointer: coarse) {
  .session-keys { display: none; }
}

@media (pointer: coarse) {
  .study .export-btn,
  .export-modal .export-btn,
  .study-act,
  .study select,
  .study input[type='search'],
  .study input[type='text'],
  .study-check,
  .practice-options-summary,
  .study .z-link { min-height: 44px; }
  .study-choice { min-height: 56px; }
}

@media print {
  .study-select,
  .browse-selection,
  .study-summary::after,
  .today-actions,
  .practice-options,
  .browse-toolbar,
  .practice-status,
  .practice-progress { display: none !important; }
}

/* Japanese UI: the English half of a label is translated, so drop the wide tracking */
html[lang|='ja'] .section-label .en,
html[lang|='ja'] .study-title .en,
html[lang|='ja'] .study-figure dt,
html[lang|='ja'] .session-type { letter-spacing: 0.04em; }

/* Figures: in Japanese the label is already the Japanese word */
html[lang|='ja'] .study-figure dt [data-i18n] { display: none; }
