/* Claude Academy — 3D Claymorphism UI
   Bảng màu ấm 2026 lấy cảm hứng thương hiệu Claude/Anthropic:
   kem ngà · đất nung (coral clay) · mực ấm · Plus Jakarta Sans */

:root {
  --violet: #d9734e;        /* coral đất nung — màu chủ đạo (giữ tên biến cũ để tương thích) */
  --violet-deep: #b5532f;
  --violet-soft: #ecb59c;
  --bg: #f6f1e8;            /* kem ngà ấm */
  --bg2: #efe5d4;
  --surface: #fffdf8;
  --surface-2: #f3ebdd;
  --ink: #2c2722;           /* mực nâu ấm */
  --muted: #8c8073;
  --green: #4f9d77;
  --gold: #d8943a;
  --rose: #e08a63;          /* coral nhạt ấm cho gradient */
  --clay-out: 0 10px 26px rgba(178, 96, 62, .18), 0 2px 6px rgba(44, 39, 34, .07);
  --clay-in: inset 0 2px 4px rgba(255, 255, 255, .85), inset 0 -5px 10px rgba(178, 96, 62, .08);
  --clay-press: 0 3px 8px rgba(178, 96, 62, .16), 0 1px 2px rgba(44, 39, 34, .08);
  --bounce: cubic-bezier(.34, 1.56, .64, 1);
  --r: 24px;
}
html.dark {
  --violet: #e0865f;
  --violet-deep: #c96440;
  --violet-soft: #a86348;
  --bg: #1d1813;
  --bg2: #251f17;
  --surface: #2a231b;
  --surface-2: #342c22;
  --ink: #f6f1e8;
  --muted: #b3a795;
  --green: #5bb088;
  --gold: #e0a94e;
  --rose: #e0865f;
  --clay-out: 0 10px 26px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  --clay-in: inset 0 2px 4px rgba(255, 255, 255, .06), inset 0 -5px 10px rgba(0, 0, 0, .25);
  --clay-press: 0 3px 8px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(1100px 560px at 50% -8%, var(--bg2), var(--bg));
  color: var(--ink);
  line-height: 1.6;
  min-height: 100dvh;
}
/* Lớp nền trang trí: vầng sáng coral ấm + hoạ tiết tia sáng kiểu Anthropic (rất mờ) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(520px 360px at 85% 6%, rgba(217, 115, 78, .16), transparent 70%),
    radial-gradient(460px 380px at 10% 92%, rgba(79, 157, 119, .12), transparent 70%),
    radial-gradient(600px 420px at 50% 50%, rgba(216, 148, 58, .07), transparent 75%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='%23d9734e' fill-opacity='0.05'%3E%3Cpath d='M40 22c2 9 7 14 16 16-9 2-14 7-16 16-2-9-7-14-16-16 9-2 14-7 16-16z'/%3E%3Cpath d='M168 120c1.5 7 5.5 11 12.5 12.5-7 1.5-11 5.5-12.5 12.5-1.5-7-5.5-11-12.5-12.5 7-1.5 11-5.5 12.5-12.5z'/%3E%3Cpath d='M108 168c1 5 4 8 9 9-5 1-8 4-9 9-1-5-4-8-9-9 5-1 8-4 9-9z'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
}
html.dark body::before {
  background:
    radial-gradient(520px 360px at 85% 6%, rgba(224, 134, 95, .14), transparent 70%),
    radial-gradient(460px 380px at 10% 92%, rgba(91, 176, 136, .10), transparent 70%),
    radial-gradient(600px 420px at 50% 50%, rgba(224, 169, 78, .06), transparent 75%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='%23e0865f' fill-opacity='0.06'%3E%3Cpath d='M40 22c2 9 7 14 16 16-9 2-14 7-16 16-2-9-7-14-16-16 9-2 14-7 16-16z'/%3E%3Cpath d='M168 120c1.5 7 5.5 11 12.5 12.5-7 1.5-11 5.5-12.5 12.5-1.5-7-5.5-11-12.5-12.5 7-1.5 11-5.5 12.5-12.5z'/%3E%3Cpath d='M108 168c1 5 4 8 9 9-5 1-8 4-9 9-1-5-4-8-9-9 5-1 8-4 9-9z'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
}
/* lớp mờ chuyển tiếp để nội dung không lộ lem nhem sau thanh điều hướng dưới */
body::after {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 92px;
  background: linear-gradient(to top, var(--bg) 18%, transparent);
  pointer-events: none; z-index: 40;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
#app { max-width: 720px; margin: 0 auto; padding: 76px 18px 150px; }
.btn, .opt-btn, .lesson-row, .course-card, .cert-row { scroll-margin-bottom: 110px; }

/* ═══ Chuyển cảnh & hiệu ứng vào màn ═══ */
@keyframes popIn {
  from { opacity: 0; transform: translateY(30px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
.screen { animation: slideRight .5s var(--bounce) both; }
.pop { animation: popIn .55s var(--bounce) both; animation-delay: var(--d, 0s); }

/* ═══ Thẻ đất sét ═══ */
.clay {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--clay-out), var(--clay-in);
  position: relative;
  overflow: hidden;
}
.pressable { transition: transform .15s var(--bounce), box-shadow .15s ease; }
.pressable:active { transform: translateY(3px) scale(.965); box-shadow: var(--clay-press), var(--clay-in); }

/* Shimmer — vệt sáng quét qua */
.shimmer::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .9) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: shimmer 4.5s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
html.dark .shimmer::after { background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.18) 50%, transparent 70%); }
@keyframes shimmer { 0%, 55% { transform: translateX(-120%); } 80%, 100% { transform: translateX(120%); } }

