/* ═══════════════════════════════════════════════════════
   ROOT & RESET
═══════════════════════════════════════════════════════ */
:root {
  --red: #FF6B6B;
  --orange: #FF9F43;
  --yellow: #FECA57;
  --blue: #48DBFB;
  --pink: #FF9FF3;
  --green: #1DD1A1;
  --purple: #A29BFE;
  --bg: #FFF8F1;
  --card: #FFFFFF;
  --border: #FFE0A0;
  --text: #333344;
  --muted: #AAA;
  --surface: rgba(255,255,255,0.76);
  --surface-strong: rgba(255,255,255,0.92);
  --shadow-soft: 0 18px 48px rgba(255,140,82,0.14);
  --shadow-card: 0 14px 34px rgba(76,45,24,0.10);
  --ring: rgba(255,159,67,0.16);
  --sidebar-w: 200px;
  --bottom-h: 64px;
  --top-h: 60px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Nunito', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255,234,198,0.7), transparent 34%),
    radial-gradient(circle at right 16%, rgba(72,219,251,0.12), transparent 20%),
    linear-gradient(180deg, #FFFDF8 0%, var(--bg) 100%);
  color: var(--text);
}
body { position: relative; }
body::before, body::after {
  content: '';
  position: fixed;
  width: 280px; height: 280px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(18px);
  opacity: 0.42; z-index: 0;
}
body::before { top: -110px; right: -80px; background: rgba(255,180,71,0.24); }
body::after  { bottom: -130px; left: -110px; background: rgba(72,219,251,0.16); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #FFF0DC; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: var(--orange); border-radius: 10px; }

button, input { font-family: 'Nunito', sans-serif; outline: none; border: none; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button:focus-visible, input:focus-visible,
.cat-pill:focus-visible, .sb-item:focus-visible { box-shadow: 0 0 0 4px var(--ring); }

/* ═══════════════════════════════════════════════════════
   FLOATING STARS CANVAS
═══════════════════════════════════════════════════════ */
#stars-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.72; }

/* ═══════════════════════════════════════════════════════
   PAGES
═══════════════════════════════════════════════════════ */
.page { position: fixed; inset: 0; z-index: 10; display: none; }
.page.active { display: flex; animation: pageSoftIn 0.45s ease forwards; }
@keyframes pageSoftIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════
   BOOK COVER PAGE
═══════════════════════════════════════════════════════ */
#page-book {
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #fff8e7 0%, #ffe8a0 50%, #FFB347 100%);
  perspective: 1400px; cursor: pointer;
  flex-direction: column; gap: 24px;
}
.book-scene {
  transform-style: preserve-3d;
  animation: bookFloat 5.4s ease-in-out infinite;
}
@keyframes bookFloat {
  0%,100% { transform: translateY(0) rotateY(-4deg) rotateX(2deg); }
  50%      { transform: translateY(-10px) rotateY(3deg) rotateX(-1deg); }
}
.book-3d {
  width: 230px; height: 300px;
  position: relative; transform-style: preserve-3d;
}
.book-front {
  position: absolute; inset: 0;
  background: linear-gradient(145deg, #FF6B6B 0%, #FF9F43 45%, #FECA57 100%);
  border-radius: 6px 20px 20px 6px;
  border: 4px solid rgba(255,255,255,0.5);
  box-shadow: 8px 12px 40px rgba(200,80,20,0.45), -4px 0 0 #C0392B;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; overflow: hidden; backface-visibility: hidden;
}
.book-front::before {
  content: ''; position: absolute; left: 0; top: 0; width: 20px; height: 100%;
  background: rgba(0,0,0,0.18); border-radius: 6px 0 0 6px;
}
.book-front::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg,transparent,transparent 28px,rgba(255,255,255,0.06) 28px,rgba(255,255,255,0.06) 29px);
  pointer-events: none;
}
.book-spine {
  position: absolute; left: -14px; top: 4px; bottom: 4px; width: 14px;
  background: linear-gradient(to right, #C0392B, #E74C3C);
  border-radius: 4px 0 0 4px;
  transform: rotateY(-90deg) translateX(-7px); transform-origin: right;
}
.book-logo-emoji {
  font-size: 70px; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.25));
  animation: logoBounce 3.4s ease-in-out infinite; position: relative; z-index: 1;
}
@keyframes logoBounce {
  0%,100% { transform: translateY(0) scale(1); }
  40%      { transform: translateY(-6px) scale(1.03); }
  60%      { transform: translateY(-4px) scale(1.015); }
}
.book-title-text {
  font-family: 'Fredoka One', cursive; font-size: 30px; color: #fff;
  text-shadow: 3px 4px 0 rgba(0,0,0,0.18);
  position: relative; z-index: 1; letter-spacing: 1px;
}
.book-subtitle {
  font-size: 11px; font-weight: 800; color: rgba(255,255,255,0.9);
  letter-spacing: 3px; text-transform: uppercase; position: relative; z-index: 1;
}
.tap-hint {
  font-size: 14px; font-weight: 800; color: rgba(255,255,255,0.95);
  animation: tapPulse 2.4s ease-in-out infinite; margin-top: 4px; position: relative; z-index: 1;
}
@keyframes tapPulse {
  0%,100% { opacity: 0.96; transform: scale(1); }
  50%      { opacity: 0.72; transform: scale(0.985); }
}
.sparkle {
  position: absolute; font-size: 18px;
  animation: sparkleSpin 8s linear infinite; pointer-events: none;
}
@keyframes sparkleSpin {
  0%   { transform: rotate(0deg) translateX(140px) rotate(0deg) scale(1); opacity:0.8; }
  50%  { opacity: 1; transform: rotate(180deg) translateX(140px) rotate(-180deg) scale(1.08); }
  100% { transform: rotate(360deg) translateX(140px) rotate(-360deg) scale(1); opacity:0.8; }
}
.book-hint-row {
  font-size: 15px; color: rgba(80,40,10,0.65); font-weight: 800;
  letter-spacing: 1px; animation: tapPulse 2.6s ease-in-out infinite 0.3s;
}

