/* ===========================================================
   한국어 한걸음 — Korean Step by Step
   Design System & Global Styles
   =========================================================== */

:root {
  /* Brand palette */
  --c-primary: #2b50e2;
  --c-primary-dark: #1e3bb0;
  --c-primary-light: #eaeefc;
  --c-accent: #ff5a7a;
  --c-accent-soft: #ffe5eb;

  /* Level colors */
  --lvl-intro: #16a34a;   /* 입문 */
  --lvl-begin: #2b50e2;   /* 초급 */
  --lvl-inter: #f59e0b;   /* 중급 */
  --lvl-adv:   #db2777;   /* 고급 */
  --lvl-expert:#7c3aed;   /* 전문가 */

  /* Neutrals */
  --c-text: #1f2533;
  --c-text-soft: #5a6478;
  --c-border: #e6e9f2;
  --c-bg: #ffffff;
  --c-bg-soft: #f6f8fc;
  --c-bg-card: #ffffff;

  /* Feedback */
  --c-ok: #16a34a;
  --c-ok-bg: #e9f9ef;
  --c-bad: #dc2626;
  --c-bad-bg: #fdecec;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 3px rgba(20,30,60,.08);
  --shadow: 0 6px 22px rgba(20,30,60,.10);
  --shadow-lg: 0 18px 50px rgba(20,30,60,.16);
  --maxw: 1120px;
  --font: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont,
          'Segoe UI', Roboto, 'Malgun Gothic', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-text: #e8ebf5;
    --c-text-soft: #a4adc4;
    --c-border: #2a3145;
    --c-bg: #11151f;
    --c-bg-soft: #161b27;
    --c-bg-card: #1a202e;
    --c-primary-light: #1f2a4d;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
    --shadow: 0 6px 22px rgba(0,0,0,.45);
    --shadow-lg: 0 18px 50px rgba(0,0,0,.55);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.02em; }
p { margin: 0 0 1em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.section-soft { background: var(--c-bg-soft); }
.muted { color: var(--c-text-soft); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--c-bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 10px; flex-wrap: nowrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.12rem; color: var(--c-text); flex: 0 0 auto; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  display: grid; place-items: center; color: #fff; font-weight: 900;
}
.nav-links { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.nav-links a {
  color: var(--c-text-soft); font-weight: 600; padding: 8px 11px; border-radius: 8px; white-space: nowrap;
}
#authSlot a { white-space: nowrap; }
.nav-links a:hover { color: var(--c-text); background: var(--c-bg-soft); text-decoration: none; }
.nav-links a.active { color: var(--c-primary); background: var(--c-primary-light); }
/* keep button-styled links readable inside the nav */
.nav-links a.btn-primary { color: #fff; background: var(--c-primary); }
.nav-links a.btn-primary:hover { color: #fff; background: var(--c-primary-dark); }
.nav-links a.btn-ghost { color: var(--c-text); }
.nav-toggle { display: none; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--c-text); }

@media (max-width: 1024px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--c-bg); border-bottom: 1px solid var(--c-border);
    padding: 8px; box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; }
  .lang-switch { margin: 4px 0; }
  .lang-menu { left: 0; right: auto; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 22px; border-radius: 10px; font-weight: 700; cursor: pointer;
  border: 1px solid transparent; font-size: 1rem; transition: transform .08s, box-shadow .2s, background .2s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--c-primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-ghost { background: var(--c-bg); color: var(--c-text); border-color: var(--c-border); }
.btn-ghost:hover { background: var(--c-bg-soft); }
.btn-lg { padding: 15px 30px; font-size: 1.08rem; }
.btn-block { width: 100%; }

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 800; padding: 4px 11px; border-radius: 999px;
  background: var(--c-primary-light); color: var(--c-primary);
}
.badge[data-level="intro"]  { background: #e7f7ee; color: var(--lvl-intro); }
.badge[data-level="begin"]  { background: #e9edfd; color: var(--lvl-begin); }
.badge[data-level="inter"]  { background: #fef3e2; color: #b45309; }
.badge[data-level="adv"]    { background: #fde7f1; color: var(--lvl-adv); }
.badge[data-level="expert"] { background: #f0e9fd; color: var(--lvl-expert); }

/* ---------- Hero ---------- */
.hero { padding: 76px 0 56px; background:
  radial-gradient(1200px 400px at 80% -10%, var(--c-primary-light), transparent),
  radial-gradient(900px 360px at 0% 10%, var(--c-accent-soft), transparent);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.3rem); margin-bottom: .35em; }
.hero .lead { font-size: 1.18rem; color: var(--c-text-soft); max-width: 620px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-stats { display: flex; gap: 34px; margin-top: 40px; flex-wrap: wrap; }
.hero-stats .num { font-size: 1.8rem; font-weight: 900; color: var(--c-primary); }
.hero-stats .lbl { color: var(--c-text-soft); font-size: .9rem; }
.hero-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 30px; align-items: center; }
@media (max-width: 760px) { .hero-grid { grid-template-columns: 1fr; } .hero-grid .center { order: -1; } }

/* ---------- Grid / Cards ---------- */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--c-bg-card); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .2s, border-color .2s;
}
a.card { color: inherit; display: block; }
a.card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c-primary) 35%, var(--c-border)); }
.card h3 { margin: 12px 0 6px; font-size: 1.15rem; }
.card .emoji { font-size: 1.9rem; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; color: var(--c-text-soft); font-size: .85rem; }

/* progress bar */
.progress { height: 8px; background: var(--c-bg-soft); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--c-primary), var(--c-accent)); border-radius: 999px; transition: width .4s; }

