/* =========================================================
   Sam Kido - Cấp độ tự thích ứng, gợi ý trả lời, huy hiệu,
   thẻ phòng mới & Góc Phụ Huynh v2
   ========================================================= */

/* ---------- Thẻ trang chủ cho 2 phòng mới ---------- */
.card-memory-lab {
  background: linear-gradient(180deg, #F3EBFF 0%, #FFFFFF 100%);
  border-color: #9D65FF;
}
.card-memory-lab:hover { box-shadow: 0 16px 30px rgba(157, 101, 255, 0.32); }
.card-memory-lab .cat-icon-wrap { background: linear-gradient(135deg, #9D65FF, #C084FC); }
.card-memory-lab .cat-badge { color: #7C3AED; }

.card-logic-lab {
  background: linear-gradient(180deg, #E6F6FF 0%, #FFFFFF 100%);
  border-color: #3AA8F7;
}
.card-logic-lab:hover { box-shadow: 0 16px 30px rgba(58, 168, 247, 0.32); }
.card-logic-lab .cat-icon-wrap { background: linear-gradient(135deg, #3AA8F7, #38D39F); }
.card-logic-lab .cat-badge { color: #0369A1; }

.sk-new-ribbon {
  position: absolute;
  top: 14px;
  right: -34px;
  transform: rotate(35deg);
  background: linear-gradient(135deg, #FF5E7E, #FF9F1C);
  color: #fff;
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 4px 40px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* ---------- Nhãn "Ôn lại" trên câu hỏi bé từng làm sai ---------- */
.sk-review-chip {
  display: inline-block;
  margin-left: 6px;
  background: #FFF4CC;
  border: 2px solid #FFD13B;
  color: #92400E;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}

/* ---------- Lộ trình "Học hôm nay" ---------- */
.dp-card {
  background: linear-gradient(135deg, #EEF6FF 0%, #FFFFFF 60%, #F6F0FF 100%);
  border: 4px solid #9D65FF;
  border-radius: 28px;
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--clay-shadow);
}

.dp-card.dp-done {
  border-color: #38D39F;
  background: linear-gradient(135deg, #ECFDF5 0%, #FFFFFF 70%);
}

.dp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.dp-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 900;
  color: #4C1D95;
}

.dp-sub {
  font-size: 0.95rem;
  color: #5A6270;
  font-weight: 700;
}

.dp-ring {
  flex-shrink: 0;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
  color: #4C1D95;
  background:
    radial-gradient(closest-side, #fff 76%, transparent 77%),
    conic-gradient(#9D65FF calc(var(--p, 0) * 1%), #E4DAFF 0);
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

.dp-tasks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dp-task {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 2px solid #EEE9FF;
  border-radius: 18px;
  padding: 10px 12px;
}

.dp-task-done {
  background: #F2FBF7;
  border-color: #BDEFD9;
}

.dp-task-icon {
  font-size: 1.7rem;
  flex-shrink: 0;
}

.dp-task-info {
  flex: 1;
  min-width: 0;
}

.dp-task-title {
  font-weight: 800;
  font-size: 0.98rem;
  color: #2B2D42;
  margin-bottom: 5px;
}

.dp-task-bar {
  height: 9px;
  background: #EEE9FF;
  border-radius: 9px;
  overflow: hidden;
}

.dp-task-bar > span {
  display: block;
  height: 100%;
  border-radius: 9px;
  background: linear-gradient(90deg, #9D65FF, #38D39F);
  transition: width 0.4s ease;
}

.dp-task-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.dp-task-count {
  font-weight: 900;
  color: #5A6270;
  font-size: 0.9rem;
}

.dp-go {
  border: none;
  background: linear-gradient(135deg, #9D65FF, #7C3AED);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 0 #6D28D9;
}

.dp-go:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #6D28D9;
}

/* ---------- Khu rèn luyện trí não trên trang chủ ---------- */
.sk-rooms-section {
  margin-bottom: 26px;
}

.sk-rooms-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: #2B2D42;
  text-align: center;
  margin-bottom: 4px;
}

.sk-rooms-sub {
  text-align: center;
  color: #5A6270;
  font-weight: 700;
  margin-bottom: 14px;
}

.sk-rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.sk-room-card {
  background: #fff;
  border: 3px solid #E4DAFF;
  border-radius: 22px;
  padding: 16px 14px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  position: relative;
}

.sk-room-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 26px rgba(124, 58, 237, 0.18);
}

.sk-room-icon {
  font-size: 2.6rem;
  line-height: 1;
}

.sk-room-name {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 900;
  margin: 6px 0 4px;
}

.sk-room-desc {
  font-size: 0.86rem;
  color: #5A6270;
  font-weight: 600;
  line-height: 1.35;
}

.sk-room-tag {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  background: #F4F1FF;
  color: #7C3AED;
}

@media (max-width: 640px) {
  .dp-card { padding: 14px; border-radius: 22px; }
  .dp-title { font-size: 1.2rem; }
  .dp-sub { font-size: 0.86rem; }
  .dp-ring { width: 60px; height: 60px; font-size: 0.95rem; }
  .dp-task-title { font-size: 0.9rem; }
  .dp-go { font-size: 0.82rem; padding: 9px 11px; }
  .sk-rooms-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .sk-room-card { padding: 12px 8px; }
  .sk-room-icon { font-size: 2.1rem; }
  .sk-room-name { font-size: 0.95rem; }
  .sk-room-desc { font-size: 0.76rem; }
}

/* ---------- Thẻ chọn bản đồ tri thức ---------- */
.map-pack-card .island-icon-wrap {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

/* Thẻ bản đồ: thanh tiến độ ở trên, nút khám phá chiếm trọn hàng dưới */
.map-pack-card .island-footer {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.map-pack-card .btn-play-island {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
}

.map-pack-bar {
  width: 100%;
  height: 10px;
  background: #EEE9FF;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.map-pack-bar > span {
  display: block;
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, #FFD13B, #38D39F);
  transition: width 0.4s ease;
}

.overworld-title-box .btn-back-stage {
  margin-bottom: 8px;
}

/* ---------- Thanh cấp độ có khóa ---------- */
.sk-level-bar { flex-wrap: wrap; max-width: 100%; min-width: 0; box-sizing: border-box; }
.caro-setup-bar .sk-level-bar { width: 100%; margin-top: 8px; }
.diff-pill-btn.sk-locked {
  opacity: 0.55;
  filter: grayscale(0.6);
  border-style: dashed;
}
.sk-auto-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #5A6270;
  background: #F4F1FF;
  border: 2px solid #E4DAFF;
  border-radius: 999px;
  padding: 5px 10px;
}
.sk-progress {
  display: inline-block;
  width: 54px;
  height: 8px;
  border-radius: 8px;
  background: #E4DAFF;
  overflow: hidden;
}
.sk-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #9D65FF, #38D39F);
  border-radius: 8px;
  transition: width 0.4s ease;
}

/* ---------- Trợ lý trả lời: loại đáp án, rung, hé lộ ---------- */
.sk-shake { animation: sk-shake 0.5s ease; }
@keyframes sk-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.sk-eliminated {
  opacity: 0.25 !important;
  transform: scale(0.92);
  filter: grayscale(1);
  transition: all 0.35s ease;
  pointer-events: none;
}
.sk-reveal { animation: sk-glow 1s ease-in-out 3; }
@keyframes sk-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56, 211, 159, 0.0); }
  50% { box-shadow: 0 0 0 8px rgba(56, 211, 159, 0.45); }
}

/* ---------- Toast ---------- */
#sk-toast-wrap {
  position: fixed;
  left: 50%;
  top: 84px;
  transform: translateX(-50%);
  z-index: 10050;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.sk-toast {
  background: #fff;
  border: 3px solid #E4DAFF;
  color: #2B2D42;
  border-radius: 18px;
  padding: 12px 16px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(78, 93, 140, 0.2);
  opacity: 0;
  transform: translateY(-12px);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}
.sk-toast.show { opacity: 1; transform: translateY(0); }
.sk-toast-badge { border-color: #FFD13B; background: #FFFBEA; }

/* ---------- Banner lên cấp ---------- */
.sk-levelup-banner {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(157, 101, 255, 0.12);
  animation: sk-fade-in 0.3s ease;
}
.sk-levelup-banner.hide { opacity: 0; transition: opacity 0.45s ease; }
.sk-levelup-inner {
  background: linear-gradient(135deg, #9D65FF, #3AA8F7);
  color: #fff;
  padding: 26px 40px;
  border-radius: 32px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(78, 60, 160, 0.35);
  border: 5px solid #fff;
  animation: sk-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sk-levelup-icon { font-size: 3.4rem; }
.sk-levelup-title { font-family: var(--font-display); font-size: 2.2rem; font-weight: 900; letter-spacing: 0.05em; }
.sk-levelup-sub { font-size: 1.2rem; font-weight: 800; margin-top: 4px; }
@keyframes sk-pop { 0% { transform: scale(0.3); } 100% { transform: scale(1); } }
@keyframes sk-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Kệ huy hiệu ---------- */
.sk-badge-card { margin-top: 20px; }
.sk-badge-heading {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 6px;
}
.sk-badge-count {
  font-size: 1rem;
  background: #FFF4CC;
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 6px;
}
.sk-badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.sk-badge-item {
  background: #fff;
  border: 3px solid #EEE;
  border-radius: 20px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.sk-badge-item:hover { transform: translateY(-3px); }
.sk-badge-item.owned { border-color: #FFD13B; background: linear-gradient(180deg, #FFFBEA, #fff); }
.sk-badge-item.locked { opacity: 0.6; }
.sk-badge-icon { font-size: 2.3rem; }
.sk-badge-name { font-weight: 900; font-size: 0.92rem; margin-top: 4px; }
.sk-badge-desc { font-size: 0.78rem; color: #5A6270; margin-top: 2px; }

/* ---------- Góc Phụ Huynh v2 ---------- */
.pd-modal-card {
  max-width: 860px;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pd-modal-card .modal-title { padding: 0 44px; }
.pd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #F6F3FF;
  border-radius: 18px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.pd-name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 900; }
.pd-band { font-size: 0.9rem; color: #5A6270; }
.pd-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.pd-tile {
  background: #fff;
  border: 2px solid #EEE9FF;
  border-radius: 16px;
  padding: 10px 12px;
}
.pd-tile-val { font-family: var(--font-display); font-size: 1.4rem; font-weight: 900; color: #2B2D42; }
.pd-tile-label { font-size: 0.82rem; color: #5A6270; font-weight: 700; }
.pd-tile-sub { font-size: 0.78rem; color: #7C3AED; font-weight: 800; }
.pd-section {
  background: #fff;
  border: 2px solid #F0ECFA;
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.pd-title { font-family: var(--font-display); font-size: 1.08rem; font-weight: 900; margin-bottom: 6px; }
.pd-note { font-size: 0.86rem; color: #5A6270; }
.pd-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pd-two-col .pd-section { margin-bottom: 12px; }
.pd-list { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; }
.pd-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pd-go-btn {
  border: none;
  background: #9D65FF;
  color: #fff;
  font-weight: 800;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}

.pd-radar-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; }
.pd-radar { width: 240px; max-width: 100%; height: auto; }
.pd-radar-ring { fill: none; stroke: #E6E1F5; stroke-width: 1; }
.pd-radar-area { fill: rgba(157, 101, 255, 0.22); stroke: #7C3AED; stroke-width: 2; stroke-linejoin: round; }
.pd-radar-dot { fill: #7C3AED; stroke: #fff; stroke-width: 2; cursor: pointer; }
.pd-radar-dot:hover { r: 7; }
.pd-radar-label { font-size: 18px; }
.pd-area-list { list-style: none; min-width: 200px; display: flex; flex-direction: column; gap: 6px; }
.pd-area-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 0.92rem; border-bottom: 1px dashed #EEE; padding-bottom: 4px; }
.pd-area-val { font-weight: 900; color: #2B2D42; }
.pd-area-val em { font-weight: 600; color: #9AA0AA; font-style: normal; font-size: 0.82rem; }

.pd-trend { width: 100%; max-width: 480px; height: auto; display: block; margin: 0 auto; }
.pd-axis { stroke: #D9D4E8; stroke-width: 1; }
.pd-bar { fill: #9D65FF; }
.pd-bar-g:hover .pd-bar { fill: #7C3AED; }
.pd-bar-val { font-size: 11px; font-weight: 800; fill: #2B2D42; }
.pd-bar-label { font-size: 10px; fill: #5A6270; font-weight: 700; }

.pd-table-wrap { overflow-x: auto; }
.pd-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 520px; }
.pd-table th, .pd-table td { padding: 7px 8px; text-align: left; border-bottom: 1px solid #F0ECFA; }
.pd-table th { background: #F6F3FF; font-weight: 900; color: #4B4F5C; }
.pd-table td small { color: #9AA0AA; }

.pd-setting { margin-bottom: 12px; }
.pd-setting > label { display: block; font-weight: 800; font-size: 0.92rem; margin-bottom: 6px; }
.pd-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pd-pill {
  border: 2px solid #E4DAFF;
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: inherit;
}
.pd-pill.active { background: #9D65FF; color: #fff; border-color: #9D65FF; }
.pd-switch { display: flex !important; align-items: center; gap: 8px; cursor: pointer; }
.pd-switch input { width: 20px; height: 20px; accent-color: #9D65FF; }
.pd-voice-status {
  background: #F9F8FC;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.84rem;
  margin: 8px 0;
  line-height: 1.6;
}
.pd-test-voice { margin-top: 4px; }

/* ---------- Toán có lời văn / Đọc hiểu / Điền vần ---------- */
.sk-word-problem {
  background: #FFF8EC;
  border: 3px dashed #FFD08A;
  border-radius: 20px;
  padding: 16px 18px;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.6;
  text-align: center;
  margin: 10px 0 16px;
}
.sk-word-visual { font-size: 1.9rem; margin-top: 6px; letter-spacing: 2px; }
.sk-reading-passage {
  background: #F2FBF7;
  border: 3px solid #BDEFD9;
  border-radius: 20px;
  padding: 16px 18px;
  font-size: 1.2rem;
  line-height: 1.75;
  font-weight: 700;
  margin: 10px 0 14px;
}
.sk-reading-title { font-family: var(--font-display); font-weight: 900; font-size: 1.3rem; margin-bottom: 6px; }
.sk-rhyme-word {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.05em;
  margin: 6px 0 14px;
}
.sk-rhyme-emoji { font-size: 4rem; text-align: center; }
.sk-rhyme-blank { color: #FF5E7E; border-bottom: 5px solid #FF5E7E; padding: 0 6px; }

/* ---------- Luyện viết: điểm chấm thật ---------- */
.sk-write-score { font-size: 1.6rem; letter-spacing: 3px; }

/* Tiêu đề màn hình dài (vd: "Phòng Siêu Trí Nhớ") không bị cắt trên điện thoại */
.view-heading { min-width: 0; flex: 1 1 auto; justify-content: center; flex-wrap: wrap; text-align: center; }
.btn-back-home { flex-shrink: 0; }

@media (max-width: 640px) {
  .view-top-header > div:empty { display: none; }
  /* Thanh cấp độ gọn 1 hàng, vuốt ngang để xem các cấp khác */
  .difficulty-level-bar {
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 6px 10px !important;
    gap: 6px !important;
  }
  .difficulty-level-bar::-webkit-scrollbar { display: none; }
  .difficulty-level-bar > * { flex-shrink: 0; }
  .view-heading { font-size: 1.1rem !important; line-height: 1.25; }
  .pd-two-col { grid-template-columns: 1fr; }
  .pd-modal-card { padding: 22px 14px; border-radius: 22px; }
  .sk-rhyme-word { font-size: 2.3rem; }
  .sk-word-problem, .sk-reading-passage { font-size: 1.08rem; }
  .sk-auto-chip { font-size: 0.75rem; }
}
