/* ============================================================
   MỤC LỤC (TOC) — cấu trúc giữ nguyên vị trí, chỉ đánh dấu mục:
   1. Tokens & theme  — :root, .ftka-dark-ui, body[data-style=…] (thứ tự QUAN TRỌNG)
   2. Base & shared   — nút, input, card, bảng, layout khung (sidebar/topbar)
   3. Pages           — dv-*(dashboard) gen-* qz-* gr-* rv-* ls-* anki-* admin-* …
   4. Responsive      — cuối file, mỗi breakpoint đúng MỘT khối @media
   ============================================================ */

:root {
    color-scheme: light;
    /* Calm, focused light theme — soft neutral canvas, single refined blue accent */
    --bg: #eef1f6;
    --surface: #ffffff;
    --surface-soft: #f6f8fb;
    --surface-blue: #eef3ff;
    --line: #e3e8ef;
    --line-strong: #cdd5e0;
    --text: #1a2233;
    --text-soft: #475063;
    --muted: #7a8499;
    --primary: #3b62e6;
    --primary-strong: #2c4bc4;
    --primary-soft: #e6ecfd;
    --info: #0e7fb8;
    --info-soft: #e0f2fe;
    --success: #16855a;
    --success-soft: #d8f3e6;
    --warning: #b06a06;
    --warning-soft: #fcefcf;
    --danger: #d4493f;
    --danger-soft: #fbe5e3;
    --shadow-sm: 0 1px 2px rgba(26, 34, 51, .05);
    --shadow-md: 0 6px 20px rgba(26, 34, 51, .07);
    --shadow-lg: 0 16px 44px rgba(26, 34, 51, .12);
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --sidebar-width: 272px;
    --sidebar-compact: 82px;
    --topbar-height: 74px;
    /* Korean glyphs render in Noto Sans KR while Latin/Vietnamese stay in Inter */
    --font-base: Inter, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-kr: "Noto Sans KR", Inter, system-ui, sans-serif;
}

body.ftka-dark-ui {
    color-scheme: dark;
    --bg: #0e1320;
    --surface: #171d2b;
    --surface-soft: #1d2536;
    --surface-blue: #1a2742;
    --line: #2a3346;
    --line-strong: #3a455c;
    --text: #f1f5fb;
    --text-soft: #c4cee0;
    --muted: #8c97ac;
    --primary: #6f92ff;
    --primary-strong: #93adff;
    --primary-soft: #21304f;
    --info: #46b6e8;
    --info-soft: #18324a;
    --success: #4cc78d;
    --success-soft: #163328;
    --warning: #e0a85b;
    --warning-soft: #3a2e12;
    --danger: #f0726a;
    --danger-soft: #3a201e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 44px rgba(0, 0, 0, .45);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    background-color: var(--bg);
}

