/* vocab.css — Giao diện "Học từ vựng" (hoctu.php + hoctu_flashcard.php) */

.vocab-wrap { max-width: 1000px; margin: 0 auto; padding: 16px; }

/* ==== Cổng nhập Mã TTS ==== */
.vocab-gate { max-width: 440px; margin: 40px auto; }
.vocab-gate .card { padding: 28px 24px; }
.vocab-gate h1 { font-size: 1.5rem; margin: 0 0 6px; text-align: center; }
.vocab-gate p.sub { text-align: center; color: #64748b; margin: 0 0 20px; }
.vocab-gate input[type=text] {
  width: 100%; padding: 13px 14px; font-size: 1.1rem; letter-spacing: .5px;
  border: 2px solid #cbd5e1; border-radius: 10px; text-align: center; box-sizing: border-box;
}
.vocab-gate input[type=text]:focus { outline: none; border-color: #6366f1; }
.vocab-err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
  padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-size: .92rem; }

/* ==== Bảng điều khiển ==== */
.vocab-hello { display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  justify-content: space-between; margin: 8px 0 18px; }
.vocab-hello .who { font-size: 1.05rem; }
.vocab-hello .who b { color: #4338ca; }
.vocab-sum { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.vocab-stat { flex: 1 1 130px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 12px 14px; text-align: center; }
.vocab-stat .n { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.vocab-stat .l { font-size: .8rem; color: #64748b; }
.vocab-stat.due .n { color: #d97706; }
.vocab-stat.new .n { color: #2563eb; }
.vocab-stat.mature .n { color: #16a34a; }

.vocab-search { width: 100%; padding: 11px 14px; font-size: 1rem; margin-bottom: 14px;
  border: 1px solid #cbd5e1; border-radius: 10px; box-sizing: border-box; }

.nganh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.nganh-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px; }
.nganh-card h3 { margin: 0; font-size: 1.05rem; }
.nganh-meta { font-size: .82rem; color: #64748b; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nganh-bar { height: 8px; background: #eef2ff; border-radius: 999px; overflow: hidden; }
.nganh-bar > i { display: block; height: 100%; background: linear-gradient(90deg,#34d399,#16a34a); }
.nganh-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.pill-due { background: #fef3c7; color: #92400e; border-radius: 999px; padding: 1px 9px; font-weight: 600; }
.pill-new { background: #dbeafe; color: #1e40af; border-radius: 999px; padding: 1px 9px; font-weight: 600; }
.pill-done { background: #dcfce7; color: #166534; border-radius: 999px; padding: 1px 9px; font-weight: 600; }

/* ==== Phiên học/ôn thẻ ==== */
.flash-top { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.flash-top .back { color: #64748b; text-decoration: none; font-size: .9rem; }
.flash-progress { flex: 1; height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.flash-progress > i { display: block; height: 100%; width: 0; background: #6366f1; transition: width .25s; }
.flash-count { font-size: .85rem; color: #64748b; white-space: nowrap; }

.flash-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 16px;
  min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px 20px; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.05);
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.flash-tag { font-size: .78rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
.flash-jp { font-size: 2.8rem; font-weight: 700; line-height: 1.25; word-break: break-word; }
.flash-audio { margin-top: 14px; border: none; background: #eff6ff; color: #1d4ed8; font-weight: 600;
  font-size: .95rem; padding: 9px 18px; border-radius: 999px; cursor: pointer; display: inline-flex;
  align-items: center; gap: 6px; box-shadow: 0 1px 3px rgba(37,99,235,.15);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: background .15s, transform .1s; }
.flash-audio:hover { background: #dbeafe; }
.flash-audio:active { transform: scale(.94); }
.flash-reveal { margin-top: 18px; padding-top: 18px; border-top: 1px dashed #e5e7eb; width: 100%;
  max-width: 560px; display: none; }
.flash-reveal.show { display: block; }
.flash-kana { font-size: 1.3rem; color: #7c3aed; margin-bottom: 6px; }
.flash-vi { font-size: 1.35rem; color: #0f172a; font-weight: 600; }
.flash-img { max-width: 100%; max-height: 190px; margin: 14px auto 4px; display: block;
  object-fit: contain; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.flash-prompt { margin-top: 14px; color: #94a3b8; font-size: .95rem; font-style: italic; }

/* Ghi chú mục đích — nút gập/mở hiển thị 使用用途 (Nhật + Việt) */
.flash-note { margin-top: 16px; width: 100%; }
.flash-note-toggle { width: 100%; border: 1px solid #e2e8f0; background: #f8fafc; color: #334155;
  font-size: .95rem; font-weight: 600; padding: 10px 14px; border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: background .15s; }
.flash-note-toggle:hover { background: #f1f5f9; }
.flash-note-toggle .chev { transition: transform .18s; font-size: .8rem; color: #94a3b8; }
.flash-note-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.flash-note.caution .flash-note-toggle { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.flash-note.caution .flash-note-toggle:hover { background: #fee2e2; }
.flash-note-label { font-weight: 700; color: #334155; font-size: .95rem; text-align: left;
  display: flex; align-items: center; gap: 8px; }
.flash-note-body { margin-top: 8px; padding: 14px 16px; border: 1px solid #eef2f7; border-radius: 10px;
  background: #fbfdff; text-align: left; }
.flash-note.caution .flash-note-body { border-color: #fecaca; background: #fef2f2; }
.note-jp { font-size: 1.05rem; color: #0f172a; line-height: 1.6; white-space: pre-line; }
.note-vi { margin-top: 8px; font-size: .98rem; color: #475569; line-height: 1.55; white-space: pre-line; }
.note-caution { margin-top: 10px; font-size: .88rem; color: #b91c1c; font-weight: 600; }

.rate-label { text-align: center; color: #475569; font-size: .98rem; line-height: 1.45; margin-bottom: 10px; }
.rate-label b { color: #4338ca; }

.flash-controls { margin-top: 18px; text-align: center; }
.flash-hint { color: #94a3b8; font-size: .82rem; margin-top: 10px; }
.rate-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rate-btn { border: none; border-radius: 10px; padding: 14px 6px; cursor: pointer; color: #fff;
  font-size: 1rem; font-weight: 600; display: flex; flex-direction: column; gap: 2px;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.rate-btn small { font-weight: 400; opacity: .92; font-size: .76rem; }
/* Ẩn gợi ý bàn phím trên thiết bị cảm ứng (điện thoại/máy tính bảng) */
@media (hover: none) and (pointer: coarse) { .only-kb { display: none !important; } }
.rate-1 { background: #ef4444; } .rate-2 { background: #f59e0b; }
.rate-3 { background: #22c55e; } .rate-4 { background: #3b82f6; }
.rate-btn:active { transform: translateY(1px); }

/* Chú thích 4 mức đánh giá cho người học */
.rate-legend { margin-top: 12px; padding: 12px 14px; background: rgba(255,255,255,.06);
  border: 1px solid rgba(148,163,184,.25); border-radius: 10px; text-align: left;
  font-size: .86rem; line-height: 1.7; color: #e2e8f0; }
.rate-legend b { color: #fff; }
.rate-legend .lg-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  margin-right: 7px; vertical-align: middle; }
.rate-legend .lg-1 { background: #ef4444; } .rate-legend .lg-2 { background: #f59e0b; }
.rate-legend .lg-3 { background: #22c55e; } .rate-legend .lg-4 { background: #3b82f6; }
.rate-legend .lg-note { margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(148,163,184,.3);
  color: #cbd5e1; font-size: .82rem; }

/* Thanh thoát: về danh sách nghề / trang chủ */
.flash-exit { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 22px auto 8px; }
.flash-exit-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
  border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(148,163,184,.35);
  color: #e2e8f0; text-decoration: none; font-size: .9rem; font-weight: 600; }
.flash-exit-btn:hover { background: rgba(255,255,255,.16); }

.flash-done { text-align: center; padding: 40px 20px; }
.flash-done .big { font-size: 3rem; }
.flash-done h2 { margin: 8px 0; }
.flash-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px;
  background: #0f172a; color: #fff; padding: 8px 16px; border-radius: 999px; font-size: .88rem;
  opacity: 0; transition: opacity .2s; pointer-events: none; }
.flash-toast.show { opacity: .95; }

@media (max-width: 520px) {
  .vocab-wrap { padding: 12px; }
  .flash-jp { font-size: 2.2rem; }
  .rate-btn { padding: 14px 4px; font-size: .95rem; min-height: 54px; }
  .vocab-stat { flex: 1 1 44%; }               /* 2 ô/hàng gọn gàng */
  .nganh-actions { gap: 8px; }
  .nganh-actions .btn {                         /* nút chạm to hơn trên điện thoại */
    flex: 1 1 auto; min-height: 44px; padding: 9px 12px; font-size: .92rem;
    display: inline-flex; align-items: center; justify-content: center;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  }
}
