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

:root {
  --loom-blue: #4169E8;
  --loom-blue-hover: #3457c9;
  --text-primary: #1a1a2e;
  --text-secondary: #73737a;
  --text-tertiary: #a1a1a8;
  --border: #e8e8eb;
  --bg: #ffffff;
  --bg-hover: #f5f5f5;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════
   HEADER — full width, thin
   ═══════════════════════════════════ */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

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

.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

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

.header-btn-login {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: background 0.15s;
}
.header-btn-login:hover {
  background: var(--bg-hover);
}

/* ═══════════════════════════════════
   MAIN — two-column layout
   ═══════════════════════════════════ */

.main {
  padding: 20px 20px 80px;
}

.two-col {
  display: flex;
  gap: 0;
  align-items: flex-start;
}

.col-left {
  flex: 7;
  min-width: 0;
  padding-left: 25%;
  padding-right: 24px;
}

.col-right {
  flex: 3;
  min-width: 200px;
  align-self: stretch;
  border-left: 1px solid var(--border);
  padding-left: 24px;
}

.col-right .right-header,
.col-right .right-divider,
.col-right .comments-panel {
  position: sticky;
  top: 56px;
}

/* ═══════════════════════════════════
   RIGHT SIDEBAR — Activity panel
   ═══════════════════════════════════ */

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

.icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.activity-tab {
  font-size: 14px;
  font-weight: 600;
  color: var(--loom-blue);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--loom-blue);
}

.right-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin-bottom: 0;
}

.comments-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.comments-disabled {
  text-align: center;
  color: var(--text-secondary);
}
.comments-disabled strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.comments-disabled p {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* ═══════════════════════════════════
   VIDEO TITLE + CREATOR INFO
   ═══════════════════════════════════ */

.video-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
}

.creator-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.creator-name { font-weight: 500; }
.creator-sep { color: var(--text-tertiary); }

/* ═══════════════════════════════════
   VIDEO PLAYER
   ═══════════════════════════════════ */

.video-container {
  width: 100%;
  margin-bottom: 24px;
}

.player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
}

.player {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #000;
}

/* CTA Overlay */

.cta-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 10px 24px;
  background: #FF3000;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: background 0.2s, transform 0.15s;
}
.cta-overlay:hover {
  background: #e62b00;
  transform: translateY(-1px);
}

/* Play overlay */

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.15);
  cursor: pointer;
  transition: opacity 0.3s;
  z-index: 5;
}
.play-overlay.hidden { opacity: 0; pointer-events: none; }

.play-btn {
  background: none;
  border: none;
  cursor: pointer;
  width: 72px;
  height: 72px;
  transition: transform 0.15s;
}
.play-btn:hover { transform: scale(1.08); }

/* Controls */

.controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 6;
}
.player-wrapper:hover .controls,
.controls.visible { opacity: 1; }

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

.ctrl-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.15s;
  color: #fff;
  min-width: 28px;
  height: 28px;
}
.ctrl-btn:hover { opacity: 1; }

/* Speed button */

.speed-wrapper { position: relative; }

.speed-btn {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  min-width: auto;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
}
.speed-btn:hover { background: rgba(255,255,255,0.25); }

#speed-label {
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

.speed-menu {
  display: none;
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28,28,30,0.95);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 4px;
  min-width: 72px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 20;
}
.speed-menu.open { display: block; }

.speed-menu button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: background 0.1s;
}
.speed-menu button:hover { background: rgba(255,255,255,0.12); }
.speed-menu button.active { color: var(--loom-blue); font-weight: 700; }

/* Progress bar */

.progress-container {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 4px;
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  cursor: pointer;
  transition: height 0.1s;
  /* Larger click area via padding */
  padding: 8px 0;
  background-clip: content-box;
}
.progress-bar:hover { height: 6px; }

.progress-fill {
  height: 100%;
  background: var(--loom-blue);
  border-radius: 2px;
  width: 0;
  pointer-events: none;
}

.progress-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px;
  height: 12px;
  background: var(--loom-blue);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.progress-bar:hover .progress-thumb { opacity: 1; }

.time {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 85px;
  text-align: center;
}

/* ═══════════════════════════════════
   BELOW VIDEO — Summary + Chapters
   ═══════════════════════════════════ */

.section {
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

.section:first-of-type {
  border-top: none;
  padding-top: 4px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.summary-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.see-more-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
}
.see-more-btn:hover { text-decoration: underline; }

.chapters-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chapter-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.chapter-item:hover { background: var(--bg-hover); }

.chapter-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--loom-blue);
  min-width: 36px;
  font-variant-numeric: tabular-nums;
}

.chapter-label {
  font-size: 14px;
  color: var(--text-primary);
}

/* ═══════════════════════════════════
   FLOATING CAMERA — blue rounded square
   ═══════════════════════════════════ */

.fab-camera {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  background: var(--loom-blue);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(65,105,232,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 50;
}
.fab-camera:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 18px rgba(65,105,232,0.45);
}

/* ═══════════════════════════════════
   MOBILE
   ═══════════════════════════════════ */

@media (max-width: 900px) {
  .two-col {
    flex-direction: column;
    gap: 24px;
  }

  .col-left {
    flex: none;
    width: 100%;
    padding-left: 0 !important;
  }

  .col-left > * {
    max-width: none;
  }

  .col-right {
    flex: none;
    width: 100%;
    min-width: 0;
    position: static;
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 20px;
  }

  .comments-panel {
    min-height: 120px;
  }
}

@media (max-width: 768px) {
  .header-inner { padding: 8px 14px; }
  .main { padding: 14px 14px 60px; }
  .video-title { font-size: 17px; }

  .cta-overlay {
    padding: 8px 16px;
    font-size: 12px;
    top: 8px;
    right: 8px;
  }

  .play-btn { width: 56px; height: 56px; }

  .controls { gap: 4px; padding: 8px; }
  .ctrl-btn { min-width: 24px; height: 24px; padding: 2px; }
  .ctrl-btn svg { width: 16px; height: 16px; }
  .time { font-size: 10px; min-width: 70px; }

  #ctrl-settings,
  #ctrl-pip { display: none; }

  .fab-camera { width: 38px; height: 38px; border-radius: 10px; bottom: 14px; left: 14px; }
  .fab-camera svg { width: 17px; height: 17px; }
}

@media (max-width: 480px) {
  .header-btn-login { font-size: 13px; padding: 5px 12px; }
  .video-title { font-size: 16px; }
  .controls-right { gap: 0; }
  .time { font-size: 10px; min-width: 62px; }
  .chapter-item { padding: 6px 8px; }
}

/* Fullscreen */
.player-wrapper:fullscreen .controls { opacity: 1; }
.player-wrapper:fullscreen .player { object-fit: contain; }