body {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    margin: 0;
    font-family: var(--font-base);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Calm canvas: a soft tinted wash instead of the busy crosshatch pattern */
body.ftka-light-ui {
    background-color: var(--bg);
    background-image:
        radial-gradient(120% 90% at 100% 0%, rgba(59, 98, 230, .06) 0%, transparent 55%),
        radial-gradient(100% 80% at 0% 100%, rgba(59, 98, 230, .04) 0%, transparent 50%);
    background-attachment: fixed;
}

body.ftka-dark-ui {
    background-color: var(--bg);
    background-image:
        radial-gradient(120% 90% at 100% 0%, rgba(111, 146, 255, .08) 0%, transparent 55%),
        radial-gradient(100% 80% at 0% 100%, rgba(111, 146, 255, .05) 0%, transparent 50%);
    background-attachment: fixed;
}

/* ============================================================
   6 STYLE VARIANTS — chọn ở trang "Giao diện", áp qua body[data-style].
   Tận dụng token semantic sẵn có: đổi token → toàn app đổi theo.
   Đặt SAU block .ftka-dark-ui để thắng khi cùng độ đặc hiệu.
   ============================================================ */
:root { --font-display: var(--font-base); }
h1, h2, h3, .logo-text h1 { font-family: var(--font-display); }

/* Studio — indigo hiện đại, sạch */
body[data-style="studio"] {
  --bg:#f5f7fb; --surface:#fff; --surface-soft:#f7f9fc; --surface-blue:#eef2ff;
  --line:#e6eaf1; --line-strong:#d3dae6; --text:#131a2b; --text-soft:#525c74; --muted:#79839a;
  --primary:#4361ee; --primary-strong:#3049d6; --primary-soft:#eaefff;
  --success:#0f9d6f; --success-soft:#d8f6ea; --warning:#c67c10; --warning-soft:#fdeecd;
  --danger:#dc2626; --danger-soft:#fde5e5; --info:#0e7fb8; --info-soft:#e0f2fe;
  --shadow-sm:0 1px 2px rgba(19,26,43,.06); --shadow-md:0 6px 20px rgba(19,26,43,.08); --shadow-lg:0 18px 48px rgba(19,26,43,.14);
  --radius-sm:10px; --radius:16px; --radius-lg:22px;
  --font-display:"Plus Jakarta Sans","Inter","Noto Sans KR",sans-serif;
}
/* Warm — kem/giấy, tiêu đề serif */
body[data-style="warm"] {
  --bg:#f6f1e7; --surface:#fffdf8; --surface-soft:#f9f4ea; --surface-blue:#f3ece0;
  --line:#e7dcc6; --line-strong:#d8c9ac; --text:#33291c; --text-soft:#5f5136; --muted:#8a7a5c;
  --primary:#bb5836; --primary-strong:#9c4726; --primary-soft:#f6e6dd;
  --success:#5e7d18; --success-soft:#e9efd7; --warning:#a9760a; --warning-soft:#f6ecc9;
  --danger:#c0392b; --danger-soft:#f6e0dc; --info:#2f6f7d; --info-soft:#dceef1;
  --shadow-sm:0 1px 2px rgba(70,55,30,.08); --shadow-md:0 6px 18px rgba(70,55,30,.12); --shadow-lg:0 16px 40px rgba(70,55,30,.18);
  --radius-sm:10px; --radius:16px; --radius-lg:20px;
  --font-display:"Fraunces",Georgia,serif;
  background-image:none;
}
/* Midnight — tối cao cấp */
body[data-style="midnight"] {
  --bg:#0a0e17; --surface:#121826; --surface-soft:#0f1420; --surface-blue:#152036;
  --line:#232c3d; --line-strong:#33405a; --text:#eef2fb; --text-soft:#b2bccf; --muted:#828da3;
  --primary:#6f92ff; --primary-strong:#93adff; --primary-soft:#1c2743;
  --success:#34d399; --success-soft:#0f3328; --warning:#fbbf24; --warning-soft:#3a2e0f;
  --danger:#f87171; --danger-soft:#3a1e1e; --info:#38bdf8; --info-soft:#0e2a3a;
  --shadow-sm:0 1px 2px rgba(0,0,0,.5); --shadow-md:0 8px 26px rgba(0,0,0,.5); --shadow-lg:0 20px 50px rgba(0,0,0,.6);
  --radius-sm:10px; --radius:16px; --radius-lg:22px;
  --font-display:"Sora","Inter",sans-serif;
}
/* Glass — kính mờ trên nền gradient */
body[data-style="glass"] {
  --bg:#eaf0ff; --surface:rgba(255,255,255,.62); --surface-soft:rgba(255,255,255,.46); --surface-blue:rgba(255,255,255,.5);
  --line:rgba(255,255,255,.7); --line-strong:rgba(110,122,170,.35); --text:#161a30; --text-soft:#3b4262; --muted:#5b6486;
  --primary:#5566ff; --primary-strong:#3d4ee6; --primary-soft:rgba(85,102,255,.16);
  --success:#0d9488; --success-soft:rgba(13,148,136,.16); --warning:#c2790a; --warning-soft:rgba(194,121,10,.18);
  --danger:#dc2626; --danger-soft:rgba(220,38,38,.14); --info:#0284c7; --info-soft:rgba(2,132,199,.14);
  --shadow-sm:0 4px 24px rgba(50,60,120,.10); --shadow-md:0 12px 40px rgba(50,60,120,.16); --shadow-lg:0 20px 60px rgba(50,60,120,.22);
  --radius-sm:14px; --radius:20px; --radius-lg:26px;
  --font-display:"Outfit","Inter",sans-serif;
  background-image:
    radial-gradient(1100px 600px at 8% -8%, #b9c6ff 0%, transparent 55%),
    radial-gradient(1000px 700px at 112% 18%, #ffd0e6 0%, transparent 52%),
    linear-gradient(160deg,#eef1ff,#f6efff 60%,#eafaf6);
}
body[data-style="glass"] .sidebar,
body[data-style="glass"] .topbar,
body[data-style="glass"] .mobile-header {
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
}
/* Clay — mềm, bóng màu nhẹ, bo góc lớn */
body[data-style="clay"] {
  --bg:#eef0fb; --surface:#ffffff; --surface-soft:#f5f6ff; --surface-blue:#eceefb;
  --line:#eceefb; --line-strong:#dee2f6; --text:#2e3350; --text-soft:#5a6187; --muted:#8b93b4;
  --primary:#6e77ff; --primary-strong:#565ee6; --primary-soft:#e9eaff;
  --success:#12bd8c; --success-soft:#d5f6ec; --warning:#e0902a; --warning-soft:#ffeecd;
  --danger:#e05260; --danger-soft:#fde5e8; --info:#5b8def; --info-soft:#e3ecff;
  --shadow-sm:0 6px 18px rgba(110,119,255,.10); --shadow-md:0 12px 30px rgba(110,119,255,.16); --shadow-lg:0 22px 46px rgba(110,119,255,.22);
  --radius-sm:16px; --radius:24px; --radius-lg:30px;
  --font-display:"Baloo 2","Inter",sans-serif;
  background-image:none;
}
/* Neo — brutalist: viền đậm, bóng cứng lệch */
body[data-style="neo"] {
  --bg:#fdfbf3; --surface:#ffffff; --surface-soft:#fffdf5; --surface-blue:#fff3bf;
  --line:#111111; --line-strong:#111111; --text:#111; --text-soft:#2f2f2f; --muted:#565656;
  --primary:#ff5c00; --primary-strong:#e04e00; --primary-soft:#ffe4d3;
  --success:#008f6b; --success-soft:#c4f5e8; --warning:#b8860b; --warning-soft:#fff3bf;
  --danger:#e5342b; --danger-soft:#ffe0dd; --info:#2b6fff; --info-soft:#dbe6ff;
  --shadow-sm:2px 2px 0 #111; --shadow-md:4px 4px 0 #111; --shadow-lg:6px 6px 0 #111;
  --radius-sm:6px; --radius:9px; --radius-lg:12px;
  --font-display:"Space Grotesk","Inter",sans-serif;
  background-image:none;
}
/* Forest — rừng, cây lá, thiên nhiên: xanh lá + nâu đất, bo góc hữu cơ */
body[data-style="forest"] {
  --bg:#eef3e8; --surface:#fdfefb; --surface-soft:#f3f7ee; --surface-blue:#e6f0e0;
  --line:#dbe7d2; --line-strong:#c0d3b3; --text:#1f2d1b; --text-soft:#47583e; --muted:#748568;
  --primary:#3e7c3a; --primary-strong:#2f622c; --primary-soft:#e1f0dc;
  --success:#2e7d32; --success-soft:#ddf0dd; --warning:#a1740f; --warning-soft:#f5ecce;
  --danger:#bf4433; --danger-soft:#f7e2dd; --info:#33707e; --info-soft:#ddeef2;
  --shadow-sm:0 1px 2px rgba(37,58,30,.08); --shadow-md:0 6px 18px rgba(37,58,30,.12); --shadow-lg:0 16px 40px rgba(37,58,30,.18);
  --radius-sm:12px; --radius:18px; --radius-lg:24px;
  --font-display:"Plus Jakarta Sans","Inter","Noto Sans KR",sans-serif;
  /* khung cảnh rừng: tán xa mờ + rặng thông + bụi + nấm + dương xỉ (dải đáy lặp),
     cành lá rủ 2 góc trên, đàn chim, lá rơi rải rác */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='90'%3E%3Cg stroke='%232f622c' stroke-opacity='.16' stroke-width='3' fill='none' stroke-linecap='round'%3E%3Cpath d='M20 50q11-14 22 0q11-14 22 0'/%3E%3Cpath d='M110 30q9-11 18 0q9-11 18 0'/%3E%3Cpath d='M170 62q7-9 14 0q7-9 14 0'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='170'%3E%3Cpath d='M0 8q90 6 150 58' stroke='%233e7c3a' stroke-opacity='.12' stroke-width='5' fill='none'/%3E%3Cg fill='%233e7c3a' fill-opacity='.10'%3E%3Cellipse cx='64' cy='34' rx='30' ry='11' transform='rotate(28 64 34)'/%3E%3Cellipse cx='104' cy='52' rx='26' ry='10' transform='rotate(38 104 52)'/%3E%3Cellipse cx='137' cy='74' rx='22' ry='9' transform='rotate(46 137 74)'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='170'%3E%3Cpath d='M300 8q-90 6-150 58' stroke='%233e7c3a' stroke-opacity='.12' stroke-width='5' fill='none'/%3E%3Cg fill='%233e7c3a' fill-opacity='.10'%3E%3Cellipse cx='236' cy='34' rx='30' ry='11' transform='rotate(-28 236 34)'/%3E%3Cellipse cx='196' cy='52' rx='26' ry='10' transform='rotate(-38 196 52)'/%3E%3Cellipse cx='163' cy='74' rx='22' ry='9' transform='rotate(-46 163 74)'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='320'%3E%3Cg fill='%233e7c3a' fill-opacity='.06'%3E%3Cpath d='M40 60q10-16 24-18q-2 16-14 24q-6-2-10-6z'/%3E%3Cpath d='M190 140q12-14 26-14q-4 16-17 22q-6-3-9-8z'/%3E%3Cpath d='M90 260q8-16 22-19q-1 15-12 24q-7-2-10-5z'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='220'%3E%3Cg fill='%233e7c3a' fill-opacity='.05'%3E%3Ccircle cx='30' cy='205' r='45'/%3E%3Ccircle cx='120' cy='210' r='55'/%3E%3Ccircle cx='250' cy='208' r='48'/%3E%3Ccircle cx='400' cy='212' r='60'/%3E%3Ccircle cx='530' cy='206' r='50'/%3E%3C/g%3E%3Cg fill='%232f622c' fill-opacity='.12'%3E%3Cpath d='M70 220v-36l-18 7 22-40-13 5 24-46 24 46-13-5 22 40-18-7v36z'/%3E%3Cpath d='M180 220v-26l-14 6 18-32-10 4 20-36 20 36-10-4 18 32-14-6v26z'/%3E%3Cpath d='M420 220v-40l-20 8 24-44-14 5 26-50 26 50-14-5 24 44-20-8v40z'/%3E%3Cpath d='M530 220v-24l-12 5 15-28-9 3 17-32 17 32-9-3 15 28-12-5v24z'/%3E%3Ccircle cx='280' cy='204' r='18'/%3E%3Ccircle cx='310' cy='210' r='12'/%3E%3C/g%3E%3Cg fill='%23a1740f' fill-opacity='.14'%3E%3Crect x='347' y='200' width='7' height='16'/%3E%3Cpath d='M336 202a15 15 0 0 1 30 0z'/%3E%3C/g%3E%3Cg stroke='%232f622c' stroke-opacity='.10' stroke-width='3' fill='none'%3E%3Cpath d='M560 218q-6-26 10-44'/%3E%3Cpath d='M560 218q-16-20-8-40'/%3E%3Cpath d='M560 218q4-22 22-30'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(165deg,#f0f5e9,#e5efdc 65%,#e9f2e0);
  background-position:right 16% top 64px, left top, right top, 0 0, left bottom, center;
  background-repeat:no-repeat, no-repeat, no-repeat, repeat, repeat-x, no-repeat;
  background-size:auto, auto, auto, 260px 320px, 600px 220px, cover;
  background-attachment:fixed, fixed, fixed, fixed, fixed, fixed;
}
/* Minecraft — khối vuông, viền chunky, bóng cứng, palette cỏ/đất/trời */
body[data-style="minecraft"] {
  --bg:#dcefff; --surface:#fffef8; --surface-soft:#f1f7e9; --surface-blue:#e2f2d8;
  --line:#4a4a4a; --line-strong:#262626; --text:#1c1c1c; --text-soft:#3d3d3d; --muted:#5f5f5f;
  --primary:#5d9c3f; --primary-strong:#4a8332; --primary-soft:#dff0d1;
  --success:#3f8f2f; --success-soft:#dcf2d4; --warning:#a9760a; --warning-soft:#f7ecc7;
  --danger:#c43c2c; --danger-soft:#f8ded9; --info:#2b6fb0; --info-soft:#dcebf9;
  --shadow-sm:3px 3px 0 #2b2b2b; --shadow-md:5px 5px 0 #2b2b2b; --shadow-lg:8px 8px 0 #2b2b2b;
  --radius-sm:0px; --radius:0px; --radius-lg:0px;
  --font-display:ui-monospace,"Cascadia Mono",Consolas,"Courier New",monospace;
  /* thế giới khối: mây pixel + mặt trời vuông (trên), cây oak + mặt creeper (đứng trên đất),
     địa hình grass/dirt/đá + quặng kim cương lặp ở đáy, lưới pixel mờ toàn nền */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='80' viewBox='0 0 24 8'%3E%3Cg fill='%23ffffff' fill-opacity='.6'%3E%3Crect x='2' y='3' width='6' height='2'/%3E%3Crect x='3' y='2' width='4' height='1'/%3E%3Crect x='15' y='4' width='7' height='2'/%3E%3Crect x='16' y='3' width='5' height='1'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Crect width='56' height='56' fill='%23f2c94c' fill-opacity='.30'/%3E%3Crect x='12' y='12' width='32' height='32' fill='%23f7dd7a' fill-opacity='.35'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='130'%3E%3Cg fill='%233f8f2c' fill-opacity='.16'%3E%3Crect x='20' y='10' width='60' height='22'/%3E%3Crect x='8' y='32' width='84' height='34'/%3E%3Crect x='20' y='66' width='60' height='14'/%3E%3C/g%3E%3Crect x='42' y='80' width='16' height='50' fill='%236b4726' fill-opacity='.18'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 8 8'%3E%3Cg fill='%233f7d2c' fill-opacity='.18'%3E%3Crect x='1' y='1' width='2' height='2'/%3E%3Crect x='5' y='1' width='2' height='2'/%3E%3Crect x='3' y='3' width='2' height='2'/%3E%3Crect x='2' y='4' width='1' height='3'/%3E%3Crect x='5' y='4' width='1' height='3'/%3E%3Crect x='3' y='6' width='2' height='1'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='88'%3E%3Crect width='128' height='14' fill='%235d9c3f' fill-opacity='.22'/%3E%3Cg fill='%234a8332' fill-opacity='.20'%3E%3Crect x='8' y='10' width='8' height='8'/%3E%3Crect x='44' y='10' width='8' height='8'/%3E%3Crect x='84' y='10' width='8' height='8'/%3E%3Crect x='112' y='10' width='8' height='8'/%3E%3C/g%3E%3Crect y='14' width='128' height='74' fill='%237a5230' fill-opacity='.10'/%3E%3Cg fill='%236b4726' fill-opacity='.12'%3E%3Crect x='12' y='26' width='10' height='10'/%3E%3Crect x='58' y='40' width='10' height='10'/%3E%3Crect x='30' y='62' width='10' height='10'/%3E%3Crect x='104' y='30' width='10' height='10'/%3E%3C/g%3E%3Crect x='78' y='58' width='26' height='18' fill='%23808891' fill-opacity='.14'/%3E%3Crect x='84' y='62' width='8' height='8' fill='%236d757e' fill-opacity='.14'/%3E%3Cg fill='%2340c8d0' fill-opacity='.30'%3E%3Crect x='20' y='76' width='5' height='5'/%3E%3Crect x='27' y='81' width='5' height='5'/%3E%3Crect x='27' y='71' width='5' height='5'/%3E%3Crect x='34' y='76' width='5' height='5'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(rgba(0,0,0,0) 96%, rgba(43,74,32,.05) 96%),
    linear-gradient(90deg, rgba(0,0,0,0) 96%, rgba(43,74,32,.05) 96%);
  background-position:left 12% top 28px, right 9% top 30px, left 8% bottom 82px, right 36px bottom 92px, left bottom, 0 0, 0 0;
  background-repeat:no-repeat, no-repeat, no-repeat, no-repeat, repeat-x, repeat, repeat;
  background-size:240px 80px, 56px 56px, 100px 130px, 120px 120px, 128px 88px, 26px 26px, 26px 26px;
  background-attachment:fixed, fixed, fixed, fixed, fixed, fixed, fixed;
}
/* Ocean — biển: aqua/teal thoáng, nhấn san hô */
body[data-style="ocean"] {
  --bg:#e5f4f8; --surface:#ffffff; --surface-soft:#eff8fa; --surface-blue:#def0f5;
  --line:#d2e8ed; --line-strong:#b2d6de; --text:#0f2b33; --text-soft:#3b5a63; --muted:#6a8a93;
  --primary:#0288a7; --primary-strong:#026e88; --primary-soft:#d8f1f6;
  --success:#0d9477; --success-soft:#d7f3ec; --warning:#c07b2a; --warning-soft:#f9ecd8;
  --danger:#e0533f; --danger-soft:#fbe4df; --info:#0277bd; --info-soft:#ddf0fb;
  --shadow-sm:0 1px 2px rgba(7,64,80,.08); --shadow-md:0 8px 22px rgba(7,64,80,.12); --shadow-lg:0 18px 44px rgba(7,64,80,.18);
  --radius-sm:12px; --radius:18px; --radius-lg:26px;
  --font-display:"Sora","Inter",sans-serif;
  /* đáy biển: sóng 2 lớp + rong + san hô + sao biển + vỏ sò + đàn cá (dải đáy lặp),
     sứa lơ lửng bên phải, bọt khí, thuyền buồm + mặt trời góc trái trên */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120'%3E%3Ccircle cx='36' cy='34' r='16' fill='%23f2c94c' fill-opacity='.25'/%3E%3Cg fill='%23026e88' fill-opacity='.12'%3E%3Cpath d='M150 74h56l-10 14h-36z'/%3E%3Cpath d='M176 30v40h-24z'/%3E%3Cpath d='M182 34v36h20z'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='110' height='150'%3E%3Cpath d='M25 52a30 30 0 0 1 60 0q0 10-8 10h-44q-8 0-8-10z' fill='%230288a7' fill-opacity='.11'/%3E%3Cg stroke='%230288a7' stroke-opacity='.11' stroke-width='3' fill='none' stroke-linecap='round'%3E%3Cpath d='M38 64q-6 22 4 40q-8 16 2 34'/%3E%3Cpath d='M55 64q6 24-2 44q6 18-2 34'/%3E%3Cpath d='M72 64q8 20-2 38q8 18 0 34'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='340'%3E%3Cg fill='none' stroke='%230288a7' stroke-opacity='.16' stroke-width='2'%3E%3Ccircle cx='60' cy='300' r='9'/%3E%3Ccircle cx='84' cy='240' r='5'/%3E%3Ccircle cx='48' cy='180' r='7'/%3E%3Ccircle cx='76' cy='110' r='4'/%3E%3Ccircle cx='58' cy='50' r='6'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='170'%3E%3Cpath d='M0 60Q75 30 150 60T300 60T450 60T600 60V170H0z' fill='%230288a7' fill-opacity='.07'/%3E%3Cpath d='M0 92Q75 64 150 92T300 92T450 92T600 92V170H0z' fill='%23026e88' fill-opacity='.09'/%3E%3Cg stroke='%230d9477' stroke-opacity='.14' stroke-width='4' fill='none' stroke-linecap='round'%3E%3Cpath d='M48 168q-8-24 4-46q-10-18 2-34'/%3E%3Cpath d='M66 168q8-22-2-42q10-16 0-32'/%3E%3Cpath d='M84 168q-6-20 4-38'/%3E%3C/g%3E%3Cg stroke='%23e0533f' stroke-opacity='.13' stroke-width='5' fill='none' stroke-linecap='round'%3E%3Cpath d='M300 168v-28m0 12l-14-18m14 6l16-22m-16 8l-6-10'/%3E%3C/g%3E%3Cpath d='M430 140l6 12 13 2-9 9 2 13-12-6-12 6 2-13-9-9 13-2z' fill='%23e0533f' fill-opacity='.15'/%3E%3Cpath d='M520 168a16 16 0 0 1 32 0z' fill='%230288a7' fill-opacity='.12'/%3E%3Cg fill='%23026e88' fill-opacity='.12'%3E%3Cpath d='M190 36q12-9 26 0-14 9-26 0zm26 0 9-7v14z'/%3E%3Cpath d='M245 22q12-9 26 0-14 9-26 0zm26 0 9-7v14z'/%3E%3Cpath d='M295 46q12-9 26 0-14 9-26 0zm26 0 9-7v14z'/%3E%3Cpath d='M340 28q12-9 26 0-14 9-26 0zm26 0 9-7v14z'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(180deg,#ecf8fb,#dff0f5 70%,#e3f3f1);
  background-position:left 6% top 24px, right 12% top 32%, left 28px center, left bottom, center;
  background-repeat:no-repeat, no-repeat, no-repeat, repeat-x, no-repeat;
  background-size:auto, auto, auto, 600px 170px, cover;
  background-attachment:fixed, fixed, fixed, fixed, fixed;
}
/* Hàn Quốc — giấy hanji ấm, xanh taegeuk + nhấn đỏ dancheong, serif truyền thống */
body[data-style="korea"] {
  --bg:#faf5ec; --surface:#fffdf7; --surface-soft:#f7f1e3; --surface-blue:#efe7d6;
  --line:#e8dcc6; --line-strong:#d3c4a3; --text:#2b2118; --text-soft:#5a4b37; --muted:#89785e;
  --primary:#1d4f9e; --primary-strong:#16407f; --primary-soft:#e2eaf7;
  --success:#3a7d44; --success-soft:#e2efe1; --warning:#b8860b; --warning-soft:#f6ecc9;
  --danger:#cd2e3a; --danger-soft:#f9e0e2; --info:#2f6f7d; --info-soft:#dceef1;
  --shadow-sm:0 1px 2px rgba(64,48,24,.08); --shadow-md:0 6px 18px rgba(64,48,24,.12); --shadow-lg:0 16px 40px rgba(64,48,24,.18);
  --radius-sm:8px; --radius:12px; --radius-lg:16px;
  --font-display:"Fraunces","Noto Sans KR",Georgia,serif;
  /* tranh phong cảnh: thái cực (phải trên), cành anh đào nở (trái trên), mây 구름무늬 (giữa trên),
     cánh hoa rơi rải rác, dải đáy lặp = núi minhwa + chùa tháp + tùng cong */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='130' height='130' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='48' fill='%230047a0' fill-opacity='.09'/%3E%3Cpath d='M2 50a48 48 0 0 1 96 0 24 24 0 0 1-48 0 24 24 0 1 0-48 0z' fill='%23cd2e3a' fill-opacity='.11'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='200'%3E%3Cg stroke='%235a4b37' stroke-opacity='.14' stroke-width='5' fill='none' stroke-linecap='round'%3E%3Cpath d='M0 16q110 10 180 74'/%3E%3Cpath d='M96 44q30 8 44 34'/%3E%3Cpath d='M150 78q26 2 40 22'/%3E%3C/g%3E%3Cg fill='%23cd2e3a' fill-opacity='.10'%3E%3Ccircle cx='122' cy='39' r='4'/%3E%3Ccircle cx='127' cy='43' r='4'/%3E%3Ccircle cx='125' cy='49' r='4'/%3E%3Ccircle cx='119' cy='49' r='4'/%3E%3Ccircle cx='117' cy='43' r='4'/%3E%3Ccircle cx='168' cy='65' r='4'/%3E%3Ccircle cx='173' cy='69' r='4'/%3E%3Ccircle cx='171' cy='75' r='4'/%3E%3Ccircle cx='165' cy='75' r='4'/%3E%3Ccircle cx='163' cy='69' r='4'/%3E%3Ccircle cx='204' cy='95' r='4'/%3E%3Ccircle cx='209' cy='99' r='4'/%3E%3Ccircle cx='207' cy='105' r='4'/%3E%3Ccircle cx='201' cy='105' r='4'/%3E%3Ccircle cx='199' cy='99' r='4'/%3E%3Ccircle cx='240' cy='123' r='4'/%3E%3Ccircle cx='245' cy='127' r='4'/%3E%3Ccircle cx='243' cy='133' r='4'/%3E%3Ccircle cx='237' cy='133' r='4'/%3E%3Ccircle cx='235' cy='127' r='4'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='120'%3E%3Cg fill='none' stroke='%231d4f9e' stroke-opacity='.10' stroke-width='6' stroke-linecap='round'%3E%3Cpath d='M30 84q30-50 72-28q10-26 44-18q30 6 26 34'/%3E%3Cpath d='M52 104q46-32 118-22'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='340'%3E%3Cg fill='%23cd2e3a' fill-opacity='.06'%3E%3Cellipse cx='60' cy='70' rx='7' ry='4' transform='rotate(-24 60 70)'/%3E%3Cellipse cx='200' cy='150' rx='7' ry='4' transform='rotate(30 200 150)'/%3E%3Cellipse cx='110' cy='260' rx='7' ry='4' transform='rotate(-40 110 260)'/%3E%3Cellipse cx='240' cy='310' rx='6' ry='4' transform='rotate(16 240 310)'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='190'%3E%3Cg fill='%235a4b37' fill-opacity='.07'%3E%3Cpath d='M0 190L90 96l90 94z'/%3E%3Cpath d='M140 190L250 60l110 130z'/%3E%3Cpath d='M340 190l100-84 100 84z'/%3E%3Cpath d='M500 190l80-64 60 64z'/%3E%3C/g%3E%3Cg fill='%235a4b37' fill-opacity='.13'%3E%3Cpath d='M560 190v-18h24v18z'/%3E%3Cpath d='M544 172q28-8 56 0l-8-12h-40z'/%3E%3Crect x='566' y='148' width='12' height='12'/%3E%3Cpath d='M552 148q20-6 40 0l-7-10h-26z'/%3E%3Crect x='570' y='132' width='4' height='6'/%3E%3C/g%3E%3Cpath d='M84 190q-4-30 14-48' stroke='%235a4b37' stroke-opacity='.14' stroke-width='6' fill='none'/%3E%3Cg fill='%233a7d44' fill-opacity='.12'%3E%3Cellipse cx='104' cy='132' rx='30' ry='12'/%3E%3Cellipse cx='78' cy='150' rx='22' ry='9'/%3E%3C/g%3E%3C/svg%3E");
  background-position:right 34px top 90px, left top 6px, center top 34px, 0 0, left bottom;
  background-repeat:no-repeat, no-repeat, no-repeat, repeat, repeat-x;
  background-size:auto, auto, auto, 280px 340px, 640px 190px;
  background-attachment:fixed, fixed, fixed, fixed, fixed;
}
/* Việt Nam — lụa ngà ấm, đỏ cờ + vàng sao, serif thanh lịch */
body[data-style="vietnam"] {
  --bg:#fdf6ec; --surface:#fffdf8; --surface-soft:#faf2e4; --surface-blue:#f7ecd7;
  --line:#f0e1c6; --line-strong:#dfca9e; --text:#331f14; --text-soft:#60452e; --muted:#927559;
  --primary:#c8102e; --primary-strong:#a30d26; --primary-soft:#fbe2e1;
  --success:#33691e; --success-soft:#e4efd9; --warning:#d99a06; --warning-soft:#faefcd;
  --danger:#8f1d22; --danger-soft:#f4dfdd; --info:#1a6b8a; --info-soft:#def0f6;
  --shadow-sm:0 1px 2px rgba(84,42,20,.08); --shadow-md:0 6px 18px rgba(84,42,20,.12); --shadow-lg:0 16px 40px rgba(84,42,20,.18);
  --radius-sm:10px; --radius:14px; --radius-lg:18px;
  --font-display:"Fraunces",Georgia,serif;
  /* bức tranh quê: đầm sen (2 hoa + nụ + lá sen + gợn nước, đáy trái), đàn chim Lạc bay
     (giữa trên), vịnh Hạ Long + thuyền buồm (đáy phải), sao vàng (phải trên) */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='130' height='130' viewBox='0 0 100 100'%3E%3Cpath d='M50 8 61 39h33L67 58l10 32-27-20-27 20 10-32L6 39h33z' fill='%23d99a06' fill-opacity='.14'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='110'%3E%3Cg stroke='%23c8102e' stroke-opacity='.10' stroke-width='4' fill='none' stroke-linecap='round'%3E%3Cpath d='M40 62q22-18 48-8l24-12'/%3E%3Cpath d='M86 54q10 12 2 24'/%3E%3Cpath d='M170 34q18-14 38-6l19-10'/%3E%3Cpath d='M206 28q8 10 1 20'/%3E%3Cpath d='M280 66q16-12 34-6l17-8'/%3E%3Cpath d='M312 60q7 9 1 18'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='140'%3E%3Cg fill='%2360452e' fill-opacity='.08'%3E%3Cpath d='M20 140q6-56 44-64q34 8 38 64z'/%3E%3Cpath d='M110 140q4-38 30-46q24 8 28 46z'/%3E%3Cpath d='M180 140q6-64 40-74q30 12 34 74z'/%3E%3C/g%3E%3Cg fill='%23c8102e' fill-opacity='.10'%3E%3Cpath d='M96 128h34l-6 8h-22z'/%3E%3Cpath d='M112 106v20h-14z'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='230'%3E%3Cg stroke='%231a6b8a' stroke-opacity='.08' stroke-width='3' fill='none'%3E%3Cpath d='M20 214q40-10 80 0'/%3E%3Cpath d='M150 222q50-12 100 0'/%3E%3Cpath d='M300 216q40-10 80 0'/%3E%3C/g%3E%3Cg fill='%2333691e' fill-opacity='.09'%3E%3Ccircle cx='120' cy='176' r='44'/%3E%3Ccircle cx='330' cy='190' r='32'/%3E%3C/g%3E%3Cg stroke='%2333691e' stroke-opacity='.10' stroke-width='5' fill='none'%3E%3Cpath d='M212 226q-4-56 0-96'/%3E%3Cpath d='M282 226q2-42-2-70'/%3E%3Cpath d='M400 224q0-28 0-44'/%3E%3C/g%3E%3Cg fill='%23c8102e' fill-opacity='.11'%3E%3Cpath d='M212 130c-10-26-10-54 0-80 10 26 10 54 0 80z'/%3E%3Cpath d='M212 130c-23-13-38-36-44-62 23 13 38 36 44 62z'/%3E%3Cpath d='M212 130c23-13 38-36 44-62-23 13-38 36-44 62z'/%3E%3Cpath d='M212 130c-31-2-59-11-77-26 30-3 58 7 77 26z'/%3E%3Cpath d='M212 130c31-2 59-11 77-26-30-3-58 7-77 26z'/%3E%3Cpath d='M400 180c-5-13-5-27 0-40 5 13 5 27 0 40z'/%3E%3Cpath d='M400 180c-12-7-19-18-22-31 12 7 19 18 22 31z'/%3E%3Cpath d='M400 180c12-7 19-18 22-31-12 7-19 18-22 31z'/%3E%3Cpath d='M282 156c-7-14-7-30 0-44 7 14 7 30 0 44z'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(165deg,#fdf7ed,#fbeeda 70%,#fcf3e4);
  background-position:right 40px top 84px, center top 26px, right bottom, left 16px bottom, center;
  background-repeat:no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-size:auto, auto, auto, auto, cover;
  background-attachment:fixed, fixed, fixed, fixed, fixed;
}

/* ── Chi tiết COMPONENT theo 5 skin đặc biệt ─────────────────────────────
   Nút, nav, thẻ, sidebar mang chất liệu riêng của từng chủ đề. Chỉ dùng
   box-shadow / gradient / pseudo position:absolute — KHÔNG đổi layout. */

/* Forest: nút gradient lá, vân rêu mép trên thẻ, gờ thân cây ở nav active, cỏ đáy sidebar */
body[data-style="forest"] .dv-cta:not(.ghost):not(.danger) { background:linear-gradient(165deg,#4a8f45,#33682f); }
body[data-style="forest"] .nav-item.active { box-shadow:inset 3px 0 0 #1e4a1c, var(--shadow-sm); }
body[data-style="forest"] .dv-card, body[data-style="forest"] .spec-card, body[data-style="forest"] .itv-card { box-shadow:inset 0 3px 0 rgba(62,124,58,.22), var(--shadow-sm); }
body[data-style="forest"] .sidebar {
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='46'%3E%3Cg fill='%232f622c' fill-opacity='.10'%3E%3Cpath d='M28 46V33l-8 3 10-17-6 2 11-20 11 20-6-2 10 17-8-3v13z'/%3E%3Ccircle cx='74' cy='40' r='9'/%3E%3Cpath d='M118 46V36l-6 2 8-13-4 1 8-15 8 15-4-1 8 13-6-2v10z'/%3E%3C/g%3E%3Cpath d='M0 45h160' stroke='%232f622c' stroke-opacity='.12' stroke-width='2'/%3E%3C/svg%3E");
  background-position:center bottom; background-repeat:repeat-x;
}

/* Minecraft: nút/thẻ vát khối 3D kiểu UI game (sáng trên-trái, tối dưới-phải), bấm = lún, cỏ đáy sidebar */
body[data-style="minecraft"] .dv-cta { text-transform:uppercase; letter-spacing:.02em; border-color:#262626;
  box-shadow:inset 2px 2px 0 rgba(255,255,255,.35), inset -2px -3px 0 rgba(0,0,0,.28), 3px 3px 0 #2b2b2b; }
body[data-style="minecraft"] .dv-cta.ghost { box-shadow:inset 2px 2px 0 rgba(255,255,255,.65), inset -2px -3px 0 rgba(0,0,0,.14), 3px 3px 0 #2b2b2b; }
body[data-style="minecraft"] .dv-cta:active { transform:translate(2px,2px);
  box-shadow:inset 2px 3px 0 rgba(0,0,0,.28), inset -2px -2px 0 rgba(255,255,255,.2), 1px 1px 0 #2b2b2b; }
body[data-style="minecraft"] .nav-item.active { box-shadow:inset 2px 2px 0 rgba(255,255,255,.3), inset -2px -3px 0 rgba(0,0,0,.3); }
body[data-style="minecraft"] .dv-card, body[data-style="minecraft"] .spec-card, body[data-style="minecraft"] .itv-card, body[data-style="minecraft"] .style-card {
  box-shadow:inset 2px 2px 0 rgba(255,255,255,.5), inset -2px -2px 0 rgba(0,0,0,.06), var(--shadow-sm); }
body[data-style="minecraft"] .sidebar {
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='40'%3E%3Crect y='6' width='64' height='8' fill='%235d9c3f' fill-opacity='.20'/%3E%3Cg fill='%234a8332' fill-opacity='.18'%3E%3Crect x='4' y='12' width='6' height='6'/%3E%3Crect x='28' y='12' width='6' height='6'/%3E%3Crect x='50' y='12' width='6' height='6'/%3E%3C/g%3E%3Crect y='14' width='64' height='26' fill='%237a5230' fill-opacity='.09'/%3E%3Crect x='16' y='24' width='8' height='8' fill='%236b4726' fill-opacity='.11'/%3E%3Crect x='44' y='20' width='8' height='8' fill='%236b4726' fill-opacity='.11'/%3E%3C/svg%3E");
  background-position:center bottom; background-repeat:repeat-x;
}

/* Ocean: nút gradient nước + sóng trắng ở đáy nút, gợn sóng đáy thẻ, sóng+bọt đáy sidebar */
body[data-style="ocean"] .dv-cta:not(.ghost):not(.danger) {
  background-color:#0288a7;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='8'%3E%3Cpath d='M0 5Q6 1 12 5T24 5T36 5T48 5V8H0z' fill='%23ffffff' fill-opacity='.22'/%3E%3C/svg%3E"), linear-gradient(180deg,#05a3c4,#027089);
  background-position:left bottom, center; background-repeat:repeat-x, no-repeat; background-size:48px 8px, cover;
}
body[data-style="ocean"] .nav-item.active {
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='7'%3E%3Cpath d='M0 4Q6 1 12 4T24 4T36 4T48 4V7H0z' fill='%23ffffff' fill-opacity='.25'/%3E%3C/svg%3E");
  background-position:left bottom; background-repeat:repeat-x; background-size:48px 7px;
}
body[data-style="ocean"] .dv-card, body[data-style="ocean"] .spec-card, body[data-style="ocean"] .itv-card { box-shadow:inset 0 -3px 0 rgba(2,136,167,.16), var(--shadow-sm); }
body[data-style="ocean"] .sidebar {
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='44'%3E%3Cpath d='M0 26Q20 14 40 26T80 26T120 26T160 26V44H0z' fill='%230288a7' fill-opacity='.10'/%3E%3Cpath d='M0 34Q20 24 40 34T80 34T120 34T160 34V44H0z' fill='%23026e88' fill-opacity='.10'/%3E%3Cg fill='none' stroke='%230288a7' stroke-opacity='.16' stroke-width='2'%3E%3Ccircle cx='34' cy='12' r='4'/%3E%3Ccircle cx='120' cy='8' r='3'/%3E%3C/g%3E%3C/svg%3E");
  background-position:center bottom; background-repeat:repeat-x;
}

/* Hàn Quốc: nút xanh taegeuk viền vàng đồng dưới, ngoặc góc dancheong trên thẻ, chấm thái cực ở nav active, núi đáy sidebar */
body[data-style="korea"] .dv-cta:not(.ghost):not(.danger) { background:linear-gradient(165deg,#2a62b8,#173f80);
  box-shadow:var(--shadow-sm), inset 0 -2px 0 rgba(184,134,11,.5); }
body[data-style="korea"] .nav-item { position:relative; }
body[data-style="korea"] .nav-item.active::after { content:""; position:absolute; right:12px; top:50%; width:9px; height:9px; margin-top:-5px;
  border-radius:50%; background:linear-gradient(180deg,#e85560 50%,#3f74c9 50%); opacity:.95; pointer-events:none; }
body[data-style="korea"] .dv-card, body[data-style="korea"] .spec-card { position:relative; }
body[data-style="korea"] .dv-card::after, body[data-style="korea"] .spec-card::after { content:""; position:absolute; top:7px; right:7px; width:16px; height:16px;
  border-top:2px solid rgba(205,46,58,.34); border-right:2px solid rgba(29,79,158,.34); pointer-events:none; }
body[data-style="korea"] .sidebar {
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='48'%3E%3Cg fill='%235a4b37' fill-opacity='.08'%3E%3Cpath d='M0 48L30 18l30 30z'/%3E%3Cpath d='M44 48L84 8l40 40z'/%3E%3Cpath d='M112 48l30-24 28 24z'/%3E%3C/g%3E%3C/svg%3E");
  background-position:center bottom; background-repeat:repeat-x;
}

/* Việt Nam: nút đỏ cờ viền vàng dưới, sao vàng ở nav active, lụa đỏ mép trên thẻ, sen đáy sidebar */
body[data-style="vietnam"] .dv-cta:not(.ghost):not(.danger) { background:linear-gradient(165deg,#d41b38,#a30d26);
  box-shadow:var(--shadow-sm), inset 0 -2px 0 rgba(217,154,6,.6); }
body[data-style="vietnam"] .nav-item { position:relative; }
body[data-style="vietnam"] .nav-item.active::after { content:"★"; position:absolute; right:11px; top:50%; transform:translateY(-50%);
  font-size:10px; line-height:1; color:#ffcd00; opacity:.95; pointer-events:none; }
body[data-style="vietnam"] .dv-card, body[data-style="vietnam"] .spec-card, body[data-style="vietnam"] .itv-card { box-shadow:inset 0 3px 0 rgba(200,16,46,.15), var(--shadow-sm); }
body[data-style="vietnam"] .sidebar {
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='50'%3E%3Cg stroke='%231a6b8a' stroke-opacity='.10' stroke-width='2' fill='none'%3E%3Cpath d='M10 44q22-6 44 0'/%3E%3Cpath d='M100 46q26-7 52 0'/%3E%3C/g%3E%3Cg fill='%23c8102e' fill-opacity='.11'%3E%3Cpath d='M60 40c-4-11-4-22 0-33 4 11 4 22 0 33z'/%3E%3Cpath d='M60 40c-10-5-16-15-18-26 10 5 16 15 18 26z'/%3E%3Cpath d='M60 40c10-5 16-15 18-26-10 5-16 15-18 26z'/%3E%3C/g%3E%3Ccircle cx='118' cy='38' r='12' fill='%2333691e' fill-opacity='.10'/%3E%3C/svg%3E");
  background-position:center bottom; background-repeat:repeat-x;
}

/* Khung chờ (skeleton) khi đang soạn nội dung — dùng chung */
.ftka-skeleton { display: grid; gap: 12px; }
.ftka-skel-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px; box-shadow: var(--shadow-sm); }
.ftka-skel-line { height: 12px; border-radius: 6px; background: var(--surface-soft); position: relative; overflow: hidden; }
.ftka-skel-line + .ftka-skel-line { margin-top: 10px; }
.ftka-skel-line.lg { height: 18px; width: 45%; }
.ftka-skel-line.sm { width: 70%; }
.ftka-skel-line::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--line) 55%, transparent), transparent);
  animation: ftka-shimmer 1.4s infinite;
}
@keyframes ftka-shimmer { to { transform: translateX(100%); } }


/* Korean text as the visual hero — proper Hangul line-breaking + dedicated face */
:lang(ko),
.kr,
[data-lang="ko"] {
    font-family: var(--font-kr);
    word-break: keep-all;
    overflow-wrap: anywhere;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
}

button:not(:disabled),
a[href],
summary {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .62;
}

img,
audio,
canvas {
    max-width: 100%;
}

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent);
    outline-offset: 3px;
    border-radius: 4px;
}

.skip-link {
    position: fixed;
    left: 16px;
    top: 12px;
    z-index: 1000;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: #fff;
    background: var(--primary);
    transform: translateY(-140%);
}

.skip-link:focus {
    transform: translateY(0);
}

.global-loading {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 900;
    padding: 12px 16px;
    border-radius: var(--radius);
    color: #fff;
    background: var(--primary);
    box-shadow: var(--shadow-md);
}

.toast-root {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1200;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    display: grid;
    grid-template-columns: 10px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 14px;
    color: #0f172a;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 18px 42px rgba(15, 23, 42, .16);
    animation: toast-in .18s ease-out;
    pointer-events: auto;
}

.toast-hide {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .18s ease, transform .18s ease;
}

.toast-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--info);
}

.toast-success .toast-dot { background: var(--success); }
.toast-error .toast-dot { background: var(--danger); }
.toast-warning .toast-dot { background: var(--warning); }
.toast-info .toast-dot { background: var(--info); }

.toast-message {
    font-size: 14px;
    font-weight: 700;
}

.toast-close {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    font-size: 20px;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text);
    background: var(--surface-soft);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.app-container {
    display: grid;
    grid-template-columns: var(--sidebar-compact) minmax(0, 1fr);
    min-height: 100dvh;
    max-width: 100%;
    gap: 0;
}

.sidebar {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 0 18px 18px 0;
    background: var(--surface);
    backdrop-filter: blur(16px);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

body.ftka-dark-ui .sidebar {
    background: rgba(23, 32, 51, .94);
}

.sidebar-header {
    flex: 0 0 auto;
    padding: 18px 14px 14px;
}

.logo,
.mobile-brand,
.public-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.logo-icon,
.public-logo {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
    letter-spacing: 0;
}

.logo-text h1,
.logo-text p {
    margin: 0;
}

.logo-text h1 {
    font-size: 18px;
    line-height: 1.1;
}

.logo-text p,
.public-brand small,
.topbar-context p {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 14px 18px;
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-soft);
    font-weight: 650;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.nav-item:hover {
    color: var(--primary);
    background: var(--surface-blue);
}

.nav-item.active {
    color: #fff;
    background: var(--primary);
    box-shadow: var(--shadow-sm);
}

.nav-item .material-icons-outlined {
    font-size: 21px;
}

/* ── Sidebar: nhãn nhóm + khu vực người dùng (bố cục mới) ── */
.nav-group {
    display: block;
    font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
    color: var(--muted); padding: 12px 12px 4px;
}
.sidebar-nav > .nav-group:first-child { padding-top: 2px; }
.sidebar-user {
    flex: 0 0 auto; margin: 6px 14px 14px; display: flex; align-items: center; gap: 10px;
    padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); box-shadow: var(--shadow-sm);
}
.sidebar-user .su-avatar {
    width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
    font-weight: 800; color: #fff; background: var(--primary); overflow: hidden; text-decoration: none;
}
.sidebar-user .su-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user .su-who { flex: 1; min-width: 0; text-decoration: none; color: var(--text); }
.sidebar-user .su-who b { display: block; font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .su-who span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .su-logout {
    width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface);
    display: grid; place-items: center; color: var(--text-soft); flex: none; cursor: pointer;
}
.sidebar-user .su-logout:hover { color: var(--danger); }

/* ── Dashboard v2 (giống preview) — theo token nên đúng cả 6 style ── */
.dv-wrap { display: flex; flex-direction: column; gap: 16px; }
.dv-grid { display: grid; gap: 16px; }
.dv-c4 { grid-template-columns: repeat(4, 1fr); }
.dv-c2 { grid-template-columns: 1fr 1fr; }
.dv-main { grid-template-columns: 1.5fr 1fr; align-items: start; }
.dv-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.dv-today { display: flex; gap: 20px; align-items: center; padding: 22px; flex-wrap: wrap; }
.dv-today .lead { flex: 1; min-width: 240px; }
/* 2 nút trong "việc hôm nay" nằm cạnh nhau trong .lead (không phải flex-gap) — giữ khoảng cách
   sau khi bỏ margin-left mặc định của .dv-cta.ghost. */
.dv-today .lead .dv-cta + .dv-cta { margin-left: 8px; }
.dv-today h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.dv-today p { color: var(--muted); margin: 6px 0 14px; }
.dv-ring { width: 118px; height: 118px; border-radius: 50%; position: relative; display: grid; place-items: center; flex: none;
    background: conic-gradient(var(--primary) calc(var(--dv-p, 0) * 1%), var(--surface-soft) 0); }
.dv-ring::before { content: ""; position: absolute; width: 88px; height: 88px; border-radius: 50%; background: var(--surface); }
.dv-ring b { position: relative; font-size: 21px; font-weight: 800; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.dv-ring span { position: relative; font-size: 11px; color: var(--muted); font-weight: 600; text-align: center; display: block; }
/* Hệ nút CHUẨN duy nhất (xem docs/UI_GUIDE.md). Biến thể:
   .dv-cta (primary) · .ghost (secondary) · .danger · .block (full-width). */
.dv-cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 11px 16px; font-weight: 800; font-size: 14px; background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); min-height: 44px;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease, color .14s ease; }
.dv-cta.ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: none; }
.dv-cta.danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(220, 38, 38, .24); box-shadow: none; }
.dv-cta.block { width: 100%; }
.dv-cta:hover { background: var(--primary-strong); transform: translateY(-1px); }
.dv-cta.ghost:hover { background: var(--surface-blue); border-color: var(--primary-soft); color: var(--primary); transform: none; }
.dv-cta.danger:hover { background: var(--danger); color: #fff; transform: translateY(-1px); }
.dv-cta:disabled, .dv-cta[disabled] { opacity: .6; cursor: not-allowed; transform: none; }
/* Neo: chỉ nút primary mới cần chữ tối trên nền cam (ghost/danger giữ màu riêng). */
body[data-style="neo"] .dv-cta:not(.ghost):not(.danger) { color: #111; }
.dv-stat { padding: 16px; }
.dv-stat .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 10px; }
.dv-stat .num { font-size: 24px; font-weight: 800; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.dv-stat .lbl { color: var(--muted); font-size: 12px; font-weight: 600; }
.dv-tb { background: var(--primary-soft); color: var(--primary); }
.dv-tg { background: var(--success-soft); color: var(--success); }
.dv-tgo { background: var(--warning-soft); color: var(--warning); }
.dv-tv { background: var(--violet-soft, var(--primary-soft)); color: var(--violet, var(--primary)); }
.dv-phead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.dv-phead h3 { font-size: 15px; font-weight: 800; margin: 0; }
.dv-link { color: var(--primary-strong); font-weight: 700; font-size: 13px; }
.dv-chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 6px 2px 0; }
.dv-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.dv-col .bar { width: 100%; max-width: 26px; min-height: 4px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--primary), var(--primary-strong)); }
.dv-col.is-today .bar { outline: 2px solid var(--primary-soft); outline-offset: 1px; }
.dv-col small { font-size: 11px; color: var(--muted); font-weight: 600; }
.dv-col .v { font-size: 11px; color: var(--text-soft); font-weight: 700; font-variant-numeric: tabular-nums; }
/* Banner thưởng mốc chuỗi ngày học */
.dv-reward { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border: 1px solid var(--success);
    border-radius: var(--radius); background: var(--success-soft); color: var(--success); }
.dv-reward .material-icons-outlined { font-size: 28px; }
.dv-reward p { margin: 0; color: var(--text); font-size: 14px; }
.dv-reward p + p { margin-top: 4px; }
/* Heatmap 15 tuần (mỗi cột 1 tuần, 7 ô/ngày) */
.dv-heatmap { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.dv-heat-col { display: grid; gap: 4px; flex: none; }
.dv-heat-cell { width: 14px; height: 14px; border-radius: 4px; background: var(--surface-soft); border: 1px solid var(--line); }
.dv-heat-cell.lv1 { background: var(--primary-soft); border-color: transparent; }
.dv-heat-cell.lv2 { background: var(--primary); opacity: .55; border-color: transparent; }
.dv-heat-cell.lv3 { background: var(--primary); border-color: transparent; }
.dv-heat-cell.is-today { outline: 2px solid var(--primary-strong); outline-offset: 1px; }
.dv-rev { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.dv-rev:last-child { border-bottom: 0; }
.dv-rev .kr { font-size: 17px; font-weight: 700; }
.dv-rev .mn { color: var(--muted); font-size: 12.5px; }
.dv-mini { margin-left: auto; border: 1px solid var(--line-strong); background: var(--surface); color: var(--primary-strong);
    border-radius: 9px; padding: 7px 12px; font-weight: 700; font-size: 12.5px; text-decoration: none; }
.dv-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dv-row:last-child { border-bottom: 0; }
.dv-row .kr { font-weight: 700; }
.dv-row .mn { color: var(--muted); font-size: 12.5px; }
.dv-tag { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.dv-empty { color: var(--muted); font-size: 13.5px; padding: 14px 0; }


/* ── Trang Tạo từ vựng (bố cục mới, theo token) ── */
.gen-wrap { display: flex; flex-direction: column; gap: 16px; }
.gen-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.gen-head p { color: var(--muted); margin-top: 4px; }
.gen-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.gen-kicker { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.gen-input { width: 100%; min-height: 120px; resize: vertical; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface-soft); color: var(--text); font: inherit; font-size: 15px; padding: 14px; margin-top: 8px; }
.gen-input:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.gen-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 14px; }
.gen-ctrl { display: flex; flex-direction: column; gap: 5px; }
.gen-ctrl > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.gen-select { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
    font: inherit; padding: 10px 12px; min-height: 44px; }
.gen-select:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.gen-generate { margin-left: auto; }
.gen-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.gen-chip { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-soft); border-radius: var(--pill);
    padding: 8px 13px; font-weight: 600; font-size: 13px; cursor: pointer; }
.gen-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.gen-loading { display: none; align-items: center; gap: 12px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line);
    border-radius: var(--radius); background: var(--surface-soft); }
.gen-loading.is-visible { display: flex; }
.gen-loading .material-icons-outlined { color: var(--primary); animation: gen-spin 1s linear infinite; }
@keyframes gen-spin { to { transform: rotate(360deg); } }

.gen-results { margin-top: 16px; }
.gen-results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gen-summary { margin-bottom: 12px; }
.gen-summary strong { font-size: 15px; }
.gen-summary p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.gen-result-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); padding: 15px; }
.gen-result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.gen-result-title { font-size: 20px; font-weight: 700; margin: 0; }
.gen-result-meaning { color: var(--text-soft); font-size: 13.5px; margin-top: 4px; }
.gen-result-tag { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: var(--pill); background: var(--success-soft); color: var(--success); white-space: nowrap; }
.gen-result-example { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.gen-result-example strong { display: block; }
.gen-result-example span { color: var(--muted); font-size: 12px; }
.gen-result-actions { display: flex; gap: 10px; margin-top: 12px; align-items: center; }
.gen-audio { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface);
    color: var(--primary-strong); border-radius: 9px; padding: 7px 12px; font-weight: 700; font-size: 12.5px; cursor: pointer; }
.gen-inline-link { display: inline-flex; align-items: center; gap: 5px; color: var(--primary-strong); font-weight: 700; font-size: 12.5px; }
.gen-empty { color: var(--muted); font-size: 13.5px; padding: 22px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.gen-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.gen-field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.gen-field input { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
    font: inherit; padding: 11px 13px; min-height: 44px; }
.gen-field input:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }


/* ── Trang Câu hỏi ngữ pháp (bố cục mới) ── */
.qz-wrap { display: flex; flex-direction: column; gap: 16px; max-width: 760px; margin: 0 auto; width: 100%; }
.qz-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.qz-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.qz-head p { color: var(--muted); margin-top: 4px; }
.qz-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.qz-pill { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: var(--pill); font-size: 12px; font-weight: 800; background: var(--primary-soft); color: var(--primary); }
.qz-card { padding: 26px; }
.qz-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-weight: 700; font-size: 13px; margin-bottom: 16px; font-variant-numeric: tabular-nums; }
.qz-score { color: var(--primary-strong); }
.qz-question { font-size: 26px; font-weight: 700; line-height: 1.5; margin: 4px 0 6px; }
.qz-translation { color: var(--muted); margin-bottom: 20px; min-height: 1.2em; }
.qz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qz-options .grammar-quiz-option { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1.5px solid var(--line-strong);
    border-radius: 14px; background: var(--surface); color: var(--text); font-size: 17px; font-weight: 600; cursor: pointer; text-align: left; width: 100%;
    min-height: 44px; transition: border-color .14s ease, background .14s ease; }
.qz-options .grammar-quiz-option:hover { border-color: var(--primary); background: var(--primary-soft); }
.qz-options .grammar-quiz-option.is-correct { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.qz-options .grammar-quiz-option.is-wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.qz-card .grammar-quiz-feedback { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--line);
    color: var(--text-soft); font-size: 13.5px; line-height: 1.6; display: none; }
.qz-card .grammar-quiz-feedback.is-visible { display: block; }
.qz-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; }


