/* ============================================================
   style.css – Pastel Glassmorphism Theme
   Bong Bóng Chữ Cái & Luyện Gõ Telex Cho Bé
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Baloo+2:wght@400;600;700;800&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg-1: #F8FAFC;
  --bg-2: #EEF2F6;
  --bg-3: #E2E8F0;
  --bg-4: #F1F5F9;

  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(203, 213, 225, 0.6);
  --glass-shadow: rgba(148, 163, 184, 0.15);

  --candy-pink: #FF6B9D;
  --candy-blue: #3B82F6;
  --candy-yellow: #F59E0B;
  --candy-green: #10B981;
  --candy-purple: #8B5CF6;
  --candy-peach: #FB923C;
  --candy-teal: #06B6D4;

  --text-dark: #1E293B;
  --text-mid: #475569;
  --text-light: #64748B;

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 40px;

  --shadow-soft: 0 8px 32px rgba(148, 163, 184, 0.18);
  --shadow-card: 0 4px 24px rgba(148, 163, 184, 0.12);
  --shadow-btn: 0 4px 16px rgba(139, 92, 246, 0.25);

  --font-main: 'Nunito', sans-serif;
  --font-display: 'Baloo 2', cursive;

  --nav-h: 90px;
  --vkb-h: 220px;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  color: var(--text-dark);
}

body {
  background: linear-gradient(135deg, #F8FAFC 0%, #EEF2F6 40%, #E2E8F0 80%, #F1F5F9 100%);
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
  position: relative;
}

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

/* ── Floating Clouds Background ────────────────────────────── */
.bg-clouds {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.cloud {
  position: absolute;
  background: rgba(255,255,255,0.35);
  border-radius: 50px;
  filter: blur(2px);
  animation: cloudFloat linear infinite;
}
.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.cloud-1 { width: 180px; height: 60px; top: 8%; animation-duration: 40s; animation-delay: 0s; left: -200px; }
.cloud-1::before { width: 80px; height: 80px; top: -35px; left: 25px; }
.cloud-1::after  { width: 60px; height: 60px; top: -25px; left: 80px; }
.cloud-2 { width: 140px; height: 45px; top: 22%; animation-duration: 55s; animation-delay: -15s; left: -160px; }
.cloud-2::before { width: 60px; height: 60px; top: -28px; left: 20px; }
.cloud-2::after  { width: 50px; height: 50px; top: -20px; left: 65px; }
.cloud-3 { width: 220px; height: 70px; top: 55%; animation-duration: 48s; animation-delay: -8s; left: -250px; opacity: 0.6; }
.cloud-3::before { width: 100px; height: 100px; top: -40px; left: 30px; }
.cloud-3::after  { width: 80px;  height: 80px;  top: -30px; left: 100px; }
.cloud-4 { width: 160px; height: 52px; top: 75%; animation-duration: 62s; animation-delay: -30s; left: -180px; opacity: 0.5; }
.cloud-4::before { width: 70px; height: 70px; top: -32px; left: 22px; }
.cloud-4::after  { width: 55px; height: 55px; top: -22px; left: 75px; }

@keyframes cloudFloat {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(100vw + 300px)); }
}

/* Floating Stars */
.star {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  animation: starTwinkle ease-in-out infinite alternate;
}
@keyframes starTwinkle {
  from { opacity: 0.3; transform: scale(0.8); }
  to   { opacity: 1;   transform: scale(1.2); }
}

/* ── App Shell ─────────────────────────────────────────────── */
#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Navigation ────────────────────────────────────────────── */
.nav {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 2px solid var(--glass-border);
  flex-shrink: 0;
  box-shadow: 0 4px 24px var(--glass-shadow);
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  background: linear-gradient(135deg, #FF6B9D, #C084FC, #60A5FA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-right: auto;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-brand .brand-emoji { font-size: 2rem; }

.nav-tabs {
  display: flex;
  gap: 8px;
}

.nav-tab {
  padding: 11px 22px;
  border-radius: var(--radius-xl);
  border: none;
  background: rgba(255,255,255,0.3);
  color: var(--text-mid);
  font-family: var(--font-main);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid transparent;
  white-space: nowrap;
}
.nav-tab:hover {
  background: rgba(255,255,255,0.5);
  transform: translateY(-2px);
  box-shadow: var(--shadow-btn);
}
.nav-tab.active {
  background: linear-gradient(135deg, var(--candy-purple), var(--candy-pink));
  color: white;
  border-color: rgba(255,255,255,0.6);
  box-shadow: var(--shadow-btn);
  transform: translateY(-2px);
}

.nav-audio-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.4);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.nav-audio-btn:hover { background: rgba(255,255,255,0.6); transform: scale(1.1); }

/* ── Main Content Area ─────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Page Sections ─────────────────────────────────────────── */
.page {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  animation: pageIn 0.35s ease;
}
.page.active { display: flex; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Glassmorphism Card ────────────────────────────────────── */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* ============================================================
   HOME MENU SCREEN (TRANG CHỦ MỞ ĐẦU)
   ============================================================ */
#page-home {
  display: none;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px;
}
#page-home.active {
  display: flex;
}

.home-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 500px;
  margin: auto;
}

.home-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 40px;
  padding: 44px 40px 36px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(120, 160, 240, 0.28), 0 4px 18px rgba(160, 120, 220, 0.15);
  border: 3px solid rgba(255, 255, 255, 0.95);
  animation: cardIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.home-title {
  font-family: var(--font-display);
  font-size: 3.4rem;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  margin-bottom: 30px;
  letter-spacing: -0.5px;
}

.title-pink {
  color: #F43F85;
  text-shadow: 0 2px 14px rgba(244, 63, 133, 0.2);
}

.title-purple {
  color: #8B5CF6;
  text-shadow: 0 2px 14px rgba(139, 92, 246, 0.2);
}

.home-notice {
  background: rgba(245, 243, 255, 0.95);
  border: 2px dashed rgba(192, 132, 252, 0.5);
  border-radius: 20px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  box-shadow: 0 4px 16px rgba(160, 120, 220, 0.08);
}
.notice-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text-mid);
  line-height: 1.45;
  font-weight: 600;
}
.notice-item b {
  color: var(--candy-purple);
  font-weight: 800;
}
.notice-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: -2px;
}

.home-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 26px;
}

