/* Flashcards. Colours and type come from ../shared/theme.css. */

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: var(--lattice);
  font-family: var(--serif);
  color: var(--ink);
}

#app {
  width: min(720px, calc(100% - 48px));
  margin: 28px auto 64px;
}

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

.cards-head { margin-bottom: 22px; }
.cards-head h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 600;
}
.cards-sub {
  margin: 10px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 3px 0 -2px var(--line);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-2);
}

.btn-back {
  display: inline-block;
  margin-bottom: 14px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.btn-back:hover { border-color: var(--silk); color: var(--silk); }

/* ---------- panels ---------- */

.cards-panel {
  margin-bottom: 18px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--silk);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.cards-panel h2 {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 600;
}

/* ---------- the strength bar: how well the deck is known ---------- */

.strength-bar {
  display: flex;
  height: 12px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--paper-3);
}
.strength-bar .seg { display: block; }

.seg-learning, .dot-learning { background: var(--silk); }
.seg-familiar, .dot-familiar { background: #c2763f; }
.seg-known,    .dot-known    { background: var(--jade); }
.seg-mastered, .dot-mastered { background: #4f6b55; }
.seg-new,      .dot-new      { background: var(--paper-3); }

.strength-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}
.strength-legend li { display: inline-flex; align-items: center; gap: 7px; }
.strength-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.legend-label { color: var(--ink-2); }
.legend-count { font-weight: 600; }

/* ---------- queue ---------- */

.queue-line { margin: 0 0 16px; font-size: 19px; }
.queue-line strong { font-size: 24px; font-weight: 600; }
.queue-sep { color: var(--ink-3); }
.queue-done { margin: 0; font-size: 17px; color: var(--ink-2); }
.queue-note { margin: 12px 0 0; font-size: 14px; color: var(--ink-3); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 26px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper-2);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.btn-primary:hover { background: var(--silk); }

.cards-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-ghost {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--silk); color: var(--silk); }

.session-done {
  margin: 0 0 18px;
  padding: 10px 14px;
  border-left: 2px solid var(--jade);
  background: var(--jade-l);
  font-size: 15px;
}

.cards-error { font-size: 17px; color: var(--silk); }

/* ---------- browse ---------- */