/* ═══════════════════════════════════════════════════════
   BOOK OPENING OVERLAY
═══════════════════════════════════════════════════════ */
#opening-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: radial-gradient(ellipse at center, #fff8e7, #ffe0a0);
  display: flex; align-items: center; justify-content: center; perspective: 1200px;
}
.open-book-wrap {
  width: 320px; height: 400px; transform-style: preserve-3d; position: relative;
}
.open-page {
  position: absolute; top: 0; width: 50%; height: 100%;
  background: linear-gradient(to bottom, #fff, #fff8e7);
  border: 2px solid #FFD080;
}
.open-page.left {
  left: 0; border-radius: 10px 0 0 10px;
  transform-origin: right center;
  animation: openLeft 0.9s cubic-bezier(0.77,0,0.18,1) forwards;
  box-shadow: inset -4px 0 12px rgba(0,0,0,0.08);
}
.open-page.right {
  right: 0; border-radius: 0 10px 10px 0;
  transform-origin: left center;
  animation: openRight 0.9s cubic-bezier(0.77,0,0.18,1) forwards;
  box-shadow: inset 4px 0 12px rgba(0,0,0,0.08);
}
.open-page::before {
  content: ''; position: absolute; inset: 16px;
  background: repeating-linear-gradient(0deg, transparent, transparent 24px, #FFE0A0 24px, #FFE0A0 25px);
  opacity: 0.4;
}
@keyframes openLeft  { 0%{transform:rotateY(0)}   100%{transform:rotateY(-160deg)} }
@keyframes openRight { 0%{transform:rotateY(0)}   100%{transform:rotateY(160deg)} }
.opening-fade { animation: openingFadeOut 1.1s ease forwards 0.3s; }
@keyframes openingFadeOut { 0%{opacity:1} 70%{opacity:1} 100%{opacity:0;pointer-events:none} }

/* ═══════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════ */
#page-login {
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #fff8e7 0%, #FFE0A0 55%, #FFB347 100%);
  flex-direction: column;
}
.login-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,251,246,0.92));
  border-radius: 28px; padding: 36px 32px 32px;
  width: min(380px, 92vw);
  box-shadow: 0 26px 64px rgba(255,107,80,0.16), 0 8px 24px rgba(0,0,0,0.08);
  border: 1px solid rgba(255,216,160,0.9);
  animation: loginCardIn 0.55s cubic-bezier(0.22,1,0.36,1) forwards;
  backdrop-filter: blur(14px);
}
@keyframes loginCardIn {
  0%   { opacity:0; transform: scale(0.92) translateY(28px); }
  100% { opacity:1; transform: scale(1) translateY(0); }
}
.login-card.flip-out { animation: loginFlipOut 0.7s cubic-bezier(0.4,0,0.2,1) forwards; }
@keyframes loginFlipOut {
  0%   { transform: rotateY(0) scale(1); opacity:1; }
  100% { transform: rotateY(-180deg) scale(0.6); opacity:0; }
}
.login-avatar-big { font-size: 64px; text-align: center; margin-bottom: 6px; transition: transform 0.3s; }
.login-avatar-big:hover { transform: scale(1.1) rotate(-5deg); }
.login-card-title { font-family: 'Fredoka One', cursive; font-size: 28px; color: var(--red); text-align: center; }
.login-card-sub { font-size: 13px; color: var(--muted); font-weight: 700; text-align: center; margin-bottom: 22px; }
.avatar-row { display: flex; justify-content: center; gap: 12px; margin-bottom: 22px; }
.avatar-opt {
  font-size: 34px; padding: 8px; border-radius: 50%;
  border: 3px solid transparent; cursor: pointer; transition: all 0.22s;
}
.avatar-opt:hover { transform: scale(1.15) rotate(8deg); }
.avatar-opt.sel { border-color: var(--red); background: #FFF0DC; transform: scale(1.2); }
.login-input {
  width: 100%; padding: 14px 18px;
  border-radius: 16px; border: 3px solid var(--border);
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #FFFDF9;
}
.login-input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255,159,67,0.15); }
.login-input::placeholder { color: #FFBB70; }
.login-btn {
  width: 100%; padding: 16px;
  background: linear-gradient(135deg, #FF7A6E, #FFB04E);
  border-radius: 18px; font-family: 'Fredoka One', cursive;
  font-size: 20px; color: #fff;
  box-shadow: 0 12px 28px rgba(255,107,67,0.28);
  transition: transform 0.24s ease, box-shadow 0.24s ease, filter 0.24s ease;
  position: relative; overflow: hidden;
}
.login-btn::after {
  content:''; position:absolute; inset:0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
}
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(255,107,67,0.26); filter: saturate(1.05); }
.login-btn:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════ */
#page-app { flex-direction: column; animation: appFadeIn 0.55s ease forwards; min-height: 0; }
@keyframes appFadeIn { from{opacity:0;transform:translateY(10px) scale(0.985)} to{opacity:1;transform:translateY(0) scale(1)} }

.topbar {
  height: var(--top-h);
  background: var(--surface);
  border-bottom: 1px solid rgba(255,216,160,0.85);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; flex-shrink: 0;
  box-shadow: 0 10px 30px rgba(255,159,67,0.08);
  position: relative; z-index: 20;
  backdrop-filter: blur(18px);
}
.topbar-logo {
  font-family: 'Fredoka One', cursive; font-size: 22px; color: var(--red);
  display: none; flex-shrink: 0;
  animation: logoPop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes logoPop { from{transform:scale(0)} to{transform:scale(1)} }
.search-wrap {
  flex: 1; display: flex; align-items: center;
  background: rgba(255,255,255,0.7);
  border-radius: 28px; padding: 10px 14px; gap: 10px;
  border: 1px solid rgba(255,216,160,0.9);
  transition: border-color 0.24s ease, box-shadow 0.24s ease, transform 0.24s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}
.search-wrap:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px var(--ring), 0 14px 28px rgba(255,159,67,0.10);
  transform: translateY(-1px);
}
.search-wrap input { flex: 1; background: transparent; font-size: 14px; font-weight: 700; color: var(--text); }
.search-wrap input::placeholder { color: #FFAA60; }
.search-clear {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,159,67,0.12); color: #C96B2D;
  font-size: 16px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
}
.search-clear:hover { background: rgba(255,159,67,0.2); transform: scale(1.05); }
.topbar-avatar {
  font-size: 28px; cursor: pointer;
  transition: transform 0.24s ease, filter 0.24s ease; flex-shrink: 0;
}
.topbar-avatar:hover { transform: scale(1.08) rotate(-4deg); filter: drop-shadow(0 8px 18px rgba(255,159,67,0.24)); }

.main-row {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(185deg, #FF6B6B 0%, #FF9F43 55%, #FECA57 100%);
  display: flex; flex-direction: column;
  padding: 18px 10px; flex-shrink: 0;
  box-shadow: 4px 0 24px rgba(255,107,67,0.2);
  overflow-y: auto; position: relative; z-index: 15;
  min-height: 0;
}
.sidebar::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg,transparent,transparent 20px,rgba(255,255,255,0.04) 20px,rgba(255,255,255,0.04) 21px);
  pointer-events: none;
}
.mobile-sidebar-backdrop {
  display: none;
}
.sb-logo {
  font-family: 'Fredoka One', cursive; font-size: 18px; color: #fff;
  text-align: center; padding: 4px 0 16px;
  border-bottom: 2px solid rgba(255,255,255,0.3); margin-bottom: 10px;
  text-shadow: 1px 2px 0 rgba(0,0,0,0.1);
}
.sb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 18px;
  cursor: pointer; color: rgba(255,255,255,0.88);
  font-weight: 900; font-size: 14px; transition: all 0.22s;
  position: relative; z-index: 1; margin-bottom: 4px;
  line-height: 1.15;
}
.sb-item:hover  { background: rgba(255,255,255,0.22); color:#fff; transform: translateX(5px) scale(1.01); }
.sb-item.active { background: rgba(255,255,255,0.30); color:#fff; transform: translateX(5px) scale(1.01); }
.sb-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,244,211,0.92));
  color: #ff7d41;
  box-shadow: 0 10px 18px rgba(0,0,0,0.12);
  transition: transform 0.24s ease, box-shadow 0.24s ease, filter 0.24s ease;
}
.sb-item[data-tab="home"] .sb-icon { background: linear-gradient(135deg, #DFFFED, #FECA57); color: #2f7f42; }
.sb-item[data-tab="learn"] .sb-icon { background: linear-gradient(135deg, #E8ECFF, #C8D4FF); color: #5c64d6; }
.sb-item[data-tab="tasks"] .sb-icon { background: linear-gradient(135deg, #FFF3B8, #FFD166); color: #b26b00; }
.sb-item[data-tab="homework"] .sb-icon { background: linear-gradient(135deg, #FFE1F3, #FFB7E3); color: #cf4f9d; }
.sb-item[data-tab="games"] .sb-icon { background: linear-gradient(135deg, #DFF8FF, #7FDBFF); color: #1474b8; }
.sidebar > .sb-item:last-child .sb-icon { background: linear-gradient(135deg, #FFF2D9, #FFD6A5); color: #c86d3b; }
.sb-item:hover .sb-icon,
.sb-item.active .sb-icon {
  transform: scale(1.08) rotate(-6deg);
  box-shadow: 0 14px 24px rgba(0,0,0,0.16);
  filter: saturate(1.05);
  animation: sidebarIconWiggle 0.42s ease;
}
@keyframes sidebarIconWiggle {
  0%, 100% { transform: scale(1.08) rotate(-6deg); }
  25% { transform: scale(1.12) rotate(6deg); }
  50% { transform: scale(1.08) rotate(-10deg); }
  75% { transform: scale(1.12) rotate(4deg); }
}
.sb-spacer { flex: 1; }
.sb-divider { height: 2px; background: rgba(255,255,255,0.25); border-radius: 2px; margin: 8px 4px; }

.content-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 18px 18px;
  position: relative;
}

.bottom-nav {
  height: var(--bottom-h);
  background: var(--surface-strong);
  border-top: 1px solid rgba(255,216,160,0.9);
  display: flex; justify-content: space-around; align-items: center;
  flex-shrink: 0;
  box-shadow: 0 -12px 30px rgba(255,159,67,0.08);
  position: relative; z-index: 20;
  backdrop-filter: blur(18px);
}
.bn-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; padding: 6px 14px; border-radius: 16px;
  color: #BBB; font-size: 11px; font-weight: 800;
  transition: all 0.22s; background: transparent; flex: 1;
}
.bn-btn:hover { color: var(--orange); }
.bn-btn.active { color: var(--red); background: rgba(255,240,220,0.9); box-shadow: inset 0 1px 0 rgba(255,255,255,0.7); }
.bn-btn .bn-icon { font-size: 22px; transition: transform 0.22s; }
.bn-btn.active .bn-icon { transform: scale(1.2); }
.bn-btn:hover .bn-icon { transform: scale(1.15); }

.compact-bottom-nav {
  justify-content: center;
  gap: 10px;
  padding: 0 12px;
}
.compact-bottom-nav .bn-btn { max-width: 140px; }
.compact-bottom-nav .bn-btn[data-tab="home"] { order: 1; }
.compact-bottom-nav .bn-btn-upload { order: 2; }
.compact-bottom-nav .bn-btn-profile-link { order: 3; }
.compact-bottom-nav .bn-btn:nth-child(n + 4) { display: none; }
.compact-bottom-nav .bn-btn[data-tab="shorts"],
.compact-bottom-nav .bn-btn[data-tab="long"],
.compact-bottom-nav .bn-btn[data-tab="games"],
.compact-bottom-nav .bn-btn[data-tab="profile"] {
  display: none;
}
.bn-btn-upload {
  background: linear-gradient(135deg, #FF7A6E, #FFB04E);
  color: #fff;
  box-shadow: 0 16px 30px rgba(255,107,67,0.24);
  transform: translateY(-10px);
}
.bn-btn-upload .bn-icon { font-size: 24px; }
.bn-btn-upload:hover,
.bn-btn-upload.active {
  color: #fff;
  background: linear-gradient(135deg, #FF6B6B, #FF9F43);
}
.bn-btn-upload.active {
  box-shadow: 0 18px 34px rgba(255,107,67,0.28);
}

.panel { display: none; animation: panelIn 0.42s cubic-bezier(0.22,1,0.36,1) forwards; }
.panel.visible {
  display: block;
  width: min(100%, 1180px);
  margin: 0 auto;
}
@keyframes panelIn {
  from { opacity:0; transform: translateY(12px) scale(0.99); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}

.cat-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 14px; scrollbar-width: none; }
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 18px; border-radius: 22px;
  font-family: 'Fredoka One', cursive; font-size: 15px;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  border: 1px solid rgba(255,216,160,0.9);
  box-shadow: 0 10px 24px rgba(0,0,0,0.05);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, color 0.22s ease;
  background: rgba(255,255,255,0.78); color: #777;
}
.cat-pill:hover { transform: translateY(-2px); box-shadow: 0 14px 26px rgba(0,0,0,0.08); }
.cat-pill.active { border-color: transparent; transform: translateY(-1px); color: #fff; box-shadow: 0 16px 28px rgba(255,107,107,0.20); }

.results-bar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin: 0 0 16px; padding: 14px 16px;
  border-radius: 20px; background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,216,160,0.85);
  box-shadow: 0 14px 28px rgba(0,0,0,0.05);
  font-size: 13px; font-weight: 800; color: #8C6A56; backdrop-filter: blur(16px);
}
.results-bar strong { color: var(--red); font-family: 'Fredoka One', cursive; font-size: 15px; font-weight: 400; }

.magic-pick-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding: 18px 20px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.34), transparent 35%),
    linear-gradient(135deg, #FF7A6E 0%, #FFB04E 46%, #FFE27A 100%);
  box-shadow: 0 24px 40px rgba(255,107,67,0.22);
  position: relative;
  overflow: hidden;
}
.magic-pick-band::after {
  content: '';
  position: absolute;
  inset: auto -22px -36px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
}
.magic-pick-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #fff;
  position: relative;
  z-index: 1;
}
.magic-pick-copy strong {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  letter-spacing: 0.02em;
}
.magic-pick-copy span {
  font-size: 13px;
  font-weight: 800;
  color: rgba(255,255,255,0.92);
}
.magic-pick-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 20px;
  background: rgba(255,255,255,0.92);
  color: var(--red);
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  box-shadow: 0 16px 28px rgba(0,0,0,0.12);
  position: relative;
  z-index: 1;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}
.magic-pick-button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 20px 34px rgba(0,0,0,0.16);
  filter: saturate(1.06);
}
.magic-pick-icon {
  font-size: 24px;
  line-height: 1;
  animation: magicGlow 1.8s ease-in-out infinite;
}
@keyframes magicGlow {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50% { transform: rotate(8deg) scale(1.12); }
}

.sec-title {
  font-family: 'Fredoka One', cursive; font-size: 20px; color: var(--red);
  margin: 10px 0 14px; display: flex; align-items: center; gap: 8px;
}

.reels-shell {
  position: relative;
}
.reels-shell.has-scroll {
  padding-inline: 42px;
}
.reels-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.96);
  color: var(--red);
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.14);
  backdrop-filter: blur(12px);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.reels-shell.has-scroll .reels-nav {
  display: inline-flex;
}
.reels-nav:hover {
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 16px 30px rgba(0,0,0,0.18);
}
.reels-nav.is-active {
  transform: translateY(-50%) scale(1.12);
  box-shadow: 0 0 0 5px rgba(255, 209, 102, 0.4), 0 16px 30px rgba(0,0,0,0.2);
  color: #ff7a18;
}
.reels-nav:disabled {
  opacity: 0.38;
  transform: translateY(-50%);
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}
.reels-nav-prev {
  left: 0;
}
.reels-nav-next {
  right: 0;
}

.reels-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 14px;
  margin-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-x;
  cursor: grab;
  scroll-behavior: smooth;
}
.reels-row:active { cursor: grabbing; }
.reels-row::-webkit-scrollbar {
  display: none;
}
.reel-card {
  flex-shrink: 0; width: 115px; height: 196px;
  border-radius: 22px; overflow: hidden; cursor: pointer;
  position: relative; box-shadow: var(--shadow-card);
  border: 1px solid rgba(255,255,255,0.7);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  transition: transform 0.26s ease, box-shadow 0.26s ease, filter 0.26s ease;
}
.reel-card:hover { transform: translateY(-4px) scale(1.025); box-shadow: 0 18px 34px rgba(0,0,0,0.16); filter: saturate(1.03); }
.reel-thumb { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 50px; position: relative; overflow: hidden; }
.media-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.media-ready .media-fallback {
  opacity: 0;
  transform: scale(1.06);
}
.reel-media { width: 100%; height: 100%; object-fit: cover; display: block; background: #111; pointer-events: none; transition: transform 0.3s ease, filter 0.3s ease; }
.reel-grad {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 55%);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 10px 9px;
}
.reel-title { color: #fff; font-size: 11px; font-weight: 800; line-height: 1.3; }
.reel-dur   { color: rgba(255,255,255,0.78); font-size: 10px; font-weight: 700; margin-top: 2px; }
.reel-play-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.25); backdrop-filter: blur(4px);
  border-radius: 50%; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff;
}

.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 14px; margin-bottom: 24px; }
.vid-card {
  background: var(--card); border-radius: 20px; overflow: hidden; cursor: pointer;
  border: 1px solid rgba(255,216,160,0.9); box-shadow: var(--shadow-card);
  transition: transform 0.26s ease, box-shadow 0.26s ease, border-color 0.26s ease;
  backdrop-filter: blur(10px);
}
.vid-card:hover { transform: translateY(-4px) scale(1.015); box-shadow: 0 18px 34px rgba(0,0,0,0.12); border-color: var(--orange); }
.vid-thumb { height: 105px; display: flex; align-items: center; justify-content: center; font-size: 46px; position: relative; }
.vid-media { width: 100%; height: 100%; object-fit: cover; display: block; background: #111; pointer-events: none; transition: transform 0.3s ease, filter 0.3s ease; }
.vid-dur { position: absolute; bottom: 7px; right: 9px; background: rgba(0,0,0,0.72); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 7px; }
.vid-info { padding: 10px 11px; }
.vid-title { font-weight: 800; font-size: 12px; color: var(--text); line-height: 1.35; margin-bottom: 4px; }
.vid-views { font-size: 11px; color: var(--muted); font-weight: 700; }
.reel-card.is-previewing .reel-media,
.vid-card.is-previewing .vid-media,
.rel-item.is-previewing .rel-media {
  transform: scale(1.06);
  filter: saturate(1.06);
}

/* ═══════════════════════════════════════════════════════
   VIDEO DETAIL PAGE
═══════════════════════════════════════════════════════ */
#page-viddetail { flex-direction: column; animation: appFadeIn 0.4s ease; background: #111; }
.vd-back { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--red); font-weight: 800; font-size: 15px; padding: 10px 16px 6px; transition: gap 0.2s; }
.vd-back:hover { gap: 12px; }
.vd-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 16px 28px;
  background: #111;
}
.vd-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
}
.vd-main {
  min-width: 0;
  flex: 1 1 auto;
}
.vd-sidebar {
  width: min(390px, 34vw);
  flex: 0 0 min(390px, 34vw);
  position: sticky;
  top: 14px;
}
.vd-player-shell {
  width: 100%;
  margin-top: 16px;
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  background: #000;
  box-shadow: 0 24px 46px rgba(0,0,0,0.16);
  isolation: isolate;
}
.vd-player-shell.is-fallback-fullscreen,
.vd-player-shell:fullscreen,
.vd-player-shell:-webkit-full-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  padding: 0;
  background: #000;
  overflow: hidden;
  border-radius: 0;
}
.vd-player-shell.is-fallback-fullscreen .vd-player,
.vd-player-shell:fullscreen .vd-player,
.vd-player-shell:-webkit-full-screen .vd-player {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  max-height: none;
  border-radius: 0;
}
.vd-player-shell.is-fallback-fullscreen .vd-controls,
.vd-player-shell:fullscreen .vd-controls,
.vd-player-shell:-webkit-full-screen .vd-controls {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 22px;
  z-index: 5;
  margin-top: 0;
}
.vd-player-shell.is-fallback-fullscreen .vd-progress-row,
.vd-player-shell:fullscreen .vd-progress-row,
.vd-player-shell:-webkit-full-screen .vd-progress-row {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 84px;
  z-index: 5;
  margin-top: 0;
}
.vd-player-shell.is-fallback-fullscreen .vd-player-copy,
.vd-player-shell:fullscreen .vd-player-copy,
.vd-player-shell:-webkit-full-screen .vd-player-copy {
  bottom: 132px;
}
.vd-player-shell.is-fallback-fullscreen .media-badge,
.vd-player-shell:fullscreen .media-badge,
.vd-player-shell:-webkit-full-screen .media-badge {
  top: 24px;
  left: 24px;
}
body.video-mobile-theater-open {
  overflow: hidden;
}
.vd-player-shell.is-rotated-mobile-fullscreen,
.vd-player-shell.is-fallback-fullscreen.is-rotated-mobile-fullscreen,
.vd-player-shell:fullscreen.is-rotated-mobile-fullscreen,
.vd-player-shell:-webkit-full-screen.is-rotated-mobile-fullscreen {
  inset: auto;
  top: 50%;
  left: 50%;
  width: 100vh;
  max-width: none;
  height: 100vw;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center center;
}
.vd-player-shell.is-rotated-mobile-fullscreen .vd-player {
  min-height: 100%;
  height: 100%;
  max-height: none;
}
.vd-player-shell.is-rotated-mobile-fullscreen .vd-player-copy {
  display: none;
}
.vd-player {
  width: 100%;
  min-height: clamp(260px, 48vh, 460px);
  max-height: 52vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: inherit;
}
.vd-player::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.12), transparent 34%, rgba(0,0,0,0.48));
}
.vd-player-media {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.vd-player.playing .vd-emoji {
  animation: vdPulse 1.6s ease-in-out infinite;
}
@keyframes vdPulse {
  0%,100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.06); }
}
.play-circle {
  position: absolute;
  width: 78px;
  height: 78px;
  background: rgba(255,255,255,0.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 12px 26px rgba(0,0,0,0.22);
  transition: transform 0.2s, opacity 0.2s;
  cursor: pointer;
  z-index: 2;
}
.vd-player:hover .play-circle { transform: scale(1.08); }
.vd-player.playing .play-circle {
  opacity: 0;
  transform: scale(0.88);
  pointer-events: none;
}
.vd-emoji {
  position: relative;
  z-index: 1;
  font-size: clamp(88px, 16vw, 148px);
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.20));
}
.vd-player-copy {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 126px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  color: #fff;
}
.vd-player-copy strong {
  display: block;
  font-family: 'Fredoka One', cursive;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.15;
}
.vd-player-copy span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 800;
  opacity: 0.88;
}
.media-badge {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  backdrop-filter: blur(10px);
}
.vd-controls {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 0;
}
.vd-controls-left,
.vd-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.vd-controls-right {
  justify-content: flex-end;
}
.vd-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(10,10,14,0.82);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(0,0,0,0.22);
  backdrop-filter: blur(16px);
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
.vd-control:hover {
  transform: translateY(-2px);
  background: rgba(34,34,38,0.9);
  box-shadow: 0 14px 26px rgba(0,0,0,0.2);
}
.vd-control:disabled {
  opacity: 0.45;
  transform: none;
  box-shadow: none;
  cursor: default;
}
.vd-control.primary {
  background: rgba(255,255,255,0.16);
  color: #fff;
}
.vd-control-ghost {
  width: auto;
  min-width: 46px;
  padding: 0 12px;
  border-radius: 14px;
  font-size: 14px;
}
.vd-control-icon {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.vd-control-skip {
  position: relative;
  width: 24px;
  height: 24px;
  display: block;
}
.vd-control-skip-arrow {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  opacity: 0.95;
}
.vd-control-skip-seconds {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  font-size: 8px;
  font-weight: 1000;
  letter-spacing: 0.03em;
}
.vd-settings-wrap {
  position: relative;
}
.vd-settings-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  z-index: 6;
}
.vd-settings-menu[hidden] {
  display: none !important;
}
.vd-settings-panel {
  width: min(300px, calc(100vw - 36px));
  padding: 14px;
  border-radius: 20px;
  background: rgba(10, 10, 16, 0.95);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 36px rgba(0,0,0,0.34);
  backdrop-filter: blur(18px);
}
.vd-settings-group + .vd-settings-group {
  margin-top: 12px;
}
.vd-settings-label {
  color: rgba(255,255,255,0.72);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.vd-settings-toggle {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.08);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 800;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.vd-settings-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.14);
}
.vd-settings-toggle strong {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.vd-settings-toggle.active {
  background: rgba(255, 166, 82, 0.22);
  border-color: rgba(255, 184, 122, 0.5);
  color: #ffe6b8;
}
.vd-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.vd-settings-option {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.vd-settings-option:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.14);
}
.vd-settings-option.active,
.vd-control.is-active {
  background: rgba(255, 166, 82, 0.22);
  border-color: rgba(255, 184, 122, 0.5);
  color: #ffe6b8;
}
#vd-pip-control {
  width: 48px;
  min-width: 48px;
  padding: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vd-control-hidden {
  display: none !important;
}
#vd-pause-control {
  display: none !important;
}
.vd-progress-row {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 76px;
  z-index: 3;
  display: block;
  margin-top: 0;
  padding: 0;
  background: transparent;
}
.vd-time {
  color: rgba(255,255,255,0.92);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.vd-time-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
}
.vd-time-sep {
  color: rgba(255,255,255,0.72);
  font-weight: 800;
}
.vd-context-pill {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(10,10,14,0.82);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(0,0,0,0.2);
  backdrop-filter: blur(16px);
  transition: transform 0.2s, background 0.2s;
}
.vd-context-pill:hover {
  transform: translateY(-2px);
  background: rgba(34,34,38,0.9);
}
.vd-progress-track {
  position: relative;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.3);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.vd-progress-track.is-dragging {
  cursor: grabbing;
}
.vd-progress-fill {
  position: relative;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg,#ff215a,#ff4c4c);
  transition: width 0.2s linear;
}
.vd-progress-fill::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff2f5f;
  transform: translateY(-50%);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
}
.vd-player-shell[data-quality="auto"] .vd-player-media,
.vd-player-shell[data-quality="1080p"] .vd-player-media {
  filter: none;
}
.vd-player-shell[data-quality="720p"] .vd-player-media {
  filter: contrast(1.02) saturate(1.04);
}
.vd-player-shell[data-quality="480p"] .vd-player-media {
  filter: saturate(0.96) contrast(0.98) blur(0.35px);
}
.vd-player-shell[data-quality="360p"] .vd-player-media {
  filter: saturate(0.9) contrast(0.94) blur(0.7px);
}
.vd-meta {
  padding: 6px 4px 2px;
}
.vd-title {
  font-family: 'Fredoka One', cursive;
  font-size: 21px;
  color: #f7f3ea;
  margin-bottom: 6px;
}
.vd-info {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  font-weight: 700;
}
.vd-channel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 14px 4px 4px;
}
.vd-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
}
.vd-channel-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg,#ffd778,#ff8f6d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 10px 24px rgba(255,159,67,0.18);
}
.vd-channel-copy strong {
  display: block;
  color: #fff;
  font-family: 'Fredoka One', cursive;
  font-size: 15px;
  line-height: 1.2;
}
.vd-channel-copy span {
  display: block;
  margin-top: 4px;
  color: rgba(255,255,255,0.68);
  font-size: 12px;
  font-weight: 700;
}
.vd-subscribe {
  padding: 12px 18px;
  border-radius: 999px;
  background: #f4f4f4;
  color: #111;
  font-family: 'Fredoka One', cursive;
  font-size: 13px;
}
.vd-subscribe.is-active {
  background: linear-gradient(135deg, #ff8c5a, #ff5f6d);
  color: #fff;
  box-shadow: 0 12px 24px rgba(255, 95, 109, 0.24);
}
.vd-action-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.vd-action-pill {
  padding: 11px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.08);
  font-weight: 800;
  color: #f7f3ea;
  box-shadow: 0 10px 22px rgba(0,0,0,0.12);
}
.vd-action-pill.is-active {
  background: rgba(255, 174, 86, 0.18);
  border-color: rgba(255, 195, 135, 0.42);
  color: #ffe5bf;
}
.vd-comments-section {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 14px 30px rgba(0,0,0,0.12);
}
.vd-comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.vd-comments-head strong {
  color: #fff;
  font-family: 'Fredoka One', cursive;
  font-size: 15px;
}
.vd-comments-head span {
  color: rgba(255,255,255,0.68);
  font-size: 12px;
  font-weight: 800;
}
.vd-comment-compose {
  display: flex;
  gap: 10px;
  align-items: center;
}
.vd-comment-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.vd-comment-input::placeholder {
  color: rgba(255,255,255,0.48);
}
.vd-comment-input:focus {
  outline: none;
  border-color: rgba(255, 184, 122, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 176, 67, 0.12);
}
.vd-comment-submit {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff9f43, #ff6b6b);
  color: #fff;
  font-family: 'Fredoka One', cursive;
  font-size: 13px;
  box-shadow: 0 12px 24px rgba(255, 107, 107, 0.2);
}
.vd-comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}
.vd-comment-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.vd-comment-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: 0 0 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffd778, #ff8f6d);
  color: #38200e;
  font-family: 'Fredoka One', cursive;
  font-size: 15px;
}
.vd-comment-body {
  min-width: 0;
  flex: 1 1 auto;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
}
.vd-comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.vd-comment-meta strong {
  color: #fff;
  font-size: 13px;
}
.vd-comment-meta span {
  color: rgba(255,255,255,0.56);
  font-size: 11px;
  font-weight: 800;
}
.vd-comment-body p {
  margin-top: 6px;
  color: rgba(255,255,255,0.86);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}