/* ---------- Lesson layout ---------- */
.lesson-layout { display: grid; grid-template-columns: 270px 1fr; gap: 32px; align-items: start; }
@media (max-width: 880px) { .lesson-layout { grid-template-columns: 1fr; } }
.lesson-sidebar { position: sticky; top: 80px; background: var(--c-bg-soft); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 16px; }
.lesson-nav-toggle { display: none; }
.lesson-nav-toggle .chev { transition: transform .2s; }
@media (max-width: 880px) {
  .lesson-sidebar { position: static; top: auto; padding: 8px; }
  .lesson-nav-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; background: none; border: 0; cursor: pointer; padding: 10px 8px;
    font-weight: 800; font-size: 1rem; color: var(--c-text);
  }
  .lesson-nav-body { display: none; padding: 0 4px 4px; }
  .lesson-nav-body.open { display: block; }
  .lesson-nav-body h4 { display: none; }
}
.lesson-sidebar h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--c-text-soft); }
.lesson-sidebar ol { list-style: none; margin: 0; padding: 0; counter-reset: l; }
.lesson-sidebar li a { display: flex; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--c-text-soft); font-size: .92rem; font-weight: 600; }
.lesson-sidebar li a:hover { background: var(--c-bg); text-decoration: none; color: var(--c-text); }
.lesson-sidebar li a.active { background: var(--c-primary-light); color: var(--c-primary); }
.lesson-sidebar li.done a::before { content: "✓"; color: var(--c-ok); font-weight: 900; }

.lesson-content { min-width: 0; }
.lesson-content h2 { font-size: 1.9rem; margin-top: 0; }
.lesson-content h3 { font-size: 1.3rem; margin-top: 1.6em; }
.lesson-content table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .96rem; }
.lesson-content th, .lesson-content td { border: 1px solid var(--c-border); padding: 10px 12px; text-align: left; }
.lesson-content th { background: var(--c-bg-soft); }
.lesson-content blockquote { margin: 1.2em 0; padding: 14px 18px; background: var(--c-bg-soft); border-left: 4px solid var(--c-primary); border-radius: 8px; }
.lesson-content code { background: var(--c-bg-soft); padding: 2px 7px; border-radius: 6px; font-size: .9em; }