.home-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 16px 24px;
  border-radius: 50px;
  border: none;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.home-btn:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.home-btn:active {
  transform: translateY(-1px) scale(0.99);
}

.home-btn-icon {
  font-size: 1.5rem;
}

.btn-telex {
  background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
  box-shadow: 0 8px 22px rgba(139, 92, 246, 0.35);
}
.btn-telex:hover {
  box-shadow: 0 14px 28px rgba(139, 92, 246, 0.45);
}

.btn-bubble {
  background: linear-gradient(135deg, #EC4899 0%, #F43F5E 100%);
  box-shadow: 0 8px 22px rgba(244, 63, 94, 0.35);
}
.btn-bubble:hover {
  box-shadow: 0 14px 28px rgba(244, 63, 94, 0.45);
}

.btn-finger {
  background: linear-gradient(135deg, #F59E0B 0%, #EA580C 100%);
  box-shadow: 0 8px 22px rgba(234, 88, 12, 0.35);
}
.btn-finger:hover {
  box-shadow: 0 14px 28px rgba(234, 88, 12, 0.45);
}

.btn-mouse {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.35);
}
.btn-mouse:hover {
  box-shadow: 0 14px 28px rgba(16, 185, 129, 0.45);
}

.home-leaderboard {
  background: rgba(248, 250, 255, 0.9);
  border-radius: 24px;
  padding: 16px 20px;
  border: 2px dashed rgba(192, 132, 252, 0.35);
}

.home-lb-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-mid);
  margin-bottom: 6px;
}

.home-lb-content {
  font-size: 0.95rem;
  color: var(--text-light);
  font-weight: 600;
}

.home-lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  font-size: 0.9rem;
  color: var(--text-dark);
}
.home-lb-name {
  font-weight: 700;
}
.home-lb-score {
  font-weight: 800;
  color: #8B5CF6;
}

/* ============================================================
   TYPING MODE
   ============================================================ */
#page-typing {
  padding: 0;
  overflow: hidden;
}

.tm-header {
  padding: 14px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-bottom: 2px solid var(--glass-border);
  flex-shrink: 0;
}

.tm-telex-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 1rem;
  color: var(--text-mid);
  margin-bottom: 12px;
}
.hint-title { font-weight: 900; color: var(--candy-purple); font-size: 1.05rem; }
.hint-item { 
  padding: 4px 12px;
  background: rgba(255,255,255,0.5);
  border-radius: 10px;
  font-size: 0.95rem;
  border: 1.5px solid rgba(255,255,255,0.6);
}
.hint-item b { color: var(--text-dark); font-size: 1rem; }
.hint-sep { color: var(--text-light); }

.tm-level-select {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tm-lvl-btn {
  padding: 9px 18px;
  border-radius: var(--radius-xl);
  border: 2px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.2);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-mid);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tm-lvl-btn:hover { background: rgba(255,255,255,0.4); transform: translateY(-1px); }
.tm-lvl-btn.active {
  background: linear-gradient(135deg, #C084FC, #818cf8);
  color: white;
  border-color: rgba(255,255,255,0.6);
  box-shadow: 0 3px 12px rgba(192,132,252,0.4);
}

.tm-stats {
  display: flex;
  gap: 14px;
  padding: 12px 24px;
  flex-shrink: 0;
  justify-content: center;
}

.stat-card {
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  text-align: center;
  backdrop-filter: blur(12px);
  min-width: 100px;
}
.stat-val {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-dark);
  line-height: 1;
}
.stat-lbl {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 700;
  margin-top: 4px;
}

/* ── Typing Mode: khu vực chính ─────────────────────────── */
.tm-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 24px;
  overflow: hidden;
}

/* Thẻ từ mẫu (cố định) – không nền (Số 2) */
.tm-word-card {
  background: none;
  border: none;
  padding: 8px 16px;
  text-align: center;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  flex-shrink: 0;
  position: relative;
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
}
.tm-word-card.word-pop {
  animation: wordPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes wordPop {
  0%   { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1);    opacity: 1; }
}
.tm-word-label {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-light);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Từ/câu cần gõ */
.tm-display {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 2px;
  position: relative;
  z-index: 1;
}
.tm-char {
  font-family: var(--font-display);
  font-size: 5.8rem;
  font-weight: 900;
  line-height: 1.1;
  display: inline-block;
  text-shadow: 0 4px 14px rgba(0,0,0,0.12);
  letter-spacing: 1.5px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.tm-char.correct {
  opacity: 0.25;
  transform: scale(0.85);
}
.tm-char.wrong {
  color: #FF4D6D !important;
  animation: wrongShake 0.3s ease;
  text-shadow: 0 0 16px rgba(255,77,109,0.4);
}
@keyframes wrongShake {
  0%, 100% { transform: translateX(0) scale(1); }
  25%       { transform: translateX(-5px) scale(1.05); }
  75%       { transform: translateX(5px) scale(1.05); }
}

/* ── Kích thước chữ & phím linh hoạt theo độ dài từ/câu (Đã phóng to) ── */
.size-single .tm-char { font-size: 5.8rem; }
.size-single .telex-key-tile { min-width: 58px; height: 62px; font-size: 2.1rem; }

.size-compound .tm-char { font-size: 4.4rem; }
.size-compound .telex-key-tile { min-width: 48px; height: 54px; font-size: 1.7rem; }

.size-sentence .tm-char { font-size: 3.0rem; }
.size-sentence .telex-key-tile { min-width: 38px; height: 44px; font-size: 1.3rem; border-radius: 10px; padding: 0 8px; }
.size-sentence .telex-key-tile.telex-space-tile { min-width: 65px; font-size: 0.9rem; }

.size-sentence-long .tm-char { font-size: 2.4rem; }
.size-sentence-long .telex-key-tile { min-width: 32px; height: 38px; font-size: 1.1rem; border-radius: 8px; padding: 0 6px; }
.size-sentence-long .telex-key-tile.telex-space-tile { min-width: 55px; font-size: 0.8rem; }

/* ── Hàng phím gợi ý Telex không dấu (Key Tiles) - Cố định đúng 1 dòng ── */
.tm-telex-guide-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 6px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
  max-width: 100%;
  overflow-x: auto;
}

