* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  padding-bottom: 0;
}

.auth-box,
.page-box {
  width: 100%;
  max-width: 420px;
  margin: 50px auto;
  padding: 20px;
}

input,
textarea,
button {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  margin-top: 10px;
  font-size: 16px;
}

button {
  background: #16c784;
  color: #000;
  font-weight: bold;
  cursor: pointer;
}

.feed-spinner-wrap {
  width: 100%;
  height: calc(100vh - 70px);
  height: calc(100dvh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.feed-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: feedSpin 0.8s linear infinite;
}

@keyframes feedSpin {
  to {
    transform: rotate(360deg);
  }
}

#feedList {
  width: 100%;
  height: calc(100vh - 70px);
  height: calc(100dvh - 70px);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  background: #000;
}

.video-card {
  position: relative;
  width: 100%;
  height: calc(100vh - 70px);
  height: calc(100dvh - 70px);
  overflow: hidden;
  background: #000;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.video-card video,
.video-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #000;
}

.video-card video {
  z-index: 2;
}

.video-thumb {
  z-index: 5;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    visibility 0.18s ease;
}

.video-thumb.hide-thumb {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.video-info {
  position: absolute;
  left: 15px;
  right: 95px;
  bottom: 145px;
  z-index: 10;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.video-info p {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.35;
}

.video-actions {
  position: absolute;
  right: 14px;
  bottom: 145px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.action-btn {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 50%;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.action-btn.liked,
.like-btn.liked,
.video-actions .like-btn.liked {
  color: #ff2d55 !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

.video-actions span {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 2px 6px #000;
}

.video-progress-wrap {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 105px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-progress-wrap span {
  min-width: 35px;
  font-size: 12px;
  text-shadow: 0 1px 4px #000;
}

.video-progress {
  flex: 1;
  height: 4px;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.tap-hint,
.center-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 25;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.tap-hint {
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 30px;
  font-size: 14px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.25s;
}

.center-play {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 50%;
  font-size: 34px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* COMMENT MODAL - SHEET STOPS ABOVE NAV */

.comment-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.55);
  overscroll-behavior: contain;
  touch-action: none;
}

.comment-modal[hidden] {
  display: none !important;
}

.comment-box {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 70px;
  width: 100%;
  height: 60vh;
  height: 60dvh;
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #111;
  border-radius: 18px 18px 0 0;
  touch-action: pan-y;
}

.comment-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
}

.comment-close {
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  background: transparent;
  color: #fff;
  font-size: 28px;
}

.reply-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #aaa;
  font-size: 13px;
}

.reply-cancel {
  width: auto;
  padding: 0;
  margin: 0;
  background: transparent;
  color: #16c784;
  font-size: 13px;
}

.comment-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px;
}

.comment-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.comment-item p {
  margin-top: 4px;
  font-size: 14px;
}

.comment-reply {
  margin-left: 18px;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
}

.reply-btn {
  width: auto;
  padding: 0;
  margin-top: 6px;
  background: transparent;
  color: #aaa;
  font-size: 13px;
  font-weight: bold;
}

.delete-comment-btn {
  width: auto;
  padding: 0;
  margin-top: 6px;
  margin-left: 12px;
  background: transparent;
  color: #ff4d4d;
  font-size: 13px;
  font-weight: bold;
}

.comment-empty {
  padding: 20px;
  text-align: center;
  color: #aaa;
}

.comment-form {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #111;
}

.comment-input {
  flex: 1;
  min-width: 0;
  margin: 0;
  background: #222;
  color: #fff;
}

.comment-send {
  width: 80px;
  flex-shrink: 0;
  margin: 0;
}

/* BOTTOM NAVIGATION */

#navContainer {
  position: relative;
  z-index: 999;
}

nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  height: 70px;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: rgba(0, 0, 0, 0.05);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-top: none;
}

nav a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

::-webkit-scrollbar {
  width: 0;
  height: 0;
}