.vd-comment-empty {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.64);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}
.vd-sidebar-next {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  margin-bottom: 14px;
}
.vd-sidebar-next strong {
  display: block;
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  line-height: 1.35;
}
.vd-sidebar-next span {
  display: block;
  margin-top: 8px;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-weight: 700;
}
.vd-mobile-next {
  display: none;
}
.vd-chip-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.vd-chip {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.1);
  color: #f7f3ea;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,0.08);
}
.vd-chip.active {
  background: #f1f1f1;
  color: #111;
}
.vd-related-wrap .sec-title {
  color: #f7f3ea;
}
.vd-related-wrap {
  padding-top: 16px;
}
.vd-related {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rel-item {
  display: flex;
  gap: 14px;
  padding: 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
}
.rel-item:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.06);
}
.rel-thumb {
  width: 168px;
  height: 94px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.rel-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #111;
  pointer-events: none;
  transition: transform 0.3s ease, filter 0.3s ease;
}
.rel-thumb::after {
  content: '▶';
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text);
}
.rel-info {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
}
.rel-title {
  font-family: 'Fredoka One', cursive;
  font-size: 15px;
  color: #fff;
  line-height: 1.28;
}
.rel-views {
  font-size: 12px;
  color: rgba(255,255,255,0.68);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════
   SHORT VIDEO FULLSCREEN
═══════════════════════════════════════════════════════ */
#page-short {
  flex-direction: column;
  background: radial-gradient(circle at top, #2b2246 0%, #120f20 55%, #090814 100%);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
.short-stage {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 18px 16px 24px;
}
.short-phone {
  width: min(100%, 360px);
  height: min(80vh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: 38px;
  overflow: hidden;
  border: 8px solid rgba(255,255,255,0.28);
  box-shadow: 0 24px 46px rgba(0,0,0,0.32);
  background: rgba(8,8,20,0.88);
}
.short-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 110px;
  position: relative;
  overflow: hidden;
}
.short-screen.short-transition-next {
  animation: shortSlideNext 0.32s ease;
}
.short-screen.short-transition-prev {
  animation: shortSlidePrev 0.32s ease;
}
.short-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent 24%, transparent 76%, rgba(0,0,0,0.18));
  opacity: 0;
  z-index: 2;
  pointer-events: none;
}
.short-screen.short-transition-next::before,
.short-screen.short-transition-prev::before {
  animation: shortFlash 0.32s ease;
}
@keyframes shortSlideNext {
  from { transform: translateY(34px) scale(0.98); opacity: 0.74; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes shortSlidePrev {
  from { transform: translateY(-34px) scale(0.98); opacity: 0.74; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes shortFlash {
  from { opacity: 0.55; }
  to { opacity: 0; }
}
.short-screen.has-media {
  background: #050505 !important;
}
.short-media {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.short-screen.has-media #short-emoji {
  display: none;
}
.short-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.24) 0%, transparent 32%, transparent 68%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}
.short-chip {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 10;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(8px);
}
.short-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 10;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(6px);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.short-close:hover { background: rgba(255,255,255,0.35); transform: scale(1.1) rotate(90deg); }
.short-title-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 20px 18px 18px;
  color: #fff;
}
.short-title-overlay h3 {
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  margin-bottom: 6px;
}
.short-title-overlay p {
  font-size: 13px;
  opacity: 0.82;
  font-weight: 700;
}
.short-progress-track {
  margin-top: 12px;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.24);
}
.short-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg,#ff7a6e,#ffcf6e);
  transition: width 0.24s ease;
}
.short-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
}
.short-counter-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.short-counter {
  text-align: center;
  color: rgba(255,255,255,0.78);
  font-size: 13px;
  font-weight: 800;
}
.short-swipe-hint {
  color: rgba(255,255,255,0.68);
  font-size: 12px;
  font-weight: 700;
}
.short-nav-btn,
.short-side-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  font-family: 'Nunito', sans-serif;
  transition: background 0.2s, transform 0.2s;
}
.short-nav-btn {
  background: rgba(255,255,255,0.15);
  padding: 10px 20px;
}
.short-nav-btn:hover,
.short-side-btn:hover { background: rgba(255,255,255,0.28); transform: scale(1.05); }
.short-nav-btn:disabled,
.short-side-btn:disabled { opacity: 0.4; transform: none; background: rgba(255,255,255,0.10); }
.short-side-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  align-self: center;
}
.short-side-btn {
  min-width: 88px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.16);
  box-shadow: 0 16px 30px rgba(0,0,0,0.22);
}
.short-mobile-nav {
  display: none;
}

