@import url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_11-01@1.0/NanumSquareNeo-Variable.woff2');

:root {
  --primary-color: #e50914;
  --primary-dark: #b20710;
  --background-dark: #141414;
  --background-card: #1f1f1f;
  --background-surface: #2a2a2a;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  --border-color: rgba(255, 255, 255, 0.1);
  --header-height: 56px;
  --bottom-nav-height: 56px;
  --sidebar-width: 220px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  font-family: 'NanumSquare Neo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  margin: 0;
  background-color: var(--background-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   모바일 상단 헤더 스타일
   ============================================ */

.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: linear-gradient(to bottom, rgba(20, 20, 20, 0.98) 0%, rgba(20, 20, 20, 0.95) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-color);
}

.mobile-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-header-center {
  flex: 1;
  text-align: center;
  overflow: hidden;
}

.mobile-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mobile-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

.mobile-menu-toggle:hover,
.mobile-menu-toggle:active {
  background: rgba(255, 255, 255, 0.1);
}

.app-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
  letter-spacing: -0.5px;
}

.app-logo span {
  color: var(--text-primary);
  font-weight: 400;
}

.current-category {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
  margin: 0 auto;
}

.mobile-search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

.mobile-search-toggle:hover,
.mobile-search-toggle:active {
  background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   검색 오버레이 스타일
   ============================================ */

.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--background-dark);
  z-index: 1100;
  display: none;
  padding: 8px 12px;
  box-sizing: border-box;
}

.search-overlay.active {
  display: flex;
}

.search-overlay-content {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.search-overlay-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
}

.search-overlay-input {
  flex: 1;
  height: 40px;
  background: var(--background-surface);
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
}

.search-overlay-input::placeholder {
  color: var(--text-muted);
}

.search-overlay-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--primary-color);
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.2s;
}

.search-overlay-submit:hover {
  background: var(--primary-dark);
}

/* ============================================
   하단 네비게이션 바 스타일
   ============================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  padding-bottom: var(--safe-area-bottom);
  background: linear-gradient(to top, rgba(20, 20, 20, 0.98) 0%, rgba(20, 20, 20, 0.95) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  border-top: 1px solid var(--border-color);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
  transition: transform 0.2s;
}

.bottom-nav-item.active {
  color: var(--primary-color);
}

.bottom-nav-item.active svg {
  transform: scale(1.1);
}

.bottom-nav-item:active {
  background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   카테고리 바텀 시트 스타일
   ============================================ */

.category-sheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: none;
}

.category-sheet.open {
  display: block;
}

.category-sheet-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.3s;
}

.category-sheet.open .category-sheet-backdrop {
  opacity: 1;
}

.category-sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70vh;
  background: var(--background-card);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-area-bottom);
}

.category-sheet.open .category-sheet-content {
  transform: translateY(0);
}

.category-sheet-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  margin: 12px auto;
}

.category-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--border-color);
}

.category-sheet-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.category-sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

.category-sheet-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.category-sheet-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  -webkit-overflow-scrolling: touch;
}

.category-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.2s;
}

.category-sheet-item:active {
  background: rgba(255, 255, 255, 0.1);
}

.category-sheet-item.active {
  color: var(--primary-color);
  background: rgba(229, 9, 20, 0.1);
}

.category-sheet-item svg {
  width: 24px;
  height: 24px;
  opacity: 0.7;
}

.category-sheet-item span {
  font-size: 16px;
  font-weight: 500;
}

/* ============================================
   로딩 스켈레톤 스타일
   ============================================ */

.skeleton {
  background: linear-gradient(90deg, var(--background-surface) 25%, var(--background-card) 50%, var(--background-surface) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-thumbnail {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 8px;
}

.skeleton-info {
  padding: 10px 12px;
}

.skeleton-title {
  height: 14px;
  width: 80%;
  margin-bottom: 8px;
}

.skeleton-subtitle {
  height: 12px;
  width: 50%;
}

/* ============================================
   로딩 인디케이터 스타일
   ============================================ */

.loading-indicator {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: var(--background-card);
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.loading-indicator.show {
  display: flex;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 상단 콘텐츠 헤더 - 모바일에서만 표시 */
#content-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 15px 20px;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: left 0.3s ease, width 0.3s ease;
  display: none; /* 데스크톱에서는 숨김 */
}

#current-category-title {
  margin: 0;
  font-size: 1.5rem;
  color: #333;
  font-weight: 600;
}

/* 햄버거 메뉴 버튼 스타일 */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 8px;
  left: 10px;
  z-index: 2000;
  background: #333;
  border: none;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-around;
  width: 36px;
  height: 36px;
}

.mobile-menu-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background: white;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* ============================================
   사이드바 스타일 (다크 테마)
   ============================================ */

aside,
#sidebar {
  width: var(--sidebar-width);
  background: var(--background-card);
  padding: 0;
  max-height: 100vh;
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: none;
  box-shadow: none;
  color: var(--text-primary);
  transition: transform 0.3s ease;
  z-index: 1600;
  box-sizing: border-box;
}