/* ── Trang Ôn tập từ vựng (bố cục mới) ── */
.rv-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.rv-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 0; }
.rv-head p { color: var(--muted); margin-top: 4px; max-width: 54ch; }
.rv-progress { padding: 14px 18px; display: grid; gap: 12px; }
.rv-progress-top { display: flex; justify-content: space-between; align-items: center; gap: 12px;
    color: var(--muted); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Trang Học hôm nay (daily) ── */
.daily-wrap { display: flex; flex-direction: column; gap: 16px; max-width: 760px; margin: 0 auto; width: 100%; }
.daily-card { position: relative; padding: 26px; }
.daily-title { font-size: 20px; font-weight: 800; margin: 0 0 14px; letter-spacing: -.01em; }
.daily-history { display: flex; gap: 8px; flex-wrap: wrap; }
.daily-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 13px; border-radius: var(--pill);
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-soft); font-size: 12.5px; font-weight: 800; }
.daily-chip:hover { border-color: var(--primary); color: var(--primary); }
.daily-chip.is-active { background: var(--primary); border-color: transparent; color: #fff; }
body[data-style="neo"] .daily-chip.is-active { color: #111; }
.daily-korean { display: grid; gap: 6px; }
.daily-sentence { display: flex; align-items: flex-start; gap: 10px; }
.daily-sentence p { margin: 0; font-size: 21px; line-height: 1.85; color: var(--text); word-break: keep-all; }
.daily-play { flex: none; width: 34px; height: 34px; margin-top: 4px; display: grid; place-items: center;
    border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--text-soft); cursor: pointer; }
.daily-play:hover, .daily-play.is-playing { color: var(--primary); border-color: var(--primary-soft); background: var(--surface-blue); }
.daily-play .material-icons-outlined { font-size: 18px; }
/* Từ bấm được: trông như chữ thường, chỉ lộ gạch chấm khi hover */
.daily-word { border: 0; padding: 0; background: none; font: inherit; color: inherit; cursor: pointer;
    border-radius: 4px; text-decoration: underline dotted transparent; text-underline-offset: 4px;
    transition: background .12s ease, text-decoration-color .12s ease; }
.daily-word:hover { background: var(--primary-soft); text-decoration-color: var(--primary); }
.daily-popover { position: absolute; z-index: 30; width: min(300px, 86%); padding: 14px 16px;
    border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); }