/* ═══ Top App Bar ═══ */
.appbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--violet) 12%, transparent);
}
.appbar-in { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 18px; }
.avatar {
  width: 38px; height: 38px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--violet), var(--rose));
  color: #fff; font-weight: 800; font-size: 16px;
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(217, 115, 78, .35), inset 0 2px 3px rgba(255, 255, 255, .45);
}
.appbar-name { flex: 1; min-width: 0; line-height: 1.25; }
.appbar-name small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.appbar-name b { font-size: 14.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.music-btn {
  width: 38px; height: 38px; border: none; border-radius: 14px; flex-shrink: 0;
  background: var(--surface-2); font-size: 17px; cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(44, 39, 34, .1);
  transition: transform .15s var(--bounce), opacity .2s;
}
.music-btn:active { transform: scale(.9); }
.music-btn.off { opacity: .35; filter: grayscale(1); }
.streak-chip {
  display: flex; align-items: center; gap: 5px;
  background: linear-gradient(135deg, #ff9a3d, #ff5e62); color: #fff;
  font-weight: 800; font-size: 14px; padding: 7px 13px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(255, 94, 98, .4), inset 0 2px 3px rgba(255, 255, 255, .4);
}

/* ═══ Bottom Navigation ═══ */
.bottomnav {
  position: fixed; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 50;
  width: min(440px, calc(100% - 28px));
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 26px; padding: 8px;
  box-shadow: var(--clay-out), var(--clay-in);
  display: flex; gap: 4px;
}
.nav-item {
  flex: 1; border: none; background: transparent; border-radius: 18px;
  padding: 8px 4px 7px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  transition: transform .15s var(--bounce), background .2s, color .2s;
}
.nav-item .ni { font-size: 20px; line-height: 1; }
.nav-item:active { transform: scale(.92); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--violet), var(--violet-deep));
  box-shadow: 0 5px 14px rgba(217, 115, 78, .45), inset 0 2px 3px rgba(255, 255, 255, .35);
}

/* ═══ Trang chủ ═══ */
.greet h1 { font-size: clamp(24px, 6vw, 32px); font-weight: 800; line-height: 1.2; }
.greet p { color: var(--muted); font-weight: 600; font-size: 14px; margin-top: 4px; }

.progress-hero { margin-top: 16px; padding: 18px; display: flex; gap: 16px; align-items: center; }
.ring { width: 88px; height: 88px; flex-shrink: 0; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; font-weight: 800; }
.ph-stats { flex: 1; display: grid; gap: 6px; }
.ph-row { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; }
.ph-row span { color: var(--muted); font-weight: 600; }