/* #category-menu is an ul inside aside */
aside ul#category-menu { /* Was #category-menu ul */
  list-style-type: none;
  padding: 0;
  margin: 0;
}

/* Targeting the specific anchor tags within the category menu list */
aside ul#category-menu li a {
  display: block;
  padding: 8px 12px; /* 패딩 축소로 더 컴팩트하게 */
  text-decoration: none;
  color: #f1f1f1; /* Light color for text on dark background */
  border-radius: 4px;
  margin-bottom: 3px; /* 마진도 축소 */
  font-size: 0.9em; /* 폰트 크기 축소 */
  transition: background-color 0.2s ease, color 0.2s ease;
  white-space: nowrap; /* 텍스트 줄바꿈 방지 */
  overflow: hidden; /* 넘치는 텍스트 숨김 */
  text-overflow: ellipsis; /* ... 표시 */
}

aside ul#category-menu li a:hover {
  background-color: #555; /* Slightly lighter hover background */
  color: #fff; /* Ensure text is white on hover */
}

aside ul#category-menu li a.active {
  background-color: #007bff; 
  color: #fff; /* Ensure text is white and bright for active state */
  font-weight: bold;
}

/* ============================================
   메인 콘텐츠 영역 스타일
   ============================================ */

#content-area {
  flex-grow: 1;
  padding: 12px;
  background-color: var(--background-dark);
  margin-left: var(--sidebar-width);
  transition: margin-left 0.3s ease, padding 0.3s ease;
  min-height: 100vh;
  box-sizing: border-box;
}

/* ============================================
   콘텐츠 리스트 및 카드 스타일 (넷플릭스 스타일)
   ============================================ */

#content-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 16px 8px;
  padding: 0;
  margin: 0;
  list-style: none;
  width: 100%;
  box-sizing: border-box;
}

.content-item {
  background-color: transparent;
  border-radius: 6px;
  overflow: visible;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, z-index 0s 0.3s;
  position: relative;
  transform-origin: center center;
  width: 100%;
}

.content-item:hover {
  transform: scale(1.05);
  z-index: 100;
  transition: transform 0.2s ease, z-index 0s;
}

.content-item:active {
  transform: scale(1.02);
}

/* 썸네일 래퍼 - 고정 비율 유지 */
.content-item .thumbnail-wrapper {
  position: relative;
  width: 100%;
  padding-top: 150%; /* 2:3 비율 (height = width * 1.5) */
  overflow: hidden;
  border-radius: 6px;
  background: var(--background-surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 썸네일 이미지 */
.content-item .thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--background-surface);
  border-radius: 6px;
  transition: all 0.3s ease;
}

.content-item:hover .thumbnail {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  border-radius: 6px 6px 0 0;
}

/* 호버시 그림자 효과 */
.content-item:hover .thumbnail-wrapper {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* 콘텐츠 제목 */
.content-item .content-title {
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* 재생 아이콘 오버레이 */
.content-item .play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  border-radius: 6px;
  transition: all 0.3s ease;
  pointer-events: none;
}

.content-item:hover .play-overlay {
  background: rgba(0, 0, 0, 0.3);
}

.content-item .play-btn {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.content-item .play-btn svg {
  width: 22px;
  height: 22px;
  fill: #141414;
  margin-left: 3px;
}

.content-item:hover .play-btn {
  opacity: 1;
  transform: scale(1);
}

/* NEW 뱃지 */
.content-item .badge-new {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--primary-color);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 10;
}

/* 레거시 스타일 호환 */
.content-item .title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0;
  transform: translateY(60px);
  transition: all 0.3s ease;
  z-index: 10;
}

.content-item:hover .title {
  opacity: 1;
  transform: translateY(65px);
}