/* ═══════════════════════════════════════════════════════
   PROFILE PAGE
═══════════════════════════════════════════════════════ */
.profile-hero {
  background: linear-gradient(135deg, #FF7A6E 0%, #FFB450 58%, #FFD772 100%);
  border-radius: 24px; padding: 28px; text-align: center;
  color: #fff; margin-bottom: 18px;
  box-shadow: 0 20px 38px rgba(255,107,67,0.24); position: relative; overflow: hidden;
}
.profile-hero::before { content: ''; position: absolute; top: -40px; right: -40px; width: 140px; height: 140px; background: rgba(255,255,255,0.12); border-radius: 50%; }
.profile-hero::after  { content: ''; position: absolute; bottom: -30px; left: -30px; width: 100px; height: 100px; background: rgba(255,255,255,0.08); border-radius: 50%; }
.profile-emoji { font-size: 70px; margin-bottom: 8px; display: block; }
.profile-name  { font-family: 'Fredoka One', cursive; font-size: 26px; }
.profile-email { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.profile-sticker-shelf {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.profile-sticker-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.92);
}
.profile-sticker-chip {
  min-width: 46px;
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  color: var(--red);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 12px 20px rgba(0,0,0,0.10);
}
#topbar-avatar,
#sb-user-icon,
#p-emoji {
  position: relative;
}
#sb-user-icon,
#p-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#topbar-avatar.has-sticker::after,
#sb-user-icon.has-sticker::after,
#p-emoji.has-sticker::after {
  content: attr(data-sticker);
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  box-shadow: 0 8px 16px rgba(0,0,0,0.14);
  font-size: 14px;
}
#p-emoji.has-sticker::after {
  top: 4px;
  right: calc(50% - 44px);
}
.stats-row { display: flex; gap: 12px; margin-bottom: 18px; }
.stat-box { flex: 1; min-width: 0; background: #fff; border-radius: 18px; padding: 16px 10px; text-align: center; border: 1px solid rgba(255,216,160,0.9); box-shadow: var(--shadow-card); transition: transform 0.22s ease, box-shadow 0.22s ease; }
.stat-box:hover { transform: translateY(-3px); box-shadow: 0 16px 28px rgba(0,0,0,0.10); }
.stat-num { font-family: 'Fredoka One', cursive; font-size: 26px; color: var(--red); }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 700; }
.logout-btn { width: 100%; padding: 15px; background: rgba(255,255,255,0.82); border: 1px solid rgba(255,216,160,0.9); border-radius: 18px; font-family: 'Fredoka One', cursive; font-size: 18px; color: var(--red); transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease; }
.logout-btn:hover { background: rgba(255,240,220,0.92); transform: translateY(-2px); box-shadow: 0 14px 26px rgba(255,159,67,0.16); }

