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

body {
  background: #0a0a0a;
  color: #e0e0e0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

a {
  color: #3b82f6;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.top-bar {
  padding: 16px 24px;
  border-bottom: 1px solid #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-name {
  font-size: 20px;
  font-weight: 700;
  color: #e0e0e0;
}

.shorts-btn {
  background: #e0e0e0;
  color: #0a0a0a;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.search-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 16px;
}

.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 48px;
  border-radius: 24px;
  background: #1a1a1a;
  border: 1px solid #333;
  color: #e0e0e0;
  font-size: 16px;
  padding: 0 20px 0 48px;
  outline: none;
}

.search-input:focus {
  border-color: #3b82f6;
}

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

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #333;
  border-top-color: #3b82f6;
  border-radius: 50%;
  margin: 24px auto;
  animation: spin 0.6s linear infinite;
}

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

.no-results {
  text-align: center;
  color: #666;
  margin-top: 48px;
  font-size: 16px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.result-card {
  background: #141414;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.15s;
  display: block;
  color: inherit;
}

.result-card:hover {
  opacity: 0.85;
}

.result-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #1a1a1a;
}

.result-card .info {
  padding: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-size: 13px;
  color: #999;
  margin-top: 6px;
}

.player-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 16px;
}

.player-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.back-arrow {
  font-size: 24px;
  color: #e0e0e0;
  line-height: 1;
}

.video-title {
  font-size: 18px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.replay-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
}

.replay-btn {
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 18px;
  cursor: pointer;
  font-family: inherit;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.controls button {
  background: transparent;
  border: none;
  color: #e0e0e0;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.controls input[type="range"] {
  flex: 1;
  accent-color: #3b82f6;
  height: 4px;
}

.controls .time {
  font-size: 14px;
  color: #999;
  min-width: 100px;
  white-space: nowrap;
}

#volumeSlider {
  flex: 0 0 80px;
}

@media (max-width: 600px) {
  .search-container {
    padding: 1rem 16px;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .player-container {
    padding: 0.5rem 16px;
  }

  .controls {
    flex-wrap: wrap;
  }

  .controls .time {
    order: -1;
    min-width: auto;
  }

  #seekSlider {
    width: 100%;
    flex: 1 1 100%;
  }

  #volumeSlider {
    flex: 1;
  }
}

@media (min-aspect-ratio: 3/4) and (max-aspect-ratio: 4/3) {
  .search-container {
    max-width: none;
    padding: 1.5rem 24px;
  }

  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }

  .player-container {
    max-width: none;
    padding: 0.5rem 24px;
  }

  .canvas-wrapper {
    max-height: 60vh;
    width: auto;
    margin: 0 auto;
  }

  canvas {
    object-fit: contain;
  }

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

  .top-bar {
    padding: 12px 24px;
  }
}