#video-player {
  display: none; /* 초기에는 숨김 */
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

#video-player video {
  width: 80%;
  max-width: 800px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

#back-button {
  /* Position the back button fixed at the bottom right of the detail viewer or video player */
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 20px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  z-index: 1002; /* Above detail title bar, below potential modals */
  display: none; /* Initially hidden, shown by JS */
}

#back-button:hover {
  background-color: #0056b3;
}

/* Detail Content Viewer Styles - 상세페이지에서도 사이드바가 보이도록 수정 */
#detail-content-viewer {
  display: none; /* Initially hidden */
  position: fixed;
  top: 0; /* 데스크톱에서는 헤더가 없으므로 top: 0 */
  left: var(--sidebar-width); /* 사이드바 너비만큼 왼쪽 여백 */
  width: calc(100% - var(--sidebar-width)); /* 사이드바 너비를 제외한 너비 */
  height: 100%; /* 전체 높이 */
  background-color: #fff;
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
  transition: left 0.3s ease, width 0.3s ease;
}

#detail-title-bar {
  background-color: #333;
  color: white;
  padding: 10px 15px;
  position: sticky; 
  top: 0;
  z-index: 1001; 
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px; /* Ensure title bar has some height */
  box-sizing: border-box;
}

#detail-title-bar h2 {
  margin: 0;
  font-size: 1.2em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#detail-html-content {
  padding: 15px; /* Default padding */
  /* Adjust padding to account for sticky title bar and potential fixed back button */
  /* padding-top: 60px; /* Approx height of title bar + some space */
  /* padding-bottom: 70px; /* Approx height of back button + some space */
  line-height: 1.6;
}

/* Basic styling for content coming from external source */
#detail-html-content img {
  max-width: 100%; 
  height: auto;
  display: block; 
  margin: 10px auto; /* Center images and add margin */
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#detail-html-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
}

#detail-html-content th, 
#detail-html-content td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

#detail-html-content pre {
  background-color: #f4f4f4;
  padding: 10px;
  overflow-x: auto; 
  border-radius: 4px;
  border: 1px solid #eee;
}

/* Hide the main scrollbar when detail viewer or video player is active */
body.detail-view-active,
body.video-view-active {
  overflow: hidden; 
}


/* 반응형: 화면 크기에 따라 열 개수 조정 */
/* Masonry handles column counts dynamically based on item width and container width. */
/* We can adjust item width or gutter at different breakpoints if needed. */

/* ============================================
   모바일 반응형 스타일 (768px 이하)
   ============================================ */

@media (max-width: 768px) {
  /* 모바일 헤더 표시 */
  .mobile-header {
    display: flex;
  }

  /* 하단 네비게이션 표시 */
  .bottom-nav {
    display: flex;
  }

  /* 데스크톱 헤더 숨김 */
  #content-header {
    display: none !important;
  }

  /* 사이드바 숨김 (모바일에서는 바텀시트 사용) */
  aside,
  #sidebar {
    transform: translateX(-100%);
    z-index: 1600;
  }

  aside.mobile-open,
  #sidebar.mobile-open {
    transform: translateX(0);
  }

  /* 메인 콘텐츠 영역 조정 */
  #content-area {
    margin-left: 0 !important;
    padding: calc(var(--header-height) + 16px) 12px calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 16px) 12px !important;
    min-height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
  }

  /* 콘텐츠 그리드 조정 - 모바일 3열 */
  #content-list {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px 8px !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* 상세 페이지 조정 */
  #detail-content-viewer {
    left: 0 !important;
    width: 100% !important;
    top: var(--header-height) !important;
    height: calc(100% - var(--header-height)) !important;
    padding: 16px 12px calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 16px) 12px !important;
    background: var(--background-dark);
  }

  /* 모바일에서 사이드바가 열려있을 때 */
  body.mobile-menu-open {
    overflow: hidden !important;
  }

  body.mobile-menu-open .mobile-header,
  body.mobile-menu-open #content-area,
  body.mobile-menu-open #detail-content-viewer,
  body.mobile-menu-open .bottom-nav {
    filter: brightness(0.3);
    pointer-events: none;
  }

  /* 사이드바 오버레이 */
  aside.mobile-open::after,
  #sidebar.mobile-open::after {
    content: '';
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    width: calc(100vw - var(--sidebar-width));
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }

  #detail-html-content {
    padding: 10px;
  }

  /* 콘텐츠 카드 모바일 최적화 - 넷플릭스 스타일 */
  .content-item {
    border-radius: 4px;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    overflow: visible;
  }

  /* 모바일에서는 호버 효과 비활성화 */
  .content-item:hover {
    transform: none;
    z-index: auto;
  }

  .content-item:active {
    transform: scale(0.97);
  }

  .content-item:hover::after {
    display: none;
  }

  /* 모바일에서 썸네일 래퍼 */
  .content-item .thumbnail-wrapper {
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  .content-item .thumbnail {
    border-radius: 4px;
  }

  .content-item:hover .thumbnail {
    border-radius: 4px;
  }

  /* 모바일에서 제목 항상 표시 */
  .content-item .content-title,
  .content-item .title {
    position: static;
    padding: 8px 4px;
    font-size: 11px;
    opacity: 1;
    transform: none;
    color: var(--text-secondary);
    -webkit-line-clamp: 2;
    background: transparent;
  }

  .content-item:hover .content-title,
  .content-item:hover .title {
    transform: none;
    color: var(--text-primary);
  }

  /* 모바일에서 재생 오버레이 숨김 */
  .content-item .play-overlay {
    display: none;
  }

  /* 페이지네이션 모바일 스타일 */
  #pagination {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 20px);
  }
}