.daily-pop-word { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.daily-pop-word small { color: var(--muted); font-weight: 600; }
.daily-pop-meaning { margin: 0; color: var(--text); font-size: 14.5px; }
.daily-pop-loading { margin: 0; color: var(--muted); font-size: 13px; }
.daily-pop-example { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--text-soft); font-size: 13px; line-height: 1.6; }
.daily-pop-actions { display: flex; gap: 8px; margin-top: 12px; }
.daily-pop-actions .dv-cta { min-height: 36px; padding: 6px 12px; font-size: 12.5px; }
.daily-vi { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.daily-vi > summary { cursor: pointer; font-weight: 800; color: var(--primary); font-size: 14px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.daily-vi > summary::-webkit-details-marker { display: none; }
.daily-vi > summary::before { content: "translate"; font-family: "Material Icons Outlined"; font-size: 18px; }
.daily-vi-text { margin-top: 12px; color: var(--text-soft); font-size: 15.5px; line-height: 1.8; }
.daily-quiz { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 14px; }
.daily-quiz h4 { margin: 0; font-size: 14px; font-weight: 800; color: var(--primary); display: inline-flex; align-items: center; gap: 6px; }
.daily-quiz h4 .material-icons-outlined { font-size: 18px; }
.daily-quiz-q { margin: 0 0 8px; font-weight: 700; font-size: 14.5px; }
.daily-quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.daily-quiz-opt { padding: 10px 12px; min-height: 42px; border: 1.5px solid var(--line-strong); border-radius: 12px;
    background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; }
.daily-quiz-opt:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.daily-quiz-opt.is-correct { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.daily-quiz-opt.is-wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.daily-quiz-score { margin: 0; font-weight: 800; color: var(--primary); }
.daily-loading { display: grid; gap: 12px; }
.daily-loading .daily-wait { color: var(--muted); font-weight: 700; font-size: 13.5px; margin-top: 4px; }
.daily-empty { text-align: center; color: var(--muted); display: grid; gap: 14px; place-items: center; padding: 20px 0; }

/* ── Ô tra từ nhanh trên topbar (dictbar) ── */
.dictbar { position: relative; display: flex; align-items: center; gap: 8px; flex: 1; max-width: 340px;
    min-width: 160px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.dictbar .material-icons-outlined { font-size: 18px; color: var(--muted); }
.dictbar input { border: 0; outline: 0; background: none; width: 100%; min-height: 0; padding: 0; font-size: 13.5px; color: var(--text); }
.dictbar input:focus-visible { box-shadow: none; }
.dictbar-panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: min(320px, 80vw);
    padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); }
.dictbar-word { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.dictbar-word small { color: var(--muted); font-weight: 600; }
.dictbar-meaning { margin: 0; font-size: 14px; color: var(--text); }
.dictbar-loading { margin: 0; color: var(--muted); font-size: 13px; }
.dictbar-example { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--text-soft); font-size: 12.5px; line-height: 1.6; }
.dictbar-actions { display: flex; gap: 8px; margin-top: 12px; }
.dictbar-actions .dv-cta { min-height: 34px; padding: 5px 12px; font-size: 12.5px; }

/* ── Trang Bảng chữ cái (hangul) ── */
.hg-wrap { display: flex; flex-direction: column; gap: 16px; max-width: 860px; margin: 0 auto; width: 100%; }
.hg-section { margin: 18px 0 10px; font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.hg-section:first-child { margin-top: 0; }
.hg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.hg-cell { display: grid; gap: 2px; place-items: center; padding: 10px 6px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); cursor: pointer; transition: border-color .12s ease, background .12s ease, transform .12s ease; }
.hg-cell:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.hg-jamo { font-size: 26px; font-weight: 800; line-height: 1.2; }
.hg-roman { font-size: 12.5px; font-weight: 700; color: var(--primary); }
.hg-name { font-size: 11px; color: var(--muted); }
.hg-quiz { display: grid; gap: 10px; justify-items: center; text-align: center; }
.hg-quiz:empty::before { content: "Bấm \"Làm quiz ghép âm\" để bắt đầu — 10 câu chọn cách đọc đúng."; color: var(--muted); font-weight: 600; }
.hg-quiz-jamo { margin: 0; font-size: 56px; font-weight: 900; line-height: 1.1; }
.hg-quiz-options { width: min(420px, 100%); }

/* ── Trang Luyện viết (writing) ── */
.wr-wrap, .sp-wrap, .tk-wrap { display: flex; flex-direction: column; gap: 16px; max-width: 760px; margin: 0 auto; width: 100%; }
.wr-topics { display: flex; gap: 8px; flex-wrap: wrap; }
.wr-topic.is-active { background: var(--primary); border-color: transparent; color: #fff; }
body[data-style="neo"] .wr-topic.is-active { color: #111; }
#wrText { font-size: 17px; line-height: 1.7; }
.wr-result { padding: 22px; }
.wr-result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.wr-result-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.wr-score { font-size: 24px; font-weight: 900; color: var(--primary); font-variant-numeric: tabular-nums; }
.wr-score-pill { display: inline-flex; padding: 2px 10px; border-radius: var(--pill); background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 800; }
.wr-feedback { color: var(--text); background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.wr-label { margin: 14px 0 4px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.wr-corrected { font-size: 17px; line-height: 1.8; }
.wr-corrections { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.wr-corrections li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.wr-corrections .material-icons-outlined { font-size: 16px; color: var(--muted); }
.wr-wrong { color: var(--danger); text-decoration: line-through; }
.wr-right { color: var(--success); font-weight: 700; }
.wr-corrections small { flex-basis: 100%; color: var(--muted); }
.wr-history-item { border-top: 1px solid var(--line); padding: 10px 0; }
.wr-history-item summary { cursor: pointer; display: flex; align-items: center; gap: 10px; font-weight: 700; list-style: none; }
.wr-history-item summary::-webkit-details-marker { display: none; }
.wr-history-topic { flex: 1; }
.wr-history-body p { margin: 6px 0; }

/* ── Trang Luyện phát âm (speak) ── */
.sp-stage { display: grid; gap: 12px; text-align: center; }
.sp-progress { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.sp-sentence { margin: 8px 0 0; font-size: clamp(22px, 4vw, 32px); font-weight: 700; line-height: 1.6; word-break: keep-all; }
.sp-vi { margin: 0; color: var(--muted); }
.sp-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.sp-result { margin-top: 10px; display: grid; gap: 6px; justify-items: center; }
.sp-score { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.sp-score.sp-good { color: var(--success); }
.sp-score.sp-mid { color: var(--warning, #b45309); }
.sp-score.sp-low { color: var(--danger); }
.sp-heard { margin: 0; color: var(--text-soft); }
.sp-note { margin: 0; color: var(--muted); font-weight: 600; }

/* ── Trang Luyện nghe (bố cục mới) ── */
.ls-createbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr) minmax(0, 1fr) auto;
    align-items: end; gap: 14px; padding: 18px; }
.ls-createbar .listening-field { margin: 0; }
.ls-createbar-submit .dv-cta { width: 100%; }
.ls-createbar-msg { grid-column: 1 / -1; margin: 0; }
.ls-body { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.ls-saved { padding: 16px; align-self: start; }
.ls-saved-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.ls-saved-head h3 { font-size: 15px; font-weight: 800; margin: 0; }
.ls-main { min-width: 0; }



/* ── Trang Ngữ pháp (bố cục mới) ── */
.gr-wrap { display: flex; flex-direction: column; gap: 16px; }
.gr-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.gr-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.gr-head p { color: var(--muted); margin-top: 4px; }
.gr-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gr-add { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.gr-add .grammar-input { flex: 1; min-width: 220px; }
.gr-add .dv-cta { flex: none; }
.gr-list-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.gr-list-head .grammar-search { flex: 1; min-width: 220px; }
.gr-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.gr-listbar { display: flex; justify-content: flex-end; margin-bottom: 6px; }

/* ── Trang Từ vựng (header + số liệu mới) ── */
.vk-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.vk-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 0; }
.vk-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.vk-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }


.main-content {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.mobile-header {
    display: none;
}

.topbar {
    position: sticky;
    top: 12px;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--topbar-height);
    margin: 12px 12px 0;
    padding: 14px 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(246, 248, 251, .92);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
}

body.ftka-dark-ui .topbar {
    background: rgba(15, 23, 42, .92);
}

.topbar-context {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-context-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: var(--primary);
    background: var(--primary-soft);
}

.topbar-context-icon.material-icons-outlined {
    display: inline-grid;
    place-items: center;
    font-size: 22px;
    line-height: 1;
}

.topbar-context p,
.topbar-context strong {
    margin: 0;
}

.topbar-context strong {
    display: block;
    max-width: 58vw;
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-status,
.user-profile,
.topbar-user-link {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-status {
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.energy-pill,
.sun-pill {
    border: 1px solid rgba(245, 158, 11, .35);
    border-radius: 999px;
    padding: 7px 12px;
    color: #92400e;
    background: rgba(251, 191, 36, .16);
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: box-shadow .15s, transform .12s;
}
.sun-pill:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

body.ftka-dark-ui .energy-pill,
body.ftka-dark-ui .sun-pill {
    color: #fde68a;
    background: rgba(245, 158, 11, .14);
}

/* Popover Sun: nhận hằng ngày + mời bạn + xem quảng cáo */
.sun-widget { position: relative; }
.sun-popover { position: absolute; right: 0; top: calc(100% + 10px); width: min(330px, 86vw); padding: 14px; z-index: 90; display: grid; gap: 10px; box-shadow: var(--shadow-lg); }
.sun-popover[hidden] { display: none; }
.sun-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sun-pop-head strong { font-size: 15px; }
.sun-pop-refill { font-size: 12px; color: var(--muted); }
.sun-pop-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); }
.sun-pop-row[hidden] { display: none; }
.sun-pop-row-text { display: grid; gap: 2px; min-width: 0; }
.sun-pop-row-text strong { font-size: 13.5px; }
.sun-pop-row-text span { font-size: 12px; color: var(--text-soft); }
.sun-pop-row .dv-cta { min-height: 34px; padding: 6px 12px; font-size: 12.5px; flex-shrink: 0; }
@media (max-width: 640px) { .sun-popover { position: fixed; right: 10px; left: 10px; top: 64px; width: auto; } }

/* Shadowing (/shadowing): sân khấu 1 câu — nghe, nhại, chấm điểm */
.sh-wrap { max-width: 760px; margin: 0 auto; }
.sh-card { padding: 22px; display: grid; gap: 18px; }
.sh-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#shProgress { font-weight: 800; font-size: 13.5px; color: var(--text-soft); }
.sh-settings { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-soft); }
.sh-settings label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.sh-select { padding: 6px 10px; min-height: 34px; width: auto; }
.sh-auto input { accent-color: var(--primary); }
.sh-sentence-box { text-align: center; padding: 18px 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-soft); }
#shSentence { margin: 0; font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.5; }
#shVi { margin: 10px 0 0; color: var(--text-soft); font-size: 15px; }
.sh-vi-toggle { min-height: 32px; padding: 5px 12px; font-size: 12.5px; margin-top: 12px; }
.sh-controls { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.sh-controls .dv-cta { min-width: 150px; }
#shMicBtn.is-listening { background: var(--danger); animation: sh-pulse 1.2s ease-in-out infinite; }
@keyframes sh-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.sh-result { text-align: center; min-height: 24px; font-size: 15px; }
.sh-result .sh-score { font-size: 30px; font-weight: 800; display: block; }
.sh-result.sh-good .sh-score { color: var(--success); }
.sh-result.sh-mid .sh-score { color: var(--warning); }
.sh-result.sh-low .sh-score { color: var(--danger); }
.sh-heard { color: var(--text-soft); font-size: 13.5px; }
.sh-nav { display: flex; justify-content: space-between; gap: 10px; }
.sh-done { text-align: center; padding: 14px; border-radius: var(--radius-sm); background: var(--success-soft); color: var(--success); font-weight: 700; }
.sh-done[hidden] { display: none; }
.sh-unsupported, .sh-empty { padding: 28px; text-align: center; color: var(--muted); }
.sh-unsupported[hidden] { display: none; }
@media (max-width: 640px) { #shSentence { font-size: 21px; } .sh-nav .dv-cta { flex: 1; } }
@media (prefers-reduced-motion: reduce) { #shMicBtn.is-listening { animation: none; } }

/* Key Premium: badge + form nhập key ở Hồ sơ */
.pk-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: linear-gradient(135deg, #f6c344, #e59b0e); color: #4a3403; font-weight: 800; font-size: 12.5px; }
.pk-redeem { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.pk-redeem h3 { margin: 0 0 4px; font-size: 16px; }
.pk-redeem-form { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.pk-redeem-input { flex: 1 1 280px; font-family: ui-monospace, Consolas, monospace; letter-spacing: .04em; text-transform: uppercase; }

.energy-card small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 5px rgba(21, 128, 61, .12);
}

.avatar,
.profile-avatar {
    display: inline-grid;
    place-items: center;
    overflow: hidden;
    border-radius: 999px;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
}

.avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
}

.avatar-image,
.profile-avatar[src] {
    object-fit: cover;
}

.topbar-username {
    max-width: 140px;
    overflow: hidden;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-button,
.mobile-menu-button,
.saved-lesson-delete-button,
.dictionary-group-delete-button,
.grammar-delete-button {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.logout-button:hover,
.mobile-menu-button:hover,
.saved-lesson-delete-button:hover,
.dictionary-group-delete-button:hover,
.grammar-delete-button:hover {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: transparent;
}

.public-nav-primary {
    color: #fff;
    background: var(--primary);
}

.dashboard-content {
    width: min(100%, 1480px);
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 30px 48px;
    min-width: 0;
}

.public-page {
    min-height: 100vh;
}

.public-index-page {
    --mx: 50%;
    --my: 38%;
    overflow-x: hidden;
}

.public-index-page .app-ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at var(--mx) var(--my), rgba(96, 165, 250, .26) 0, rgba(191, 219, 254, .18) 16%, rgba(255, 255, 255, 0) 34%),
        linear-gradient(120deg, #ffffff 0%, #f8fbff 18%, #eaf4ff 36%, #cfe7ff 54%, #eef6ff 72%, #ffffff 100%);
    background-size: 100% 100%, 280% 280%;
    opacity: .92;
    animation: publicIndexGradient 10s ease-in-out infinite;
    will-change: background-position;
}

.public-index-page .public-shell {
    position: relative;
    z-index: 1;
}

@keyframes publicIndexGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}



.public-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.public-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
}

.public-brand strong {
    display: block;
    line-height: 1.1;
}

.public-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.public-nav a {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-weight: 700;
}

.public-nav a:hover {
    background: var(--surface-blue);
}

.public-nav-primary {
    color: #fff !important;
}

.public-main {
    padding: 34px 0 64px;
}

.public-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
    gap: 32px;
    align-items: center;
    min-height: calc(100vh - 170px);
}

.public-kicker,
.dashboard-kicker,
.studio-kicker,
.dictionary-kicker,
.grammar-kicker,
.listening-kicker,
.review-kicker,
.grammar-quiz-kicker,
.settings-kicker {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.public-hero h1,
.dashboard-hero-title,
.studio-hero-title,
.dictionary-hero-title,
.grammar-hero-title,
.listening-hero-title,
.page-title,
.grammar-quiz-title,
.settings-hero-title {
    margin: 0;
    color: var(--text);
    font-size: clamp(32px, 5vw, 54px);
    line-height: 1.05;
    letter-spacing: -.02em;
    font-weight: 800;
}

.dashboard-hero-title,
.studio-hero-title,
.dictionary-hero-title,
.grammar-hero-title,
.listening-hero-title,
.page-title,
.grammar-quiz-title,
.settings-hero-title {
    font-size: clamp(28px, 4vw, 42px);
}

.public-hero p,
.dashboard-hero-copy,
.studio-hero-copy,
.dictionary-hero-copy,
.grammar-hero-copy,
.listening-hero-copy,
.page-subtitle,
.grammar-quiz-copy,
.settings-hero-copy {
    max-width: 720px;
    margin: 12px 0 0;
    color: var(--text-soft);
    font-size: 16px;
}

.public-hero-actions,
.dashboard-hero-actions,
.studio-hero-actions,
.dictionary-hero-actions,
.grammar-hero-actions,
.study-empty-actions,
.grammar-quiz-actions,
.settings-hero-actions,
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

/* Nút thành phần chuyên biệt (KHÔNG phải CTA) — pill lọc + control trình phát.
   Hệ CTA đã hợp nhất về .dv-cta (Phase 6b); toàn bộ button-base legacy đã xoá. */
.grammar-filter-button,
.sentence-control-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    color: var(--text-soft);
    background: var(--surface);
    font-weight: 750;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease, color .14s ease;
}

/* Neo (mặc định): nav item đang chọn dùng chữ tối trên nền cam cho dễ đọc (đủ tương phản) */
body[data-style="neo"] .nav-item.active {
    color: #111;
}
body[data-style="neo"] .nav-item.active .material-icons-outlined { color: #111; }

.public-study-preview,
.public-feature-card,
.auth-panel,
.dashboard-panel,
.dashboard-metric-card,
.studio-main-card,
.studio-side-card,
.dictionary-panel,
.dictionary-metric,
.dictionary-card,
.grammar-panel,
.grammar-metric,
.grammar-card,
.listening-panel,
.saved-lessons-card,
.lesson-detail-card,
.study-empty-state,
.study-main-panel,
.session-overview-card,
.session-metric,
.sidebar-card,
.grammar-quiz-card,
.grammar-quiz-empty,
.profile-panel,
.prefs-panel,
.settings-panel,
.settings-card,
.settings-side-card,
.admin-panel,
.admin-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

/* Hover nhẹ cho thẻ danh sách/lưới — cảm giác hiện đại, đồng bộ mọi trang */
.grammar-card, .dictionary-card, .lesson-mini-card, .lesson-row, .admin-card {
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.grammar-card:hover, .dictionary-card:hover, .lesson-mini-card:hover, .lesson-row:hover, .admin-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--line-strong);
}


.public-study-preview {
    padding: 22px;
}

.public-preview-card {
    padding: 22px;
    border-radius: var(--radius);
    background: var(--surface-blue);
}

.public-preview-card .material-icons-outlined {
    color: var(--primary);
    font-size: 32px;
}

.public-preview-card strong,
.public-feature-card h2 {
    display: block;
    margin: 10px 0 6px;
    font-size: 20px;
}

.public-preview-card p,
.public-feature-card p {
    margin: 0;
    color: var(--text-soft);
}

.public-preview-grid,
.public-features {
    display: grid;
    gap: 14px;
}

.public-preview-grid {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 14px;
}

.public-preview-grid span {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    background: var(--surface);
    font-weight: 750;
}

.public-features {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-top: 20px;
}

.public-feature-card {
    padding: 18px;
}

.public-feature-card .material-icons-outlined {
    color: var(--primary);
}

.auth-panel {
    width: min(460px, 100%);
    max-width: calc(100vw - 28px);
    margin: 34px auto;
    padding: 26px;
    overflow: hidden;
}

.pricing-shell,
.billing-shell,
.payment-status-shell {
    width: min(100%, 1180px);
    margin: 0 auto;
    padding: 28px 30px 56px;
}

.pricing-head {
    margin-bottom: 22px;
}

.pricing-plan-grid,
.billing-summary-grid {
    display: grid;
    gap: 14px;
}

.pricing-plan-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.billing-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 14px;
}

.pricing-plan-card,
.billing-summary-card,
.billing-panel,
.payment-status-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.pricing-plan-card {
    display: flex;
    min-height: 230px;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
}

.pricing-plan-card h3,
.billing-panel h3,
.payment-status-card h2 {
    margin: 0;
}

.pricing-plan-duration,
.billing-summary-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.pricing-plan-card strong,
.billing-summary-card strong {
    display: block;
    margin-top: 12px;
    color: var(--text);
    font-size: 30px;
    line-height: 1;
}

.pricing-buy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: #fff;
    background: var(--primary);
    font-weight: 800;
}

.pricing-buy-button:hover {
    background: var(--primary-strong);
}

.pricing-buy-button:disabled {
    opacity: .72;
}

.pricing-payment-status {
    min-height: 24px;
    margin: 16px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.pricing-payment-status.is-error {
    color: var(--danger);
}

.payment-submit-form {
    display: none;
}

.billing-summary-card,
.billing-panel {
    padding: 20px;
}

.billing-panel + .billing-panel {
    margin-top: 14px;
}

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

.payment-status-shell {
    display: grid;
    min-height: calc(100vh - var(--topbar-height));
    place-items: center;
}

.payment-status-card {
    width: min(560px, 100%);
    padding: 28px;
    text-align: center;
}

.payment-status-card > .material-icons-outlined {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: 14px;
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 28px;
}

.payment-status-card.is-success > .material-icons-outlined {
    color: var(--success);
    background: var(--success-soft);
}

.payment-status-card p {
    margin: 12px 0 0;
    color: var(--text-soft);
}

.payment-order-summary {
    display: grid;
    grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr);
    gap: 8px 12px;
    margin-top: 18px;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--surface-soft);
    text-align: left;
}

.payment-order-summary span {
    color: var(--muted);
    font-weight: 750;
}

.payment-status-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.payment-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 850;
}

.payment-badge.paid,
.payment-badge.processed {
    color: var(--success);
    background: var(--success-soft);
}

.payment-badge.pending,
.payment-badge.received {
    color: var(--warning);
    background: var(--warning-soft);
}

.payment-badge.failed {
    color: var(--danger);
    background: var(--danger-soft);
}

.auth-panel h2,
.profile-panel h2,
.prefs-panel h2 {
    margin: 0;
    font-size: 26px;
}

.auth-copy,
.prefs-copy {
    margin: 6px 0 18px;
    color: var(--muted);
}

.auth-form,
.prefs-form,
.settings-form,
.admin-detail-form,
.listening-form {
    display: grid;
    gap: 14px;
}

.auth-form label,
.prefs-field,
.settings-field,
.admin-detail-form label,
.listening-field,
.grammar-field {
    display: grid;
    gap: 7px;
    color: var(--text-soft);
    font-weight: 750;
}

.auth-form input,
.prefs-form input,
.admin-input,
.admin-select,
.admin-textarea,
.settings-input,
.settings-select,
.dictionary-input,
.dictionary-search-input,
.dictionary-select,
.grammar-input,
.grammar-search,
.studio-topic-input,
.studio-select,
.listening-select,
textarea,
select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"] {
    width: 100%;
    min-height: 44px;
    padding: 11px 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.admin-input:focus-visible,
.admin-select:focus-visible,
.admin-textarea:focus-visible,
.settings-input:focus-visible,
.settings-select:focus-visible,
.dictionary-input:focus-visible,
.dictionary-search-input:focus-visible,
.dictionary-select:focus-visible,
.grammar-input:focus-visible,
.grammar-search:focus-visible,
.studio-topic-input:focus-visible,
.studio-select:focus-visible,
.listening-select:focus-visible,
textarea:focus-visible,
select:focus-visible,
input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
input[type="password"]:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

textarea,
.admin-textarea,
.studio-topic-input {
    min-height: 120px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #8aa0b8;
}

input,
select,
textarea {
    min-width: 0;
    max-width: 100%;
}

.auth-error,
.auth-flash,
.prefs-message.visible,
.settings-message.is-visible,
.grammar-add-status.is-visible,
.grammar-card-status.is-visible,
.listening-status,
.listening-warning,
.admin-flash {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid rgba(220, 38, 38, .18);
}

.auth-flash.success,
.prefs-message.visible:not(.error),
.settings-message.is-success,
.grammar-add-status.is-success,
.grammar-card-status.is-success,
.listening-status.success,
.admin-flash.success {
    color: var(--success);
    background: var(--success-soft);
    border-color: rgba(21, 128, 61, .18);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--line);
}

.auth-link-row {
    margin: 18px 0 0;
    color: var(--muted);
    text-align: center;
}

.auth-link-row a {
    color: var(--primary);
    font-weight: 800;
}

.dashboard-shell,
.studio-shell,
.dictionary-shell,
.grammar-shell,
.listening-shell,
.review-shell,
.grammar-quiz-shell,
.settings-shell {
    display: grid;
    gap: 22px;
}

.dashboard-hero,
.studio-hero,
.dictionary-hero,
.grammar-hero,
.listening-hero,
.review-hero,
.grammar-quiz-hero,
.settings-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.dashboard-hero-side {
    min-width: 260px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.dashboard-status-badge,
.dashboard-chip,
.dictionary-chip,
.grammar-chip,
.listening-chip,
.grammar-quiz-pill,
.admin-badge,
.direction-badge,
.review-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 12px;
    font-weight: 800;
}

.admin-badge.danger {
    color: var(--danger);
    background: var(--danger-soft);
}

.admin-badge.warn {
    color: var(--warning);
    background: var(--warning-soft);
}

.dashboard-streak-orb {
    display: grid;
    gap: 2px;
    margin: 18px 0;
}

.dashboard-streak-orb strong {
    font-size: 46px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.02em;
    color: var(--primary);
}

.dashboard-streak-orb span,
.dashboard-hero-side-copy,
.dashboard-panel-note,
.dashboard-metric-note,
.dashboard-feed-date,
.dashboard-shelf-meta,
.dictionary-panel-note,
.dictionary-support-copy,
.grammar-panel-note,
.sidebar-copy,
.admin-muted {
    color: var(--muted);
    font-size: 13px;
}

.dashboard-goal-stack,
.dashboard-source-list,
.dashboard-feed-list,
.dashboard-focus-list,
.dashboard-shelf-list,
.studio-tip-list,
.shortcut-list,
.choice-list {
    display: grid;
    gap: 10px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.dashboard-progress-track,
.dashboard-source-bar,
.session-progress-track {
    display: block;
    overflow: hidden;
    height: 9px;
    border-radius: 999px;
    background: var(--line);
}

.dashboard-progress-fill,
.dashboard-source-fill,
.session-progress-fill,
.dashboard-progress-track > span,
.dashboard-source-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.session-progress-track {
    background: var(--primary-soft);
}

.session-progress-fill {
    background: var(--line);
}

.dashboard-metrics,
.dictionary-metrics,
.grammar-metrics,
.session-metrics,
.admin-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.admin-kpi {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.admin-card-accent {
    border-top: 3px solid var(--primary);
}

.admin-card-accent strong {
    font-size: 34px;
    color: var(--primary-strong);
}

.dictionary-metrics,
.grammar-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-metric-card,
.dictionary-metric,
.grammar-metric,
.session-metric,
.admin-card {
    padding: 18px;
}

.dashboard-metric-card strong,
.dictionary-metric strong,
.grammar-metric strong,
.session-metric strong,
.admin-card strong {
    display: block;
    margin: 4px 0;
    font-size: 30px;
    line-height: 1;
}

.dashboard-metric-label,
.dictionary-metric span,
.grammar-metric span,
.session-metric-label,
.admin-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.dashboard-grid,
.dashboard-lower-grid,
.studio-layout,
.dictionary-control-grid,
.listening-layout,
.review-layout,
.admin-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.dictionary-control-grid,
.admin-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-panel,
.studio-main-card,
.studio-side-card,
.dictionary-panel,
.grammar-panel,
.listening-panel,
.saved-lessons-card,
.study-main-panel,
.sidebar-card,
.grammar-quiz-card,
.profile-panel,
.prefs-panel,
.settings-panel,
.settings-card,
.settings-side-card,
.admin-panel {
    padding: 20px;
}

.dashboard-panel-head,
.studio-card-head,
.dictionary-panel-head,
.dictionary-shelf-head,
.grammar-panel-head,
.listening-panel-head,
.settings-card-head,
.session-overview-card,
.lesson-detail-head,
.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-panel-head h3,
.studio-card-head h3,
.dictionary-panel-head h3,
.dictionary-shelf-head h3,
.grammar-panel-head h3,
.listening-panel-head h3,
.sidebar-card h3,
.admin-header h1,
.admin-header h2 {
    margin: 0;
}

.grammar-visible-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    align-self: center;
}

.grammar-list-head-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-chart-frame {
    position: relative;
    min-height: 260px;
}

.dashboard-chart-frame canvas {
    width: 100% !important;
    height: 260px !important;
}

.dashboard-chart-empty,
.dashboard-empty-state,
.dictionary-empty-state,
.grammar-empty-state,
.listening-empty-state,
.study-empty-state,
.studio-empty-state {
    padding: 18px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--muted);
    background: var(--surface-soft);
}

.dashboard-chart-empty {
    display: none;
}

.dashboard-chart-frame.is-empty canvas {
    display: none !important;
}

.dashboard-chart-frame.is-empty .dashboard-chart-empty {
    display: block;
}

.dashboard-momentum-layout,
.dashboard-shelf-grid,
.dictionary-grid,
.grammar-grid,
.studio-results-grid,
.lesson-grid {
    display: grid;
    gap: 14px;
}

.dashboard-shelf-grid,
.grammar-grid,
.studio-results-grid,
.lesson-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.dictionary-grid {
    grid-template-columns: 1fr;
}

.dashboard-momentum-chart {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
    min-height: 150px;
}

.dashboard-momentum-day {
    display: grid;
    gap: 8px;
    text-align: center;
}

.dashboard-momentum-rail {
    display: flex;
    align-items: end;
    height: 120px;
    border-radius: 999px;
    background: var(--surface-soft);
}

.dashboard-momentum-bar {
    width: 100%;
    min-height: 6px;
    border-radius: inherit;
    background: var(--line-strong);
}

.dashboard-momentum-bar.is-active {
    background: var(--primary);
}

.dashboard-vocab-card,
.dashboard-grammar-card,
.dashboard-focus-item,
.dashboard-feed-item,
.dashboard-source-row,
.studio-result-card,
.lesson-mini-card,
.sentence-line,
.saved-lesson-row {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.dashboard-card-top,
.dashboard-stack-block-header,
.dashboard-source-head,
.dashboard-shelf-item,
.dashboard-feed-item,
.dashboard-focus-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.dashboard-stack-block-header h4,
.dashboard-feed h4 {
    margin: 0;
}

.dashboard-stack-link,
.studio-inline-link {
    color: var(--primary);
    font-size: 13px;
    font-weight: 850;
}

.dashboard-feed-copy,
.dashboard-focus-copy,
.dashboard-shelf-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.dashboard-feed-copy span,
.dashboard-focus-copy span,
.dashboard-shelf-copy span {
    color: var(--text-soft);
}

.dashboard-card-title,
.dashboard-card-copy,
.dashboard-shelf-copy h4,
.dashboard-shelf-copy p,
.dashboard-feed-copy strong,
.dashboard-feed-copy p,
.dashboard-focus-copy strong,
.dashboard-focus-copy p {
    margin: 0;
}

.studio-compose,
.dictionary-filter-stack,
.grammar-add-grid {
    display: grid;
    gap: 12px;
}

.studio-compose-footer,
.dictionary-manual-row,
.dictionary-group-row,
.dictionary-filter-row,
.grammar-filter-row,
.sentence-controls,
.review-hero-meta,
.session-overview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.studio-count-picker {
    display: grid;
    gap: 6px;
    min-width: 170px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.studio-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.studio-chip {
    padding: 8px 11px;
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 750;
}

.studio-loading {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius);
    color: var(--text-soft);
    background: var(--surface-blue);
}

.studio-loading.is-visible {
    display: flex;
}

.studio-result-head,
.grammar-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.studio-result-title,
.dictionary-card-title,
.grammar-card-title,
.lesson-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

/* Korean headword as the hero of each card */
.dictionary-card-title,
.studio-result-title {
    font-family: var(--font-kr);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    letter-spacing: -.01em;
}

.studio-result-example strong {
    font-family: var(--font-kr);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.7;
    word-break: keep-all;
}

/* Korean example sentence — readable, distinct from the Vietnamese gloss */
.dictionary-example-kr {
    font-family: var(--font-kr);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.7;
    color: var(--text);
}

.dictionary-card-title.is-concealed {
    filter: blur(7px);
    user-select: none;
}

.dictionary-card-title.is-concealed:hover {
    filter: blur(3px);
}

.studio-result-meaning,
.dictionary-card-meaning,
.grammar-card-meaning,
.grammar-card-copy {
    margin: 8px 0 0;
    color: var(--text-soft);
}

.studio-result-example,
.grammar-example,
.dictionary-example-box,
.listening-text-block {
    display: grid;
    gap: 6px;
    margin-top: 12px;
    padding: 14px;
    border-radius: var(--radius);
    color: var(--text-soft);
    background: var(--surface-soft);
}

.studio-result-actions,
.dictionary-card-actions,
.grammar-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.dictionary-card-meta,
.grammar-card-meta,
.lesson-meta,
.grammar-quiz-stats,
.saved-lesson-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.dictionary-practice,
.dictionary-card-footer {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.dictionary-group-table-wrap,
.admin-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.admin-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.admin-check-col {
    width: 36px;
    text-align: center;
}

.admin-check-col input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-height: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.admin-table-wrap .admin-table,
.dictionary-group-table-wrap .dictionary-group-table {
    min-width: 760px;
}

.dictionary-group-table,
.admin-table,
.profile-table {
    width: 100%;
    border-collapse: collapse;
}

.dictionary-group-table th,
.dictionary-group-table td,
.admin-table th,
.admin-table td,
.profile-table th,
.profile-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.dictionary-group-table th,
.admin-table th,
.profile-table th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.dictionary-card.is-hidden,
.grammar-card.is-hidden {
    display: none;
}

.dictionary-shelf {
    display: grid;
    gap: 16px;
}

.dictionary-card {
    overflow: hidden;
    padding: 0;
}

.dictionary-card-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    padding: 18px;
}

.dictionary-word-block {
    min-width: 0;
}

.dictionary-card-title {
    overflow-wrap: anywhere;
    max-width: 100%;
    margin-top: 8px;
    font-size: 28px;
}

.dictionary-card-meaning {
    font-size: 16px;
}

.dictionary-card-copy {
    max-width: 840px;
}

.dictionary-card-actions {
    margin-top: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    min-width: max-content;
}

.dictionary-card-detail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    padding: 14px 18px 18px;
    border-top: 1px solid var(--line);
    background: var(--surface-soft);
}

.dictionary-icon-button,
.dictionary-inline-button,
.dictionary-status-button,
.dictionary-example-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    background: var(--surface);
    font-weight: 800;
}

.dictionary-icon-button {
    width: 38px;
    padding: 0;
}

.dictionary-status-button {
    min-width: 86px;
    white-space: nowrap;
}

.dictionary-icon-button:hover,
.dictionary-inline-button:hover,
.dictionary-example-toggle:hover {
    color: var(--primary);
    border-color: var(--primary-soft);
    background: var(--surface-blue);
}

.dictionary-status-button.is-learned {
    color: var(--success);
    border-color: rgba(21, 128, 61, .2);
    background: var(--success-soft);
}

.dictionary-status-button.is-unlearned {
    color: var(--warning);
    border-color: rgba(180, 83, 9, .2);
    background: var(--warning-soft);
}

.dictionary-practice {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.dictionary-practice label,
.dictionary-folder-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.dictionary-practice-input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface);
}

.dictionary-practice-input.is-success {
    border-color: rgba(21, 128, 61, .35);
    background: var(--success-soft);
}

.dictionary-card-copy {
    margin: 8px 0 0;
    color: var(--text-soft);
}

.dictionary-folder-panel,
.dictionary-example {
    display: grid;
    gap: 12px;
    margin-top: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.dictionary-folder-topline,
.dictionary-group-assign,
.dictionary-group-chip-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.dictionary-folder-empty {
    color: var(--muted);
    font-size: 13px;
}

.dictionary-example {
    position: relative;
    overflow: hidden;
}

.dictionary-example-content {
    display: none;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
}

.dictionary-example.is-revealed .dictionary-example-content {
    display: grid;
}

.dictionary-example-content p {
    margin: 0;
}

.dictionary-example-toggle {
    width: 100%;
    min-height: 44px;
    background: var(--surface);
}

.dictionary-example.is-revealed .dictionary-example-toggle {
    display: none;
}

.grammar-grid {
    grid-template-columns: 1fr;
}

.grammar-card {
    overflow: hidden;
    padding: 0;
}

.grammar-card-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    padding: 18px;
}

.grammar-pattern-block {
    min-width: 0;
}

.grammar-card-title {
    font-family: var(--font-kr);
    overflow-wrap: anywhere;
    word-break: keep-all;
    max-width: 100%;
    margin-top: 8px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.grammar-card-meaning {
    max-width: 820px;
    font-size: 16px;
}

.grammar-card-actions {
    margin-top: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    min-width: max-content;
}

.grammar-regenerate-button,
.grammar-delete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    background: var(--surface);
    font-weight: 800;
}

.grammar-delete-button {
    width: 38px;
    padding: 0;
}

.grammar-regenerate-button:hover {
    color: var(--primary);
    border-color: var(--primary-soft);
    background: var(--surface-blue);
}

.grammar-card-status {
    margin: 0 18px 14px;
}

.grammar-card-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, .72fr);
    gap: 12px;
    padding: 14px 18px 18px;
    border-top: 1px solid var(--line);
    background: var(--surface-soft);
}

.grammar-card-copy,
.grammar-example {
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.grammar-card-copy:only-child,
.grammar-example:only-child {
    grid-column: 1 / -1;
}

.grammar-example strong {
    font-family: var(--font-kr);
    color: var(--text);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.7;
    word-break: keep-all;
}

.dictionary-pagination ul,
.grammar-pagination ul {
    flex-wrap: wrap;
    justify-content: center;
}

.dictionary-pagination {
    width: 100%;
    max-width: 100%;
    margin-top: 20px;
    text-align: center;
}

.dictionary-pagination-list {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
}

.dictionary-pagination-link {
    padding: 10px 16px;
}

.grammar-filter-button.is-active {
    color: #fff;
    border-color: transparent;
    background: var(--primary);
}

.listening-layout {
    grid-template-columns: 360px minmax(0, 1fr);
}

.listening-sidebar,
.studio-side-stack,
.study-sidebar,
.dashboard-side-stack {
    display: grid;
    gap: 14px;
}

.studio-manual-form {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.dictionary-search-hint {
    margin: 6px 2px 0;
    font-size: .78rem;
    color: var(--text-muted, #8aa0b8);
}

.dictionary-search-hint a {
    color: var(--primary);
}

.studio-manual-field {
    display: grid;
    gap: 6px;
}

.studio-manual-field span {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-soft);
}

.saved-lessons-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    list-style: none;
}

.saved-lessons-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.saved-lesson-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px;
}

.saved-lesson-item {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.saved-lesson-item.active .saved-lesson-title {
    color: var(--primary);
}

.saved-lesson-title {
    font-weight: 800;
}

.saved-lesson-date,
.lesson-date {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.listening-audio {
    width: 100%;
    margin: 8px 0 18px;
}

.lesson-section {
    margin-top: 18px;
}

.lesson-section h4 {
    margin: 0 0 10px;
}

.sentence-list {
    display: grid;
    gap: 8px;
}

.sentence-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color .14s ease, background .14s ease;
}

.sentence-line:hover {
    border-color: var(--primary-soft);
    background: var(--surface-soft);
}

.sentence-line.active {
    border-color: var(--primary);
    background: var(--surface-blue);
}

.sentence-text {
    font-family: var(--font-kr);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.7;
    word-break: keep-all;
}

/* Full Korean transcript — generous reading rhythm */
.listening-korean {
    font-family: var(--font-kr);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.9;
    white-space: pre-line;
    word-break: keep-all;
}

.lesson-mini-card strong {
    font-family: var(--font-kr);
    font-size: 18px;
    font-weight: 700;
    word-break: keep-all;
}

.sentence-number {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    color: #fff;
    background: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.choice-list li {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.choice-list .is-answer {
    color: var(--success);
    background: var(--success-soft);
    font-weight: 800;
}

.review-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
}

.study-main-panel {
    display: grid;
    gap: 16px;
}

.session-overview-card {
    margin: 0;
}

.session-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.study-body {
    min-height: 420px;
}

.study-stage {
    display: grid;
    gap: 14px;
}

.study-card,
.completion-card {
    display: grid;
    gap: 18px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.prompt-panel,
.answer-sheet,
.reveal-panel {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.prompt-meta,
.prompt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.prompt-chip,
.prompt-chip-primary,
.prompt-chip-muted {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 12px;
    font-weight: 850;
}

.prompt-chip-muted {
    color: var(--muted);
    background: var(--surface-soft);
}

.prompt-question,
.prompt-support {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.prompt-main {
    overflow-wrap: anywhere;
    word-break: keep-all;
    color: var(--text);
    font-size: clamp(30px, 5vw, 56px);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.01em;
}

.study-card-header,
.prompt-card,
.result-card,
.completion-card {
    min-width: 0;
}

.prompt-text,
.study-prompt,
.quiz-prompt {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: clamp(24px, 4vw, 42px);
    line-height: 1.16;
}

.option-grid,
.study-actions,
.result-actions,
.completion-grid,
.completion-actions,
.answer-grid {
    display: grid;
    gap: 10px;
}

.option-grid,
.answer-grid,
.completion-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.option-button,
.primary-button,
.secondary-button,
.neutral-button,
.inline-audio-button,
.hint-button {
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--surface-soft);
    font-weight: 750;
    text-align: left;
}

.option-button:hover,
.primary-button:hover,
.secondary-button:hover,
.neutral-button:hover,
.inline-audio-button:hover,
.hint-button:hover {
    border-color: var(--primary);
    background: var(--surface-blue);
}

.primary-button {
    color: #fff;
    border-color: transparent;
    background: var(--primary);
    text-align: center;
    justify-content: center;
}

.secondary-button,
.neutral-button,
.inline-audio-button,
.hint-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.neutral-button {
    color: var(--warning);
    background: var(--warning-soft);
}

.option-button.correct,
.option-button.is-correct,
.grammar-quiz-option.is-correct {
    color: var(--success);
    border-color: rgba(21, 128, 61, .28);
    background: var(--success-soft);
}

.option-button.wrong,
.option-button.is-wrong,
.grammar-quiz-option.is-wrong {
    color: var(--danger);
    border-color: rgba(220, 38, 38, .28);
    background: var(--danger-soft);
}

.result-scroll-area {
    display: grid;
    gap: 12px;
    max-height: 48vh;
    overflow: auto;
    padding-right: 3px;
}

.result-panel,
.result-banner,
.hint-panel {
    padding: 14px;
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.result-banner {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.result-banner h3,
.result-banner p,
.answer-block h4,
.answer-block p,
.example-block h4,
.example-block p {
    margin: 0;
}

.result-banner-correct {
    color: var(--success);
    background: var(--success-soft);
}

.result-banner-wrong {
    color: var(--danger);
    background: var(--danger-soft);
}

.answer-block,
.example-block,
.completion-stat {
    padding: 14px;
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.example-kr {
    font-family: var(--font-kr);
    color: var(--text);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.7;
    word-break: keep-all;
}

.result-actions {
    position: sticky;
    bottom: 14px;
    z-index: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow-md);
}

.completion-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.ftka-dark-ui .result-actions {
    background: rgba(23, 32, 51, .96);
}

.shortcut-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-soft);
}

.shortcut-list span {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 28px;
    border-radius: 6px;
    background: var(--surface-soft);
    font-weight: 850;
}

.grammar-quiz-card {
    display: grid;
    gap: 16px;
    max-width: 880px;
}

.grammar-quiz-topline {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
    font-weight: 800;
}

.grammar-quiz-question {
    margin: 0;
    font-family: var(--font-kr);
    overflow-wrap: anywhere;
    word-break: keep-all;
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -.01em;
}

.grammar-quiz-translation {
    margin: 0;
    color: var(--text-soft);
}

.grammar-quiz-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.grammar-quiz-option {
    min-height: 56px;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--surface-soft);
    font-weight: 780;
    text-align: left;
}

.grammar-quiz-feedback {
    display: none;
    min-height: 64px;
    padding: 14px;
    border-radius: var(--radius);
    color: var(--text-soft);
    background: var(--surface-soft);
}

.grammar-quiz-feedback.is-visible {
    display: block;
}

.grammar-quiz-actions {
    position: sticky;
    bottom: 14px;
    z-index: 2;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow-md);
}

body.ftka-dark-ui .grammar-quiz-actions {
    background: rgba(23, 32, 51, .96);
}

.profile-panel,
.prefs-panel,
.settings-panel {
    max-width: 900px;
}

.profile-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.profile-avatar {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    font-size: 26px;
}

.prefs-segment {
    display: inline-grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    width: min(320px, 100%);
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.prefs-segment input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.prefs-segment label {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.prefs-segment input:checked + label {
    color: #fff;
    background: var(--primary);
}

.settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
    align-items: start;
}

.settings-layout > section,
.settings-side-stack,
.settings-status-list {
    display: grid;
    gap: 14px;
}

.settings-status-chip {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 6px 11px;
    border-radius: 999px;
    color: var(--warning);
    background: var(--warning-soft);
    font-size: 12px;
    font-weight: 850;
}

.settings-status-chip.is-ready {
    color: var(--success);
    background: var(--success-soft);
}

.settings-card-note,
.settings-description,
.settings-side-card p {
    color: var(--muted);
}

.settings-input-row {
    display: grid;
    gap: 8px;
}

.settings-switch {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.settings-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.settings-switch-track {
    position: relative;
    width: 50px;
    height: 28px;
    border-radius: 999px;
    background: var(--line-strong);
    transition: background .16s ease;
}

.settings-switch-track::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform .16s ease;
}

.settings-switch input:checked + .settings-switch-track {
    background: var(--primary);
}

.settings-switch input:checked + .settings-switch-track::after {
    transform: translateX(22px);
}

.settings-switch-copy {
    display: grid;
    gap: 3px;
}

.settings-switch-copy span,
.settings-status-list span {
    color: var(--muted);
    font-size: 13px;
}

.settings-status-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.settings-status-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.settings-status-list li:last-child {
    border-bottom: 0;
}

.admin-shell {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 18px;
    min-width: 0;
    max-width: 100%;
}

.admin-nav {
    position: sticky;
    top: calc(var(--topbar-height) + 18px);
    display: grid;
    gap: 6px;
    align-self: start;
    max-height: calc(100vh - 110px);
    overflow: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.admin-nav a {
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-weight: 750;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: var(--primary);
    background: var(--surface-blue);
}

.admin-nav-label {
    margin: 12px 0 2px;
    padding: 0 11px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}
.admin-nav-label:first-child { margin-top: 4px; }

.admin-main {
    display: grid;
    gap: 16px;
    min-width: 0;
    max-width: 100%;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

/* ── Admin: nhãn bộ lọc gọn gàng ── */
.admin-form-grid label,
.admin-filters label {
    display: grid;
    gap: 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    color: var(--muted);
}
.admin-form-grid label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-height: 0;
    accent-color: var(--primary);
}

/* ── Admin: chip đếm kết quả trên tiêu đề ── */
.admin-count {
    display: inline-flex;
    align-items: center;
    align-self: center;
    padding: 5px 12px;
    border-radius: var(--pill);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    background: var(--primary-soft);
    color: var(--primary);
}

/* ── Admin: bảng dữ liệu dễ đọc hơn ── */
.admin-table:not(.ai-log-table) tbody tr:nth-child(even) {
    background: var(--surface-soft);
}
.admin-table tbody tr:hover {
    background: var(--surface-blue);
}
.admin-table td a {
    color: var(--primary);
    font-weight: 700;
}
.admin-table td a:hover { text-decoration: underline; }
.admin-table td[colspan] {
    padding: 28px 14px;
    text-align: center;
    color: var(--muted);
    font-weight: 600;
}

/* ── Admin: nút thao tác trong ô bảng nhỏ gọn, không chiếm hết hàng ── */
.admin-table .admin-actions {
    gap: 6px;
}
.admin-table .admin-actions .dv-cta {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
}

/* ── Admin: vùng thao tác nguy hiểm ── */
.admin-danger-zone {
    border-color: var(--danger);
    background: var(--danger-soft);
}
.admin-danger-zone h3 { color: var(--danger); }
.admin-header h2 .admin-badge {
    vertical-align: middle;
    margin-left: 8px;
}

.admin-pre {
    overflow: auto;
    padding: 14px;
    border-radius: var(--radius);
    color: var(--text-soft);
    background: var(--surface-soft);
    white-space: pre-wrap;
}











/* ============================================================
   CONFIRMATION MODAL
   ============================================================ */

.confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(4px);
}

.confirm-modal-backdrop.is-open {
    display: flex;
    animation: modal-fade-in .15s ease-out;
}

.confirm-modal-backdrop[hidden] {
    display: none !important;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.confirm-modal-box {
    width: min(440px, 100%);
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: modal-slide-in .18s ease-out;
}

@keyframes modal-slide-in {
    from { opacity: 0; transform: translateY(-12px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.confirm-modal-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

.confirm-modal-message {
    margin: 0 0 22px;
    color: var(--text-soft);
    line-height: 1.55;
}

.confirm-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-modal-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    background: var(--surface);
    font-weight: 750;
    cursor: pointer;
    transition: background .14s ease, border-color .14s ease;
}

.confirm-modal-cancel:hover {
    background: var(--surface-soft);
    border-color: var(--primary-soft);
}

.confirm-modal-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: #fff;
    background: var(--primary);
    font-weight: 800;
    cursor: pointer;
    transition: background .14s ease, transform .12s ease;
}

.confirm-modal-confirm:hover {
    background: var(--primary-strong);
    transform: translateY(-1px);
}

.confirm-modal-confirm.is-danger {
    background: var(--danger);
}

.confirm-modal-confirm.is-danger:hover {
    background: #b91c1c;
}

/* ============================================================
   VOCABULARY PROGRESS BAR
   ============================================================ */

.vocab-progress-section {
    padding: 18px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.vocab-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.vocab-progress-label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 800;
}

.vocab-progress-label .material-icons-outlined {
    font-size: 18px;
    color: var(--primary);
}

.vocab-progress-count {
    color: var(--primary);
    font-size: 13px;
    font-weight: 850;
}

.vocab-progress-track {
    display: block;
    overflow: hidden;
    height: 10px;
    border-radius: 999px;
    background: var(--primary-soft);
}

.vocab-progress-fill {
    display: block;
    height: 100%;
    min-width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #0059ff);
    transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

.vocab-progress-hint {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

/* ============================================================
   VOCABULARY CARD — LEFT ACCENT + BADGE
   ============================================================ */

.vocab-card-accented {
    border-left: 3px solid var(--primary) !important;
}

.vocab-card-accented[data-learned="true"] {
    border-left-color: var(--success) !important;
}

.vocab-learned-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.vocab-learned-badge.is-learned {
    color: var(--success);
    background: var(--success-soft);
}

.vocab-learned-badge.is-unlearned {
    color: var(--warning);
    background: var(--warning-soft);
}

/* ============================================================
   COLLAPSIBLE FOLDER SECTION
   ============================================================ */

.dictionary-folder-section-details {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.dictionary-folder-section-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-weight: 750;
    color: var(--text-soft);
    transition: background .14s ease;
}

.dictionary-folder-section-toggle::-webkit-details-marker {
    display: none;
}

.dictionary-folder-section-toggle:hover {
    background: var(--surface-soft);
}

.dictionary-folder-section-toggle .material-icons-outlined:first-child {
    color: var(--primary);
    font-size: 20px;
}

.dictionary-folder-section-count {
    margin-left: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 800;
}

.dictionary-folder-chevron {
    margin-left: auto;
    font-size: 20px;
    color: var(--muted);
    transition: transform .2s ease;
}

.dictionary-folder-section-details[open] .dictionary-folder-chevron {
    transform: rotate(180deg);
}

.dictionary-folder-section-details > .dictionary-panel {
    border: none;
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
}

/* folder table: reduced min-width, responsive */
.admin-table-wrap .admin-table,
.dictionary-group-table-wrap .dictionary-group-table {
    min-width: 460px;
}



/* Sidebar: responsive overrides */


/* === Premium Anki-style vocab flashcards === */
.anki-vocab-shell {
    display: grid;
    gap: 22px;
    min-height: calc(100vh - 120px);
}

.anki-vocab-hero,
.anki-vocab-stats,
.anki-study-shell,
.anki-manage-panel,
.anki-progress-card {
    border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
    border-radius: 28px;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    box-shadow: 0 18px 54px rgba(15, 23, 42, .09);
}

.anki-vocab-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    overflow: hidden;
    padding: clamp(22px, 3vw, 32px);
}

.anki-vocab-hero::before {
    content: "";
    position: absolute;
    inset: -120px auto auto -90px;
    width: 340px;
    height: 340px;
    border-radius: 999px;
    pointer-events: none;
}

.anki-vocab-hero > * {
    position: relative;
    z-index: 1;
}

.anki-vocab-kicker,
.anki-progress-kicker,
.anki-card-label,
.anki-answer-label {
    display: inline-flex;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.anki-vocab-title {
    margin: 0;
    color: var(--text);
    font-size: clamp(34px, 4.8vw, 56px);
    font-weight: 850;
    line-height: 1;
    letter-spacing: -.045em;
}

.anki-vocab-copy {
    max-width: 620px;
    margin: 10px 0 0;
    color: var(--text-soft);
    font-size: 16px;
    font-weight: 650;
}

.anki-vocab-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.anki-vocab-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    background: var(--line);
}

.anki-vocab-stat {
    display: grid;
    gap: 7px;
    padding: 20px 24px;
    background: color-mix(in srgb, var(--surface) 94%, var(--primary-soft));
}

.anki-vocab-stat span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.anki-vocab-stat strong {
    color: var(--text);
    font-size: clamp(30px, 4vw, 42px);
    font-weight: 850;
    line-height: 1;
    letter-spacing: -.045em;
}

.anki-study-shell {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 18px;
    min-height: min(860px, calc(100vh - 230px));
    padding: clamp(18px, 4vw, 40px);
    overflow: hidden;
    background:

        color-mix(in srgb, var(--surface) 90%, transparent);
}

.anki-progress-host,
.anki-card-stage,
.anki-actions-host,
.anki-shortcuts {
    position: relative;
    z-index: 1;
    width: min(100%, 700px);
}

.anki-progress-card {
    display: grid;
    gap: 14px;
    width: 100%;
    padding: 18px;
    border-radius: 24px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .07);
}

.anki-progress-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.anki-progress-summary strong {
    display: block;
    margin-top: 3px;
    color: var(--text);
    font-size: clamp(19px, 2.8vw, 25px);
    font-weight: 850;
    letter-spacing: -.025em;
}

.anki-progress-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 16px;
    color: #fff;
    background: var(--primary);
    font-size: 18px;
    font-weight: 900;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 28%, transparent);
}

.anki-progress-track {
    display: block;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary-soft) 74%, var(--line));
}

.anki-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #06b6d4, #22c55e);
    transition: width .42s cubic-bezier(.22, 1, .36, 1);
}

.anki-progress-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.anki-progress-stats span {
    display: grid;
    gap: 3px;
    min-height: 76px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-soft) 84%, transparent);
}

