/* A kanji's SRS box, 0 (new) to 5 (learnt): KanjiWithStyle.cls in a KanjiGrid */
aedict-kanji-grid::part(srs0) { background-color: rgba(189, 189, 189, 0.33); }
aedict-kanji-grid::part(srs1) { background-color: rgba(239, 83, 80, 0.33); }
aedict-kanji-grid::part(srs2) { background-color: rgba(255, 167, 38, 0.33); }
aedict-kanji-grid::part(srs3) { background-color: rgba(255, 238, 88, 0.33); }
aedict-kanji-grid::part(srs4) { background-color: rgba(212, 225, 87, 0.33); }
aedict-kanji-grid::part(srs5) { background-color: rgba(76, 175, 80, 0.33); }

/* MainLayout: its own side margin, since on a phone the drawer toggle beside it moves to the bottom */
.view-title {
  font-size: var(--lumo-font-size-l);
  margin: 0 var(--lumo-space-m);
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clickable { cursor: pointer; }
.clickable:active { background-color: var(--lumo-primary-color-10pct); }
mark { background-color: var(--lumo-primary-color-10pct); color: var(--lumo-primary-text-color); }

/* SearchView */
.search-bar {
  width: 100%;
  box-sizing: border-box;
  padding: var(--lumo-space-xs) var(--lumo-space-m);
  background: var(--lumo-contrast-5pct);
}
.search-bar-row { align-items: baseline; }
.search-filter {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--lumo-space-m);
  align-items: baseline;
}
.search-caption {
  width: 100%;
  box-sizing: border-box;
  padding: var(--lumo-space-xs) var(--lumo-space-m);
  font-size: var(--lumo-font-size-s);
  color: var(--lumo-secondary-text-color);
}
.welcome {
  padding: 0 var(--lumo-space-m);
  overflow: auto;
  flex-grow: 1;
}

/* EntryList: a VirtualList of rows, a checkbox sliding in from the left in the selection mode */
.entry-list {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.entry-list > vaadin-virtual-list { flex-grow: 1; min-height: 0; }
.entry-list-message {
  padding: var(--lumo-space-l);
  text-align: center;
  color: var(--lumo-secondary-text-color);
}
.entry-list-select {
  position: absolute;
  top: var(--lumo-space-xs);
  right: var(--lumo-space-m);
  z-index: 1;
  background: var(--lumo-base-color);
}
/* in a narrow column the buttons move below the count as one row, right-aligned; at 4px apart all
   eight fit from EntryDetailView's narrowest column on, and wrap only narrower still */
.entry-list-selection-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lumo-space-xs) var(--lumo-space-s);
  padding: var(--lumo-space-xs) var(--lumo-space-m);
  background: var(--lumo-primary-color-10pct);
}
.entry-list-selection-bar > span { flex-grow: 1; }
.entry-list-selection-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--lumo-space-xs);
  margin-left: auto;
}
.entry-list-row {
  display: flex;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid var(--lumo-contrast-10pct);
  padding: var(--lumo-space-xs) var(--lumo-space-m);
}
.entry-list-row:active { background-color: var(--lumo-primary-color-10pct); }
.entry-list-row > .entry-item, .entry-list-row > .kanji-card { flex-grow: 1; min-width: 0; }
/* the stripe the apps draw too */
.entry-list-row.tagged { border-left: 4px solid var(--tag-color); }
.entry-list-checkbox {
  pointer-events: none;
  flex-shrink: 0;
  width: 0;
  overflow: hidden;
  opacity: 0;
  transition: width 0.2s, opacity 0.2s;
}
.entry-list.selecting .entry-list-checkbox { width: 2.2em; opacity: 1; }