.word-list { margin: 0; padding: 0; list-style: none; }
.word-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--paper-2);
  margin-bottom: 8px;
}
.word-thai {
  flex: none;
  min-width: 110px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 26px;
  /* Thai hangs vowels and tone marks above and below the line; 1.0 clips
     them. */
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}
.word-thai:hover { color: var(--silk); }
.word-text { flex: 1; min-width: 0; }
.word-roman { display: block; font-size: 15px; color: var(--ink-2); }
.word-english { display: block; font-size: 15px; }
.word-meta { flex: none; text-align: right; }
.word-due { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-3); }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.tag-new      { background: var(--paper-3); color: var(--ink-3); }
.tag-learning { background: var(--silk); color: var(--paper-2); }
.tag-familiar { background: #c2763f; color: var(--paper-2); }
.tag-known    { background: var(--jade); color: var(--paper-2); }
.tag-mastered { background: #4f6b55; color: var(--paper-2); }

/* ---------- session ---------- */

.session-top { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.btn-close {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.btn-close:hover { color: var(--silk); }
.session-progress {
  flex: 1;
  height: 6px;
  border-radius: var(--radius);
  background: var(--paper-3);
  overflow: hidden;
}
.session-fill { display: block; height: 100%; background: var(--silk); transition: width 0.2s; }
.session-count { flex: none; font-size: 13px; color: var(--ink-3); }

.card-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 44px 24px 34px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--silk);
  border-radius: var(--radius);
  background: var(--paper-2);
  text-align: center;
}
.card-flag {
  padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--silk);
  color: var(--paper-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
/* A Thai word runs from ดี to คอมพิวเตอร์, so the face is sized to the
   viewport and allowed to wrap rather than set at one heroic size. */
.card-thai {
  font-size: clamp(40px, 11vw, 78px);
  line-height: 1.45;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.card-roman { font-size: 26px; color: var(--silk); }
.card-english { font-size: 21px; color: var(--ink-2); }
.card-note {
  max-width: 30em; margin: 14px auto 0; padding: 3px 0 3px 12px;
  border-left: 2px solid var(--gold);
  font-size: 14px; line-height: 1.55; color: var(--ink-3); text-align: left;
}
.card-hint { font-size: 16px; color: var(--ink-3); }

/* The word in a sentence. Set apart from the answer above it by a rule and a
   ground of its own, so the face reads as two things — what the word means,
   and what it looks like in use — rather than one list that keeps going. */
.card-eg {
  position: relative;
  width: min(100%, 30em);
  margin-top: 18px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.eg-label {
  position: absolute;
  top: -8px;
  left: 14px;
  padding: 1px 8px;
  background: var(--paper-2);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eg-thai {
  font-size: clamp(22px, 4.4vw, 28px);
  line-height: 1.6;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.eg-roman { margin-top: 4px; font-size: 15px; color: var(--silk); }
.eg-english { margin-top: 2px; font-size: 15px; color: var(--ink-2); font-style: italic; }
.eg-who { margin-left: 7px; font-size: 13px; font-style: normal; color: var(--ink-3); }

/* ---------- the one option ---------- */

.opt-row { display: flex; justify-content: flex-end; margin: 0 0 16px; }
.btn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.btn-toggle:hover { border-color: var(--silk); color: var(--ink-2); }
/* The switch itself: a box that fills rather than a sliding track, which is
   the one shape the rest of the site already uses for on and off. */
.toggle-box {
  flex: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
}
.btn-toggle.on { border-color: var(--silk); color: var(--ink-2); }
.btn-toggle.on .toggle-box { background: var(--silk); border-color: var(--silk); }
.toggle-eg { color: var(--ink-3); font-size: 12px; opacity: 0.75; }
.btn-toggle.on .toggle-eg { color: var(--silk); opacity: 1; }

.btn-sound {
  margin-top: 4px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.btn-sound:hover { border-color: var(--silk); color: var(--silk); }

.session-foot { display: flex; gap: 10px; margin-top: 22px; }
.session-foot .btn-primary { flex: 1; }

.btn-grade {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 62px;
  padding: 10px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.grade-label { font-size: 16px; font-weight: 600; }
.grade-when { font-size: 12px; color: var(--ink-3); }
.btn-grade:hover { background: var(--paper-2); }
.grade-again { border-color: var(--silk); color: var(--silk); }
.grade-again .grade-when { color: var(--silk); }
.grade-easy { border-color: var(--jade); }

.session-keys {
  margin: 16px 0 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

@media (max-width: 760px) {
  #app { width: min(100% - 24px, 720px); margin-top: 14px; }
  .cards-panel { padding: 18px 16px; }
  .word-row { gap: 12px; padding: 10px; }
  .word-thai { min-width: 88px; font-size: 22px; }
  .session-foot { flex-direction: column; }
}

/* Headings share the lessons' display face, so the two halves of the site
   speak in one voice. */
.cards-head h1,
.cards-panel h2 { font-family: var(--display); }
.card-thai,
.eg-thai { font-family: var(--display); }

/* Met / All. Two words of chrome: the list is the thing, and a control that
   looked like a toolbar would weigh more than what it filters. */
.word-tabs { display: flex; gap: 8px; margin: 0 0 14px; }
.word-tab {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.word-tab:hover { border-color: var(--silk); color: var(--ink-2); }
.word-tab.on { border-color: var(--silk); background: var(--silk); color: var(--paper-2); }

/* What the scheduler knows about this word, under its meaning. */
.word-srs { display: block; margin-top: 3px; font-size: 12px; color: var(--ink-3); }