.telex-key-tile {
  min-width: 54px;
  height: 58px;
  padding: 0 12px;
  background: #ffffff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 900;
  color: #334155;
  box-shadow: 0 6px 16px rgba(140, 100, 200, 0.16), 0 3px 0 #E2E8F0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.telex-key-tile.active,
.telex-key-tile.tile-correct {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4), 0 2px 0 #047857;
  border-color: #10B981;
  transform: translateY(2px) scale(1.04);
}

.telex-key-tile.tile-wrong {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4), 0 2px 0 #B91C1C;
  border-color: #EF4444;
  animation: wrongShake 0.3s ease;
}

.telex-key-tile.telex-space-tile {
  min-width: 100px;
  font-size: 1rem;
  letter-spacing: 0.5px;
  color: #64748B;
}
.telex-key-tile.telex-space-tile.active,
.telex-key-tile.telex-space-tile.tile-correct {
  color: #ffffff;
}

/* Ô gõ lớn */
.tm-input-box {
  flex: 1;
  border-radius: var(--radius-lg);
  padding: 16px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  position: relative;
  min-height: 130px;
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
}
.tm-input-box.box-neutral {
  background: rgba(255, 255, 255, 0.88);
  border: 4px dashed rgba(180, 150, 240, 0.5);
  box-shadow: 0 4px 20px rgba(160,120,220,0.1);
}
.tm-input-box.box-correct {
  background: rgba(240, 255, 248, 0.95);
  border: 4px solid #10B981;
  box-shadow: 0 4px 24px rgba(16,185,129,0.25);
}
.tm-input-box.box-wrong {
  background: rgba(255, 242, 245, 0.95);
  border: 4px solid #EF4444;
  box-shadow: 0 4px 24px rgba(239,68,68,0.25);
  animation: shakeBox 0.35s ease;
}
@keyframes shakeBox {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  60%       { transform: translateX(8px); }
}
.tm-input-label {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-light);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  width: 100%;
}
.tm-input-cursor-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: nowrap;
  white-space: nowrap;
  min-height: 5rem;
  width: 100%;
}
.tm-typed-chars {
  display: flex;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 1px;
  align-items: center;
  justify-content: center;
}
.tm-typed-char {
  font-family: var(--font-display);
  font-size: 4.2rem;
  font-weight: 900;
  line-height: 1.1;
  display: inline-block;
  transition: font-size 0.2s ease;
}
.size-compound ~ .tm-input-box .tm-typed-char { font-size: 3.2rem; }
.size-sentence ~ .tm-input-box .tm-typed-char { font-size: 2.2rem; }
.size-sentence-long ~ .tm-input-box .tm-typed-char { font-size: 1.8rem; }