/* the rows of an EntryList */
.entry-item .entry-jp { font-size: var(--lumo-font-size-xl); }
.entry-item .entry-sense { color: var(--lumo-body-text-color); }
.entry-item .entry-jp, .entry-item .entry-sense {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-note {
  font-size: var(--lumo-font-size-s);
  font-style: italic;
  color: var(--lumo-secondary-text-color);
}
.kanji-item { display: flex; align-items: center; gap: var(--lumo-space-m); }
.kanji-item .entry-kanji { font-size: 2.4em; }
.kanji-item .entry-body { min-width: 0; }
.kanji-item .entry-reading { color: var(--lumo-secondary-text-color); }
.sentence-item .entry-sentence { font-size: var(--lumo-font-size-l); }
.sentence-item .entry-reading { color: var(--lumo-secondary-text-color); }

/* EntryDetailView */
.entry-detail-toolbar {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}
.entry-detail-content { min-height: 0; display: flex; flex-direction: column; }
.column-tabs { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; }
.column-tabs-content { flex-grow: 1; min-height: 0; display: flex; }
.column-tabs-columns { display: flex; flex-grow: 1; gap: var(--lumo-space-s); min-height: 0; width: 100%; }
.column-tabs-column { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.column-tabs-column > .column-tabs-column-content { flex-grow: 1; min-height: 0; }
.column-caption {
  color: var(--lumo-base-color);
  background: var(--lumo-contrast-80pct);
  padding: var(--lumo-space-xs) var(--lumo-space-m);
}
.scrolling { overflow: auto; padding: var(--lumo-space-s) var(--lumo-space-m); }
.split-pane { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.split-pane > :first-child { flex-shrink: 0; max-height: 50%; overflow: auto; padding: var(--lumo-space-s) var(--lumo-space-m); }
.split-pane > .split-pane-list { flex-grow: 1; min-height: 0; }
.entry-side { display: flex; flex-direction: column; flex-shrink: 0; }

/* WordCard */
.word-card-spelling, .word-card-sense {
  border-radius: var(--lumo-border-radius-l);
  padding: var(--lumo-space-s);
  margin-bottom: var(--lumo-space-s);
}
.word-card-spelling { display: flex; background: var(--lumo-contrast-5pct); }
.word-card-body { flex-grow: 1; min-width: 0; }
.word-card-sense { border: 1px solid var(--lumo-contrast-10pct); }
.word-card-kanji { font-size: 2em; }
.word-card-reading { font-size: 61.8%; color: var(--lumo-secondary-text-color); }
.accent1 { text-decoration: overline; text-decoration-color: var(--lumo-primary-color); }
.accentnasal { color: var(--lumo-primary-color); }

/* Badges */
.badges { cursor: pointer; }
.badges > * { margin: 2px; vertical-align: middle; display: inline-block; }
.badges > .badge {
  border-radius: var(--lumo-border-radius-l);
  background: #669900;
  padding: 2px 6px;
  color: #fff;
  font-size: var(--lumo-font-size-s);
}
.antonyms { display: flex; gap: var(--lumo-space-s); align-items: center; color: var(--lumo-primary-text-color); }

/* KanjiCard */
.kanji-card-row { display: flex; }
.kanji-card-body { flex-grow: 1; min-width: 0; }
.kanji-card-top { display: flex; gap: var(--lumo-space-m); align-items: center; }
.kanji-card-kanji { font-size: 6em; line-height: 1.1; }
.kanji-card-table { font-size: var(--lumo-font-size-s); }
.kanji-card-readings { color: var(--lumo-secondary-text-color); font-size: var(--lumo-font-size-l); }
.kanji-card-sense { color: var(--lumo-body-text-color); }
.entry-list-row .kanji-card { width: 100%; }
/* clear of the list's Select button, floating top right */
.entry-list-row .kanji-card .entry-side { margin-top: 2.2em; }
.kanji-info-item { display: flex; gap: var(--lumo-space-s); align-items: flex-start; margin-bottom: var(--lumo-space-s); }
.kanji-info-description { font-size: var(--lumo-font-size-s); color: var(--lumo-secondary-text-color); }

/* StrokeOrderDiagram: 70px frames, wrapping */
.stroke-order { display: flex; flex-wrap: wrap; gap: 2px; padding: var(--lumo-space-s) 0; }
.stroke-order svg { width: 70px; height: 70px; fill: none; stroke: var(--lumo-body-text-color); stroke-width: 3; stroke-linecap: round; }
.stroke-order svg rect { stroke: var(--lumo-contrast-20pct); stroke-width: 1; }
.stroke-order svg .stroke-start { stroke: #de632f; stroke-width: 6; stroke-dasharray: 15 10000; }
.stroke-order.clickable:active { background: none; }
.stroke-order.clickable svg:active { background-color: var(--lumo-primary-color-10pct); }

/* KanjiDrawPracticeView: the pad takes what the stroke order leaves */
.kanji-draw-practice > aedict-kanjipad { flex-grow: 1; min-height: 0; width: 100%; height: auto; border: 1px solid var(--lumo-contrast-20pct); }
.kanji-draw-practice-strokes { flex-shrink: 0; max-height: 30%; overflow-y: auto; }

/* KanaTableView: a column per vowel, each kana over its romaji */
.kana-tables {
  flex-grow: 1; min-height: 0; width: 100%; overflow: auto;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--lumo-space-l); padding-bottom: var(--lumo-space-l);
}
.kana-table { display: grid; column-gap: var(--lumo-space-m); align-items: baseline; text-align: center; }
.kana-table .kana, .kana-table .kana-label { font-size: var(--lumo-font-size-xxl); padding-top: var(--lumo-space-xs); }
.kana-table .kana-label { color: var(--lumo-secondary-text-color); }
.kana-table .kana-reading { font-size: var(--lumo-font-size-s); color: var(--lumo-secondary-text-color); }

/* KanjiParts */
.kanji-parts-node { display: flex; align-items: center; }
.kanji-parts-children { display: flex; flex-direction: column; border-left: 2px solid var(--lumo-primary-color-50pct); margin-left: var(--lumo-space-xs); }
.kanji-parts-part { font-size: var(--lumo-font-size-xl); min-width: 2.4em; }
.kanji-parts-part.selected { background: var(--lumo-primary-color); color: var(--lumo-primary-contrast-color); }
.kanji-parts-tree { overflow-x: auto; padding-bottom: var(--lumo-space-m); }

/* Inflections: a TreeGrid with no header */
vaadin-grid.inflections::part(header-cell) { display: none; }
.inflection-kana { font-size: var(--lumo-font-size-l); }

/* showSelectDialog */
.select-dialog-option { display: flex; width: 100%; justify-content: flex-start; }

/* KanjiSearchView: the kanji found on top, the way to find them at the bottom, in thumb reach */
.kanji-search { display: flex; flex-direction: column; height: 100%; }
.kanji-search-scratchpad { display: flex; align-items: center; padding: 0 var(--lumo-space-m); background: var(--lumo-contrast-5pct); }
.kanji-search-scratchpad .scratchpad { flex-grow: 1; font-size: var(--lumo-font-size-xl); }
.kanji-search-matches { flex: 1 1 0; min-height: 4em; }
.kanji-search-bar { display: flex; align-items: center; border-top: 1px solid var(--lumo-contrast-10pct); }
.kanji-search-bar > vaadin-tabs { flex-grow: 1; min-width: 0; }
/* a phone: icons only, as the old action bar, so that all four fit; the tooltips name them */
@media (max-width: 500px) { .kanji-search-bar vaadin-tab > span { display: none; } }
.kanji-search-method { flex: 0 1 auto; max-height: 60%; overflow: auto; padding: 0 var(--lumo-space-m); }
.kanji-search-method.fills { flex: 2 1 0; max-height: none; display: flex; flex-direction: column; }
.kanji-search-method.fills.enlarged { flex-grow: 3; }
.kanji-search-method-header { display: flex; align-items: center; gap: var(--lumo-space-m); flex-shrink: 0; }
.kanji-search-method-header > span { flex-grow: 1; }
.kanji-pad-sub-view, .kanji-parts-sub-view { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; }
.kanji-pad-sub-view > aedict-kanjipad { flex-grow: 1; min-height: 0; width: 100%; height: auto; border: 1px solid var(--lumo-contrast-20pct); }
.kanji-parts-sub-view > .kanji-search-method-header { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* KanjiPartsGrid: 2.6em cells, a red cell starting each stroke count */
.parts-grid { flex-grow: 1; min-height: 0; overflow: auto; display: flex; flex-wrap: wrap; gap: 2px; align-content: flex-start; }
.parts-grid > * {
  width: 2.6em; height: 2.6em; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--lumo-font-size-xl); border-radius: var(--lumo-border-radius-s);
}
.parts-grid > button { border: 1px solid var(--lumo-contrast-20pct); background: var(--lumo-base-color); color: var(--lumo-body-text-color); cursor: pointer; padding: 0; font-family: inherit; }
.parts-grid > button img { max-width: 80%; max-height: 80%; }
.parts-grid > button.selected { background: var(--lumo-primary-color); color: var(--lumo-primary-contrast-color); }
.parts-grid > button.selected img { filter: invert(1); }
.parts-grid > button:disabled { color: var(--lumo-disabled-text-color); background: var(--lumo-contrast-5pct); cursor: default; }
.parts-grid > button:disabled img { opacity: 0.3; }
.parts-grid-divider { background: #c62828; color: #fff; }

/* SkipWizardSubView */
.skip-card { display: flex; align-items: center; gap: var(--lumo-space-m); padding: var(--lumo-space-s); margin-bottom: var(--lumo-space-s); border: 1px solid var(--lumo-contrast-10pct); border-radius: var(--lumo-border-radius-l); }
.skip-card-caption { font-size: var(--lumo-font-size-xxl); white-space: nowrap; }

/* SettingsView */
.settings { padding: 0 var(--lumo-space-m) var(--lumo-space-l); max-width: 40em; overflow: auto; height: 100%; box-sizing: border-box; }
.settings > vaadin-select, .settings > vaadin-multi-select-combo-box, .settings > vaadin-checkbox { display: flex; width: 100%; }
.settings > h3 { margin: var(--lumo-space-l) 0 var(--lumo-space-xs); }

/* EntrySidePane: the user's tag and notepad categories beside an entry */
/* clear of the list's "Select" button, which floats over the first row */
.entry-list-row > .entry-side-pane { margin-right: var(--lumo-size-s); }
.entry-list-row > .entry-list-row-menu { flex-shrink: 0; margin-right: var(--lumo-size-s); }
.entry-side-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  max-width: 6em;
}
.entry-side-pane-notepad {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: var(--lumo-font-size-xxs);
  color: var(--lumo-secondary-text-color);
  text-align: center;
  overflow-wrap: anywhere;
  padding: var(--lumo-space-xs);
}

/* EditTagDialog */
.tag-color-swatch {
  display: inline-block;
  min-width: 2em;
  height: 1.5em;
  line-height: 1.5em;
  text-align: center;
  border-radius: var(--lumo-border-radius-m);
}
aedict-tag-editor { display: block; width: min(30em, 80vw); }
.tag-editor-toolbar { display: flex; gap: var(--lumo-space-xs); margin-bottom: var(--lumo-space-xs); }
.tag-editor-toolbar button {
  min-width: 2.2em;
  font: inherit;
  background: var(--lumo-contrast-5pct);
  border: 1px solid var(--lumo-contrast-20pct);
  border-radius: var(--lumo-border-radius-s);
  cursor: pointer;
}
.tag-editor-text {
  min-height: 8em;
  padding: var(--lumo-space-s);
  border: 1px solid var(--lumo-contrast-30pct);
  border-radius: var(--lumo-border-radius-m);
  white-space: pre-wrap;
}
.tag-editor-text:focus { outline: 2px solid var(--lumo-primary-color-50pct); }

/* CsvExport: the download link sits among the dialog's buttons */
.csv-download { align-self: center; font-weight: 500; }

/* SRS boxes in an EntryList, with Settings.isShowSRSProgressInLists: the KanjiGrid's colors */
.entry-list-row.srs0 :is(.entry-kanji, .entry-jp, .entry-sentence) { background-color: rgba(189, 189, 189, 0.33); }
.entry-list-row.srs1 :is(.entry-kanji, .entry-jp, .entry-sentence) { background-color: rgba(239, 83, 80, 0.33); }
.entry-list-row.srs2 :is(.entry-kanji, .entry-jp, .entry-sentence) { background-color: rgba(255, 167, 38, 0.33); }
.entry-list-row.srs3 :is(.entry-kanji, .entry-jp, .entry-sentence) { background-color: rgba(255, 238, 88, 0.33); }
.entry-list-row.srs4 :is(.entry-kanji, .entry-jp, .entry-sentence) { background-color: rgba(212, 225, 87, 0.33); }
.entry-list-row.srs5 :is(.entry-kanji, .entry-jp, .entry-sentence) { background-color: rgba(76, 175, 80, 0.33); }

/* QuizView: the card and the pad scroll, the answer buttons stay at the bottom */
.quiz-type { flex-grow: 1; align-self: center; padding: 0 var(--lumo-space-m); color: var(--lumo-secondary-text-color); }
.entry-detail-toolbar:has(.quiz-type) { justify-content: flex-start; }
.quiz-help { padding: var(--lumo-space-xs) var(--lumo-space-m); font-size: var(--lumo-font-size-s); color: var(--lumo-secondary-text-color); }
.quiz-content {
  width: 100%; box-sizing: border-box; min-height: 0; overflow: auto;
  display: flex; flex-direction: column; gap: var(--lumo-space-s); padding: 0 var(--lumo-space-m);
}
.quiz-card { font-size: var(--lumo-font-size-l); }
.quiz-card.word-item .entry-jp { font-size: var(--lumo-font-size-xxl); }
.quiz-content > aedict-kanjipad { flex: 1 0 300px; width: 100%; border: 1px solid var(--lumo-contrast-20pct); }
.quiz-right { color: var(--lumo-success-text-color); }
.quiz-wrong { color: var(--lumo-error-text-color); }
.quiz-buttons {
  width: 100%; box-sizing: border-box; display: flex; flex-wrap: wrap; gap: var(--lumo-space-s);
  padding: var(--lumo-space-s) var(--lumo-space-m); border-top: 1px solid var(--lumo-contrast-10pct);
}
.quiz-buttons > vaadin-button:not([theme~="icon"]) { flex: 1 1 auto; }

/* QuizLaunchView */
.quiz-launch-filter {
  width: 100%; box-sizing: border-box; padding: var(--lumo-space-xs) var(--lumo-space-m);
  background: var(--lumo-contrast-5pct); display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--lumo-space-m);
}
.quiz-launch-categories { width: 100%; box-sizing: border-box; min-height: 0; overflow: auto; padding: 0 var(--lumo-space-m); }
.quiz-launch-group-caption { margin-top: var(--lumo-space-m); font-weight: bold; }
.quiz-launch-group { display: flex; flex-wrap: wrap; column-gap: var(--lumo-space-m); }
.quiz-launch-start { margin: var(--lumo-space-s) var(--lumo-space-m); align-self: flex-end; }

/* ReviewLearningProgressView */
.progress-review-bar { width: 100%; box-sizing: border-box; padding: 0 var(--lumo-space-m); background: var(--lumo-contrast-5pct); }