.anki-progress-stats b {
    color: var(--text);
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
}

.anki-progress-stats small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.anki-card-stage {
    display: grid;
    place-items: center;
    perspective: 1500px;
}

.anki-flashcard {
    position: relative;
    width: 100%;
    max-width: 700px;
    aspect-ratio: 4 / 3;
    min-height: 0;
    padding: 0;
    border: 0;
    outline: 0;
    appearance: none;
    background: transparent;
    cursor: pointer;
    perspective: 1500px;
    transform: translateZ(0);
}

.anki-card-inner {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 32px;
    transform-style: preserve-3d;
    box-shadow: 0 26px 70px rgba(15, 23, 42, .16);
}

.anki-flashcard:focus-visible .anki-card-inner {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 28%, transparent), 0 28px 76px rgba(15, 23, 42, .18);
}

.anki-card-face {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: clamp(16px, 3vw, 26px);
    padding: clamp(24px, 4.4vw, 42px);
    border: 1px solid rgba(255, 255, 255, .58);
    border-radius: 32px;
    overflow: hidden;
    color: var(--text);
    background:
        linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,255,255,.72)),
        radial-gradient(circle at 18% 14%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 36%);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    text-align: left;
}

.anki-card-back {
    transform: rotateY(180deg);
    background:
        linear-gradient(145deg, rgba(255,255,255,.96), rgba(246,248,251,.78)),
        radial-gradient(circle at 84% 12%, rgba(20, 184, 166, .18), transparent 34%);
}