.tm-typed-char.correct {
  color: #10B981;
  text-shadow: 0 2px 8px rgba(16,185,129,0.3);
}
.tm-typed-char.in-progress {
  color: #6366F1;
  text-shadow: 0 2px 8px rgba(99,102,241,0.25);
}
.tm-typed-char.wrong {
  color: #EF4444;
  text-shadow: 0 2px 8px rgba(239,68,68,0.3);
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: #EF4444;
}
.tm-typed-char.overflow {
  color: #F59E0B;
  text-shadow: 0 2px 8px rgba(245,158,11,0.3);
}
.tm-input-cursor {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 900;
  color: var(--candy-purple);
  animation: cursorBlink 0.8s ease-in-out infinite;
  line-height: 1;
  margin-left: 2px;
  flex-shrink: 0;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
.tm-input-hint {
  font-size: 0.95rem;
  color: var(--text-light);
  font-weight: 600;
  text-align: center;
  width: 100%;
}

/* Feedback popup */
.tm-feedback {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 16px 40px;
  border-radius: var(--radius-xl);
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  animation: feedbackPop 0.7s ease forwards;
  pointer-events: none;
  z-index: 200;
}
.fb-correct { background: linear-gradient(135deg, #10B981, #34D399); color: white; box-shadow: 0 6px 24px rgba(16,185,129,0.5); }
.fb-wrong   { background: linear-gradient(135deg, #EF4444, #F87171); color: white; box-shadow: 0 6px 24px rgba(239,68,68,0.5); }
@keyframes feedbackPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  30%  { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  70%  { opacity: 1; transform: translate(-50%, -65%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.9); }
}

/* Progress bar */
.tm-progress-bar {
  height: 12px;
  background: rgba(255,255,255,0.4);
  flex-shrink: 0;
}
.tm-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #C084FC, #FB7185, #60A5FA);
  border-radius: 0 6px 6px 0;
  transition: width 0.5s ease;
}

/* ============================================================
   VIRTUAL KEYBOARD
   ============================================================ */
.vkb-wrap {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-top: 3px solid rgba(192,132,252,0.4);
  padding: 12px 16px 18px;
  box-shadow: 0 -4px 20px rgba(160,120,220,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Thanh gợi ý Telex ngay trên bàn phím ảo - Cố định đúng 1 dòng */
.tm-telex-hint-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
  padding: 8px 18px;
  background: rgba(245, 243, 255, 0.95);
  border: 2px solid rgba(192, 132, 252, 0.35);
  border-radius: 24px;
  box-shadow: 0 2px 10px rgba(160, 120, 220, 0.1);
  max-width: 1120px;
  width: auto;
  overflow-x: auto;
}

.tm-telex-hint-bar .hint-title {
  font-family: var(--font-display);
  font-weight: 900;
  color: #7C3AED;
  font-size: 1.15rem;
  letter-spacing: 0.3px;
  margin-right: 4px;
  flex-shrink: 0;
}

.tm-telex-hint-bar .hint-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.tm-telex-hint-bar .hint-item {
  padding: 4px 8px;
  background: #ffffff;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #334155;
  border: 1.5px solid rgba(203, 213, 225, 0.8);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
  flex-shrink: 0;
}

.tm-telex-hint-bar .hint-item b {
  color: #E11D48;
  font-size: 1.05rem;
  font-weight: 900;
}

.tm-telex-hint-bar .hint-sep {
  color: #CBD5E1;
  font-weight: 900;
  font-size: 1.2rem;
  margin: 0 4px;
  flex-shrink: 0;
}

.vkb-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.vkb-row {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.vkb-key {
  min-width: 54px;
  height: 54px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid rgba(200, 170, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: all 0.08s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1), inset 0 2px 0 rgba(255,255,255,1), 0 2px 0 rgba(180,140,240,0.3);
  position: relative;
  user-select: none;
}

.vkb-label {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text-dark);
  text-transform: uppercase;
}

.vkb-key.vkb-pressed {
  transform: translateY(3px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15), inset 0 2px 0 rgba(255,255,255,0.6), 0 0 16px rgba(192,132,252,0.5);
  background: rgba(192,132,252,0.75) !important;
  border-color: #A855F7;
}

.vkb-key.home-row {
  border-bottom: 3px solid rgba(100,80,200,0.4);
}
.vkb-key.anchor-key::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 3px;
  background: var(--candy-purple);
  border-radius: 2px;
}

/* Finger colors – brighter for kids */
.f-pinky-l  { background: rgba(255,158,196,0.55); border-color: rgba(255,100,160,0.4); }
.f-ring-l   { background: rgba(255,190,80,0.55);  border-color: rgba(240,160,40,0.4);  }
.f-mid-l    { background: rgba(100,200,255,0.55); border-color: rgba(60,160,240,0.4);  }
.f-idx-l    { background: rgba(120,240,150,0.55); border-color: rgba(60,200,100,0.4);  }
.f-thumb    { background: rgba(210,150,255,0.55); border-color: rgba(170,100,240,0.4); }
.f-idx-r    { background: rgba(130,250,160,0.55); border-color: rgba(60,200,100,0.4);  }
.f-mid-r    { background: rgba(100,200,255,0.55); border-color: rgba(60,160,240,0.4);  }
.f-ring-r   { background: rgba(255,190,80,0.55);  border-color: rgba(240,160,40,0.4);  }
.f-pinky-r  { background: rgba(255,158,196,0.55); border-color: rgba(255,100,160,0.4); }

/* Key widths */
.key-wide-2  { min-width: 100px; font-size: 0.8rem; }
.key-wide-1h { min-width: 78px; font-size: 0.85rem; }
.key-wide-2h { min-width: 124px; font-size: 0.8rem; }
.key-wide-3  { min-width: 150px; }
.key-space   { min-width: 320px; }

/* ============================================================
   BUBBLE GAME
   ============================================================ */
#page-bubble {
  overflow: hidden;
}

.bg-game-header {
  flex-shrink: 0;
  padding: 14px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-bottom: 2px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 24px;
}

.bg-stats {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.bg-stat {
  text-align: center;
  background: rgba(255,255,255,0.3);
  border-radius: var(--radius-md);
  padding: 10px 22px;
  border: 2px solid rgba(255,255,255,0.5);
}
.bg-stat-label { display: block; font-size: 0.9rem; color: var(--text-light); font-weight: 700; }
.bg-stat-val   { display: block; font-family: var(--font-display); font-size: 1.8rem; font-weight: 900; color: var(--text-dark); }

.bg-end-game-btn {
  background: #EF4444;
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 0 #B91C1C;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 12px;
}
.bg-end-game-btn:hover {
  background: #DC2626;
  transform: translateY(2px);
  box-shadow: 0 2px 0 #B91C1C;
}
.bg-end-game-btn:active {
  transform: translateY(4px);
  box-shadow: none;
}

.bg-input-area { flex: 1; }

.bg-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.4);
  border: 3px solid rgba(192,132,252,0.5);
  border-radius: var(--radius-xl);
  padding: 10px 24px;
  box-shadow: 0 0 24px rgba(192,132,252,0.2);
}
.bg-input-icon { font-size: 1.6rem; }
.bg-input-display {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--candy-purple);
  min-width: 100px;
  min-height: 2.2rem;
}
.bg-placeholder { color: var(--text-light); font-weight: 600; font-size: 1rem; font-family: var(--font-main); }
.bg-typed { animation: typeIn 0.1s ease; }
@keyframes typeIn {
  from { transform: scale(0.9); opacity: 0.5; }
  to   { transform: scale(1);   opacity: 1; }
}

.bg-input-wrap.pop-success {
  border-color: #10B981 !important;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.45) !important;
  transform: scale(1.02);
  transition: all 0.15s ease;
}

.bg-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.bg-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Overlay */
.bg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(180,150,230,0.35);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.3s ease;
}
.bg-overlay.hidden {
  display: none;
}

.bg-overlay-card {
  background: rgba(255,255,255,0.75);
  border: 2px solid rgba(255,255,255,0.8);
  border-radius: var(--radius-xl);
  padding: 36px 44px;
  max-width: 600px;
  width: 92%;
  box-shadow: 0 20px 60px rgba(160,120,220,0.3);
  text-align: center;
  animation: cardIn 0.4s ease;
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes cardIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.bg-overlay-emoji { font-size: 5rem; margin-bottom: 16px; animation: bounce 1s ease infinite; }
@keyframes bounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

.bg-overlay-card h2 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 10px;
}
.bg-overlay-card p {
  color: var(--text-mid);
  font-size: 1.1rem;
  margin-bottom: 24px;
  font-weight: 600;
}

.bg-settings { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; text-align: left; }
.bg-setting-group label { display: block; font-size: 1rem; font-weight: 800; color: var(--text-mid); margin-bottom: 8px; }

.bg-btn-group { display: flex; gap: 8px; }

.bg-set-btn {
  flex: 1;
  padding: 12px 10px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(192,132,252,0.3);
  background: rgba(255,255,255,0.5);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  color: var(--text-mid);
  transition: all 0.2s;
}
.bg-set-btn:hover { background: rgba(255,255,255,0.8); transform: translateY(-2px); }
.bg-set-btn.active {
  background: linear-gradient(135deg, var(--candy-purple), var(--candy-pink));
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-btn);
}

.bg-name-input {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(192,132,252,0.3);
  background: rgba(255,255,255,0.6);
  font-family: var(--font-main);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  outline: none;
}
.bg-name-input:focus { border-color: var(--candy-purple); box-shadow: 0 0 0 3px rgba(192,132,252,0.2); }