/* Hangul / example block */
.ko-example { background: var(--c-bg-soft); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }
.ko-example .ko { font-size: 1.7rem; font-weight: 800; }
.ko-example .ro { color: var(--c-primary); font-weight: 700; }
.ko-example .en { color: var(--c-text-soft); }
.ko-example .ex-tl { color: var(--c-primary); font-weight: 600; margin-top: 2px; }
.speak-btn { background: var(--c-primary-light); color: var(--c-primary); border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 700; font-size: .85rem; }
.speak-btn:hover { background: var(--c-primary); color: #fff; }
.speed-group { display: inline-flex; gap: 4px; align-items: center; }
.speak-btn.slow { background: var(--c-bg-soft); color: var(--c-text-soft); font-size: .78rem; padding: 5px 9px; }
.speak-btn.slow:hover { background: var(--c-accent); color: #fff; }

/* ---------- Quiz ---------- */
.quiz-card { max-width: 720px; margin: 0 auto; }
.quiz-progress-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--c-text-soft); font-weight: 700; font-size: .9rem; }
.quiz-question { font-size: 1.45rem; font-weight: 800; margin: 18px 0 6px; }
.quiz-options { display: grid; gap: 12px; margin: 22px 0; }
.quiz-option {
  text-align: left; padding: 16px 18px; border-radius: 12px; border: 2px solid var(--c-border);
  background: var(--c-bg); cursor: pointer; font-size: 1.05rem; font-weight: 600; color: var(--c-text);
  transition: border-color .15s, background .15s; display: flex; gap: 12px; align-items: center;
}
.quiz-option:hover:not(:disabled) { border-color: var(--c-primary); background: var(--c-primary-light); }
.quiz-option .key { width: 26px; height: 26px; border-radius: 7px; background: var(--c-bg-soft); display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; }
.quiz-option.correct { border-color: var(--c-ok); background: var(--c-ok-bg); }
.quiz-option.correct .key { background: var(--c-ok); color: #fff; }
.quiz-option.wrong { border-color: var(--c-bad); background: var(--c-bad-bg); }
.quiz-option.wrong .key { background: var(--c-bad); color: #fff; }
.quiz-option:disabled { cursor: default; }
.quiz-explain { padding: 14px 16px; border-radius: 10px; background: var(--c-bg-soft); border-left: 4px solid var(--c-primary); margin-top: 6px; display: none; }
.quiz-explain.show { display: block; }
.quiz-result { text-align: center; padding: 20px 0; }
.quiz-result .score { font-size: 3.4rem; font-weight: 900; color: var(--c-primary); }
.qstat-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.qstat { background: var(--c-bg-soft); border: 1px solid var(--c-border); border-radius: 12px; padding: 12px 16px; min-width: 92px; }
.qstat .qv { font-size: 1.3rem; font-weight: 900; color: var(--c-primary); }
.qstat .ql { font-size: .78rem; color: var(--c-text-soft); }

/* ---------- Ads ---------- */
.ad-slot {
  margin: 28px auto; max-width: var(--maxw); min-height: 90px;
  display: grid; place-items: center;
  background: var(--c-bg-soft); border: 1px dashed var(--c-border); border-radius: 10px;
  color: var(--c-text-soft); font-size: .8rem;
}
.ad-slot.inline { min-height: 100px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--c-bg-soft); border-top: 1px solid var(--c-border); padding: 48px 0 28px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; gap: 20px; } }
.footer-grid h5 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--c-text-soft); margin-bottom: 12px; }
.footer-grid a { display: block; color: var(--c-text-soft); padding: 4px 0; font-size: .95rem; }
.footer-bottom { border-top: 1px solid var(--c-border); margin-top: 30px; padding-top: 18px; color: var(--c-text-soft); font-size: .85rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ---------- Misc / utility ---------- */
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }
.skeleton { background: linear-gradient(90deg, var(--c-bg-soft), var(--c-border), var(--c-bg-soft)); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 8px; }
@keyframes sh { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.page-head { padding: 50px 0 10px; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.breadcrumb { font-size: .88rem; color: var(--c-text-soft); margin-bottom: 8px; }
.breadcrumb a { color: var(--c-text-soft); }
.notice { padding: 14px 18px; border-radius: 10px; background: var(--c-accent-soft); color: #9b2c43; font-size: .92rem; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.2em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--c-primary) 50%, transparent); outline-offset: 2px; }

/* ===========================================================
   Personality layer — playful, hand-made feel
   =========================================================== */
/* Wavy hand-drawn underline on highlighted words */
.wavy { position: relative; white-space: nowrap; }
.wavy::after {
  content: ""; position: absolute; left: -2%; right: -2%; bottom: -6px; height: 8px;
  background: radial-gradient(circle at 6px 4px, transparent 4px, var(--c-accent) 4.5px, transparent 6px) repeat-x;
  background-size: 14px 10px; opacity: .55; border-radius: 4px;
}
/* Sticker: slightly rotated, tactile badge */
.sticker {
  display: inline-block; transform: rotate(-3deg); background: #fff; color: var(--c-text);
  border: 2px solid var(--c-text); border-radius: 12px; padding: 6px 14px; font-weight: 800;
  box-shadow: 3px 3px 0 var(--c-text); font-size: .9rem;
}
.sticker.pink { background: var(--c-accent-soft); border-color: var(--c-accent); box-shadow: 3px 3px 0 var(--c-accent); color: #9b2c43; }
.sticker.blue { background: var(--c-primary-light); border-color: var(--c-primary); box-shadow: 3px 3px 0 var(--c-primary); color: var(--c-primary-dark); }

/* Mascot bob */
.mascot { font-size: clamp(4rem, 12vw, 8rem); line-height: 1; display: inline-block; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 10px 18px rgba(20,30,60,.18)); }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-12px) rotate(2deg); } }
.speech-bubble {
  position: relative; background: var(--c-bg-card); border: 2px solid var(--c-text); border-radius: 16px;
  padding: 12px 16px; font-weight: 700; box-shadow: 3px 3px 0 var(--c-text); display: inline-block;
}
.speech-bubble::after { content: ""; position: absolute; left: 28px; bottom: -12px; border: 7px solid transparent; border-top-color: var(--c-text); }

