* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
body { background-color: #0d0e12; color: #ffffff; padding-bottom: 90px; overflow-x: hidden; }

.navbar {
  padding: 12px 16px; background: #13141c;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 10; border-bottom: 1px solid #222430;
}
.nav-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.menu-toggle-btn {
  background: #181a24; border: 1px solid #282b3d; color: #fff; width: 36px; height: 36px;
  border-radius: 8px; font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: 0.2s;
}
.menu-toggle-btn:hover { border-color: #ff4757; color: #ff4757; }

.brand-logo { font-size: 1.1rem; color: #ff4757; font-weight: 800; white-space: nowrap; cursor: pointer; text-decoration: none; }

.search-box { position: relative; flex: 1 1 auto; min-width: 0; }
.search-input {
  width: 100%; background: #181a24; border: 1px solid #282b3d; color: #fff;
  padding: 8px 14px 8px 36px; border-radius: 20px; font-size: 0.85rem; outline: none; transition: border-color 0.2s;
}
.search-input:focus { border-color: #ff4757; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #888; font-size: 0.9rem; pointer-events: none; }
.clear-search {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: #888; cursor: pointer; display: none; font-size: 0.8rem;
  background: #282b3d; width: 18px; height: 18px; border-radius: 50%;
  align-items: center; justify-content: center;
}

.user-menu-wrapper {
  position: relative; flex-shrink: 0;
  flex-basis: 100%;
  display: flex; justify-content: flex-start; align-items: center;
  gap: 8px;
  padding-top: 2px;
}
.user-avatar-btn {
  background: #181a24; border: 1px solid #282b3d; color: #fff;
  height: 34px; border-radius: 20px; padding: 0 12px 0 4px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; transition: 0.2s; max-width: 100%;
}
.user-avatar-btn:hover { border-color: #ff4757; }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #ff4757, #e03e4d); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  flex-shrink: 0;
}
.user-avatar-label {
  font-size: 0.8rem; font-weight: 600; color: #ccc;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
}
.user-menu {
  position: absolute; top: calc(100% + 8px); left: 0; right: auto;
  background: #161822; border: 1px solid #282b3d;
  border-radius: 12px; min-width: 230px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  display: none; flex-direction: column; padding: 8px;
  z-index: 200; animation: fadeInMenu 0.15s ease-out;
}
@keyframes fadeInMenu { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.user-menu.open { display: flex; }
.user-menu-header { padding: 12px 12px 14px 12px; border-bottom: 1px solid #222430; margin-bottom: 8px; }
.user-menu-name { font-size: 0.95rem; font-weight: 700; color: #fff; margin-bottom: 4px; word-break: break-all; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.user-menu-email { font-size: 0.72rem; color: #888; word-break: break-all; }
.user-menu-item {
  background: none; border: none; color: #ccc;
  padding: 10px 12px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 600;
  text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: 0.2s; width: 100%;
}
.user-menu-item:hover { background: #222433; color: #fff; }
.user-menu-item.logout:hover { background: #ff4757; color: #fff; }

.history-btn-nav {
  position: relative;
  background: #181a24;
  border: 1px solid #282b3d;
  color: #ccc;
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: 0.2s;
  flex-shrink: 0;
}
.history-btn-nav:hover { border-color: #ff4757; color: #ff4757; }
.history-btn-nav.active {
  border-color: #ff4757;
  color: #ff4757;
  background: #2a1a1e;
}
.history-btn-nav .history-btn-label { display: inline; }
@media (max-width: 380px) {
  .history-btn-nav .history-btn-label { display: none; }
  .history-btn-nav { padding: 0; width: 34px; }
}

.history-count-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4757;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #13141c;
  pointer-events: none;
  animation: pulseBadge 1.6s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(255, 71, 87, 0.6);
}
.history-count-badge.hide { display: none; }

@keyframes pulseBadge {
  0%   { transform: scale(1);    box-shadow: 0 0 6px rgba(255, 71, 87, 0.5); }
  50%  { transform: scale(1.15); box-shadow: 0 0 14px rgba(255, 71, 87, 0.9); }
  100% { transform: scale(1);    box-shadow: 0 0 6px rgba(255, 71, 87, 0.5); }
}

.user-menu-item.history-item { position: relative; }
.user-menu-item.history-item .mini-badge {
  margin-left: auto;
  background: #ff4757;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 20px;
  height: 18px;
  border-radius: 9px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-menu-item.history-item .mini-badge.hide { display: none; }

/* ⭐ auth loading — แสดง container ไว้ (skeleton โชว์ทันที) */
body.auth-loading .navbar,
body.auth-loading .bottom-nav,
body.auth-loading .categories-modal-overlay,
body.auth-loading .player-view,
body.auth-loading .modal-overlay { visibility: hidden !important; }

body.auth-loading .container { visibility: visible !important; }

.auth-loader {
  position: fixed; inset: 0; background: #0d0e12;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; z-index: 9999;
}
.auth-loader.hide { display: none; }
.auth-loader-spinner {
  width: 42px; height: 42px; border: 3px solid #282b3d;
  border-top-color: #ff4757; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.auth-loader-text { color: #888; font-size: 0.85rem; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; width: 100%; height: 65px; background-color: #13141c;
  display: flex; justify-content: space-around; align-items: center; border-top: 1px solid #222430;
  z-index: 100; box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.4);
}
.nav-item {
  position: relative; display: flex; flex-direction: column; align-items: center; text-decoration: none;
  color: #888; font-size: 0.75rem; font-weight: 600; flex: 1; padding: 6px 0; cursor: pointer; transition: color 0.2s ease;
}
.nav-icon { font-size: 1.25rem; margin-bottom: 3px; }
.nav-item.active { color: #ff4757; }

.categories-modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(4px);
  z-index: 250; display: none; align-items: flex-end;
}
.categories-modal-content {
  width: 100%; background: #161822; border-top-left-radius: 20px; border-top-right-radius: 20px;
  max-height: 80vh; display: flex; flex-direction: column; padding: 20px 15px 30px 15px;
  animation: slideUp 0.25s ease-out; border-top: 1px solid #282b3d;
}
.categories-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid #222430; margin-bottom: 15px; }
.categories-title { font-size: 1rem; font-weight: 700; color: #ff4757; }
.btn-close-modal { background: #222433; border: none; color: #888; width: 32px; height: 32px; border-radius: 50%; font-size: 1rem; cursor: pointer; }

.categories-grid-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-right: 4px; }
.category-row-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: #1c1f2e; border: 1px solid #282b3d;
  border-radius: 12px; color: #e1e1e1; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.category-row-item:hover, .category-row-item:active { background: #ff4757; color: #fff; border-color: #ff4757; }
.category-row-item .item-count { font-size: 0.75rem; opacity: 0.8; background: rgba(0, 0, 0, 0.25); padding: 2px 8px; border-radius: 10px; color: #ccc; }

.container { padding: 20px 15px; max-width: 1200px; margin: 0 auto; width: 100%; }

.home-section { margin-bottom: 30px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 1.1rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ''; width: 4px; height: 18px; background: #ff4757; border-radius: 2px; }
.btn-view-all { color: #ff4757; font-size: 0.85rem; font-weight: 600; background: none; border: none; cursor: pointer; display: flex; align-items: center; gap: 4px; text-decoration: none; }
.btn-view-all:hover { text-decoration: underline; }

.horizontal-scroll-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; scroll-behavior: smooth; scrollbar-width: none; }
.horizontal-scroll-row::-webkit-scrollbar { display: none; }

.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 15px; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  background: #181a24; border: 1px solid #282b3d; color: #aaa; padding: 6px 14px;
  border-radius: 20px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; cursor: pointer; transition: 0.2s;
}
.filter-chip.active { background: #ff4757; color: #fff; border-color: #ff4757; }

.series-card {
  background: #161822; border-radius: 10px; overflow: hidden; cursor: pointer;
  transition: transform 0.2s; border: 1px solid #222430; display: flex; flex-direction: column;
  flex-shrink: 0; width: 140px; position: relative;
}
@media (min-width: 600px) { .series-card { width: 170px; } }
.series-card:active { transform: scale(0.97); }

/* ⭐ BLUR-UP IMAGE LOADING */
.poster-box {
  position: relative;
  width: 100%;
  padding-top: 140%;
  background: linear-gradient(135deg, #1a1f2e 0%, #232a3d 50%, #1a1f2e 100%);
  background-size: 200% 200%;
  overflow: hidden;
  animation: posterShimmer 1.6s ease-in-out infinite;
}
.poster-box img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: blur(20px);
  transform: scale(1.08);
  transition:
    opacity   0.45s ease,
    filter    0.55s cubic-bezier(0.25, 1, 0.5, 1),
    transform 0.6s  cubic-bezier(0.25, 1, 0.5, 1);
}
.poster-box img.loaded {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
  animation: none;
  will-change: auto;
}
.poster-box.img-ready {
  animation: none;
  background: #14171f;
}
@keyframes posterShimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .poster-box img {
    transition: opacity 0.2s;
    filter: none;
    transform: none;
  }
  .poster-box { animation: none; }
}

.card-info { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; justify-content: space-between; }
.card-title { font-size: 0.85rem; font-weight: 600; color: #e1e1e1; line-height: 1.35; word-break: break-word; white-space: normal; }
.card-tag { font-size: 0.7rem; color: #aaa; background: #222433; padding: 2px 6px; border-radius: 4px; width: fit-content; border: 1px solid #2d3042; font-weight: 500; }

.btn-delete-card {
  position: absolute; top: 6px; right: 6px; background: rgba(0, 0, 0, 0.7);
  color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); width: 26px; height: 26px;
  border-radius: 50%; font-size: 0.75rem; display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 5; transition: 0.2s;
}
.btn-delete-card:hover { background: #ff4757; border-color: #ff4757; }

.category-view { display: none; }
.category-view.active { display: block; }
.series-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
@media (min-width: 600px) { .series-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; } }
.series-grid .series-card { width: 100%; }

.back-to-home-btn {
  display: inline-flex; align-items: center; gap: 6px; background: #1a1c28; color: #fff;
  border: 1px solid #282b3d; padding: 6px 14px; border-radius: 15px; font-size: 0.8rem;
  cursor: pointer; margin-bottom: 15px; font-weight: 600;
}

.history-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.btn-clear-all {
  background: #ff4757; color: #fff; border: none; padding: 6px 14px; border-radius: 15px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.btn-clear-all:active { transform: scale(0.95); }

.pagination-container { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 25px; margin-bottom: 10px; flex-wrap: wrap; }
.page-btn {
  min-width: 38px; height: 38px; padding: 0 8px; background: #181a24; border: 1px solid #282b3d;
  color: #aaa; border-radius: 8px; font-size: 0.85rem; font-weight: 600; display: flex;
  align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s;
}
.page-btn:active { transform: scale(0.95); }
.page-btn.active { background: #ff4757; color: #fff; border-color: #ff4757; font-weight: 700; }
.page-btn.disabled { opacity: 0.3; cursor: not-allowed; }
.page-dots { color: #555; font-weight: bold; padding: 0 4px; }

.skeleton-card { background: #1a1c28; border-radius: 10px; height: 220px; min-width: 140px; animation: pulse 1.5s infinite ease-in-out; flex-shrink: 0; }
@keyframes pulse { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }

.error-state {
  text-align: center; padding: 60px 20px; color: #888;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.error-state .error-icon { font-size: 3rem; margin-bottom: 4px; }
.error-state .error-title { font-size: 1.05rem; font-weight: 700; color: #fff; }
.error-state .error-desc { font-size: 0.85rem; color: #888; max-width: 320px; line-height: 1.5; }
.error-state .btn-retry {
  background: #ff4757; color: #fff; border: none; padding: 12px 26px;
  border-radius: 10px; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  margin-top: 8px; transition: 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.error-state .btn-retry:hover { background: #e03e4d; }
.error-state .btn-retry:disabled { opacity: 0.6; cursor: not-allowed; }

/* ⭐ PLAYER VIEW — ลบ backdrop-filter, contain */
.player-view {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: #0d0e12;
  z-index: 300; display: none; flex-direction: column; overflow-y: auto;
  align-items: center; justify-content: center; padding: 15px;
  contain: strict;
  isolation: isolate;
}

.player-content-wrapper {
  width: 90vw; max-width: 1000px; height: 85vh;
  background: #13141c; border-radius: 16px;
  border: 1px solid #222430; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.player-header { padding: 12px 18px; background: #181a24; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0; border-bottom: 1px solid #222430; }
.player-header .title-info { font-size: 0.95rem; font-weight: 700; color: #fff; word-break: break-word; white-space: normal; line-height: 1.3; flex: 1; }
.btn-close { background: #222430; color: #fff; border: none; width: 32px; height: 32px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; flex-shrink: 0; transition: 0.2s; }
.btn-close:hover { background: #ff4757; }

/* ⭐ VIDEO CONTAINER — containment + GPU layer */
.video-container {
  position: relative; width: 100%; flex: 1; background: #000;
  display: flex; align-items: center; justify-content: center; padding: 0;
  contain: strict;
  isolation: isolate;
  overflow: hidden;
}
.video-container iframe,
.video-container video,
.video-container > div {
  width: 100%; height: 100%; border: none;
  display: block;
}
.video-container iframe {
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}
.video-container video { object-fit: contain; }

.player-controls { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; background: #13141c; }
.nav-ep-bar { display: flex; gap: 8px; align-items: center; }
.btn-nav-ep {
  background: #181a24; border: 1px solid #2d3042; color: #fff; padding: 10px 6px; border-radius: 10px; flex: 1;
  font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer; text-align: center;
}
.btn-nav-ep.ep-info-badge { flex: 2; background: #1f2336; border-color: #3b4263; color: #ffffff; flex-wrap: wrap; }

.btn-all-ep {
  width: 100%; background: #ff4757; color: #fff; border: none; padding: 11px; border-radius: 10px;
  font-size: 0.85rem; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: 0.2s;
}
.btn-all-ep:hover { background: #e03e4d; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 350; display: none; align-items: flex-end; }
.modal-bottom-sheet {
  width: 100%; background: #161822; border-top-left-radius: 20px; border-top-right-radius: 20px;
  max-height: 75vh; display: flex; flex-direction: column; padding: 15px 15px 25px 15px; animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid #222430; margin-bottom: 15px; }
.sheet-title { font-size: 1rem; font-weight: 700; }
.sheet-ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; overflow-y: auto; padding-right: 4px; }
.ep-button {
  background: #222433; color: #ccc; border: 1px solid #2d3042; padding: 12px; border-radius: 10px;
  font-size: 0.85rem; font-weight: 600; text-align: center; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}
.ep-button.active { background: #ff4757; color: #fff; border-color: #ff4757; font-weight: 700; }

.ep-badge { color: #fff; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; font-weight: bold; }
.tag-sub { background-color: #2ed573 !important; }
.tag-dub { background-color: #0084ff !important; }
.tag-end { background-color: #ffa500 !important; }
.tag-def { background-color: #ff4757 !important; }

.player-view.vertical-mode { padding: 0; background: #000; }
.player-view.vertical-mode .player-content-wrapper {
  width: 100%; max-width: 480px;
  height: calc(100dvh - 25px); max-height: 100vh;
  border-radius: 0; border: none; box-shadow: none; margin-bottom: 25px;
}
.player-view.vertical-mode .player-header {
  position: absolute; top: 0; left: 0; width: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, transparent 100%);
  border-bottom: none; z-index: 10; padding: 15px 18px;
}
.player-view.vertical-mode .video-container { flex: 1; width: 100%; height: 100%; aspect-ratio: auto; background: #000; }
.player-view.vertical-mode .video-container iframe,
.player-view.vertical-mode .video-container video,
.player-view.vertical-mode .video-container > div { width: 100%; height: 100%; }
.player-view.vertical-mode .player-controls { display: none !important; }

.source-badge {
  position: fixed; bottom: 75px; right: 10px;
  background: #181a24; border: 1px solid #282b3d;
  color: #888; padding: 4px 10px; border-radius: 12px;
  font-size: 0.7rem; font-family: monospace; z-index: 90;
  opacity: 0.7;
}
.source-badge.netlify { border-color: #2ed573; color: #2ed573; }
.source-badge.dropbox { border-color: #ffa500; color: #ffa500; }

/* =========================================================
   ✅ POPUP ประกาศ
========================================================= */
.announce-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  z-index: 500; padding: 20px;
  animation: fadeInAnn 0.3s ease-out;
}
.announce-overlay.show { display: flex; }

.announce-popup {
  background: linear-gradient(135deg, #1a1c28, #2a1a1e);
  border: 2px solid #ff4757;
  border-radius: 20px;
  max-width: 420px; width: 100%;
  box-shadow: 0 20px 60px rgba(255, 71, 87, 0.4);
  animation: announcePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.announce-header {
  padding: 20px 24px 12px 24px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255, 71, 87, 0.2);
}
.announce-icon {
  font-size: 1.5rem;
  animation: bellShake 2s ease-in-out infinite;
}
.announce-title {
  font-size: 1.05rem; font-weight: 800;
  color: #ff4757; flex: 1;
}

.announce-body {
  padding: 20px 24px;
  color: #e1e1e1; font-size: 0.95rem;
  line-height: 1.6; word-break: break-word;
  max-height: 40vh; overflow-y: auto;
  white-space: pre-wrap;
}

.announce-footer {
  padding: 0 24px 20px 24px;
}
.announce-close-btn {
  width: 100%;
  background: #ff4757; color: #fff;
  border: none; padding: 12px;
  border-radius: 10px; font-size: 0.9rem;
  font-weight: 700; cursor: pointer;
  transition: 0.2s;
}
.announce-close-btn:hover { background: #e03e4d; }

@keyframes fadeInAnn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes announcePop {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes bellShake {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-12deg); }
  20%, 40% { transform: rotate(12deg); }
  50% { transform: rotate(0deg); }
}

/* =========================================================
   ✅ DEVICE LIMIT POPUP (User)
========================================================= */
.limit-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
}
.limit-overlay.show { display: flex; }
.limit-card {
  background: linear-gradient(135deg, #2a1a1e, #1a1c28);
  border: 2px solid #ff4757;
  border-radius: 20px;
  padding: 30px 24px;
  max-width: 400px; width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(255, 71, 87, 0.4);
  animation: announcePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.limit-icon { font-size: 3rem; margin-bottom: 12px; }
.limit-title {
  font-size: 1.2rem; font-weight: 800;
  color: #ff4757; margin-bottom: 10px;
}
.limit-desc {
  color: #ccc; font-size: 0.9rem;
  line-height: 1.6; margin-bottom: 20px;
}
.limit-desc strong { color: #fff; }
.limit-btn-out {
  width: 100%;
  background: #ff4757; color: #fff;
  border: none; padding: 12px;
  border-radius: 10px; font-size: 0.9rem;
  font-weight: 700; cursor: pointer;
  transition: 0.2s;
}
.limit-btn-out:hover { background: #e03e4d; }

/* =========================================================
   ✅ วันที่อัปเดต (ใต้หัวหมวด)
========================================================= */
.section-date {
  font-size: 0.72rem;
  color: #666;
  font-weight: 500;
  margin-top: 3px;
  margin-left: 12px;
  font-style: italic;
  transition: color 0.2s;
}

.section-date.fresh {
  color: #2ed573;
  font-weight: 700;
  font-style: normal;
  text-shadow: 0 0 8px rgba(46, 213, 115, 0.5);
  animation: datePulse 2s ease-in-out infinite;
}

.section-date.recent {
  color: #ffa500;
  font-weight: 600;
  font-style: normal;
}

.section-date.old {
  color: #666;
}

@keyframes datePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.75; }
}

.section-header > div > .section-title {
  margin-bottom: 0;
}

/* =========================================================
   ✅ ONLINE BADGE (จำนวนคนออนไลน์)
========================================================= */
.online-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.4);
  border-radius: 20px;
  font-size: 0.78rem; color: #2ecc71; font-weight: 600;
  margin-right: 8px; white-space: nowrap;
  cursor: default;
}
.online-dot {
  width: 7px; height: 7px; background: #2ecc71;
  border-radius: 50%; box-shadow: 0 0 6px #2ecc71;
  animation: onlinePulse 1.8s infinite;
}
.online-badge #online-count { color: #fff; font-weight: 800; }
@keyframes onlinePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@media (max-width: 640px) {
  .online-badge { padding: 4px 8px; font-size: 0.72rem; }
  .online-badge .online-label { display: none; }
}

/* =========================================================
   ✅ USER TIER BADGE (ทั่วไป / VIP)
========================================================= */
.user-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 6px;
  white-space: nowrap;
  letter-spacing: 0.2px;
  vertical-align: middle;
}

.user-tier-badge.tier-general {
  background: #1a2a3d;
  color: #4aa3ff;
  border: 1px solid #20396b;
}

.user-tier-badge.tier-vip {
  background: linear-gradient(135deg, #3d2a00, #4a3620);
  color: #ffd700;
  border: 1px solid #6b4a20;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

.user-tier-badge.tier-vip-inf {
  background: linear-gradient(135deg, #3d1a2a, #4a1a20);
  color: #ff4757;
  border: 1px solid #6b2038;
  box-shadow: 0 0 8px rgba(255, 71, 87, 0.3);
}

.user-tier-badge.tier-blocked {
  background: #2a2a2a;
  color: #888;
  border: 1px solid #444;
}

.online-user-tier {
  font-size: 0.6rem !important;
  padding: 1px 6px !important;
  margin-left: 6px;
  margin-top: 3px;
  display: inline-flex;
  width: fit-content;
}

@media (max-width: 420px) {
  #user-tier-badge-nav {
    font-size: 0.58rem !important;
    padding: 1px 6px !important;
    margin-left: 4px;
  }
}

/* =========================================================
   ⭐ PLAYER MODE — ลดโหลด GPU/CPU ขณะเล่นวิดีโอ
========================================================= */
body.player-open .history-count-badge,
body.player-open .section-date.fresh,
body.player-open .online-dot,
body.player-open .announce-icon,
body.player-open .poster-box {
  animation: none !important;
}

body.player-open .navbar,
body.player-open .container,
body.player-open .bottom-nav,
body.player-open .source-badge {
  content-visibility: hidden;
}