.anki-face-header,
.anki-face-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.anki-card-chip,
.anki-face-footer {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.anki-card-chip {
    padding: 7px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary-soft) 62%, transparent);
    white-space: nowrap;
}

.anki-face-footer {
    justify-content: center;
    padding-top: 10px;
    border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    text-align: center;
}

.anki-face-footer .material-icons-outlined {
    color: var(--primary);
    font-size: 20px;
}

.anki-front-content {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 16px;
    min-height: 0;
    text-align: center;
}

.anki-card-word {
    max-width: 100%;
    margin: 0;
    color: var(--text);
    font-family: var(--font-kr);
    font-size: clamp(46px, 8vw, 82px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -.04em;
    overflow-wrap: anywhere;
    word-break: keep-all;
}

.anki-card-pronunciation {
    max-width: 90%;
    margin: 0;
    padding: 10px 16px;
    border-radius: 999px;
    color: var(--text-soft);
    background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
    font-size: clamp(18px, 2.5vw, 24px);
    font-weight: 800;
    line-height: 1.35;
}

.anki-back-content {
    display: grid;
    align-content: center;
    gap: 10px;
    min-height: 0;
}

.anki-answer-label {
    margin: 0;
}

.anki-card-meaning {
    margin: 0;
    color: var(--text);
    font-size: clamp(28px, 4.4vw, 46px);
    font-weight: 850;
    line-height: 1.16;
    letter-spacing: -.035em;
}

.anki-card-explain {
    max-width: 94%;
    margin: 0;
    color: var(--text-soft);
    font-size: clamp(16px, 2vw, 19px);
    font-weight: 650;
    line-height: 1.58;
}

.anki-example-box {
    display: grid;
    gap: 7px;
    width: 100%;
    padding: clamp(14px, 2.4vw, 18px);
    border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
    border-radius: 22px;
    background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
}

.anki-example-box.is-empty {
    color: var(--muted);
    font-weight: 750;
}

.anki-example-kr {
    margin: 0;
    color: var(--text);
    font-family: var(--font-kr);
    font-size: clamp(18px, 2.6vw, 24px);
    font-weight: 750;
    line-height: 1.45;
    word-break: keep-all;
}

.anki-example-vi {
    margin: 0;
    color: var(--text-soft);
    font-size: clamp(14px, 1.8vw, 16px);
    font-weight: 650;
    line-height: 1.5;
}

.anki-card-status {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    max-width: calc(100% - 36px);
    pointer-events: none;
}

.anki-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 6px 10px;
    border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
    border-radius: 999px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary-soft) 84%, rgba(255,255,255,.72));
    font-size: 12px;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.anki-pill .material-icons-outlined {
    font-size: 16px;
}

