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

html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #0f0f0f;
  color: #fff;
}

.app-container {
  width: min(100vw, 56.25vh);
  aspect-ratio: 9 / 16;
  max-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: #0f0f0f;
  position: relative;
}

@media (min-width: 481px) {
  .app-container {
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  }
  
  body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
  }
}

.header {
  background: linear-gradient(135deg, #ff0000, #cc0000);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.header-top {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
}

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

.cast-button {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 8px;
  display: none;
}

.cast-button:hover {
  background: rgba(255, 0, 0, 0.3);
}

.view-toggle {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.view-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
}

.selection-info {
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.search-bar {
  padding: 12px 16px;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-bar input {
  width: 100%;
  padding: 12px 16px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  transition: all 0.2s;
}

.search-bar input:focus {
  outline: none;
  border-color: #ff0000;
  background: #333;
}

.search-bar input::placeholder {
  color: #666;
}

.channel-select {
  width: 100%;
  padding: 12px 16px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  transition: all 0.2s;
  text-align: center;
  cursor: pointer;
}

.channel-select:focus {
  outline: none;
  border-color: #ff0000;
  background: #333;
}

.channel-label {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #ff0000;
  letter-spacing: 0.5px;
}

.channel-select option {
  background: #1a1a1a;
  color: #fff;
  text-align: center;
  padding: 8px;
}

.videos-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.videos-container::-webkit-scrollbar {
  width: 8px;
}

.videos-container::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.videos-container::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

.videos-container::-webkit-scrollbar-thumb:hover {
  background: #666;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 16px;
}

.player-view {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.video-card-single {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
}

.video-card-single.selected {
  border-color: #ff0000;
}

.list-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  background: #1a1a1a;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.list-item:hover {
  background: #ff0000;
  transform: translateX(6px);
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.3);
}

.list-icon {
  flex-shrink: 0;
  font-size: 16px;
  color: #ff0000;
  opacity: 0.8;
  transition: all 0.3s ease;
}

.list-item:hover .list-icon {
  color: #ffffff;
  opacity: 1;
  transform: scale(1.15);
}

.list-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: #fff;
}

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

.video-error {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  color: #999;
  font-size: 14px;
}

.checkbox-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  cursor: pointer;
}

.checkbox-container {
  position: relative;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.checkbox-overlay:hover .checkbox-container {
  background: rgba(255, 0, 0, 0.8);
}

.checkbox-container input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #ff0000;
}

.video-info-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  padding: 20px 12px 12px;
  z-index: 5;
  cursor: default;
}

.video-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
}

.video-channel {
  font-size: 11px;
  color: #ff0000;
  font-weight: 500;
  margin-bottom: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  z-index: 8;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(255, 0, 0, 0.8);
  transform: translateY(-50%) scale(1.05);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.prev-btn {
  left: 12px;
}

.next-btn {
  right: 12px;
}

.video-counter {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  z-index: 8;
}


.header-bottom {
  padding: 0 20px 12px 20px;
}

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

.header-nav-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  flex: 1;
}

.header-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.header-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.footer {
  flex-shrink: 0;
}

.btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #ff0000;
  color: white;
}

.btn-primary:hover {
  background: #cc0000;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #333;
  color: white;
}

.btn-secondary:hover {
  background: #444;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}