/* 작은 모바일 (480px 이하) */
@media (max-width: 480px) {
  #content-list {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px 8px !important;
  }

  .content-item .content-title,
  .content-item .title {
    padding: 6px 2px;
    font-size: 10px;
    -webkit-line-clamp: 2;
  }

  #detail-title-bar h2 {
    font-size: 1em;
  }

  .app-logo {
    font-size: 18px;
  }

  .current-category {
    font-size: 12px;
    max-width: 100px;
  }
}

/* 매우 작은 화면 (380px 이하) */
@media (max-width: 380px) {
  #content-list {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px 6px !important;
  }

  .content-item .content-title,
  .content-item .title {
    font-size: 9px;
    padding: 4px 2px;
    -webkit-line-clamp: 1;
  }

  .app-logo {
    font-size: 16px;
  }

  .app-logo span {
    display: none;
  }
}

/* 데스크톱 스타일 (769px 이상) */
@media (min-width: 769px) {
  /* 모바일 전용 요소 숨김 */
  .mobile-header {
    display: none;
  }

  .bottom-nav {
    display: none;
  }

  .category-sheet {
    display: none !important;
  }

  .search-overlay {
    display: none !important;
  }

  /* 데스크톱 콘텐츠 그리드 */
  #content-list {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 24px 16px;
    padding-bottom: 40px;
  }
}

/* 대형 데스크톱 (1400px 이상) */
@media (min-width: 1400px) {
  #content-list {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 24px 16px;
  }
}

/* 중간 데스크톱 (1024px ~ 1399px) */
@media (min-width: 1024px) and (max-width: 1399px) {
  #content-list {
    grid-template-columns: repeat(5, 1fr) !important;
  }
}

/* 태블릿 (769px ~ 1023px) */
@media (min-width: 769px) and (max-width: 1023px) {
  #content-list {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px 12px;
  }
}

.video-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.video-container video {
  width: 100%;
  height: auto;
  display: block;
}

/* Plyr 플레이어 커스텀 스타일 */
.plyr--video {
  border-radius: 8px;
  overflow: hidden;
}

.plyr--video .plyr__control--overlaid {
  background: rgba(0, 0, 0, 0.8);
}

.plyr--video .plyr__control:hover {
  background: rgba(0, 0, 0, 0.9);
}

.plyr--video .plyr__control--overlaid:hover {
  background: rgba(0, 0, 0, 0.9);
}

.plyr--full-ui input[type=range] {
  color: #00a8ff;
}

.plyr__control--overlaid {
  background: rgba(0, 0, 0, 0.8);
}

.plyr--video .plyr__control.plyr__tab-focus,
.plyr--video .plyr__control:hover,
.plyr--video .plyr__control[aria-expanded=true] {
  background: rgba(0, 0, 0, 0.9);
}

.plyr__control.plyr__tab-focus {
  box-shadow: 0 0 0 5px rgba(0, 168, 255, 0.5);
}

.plyr__menu__container {
  background: rgba(28, 28, 28, 0.9);
  border-radius: 4px;
}

.plyr__menu__container .plyr__control {
  color: #fff;
}

