/**
 * Theory Player HUD — P4 "Vương Quốc Cờ". Compact level/streak pill + XP bar,
 * the "+XP" flight and the level-up ceremony. Transform/opacity only.
 */

/* P5: pill có thể là <a> (link sang "Hồ sơ của em") — không được trông như link */
a.ckhud,
a.ckhud:hover,
a.ckhud:focus {
  text-decoration: none;
  color: #3730a3;
}

a.ckhud:hover {
  border-color: #a5b4fc;
  filter: brightness(1.03);
}

.ckhud {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 4px 14px 8px;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border: 2px solid #c7d2fe;
  border-radius: 999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #3730a3;
  white-space: nowrap;
}
.ckhud-piece { font-size: 17px; }
.ckhud-streak { color: #ea580c; }
.ckhud-streak b { font-variant-numeric: tabular-nums; }
.ckhud-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 4px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.18);
  overflow: hidden;
}
.ckhud-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #818cf8, #6366f1);
  transition: width 0.5s ease;
}

/* "+XP" flight (fixed — flies from board to the HUD pill) */
.ckhud-fly {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 900;
  font-size: 18px;
  color: #16a34a;
  text-shadow: 0 1px 0 #fff, 0 0 10px rgba(34, 197, 94, 0.5);
  animation: ckhudFly 0.9s cubic-bezier(0.3, 0.7, 0.4, 1) forwards;
}
@keyframes ckhudFly {
  0%   { transform: translate(0, 0) scale(1); opacity: 0; }
  15%  { opacity: 1; transform: translate(0, -8px) scale(1.25); }
  100% { transform: translate(var(--ckhud-dx, 0px), var(--ckhud-dy, -120px)) scale(0.6); opacity: 0; }
}

/* Level-up ceremony */
.ckhud-levelup {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  font-family: 'Inter', system-ui, sans-serif;
}
.ckhud-levelup-card {
  background: #fff;
  border: 4px solid #fbbf24;
  border-radius: 24px;
  padding: 26px 34px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.35);
  animation: ckhudCardPop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) forwards;
  max-width: 90vw;
}
@keyframes ckhudCardPop {
  0%   { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.ckhud-levelup-crown { font-size: 52px; animation: ckhudCrown 1.2s ease-in-out infinite; }
@keyframes ckhudCrown { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.ckhud-levelup-title { font-size: 15px; font-weight: 900; letter-spacing: 3px; color: #d97706; margin-top: 6px; }
.ckhud-levelup-name { font-size: 26px; font-weight: 900; color: #1e293b; margin-top: 4px; }
.ckhud-levelup-sub { font-size: 14px; font-weight: 600; color: #64748b; margin-top: 6px; }
.ckhud-levelup-btn {
  margin-top: 18px;
  min-height: 48px;
  padding: 0 30px;
  border: none;
  border-radius: 999px;
  background: #22c55e;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #15803d;
  transition: transform 0.15s ease;
}
.ckhud-levelup-btn:hover { transform: scale(1.05); }
.ckhud-levelup-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #15803d; }

@media (max-width: 768px) {
  .ckhud { font-size: 11px; padding: 3px 10px 7px; }
  .ckhud-piece { font-size: 14px; }
  .ckhud-levelup-name { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  .ckhud-fly { display: none !important; }
  .ckhud-levelup-crown { animation: none; }
  .ckhud-levelup-card { animation-duration: 0.01s; }
  .ckhud-bar-fill { transition: none; }
}

/* ---- P9 "Nhiệm vụ hôm nay" — chip + panel ---------------------------- */
.ckhud-quest-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ckhud-quest-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12); }
.ckhud-quest-btn.is-all-done {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-color: #f59e0b;
  color: #fff;
}
.ckhud-quests {
  position: absolute;
  z-index: 1080;
  width: 252px;
  background: #fff;
  border: 2px solid #eadffb;
  border-radius: 16px;
  box-shadow: 0 16px 34px -18px rgba(90, 60, 150, 0.5);
  padding: 12px 14px;
  font-family: 'Inter', sans-serif;
}
.ckhud-quests-title { font-size: 13px; font-weight: 800; color: #3a2b5f; margin-bottom: 8px; }
.ckhud-quests-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ckhud-quest {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  background: #f8fafc;
  border-radius: 10px;
  padding: 7px 9px;
}
.ckhud-quest .q-label { flex: 1 1 auto; }
.ckhud-quest .q-prog { font-weight: 800; color: #94a3b8; font-variant-numeric: tabular-nums; }
.ckhud-quest.is-done { background: #ecfdf5; color: #065f46; }
.ckhud-quest.is-done .q-prog { color: #10b981; }
.ckhud-quests-bonus { margin-top: 9px; font-size: 11.5px; font-weight: 700; color: #b45309; text-align: center; }

/* ---- P9 "Lớn rồi!" — chế độ bé lớn: ẩn trang trí trẻ con (trang tập) ---- */
.ck-age-big .ck-board-scene { display: none !important; }
.ck-age-big .ckms { display: none !important; }