/* â”€â”€ UPLOAD PANEL â”€â”€ */
.upload-shell { display: flex; justify-content: center; padding-bottom: 18px; }
.upload-card {
  width: min(100%, 760px);
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,216,160,0.9);
  border-radius: 28px;
  padding: 26px;
  box-shadow: 0 22px 40px rgba(255,159,67,0.12);
}
.upload-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,159,67,0.12);
  color: var(--red);
  font-family: 'Fredoka One', cursive;
  font-size: 0;
  margin-bottom: 14px;
}
.upload-badge::before {
  content: "\1F4E4";
  font-size: 14px;
  margin-right: 8px;
}
.upload-badge::after {
  content: "Upload Corner";
  font-size: 14px;
}
.upload-card h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  color: var(--text);
  line-height: 1.2;
}
.upload-copy {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #876957;
  line-height: 1.7;
}
.upload-input { display: none; }
.upload-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.upload-primary,
.upload-secondary {
  padding: 14px 22px;
  border-radius: 18px;
  font-family: 'Fredoka One', cursive;
  font-size: 15px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}
.upload-primary {
  background: linear-gradient(135deg, #FF7A6E, #FFB04E);
  color: #fff;
  box-shadow: 0 14px 28px rgba(255,107,67,0.22);
}
.upload-secondary {
  background: rgba(255,248,241,0.95);
  color: var(--text);
  border: 1px solid rgba(255,216,160,0.95);
}
.upload-primary:hover,
.upload-secondary:hover {
  transform: translateY(-2px);
}
.upload-status {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,248,241,0.9);
  border: 1px solid rgba(255,216,160,0.75);
  color: #876957;
  font-size: 13px;
  font-weight: 800;
}
.upload-preview {
  margin-top: 16px;
  min-height: 240px;
  border-radius: 24px;
  border: 1px dashed rgba(255,159,67,0.35);
  background:
    radial-gradient(circle at top right, rgba(72,219,251,0.14), transparent 32%),
    rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.upload-preview-empty {
  text-align: center;
  color: #876957;
  max-width: 320px;
}
.upload-preview-icon {
  display: block;
  font-size: 44px;
  margin-bottom: 10px;
}
.upload-preview-empty h3 {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: var(--red);
}
.upload-preview-empty p {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.7;
}
.upload-preview-card {
  width: 100%;
  display: grid;
  gap: 16px;
}
.upload-preview-media {
  width: 100%;
  max-height: 360px;
  border-radius: 22px;
  object-fit: cover;
  background: #fff5ec;
  border: 1px solid rgba(255,216,160,0.75);
  box-shadow: 0 16px 30px rgba(0,0,0,0.08);
}
.upload-preview-copy strong {
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  color: var(--text);
}
.upload-preview-copy p {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #876957;
}

/* ═══════════════════════════════════════════════════════
   TASKS / HOMEWORK
═══════════════════════════════════════════════════════ */
.task-list { display: flex; flex-direction: column; gap: 12px; }
.task-item { display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,0.84); border-radius: 20px; padding: 16px 18px; border: 1px solid rgba(255,216,160,0.9); cursor: pointer; transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease; box-shadow: var(--shadow-card); backdrop-filter: blur(12px); }
.task-item:hover { border-color: var(--orange); transform: translateX(4px); box-shadow: 0 16px 28px rgba(0,0,0,0.10); }
.task-item.done { opacity: 0.5; }
.task-check { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--orange); display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; transition: all 0.25s; color: transparent; }
.task-item.done .task-check { background: var(--orange); border-color: var(--orange); color: #fff; }
.task-emoji { font-size: 28px; flex-shrink: 0; }
.task-text .task-t { font-weight: 800; font-size: 14px; color: var(--text); }
.task-text .task-s { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.task-reward-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(35,22,19,0.34);
  backdrop-filter: blur(8px);
}
.task-reward-card {
  width: min(420px, 100%);
  padding: 28px 26px 24px;
  border-radius: 32px;
  text-align: center;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.35), transparent 34%),
    linear-gradient(135deg, #FFF8E7 0%, #FFE7B8 45%, #FFD27D 100%);
  box-shadow: 0 30px 60px rgba(0,0,0,0.22);
  position: relative;
  overflow: hidden;
  animation: rewardPopupIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
.task-reward-card::before,
.task-reward-card::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}
.task-reward-card::before {
  width: 120px;
  height: 120px;
  top: -46px;
  right: -30px;
}
.task-reward-card::after {
  width: 90px;
  height: 90px;
  bottom: -28px;
  left: -20px;
}
.task-reward-mascot {
  font-size: 60px;
  position: relative;
  z-index: 1;
}
.task-reward-title {
  margin-top: 8px;
  font-family: 'Fredoka One', cursive;
  font-size: 30px;
  color: var(--red);
  position: relative;
  z-index: 1;
}
.task-reward-copy {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.6;
  color: #875f44;
  position: relative;
  z-index: 1;
}
.task-reward-sticker {
  width: 92px;
  height: 92px;
  margin: 18px auto 0;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 18px 28px rgba(255,159,67,0.20);
  position: relative;
  z-index: 1;
}
.task-reward-button {
  margin-top: 18px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #FF7A6E, #FFB04E);
  color: #fff;
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  box-shadow: 0 16px 28px rgba(255,107,67,0.24);
  position: relative;
  z-index: 1;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.task-reward-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 34px rgba(255,107,67,0.28);
}
@keyframes rewardPopupIn {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════════════════════
   GAMES PAGE
═══════════════════════════════════════════════════════ */
.games-hero {
  background: linear-gradient(135deg, #A29BFE 0%, #74b9ff 50%, #48DBFB 100%);
  border-radius: 24px; padding: 22px 24px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 18px;
  box-shadow: 0 20px 38px rgba(114,106,248,0.22); position: relative; overflow: hidden;
}
.games-hero::before { content: ''; position: absolute; top: -30px; right: -30px; width: 120px; height: 120px; background: rgba(255,255,255,0.14); border-radius: 50%; }
.games-hero-emoji { font-size: 56px; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.18)); }
.games-hero-text { flex: 1; min-width: 0; }
.games-hero-text h2 { font-family: 'Fredoka One', cursive; font-size: 24px; color: #fff; text-shadow: 1px 2px 0 rgba(0,0,0,0.1); }
.games-hero-text p  { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.88); margin-top: 4px; }