.bg-start-btn {
  width: 100%;
  padding: 18px;
  border-radius: var(--radius-xl);
  border: none;
  background: linear-gradient(135deg, #C084FC, #818cf8, #60A5FA);
  color: white;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 6px 24px rgba(192,132,252,0.45);
  margin-bottom: 24px;
}
.bg-start-btn:hover { transform: translateY(-3px); box-shadow: 0 10px 32px rgba(192,132,252,0.55); }
.bg-start-btn:active { transform: translateY(-1px); }

/* Leaderboard */
.bg-leaderboard h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 12px;
}
.bg-board-list { display: flex; flex-direction: column; gap: 8px; }
.bg-board-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(255,255,255,0.5);
  border-radius: var(--radius-md);
  font-size: 1rem;
}
.bg-rank { font-size: 1.4rem; flex-shrink: 0; }
.bg-board-name { flex: 1; font-weight: 800; color: var(--text-dark); font-size: 1rem; }
.bg-board-score { font-weight: 900; color: var(--candy-purple); font-size: 1rem; }
.bg-board-diff  { font-size: 0.85rem; color: var(--text-light); background: rgba(255,255,255,0.5); padding: 4px 10px; border-radius: 10px; }

/* Pop score float */
.bg-pop-score {
  position: absolute;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: #10B981;
  text-shadow: 0 2px 12px rgba(16,185,129,0.5);
  pointer-events: none;
  z-index: 30;
  animation: floatUp 0.8s ease forwards;
}
@keyframes floatUp {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-60px); }
}

/* ============================================================
   FINGER GUIDE
   ============================================================ */
.fg-layout {
  padding: 20px;
  overflow-y: auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.fg-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--candy-purple), var(--candy-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.fg-subtitle { color: var(--text-mid); font-size: 1.1rem; margin-top: 6px; font-weight: 600; }

.fg-hands-visual {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.fg-hand { flex: 1; min-width: 200px; }
.fg-hand-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.fg-finger-map { display: flex; flex-direction: column; gap: 8px; }

.fg-finger-card {
  background: rgba(255,255,255,0.45);
  border: 2px solid var(--fc, rgba(255,255,255,0.6));
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 20px var(--fg, rgba(200,180,255,0.2));
  transition: all 0.2s;
}
.fg-finger-card:hover { transform: translateX(6px); }

.fg-finger-emoji { font-size: 2rem; flex-shrink: 0; }
.fg-finger-name  { font-size: 1rem; font-weight: 800; color: var(--text-mid); flex: 1; }
.fg-finger-keys  { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.fg-finger-keys kbd {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(255,255,255,0.6);
  border: 2px solid rgba(0,0,0,0.12);
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-dark);
  font-family: var(--font-main);
}

.fg-thumb-center { display: flex; align-items: center; padding-top: 20px; }
.fg-thumb-card   { width: 100%; }

/* Keyboard */
.fg-keyboard-section {
  background: var(--glass-bg);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  backdrop-filter: blur(12px);
}
.fg-keyboard-section h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 14px;
}
.fg-keyboard { display: flex; flex-direction: column; gap: 8px; align-items: center; overflow-x: auto; }
.fg-row      { display: flex; gap: 6px; }
.fg-key {
  min-width: 60px;
  height: 58px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  color: rgba(45,39,71,0.85);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.7);
  cursor: default;
  transition: all 0.2s;
}
.fg-home   { border-bottom: 3px solid rgba(100,80,200,0.5); }
.fg-anchor { position: relative; }
.fg-anchor::after {
  content: '●';
  position: absolute;
  bottom: 2px;
  font-size: 6px;
  color: rgba(100,80,200,0.7);
}
.fg-pulse {
  animation: keyPulse 0.4s ease;
  box-shadow: 0 0 12px rgba(192,132,252,0.6), inset 0 1px 0 rgba(255,255,255,0.8) !important;
  transform: scale(1.1);
}
@keyframes keyPulse {
  0%   { transform: scale(1);   box-shadow: 0 0 0 rgba(192,132,252,0); }
  50%  { transform: scale(1.15); box-shadow: 0 0 16px rgba(192,132,252,0.7); }
  100% { transform: scale(1.1); }
}

.fg-highlight-card {
  transform: translateY(-4px) scale(1.05) !important;
  box-shadow: 0 0 30px var(--fg, rgba(200,180,255,0.6)), 0 8px 16px rgba(0,0,0,0.1) !important;
  border-color: var(--fc, rgba(255,255,255,1)) !important;
  z-index: 10;
  position: relative;
}

.fg-highlight-key {
  transform: translateY(2px) scale(0.95);
  box-shadow: 0 0 15px rgba(255,255,255,0.8), inset 0 2px 4px rgba(0,0,0,0.2) !important;
  filter: brightness(1.2);
}

/* Finger guide key widths */
.fg-key-wide-2   { min-width: 112px; font-size: 0.95rem; }
.fg-key-wide-15  { min-width: 88px; font-size: 0.95rem; }
.fg-key-wide-175 { min-width: 104px; font-size: 0.95rem; }
.fg-key-wide-225 { min-width: 132px; font-size: 0.95rem; }
.fg-key-wide-25  { min-width: 158px; font-size: 0.95rem; }
.fg-key-space    { min-width: 380px; font-size: 1.1rem; }

/* Tips */
.fg-tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.fg-tip-card {
  background: var(--glass-bg);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  backdrop-filter: blur(12px);
}
.fg-tip-icon { font-size: 2.4rem; margin-bottom: 10px; }
.fg-tip-card h4 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 8px;
}
.fg-tip-card p  { font-size: 1rem; color: var(--text-mid); line-height: 1.6; }
.fg-tip-card kbd {
  display: inline-block;
  padding: 3px 9px;
  background: rgba(255,255,255,0.6);
  border: 2px solid rgba(0,0,0,0.12);
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 800;
  font-family: var(--font-main);
}

/* Finger Guide Practice Area */
.fg-practice-area {
  background: var(--glass-bg);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.fg-pract-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.fg-pract-header h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-dark);
}
.fg-level-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.fg-lvl-btn {
  font-family: var(--font-main);
  background: rgba(255,255,255,0.5);
  border: 2px solid transparent;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.2s;
}
.fg-lvl-btn:hover { background: rgba(255,255,255,0.8); }
.fg-lvl-btn.active {
  background: #fff;
  border-color: var(--candy-purple);
  color: var(--candy-purple);
  box-shadow: 0 4px 12px rgba(192,132,252,0.3);
}