/* Doodle divider */
.doodle-divider { height: 18px; background: radial-gradient(circle at 10px 14px, transparent 9px, var(--c-border) 9.5px, transparent 11px) repeat-x; background-size: 22px 18px; opacity: .6; margin: 8px 0; }

/* Cards get a tiny playful tilt on hover */
a.card:hover { transform: translateY(-4px) rotate(-.5deg); }

/* Fun emoji bullet list */
.fun-list { list-style: none; padding: 0; }
.fun-list li { padding: 8px 0 8px 34px; position: relative; }
.fun-list li::before { content: attr(data-emoji); position: absolute; left: 0; font-size: 1.25rem; }

/* Share bar */
.share-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-bar .share-label { font-weight: 800; color: var(--c-text-soft); font-size: .85rem; margin-right: 2px; }
.share-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--c-border); background: var(--c-bg);
  display: inline-grid; place-items: center; cursor: pointer; font-weight: 800; font-size: 1rem; color: var(--c-text);
  text-decoration: none; transition: transform .1s, background .15s;
}
.share-btn:hover { transform: translateY(-2px); text-decoration: none; }
.share-btn.s-copy { width: auto; padding: 0 14px; }
.share-btn.s-x:hover { background: #111; color: #fff; }
.share-btn.s-fb:hover { background: #1877f2; color: #fff; }
.share-btn.s-wa:hover { background: #25d366; color: #fff; }
.share-btn.s-tg:hover { background: #229ed9; color: #fff; }
.share-btn.s-ln:hover { background: #06c755; color: #fff; }

/* Country tag */
.country-tag { font-weight: 700; font-size: .82rem; color: var(--c-text-soft); }

/* ---- Header icon buttons + notification bell ---- */
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 1.15rem; position: relative; text-decoration: none; padding: 4px; line-height: 1; }
.bell-wrap { position: relative; display: inline-flex; }
.badge-dot { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--c-accent); color: #fff; font-size: .64rem; font-weight: 900; display: grid; place-items: center; }
.notif-panel { width: 320px; max-width: calc(100vw - 24px); background: var(--c-bg-card); border: 1px solid var(--c-border);
  border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 9500; overflow: hidden; }
.notif-head { padding: 12px 14px; font-weight: 800; border-bottom: 1px solid var(--c-border); }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-empty { padding: 28px; text-align: center; color: var(--c-text-soft); font-size: .9rem; }
.notif-item { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--c-border); color: inherit; text-decoration: none; font-size: .9rem; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--c-bg-soft); text-decoration: none; }
.notif-item.unread { background: var(--c-primary-light); }
.notif-item img, .notif-item .na { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--c-primary-light); color: var(--c-primary); display: grid; place-items: center; font-weight: 800; }

/* dating-style profile chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--c-bg-soft); border: 1px solid var(--c-border); border-radius: 999px; padding: 5px 12px; font-size: .85rem; font-weight: 700; }
.chip.mbti { background: linear-gradient(135deg, var(--c-primary-light), var(--c-accent-soft)); color: var(--c-primary-dark); }
.meta-tag { display: inline-flex; align-items: center; gap: 3px; background: var(--c-bg-soft); border: 1px solid var(--c-border); border-radius: 999px; padding: 1px 8px; font-size: .72rem; font-weight: 800; color: var(--c-text-soft); margin-left: 4px; }
.online-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; margin-right: 4px; }
.offline-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; margin-right: 4px; }

/* ---- Global floating chat widget ---- */
#chatWidget { position: fixed; right: 18px; bottom: 18px; z-index: 9000; }
.chat-toggle { width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.6rem;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent)); color: #fff; box-shadow: var(--shadow-lg); transition: transform .12s; }
.chat-toggle:hover { transform: scale(1.08) rotate(-6deg); }
.chat-panel { position: absolute; right: 0; bottom: 70px; width: 340px; max-width: calc(100vw - 36px); height: 460px; max-height: calc(100vh - 120px);
  background: var(--c-bg-card); border: 1px solid var(--c-border); border-radius: 16px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden; }