.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.game-card {
  background: var(--card); border-radius: 22px; overflow: hidden;
  cursor: pointer; border: 1px solid rgba(255,216,160,0.9);
  box-shadow: var(--shadow-card); transition: transform 0.26s ease, box-shadow 0.26s ease;
  display: flex; flex-direction: column; align-items: center;
  padding: 22px 14px 18px; gap: 10px; text-align: center;
  position: relative;
}
.game-card:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 20px 38px rgba(0,0,0,0.13); }
.game-card-emoji { font-size: 46px; }
.game-card-title { font-family: 'Fredoka One', cursive; font-size: 14px; color: var(--text); line-height: 1.3; }
.game-card-badge { font-size: 10px; font-weight: 800; padding: 3px 10px; border-radius: 999px; color: #fff; }
.game-card-badge.easy   { background: var(--green); }
.game-card-badge.medium { background: var(--orange); }
.game-card-badge.hard   { background: var(--red); }

/* ── GAME PLAY OVERLAY ── */
#page-game {
  flex-direction: column; z-index: 400;
  background: radial-gradient(ellipse at 30% 20%, #fff8e7, #ffe0c8 60%, #ffd5a0);
}
.game-topbar {
  height: var(--top-h);
  background: var(--surface); border-bottom: 1px solid rgba(255,216,160,0.85);
  display: flex; align-items: center; gap: 12px; padding: 0 16px; flex-shrink: 0;
  box-shadow: 0 10px 30px rgba(255,159,67,0.08); backdrop-filter: blur(18px);
}
.game-back { display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--red); font-weight: 800; font-size: 15px; transition: gap 0.2s; }
.game-back:hover { gap: 10px; }
.game-title-bar { font-family: 'Fredoka One', cursive; font-size: 18px; color: var(--red); flex: 1; text-align: center; }
.game-score-bar { font-family: 'Fredoka One', cursive; font-size: 16px; color: var(--orange); }
.game-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px; gap: 20px; }