.fg-pract-board {
  width: 100%;
  max-width: 600px;
  background: rgba(255,255,255,0.6);
  border: 2px dashed rgba(192,132,252,0.5);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.fg-pract-display {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-dark);
  text-align: center;
  min-height: 40px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.fg-pract-start {
  font-family: var(--font-display);
  background: linear-gradient(135deg, var(--candy-purple), var(--candy-pink));
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(192,132,252,0.4);
  transition: transform 0.2s;
}
.fg-pract-start:hover { transform: scale(1.05); }

.fg-p-char {
  color: var(--text-mid);
  opacity: 0.5;
  transition: all 0.2s;
}
.fg-p-char.current {
  opacity: 1;
  color: var(--candy-purple);
  transform: scale(1.3);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}
.fg-p-char.done {
  opacity: 1;
  color: #10B981;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
  100% { transform: translateX(0); }
}
.shake {
  animation: shake 0.3s;
  color: #EF4444 !important;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(192,132,252,0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(192,132,252,0.7); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .nav-brand .brand-text { display: none; }
  .nav-tab span:not(.tab-icon) { display: none; }
  .tm-char { font-size: 3rem; }
  .bg-overlay-card { padding: 24px; }
  .fg-hands-visual { flex-direction: column; }
  .tm-stats { gap: 8px; }
  .stat-card { padding: 10px 14px; min-width: 80px; }
  .stat-val { font-size: 1.6rem; }
  .key-space { min-width: 200px; }
}

@media (max-width: 600px) {
  :root {
    --nav-h: 70px;
    --radius-xl: 24px;
    --radius-lg: 16px;
  }
  
  /* Nav & Home */
  .nav { padding: 0 12px; gap: 8px; }
  .nav-tab { padding: 8px 12px; font-size: 1.1rem; }
  .nav-audio-btn { width: 42px; height: 42px; font-size: 1.2rem; }
  .home-title { font-size: 2.2rem; margin-bottom: 20px; }
  .home-card { padding: 24px 20px; border-radius: 24px; border-width: 2px; }
  .home-notice { padding: 12px 16px; margin-bottom: 20px; border-radius: 16px; gap: 8px; }
  .notice-item { font-size: 0.85rem; gap: 8px; }
  .notice-icon { font-size: 1.1rem; }
  .home-btn { font-size: 1.1rem; padding: 12px 16px; gap: 8px; }
  
  /* Virtual Keyboard */
  .vkb-key { min-width: 26px; height: 38px; border-radius: 8px; border-width: 1px; }
  .vkb-label { font-size: 0.75rem; }
  .key-wide-2 { min-width: 48px; font-size: 0.65rem; }
  .key-wide-1h { min-width: 40px; font-size: 0.7rem; }
  .key-wide-2h { min-width: 60px; font-size: 0.65rem; }
  .key-wide-3 { min-width: 70px; }
  .key-space { min-width: 140px; }
  .tm-telex-hint-bar { padding: 6px 12px; gap: 6px; border-radius: 16px; }
  .tm-telex-hint-bar .hint-title { font-size: 0.9rem; margin-right: 2px; }
  .tm-telex-hint-bar .hint-item { padding: 2px 6px; font-size: 0.75rem; border-width: 1px; border-radius: 6px; }
  .tm-telex-hint-bar .hint-sep { font-size: 1rem; margin: 0 2px; }
  
  /* Typing Mode */
  .tm-header { padding: 8px 12px; }
  .tm-main-area { padding: 8px 12px; gap: 8px; }
  .tm-stats { padding: 8px; gap: 6px; flex-wrap: wrap; }
  .stat-card { padding: 8px 10px; min-width: 70px; border-radius: 12px; border-width: 1px; }
  .stat-val { font-size: 1.3rem; }
  .stat-lbl { font-size: 0.75rem; }
  
  .size-single .tm-char { font-size: 3.2rem; }
  .size-compound .tm-char { font-size: 2.4rem; }
  .size-sentence .tm-char { font-size: 1.6rem; }
  .size-sentence-long .tm-char { font-size: 1.2rem; }
  
  .telex-key-tile { min-width: 32px; height: 38px; padding: 0 6px; font-size: 1.1rem; border-radius: 10px; border-width: 1px; }
  .size-sentence .telex-key-tile { min-width: 24px; height: 30px; font-size: 0.9rem; }
  .size-sentence-long .telex-key-tile { min-width: 18px; height: 26px; font-size: 0.75rem; }
  
  .tm-input-box { padding: 10px 16px; min-height: 80px; border-width: 2px; }
  .tm-typed-char { font-size: 2.2rem; }
  .size-compound ~ .tm-input-box .tm-typed-char { font-size: 1.8rem; }
  .size-sentence ~ .tm-input-box .tm-typed-char { font-size: 1.3rem; }
  .size-sentence-long ~ .tm-input-box .tm-typed-char { font-size: 1rem; }
  .tm-input-cursor { font-size: 2.2rem; }
  .tm-input-hint { font-size: 0.8rem; }
  
  /* Bubble Game */
  .bg-game-header { padding: 8px 12px; gap: 8px; flex-direction: column; align-items: stretch; }
  .bg-stats { justify-content: space-between; gap: 6px; }
  .bg-stat { padding: 6px 10px; border-radius: 10px; flex: 1; border-width: 1.5px; }
  .bg-stat-label { font-size: 0.7rem; }
  .bg-stat-val { font-size: 1.2rem; }
  .bg-end-game-btn { font-size: 0.85rem; padding: 6px 8px; margin-left: 0; border-radius: 10px; flex: 1; }
  
  .bg-input-wrap { padding: 6px 14px; gap: 8px; border-width: 2px; border-radius: 16px; }
  .bg-input-icon { font-size: 1.2rem; }
  .bg-input-display { font-size: 1.4rem; min-height: 1.6rem; min-width: 60px; }
  .bg-placeholder { font-size: 0.85rem; }
  
  .bg-overlay-card { padding: 20px 16px; border-width: 1px; border-radius: 16px; }
  .bg-overlay-card h2 { font-size: 1.6rem; }
  .bg-overlay-card p { font-size: 0.9rem; margin-bottom: 16px; }
  .bg-overlay-emoji { font-size: 3rem; margin-bottom: 12px; }
  .bg-settings { gap: 10px; margin-bottom: 16px; }
  .bg-set-btn { font-size: 0.85rem; padding: 8px 4px; border-width: 1px; border-radius: 8px; }
  .bg-name-input { padding: 10px 14px; font-size: 0.95rem; border-width: 1px; }
  .bg-start-btn { padding: 12px; font-size: 1.1rem; border-radius: 12px; margin-bottom: 16px; }
  
  .bg-leaderboard h3 { font-size: 1.1rem; }
  .bg-board-row { padding: 8px 10px; font-size: 0.85rem; gap: 8px; }
  .bg-rank { font-size: 1.1rem; }
  
  /* Finger Guide */
  .fg-layout { padding: 12px; gap: 12px; }
  .fg-title { font-size: 1.6rem; }
  .fg-subtitle { font-size: 0.9rem; margin-top: 4px; }
  .fg-hand-title { font-size: 1.1rem; margin-bottom: 8px; }
  .fg-finger-card { padding: 10px 12px; gap: 8px; border-width: 1px; border-radius: 12px; }
  .fg-finger-emoji { font-size: 1.4rem; }
  .fg-finger-name { font-size: 0.85rem; }
  .fg-finger-keys kbd { font-size: 0.75rem; padding: 2px 6px; border-width: 1px; border-radius: 4px; }
  
  .fg-keyboard-section { padding: 12px 8px; border-width: 1px; border-radius: 12px; }
  .fg-keyboard-section h3 { font-size: 1.1rem; margin-bottom: 10px; }
  .fg-keyboard { gap: 2px; }
  .fg-row { gap: 1.5px; }
  .fg-key { min-width: 26px; height: 32px; font-size: 0.65rem; border-width: 1px; border-radius: 5px; }
  .fg-key-wide-2 { min-width: 44px; font-size: 0.6rem; }
  .fg-key-wide-15 { min-width: 36px; font-size: 0.6rem; }
  .fg-key-wide-175 { min-width: 42px; font-size: 0.6rem; }
  .fg-key-wide-225 { min-width: 52px; font-size: 0.6rem; }
  .fg-key-wide-25 { min-width: 60px; font-size: 0.6rem; }
  .fg-key-space { min-width: 140px; font-size: 0.7rem; }
  .fg-tips-grid { grid-template-columns: 1fr; gap: 10px; }
  .fg-tip-card { padding: 12px; border-width: 1px; border-radius: 12px; }
  .fg-tip-icon { font-size: 1.8rem; margin-bottom: 8px; }
  .fg-tip-card h4 { font-size: 1.05rem; }
  .fg-tip-card p { font-size: 0.9rem; }
  .fg-practice-hint { padding: 12px 16px; gap: 10px; border-width: 1px; border-radius: 12px; }
  .fg-practice-icon { font-size: 1.6rem; }
  .fg-practice-hint p { font-size: 0.9rem; }
}

/* ── Loading Screen ─────────────────────────────────────────── */
#loading-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #a18cd1, #fbc2eb, #a1c4fd);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}
#loading-screen.fade-out { opacity: 0; pointer-events: none; }

.loading-logo {
  font-size: 7rem;
  animation: loadingBounce 0.8s ease infinite alternate;
  margin-bottom: 24px;
}
@keyframes loadingBounce {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-24px) scale(1.12); }
}