.plyr__menu__container .plyr__control:hover {
  background: rgba(0, 0, 0, 0.3);
}

.plyr__tooltip {
  background: rgba(0, 0, 0, 0.8);
  border-radius: 4px;
}

.plyr__tooltip::before {
  border-top-color: rgba(0, 0, 0, 0.8);
}

#detail-video-embed {
  margin: 20px 0;
  padding: 0;
}

/* 상세 페이지 스타일 */
.detail-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.detail-header {
  margin-bottom: 20px;
}

.detail-header h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

.detail-meta {
  color: #666;
  font-size: 14px;
}

.video-container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 20px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.video-container video {
  width: 100%;
  height: auto;
  display: block;
}

.detail-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.detail-synopsis {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.detail-synopsis h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

.detail-synopsis p {
  color: #333;
  line-height: 1.6;
}

.episodes-container {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.episodes-container h3 {
  margin-bottom: 15px;
  font-size: 18px;
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.episode-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.2s;
  cursor: pointer;
}

.episode-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.episode-thumbnail {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 비율 */
  background: #000;
}

.episode-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.episode-info {
  padding: 10px;
}

.episode-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.episode-synopsis {
  font-size: 12px;
  color: #666;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 768px) {
  .episodes-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .detail-content {
    padding: 10px;
  }
  
  .detail-header h2 {
    font-size: 20px;
  }
}

/* General body and layout */
body {
  font-family: 'NanumSquare Neo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  margin: 0;
  background-color: #f4f4f4;
  color: #333;
}

header {
  background-color: #f8f9fa; /* Light gray background */
  padding: 0.5rem 1rem; /* Reduced padding */
  display: flex; /* Align items in a row */
  justify-content: space-between; /* Space out logo/title and nav/search */
  align-items: center; /* Vertically center items */
  border-bottom: 1px solid #e7e7e7;
  position: relative; /* Ensure z-index is effective */
  z-index: 50; /* Above general content, below modals */
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  color: #333;
  font-family: 'NanumSquare Neo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; /* 폰트 변경 */
}

#category-menu-top {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0;
  background-color: #444;
}

#category-menu-top a, #category-menu-side a {
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  border-radius: 4px;
  margin: 0 0.25rem;
}

#category-menu-top a:hover, #category-menu-side a:hover {
  background-color: #555;
}

#main-container {
  display: flex;
}

#sidebar {
  width: 220px; /* 너비 증가 */
  background-color: #333;
  color: white;
  padding: 1rem;
  border-right: none;
  height: 100vh; /* 헤더가 없으므로 전체 높이 사용 */
  overflow-y: auto;
  position: fixed;
  z-index: 50;
  box-sizing: border-box;
}

#category-menu-side {
  list-style-type: none !important;
  padding: 8px;
  margin: 0;
}

#category-menu-side li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text-secondary);
  border-radius: 8px;
  margin-bottom: 4px;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
}

#category-menu-side li a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

#category-menu-side li a.active {
  background-color: var(--primary-color);
  color: white;
  font-weight: 600;
}

/* 중복된 #content-area 스타일 제거됨 */

/* 사이드바 검색 컨테이너 스타일 */
#sidebar .search-container {
  display: flex;
  margin: 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background: var(--background-surface);
}

#sidebar .search-container input[type="text"] {
  flex-grow: 1;
  padding: 12px 16px;
  border: none;
  background-color: transparent;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

#sidebar .search-container input[type="text"]::placeholder {
  color: var(--text-muted);
}

/* Content List li 스타일 (레거시) */
#content-list li {
  background-color: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 4px;
  overflow: hidden; /* For image and text alignment */
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

#content-list li:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#content-list li img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 2 / 3; /* Common poster aspect ratio */
  object-fit: cover;
}

#content-list li .content-title {
  padding: 0.75rem;
  font-size: 1.2 rem;
  text-align: center;
  color: #333;
  background-color: white;
}

/* 페이지네이션 스타일 */
#pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  padding: 16px 0;
  flex-wrap: wrap;
}

#pagination button {
  padding: 10px 16px;
  margin: 0;
  border: none;
  background-color: var(--background-card);
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  min-width: 44px;
}

#pagination button:hover {
  background-color: var(--background-surface);
  transform: translateY(-2px);
}

#pagination button:active {
  transform: scale(0.95);
}

#pagination button.active {
  background-color: var(--primary-color);
  color: white;
}

#pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#pagination span {
  color: var(--text-muted);
  padding: 0 8px;
}

/* Video Player Container */
#video-player-container {
  position: fixed; /* Or absolute, depending on desired behavior */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

#video-player-container video {
  max-width: 90%;
  max-height: 80vh; /* Adjust as needed */
  border-radius: 4px;
}

#back-to-list-button {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 0.75rem 1.25rem;
  background-color: #fff;
  color: #333;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  z-index: 1001;
}

#episode-list {
  margin-top: 1rem;
  max-height: 15vh; /* Adjust as needed */
  overflow-y: auto;
  background-color: rgba(255,255,255,0.1);
  padding: 0.5rem;
  border-radius: 4px;
  width: 80%;
  max-width: 600px;
}

#episode-list button {
  display: block;
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.25rem;
  background-color: #555;
  color: white;
  border: none;
  border-radius: 3px;
  text-align: left;
  cursor: pointer;
}

#episode-list button:hover {
  background-color: #666;
}

/* Hide generic back button if new one is used */
#back-button { /* Assuming this was an old button ID */
    display: none;
}

/* 중복된 #detail-content-viewer 스타일 제거됨 */

/* 중복된 미디어 쿼리 제거됨 */

/* ============================================
   모바일 미디어 플레이어 스타일
   ============================================ */

/* 모바일 플레이어 컨테이너 */
.mobile-player {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 9999;
  flex-direction: column;
}

.mobile-player.active {
  display: flex;
}

/* 상단 헤더 */
.mobile-player-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
  z-index: 30;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.mobile-player.controls-hidden .mobile-player-header {
  opacity: 0;
  pointer-events: none;
}

.mp-back-btn {
  background: none;
  border: none;
  padding: 0;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
  flex-shrink: 0;
}

.mp-back-btn:hover,
.mp-back-btn:active {
  background: rgba(255,255,255,0.2);
}

.mp-title {
  flex: 1;
  color: white;
  font-size: 16px;
  font-weight: 500;
  margin: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.mp-header-actions {
  display: flex;
  gap: 8px;
}

.mp-pip-btn,
.mp-settings-btn {
  background: none;
  border: none;
  padding: 0;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
  flex-shrink: 0;
}

.mp-pip-btn:hover,
.mp-pip-btn:active,
.mp-settings-btn:hover,
.mp-settings-btn:active {
  background: rgba(255,255,255,0.2);
}

/* 비디오 래퍼 */
.mobile-player-video-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mobile-player-video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* 제스처 오버레이 */
.gesture-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  z-index: 20;
}

.gesture-zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.gesture-left {
  justify-content: flex-start;
  padding-left: 20%;
}

.gesture-right {
  justify-content: flex-end;
  padding-right: 20%;
}

.double-tap-indicator {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: doubleTapPulse 0.4s ease;
}

.double-tap-indicator.show {
  display: flex;
}

.double-tap-indicator span {
  color: white;
  font-size: 14px;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

@keyframes doubleTapPulse {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* 재생/일시정지 인디케이터 */
.play-pause-indicator {
  display: none;
  animation: playPausePulse 0.3s ease;
}

.play-pause-indicator.show {
  display: flex;
}

.play-pause-indicator .play-icon,
.play-pause-indicator .pause-icon {
  display: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.play-pause-indicator.playing .pause-icon {
  display: block;
}

.play-pause-indicator.paused .play-icon {
  display: block;
}

@keyframes playPausePulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* 밝기/볼륨 인디케이터 */
.adjustment-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: rgba(0,0,0,0.6);
  border-radius: 12px;
  z-index: 25;
}

.adjustment-indicator.show {
  display: flex;
}

#brightness-indicator {
  left: 30px;
}

#volume-indicator {
  right: 30px;
}

.adjustment-bar {
  width: 6px;
  height: 100px;
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.adjustment-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 3px;
  transition: height 0.1s ease;
}

/* 로딩 스피너 */
.mp-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  z-index: 15;
}

