/* Flashcards: Quizlet-style study cards, the deck list, and the pick bar over words chosen in the reader. */

.due-badge { display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 3px; border-radius: 999px;
  background: var(--rec); color: #fff; font-size: 11px; line-height: 16px; font-weight: 700; }
.mode-switch button.on .due-badge { background: #fff; color: var(--accent); }

/* floating buttons under the words picked in the reader: ✨ Explain / ＋ Flashcard */
.pick-bar { position: fixed; z-index: 60; display: flex; border-radius: 999px; overflow: hidden;
  background: var(--ink); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.pick-bar button { border: 0; background: none; color: var(--bg); padding: 8px 14px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.pick-bar button + button:not(.hidden) { border-left: 1px solid rgba(127,127,127,.45); }

.cards-view { max-width: 760px; margin: 0 auto; }
.deck-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 16px; }
.deck-count { font-size: 15px; } .deck-count b { font-size: 22px; color: var(--accent); }
.deck-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.deck-actions select { padding: 5px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }

/* study session */
.study-top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.study-bar { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.study-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.flip { perspective: 1400px; height: min(52vh, 400px); cursor: pointer; outline: none; touch-action: pan-y; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .45s cubic-bezier(.2,.7,.2,1); transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.08);
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 52px 28px 24px; overflow-y: auto; }
.face.back { transform: rotateY(180deg); }
/* centre when there is room, start at the top when the text is long (never slide under the buttons) */
.face { justify-content: flex-start; }
.face::before, .face::after { content: ""; margin: auto 0; }
.face .big-word { font-size: clamp(30px, 7vw, 44px); font-weight: 700; letter-spacing: .3px; }
.face .pos { color: var(--muted); font-style: italic; margin-top: 4px; }
.face .ctx { margin-top: 18px; font: 17px/1.6 Georgia, serif; color: var(--muted); max-width: 560px; }
.face .ctx b { color: var(--ink); }
.face .def { font-size: 20px; line-height: 1.5; max-width: 560px; }
.face .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-top: 16px; }
.face .small-txt { font-size: 16px; line-height: 1.5; max-width: 560px; margin-top: 4px; }
.face .face-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }
.face .face-tools button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.flip.fly-left .flip-inner { transform: translateX(-120%) rotate(-12deg); opacity: 0; transition: transform .3s, opacity .3s; }
.flip.fly-right .flip-inner { transform: translateX(120%) rotate(12deg); opacity: 0; transition: transform .3s, opacity .3s; }
.flip.fly-left.flipped .flip-inner { transform: translateX(-120%) rotate(-12deg) rotateY(180deg); }
.flip.fly-right.flipped .flip-inner { transform: translateX(120%) rotate(12deg) rotateY(180deg); }
.study-btns { display: flex; gap: 12px; margin-top: 16px; }
.study-btns button { flex: 1; padding: 14px; border-radius: 14px; font-size: 17px; font-weight: 700; cursor: pointer; border: 2px solid; background: var(--surface); }
.study-btns .no { color: var(--bad); border-color: var(--bad); }
.study-btns .yes { color: var(--good); border-color: var(--good); }
.study-hint { text-align: center; margin-top: 10px; }
.study-done { text-align: center; padding: 36px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.study-done .big { font-size: 40px; }

/* deck list */
.card-list { display: grid; gap: 8px; }
.card-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.card-row .w { font-weight: 700; font-size: 16px; } .card-row .w small { font-weight: 400; color: var(--muted); font-style: italic; }
.card-row .d { font-size: 14px; color: var(--muted); grid-column: 1; }
.card-row .r { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 6px; align-items: center; }
.card-row .due { font-size: 12px; color: var(--muted); white-space: nowrap; }
.card-row .err { color: var(--mid); font-size: 13px; }
.card-empty { color: var(--muted); padding: 16px; text-align: center; }

@media (max-width: 760px) {
  .flip { height: 58vh; }
  .face { padding: 50px 18px 20px; }
}

.face .ipa-line { color: var(--muted); font-size: 16px; margin-top: 4px; font-family: "Lucida Grande", "Segoe UI", sans-serif; }
.card-row .ipa { color: var(--muted); font-style: normal; margin-left: 6px; }
