:root {
  --bg: #0a0a0b;
  --panel: #151517;
  --panel-2: #1e1e21;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f4f5;
  --muted: #9a9aa2;
  --accent: #7c5cff;
  --progress: #2ecc71;
  --btn: 56px;
  --comment-width: 400px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    "Pretendard",
    "Apple SD Gothic Neo",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ── 로고 ── */
.logo {
  position: fixed;
  top: 20px;
  left: 24px;
  z-index: 50;
  line-height: 1.05;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.logo em {
  display: block;
  margin-top: 2px;
  font:
    italic 600 26px/1 "Georgia",
    "Times New Roman",
    serif;
  color: var(--accent);
}

/* ── 레이아웃 ── */
.stage {
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  /* 슬라이드 트랙을 잘라낸다 */
  transition: padding-right 0.35s ease;
}

body.comments-open .stage {
  padding-right: calc(var(--comment-width) + var(--btn) + 90px);
}

/* ── 플레이어 ── */
.player {
  position: relative;
  flex: 0 0 auto;
  width: min(480px, calc((100dvh - 48px) * 9 / 16));
  aspect-ratio: 9/16;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

/* 영상을 세로로 이어 붙여 다음 영상으로 자연스럽게 이동한다. */
.video-stack {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  transform: translate3d(0, var(--video-offset, 0px), 0);
  transition: transform 0.52s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
  touch-action: pan-x;
}

.video-stack.is-resetting {
  transition: none;
}

/* 슬라이드 한 칸: 영상 박스와 액션 버튼을 나란히 담는다 */
.video-item {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

/* Video.js 기본 UI는 숨기고 영상만 쓴다 */
.video-item .video-js {
  width: 100%;
  height: 100%;
}

.video-item .video-js .vjs-tech {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 세로 화면에 꽉 차게 */
}

.video-item .vjs-control-bar,
.video-item .vjs-big-play-button,
.video-item .vjs-loading-spinner,
.video-item .vjs-error-display {
  display: none !important;
}

.video-item .video-js .vjs-poster {
  background-size: cover;
}

/* 음소거 버튼 + 호버 시 펼쳐지는 볼륨 슬라이더 */
.mute-control {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 6;
  display: flex;
  align-items: center;
  border-radius: 999px;
  transition:
    background 0.2s ease,
    padding-right 0.2s ease;
}

.mute-control:hover,
.mute-control:focus-within {
  background: rgba(0, 0, 0, 0.45);
  padding-right: 12px;
}

.mute {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  transition: background 0.2s ease;
}

/* 래퍼가 펼쳐지면 알약 하나처럼 보이도록 버튼 배경은 지운다 */
.mute-control:hover .mute,
.mute-control:focus-within .mute {
  background: transparent;
}

.mute-volume {
  width: 0;
  margin-left: 0;
  opacity: 0;
  pointer-events: none;
  accent-color: var(--progress);
  transition:
    width 0.2s ease,
    opacity 0.2s ease,
    margin-left 0.2s ease;
}

.mute-control:hover .mute-volume,
.mute-control:focus-within .mute-volume {
  width: 84px;
  margin-left: 4px;
  opacity: 1;
  pointer-events: auto;
}

.mute svg {
  width: 20px;
  height: 20px;
}

.mute .icon-on {
  display: none;
}

.mute.is-sound-on .icon-on {
  display: block;
}

.mute.is-sound-on .icon-off {
  display: none;
}

.control-button {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}

.control-button svg {
  width: 16px;
  height: 16px;
}

.control-time {
  min-width: 66px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.control-range {
  min-width: 0;
  flex: 1;
  accent-color: var(--progress);
}

.control-volume {
  width: 54px;
  accent-color: var(--progress);
}

.meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 20px 22px 26px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  pointer-events: none;
}

.meta-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: linear-gradient(145deg, #9b8cff, #6b52e0);
}

.meta-user b {
  font-size: 15px;
}

.meta p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.88);
}

/* 일시정지하면 가운데에 재생 아이콘이 서서히 나타난다 */
.play-indicator {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.video-item.is-paused .play-indicator {
  opacity: 1;
}

.play-indicator span {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  transform: scale(0.9);
  transition: transform 0.25s ease;
}

.video-item.is-paused .play-indicator span {
  transform: scale(1);
}

.play-indicator svg {
  width: 34px;
  height: 34px;
  margin-left: 4px;
  /* 삼각형 무게중심 보정 */
  color: #fff;
}

/* 재생 바 = 컨트롤바 (클릭·드래그로 구간 이동) */
.progress {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 7;
  height: 4px;
  width: 100%;
  background: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  touch-action: none;
  transition: height 0.15s ease;
}

/* 잡기 쉽게 호버하면 두꺼워진다 */
.progress:hover {
  height: 10px;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--progress);
}

/* ── 액션 ── */
/* 영상 박스 바깥(옆)에 놓이며, 슬라이드마다 하나씩이라 함께 움직인다 */
.actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
}

.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.action-btn {
  width: var(--btn);
  height: var(--btn);
  border-radius: 50%;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  transition:
    background 0.2s,
    transform 0.15s,
    color 0.2s;
}

.action-btn:hover {
  background: #2a2a2f;
}

.action-btn:active {
  transform: scale(0.92);
}

.action-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-label {
  font-size: 13px;
  font-weight: 600;
}

.like.is-on svg {
  fill: #ff3b5c;
  stroke: #ff3b5c;
}

.save.is-on svg {
  fill: currentColor;
}

.comment-btn.is-on {
  background: var(--accent);
  color: #fff;
}

/* ── 이동 (화면 오른쪽 끝 항상 고정) ── */
.nav {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 30;
}

.nav button {
  width: var(--btn);
  height: var(--btn);
  border-radius: 50%;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  transition:
    background 0.2s,
    transform 0.15s;
}

.nav button:hover:not(:disabled) {
  background: #2a2a2f;
}

.nav button:active:not(:disabled) {
  transform: scale(0.92);
}

.nav button:disabled {
  opacity: 0.35;
  cursor: default;
}

.nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── 댓글 (네비 왼쪽에 붙는다) ── */
.comments {
  position: fixed;
  right: calc(var(--btn) + 48px);
  top: 50%;
  transform: translate(calc(100% + var(--btn) + 72px), -50%);
  width: var(--comment-width);
  height: min(720px, calc(100dvh - 48px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s ease;
  z-index: 40;
}

.comments.is-open {
  transform: translate(0, -50%);
}

.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.comments-head h2 {
  font-size: 17px;
  font-weight: 700;
}

.comments-head h2 span {
  font-weight: 500;
  color: var(--muted);
}

.close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel-2);
  display: grid;
  place-items: center;
}

.close:hover {
  background: #2a2a2f;
}

.close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.comment-list {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.comment-list::-webkit-scrollbar {
  width: 6px;
}

.comment-list::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

.comment {
  display: flex;
  gap: 12px;
}

.comment .avatar {
  width: 40px;
  height: 40px;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 5px;
}

.comment-text {
  font-size: 14.5px;
  line-height: 1.45;
  margin-bottom: 8px;
  word-break: break-word;
}

.comment-tools {
  display: flex;
  align-items: center;
  gap: 16px;
}

.comment-like {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.comment-like svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.comment-like.is-on {
  color: #ff3b5c;
}

.comment-like.is-on svg {
  fill: currentColor;
}

.comment-reply {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.comment-reply:hover {
  color: var(--text);
}

.comment-form {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}

.comment-form .avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(145deg, #4d9dff, #1b6fd6);
}

.comment-form input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
}

.comment-form input::placeholder {
  color: var(--muted);
}

.comment-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.comment-form button {
  padding: 0 18px;
  height: 44px;
  border-radius: 22px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.comment-form button:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.comment-form button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

@media (max-width: 1024px) {
  .nav {
    display: none;
    pointer-events: none;
  }

  /* 480px 폭 제한을 풀고 화면 높이를 꽉 채운다 (너비는 9/16 비율로 따라옴) */
  .player {
    width: auto;
    height: 100%;
    max-width: 100%;
  }

  .stage {
    padding: 0;
    gap: 0;
  }

  .comments {
    right: 0;
    left: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: 70dvh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .comments.is-open {
    transform: translateY(0);
  }

  body.comments-open .actions {
    bottom: calc(70dvh + 16px);
  }

  body.comments-open .stage {
    padding-right: 0;
  }
}

/* ── 모바일 ── */
@media (max-width: 768px) {
  .player {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    aspect-ratio: auto;
  }

  .actions {
    position: absolute;
    right: 10px;
    bottom: 130px;
    z-index: 20;
    gap: 16px;
    --btn: 48px;
  }

  .nav {
    display: none;
  }

  .logo {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}