.chat-panel.open { display: flex; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-weight: 800;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent)); color: #fff; }
.chat-head button { background: none; border: 0; color: #fff; font-size: 1.05rem; cursor: pointer; }
.chat-online { font-size: .8rem; font-weight: 800; color: #fff; opacity: .95; }
.chat-panel.full { position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; bottom: 0; right: 0; border-radius: 0; }
.chat-panel.full .chat-msgs { padding: 16px clamp(12px, 8vw, 200px); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--c-bg-soft); }
.chat-empty { color: var(--c-text-soft); text-align: center; margin: auto; font-size: .9rem; padding: 20px; }
.chat-msg { max-width: 85%; }
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-meta { font-size: .72rem; color: var(--c-text-soft); margin-bottom: 3px; display: flex; gap: 5px; align-items: center; }
.chat-msg.mine .chat-meta { justify-content: flex-end; }
.chat-av { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: none; vertical-align: middle; }
img.chat-av { display: inline-block; }
.chat-av.na { display: inline-grid; place-items: center; background: var(--c-primary-light); color: var(--c-primary); font-weight: 800; font-size: .62rem; }
.chat-name { color: inherit; text-decoration: none; font-weight: 700; }

/* lesson YouTube embed */
.lesson-video { position: relative; width: 100%; aspect-ratio: 16/9; margin: 18px 0 6px; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(28,34,64,.14); background: #000; }
.lesson-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson-video-cap { font-size: .85rem; margin: 0 0 4px; }
.yt-chip { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 800; color: #fff; background: #ff0033; padding: 6px 12px; border-radius: 999px; text-decoration: none; box-shadow: 0 4px 12px rgba(255,0,51,.28); }
.yt-chip:hover { filter: brightness(1.06); }
.chat-name:hover { text-decoration: underline; }
.chat-meta a { display: inline-flex; align-items: center; }
.chat-meta .chat-report { background: none; border: 0; cursor: pointer; opacity: .5; font-size: .72rem; }
.chat-meta .chat-report:hover { opacity: 1; }
.chat-bubble { display: inline-block; padding: 8px 12px; border-radius: 14px; background: var(--c-bg); border: 1px solid var(--c-border);
  font-size: .92rem; line-height: 1.45; word-break: break-word; white-space: pre-wrap; text-align: left; }
.chat-msg.mine .chat-bubble { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.chat-msg.admin .chat-bubble { border-color: #f59e0b; background: #fff8ef; color: #1f2533; }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--c-border); align-items: center; }
.chat-input input { flex: 1; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: 999px; background: var(--c-bg); color: var(--c-text); font-size: .92rem; }
.chat-input .btn { padding: 9px 14px; border-radius: 999px; }
@media (max-width: 480px) { .chat-panel { width: calc(100vw - 24px); } #chatWidget { right: 12px; bottom: 12px; } }

/* Level groups on courses page */
.level-group { margin-bottom: 40px; }
.level-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 2px solid var(--c-border); }
.level-head .level-emoji { font-size: 2rem; }
.level-head .level-count { margin-left: auto; font-weight: 800; font-size: .85rem; color: var(--c-text-soft); background: var(--c-bg-soft); padding: 6px 12px; border-radius: 999px; }

/* Language switcher */
.lang-switch { position: relative; margin-left: 4px; }
.lang-btn { background: var(--c-bg-soft); border: 1px solid var(--c-border); color: var(--c-text); border-radius: 9px; padding: 7px 12px; font-weight: 800; font-size: .85rem; cursor: pointer; }
.lang-btn:hover { background: var(--c-primary-light); }
.lang-menu { position: absolute; right: 0; top: 44px; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 168px; display: none; z-index: 60; }
.lang-menu.open { display: block; }
.lang-menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px; font-weight: 600; color: var(--c-text); cursor: pointer; font-size: .92rem; }
.lang-menu button:hover { background: var(--c-bg-soft); }
.lang-menu button.active { background: var(--c-primary-light); color: var(--c-primary); font-weight: 800; }
@media (max-width: 760px) { .lang-menu { right: auto; left: 0; } }
