/* =========================================================
   HỆ THỐNG GIAO DIỆN HPKT - HỌC VUI CÙNG BÉ (STYLE.CSS)
   Phong cách Gamified EdTech, Màu sắc tươi sáng, Bo góc mềm mại
   ========================================================= */

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

:root {
  /* Color Palette */
  --primary: #ff6b6b;
  --primary-hover: #ee5253;
  --secondary: #48dbfb;
  --secondary-hover: #0abde3;
  --accent-yellow: #feca57;
  --accent-green: #1dd1a1;
  --accent-green-dark: #10ac84;
  --accent-purple: #5f27cd;
  --accent-purple-light: #9c88ff;
  
  --bg-gradient: linear-gradient(135deg, #f6f9fc 0%, #e9f0f8 100%);
  --sky-gradient: linear-gradient(180deg, #74b9ff 0%, #a1c4fd 60%, #c2e9fb 100%);
  --card-bg: rgba(255, 255, 255, 0.94);
  --card-shadow: 0 12px 30px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
  --card-border: 2px solid rgba(255, 255, 255, 0.8);
  
  --text-main: #2d3436;
  --text-muted: #636e72;
  --text-white: #ffffff;
  
  --font-family: 'Baloo 2', 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
  --border-radius-lg: 24px;
  --border-radius-md: 16px;
  --border-radius-sm: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent !important;
}

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Background Floating Clouds & Shapes */
.bg-decor-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50px;
  filter: blur(2px);
  animation: floatCloud 25s infinite linear;
}

.cloud-1 { top: 10%; width: 140px; height: 50px; left: -150px; animation-duration: 35s; }
.cloud-2 { top: 35%; width: 220px; height: 70px; left: -250px; animation-duration: 45s; animation-delay: 10s; }
.cloud-3 { top: 70%; width: 180px; height: 60px; left: -200px; animation-duration: 40s; animation-delay: 5s; }

@keyframes floatCloud {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(100vw + 300px)); }
}

/* =========================================================
   HEADER & NAVBAR
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid #edf2f7;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.logo-badge {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #ff9f43, #ff5252);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(255, 107, 107, 0.35);
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(90deg, #ff4757, #5f27cd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.brand-text span {
  font-size: 13px;
  font-weight: 600;
  color: #747d8c;
}

/* Top Stats & Quick Actions */
.header-stats-bar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f2f6;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 15px;
  border: 1px solid #e4e7eb;
}

.pill-streak { background: #fff2e2; color: #e67e22; border-color: #ffe0b2; }
.pill-coins { background: #fffbe6; color: #d48806; border-color: #ffe58f; }
.pill-level { background: #f0f5ff; color: #2f54eb; border-color: #d6e4ff; cursor: pointer; }

.header-action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #f1f2f6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
}

.header-action-btn:hover {
  transform: scale(1.08);
  background: #e4e7eb;
}

/* =========================================================
   MAIN APP CONTAINER & VIEWS
   ========================================================= */
.app-main {
  position: relative;
  z-index: 10;
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 16px 60px 16px;
  width: 100%;
  flex: 1;
}

.view-section {
  display: none;
}

.view-section.active-view {
  display: block;
  animation: fadeInView 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInView {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   LOBBY / HOME VIEW
   ========================================================= */
.lobby-hero {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  border-radius: var(--border-radius-lg);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
  box-shadow: 0 10px 25px rgba(254, 214, 227, 0.4);
  position: relative;
  overflow: hidden;
}

.hero-greeting h2 {
  font-size: 32px;
  font-weight: 800;
  color: #2f3542;
  margin-bottom: 8px;
}

.hero-greeting p {
  font-size: 17px;
  font-weight: 600;
  color: #57606f;
  margin-bottom: 18px;
}

.grade-selector-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.grade-selector-box span {
  font-weight: 700;
  font-size: 15px;
  color: #2f3542;
}

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

.btn-grade-choice {
  background: white;
  border: 2px solid transparent;
  padding: 6px 14px;
  border-radius: 12px;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.btn-grade-choice.active {
  background: #ff4757;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(255, 71, 87, 0.35);
}

/* Hero Mascot Bubble */
.hero-mascot-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 280px;
}

.hero-mascot-avatar {
  width: 110px;
  height: 110px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.hero-mascot-avatar:hover {
  transform: scale(1.1) rotate(5deg);
}

.mascot-speech-bubble {
  background: white;
  border-radius: 18px;
  padding: 14px 18px;
  position: relative;
  font-size: 14px;
  font-weight: 700;
  color: #333;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  border: 2px solid #fed6e3;
  max-width: 220px;
}

.mascot-speech-bubble::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 10px solid white;
}

/* Game Hub Grid */
.game-hub-section h3 {
  font-size: 24px;
  font-weight: 800;
  color: #2f3542;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 35px;
}

.game-mode-card {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: 24px;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.game-mode-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-icon-huge {
  font-size: 42px;
}

.card-badge-tag {
  background: #f1f2f6;
  color: #57606f;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  text-transform: uppercase;
}

.card-info h4 {
  font-size: 20px;
  font-weight: 800;
  color: #2f3542;
  margin-bottom: 8px;
}

.card-info p {
  font-size: 14px;
  font-weight: 600;
  color: #747d8c;
  line-height: 1.4;
  margin-bottom: 20px;
}

.card-btn-launch {
  width: 100%;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

/* Card Themes */
.card-adventure { border-top: 6px solid #ff4757; }
.card-adventure .card-btn-launch { background: #ff4757; color: white; }
.card-balloon { border-top: 6px solid #2ed573; }
.card-balloon .card-btn-launch { background: #2ed573; color: white; }
.card-memory { border-top: 6px solid #5f27cd; }
.card-memory .card-btn-launch { background: #5f27cd; color: white; }
.card-fraction { border-top: 6px solid #ff9f43; }
.card-fraction .card-btn-launch { background: #ff9f43; color: white; }
.card-clock { border-top: 6px solid #1e90ff; }
.card-clock .card-btn-launch { background: #1e90ff; color: white; }
.card-sandbox { border-top: 6px solid #ff6b81; }
.card-sandbox .card-btn-launch { background: #ff6b81; color: white; }

/* Responsive Header & Layout */
@media (max-width: 768px) {
  .site-header { padding: 10px 16px; }
  .brand-text h1 { font-size: 18px; }
  .brand-text span { display: none; }
  .lobby-hero { flex-direction: column; text-align: center; padding: 20px; }
  .grade-selector-box { justify-content: center; }
  .hero-mascot-wrapper { justify-content: center; }
  .mascot-speech-bubble::before { display: none; }
}