.loading-title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 24px rgba(0,0,0,0.25);
  margin-bottom: 12px;
}

.loading-sub {
  font-size: 1.2rem;
  color: rgba(255,255,255,0.9);
  margin-bottom: 36px;
  font-weight: 600;
}

.loading-bar-wrap {
  width: 200px;
  height: 8px;
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%;
  background: white;
  border-radius: 4px;
  animation: loadingFill 1.5s ease forwards;
}
@keyframes loadingFill {
  from { width: 0%; }
  to   { width: 100%; }
}
/* ============================================================
   MOUSE PRACTICE (Luyện dùng chuột)
   ============================================================ */
.mp-menu-layout { padding: 40px 20px; text-align: center; }
.mp-title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--candy-purple), var(--candy-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}
.mp-subtitle { font-size: 1.2rem; color: var(--text-mid); margin-bottom: 40px; }
.mp-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  max-width: 1000px;
  margin: 0 auto;
}
.mp-game-card {
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid rgba(255, 255, 255, 1);
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  backdrop-filter: blur(10px);
}
.mp-game-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(192, 132, 252, 0.2);
}
.mp-card-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: float 3s ease-in-out infinite;
}
.mp-game-card h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--text-dark);
  margin-bottom: 10px;
}
.mp-game-card p {
  color: var(--text-mid);
  font-size: 1.05rem;
  line-height: 1.5;
}

/* Common Game UI */
.mp-game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 2px solid rgba(255, 255, 255, 1);
  backdrop-filter: blur(10px);
}
.mp-back-btn {
  background: var(--glass-bg);
  border: 2px solid var(--candy-purple);
  padding: 8px 16px;
  border-radius: 20px;
  color: var(--candy-purple);
  font-family: var(--font-main);
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}
.mp-back-btn:hover { background: var(--candy-purple); color: white; }
.mp-game-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--text-dark);
  margin: 0;
}
.mp-score-board {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--candy-pink);
  min-width: 120px;
  text-align: right;
}
.mp-game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  overflow: hidden;
  user-select: none;
}
.mp-btn {
  font-family: var(--font-display);
  background: linear-gradient(135deg, var(--candy-purple), var(--candy-pink));
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 30px;
  font-size: 1.2rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(192, 132, 252, 0.4);
  transition: transform 0.2s;
}
.mp-btn:hover { transform: scale(1.05); }

/* Game 1: Slime */
.g1-area { cursor: crosshair; }
.g1-slime {
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15), inset 0 4px 8px rgba(255,255,255,0.6);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: slime-appear 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.g1-slime:active { filter: brightness(0.8); }
@keyframes slime-appear {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* Game 2: Beads */
.g2-layout { display: flex; flex-direction: column; height: 100%; padding: 20px; gap: 20px; }
.g2-baskets { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 20px; }
.g2-basket {
  width: 140px;
  height: 140px;
  border: 6px dashed;
  border-radius: 20px;
  background: rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s;
}
.g2-basket.drag-over { background: rgba(255,255,255,0.9); transform: scale(1.05); }
.g2-basket-inner {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}
.g2-basket-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  transition: height 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  opacity: 0.6;
}
.g2-basket-title {
  position: absolute;
  bottom: -15px;
  padding: 4px 16px;
  border-radius: 12px;
  color: white;
  font-weight: 800;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 10;
}
.g2-beads {
  flex: 1;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-content: flex-start;
  justify-content: center;
}
.g2-bead {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2), inset -4px -4px 10px rgba(0,0,0,0.2), inset 4px 4px 10px rgba(255,255,255,0.8);
  cursor: grab;
  transition: transform 0.2s;
}
.g2-bead:active { cursor: grabbing; }
.g2-bead.dragging { opacity: 0.5; transform: scale(1.1); }
.mp-win-msg {
  text-align: center;
  padding: 40px;
  background: rgba(255,255,255,0.9);
  border-radius: 20px;
  margin: 40px auto;
  max-width: 500px;
}
.mp-win-msg h3 { font-size: 2rem; color: var(--candy-purple); margin-bottom: 20px; }