.mp-loading.show {
  display: flex;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 시크 프리뷰 */
.seek-preview {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  padding: 12px 24px;
  background: rgba(0,0,0,0.8);
  border-radius: 8px;
  z-index: 25;
}

.seek-preview.show {
  display: block;
}

.seek-time {
  color: white;
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* 하단 컨트롤 */
.mobile-player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
  z-index: 30;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.mobile-player.controls-hidden .mobile-player-controls {
  opacity: 0;
  pointer-events: none;
}

/* 진행바 */
.mp-progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.mp-time {
  color: white;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-width: 45px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.mp-current-time {
  text-align: left;
}

.mp-duration {
  text-align: right;
}

.mp-progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
  touch-action: none;
}

.mp-progress-bar:hover,
.mp-progress-bar:active {
  height: 6px;
}

.mp-progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255,255,255,0.4);
  border-radius: 2px;
  pointer-events: none;
}

.mp-progress-played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #ff4444;
  border-radius: 2px;
  pointer-events: none;
}

.mp-progress-handle {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: #ff4444;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.mp-progress-bar:hover .mp-progress-handle,
.mp-progress-bar:active .mp-progress-handle,
.mp-progress-bar.seeking .mp-progress-handle {
  opacity: 1;
}

/* 컨트롤 버튼들 */
.mp-control-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mp-control-btn {
  background: none;
  border: none;
  padding: 0;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.mp-control-btn:hover,
.mp-control-btn:active {
  background: rgba(255,255,255,0.2);
}

.mp-control-btn:active {
  transform: scale(0.95);
}

.mp-play-btn {
  margin: 0 16px;
}

.mp-play-btn .play-icon,
.mp-play-btn .pause-icon {
  display: none;
}

.mp-play-btn.playing .pause-icon {
  display: block;
}

.mp-play-btn.paused .play-icon {
  display: block;
}

.mp-control-spacer {
  flex: 1;
}

.mp-speed-btn {
  min-width: 44px;
}

#mp-speed-label {
  color: white;
  font-size: 14px;
  font-weight: 600;
}

.mp-fullscreen-btn .expand-icon,
.mp-fullscreen-btn .compress-icon {
  display: none;
}

.mp-fullscreen-btn.normal .expand-icon {
  display: block;
}

.mp-fullscreen-btn.fullscreen .compress-icon {
  display: block;
}

.mp-lock-btn .unlock-icon,
.mp-lock-btn .lock-icon {
  display: none;
}

.mp-lock-btn.unlocked .unlock-icon {
  display: block;
}

.mp-lock-btn.locked .lock-icon {
  display: block;
}

/* 화면 잠금 오버레이 */
.mp-locked-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  z-index: 40;
}

.mp-locked-overlay.show {
  display: flex;
}

.mp-unlock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.6);
  border: none;
  padding: 20px 32px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.mp-unlock-btn:hover,
.mp-unlock-btn:active {
  background: rgba(0,0,0,0.8);
}

.mp-unlock-btn span {
  color: white;
  font-size: 14px;
}

/* 에피소드 바텀 시트 */
.mp-bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70%;
  background: #1a1a1a;
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mp-bottom-sheet.open {
  transform: translateY(0);
}

.mp-bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  margin: 12px auto;
}

.mp-bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.mp-bottom-sheet-header h3 {
  color: white;
  font-size: 18px;
  margin: 0;
}

.mp-sheet-close {
  background: none;
  border: none;
  padding: 0;
  width: 44px;
  height: 44px;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  border-radius: 50%;
  transition: background 0.2s;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.mp-sheet-close:hover,
.mp-sheet-close:active {
  background: rgba(255,255,255,0.2);
}

.mp-episodes-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}

.mp-episode-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.mp-episode-item:hover,
.mp-episode-item:active {
  background: rgba(255,255,255,0.1);
}

.mp-episode-item.playing {
  background: rgba(255,68,68,0.2);
  border: 1px solid rgba(255,68,68,0.5);
}

.mp-episode-thumb {
  width: 120px;
  height: 68px;
  border-radius: 4px;
  object-fit: cover;
  background: #333;
  flex-shrink: 0;
}

.mp-episode-info {
  flex: 1;
  min-width: 0;
}

.mp-episode-title {
  color: white;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp-episode-desc {
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 설정 모달 */
.mp-settings-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.8);
  z-index: 100;
}

.mp-settings-modal.open {
  display: flex;
}

.mp-settings-content {
  width: 90%;
  max-width: 400px;
  background: #1a1a1a;
  border-radius: 16px;
  overflow: hidden;
}

.mp-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.mp-settings-header h3 {
  color: white;
  font-size: 18px;
  margin: 0;
}

.mp-settings-close {
  background: none;
  border: none;
  padding: 0;
  width: 40px;
  height: 40px;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  border-radius: 50%;
  transition: background 0.2s;
  flex-shrink: 0;
}

