:root {
  --bg: #0f1014;
  --surface: #171920;
  --surface-2: #1f222b;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #ff3b5c;
  --accent-hover: #e62e4d;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input {
  font: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(15, 16, 20, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff3b5c, #ff6b4a);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(255, 59, 92, 0.28);
}

.brand-mark.small {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.search-box {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 6px 2px 16px;
  transition: border-color 0.2s;
}

.search-box:focus-within {
  border-color: rgba(255, 59, 92, 0.6);
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  padding: 8px 4px;
  font-size: 14px;
}

.search-box button {
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-box button:hover {
  color: var(--text);
}

.btn-primary {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-primary.full {
  width: 100%;
  padding: 12px 18px;
  border-radius: 10px;
}

.btn-ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.categories {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.categories::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover {
  color: var(--text);
  background: var(--surface-2);
}

.chip.active {
  background: var(--text);
  color: #0f1014;
  border-color: var(--text);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 180px);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.section-count {
  font-size: 13px;
  color: var(--muted);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px 18px;
}

.video-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

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

.duration-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(10, 11, 15, 0.86);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
}

.hd-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  background: rgba(255, 59, 92, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  letter-spacing: 0.04em;
}

.card-body {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.card-avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-avatar img, .channel-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-size: 13px;
  color: var(--muted);
}

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

.player-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #07080b;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.player-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.45) blur(2px);
  transform: scale(1.03);
}

.player-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(15, 16, 20, 0.3), rgba(8, 9, 12, 0.82));
}

.player-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 2;
  padding-bottom: 24px;
}

.loader-brand {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.loader-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 59, 92, 0.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.loader-status {
  font-size: 13px;
  color: #d1d5db;
}

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

.player-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 20px 14px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
}

.progress-track {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  margin-bottom: 8px;
  overflow: hidden;
}

.progress-buffer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14%;
  background: rgba(255, 255, 255, 0.35);
  transition: width 1s ease;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--accent);
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ctrl-btn {
  border: 0;
  background: transparent;
  color: #fff;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.time-display {
  font-size: 12px;
  color: #e5e7eb;
  font-variant-numeric: tabular-nums;
}

.quality-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.14);
}

.watch-title {
  margin: 16px 0 12px;
  font-size: 21px;
  font-weight: 700;
}

.watch-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.channel-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.channel-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.channel-name {
  font-weight: 600;
  font-size: 15px;
}

.channel-sub {
  font-size: 13px;
  color: var(--muted);
}

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

.action-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.action-pill:hover {
  background: var(--surface-2);
}

.watch-description {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  color: #d1d5db;
}

.sidebar-heading {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.related-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.related-card {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  cursor: pointer;
}

.related-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

.related-meta {
  font-size: 12px;
  color: var(--muted);
}

.footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  font-size: 13px;
  color: var(--muted);
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a:hover {
  color: var(--text);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(7, 8, 12, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 28px 24px 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.modal-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 15px;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.modal-subtitle {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--muted);
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: #d1d5db;
}

.field-input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  outline: none;
  margin-bottom: 12px;
  font-size: 15px;
}

.field-input:focus {
  border-color: var(--accent);
}

.code-input {
  text-align: center;
  letter-spacing: 0.35em;
  font-size: 20px;
  font-weight: 700;
}

.field-error {
  margin: -4px 0 12px;
  font-size: 13px;
  color: #ff6b81;
}

.modal-note {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.code-footer {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.link-btn:not(:disabled):hover {
  color: var(--text);
}

.link-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

@media (max-width: 1024px) {
  .watch-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 10px 14px;
    gap: 10px;
  }
  .btn-ghost {
    display: none;
  }
  .container {
    padding: 16px 14px;
  }
  .categories {
    padding: 10px 14px;
  }
}