/* Game 3: Canvas */
.g3-container {
  flex: 1;
  width: 100%;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
#g3-bg-img {
  max-width: 90%;
  max-height: 90%;
  width: auto;
  height: auto;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  object-fit: contain;
  pointer-events: none;
}
#g3-canvas {
  position: absolute;
  cursor: pointer;
  border-radius: 20px;
}
/* Game 1: Menu & Challenge */
.g1-menu {
  background: rgba(255,255,255,0.9);
  padding: 40px;
  border-radius: 20px;
  max-width: 600px;
  margin: 40px auto;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.g1-menu h3 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--candy-purple);
  margin-bottom: 30px;
}
.g1-modes {
  display: flex;
  gap: 20px;
  justify-content: center;
}
.g1-config-group {
  margin-bottom: 20px;
  text-align: left;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}
.g1-config-group label {
  display: block;
  font-weight: bold;
  color: var(--text-dark);
  margin-bottom: 8px;
}
.g1-select, .g1-input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--glass-border);
  border-radius: 12px;
  font-size: 1.1rem;
  font-family: inherit;
  outline: none;
}
.g1-select:focus, .g1-input:focus {
  border-color: var(--candy-purple);
}
.g1-lb-menu {
  max-width: 800px;
}
.g1-lb-list {
  max-height: 400px;
  overflow-y: auto;
}
.g1-lb-list table {
  width: 100%;
  border-collapse: collapse;
}
.g1-lb-list th {
  background: var(--candy-purple);
  color: white;
  padding: 10px;
  position: sticky;
  top: 0;
}
.g1-lb-list td {
  padding: 10px;
  border-bottom: 1px solid #ddd;
}
/* Game 4: Trùm Gắp Thú Bông */
.g4-container {
  position: relative;
  width: 100%;
  height: 500px;
  background: linear-gradient(180deg, #1A1A2E 0%, #16213E 100%);
  border-radius: 20px;
  overflow: hidden;
  border: 8px solid #FF9A9E;
  box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
  margin-bottom: 20px;
}
.g4-crane-track {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 20px;
  background: #333;
  border-bottom: 4px solid #111;
}
.g4-crane {
  position: absolute;
  top: 20px;
  width: 60px;
  height: 60px; /* Base height */
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
  transition: height 0.5s ease-in-out;
}
.g4-crane.g4-dropping {
  height: 400px; /* Drop down */
}
.g4-crane-line {
  width: 4px;
  height: calc(100% - 40px);
  background: #CCC;
}
.g4-crane-claw {
  width: 50px;
  height: 40px;
  background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="M10 50 Q 50 10 90 50" stroke="silver" stroke-width="10" fill="none"/><path d="M10 50 L 10 80 M90 50 L 90 80" stroke="silver" stroke-width="10" stroke-linecap="round"/></svg>') no-repeat center;
  background-size: contain;
}
.g4-dropping .g4-crane-claw {
  background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="M30 50 Q 50 20 70 50" stroke="silver" stroke-width="10" fill="none"/><path d="M30 50 L 40 80 M70 50 L 60 80" stroke="silver" stroke-width="10" stroke-linecap="round"/></svg>') no-repeat center;
}
.g4-toy-bin {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 120px;
  background: rgba(255,255,255,0.1);
  border-top: 5px solid rgba(255,255,255,0.2);
}
.g4-toy {
  position: absolute;
  bottom: 10px;
  font-size: 3.5rem;
  transform: translateX(-50%);
  filter: drop-shadow(0 5px 5px rgba(0,0,0,0.5));
}
.g4-controls {
  text-align: center;
}
/* Game 5: Tiệc Nướng BBQ */
.g5-layout {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  height: 500px;
  background: rgba(255,255,255,0.8);
  border-radius: 20px;
  padding: 20px;
}
.g5-zone {
  flex: 1;
  border-radius: 15px;
  background: rgba(0,0,0,0.05);
  border: 3px dashed rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.g5-zone-title {
  text-align: center;
  color: white;
  margin: 0;
  padding: 10px;
  font-family: var(--font-display);
}
.g5-zone-content {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  position: relative;
}
.g5-item {
  width: 60px;
  height: 60px;
  font-size: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: filter 0.3s, transform 0.2s;
}
.g5-item:active {
  cursor: grabbing;
  transform: scale(1.1);
}
.g5-cooking {
  animation: shake 0.5s infinite;
}
.g5-cooked {
  filter: sepia(1) hue-rotate(-50deg) saturate(3) drop-shadow(0 0 10px gold);
}
.g5-burnt {
  filter: grayscale(1) brightness(0.2);
}
#g5-grill {
  background: #2d3436;
  border: 5px solid #111;
}
#g5-grill .g5-fire {
  position: absolute;
  bottom: 10px;
  left: 0;
  width: 100%;
  font-size: 4rem;
  text-align: center;
  opacity: 0.5;
  pointer-events: none;
  animation: flicker 1s infinite alternate;
}
@keyframes shake {
  0% { transform: translateX(-2px) rotate(-5deg); }
  50% { transform: translateX(2px) rotate(5deg); }
  100% { transform: translateX(-2px) rotate(-5deg); }
}
@keyframes flicker {
  0% { opacity: 0.4; transform: scaleY(1); }
  100% { opacity: 0.8; transform: scaleY(1.2); }
}
/* Game 6: Ninja Chém Hoa Quả */
.g6-container {
  width: 100%;
  height: 500px;
  background: url('img_jungle.jpg') center/cover;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
  border: 5px solid #2ecc71;
  cursor: crosshair;
}
#g6-canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
}