.anki-pill.is-learned {
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 24%, transparent);
    background: var(--success-soft);
}

.anki-pill.is-hard {
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 24%, transparent);
    background: var(--warning-soft);
}

.anki-actions-host {
    display: grid;
}

.anki-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
    border-radius: 24px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    box-shadow: 0 16px 42px rgba(15, 23, 42, .10);
    opacity: 1;
    transform: none;
}

.anki-action-btn {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 66px;
    padding: 11px 12px;
    border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
    border-radius: 18px;
    color: var(--text);
    background: var(--surface);
    font-weight: 850;
    text-align: left;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.anki-action-btn:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--primary) 26%, var(--line));
    background: var(--surface-blue);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .10);
}

.anki-action-btn:disabled {
    opacity: .52;
    cursor: not-allowed;
}

.anki-action-btn > .material-icons-outlined {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 21px;
}

.anki-action-btn.is-learned > .material-icons-outlined {
    color: var(--success);
    background: var(--success-soft);
}

.anki-action-btn.is-review > .material-icons-outlined {
    color: var(--warning);
    background: var(--warning-soft);
}

.anki-action-btn strong,
.anki-action-btn small {
    display: block;
}

.anki-action-btn strong {
    color: var(--text);
    font-size: 14px;
    line-height: 1.1;
}

.anki-action-btn small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    line-height: 1.2;
}

.anki-action-btn kbd,
.anki-shortcuts kbd {
    display: inline-grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border: 1px solid color-mix(in srgb, var(--line-strong) 70%, transparent);
    border-bottom-width: 2px;
    border-radius: 8px;
    color: var(--muted);
    background: var(--surface-soft);
    font-family: inherit;
    font-size: 11px;
    font-weight: 900;
}

.anki-shortcuts {
    margin: -2px 0 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.anki-session-complete {
    display: grid;
    place-items: center;
    gap: 10px;
    width: 100%;
    max-width: 700px;
    min-height: 360px;
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 32px;
    background: var(--surface);
    box-shadow: 0 24px 64px rgba(15, 23, 42, .12);
    text-align: center;
}

.anki-session-complete .material-icons-outlined {
    color: var(--success);
    font-size: 56px;
}

.anki-session-complete h3 {
    margin: 0;
    color: var(--text);
    font-size: 30px;
}

.anki-session-complete p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.anki-session-complete-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: min(100%, 420px);
    margin-top: 12px;
}

.anki-session-complete-actions .dv-cta {
    justify-content: center;
    min-height: 46px;
    border-radius: 14px;
}

.anki-manage-panel {
    padding: 0;
    overflow: hidden;
}

.anki-manage-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 22px;
    color: var(--text);
    font-weight: 900;
    cursor: pointer;
    list-style: none;
}

.anki-manage-summary::-webkit-details-marker {
    display: none;
}

.anki-manage-chevron {
    margin-left: auto;
    color: var(--muted);
    transition: transform .18s ease;
}

.anki-manage-panel[open] .anki-manage-chevron {
    transform: rotate(180deg);
}

.anki-manage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 0 18px 18px;
}

.anki-folder-panel {
    grid-column: 1 / -1;
}