.mp-settings-close:hover {
  background: rgba(255,255,255,0.1);
}

.mp-settings-section {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.mp-settings-section:last-child {
  border-bottom: none;
}

.mp-settings-section h4 {
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px 0;
}

.mp-speed-options,
.mp-quality-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mp-speed-option,
.mp-quality-option {
  background: rgba(255,255,255,0.1);
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.mp-speed-option:hover,
.mp-quality-option:hover {
  background: rgba(255,255,255,0.2);
}

.mp-speed-option.active,
.mp-quality-option.active {
  background: #ff4444;
}

/* 모바일 특화 스타일 */
@media (max-width: 768px) {
  /* 상세 페이지에서 비디오 영역 클릭 시 모바일 플레이어 표시 */
  .video-container.mobile-clickable {
    cursor: pointer;
  }

  .video-container.mobile-clickable::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
  }

  .video-container.mobile-clickable:hover::after {
    opacity: 1;
  }

  /* 세로 모드에서 플레이어 조정 */
  .mobile-player.portrait .mobile-player-video-wrapper {
    flex: none;
    height: 30vh;
    min-height: 200px;
  }

  .mobile-player.portrait .mobile-player-controls {
    position: relative;
    background: #1a1a1a;
    padding-top: 20px;
  }

  .mobile-player.portrait .mp-bottom-sheet {
    position: relative;
    flex: 1;
    transform: none;
    border-radius: 0;
    display: flex;
  }

  /* portrait 모드에서는 X버튼 숨김 (목록이 항상 표시) */
  .mobile-player.portrait .mp-sheet-close {
    display: none;
  }

  /* 가로 모드에서 전체화면 최적화 */
  @media (orientation: landscape) {
    .mobile-player-header {
      padding: 8px 16px;
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
    }

    .mobile-player-controls {
      padding: 12px 16px;
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
      padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
  }
}

/* 다크 테마 지원 (기본 다크) */
@media (prefers-color-scheme: light) {
  .mp-bottom-sheet,
  .mp-settings-content {
    background: #f5f5f5;
  }

  .mp-bottom-sheet-header h3,
  .mp-settings-header h3,
  .mp-episode-title {
    color: #333;
  }

  .mp-episode-desc,
  .mp-settings-section h4 {
    color: #666;
  }

  .mp-sheet-close,
  .mp-settings-close {
    color: #666;
  }

  .mp-episode-item {
    background: rgba(0,0,0,0.05);
  }

  .mp-episode-item:hover {
    background: rgba(0,0,0,0.1);
  }

  .mp-speed-option,
  .mp-quality-option {
    background: rgba(0,0,0,0.1);
    color: #333;
  }

  .mp-speed-option:hover,
  .mp-quality-option:hover {
    background: rgba(0,0,0,0.15);
  }

  .mp-speed-option.active,
  .mp-quality-option.active {
    background: #ff4444;
    color: white;
  }
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {

  .mp-progress-bar {
    height: 8px;
    padding: 8px 0;
    margin: -8px 0;
  }

  .mp-progress-handle {
    width: 20px;
    height: 20px;
    opacity: 1;
  }
}

/* iOS 노치/홈 인디케이터 대응 */
@supports (padding: max(0px)) {
  .mobile-player-controls {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .mobile-player-header {
    padding-top: max(12px, env(safe-area-inset-top));
  }
}

/* 세로 모드 전용 레이아웃 */
.mobile-player.portrait-mode {
  flex-direction: column;
}

.mobile-player.portrait-mode .mobile-player-video-wrapper {
  flex: none;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 35vh;
}

.mobile-player.portrait-mode .mobile-player-controls {
  position: relative;
  background: #000;
}

.mobile-player.portrait-mode .mp-bottom-sheet {
  position: relative;
  transform: none;
  flex: 1;
  border-radius: 0;
  max-height: none;
  display: flex;
}

/* portrait-mode에서는 X버튼 숨김 */
.mobile-player.portrait-mode .mp-sheet-close {
  display: none;
}

/* 애니메이션 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideDown {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

.mobile-player.entering {
  animation: fadeIn 0.3s ease;
}

.mp-bottom-sheet.entering {
  animation: slideUp 0.3s ease;
}

.mp-bottom-sheet.leaving {
  animation: slideDown 0.3s ease;
}
