* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #ff4757;
  --secondary-color: #2f3542;
  --bg-color: #f1f2f6;
  --card-bg: #ffffff;
  --text-primary: #2f3542;
  --text-secondary: #747d8c;
  --border-color: #e1e1e1;
}

html,
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.logo {
  font-size: 20px;
  font-weight: bold;
  color: white;
  white-space: nowrap;
  text-decoration: none;
}

.search-box {
  flex: 0 1 280px;
  max-width: 280px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 40px 10px 16px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.95);
  outline: none;
  transition: box-shadow 0.3s;
}

.search-input:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.search-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary-color);
  border: none;
  padding: 6px 12px;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  font-size: 12px;
}

.nav-menu {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.lang-switch {
  position: relative;
}

.lang-switch summary {
  list-style: none;
}

.lang-switch summary::-webkit-details-marker {
  display: none;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  display: none;
  z-index: 300;
}

.lang-switch[open] .lang-dropdown {
  display: block;
}

.lang-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.lang-item:hover {
  background: #f2f3f5;
  color: var(--primary-color);
}

.top-nav {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.top-nav .nav-btn {
  white-space: nowrap;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  user-select: none;
}

.nav-btn.sidebar-toggle-btn {
  display: none;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.nav-btn:active {
  transform: translateY(1px);
}

.nav-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

.nav-btn.is-active {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-color);
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.nav-btn.is-active:hover {
  background: rgba(255, 255, 255, 0.95);
}

#sidebarToggle:checked ~ .header label[for='sidebarToggle'] {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-color);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.is-compact-header .header-content {
  flex-wrap: wrap;
}

.is-compact-header .top-nav {
  display: none;
}

.is-compact-header .nav-btn.sidebar-toggle-btn {
  display: inline-flex;
}

.is-compact-header .search-box {
  order: 3;
  flex: 1 0 100%;
  max-width: none;
  width: 100%;
  margin-top: 10px;
}

.sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: var(--card-bg);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 200;
  transition: left 0.3s ease;
  overflow-y: auto;
}

.sidebar.active {
  left: 0;
}

#sidebarToggle:checked ~ .sidebar {
  left: 0;
}

.sidebar-header {
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.sidebar-close {
  float: right;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
}

.sidebar-nav {
  padding: 20px 0;
}

.sidebar-nav a {
  display: block;
  padding: 14px 20px;
  color: var(--text-primary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.3s;
}

.sidebar-nav a:hover {
  background: #f8f9fa;
  border-left-color: var(--primary-color);
  color: var(--primary-color);
}

.sidebar-nav a.active {
  background: #f8f9fa;
  border-left-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
}

.overlay {
  position: fixed;
  display: block;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

#sidebarToggle:checked ~ .overlay {
  opacity: 1;
  visibility: visible;
}

.main-content {
  flex: 1;
  padding: 16px 0;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: 10px 20px;
  background: var(--card-bg);
  border: none;
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s;
}

.tab.active {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
}

.tab:hover:not(.active) {
  background: #e8e8e8;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (min-width: 480px) {
  .video-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 768px) {
  .video-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
  }
}

@media (min-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
  }
}

.video-card {
  position: relative;
  aspect-ratio: 9/16;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
  display: block;
  text-decoration: none;
}

.video-card:hover {
  transform: scale(1.03);
}

.video-card .video-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-card .video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0) 30%,
    rgba(0, 0, 0, 0) 60%,
    rgba(0, 0, 0, 0.7) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
}

.video-card .video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.video-card .video-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #ff4757;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.video-card .video-info {
  padding: 0;
  margin-top: auto;
}

.video-card .video-title {
  font-size: 12px;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.video-card .video-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
}

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

.category-title {
  font-size: 24px;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.category-desc {
  color: var(--text-secondary);
  font-size: 14px;
}

.detail-video {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.detail-video video {
  width: 100%;
  height: 100%;
}

.detail-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 16px;
}

.detail-info {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.detail-stat {
  font-size: 14px;
  color: var(--text-secondary);
}

.detail-desc {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

.footer {
  background: var(--secondary-color);
  color: white;
  padding: 30px 16px;
  text-align: center;
  margin-top: auto;
}

.footer-content {
  max-width: 600px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: white;
}

.footer-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 1024px) {
  .header-content {
    flex-wrap: wrap;
  }

  .header-left {
    order: 1;
    flex: 1 1 auto;
  }

  .top-nav {
    display: none;
  }

  .nav-btn.sidebar-toggle-btn {
    display: inline-flex;
  }

  .nav-menu {
    order: 2;
    margin-left: auto;
  }

  .search-box {
    order: 3;
    flex: 1 0 100%;
    max-width: none;
    width: 100%;
    margin-top: 10px;
  }
}

@media (max-width: 479px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .detail-title {
    font-size: 18px;
  }
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