.sec-title { margin: 26px 4px 12px; font-size: 17px; font-weight: 800; display: flex; justify-content: space-between; align-items: baseline; }
.sec-title small { font-size: 12px; color: var(--violet); font-weight: 700; }

.course-grid { display: grid; gap: 14px; }
.course-card { display: flex; gap: 14px; padding: 16px; align-items: center; }
.cc-icon {
  width: 58px; height: 58px; border-radius: 20px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 28px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cc) 28%, var(--surface)), color-mix(in srgb, var(--cc) 12%, var(--surface)));
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, .7), inset 0 -4px 8px color-mix(in srgb, var(--cc) 30%, transparent), 0 4px 10px color-mix(in srgb, var(--cc) 25%, transparent);
}
html.dark .cc-icon { box-shadow: inset 0 2px 4px rgba(255,255,255,.1), 0 4px 10px rgba(0,0,0,.3); }
.cc-main { flex: 1; min-width: 0; }
.cc-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--cc); }
.cc-main h3 { font-size: 16.5px; font-weight: 800; margin: 1px 0 2px; }
.cc-main p { font-size: 12.5px; color: var(--muted); font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-bar { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.cc-bar small { font-size: 11px; font-weight: 800; color: var(--muted); white-space: nowrap; }

.track { height: 10px; flex: 1; background: var(--surface-2); border-radius: 99px; box-shadow: inset 0 2px 4px rgba(44, 39, 34, .12); overflow: hidden; }
.track i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--cc, var(--violet)), color-mix(in srgb, var(--cc, var(--violet)) 65%, #fff));
  box-shadow: 0 1px 3px color-mix(in srgb, var(--cc, var(--violet)) 50%, transparent);
  transition: width .6s var(--bounce);
}

/* ═══ Nút đất sét ═══ */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 18px; border: none; border-radius: 20px;
  background: var(--surface); color: var(--ink);
  font-weight: 800; font-size: 15px;
  box-shadow: var(--clay-out), var(--clay-in);
  transition: transform .15s var(--bounce), box-shadow .15s ease;
  position: relative; overflow: hidden;
}
.btn:active { transform: translateY(3px) scale(.97); box-shadow: var(--clay-press), var(--clay-in); }
.btn-primary {
  background: linear-gradient(135deg, var(--violet), var(--violet-deep)); color: #fff;
  box-shadow: 0 10px 22px rgba(217, 115, 78, .42), inset 0 2px 4px rgba(255, 255, 255, .35), inset 0 -4px 8px rgba(0, 0, 0, .15);
}
.btn-primary:active { box-shadow: 0 4px 10px rgba(217, 115, 78, .35), inset 0 2px 4px rgba(255, 255, 255, .3); }
.btn-gold { background: linear-gradient(135deg, #ffb347, #f5841f); color: #fff; box-shadow: 0 10px 22px rgba(245, 132, 31, .4), inset 0 2px 4px rgba(255,255,255,.4); }
.btn-ghost { background: var(--surface-2); box-shadow: inset 0 2px 5px rgba(44, 39, 34,.1); font-weight: 700; }

/* ═══ Đăng nhập ═══ */
.login-wrap { min-height: calc(100dvh - 80px); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 420px; padding: 30px 24px; text-align: center; }
.login-logo {
  width: 86px; height: 86px; margin: 0 auto 14px; border-radius: 30px; font-size: 42px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--violet), var(--rose));
  box-shadow: 0 14px 30px rgba(217, 115, 78, .45), inset 0 3px 6px rgba(255, 255, 255, .45);
  animation: float 3.5s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-9px) rotate(3deg); } }