/* Quiz game */
.quiz-question { font-family: 'Fredoka One', cursive; font-size: 22px; color: var(--text); text-align: center; max-width: 340px; line-height: 1.4; }
.quiz-emoji    { font-size: 80px; animation: quizEmojiBounce 1.4s ease-in-out infinite; }
@keyframes quizEmojiBounce {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-8px) scale(1.05); }
}
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 360px; }
.quiz-opt {
  background: rgba(255,255,255,0.88); border-radius: 18px; padding: 16px 12px;
  font-family: 'Fredoka One', cursive; font-size: 16px; color: var(--text);
  border: 2px solid rgba(255,216,160,0.9);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
  cursor: pointer; text-align: center;
}
.quiz-opt:hover   { transform: translateY(-3px); border-color: var(--orange); box-shadow: 0 14px 26px rgba(0,0,0,0.10); }
.quiz-opt.correct { background: #DFFFED; border-color: var(--green); color: var(--green); }
.quiz-opt.wrong   { background: #FFE8E8; border-color: var(--red);   color: var(--red); }
.quiz-feedback    { font-family: 'Fredoka One', cursive; font-size: 20px; min-height: 28px; text-align: center; }
.quiz-next {
  padding: 14px 36px; background: linear-gradient(135deg, #FF7A6E, #FFB04E);
  border-radius: 18px; color: #fff; font-family: 'Fredoka One', cursive; font-size: 18px;
  box-shadow: 0 12px 28px rgba(255,107,67,0.28); transition: transform 0.22s, box-shadow 0.22s;
}
.quiz-next:hover  { transform: translateY(-2px); box-shadow: 0 18px 34px rgba(255,107,67,0.26); }

/* Memory match game */
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; max-width: 360px; }
.mem-card {
  aspect-ratio: 1; border-radius: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; background: linear-gradient(145deg, #FF9F43, #FECA57);
  border: 2px solid rgba(255,255,255,0.6);
  box-shadow: 0 8px 18px rgba(0,0,0,0.10);
  transition: transform 0.3s, box-shadow 0.2s;
  user-select: none;
}
.mem-card:hover:not(.flipped):not(.matched) { transform: scale(1.06); }
.mem-card.flipped  { background: #fff; border-color: var(--orange); }
.mem-card.matched  { background: #DFFFED; border-color: var(--green); opacity: 0.8; pointer-events: none; }
.mem-card .card-back { font-size: 28px; }
.mem-card .card-front { display: none; font-size: 28px; }
.mem-card.flipped .card-front,
.mem-card.matched .card-front { display: flex; }
.mem-card.flipped .card-back,
.mem-card.matched .card-back  { display: none; }
.mem-info { font-family: 'Fredoka One', cursive; font-size: 16px; color: #876957; }

/* Drawing game */
#draw-canvas { border-radius: 20px; box-shadow: 0 14px 32px rgba(0,0,0,0.12); cursor: crosshair; touch-action: none; background: #fff; }
.draw-controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.draw-color {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid transparent; cursor: pointer; transition: transform 0.2s, border-color 0.2s;
}
.draw-color:hover  { transform: scale(1.2); }
.draw-color.sel    { border-color: var(--text); transform: scale(1.2); }
.draw-btn {
  padding: 9px 18px; border-radius: 14px;
  font-family: 'Fredoka One', cursive; font-size: 14px;
  background: rgba(255,255,255,0.82); border: 1px solid rgba(255,216,160,0.9);
  color: var(--text); transition: background 0.2s, transform 0.2s;
}
.draw-btn:hover { background: #FFF0DC; transform: translateY(-2px); }

/* ═══════════════════════════════════════════════════════
   CONFETTI
═══════════════════════════════════════════════════════ */
.confetti-piece {
  position: fixed; width: 10px; height: 10px;
  border-radius: 2px; pointer-events: none; z-index: 9999;
  animation: confettiFall var(--dur) ease-out forwards;
}
@keyframes confettiFall {
  0%   { transform: translate(0,0) rotate(0deg) scale(1); opacity:1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.3); opacity:0; }
}

/* ═══════════════════════════════════════════════════════
   MISC
═══════════════════════════════════════════════════════ */
.mt16 { margin-top: 16px; }
.hidden { display: none !important; }
.empty-state {
  width: 100%; flex: 1 0 100%; min-height: 158px; padding: 24px 18px; border-radius: 24px;
  border: 1px dashed rgba(255,159,67,0.45); background: rgba(255,255,255,0.74);
  box-shadow: 0 14px 30px rgba(0,0,0,0.05); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 8px;
  grid-column: 1 / -1; backdrop-filter: blur(12px);
}
.empty-state h3 { font-family: 'Fredoka One', cursive; font-size: 18px; color: var(--red); }
.empty-state p  { max-width: 280px; font-size: 13px; font-weight: 700; color: #876957; }
.empty-reset {
  margin-top: 4px; padding: 10px 16px; border-radius: 999px;
  background: linear-gradient(135deg, #FF7A6E, #FFB04E); color: #fff;
  font-weight: 800; box-shadow: 0 12px 24px rgba(255,107,67,0.18);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (min-width: 640px) { .topbar-logo { display: block !important; } }
@media (max-width: 639px) {
  .topbar-logo { display: block; }
  .sidebar {
    position: fixed;
    top: var(--shared-navbar-h);
    left: 0;
    bottom: 0;
    width: min(280px, 82vw);
    display: flex !important;
    z-index: 170;
    transform: translateX(-108%);
    transition: transform 0.28s ease;
    box-shadow: 18px 0 34px rgba(0,0,0,0.16);
  }
  .content-area {
    width: 100%;
  }
  .mobile-sidebar-backdrop {
    position: fixed;
    inset: var(--shared-navbar-h) 0 0;
    width: 100%;
    border: 0;
    background: rgba(22,18,34,0.28);
    backdrop-filter: blur(3px);
    z-index: 160;
    padding: 0;
  }
  body.mobile-sidebar-open .mobile-sidebar-backdrop {
    display: block;
  }
  body.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }
}
@media (max-width: 480px) {
  .video-grid { grid-template-columns: repeat(2, 1fr); }
  .games-grid { grid-template-columns: repeat(2, 1fr); }
  .compact-bottom-nav { gap: 8px; padding: 0 8px; }
  .compact-bottom-nav .bn-btn { padding-inline: 8px; }
  .upload-card { padding: 22px 18px; }
  .upload-card h2 { font-size: 24px; }
  .task-reward-card {
    padding: 24px 20px 20px;
    border-radius: 28px;
  }
  .task-reward-title {
    font-size: 26px;
  }
  .upload-actions { flex-direction: column; }
  .vd-scroll { padding-inline: 12px; }
  .vd-controls {
    left: 12px;
    right: 12px;
    bottom: 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .vd-controls-left,
  .vd-controls-right {
    flex-wrap: wrap;
    justify-content: center;
  }
  .vd-control {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }
  .vd-control-ghost {
    min-width: 42px;
    height: 42px;
    padding: 0 10px;
  }
  .vd-context-pill {
    display: none;
  }
  .vd-progress-row {
    left: 12px;
    right: 12px;
    bottom: 66px;
  }
  .vd-player-copy {
    left: 16px;
    right: 16px;
    bottom: 118px;
  }
  .rel-item { padding: 10px; gap: 10px; }
  .rel-thumb { width: 110px; height: 72px; font-size: 30px; }
}
@media (max-width: 760px) {
  #page-short { padding: 0; }
  .short-stage {
    padding: 0;
    gap: 0;
  }
  .short-phone {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .short-side-controls {
    display: none;
  }
  .short-mobile-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .short-swipe-hint {
    font-size: 11px;
    padding-inline: 12px;
  }
}
@media (max-width: 900px) {
  .vd-layout {
    flex-direction: column;
  }
  .vd-sidebar {
    width: 100%;
    flex: 1 1 auto;
    position: static;
  }
  .vd-player {
    min-height: clamp(240px, 40vh, 340px);
  }
  .vd-player-copy {
    flex-direction: column;
    align-items: flex-start;
  }
  .vd-channel-row {
    align-items: flex-start;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ── Topbar back-to-home button ── */
.topbar-home-btn {
  font-size: 22px; text-decoration: none; flex-shrink: 0;
  transition: transform 0.22s; line-height: 1;
}
.topbar-home-btn:hover { transform: scale(1.15) rotate(-5deg); }

/* ── Games hub link inside games panel ── */
.games-hub-link {
  margin-left: auto; flex-shrink: 0;
  padding: 8px 16px; border-radius: 14px;
  background: linear-gradient(135deg,#A29BFE,#74b9ff);
  color: #fff; font-family: 'Fredoka One', cursive; font-size: 13px;
  text-decoration: none; white-space: nowrap;
  box-shadow: 0 8px 18px rgba(114,106,248,0.22);
  transition: transform 0.2s, box-shadow 0.2s;
}
.games-hub-link:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(114,106,248,0.28); }

@media (max-width: 560px) {
  .content-area {
    padding: 12px 12px 96px;
  }

  .panel.visible {
    width: 100%;
  }

  .magic-pick-band {
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .magic-pick-copy strong {
    font-size: 20px;
  }

  .magic-pick-button {
    width: 100%;
  }

  .cat-scroll {
    gap: 8px;
    padding-bottom: 10px;
  }

  .results-bar {
    padding: 10px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .results-bar strong {
    font-size: 14px;
  }

  .sec-title {
    font-size: 18px;
  }

  .reels-row {
    gap: 10px;
    padding-bottom: 10px;
  }

  .reels-shell.has-scroll {
    padding-inline: 0;
  }

  .reels-nav {
    display: none !important;
  }

  .video-grid,
  .games-grid {
    gap: 10px;
  }

  .quiz-options {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .memory-grid {
    max-width: 100%;
    gap: 8px;
  }

  .games-hub-link {
    width: 100%;
    margin: 6px 0 0;
    text-align: center;
  }

  .games-hero {
    padding: 18px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .games-hero-emoji {
    font-size: 44px;
  }

  .stats-row {
    flex-direction: column;
  }

  .profile-sticker-shelf {
    gap: 8px;
  }

  .profile-sticker-chip {
    min-width: 42px;
    padding: 7px 10px;
    font-size: 20px;
  }

  .upload-primary,
  .upload-secondary {
    width: 100%;
  }

  .vd-title {
    font-size: 20px;
  }

  .vd-player {
    min-height: 220px;
  }

  .vd-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .vd-controls-left,
  .vd-controls-right {
    flex-wrap: wrap;
    justify-content: center;
  }

  .vd-control {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }

  .vd-control-ghost {
    min-width: 42px;
    height: 42px;
    padding: 0 10px;
  }

  .vd-context-pill {
    display: none;
  }

  .vd-progress-row {
    bottom: 66px;
  }

  .vd-player-copy {
    bottom: 118px;
  }
}

@media (max-width: 380px) {
  .content-area {
    padding: 10px 10px 94px;
  }

  .video-grid,
  .games-grid {
    gap: 8px;
  }

  .compact-bottom-nav {
    gap: 6px;
    padding: 0 6px;
  }

  .compact-bottom-nav .bn-btn {
    padding-inline: 6px;
  }
}

@media (max-width: 760px) {
  #page-viddetail {
    background: #0f0f0f;
  }

  #page-viddetail .topbar {
    height: 52px;
    padding: 0 12px;
    gap: 10px;
    background: #111;
    border-bottom-color: rgba(255,255,255,0.08);
    box-shadow: none;
  }

  #page-viddetail .vd-back {
    padding: 0;
    font-size: 14px;
    color: #fff;
  }

  #page-viddetail .bottom-nav {
    display: none;
  }

  #page-viddetail .vd-scroll {
    padding: 0 0 calc(20px + env(safe-area-inset-bottom, 0px));
    gap: 0;
  }

  #page-viddetail .vd-layout {
    gap: 0;
  }

  #page-viddetail .vd-player-shell {
    margin-top: 0;
    border-radius: 0;
    box-shadow: none;
  }

  #page-viddetail .vd-player {
    min-height: auto;
    max-height: none;
    aspect-ratio: 16 / 9;
  }

  #page-viddetail .play-circle {
    width: 64px;
    height: 64px;
    font-size: 24px;
  }

  #page-viddetail .vd-player-copy {
    left: 14px;
    right: 14px;
    bottom: 74px;
    gap: 10px;
    align-items: flex-end;
  }

  #page-viddetail .vd-player-copy > div span {
    display: none;
  }

  #page-viddetail .vd-player-copy > span {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(0,0,0,0.65);
    font-size: 12px;
    font-weight: 800;
  }

  #page-viddetail .media-badge {
    top: 12px;
    left: 12px;
    padding: 6px 10px;
    font-size: 11px;
  }

  #page-viddetail .vd-progress-row {
    left: 12px;
    right: 12px;
    bottom: 44px;
  }

  #page-viddetail .vd-progress-track {
    height: 4px;
  }

  #page-viddetail .vd-progress-fill::after {
    width: 12px;
    height: 12px;
    right: -6px;
  }

  #page-viddetail .vd-controls {
    left: 10px;
    right: 10px;
    bottom: 8px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  #page-viddetail .vd-controls-left,
  #page-viddetail .vd-controls-right {
    flex-wrap: nowrap;
    gap: 8px;
  }

  #page-viddetail .vd-controls-left {
    min-width: 0;
    flex: 1 1 auto;
  }

  #page-viddetail .vd-controls-right {
    flex: 0 0 auto;
  }

  #page-viddetail .vd-control {
    width: 34px;
    height: 34px;
    font-size: 15px;
    box-shadow: none;
  }

  #page-viddetail .vd-control-skip {
    width: 20px;
    height: 20px;
  }

  #page-viddetail .vd-control-skip-arrow {
    font-size: 17px;
  }

  #page-viddetail .vd-control-skip-seconds {
    font-size: 7px;
  }

  #page-viddetail .vd-control-ghost {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 12px;
  }

  #page-viddetail .vd-time-inline {
    gap: 4px;
    padding: 0 2px;
  }

  #page-viddetail .vd-time {
    font-size: 12px;
  }

  #page-viddetail #vd-pip-control,
  #page-viddetail #vd-restart-control,
  #page-viddetail .vd-context-pill {
    display: none !important;
  }

  #page-viddetail .vd-mobile-next {
    display: block;
    margin: 0 12px 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(68,96,38,0.95), rgba(26,38,18,0.98));
    border: 1px solid rgba(168,209,112,0.24);
    color: #fff;
    box-shadow: 0 12px 24px rgba(0,0,0,0.22);
  }

  #page-viddetail .vd-mobile-next strong {
    display: block;
    font-family: 'Fredoka One', cursive;
    font-size: 13px;
    line-height: 1.35;
  }

  #page-viddetail .vd-mobile-next span {
    display: block;
    margin-top: 6px;
    color: rgba(255,255,255,0.76);
    font-size: 12px;
    font-weight: 700;
  }

  #page-viddetail .vd-sidebar-next {
    display: none;
  }

  #page-viddetail .vd-meta {
    padding: 0 12px 6px;
  }

  #page-viddetail .vd-title {
    font-size: 20px;
    line-height: 1.28;
  }

  #page-viddetail .vd-info {
    font-size: 12px;
  }

  #page-viddetail .vd-channel-row {
    padding: 10px 12px 4px;
    gap: 10px;
  }

  #page-viddetail .vd-channel {
    gap: 10px;
  }

  #page-viddetail .vd-channel-avatar {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  #page-viddetail .vd-subscribe {
    padding: 10px 16px;
    font-size: 12px;
  }

  #page-viddetail .vd-action-pills {
    width: 100%;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  #page-viddetail .vd-action-pills::-webkit-scrollbar {
    display: none;
  }

  #page-viddetail .vd-action-pill {
    white-space: nowrap;
    padding: 10px 14px;
  }

  #page-viddetail .vd-settings-panel {
    width: min(280px, calc(100vw - 20px));
    padding: 12px;
  }

  #page-viddetail .vd-settings-toggle {
    min-height: 40px;
    padding: 9px 10px;
    font-size: 12px;
  }

  #page-viddetail .vd-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #page-viddetail .vd-comments-section {
    margin: 14px 12px 0;
    padding: 14px;
  }

  #page-viddetail .vd-comment-compose {
    flex-direction: column;
    align-items: stretch;
  }

  #page-viddetail .vd-comment-submit {
    width: 100%;
  }

  #page-viddetail .vd-sidebar {
    padding: 0 12px 20px;
  }

  #page-viddetail .vd-related-wrap {
    padding-top: 8px;
  }

  #page-viddetail .vd-chip-row {
    margin-bottom: 12px;
  }

  #page-viddetail .rel-item {
    padding: 10px 0;
    border-radius: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  #page-viddetail .rel-thumb {
    width: 140px;
    height: 80px;
    border-radius: 12px;
  }

  #page-viddetail .rel-title {
    font-size: 14px;
  }

  #page-viddetail .vd-player-shell.is-fallback-fullscreen .vd-controls,
  #page-viddetail .vd-player-shell:fullscreen .vd-controls,
  #page-viddetail .vd-player-shell:-webkit-full-screen .vd-controls {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  #page-viddetail .vd-player-shell.is-fallback-fullscreen .vd-progress-row,
  #page-viddetail .vd-player-shell:fullscreen .vd-progress-row,
  #page-viddetail .vd-player-shell:-webkit-full-screen .vd-progress-row {
    left: 12px;
    right: 12px;
    bottom: 46px;
  }

  #page-viddetail .vd-player-shell.is-fallback-fullscreen .vd-player-copy,
  #page-viddetail .vd-player-shell:fullscreen .vd-player-copy,
  #page-viddetail .vd-player-shell:-webkit-full-screen .vd-player-copy {
    display: none;
  }

  #page-viddetail .vd-player-shell.is-fallback-fullscreen .media-badge,
  #page-viddetail .vd-player-shell:fullscreen .media-badge,
  #page-viddetail .vd-player-shell:-webkit-full-screen .media-badge {
    top: 12px;
    left: 12px;
  }
}