body.ftka-dark-ui .anki-vocab-hero,
body.ftka-dark-ui .anki-vocab-stats,
body.ftka-dark-ui .anki-study-shell,
body.ftka-dark-ui .anki-manage-panel,
body.ftka-dark-ui .anki-progress-card,
body.ftka-dark-ui .anki-actions {
    border-color: rgba(148, 163, 184, .18);
    background: linear-gradient(145deg, rgba(23, 32, 51, .84), rgba(15, 23, 42, .66));
    box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

body.ftka-dark-ui .anki-vocab-stats {
    background: rgba(148, 163, 184, .14);
}

body.ftka-dark-ui .anki-vocab-stat,
body.ftka-dark-ui .anki-progress-stats span,
body.ftka-dark-ui .anki-action-btn,
body.ftka-dark-ui .anki-session-complete {
    border-color: rgba(148, 163, 184, .16);
    background: rgba(23, 32, 51, .72);
}

body.ftka-dark-ui .anki-card-face {
    border-color: rgba(148, 163, 184, .20);
    background:
        linear-gradient(145deg, rgba(30, 41, 59, .98), rgba(15, 23, 42, .90)),
        radial-gradient(circle at 18% 14%, rgba(96, 165, 250, .22), transparent 36%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

body.ftka-dark-ui .anki-card-back {
}

body.ftka-dark-ui .anki-card-chip,
body.ftka-dark-ui .anki-card-pronunciation,
body.ftka-dark-ui .anki-example-box,
body.ftka-dark-ui .anki-action-btn kbd,
body.ftka-dark-ui .anki-shortcuts kbd {
    border-color: rgba(148, 163, 184, .16);
    background: rgba(15, 23, 42, .48);
}









/* ── Trang lỗi (404) ── */
.error-page { max-width: 520px; margin: 8vh auto; padding: 40px 24px; text-align: center; }
.error-page .error-code { display: block; font-size: 72px; font-weight: 900; line-height: 1; color: var(--primary); letter-spacing: -.03em; }
.error-page h1 { margin: 12px 0 6px; font-size: 24px; font-weight: 800; }
.error-page p { color: var(--muted); margin-bottom: 22px; }

/* ============================================================
   RESPONSIVE — mỗi breakpoint đúng MỘT khối, thứ tự rộng → hẹp.
   Gộp từ 21 khối rải rác (refactor Phase 4 — docs/refactor-plan.md).
   Thêm rule responsive mới: đặt vào ĐÚNG khối breakpoint dưới đây.
   ============================================================ */

@media (min-width: 901px) {

    .sidebar {
        width: var(--sidebar-compact);
        transition: width .18s ease, box-shadow .18s ease;
    }

    .app-container {
        grid-template-columns: var(--sidebar-compact) minmax(0, 1fr);
    }

    .sidebar:hover,
    .sidebar:focus-within {
        width: var(--sidebar-width);
        box-shadow: var(--shadow-lg);
    }

    .sidebar .logo-text,
    .sidebar .nav-label {
        opacity: 0;
        white-space: nowrap;
        transition: opacity .12s ease;
    }

    .sidebar:hover .logo-text,
    .sidebar:focus-within .logo-text,
    .sidebar:hover .nav-label,
    .sidebar:focus-within .nav-label {
        opacity: 1;
    }

    /* Nhãn nhóm: ẩn khi rail thu gọn, hiện khi hover (giống .nav-label) */
    .sidebar .nav-group { opacity: 0; white-space: nowrap; transition: opacity .12s ease; }
    .sidebar:hover .nav-group,
    .sidebar:focus-within .nav-group { opacity: 1; }

    /* Ô người dùng: rail thu gọn chỉ hiện avatar; hover mới hiện tên + đăng xuất */
    .sidebar .sidebar-user { margin: 8px; padding: 8px; justify-content: center; }
    .sidebar .sidebar-user .su-who,
    .sidebar .sidebar-user form { display: none; }
    .sidebar:hover .sidebar-user,
    .sidebar:focus-within .sidebar-user { margin: 8px 12px 12px; padding: 10px; justify-content: flex-start; }
    .sidebar:hover .sidebar-user .su-who,
    .sidebar:focus-within .sidebar-user .su-who { display: block; }
    .sidebar:hover .sidebar-user form,
    .sidebar:focus-within .sidebar-user form { display: block; }
}

@media (max-width: 1180px) {

    .dashboard-grid,
    .dashboard-lower-grid,
    .studio-layout,
    .listening-layout,
    .review-layout,
    .settings-layout {
        grid-template-columns: 1fr;
    }

    .public-features,
    .dashboard-metrics,
    .admin-grid,
    .admin-kpi {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .study-sidebar,
    .studio-side-stack,
    .listening-sidebar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }


    .anki-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {

    .ls-createbar { grid-template-columns: 1fr 1fr; }
    .ls-createbar-submit { grid-column: 1 / -1; }
    .ls-body { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {

    .dv-c4 { grid-template-columns: 1fr 1fr; }
    .dv-main, .dv-c2 { grid-template-columns: 1fr; }


    .gen-layout { grid-template-columns: 1fr; }
    .gen-results-grid { grid-template-columns: 1fr; }
    .gen-generate { margin-left: 0; width: 100%; justify-content: center; }


    .app-container {
        display: block;
    }

    /* Drawer sidebar mobile — nơi định nghĩa DUY NHẤT cho trạng thái đóng/mở
       (hợp nhất từ 3 khối cũ; giá trị = "người thắng" theo cascade cũ, height dùng 100dvh). */
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        top: 0;
        width: min(320px, calc(100vw - 44px));
        height: 100dvh;
        margin: 0;
        border-radius: 0;
        transform: translateX(-105%);
        transition: transform .18s ease;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-backdrop:not([hidden]) {
        position: fixed;
        inset: 0;
        z-index: 45;
        background: rgba(15, 23, 42, .42);
    }

    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 44;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 64px;
        padding: 10px 18px;
        border-bottom: 1px solid var(--line);
        background: rgba(255, 255, 255, .94);
        backdrop-filter: blur(14px);
    }

    body.ftka-dark-ui .mobile-header {
        background: rgba(23, 32, 51, .94);
    }

    .topbar {
        position: static;
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        box-shadow: none;
        padding: 14px 18px;
    }

    .topbar-status {
        display: none;
    }

    .dashboard-content {
        padding: 20px 18px 34px;
    }

    .dashboard-hero,
    .studio-hero,
    .dictionary-hero,
    .grammar-hero,
    .listening-hero,
    .review-hero,
    .grammar-quiz-hero,
    .settings-hero {
        display: grid;
        padding: 20px;
    }

    .dictionary-control-grid,
    .admin-detail-grid,
    .admin-shell,
    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-nav {
        position: static;
        display: flex;
        overflow-x: auto;
    }

    .admin-nav a {
        white-space: nowrap;
    }

    .study-sidebar,
    .studio-side-stack,
    .listening-sidebar {
        grid-template-columns: 1fr;
    }

    .public-hero {
        grid-template-columns: 1fr;
        min-height: auto;
        padding-top: 26px;
    }

    .public-features {
        grid-template-columns: 1fr;
    }

    .pricing-plan-grid,
    .billing-summary-grid {
        grid-template-columns: 1fr;
    }

    /* (.app-container / .sidebar drawer đã hợp nhất lên đầu khối này) */

    .anki-vocab-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .anki-vocab-hero-actions {
        width: 100%;
        justify-content: stretch;
    }

    .anki-vocab-hero-actions > * {
        flex: 1 1 180px;
        justify-content: center;
    }

    .anki-manage-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    html,
    body,
    body.ftka-light-ui {
        background-image: none;
    }

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    html,
    body,
    .app-container,
    .main-content,
    .dashboard-content,
    .mobile-header,
    .dictionary-shell,
    .dictionary-hero,
    .dictionary-metrics,
    .dictionary-control-grid,
    .dictionary-group-section,
    .dictionary-shelf,
    .dictionary-grid,
    .dictionary-panel,
    .dictionary-card,
    .dictionary-card-main,
    .dictionary-card-detail,
    .dictionary-pagination,
    .dictionary-pagination-list,
    .admin-shell,
    .admin-main,
    .admin-panel {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .app-container {
        display: block;
        grid-template-columns: none;
    }

    .main-content,
    .dashboard-content {
        min-width: 0;
        margin-left: 0;
        margin-right: 0;
    }

    .dashboard-content {
        width: 100%;
        max-width: 100%;
        padding: 12px 12px 26px;
        overflow-x: hidden;
    }

    .mobile-header {
        left: 0;
        right: 0;
        margin: 0;
        min-height: 64px;
        padding: 8px 12px;
        overflow: hidden;
        gap: 10px;
    }

    .mobile-brand {
        min-width: 0;
        max-width: calc(100% - 54px);
        gap: 8px;
        font-size: 15px;
        line-height: 1;
    }

    .mobile-brand .logo-icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
        border-radius: 12px;
        font-size: 14px;
    }

    .mobile-menu-button {
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
    }

    .mobile-menu-button .material-icons-outlined {
        font-size: 24px;
    }

    .dictionary-shell {
        gap: 14px;
        min-width: 0;
        overflow: hidden;
    }

    .dictionary-hero {
        gap: 14px;
        padding: 14px;
        border-radius: 14px;
    }

    .dictionary-hero-title {
        font-size: 30px;
        line-height: 1.1;
        overflow-wrap: anywhere;
    }

    .dictionary-metrics {
        gap: 12px;
    }

    .dictionary-metric {
        padding: 14px;
    }

    .dictionary-metric span {
        font-size: 16px;
        text-transform: none;
    }

    .dictionary-metric strong {
        font-size: 34px;
    }

    .dictionary-hero-actions,
    .dictionary-filter-row {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        gap: 8px;
        margin-top: 14px;
    }

    .anki-manage-grid .dv-cta,
    .dictionary-inline-button,
    .dictionary-input,
    .dictionary-search-input,
    .dictionary-select,
    .dictionary-practice-input,
    #importFile {
        width: 100%;
        max-width: 100%;
        min-height: 50px;
        padding: 10px 12px;
        font-size: 15px;
        line-height: 1.2;
    }

    .anki-manage-grid .dv-cta .material-icons-outlined,
    .dictionary-inline-button .material-icons-outlined,
    .dictionary-status-button .material-icons-outlined {
        font-size: 20px;
    }

    .dictionary-control-grid,
    .dictionary-card-detail {
        grid-template-columns: 1fr;
    }

    .dictionary-panel,
    .dictionary-metric,
    .dictionary-card,
    .dictionary-folder-panel,
    .dictionary-example,
    .dictionary-practice {
        width: 100%;
        max-width: 100%;
        border-radius: 14px;
    }

    .dictionary-panel {
        padding: 14px;
    }

    .dictionary-card {
        width: 100%;
        max-width: 100%;
        margin-bottom: 14px;
        border-radius: 16px;
        overflow: hidden;
    }

    .dictionary-card-main {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 18px 16px;
    }

    .dictionary-card-title {
        font-size: 22px;
    }

    .dictionary-card-meaning,
    .dictionary-card-copy,
    .dictionary-folder-empty,
    .dictionary-example-content,
    .dictionary-practice-input,
    .dictionary-input,
    .dictionary-search-input,
    .dictionary-select {
        font-size: 15px;
    }

    .dictionary-card-detail {
        padding: 14px 16px 16px;
    }

    .dictionary-card-actions,
    .dictionary-group-assign {
        width: 100%;
        min-width: 0;
        justify-content: stretch;
    }

    .dictionary-card-actions {
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        gap: 8px;
    }

    .dictionary-icon-button {
        width: 42px;
        min-width: 42px;
        min-height: 48px;
    }

    .dictionary-icon-button .material-icons-outlined {
        font-size: 20px;
    }

    .dictionary-status-button {
        min-width: 0;
        width: 100%;
        min-height: 48px;
        font-size: 15px;
    }

    .dictionary-example-content,
    .dictionary-group-assign {
        display: grid;
        grid-template-columns: 1fr;
    }

    .dictionary-group-table-wrap .dictionary-group-table {
        /* min-width 0 cũ là khai báo chết — rule top-level "folder table" (460px)
           đứng sau trong cascade cũ luôn thắng; đã xoá khi gộp Phase 4. */
        table-layout: fixed;
    }

    .dictionary-group-table th,
    .dictionary-group-table td {
        padding: 10px 8px;
        overflow-wrap: anywhere;
        font-size: 13px;
    }

    .dictionary-group-file,
    .dictionary-group-name {
        overflow-wrap: anywhere;
    }

    .dictionary-pagination {
        margin-top: 14px;
    }

    .dictionary-pagination-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(44px, max-content));
        justify-content: center;
        gap: 7px;
    }

    .dictionary-pagination-link {
        width: auto;
        min-height: 42px;
        padding: 8px 11px;
        font-size: 14px;
    }

    /* (Drawer .sidebar định nghĩa duy nhất ở khối 900px phía trên — bản cũ ở đây bị
       cascade đè toàn bộ: height 100vh thua 100dvh, max-width thừa vì width đã dùng min()). */

    .admin-shell {
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .admin-nav {
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .admin-panel {
        min-width: 0;
        overflow: hidden;
    }

    .admin-table-wrap {
        margin-inline: 0;
    }

    .admin-table-wrap .admin-table {
        width: max-content;
        /* min-width 760px cũ là khai báo chết — rule top-level "folder table" (460px)
           đứng sau trong cascade cũ luôn thắng; đã xoá khi gộp Phase 4. */
    }

    .topbar {
        display: none;
    }
}

@media (max-width: 640px) {
 .qz-options { grid-template-columns: 1fr; }

 .vk-stats { grid-template-columns: 1fr; }


    body {
        font-size: 14px;
    }

    .public-shell {
        width: min(1180px, calc(100% - 28px));
    }

    .topbar,
    .user-profile,
    .dashboard-panel-head,
    .studio-card-head,
    .dictionary-panel-head,
    .dictionary-shelf-head,
    .grammar-panel-head,
    .listening-panel-head,
    .settings-card-head,
    .session-overview-card,
    .lesson-detail-head,
    .admin-header {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-context strong {
        max-width: 100%;
    }

    .dashboard-metrics,
    .dictionary-metrics,
    .grammar-metrics,
    .session-metrics,
    .admin-grid,
    .admin-kpi,
    .option-grid,
    .grammar-quiz-options,
    .result-actions {
        grid-template-columns: 1fr;
    }

    .dashboard-panel,
    .studio-main-card,
    .dictionary-panel,
    .grammar-panel,
    .listening-panel,
    .saved-lessons-card,
    .study-main-panel,
    .sidebar-card,
    .grammar-quiz-card,
    .profile-panel,
    .prefs-panel,
    .settings-panel,
    .admin-panel,
    .auth-panel {
        padding: 16px;
    }

    .auth-panel {
        width: 100% !important;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .auth-form,
    .auth-panel form,
    .auth-panel input,
    .auth-panel button,
    .auth-panel a.dv-cta {
        width: 100%;
        max-width: 100%;
    }

    .dictionary-panel {
        padding: 14px;
    }

    .dictionary-hero-title {
        font-size: 28px;
    }

    .dictionary-manual-row,
    .dictionary-group-row,
    .studio-compose-footer,
    .sentence-controls,
    .grammar-quiz-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .dictionary-card-main,
    .dictionary-card-detail,
    .dictionary-example-content,
    .grammar-card-main,
    .grammar-card-detail {
        grid-template-columns: 1fr;
    }

    .grammar-card-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
        min-width: 0;
    }

    .public-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 12px;
        align-items: center;
    }

    .public-nav {
        width: auto;
        justify-content: flex-end;
        gap: 6px;
    }

    .public-nav a {
        padding: 9px 10px;
        white-space: nowrap;
    }

    .public-page .public-nav {
        display: none;
    }

    .topbar-username {
        max-width: none;
    }


    .admin-table-wrap .admin-table,
    .dictionary-group-table-wrap .dictionary-group-table {
        min-width: 360px;
    }

    .vocab-progress-section {
        padding: 14px 16px;
    }

    .confirm-modal-box {
        padding: 20px 18px;
    }

    .confirm-modal-actions {
        flex-direction: column-reverse;
    }

    .confirm-modal-cancel,
    .confirm-modal-confirm {
        width: 100%;
    }


    .anki-vocab-shell {
        gap: 14px;
    }

    .anki-vocab-hero,
    .anki-study-shell,
    .anki-progress-card,
    .anki-actions {
        border-radius: 22px;
    }

    .anki-vocab-stats,
    .anki-progress-stats,
    .anki-actions {
        grid-template-columns: 1fr;
    }

    .anki-vocab-stat {
        padding: 15px 16px;
    }

    .anki-study-shell {
        min-height: auto;
        padding: 14px;
    }

    .anki-flashcard {
        aspect-ratio: 3 / 4;
    }

    .anki-card-face,
    .anki-card-inner {
        border-radius: 24px;
    }

    .anki-card-face {
        padding: 20px;
    }

    .anki-face-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .anki-card-status {
        top: 12px;
        right: 12px;
    }

    .anki-card-word {
        font-size: clamp(40px, 15vw, 64px);
    }

    .anki-card-meaning {
        font-size: clamp(25px, 8vw, 34px);
    }

    .anki-action-btn {
        min-height: 60px;
    }

    .anki-shortcuts {
        display: none;
    }

    .daily-quiz-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {

    .ls-createbar { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
 .ftka-skel-line::after { animation: none; }

 .gen-loading .material-icons-outlined { animation: none; }


    .public-index-page .app-ambient {
        animation: none;
        will-change: auto;
    }


    .grammar-card:hover, .dictionary-card:hover, .lesson-mini-card:hover, .lesson-row:hover, .admin-card:hover { transform: none; }


    .anki-progress-fill,
    .anki-action-btn,
    .anki-manage-chevron {
        transition: none;
    }
}

/* ── Hub chọn chuyên ngành (/chuyen-nganh) ─────────────────────────── */
.spec-wrap { max-width: 920px; margin: 0 auto; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 22px; }
.spec-card { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; transition: box-shadow .16s, border-color .16s, transform .16s; }
.spec-card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); transform: translateY(-2px); }
.spec-icon { width: 46px; height: 46px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.spec-icon .material-icons-outlined { font-size: 24px; }
.spec-body { flex: 1; min-width: 0; }
.spec-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spec-top h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--text); }
.spec-tag { font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.spec-tag.soon { color: var(--muted); background: var(--surface-soft); }
.spec-body p { margin: 5px 0 0; font-size: 13px; color: var(--text-soft); line-height: 1.5; }
.spec-progress { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.spec-progress strong { color: var(--text); font-variant-numeric: tabular-nums; }
.spec-arrow { color: var(--muted); flex-shrink: 0; }
.spec-card.is-soon { opacity: .55; cursor: not-allowed; }
.spec-card.is-soon:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--line); }

.spec-back { display: inline-flex; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); transition: color .15s; }
.spec-back:hover { color: var(--primary); }
.spec-back .material-icons-outlined { font-size: 16px; }

/* ── Từ vựng chuyên ngành CNTT (/it-vocab) ─────────────────────────── */
.itv-wrap { max-width: 920px; margin: 0 auto; }
.itv-head-actions { display: flex; align-items: center; }
.itv-stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 20px; }
.itv-stat { display: flex; flex-direction: column; gap: 1px; min-width: 100px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.itv-stat strong { font-size: 22px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; line-height: 1.1; }
.itv-stat span { font-size: 12px; font-weight: 600; color: var(--muted); }

.itv-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.itv-search { flex: 1 1 280px; display: flex; align-items: center; gap: 9px; padding: 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.itv-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.itv-search .material-icons-outlined { color: var(--muted); font-size: 20px; }
.itv-search input { flex: 1; border: 0; background: transparent; padding: 12px 0; font-size: 15px; color: var(--text); outline: none; }
.itv-filter { cursor: pointer; }

.itv-list { display: flex; flex-direction: column; gap: 12px; }
.itv-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 16px 22px; box-shadow: var(--shadow-sm); cursor: pointer; transition: box-shadow .16s ease, border-color .16s ease; }
.itv-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary-soft); transition: background .16s ease; }
.itv-card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.itv-card:hover::before { background: var(--primary); }
.itv-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.itv-term { min-width: 0; }
.itv-ko { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 19px; font-weight: 800; color: var(--text); line-height: 1.3; }
.itv-tts { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--line); background: var(--surface-soft); border-radius: 50%; cursor: pointer; color: var(--primary); flex-shrink: 0; transition: background .15s, color .15s; }
.itv-tts:hover { background: var(--primary-soft); }
.itv-tts .material-icons-outlined { font-size: 17px; }
.itv-tts.is-playing { background: var(--primary); color: #fff; border-color: transparent; }
.itv-gloss { display: inline-block; margin-top: 7px; padding: 2px 9px; font-size: 11.5px; font-weight: 700; color: var(--text-soft); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 6px; letter-spacing: .01em; }
.itv-vi { margin: 11px 0 0; color: var(--text-soft); line-height: 1.62; font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.itv-card.is-open .itv-vi { -webkit-line-clamp: unset; }
.itv-vi em { color: var(--muted); }

.itv-actions { display: flex; gap: 8px; flex-shrink: 0; }
.itv-fav { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-soft); color: var(--muted); font-size: 16px; cursor: pointer; line-height: 1; transition: all .15s; }
.itv-fav:hover { border-color: #ffc6d0; color: #e0396b; }
.itv-fav.is-on { background: #ffe2e6; color: #e0396b; border-color: #ffc6d0; }
.itv-learned { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-soft); color: var(--text-soft); font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: all .15s; }
.itv-learned:hover { border-color: #bbf7d0; color: #15803d; }
.itv-learned.is-on { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }

.itv-status { text-align: center; color: var(--muted); font-size: 13px; padding: 22px 0; }
.itv-empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* Học thẻ (flashcard overlay) */
.itv-study { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 20, 30, .55); backdrop-filter: blur(2px); }
.itv-study-card { width: min(560px, 100%); box-shadow: var(--shadow-lg); }
.itv-study-top { display: flex; justify-content: space-between; align-items: center; color: var(--text-soft); font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.itv-study-body { text-align: center; padding: 26px 8px; }
.itv-study-body .kr { margin: 0; font-size: 30px; font-weight: 800; color: var(--text); }
.itv-study-body .itv-gloss { margin-top: 8px; font-size: 14px; }
.itv-study-reveal { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.itv-study-reveal p { margin: 0; color: var(--text); line-height: 1.6; font-size: 15px; }
.itv-study-actions { margin-top: 6px; }
.itv-grade { display: flex; gap: 10px; }
.itv-grade .dv-cta { flex: 1; }
/* `hidden` attr phải thắng các khai báo display ở trên (nếu không modal/nút luôn hiện) */
.itv-study[hidden], .itv-grade[hidden], .itv-study-reveal[hidden], .itv-study-actions .dv-cta[hidden] { display: none; }

@media (max-width: 640px) {
    .itv-card-head { flex-direction: column; }
    .itv-actions { align-self: flex-end; }
    .itv-study-body .kr { font-size: 24px; }
}

/* ── Luyện nghe: nâng cấp UI/UX (token-based → ăn theo mọi theme) ────── */
/* Card chi tiết bài bị THIẾU padding (không nằm trong nhóm padding:20px chung) → nội dung dính mép */
.lesson-detail-card { padding: 22px; }
@media (max-width: 640px) { .lesson-detail-card { padding: 16px; } }
.ls-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ls-section-head h4 { margin: 0; }
.ls-toggle-btn { min-height: 34px; padding: 6px 12px; font-size: 12.5px; }
.ls-hint { font-size: 12.5px; color: var(--muted); }

/* Trạng thái chờ khi tạo bài (AI + TTS 15-30s) */
.ls-wait { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--text-soft); font-weight: 600; font-size: 13.5px; }
.ls-wait[hidden] { display: none; } /* display:flex đè attr hidden nếu không có rule này */
.ls-wait::before { content: ""; width: 14px; height: 14px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--primary); border-top-color: transparent; animation: ls-spin .8s linear infinite; }
.ls-spinner { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.75); border-top-color: transparent; animation: ls-spin .8s linear infinite; }
@keyframes ls-spin { to { transform: rotate(360deg); } }
.dv-cta.is-loading { opacity: .85; pointer-events: none; }

/* Câu bấm-để-nghe: hover rõ, câu đang phát có sóng nhạc */
.listening-shell .sentence-line { cursor: pointer; display: flex; align-items: center; gap: 10px; transition: border-color .15s, background .15s, box-shadow .15s; }
.listening-shell .sentence-line:hover { border-color: var(--line-strong); background: var(--surface); box-shadow: var(--shadow-sm); }
.listening-shell .sentence-line:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.listening-shell .sentence-line.active { border-color: var(--primary); background: var(--primary-soft); }
.listening-shell .sentence-line .sentence-text { flex: 1; min-width: 0; }
.ls-eq { display: none; align-items: flex-end; gap: 2px; height: 14px; flex-shrink: 0; }
.ls-eq i { width: 3px; border-radius: 2px; background: var(--primary); animation: ls-eq 1s ease-in-out infinite; }
.ls-eq i:nth-child(1) { height: 60%; animation-delay: 0s; }
.ls-eq i:nth-child(2) { height: 100%; animation-delay: .2s; }
.ls-eq i:nth-child(3) { height: 75%; animation-delay: .4s; }
@keyframes ls-eq { 0%, 100% { transform: scaleY(.5); } 50% { transform: scaleY(1); } }
.listening-shell .sentence-line.is-playing .ls-eq { display: inline-flex; }
/* Bài chỉ có audio toàn bài: giấu lỗi lặp từng dòng + nút phát từng câu (đã có 1 thông báo chung) */
.ls-no-sentence-audio .sentence-error { display: none; }
.ls-no-sentence-audio .sentence-controls { display: none; }
.ls-no-sentence-audio .sentence-line { cursor: default; }
.ls-no-sentence-audio .sentence-status.is-visible { margin-bottom: 10px; }

/* Quiz câu hỏi: giấu đáp án, chọn mới hiện đúng/sai */
.ls-quiz-list { display: grid; gap: 12px; }
.ls-question strong { display: block; margin-bottom: 10px; }
.ls-choices { display: grid; gap: 8px; }
.ls-choice { display: block; width: 100%; text-align: left; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s, transform .12s; }
.ls-choice:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.ls-choice:disabled { cursor: default; opacity: .85; }
.ls-choice.is-correct { border-color: var(--success); background: var(--success-soft); color: var(--success); opacity: 1; }
.ls-choice.is-wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); opacity: 1; }
.ls-choice.is-correct::after { content: " ✓"; font-weight: 800; }
.ls-choice.is-wrong::after { content: " ✗"; font-weight: 800; }
.ls-reveal { margin-top: 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-soft); border: 1px dashed var(--line-strong); display: grid; gap: 4px; }
.ls-reveal-answer { font-weight: 700; color: var(--success); font-size: 13.5px; }
.ls-reveal-why { color: var(--text-soft); font-size: 13.5px; line-height: 1.55; }

/* Danh sách bài đã lưu: hover + active rõ ràng */
.listening-shell .saved-lesson-row { transition: border-color .15s, box-shadow .15s; }
.listening-shell .saved-lesson-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
/* Vạch active đặt ở MÉP ROW (row có padding 14px) — đặt trên .saved-lesson-item thì chữ đè lên vạch */
.listening-shell .saved-lesson-row:has(.saved-lesson-item.active) { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }

@media (prefers-reduced-motion: reduce) {
    .ls-eq i, .ls-wait::before, .ls-spinner { animation: none; }
}