.login-card h1 { font-size: 24px; font-weight: 800; }
.login-card > p { color: var(--muted); font-size: 13.5px; font-weight: 600; margin: 6px 0 20px; }
.field { text-align: left; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 800; color: var(--muted); margin: 0 4px 5px; display: block; text-transform: uppercase; letter-spacing: .05em; }
.field input {
  width: 100%; padding: 14px 16px; border: none; border-radius: 18px;
  background: var(--surface-2); color: var(--ink);
  font: inherit; font-weight: 700; font-size: 15px;
  box-shadow: inset 0 3px 7px rgba(44, 39, 34, .12);
  outline: 2px solid transparent; transition: outline-color .2s;
}
.field input:focus { outline-color: var(--violet-soft); }
.login-err { color: #e5484d; font-size: 12.5px; font-weight: 700; margin: -6px 0 10px; min-height: 18px; }
.known-users { display: grid; gap: 8px; margin-top: 18px; }
.known-user { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: none; border-radius: 18px; background: var(--surface-2); font-weight: 700; font-size: 13.5px; box-shadow: inset 0 2px 4px rgba(44, 39, 34,.08); }
.known-user .avatar { width: 32px; height: 32px; font-size: 13px; border-radius: 11px; }
.known-user small { color: var(--muted); font-weight: 600; }

/* ═══ Trang khoá học ═══ */
.back-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.back-btn {
  width: 42px; height: 42px; border: none; border-radius: 16px; font-size: 18px;
  background: var(--surface); box-shadow: var(--clay-out), var(--clay-in);
  transition: transform .15s var(--bounce);
}
.back-btn:active { transform: translateY(2px) scale(.93); }
.back-row b { font-size: 15px; font-weight: 800; }

.course-hero { padding: 20px; text-align: center; }
.course-hero .hero-art { max-width: 320px; margin: 0 auto 12px; border-radius: 18px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(217, 115, 78,.08); }
.course-hero .hero-art svg { display: block; width: 100%; height: auto; }
.course-hero h1 { font-size: 22px; font-weight: 800; }
.course-hero p { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.hero-meta { display: flex; justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.chip { font-size: 11.5px; font-weight: 800; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); box-shadow: inset 0 2px 4px rgba(44, 39, 34,.08); }
.chip.vio { background: color-mix(in srgb, var(--cc, var(--violet)) 16%, var(--surface)); color: var(--cc, var(--violet)); }

.lesson-row { display: flex; align-items: center; gap: 13px; padding: 14px 16px; }
.lr-num {
  width: 40px; height: 40px; border-radius: 15px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: var(--surface-2); color: var(--muted);
  box-shadow: inset 0 2px 4px rgba(44, 39, 34, .1);
}
.lesson-row.done .lr-num { background: linear-gradient(135deg, var(--green), #1fa873); color: #fff; box-shadow: 0 4px 10px rgba(52, 201, 142, .4), inset 0 2px 3px rgba(255,255,255,.4); }
.lr-main { flex: 1; min-width: 0; }
.lr-main b { font-size: 14.5px; font-weight: 800; display: block; }
.lr-main small { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.lr-go { color: var(--muted); font-size: 20px; font-weight: 800; }

.action-stack { display: grid; gap: 12px; margin-top: 16px; }

/* ═══ Bài học ═══ */
.audio-dock { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 16px; position: sticky; top: 68px; z-index: 30; }
.play-orb {
  width: 50px; height: 50px; border: none; border-radius: 50%; font-size: 18px; color: #fff; flex-shrink: 0;
  background: linear-gradient(135deg, var(--violet), var(--rose));
  box-shadow: 0 8px 18px rgba(217, 115, 78, .45), inset 0 2px 4px rgba(255, 255, 255, .4);
  transition: transform .15s var(--bounce);
}
.play-orb:active { transform: scale(.9); }
.play-orb.playing { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 8px 18px rgba(217, 115, 78,.45), 0 0 0 0 rgba(217, 115, 78,.35);} 50% { box-shadow: 0 8px 18px rgba(217, 115, 78,.45), 0 0 0 14px rgba(217, 115, 78,0);} }
.ad-label { flex: 1; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.rate-sel { border: none; padding: 9px 10px; border-radius: 14px; background: var(--surface-2); font-weight: 800; font-size: 12.5px; color: var(--ink); box-shadow: inset 0 2px 4px rgba(44, 39, 34,.1); }

.lesson-art { padding: 10px; margin-bottom: 18px; }
.lesson-art svg { display: block; width: 100%; height: auto; border-radius: 16px; }
.lesson-body section { margin-bottom: 22px; }
.lesson-body h2 { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.lesson-body p { font-size: 15px; margin-bottom: 10px; font-weight: 500; }
.lesson-body ul { padding-left: 20px; }
.lesson-body li { font-size: 14.5px; margin-bottom: 7px; font-weight: 500; }

.takeaway-card { padding: 18px; margin: 22px 0; background: linear-gradient(135deg, color-mix(in srgb, var(--cc, var(--violet)) 14%, var(--surface)), var(--surface)); }
.takeaway-card h3 { font-size: 14.5px; font-weight: 800; margin-bottom: 8px; }
.takeaway-card ul { padding-left: 20px; }
.takeaway-card li { font-size: 14px; margin-bottom: 6px; font-weight: 600; }

/* ═══ Quiz ═══ */
.quiz-q { font-size: 17.5px; font-weight: 800; margin: 16px 2px; }
.opt-stack { display: grid; gap: 11px; }
.opt-btn { text-align: left; font-weight: 700; font-size: 14.5px; padding: 15px 17px; border: none; }
.opt-btn.right { background: linear-gradient(135deg, #c9f5e3, #a8edd0); color: #0c6b48; box-shadow: 0 8px 18px rgba(52,201,142,.3), inset 0 2px 4px rgba(255,255,255,.7); }
.opt-btn.wrong { background: linear-gradient(135deg, #ffd9dc, #ffc2c7); color: #a3242c; }
html.dark .opt-btn.right { background: linear-gradient(135deg,#15543d,#1c6e50); color:#c9f5e3; }
html.dark .opt-btn.wrong { background: linear-gradient(135deg,#5e2026,#73262e); color:#ffd9dc; }
.expl-card { padding: 14px 16px; margin: 14px 0; font-size: 13.5px; font-weight: 600; }
.result-hero { padding: 28px 22px; text-align: center; }
.result-hero .big-emoji { font-size: 60px; display: block; animation: float 3s ease-in-out infinite; }
.result-hero h1 { font-size: 24px; font-weight: 800; margin: 8px 0 4px; }
.result-hero p { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.exam-cta { padding: 18px; margin-top: 14px; background: linear-gradient(135deg, #fff4e0, #ffe7c2); }
html.dark .exam-cta { background: linear-gradient(135deg, #45330f, #57400f); }
.exam-cta h3 { font-size: 15px; font-weight: 800; }
.exam-cta p { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 4px 0 12px; }

/* ═══ Thi thử (Mock Exam) ═══ */
.mock-bar {
  position: sticky; top: 68px; z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 10px 0; margin-bottom: 6px;
}
.mock-clock {
  font-family: ui-monospace, "SF Mono", monospace; font-weight: 800; font-size: 15px;
  padding: 7px 13px; border-radius: 999px; background: var(--surface);
  box-shadow: var(--clay-out), var(--clay-in); white-space: nowrap;
}
.mock-clock.low { background: linear-gradient(135deg, #ff6b6b, #e5484d); color: #fff; animation: pulse 1s ease-in-out infinite; }
.opt-btn.chosen { border: 2px solid var(--violet); background: color-mix(in srgb, var(--violet) 14%, var(--surface)); }

/* ═══ Flashcards ═══ */
.fc-stage { perspective: 1400px; height: 320px; margin-top: 14px; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .55s var(--bounce); transform-style: preserve-3d; }
.fc-stage.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 26px; padding: 28px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  box-shadow: var(--clay-out), var(--clay-in); background: var(--surface);
}
.fc-face.back { transform: rotateY(180deg); color: #fff; background: linear-gradient(135deg, var(--cc, var(--violet)), color-mix(in srgb, var(--cc, var(--violet)) 55%, #1c1240)); }
.fc-face small { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; opacity: .65; margin-bottom: 14px; }
.fc-face p { font-size: 18.5px; font-weight: 700; line-height: 1.5; }
.fc-nav { display: grid; grid-template-columns: 56px 1fr 1fr; gap: 10px; margin-top: 16px; }

/* ═══ Streaks / Khám phá / Hồ sơ ═══ */
.streak-hero { padding: 26px 20px; text-align: center; }
.flame { font-size: 64px; display: block; animation: float 2.8s ease-in-out infinite; filter: drop-shadow(0 8px 14px rgba(255, 94, 98, .4)); }
.streak-hero h1 { font-size: 34px; font-weight: 800; }
.streak-hero p { color: var(--muted); font-weight: 700; font-size: 13px; }
.week-row { display: flex; justify-content: space-between; margin-top: 18px; }
.day-dot { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 800; color: var(--muted); }
.day-dot i {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 14px;
  background: var(--surface-2); box-shadow: inset 0 2px 4px rgba(44, 39, 34, .12);
}
.day-dot.lit i { background: linear-gradient(135deg, #ff9a3d, #ff5e62); box-shadow: 0 4px 10px rgba(255, 94, 98, .45); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.stat-card { padding: 16px; text-align: center; }
.stat-card b { font-size: 24px; font-weight: 800; display: block; }
.stat-card span { font-size: 11.5px; color: var(--muted); font-weight: 700; }

.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.badge { padding: 14px 8px; text-align: center; }
.badge .be { font-size: 30px; display: block; }
.badge b { font-size: 11px; font-weight: 800; display: block; margin-top: 4px; }
.badge.locked { opacity: .38; filter: grayscale(1); }

.info-card { padding: 18px; }
.info-card h3 { font-size: 15.5px; font-weight: 800; margin-bottom: 6px; }
.info-card p, .info-card li { font-size: 13px; color: var(--muted); font-weight: 600; }
.info-card ol, .info-card ul { padding-left: 20px; margin-top: 6px; }
.info-card li { margin-bottom: 5px; }

.cert-row { display: flex; align-items: center; gap: 12px; padding: 13px 15px; }
.cert-row .ce { font-size: 24px; }
.cert-main { flex: 1; min-width: 0; }
.cert-main b { font-size: 13.5px; font-weight: 800; display: block; }
.cert-main small { font-size: 11px; color: var(--muted); font-weight: 700; }
.cert-link { font-size: 11.5px; font-weight: 800; color: #fff; padding: 8px 13px; border-radius: 999px; background: linear-gradient(135deg, var(--gold), #f5841f); box-shadow: 0 4px 10px rgba(245,132,31,.35); white-space: nowrap; }
.cert-link.done { background: linear-gradient(135deg, var(--green), #1fa873); box-shadow: 0 4px 10px rgba(52,201,142,.35); }

.profile-head { padding: 24px; text-align: center; }
.profile-head .avatar { width: 76px; height: 76px; border-radius: 26px; font-size: 32px; margin: 0 auto 10px; }
.profile-head h1 { font-size: 20px; font-weight: 800; }
.profile-head p { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ═══ Video nhúng (YouTube) ═══ */
.video-card { margin-bottom: 12px; cursor: pointer; }
.video-thumb { position: relative; aspect-ratio: 16 / 9; background: #14101f; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-thumb iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-play {
  position: absolute; inset: 0; margin: auto;
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--rose)); color: #fff;
  display: grid; place-items: center; font-size: 22px; padding-left: 4px;
  box-shadow: 0 10px 26px rgba(217, 115, 78, .55), inset 0 2px 4px rgba(255, 255, 255, .4);
  animation: pulse 2.2s ease-in-out infinite;
}
.pl-panel {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-align: center; padding: 16px; color: #fff;
  background: linear-gradient(135deg, var(--violet), var(--violet-deep));
}
.pl-panel .video-play { position: static; margin: 0 0 4px; animation: pulse 2.2s ease-in-out infinite; }
.vidgroup { padding: 14px 16px; margin-bottom: 10px; border-left: 5px solid var(--cc, var(--violet)); }
.vg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.vg-head b { font-size: 14.5px; font-weight: 800; }
.vg-link { flex-shrink: 0; font-size: 11.5px; font-weight: 800; color: #fff; padding: 6px 11px; border-radius: 999px; background: var(--cc, var(--violet)); white-space: nowrap; }
.vg-list { list-style: none; display: grid; gap: 7px; }
.vg-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; font-weight: 600; }
.vg-list li::before { content: "▶"; color: var(--cc, var(--violet)); font-size: 9px; margin-right: -4px; }
.docgroup .vg-list li::before { content: "📄"; font-size: 11px; }
.vg-list li span { flex: 1; }
.vg-list li i { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.pl-panel b { font-size: 15px; font-weight: 800; }
.pl-panel small { font-size: 11.5px; opacity: .9; max-width: 80%; }
.video-meta { padding: 12px 16px; }
.video-meta b { font-size: 14px; font-weight: 800; display: block; }
.video-meta small { font-size: 11.5px; color: var(--muted); font-weight: 700; }

/* ═══ Gợi ý cài đặt (banner trên trang chủ) ═══ */
.install-hint {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-top: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--violet) 16%, var(--surface)), var(--surface));
}
.ih-ico { font-size: 26px; flex-shrink: 0; }
.ih-body { flex: 1; min-width: 0; line-height: 1.3; }
.ih-body b { font-size: 14px; font-weight: 800; display: block; }
.ih-body small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.ih-btn {
  flex-shrink: 0; border: none; border-radius: 14px; padding: 9px 14px; font-weight: 800; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--violet), var(--violet-deep));
  box-shadow: 0 5px 12px rgba(217, 115, 78, .4);
}
.ih-x { flex-shrink: 0; border: none; background: transparent; color: var(--muted); font-size: 14px; font-weight: 800; padding: 4px 6px; }

/* ═══ Banner báo cập nhật (cố định dưới đáy) ═══ */
.update-banner {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 140%); z-index: 60;
  width: min(440px, calc(100% - 28px));
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: linear-gradient(135deg, var(--violet), var(--violet-deep)); color: #fff;
  border-radius: 20px; box-shadow: 0 12px 30px rgba(217, 115, 78, .5);
  transition: transform .45s var(--bounce); font-weight: 700; font-size: 13.5px;
}
.update-banner.show { transform: translate(-50%, 0); }
.update-banner span { flex: 1; }
.update-banner #ubReload {
  border: none; border-radius: 12px; padding: 8px 13px; font-weight: 800; font-size: 13px;
  background: #fff; color: var(--violet-deep); white-space: nowrap;
}
.update-banner #ubLater { border: none; background: transparent; color: #fff; font-size: 15px; font-weight: 800; opacity: .85; }

/* ═══ Toast nhỏ ═══ */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px); z-index: 60; opacity: 0;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 13px;
  padding: 11px 18px; border-radius: 999px; box-shadow: var(--clay-out);
  transition: opacity .3s, transform .3s; max-width: 86%; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ═══ Tìm kiếm ═══ */
.search-box { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 8px; }
.search-box span { font-size: 18px; }
.search-box input { flex: 1; border: none; background: transparent; font: inherit; font-size: 15.5px; font-weight: 600; color: var(--ink); outline: none; }

/* ═══ Ghi chú trong bài học ═══ */
.note-card { padding: 14px 16px; margin: 16px 0; }
.note-card label { display: block; font-size: 13.5px; font-weight: 800; margin-bottom: 8px; }
.note-card label small { color: var(--green, #1fa873); font-weight: 700; margin-left: 6px; }
.note-card textarea {
  width: 100%; min-height: 90px; resize: vertical; border: none; border-radius: 14px;
  background: var(--surface-2); color: var(--ink); font: inherit; font-size: 14.5px; padding: 12px 14px;
  box-shadow: inset 0 2px 5px rgba(44, 39, 34, .12); outline: 2px solid transparent; transition: outline-color .2s;
}
.note-card textarea:focus { outline-color: var(--violet-soft); }

/* ═══ Chứng nhận hoàn thành ═══ */
.certificate {
  text-align: center; padding: 28px 22px; margin-top: 6px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cc, var(--violet)) 14%, var(--surface)), var(--surface));
  border: 2px solid var(--cc, var(--violet));
}
.certificate .cert-deco { font-size: 48px; }
.certificate small { display: block; letter-spacing: .14em; font-size: 11px; font-weight: 800; color: var(--muted); margin-top: 6px; }
.certificate h2 { font-size: 22px; font-weight: 800; margin: 8px 0; }
.certificate .cert-name { font-family: Georgia, serif; font-style: italic; font-weight: 800; font-size: 26px; color: var(--violet); margin: 10px 0 4px; }
.certificate .cert-sub { font-size: 13px; color: var(--muted); font-weight: 600; }
.certificate .cert-foot { display: flex; justify-content: space-between; margin-top: 18px; font-size: 12px; font-weight: 700; color: var(--muted); }

/* ═══ Chỉnh cỡ chữ ═══ */
.fs-control { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.fs-control > span { font-weight: 700; font-size: 14px; }
.fs-btns { display: flex; gap: 6px; }
.fs-btns button {
  width: 38px; height: 38px; border: none; border-radius: 12px; background: var(--surface-2); color: var(--ink);
  font-weight: 800; cursor: pointer; box-shadow: inset 0 2px 4px rgba(44, 39, 34,.1);
}
.fs-btns button:nth-child(1) { font-size: 12px; } .fs-btns button:nth-child(2) { font-size: 15px; }
.fs-btns button:nth-child(3) { font-size: 18px; } .fs-btns button:nth-child(4) { font-size: 21px; }
.fs-btns button.on { background: linear-gradient(135deg, var(--violet), var(--violet-deep)); color: #fff; box-shadow: 0 4px 10px rgba(217, 115, 78,.4); }

/* cỡ chữ áp dụng cho nội dung đọc (bài học + quiz) */
html.fs-lg .lesson-body p, html.fs-lg .lesson-body li, html.fs-lg .takeaway-card li { font-size: 17px; }
html.fs-lg .quiz-q { font-size: 19.5px; } html.fs-lg .opt-btn { font-size: 16px; }
html.fs-xl .lesson-body p, html.fs-xl .lesson-body li, html.fs-xl .takeaway-card li { font-size: 19px; }
html.fs-xl .lesson-body h2 { font-size: 21px; } html.fs-xl .quiz-q { font-size: 21px; } html.fs-xl .opt-btn { font-size: 17.5px; }
html.fs-sm .lesson-body p, html.fs-sm .lesson-body li { font-size: 14px; }

/* ═══ Đồ thị hoạt động 7 ngày ═══ */
.chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; padding: 16px 14px 12px; height: 140px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.bar-n { font-size: 11px; font-weight: 800; color: var(--muted); }
.bar-fill { width: 70%; max-width: 26px; border-radius: 8px 8px 4px 4px; background: linear-gradient(to top, var(--violet), var(--rose)); box-shadow: 0 2px 6px rgba(217, 115, 78,.35); transition: height .5s var(--bounce); }
.bar-lb { font-size: 10.5px; font-weight: 700; color: var(--muted); }

/* ═══ Ôn tập ngắt quãng — nút đánh giá ═══ */
.srs-rate { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 12px; }
.srs-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: none; border-radius: 18px; padding: 14px 6px; font-weight: 800; font-size: 14.5px; color: #fff;
  box-shadow: var(--clay-out); transition: transform .15s var(--bounce);
}
.srs-btn small { font-weight: 700; font-size: 10.5px; opacity: .85; }
.srs-btn:active { transform: translateY(3px) scale(.96); }
.srs-btn.hard { background: linear-gradient(135deg, #f17e7e, #e5484d); }
.srs-btn.ok { background: linear-gradient(135deg, #5b8def, #3b6fd4); }
.srs-btn.easy { background: linear-gradient(135deg, #34c98e, #1fa873); }

/* ═══ Confetti ═══ */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 99; overflow: hidden; }
.confetti i {
  position: absolute; width: 10px; height: 10px; border-radius: 3px;
  animation: burst .95s cubic-bezier(.2, .8, .4, 1) forwards;
}
@keyframes burst {
  from { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
  to   { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(540deg) scale(.4); }
}

.foot-note { text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 20px 10px 0; }

@media (min-width: 640px) {
  .course-grid { grid-template-columns: 1fr 1fr; }
  .action-stack { grid-template-columns: 1fr 1fr; }
}
