@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-dark: #0d0d0f;
  --bg-card: #16161a;
  --bg-hover: #1e1e24;
  --accent: #ff6b35;
  --accent-hover: #ff8555;
  --accent-subtle: rgba(255, 107, 53, 0.15);
  --text-primary: #f0f0f2;
  --text-secondary: #8b8b95;
  --border: #2a2a30;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-dark);
}

/* 커스텀 스크롤바 - 배경과 비슷한 색 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

body {
  font-family: 'Noto Sans KR', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 100px;
}

/* 탭 네비게이션 */
.tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.tabs-left { display: flex; align-items: center; gap: 12px; }
.tabs-right { display: flex; align-items: center; gap: 12px; position: relative; overflow: visible; }

.search-input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  width: 180px;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
}
.search-input::placeholder {
  color: var(--text-secondary);
}

.user-display {
  font-size: 14px;
  color: var(--accent);
}
.user-display.hidden { display: none; }

.auth-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.auth-btn.hidden { display: none; }

/* 로그인 모달 */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-modal.hidden { display: none !important; }

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(6px);
}

.auth-modal-content {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 32px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.auth-modal-content h3 {
  margin-bottom: 20px;
  font-size: 18px;
}

.auth-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-hover);
  color: var(--text-primary);
  font-size: 20px;
  border-radius: 50%;
  cursor: pointer;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}
.auth-tab.active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent);
}

.auth-form input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
}
.auth-input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-textarea {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
}
.auth-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-submit-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
}

.auth-submit-btn:hover {
  background: var(--accent-hover);
}

.auth-error {
  color: #ff6b6b;
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}

.auth-form button[type="submit"] {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.auth-form button[type="submit"]:hover {
  background: var(--accent-hover);
}

.tab {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 24px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab.active {
  background: var(--accent-subtle);
  color: var(--accent);
}

.tab.hidden {
  display: none !important;
}

/* 컨텐츠 영역 */
.content {
  flex: 1;
  padding: 24px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* None Page */
.none-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  font-size: 24px;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

/* 메인 화면 (탭 바 없음) */
.main-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
}
.main-screen.hidden { display: none !important; }
.app-screen.hidden { display: none !important; }
.app-screen { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Main 컨텐츠 */
.main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 24px;
}
.main-desc {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
}
.main-start-btn {
  padding: 14px 32px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.main-start-btn:hover {
  background: var(--accent-hover);
}

/* Video 컨테이너 */
.video-container {
  position: relative;
}

.recommend-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* 비디오 그리드 */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.video-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.video-card-media, .image-card-media {
  position: relative;
}

.video-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg-hover);
  pointer-events: none;
}

.video-card-popular, .image-card-popular {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.9));
  color: var(--text-primary);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.video-card:hover .video-card-popular,
.image-card:hover .image-card-popular {
  opacity: 1;
}

.video-card-info {
  padding: 14px;
}

.video-card-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.video-card-likes {
  color: var(--accent);
}

.video-card-comments {
  color: var(--text-secondary);
}

.video-card-uploader {
  color: var(--accent);
  font-weight: 500;
}

/* 이미지 그리드 - 더 큰 사이즈 */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.image-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.image-thumbnail {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg-hover);
  pointer-events: none;
}

.image-modal-content #image-modal-img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #000;
  margin-bottom: 20px;
}

.edit-media-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.edit-media-btn:hover { color: var(--accent); border-color: var(--accent); }
.edit-media-btn.hidden { display: none !important; }

.comment-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-pinned {
  font-size: 11px;
  padding: 2px 6px;
  background: var(--accent-subtle);
  color: var(--accent);
  border-radius: 4px;
}

.comment-pinned-glow {
  animation: pinnedGlow 2s ease-in-out infinite;
  box-shadow: 0 0 10px var(--accent), 0 0 20px rgba(255,107,53,0.4);
}

@keyframes pinnedGlow {
  0%, 100% { box-shadow: 0 0 8px var(--accent), 0 0 16px rgba(255,107,53,0.3); }
  50% { box-shadow: 0 0 14px var(--accent), 0 0 28px rgba(255,107,53,0.5); }
}

.comment-pin-btn {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.comment-pin-btn:hover { color: var(--accent); }

.comment-actions { display: flex; gap: 16px; margin-top: 6px; font-size: 12px; }

.comment-like-btn, .comment-reply-btn {
  padding: 2px 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}
.comment-like-btn:hover, .comment-reply-btn:hover { color: var(--accent); }
.comment-like-btn.liked { color: var(--accent); }

.comment-replies { list-style: none; margin-top: 12px; padding-left: 20px; border-left: 2px solid var(--border); }
.comment-reply { margin-bottom: 8px; }

.reply-input-wrap {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}
.reply-input-wrap.hidden { display: none !important; }
.reply-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 13px;
}
.reply-submit-btn {
  padding: 8px 16px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 13px;
  cursor: pointer;
}

.comments-section-same {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* 이미지 댓글 - 검정/주황 테마 */
.comments-section-dark-orange {
  background: #0d0d0f;
  color: var(--text-primary);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.comments-section-dark-orange h4 {
  color: var(--accent);
}

.comment-input-dark-orange input {
  background: #0d0d0f !important;
  border-color: var(--accent) !important;
  color: var(--text-primary) !important;
}

.comment-input-dark-orange input:focus {
  border-color: var(--accent-hover) !important;
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.comment-input-dark-orange button {
  background: var(--accent) !important;
  color: white !important;
}

/* 칭호 배지 - 주황색 빛남 */
.user-title-badge {
  font-size: 12px;
  padding: 2px 8px;
  margin-right: 4px;
  background: var(--accent-subtle);
  color: var(--accent);
  border-radius: 6px;
  animation: titleGlow 2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(255, 107, 53, 0.4);
}

@keyframes titleGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(255, 107, 53, 0.3); }
  50% { box-shadow: 0 0 12px rgba(255, 107, 53, 0.5); }
}

/* Player 탭 */
.player-container h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.player-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.player-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.player-name {
  font-weight: 500;
}

.player-title-edit {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.player-title-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 14px;
  width: 160px;
}

.player-title-btn {
  padding: 8px 16px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 14px;
  cursor: pointer;
}

.player-empty {
  color: var(--text-secondary);
  padding: 40px;
  text-align: center;
}

/* 플러스 업로드 버튼 */
.upload-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #e55a2b);
  border: none;
  color: white;
  font-size: 28px;
  font-weight: 300;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(255, 107, 53, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.upload-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 32px rgba(255, 107, 53, 0.5);
}

.upload-btn.hidden {
  display: none;
}

/* 비디오 모달 - 확대 애니메이션 */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.3s ease;
}

.video-modal.hidden {
  display: none !important;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.modal-content {
  position: relative;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow);
  animation: modalZoomIn 0.35s ease;
}

@keyframes modalZoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-hover);
  color: var(--text-primary);
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
}

.modal-close:hover {
  background: var(--accent);
}

#modal-video {
  width: 100%;
  max-height: 450px;
  border-radius: var(--radius-sm);
  background: #000;
  margin-bottom: 20px;
  display: block;
}

.video-info {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.video-info-text {
  flex: 1;
  min-width: 0;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.like-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.like-btn.liked {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent);
}

.like-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.video-info-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.delete-video-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid #ff6b6b;
  border-radius: var(--radius-sm);
  color: #ff6b6b;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.delete-video-btn:hover {
  background: rgba(255, 107, 107, 0.15);
}

.delete-video-btn.hidden {
  display: none !important;
}

.video-info h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.video-info p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-desc-pre {
  white-space: pre-wrap;
  word-break: break-word;
  color: #e8a878;
}

.modal-date {
  font-size: 12px !important;
  margin-top: 8px;
}

/* 댓글 섹션 */
.comments-section h4 {
  font-size: 16px;
  margin-bottom: 16px;
  font-weight: 500;
}

.comment-input-area {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.comment-input-area input,
#comment-input,
#image-comment-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
}

.comment-input-area input:focus,
#comment-input:focus,
#image-comment-input:focus {
  outline: none;
  border-color: var(--accent);
}

.comment-input-area button,
#comment-submit,
#image-comment-submit {
  padding: 12px 24px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.comment-input-area button:hover,
#comment-submit:hover,
#image-comment-submit:hover {
  background: var(--accent-hover);
}

.comment-list {
  list-style: none;
}

.comment-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.5;
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-author {
  font-weight: 500;
  color: #fff;
  margin-bottom: 4px;
}

.comment-text {
  color: var(--text-primary);
}

.comment-date {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* 빈 상태 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 8px;
}

.empty-state span {
  font-size: 48px;
  opacity: 0.5;
}

/* Dialogue 탭 */
.dialogue-container {
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
}

.dialogue-room-list h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.dialogue-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.dialogue-create-btn {
  padding: 12px 24px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 24px;
}

.dialogue-create-btn:hover {
  background: var(--accent-hover);
}

.dialogue-rooms {
  list-style: none;
}

.dialogue-room-item {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialogue-room-item:hover {
  background: var(--bg-hover);
}

.dialogue-room-item-name {
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dialogue-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 600;
  border-radius: 50%;
}

.dialogue-room-item-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.dialogue-chat-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  min-height: 400px;
}

.dialogue-chat-view.hidden {
  display: none !important;
}

.dialogue-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  margin: -24px -24px 0 -24px;
  padding: 16px 24px;
}

.dialogue-back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

.dialogue-room-name {
  font-weight: 600;
}

.dialogue-messages {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 16px 0;
}

.dialogue-msg {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.dialogue-msg-author {
  font-weight: 500;
  color: #fff;
  margin-bottom: 4px;
}

.dialogue-msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.dialogue-msg-date {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.dialogue-input-area {
  display: flex;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.dialogue-input-area textarea {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  min-height: 48px;
}

.dialogue-input-area textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.dialogue-input-area button {
  padding: 12px 24px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-end;
}

.dialogue-empty {
  color: var(--text-secondary);
  padding: 24px;
  text-align: center;
}

.dialogue-room-list.hidden {
  display: none !important;
}

.dialogue-announcement {
  margin-bottom: 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--accent-subtle);
}

.dialogue-announcement.hidden {
  display: none !important;
}

.dialogue-announcement-toggle {
  width: 100%;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.dialogue-announcement-body {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-top: 1px solid var(--border);
}

.dialogue-announcement-body.collapsed {
  display: none;
}

.dialogue-msg-media {
  margin: 8px 0;
}

.dialogue-msg-media img,
.dialogue-msg-media video {
  max-width: 100%;
  max-height: 240px;
  border-radius: var(--radius-sm);
}

.dialogue-msg-media video {
  width: 100%;
}

.dialogue-media-btn {
  padding: 8px 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  align-self: flex-end;
  white-space: nowrap;
}

.dialogue-media-btn:hover {
  color: var(--accent);
}

.dialogue-msg-contextmenu {
  position: fixed;
  z-index: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 0;
  min-width: 140px;
}

.dialogue-msg-contextmenu.hidden {
  display: none !important;
}

.dialogue-msg-contextmenu button {
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.dialogue-msg-contextmenu button:hover {
  background: var(--bg-hover);
}

.player-delete-btn {
  padding: 8px 16px;
  background: #c0392b;
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 13px;
  cursor: pointer;
}

.player-delete-btn:hover {
  background: #a93226;
}

/* Friend 탭 패널 */
.tabs-right { position: relative; }
.friend-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 320px;
  max-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.friend-panel.hidden { display: none !important; }
.friend-panel-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.friend-sub-tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.friend-sub-tab:hover, .friend-sub-tab.active {
  color: var(--accent);
  border-color: var(--accent);
}
.friend-content { flex: 1; min-height: 120px; display: flex; flex-direction: column; overflow: visible; }
.friend-content.hidden { display: none !important; }
#friend-invite-content .friend-search-input { outline: none; }
#friend-search-results { max-height: 180px; overflow-y: auto; }
#friend-requests-list { max-height: 200px; overflow-y: auto; }
.friend-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  box-sizing: border-box;
}
.friend-search-input:focus {
  border-color: var(--accent);
  border-width: 2px;
  padding: 9px 13px;
}
.friend-list { list-style: none; }
.friend-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.friend-add-btn {
  padding: 6px 12px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 12px;
  cursor: pointer;
}
.friend-add-btn:hover { background: var(--accent-hover); }
.friend-add-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.friend-request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.friend-request-btns { display: flex; gap: 8px; }
.friend-accept-btn { padding: 6px 12px; background: #27ae60; color: white; border: none; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; }
.friend-reject-btn { padding: 6px 12px; background: var(--border); color: var(--text-primary); border: none; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; }
.dialogue-create-members { margin: 16px 0; }
.dialogue-create-members label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.dialogue-friends-checkbox { max-height: 120px; overflow-y: auto; }
.dialogue-friend-checkbox { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.dialogue-friend-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  cursor: pointer;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.dialogue-friend-checkbox input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2 6l3 3 5-6'/%3E%3C/svg%3E");
  background-size: 10px 10px;
  background-position: center;
  background-repeat: no-repeat;
}
.dialogue-no-friends { font-size: 13px; color: var(--text-secondary); padding: 8px 0; }
.dialogue-invite-btn {
  margin-left: auto;
  padding: 6px 12px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 13px;
  cursor: pointer;
}
.dialogue-invite-btn:hover { background: var(--accent-hover); }
.dialogue-invite-btn.hidden { display: none; }
.friend-invite-list { max-height: 200px; overflow-y: auto; }
.friend-invite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

/* ========== Community 탭 ========== */
.community-container {
  max-width: 720px;
  margin: 0 auto;
}

.community-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.community-write-area {
  margin-bottom: 32px;
}

.community-write-area .auth-input,
.community-write-area .auth-textarea {
  margin-bottom: 12px;
}

.community-desc-input {
  color: var(--text-primary);
}

.community-desc-input::placeholder {
  color: var(--text-secondary);
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.community-card {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.community-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.community-card-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.community-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.community-card-preview {
  font-size: 14px;
  color: #e8a878;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.community-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.community-card-author {
  color: var(--accent);
  font-weight: 500;
}

.community-post-desc {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.6;
  color: #e8a878;
  margin-bottom: 12px;
}

.community-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
}

/* ========== 반응형: 모바일 / PC ========== */

/* 모바일 하단 탭바 - 기본 숨김 (768px 초과) */
.mobile-bottom-nav {
  display: none;
}

/* 모바일/태블릿 (768px 이하) */
@media (max-width: 768px) {
  .app {
    padding-bottom: 0;
  }

  /* PC 상단 탭 숨김, 모바일 하단 탭 표시 */
  .tabs .tabs-left .tab:not([data-tab="player"]) {
    display: none;
  }
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
    gap: 4px;
  }
  .mobile-bottom-nav .tab {
    flex: 1;
    padding: 12px 8px;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 48px;
    border-radius: var(--radius-sm);
  }
  .mobile-bottom-nav .tab.active {
    color: var(--accent);
  }

  /* 상단 바 간소화 */
  .tabs {
    padding: 12px 16px;
    gap: 8px;
  }
  .search-input {
    flex: 1;
    min-width: 0;
    max-width: 160px;
  }
  .auth-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* 컨텐츠 패딩 */
  .content {
    padding: 16px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }

  /* 비디오/이미지 그리드 - 1~2열 */
  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  .community-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .video-card-info,
  .image-card-info {
    padding: 10px;
  }
  .video-card-title,
  .image-card-title {
    font-size: 13px;
  }

  /* 업로드 버튼 - 하단 탭바 위 */
  .upload-btn {
    bottom: calc(72px + env(safe-area-inset-bottom));
    right: 20px;
    width: 56px;
    height: 56px;
    font-size: 24px;
  }

  /* 모달 - 모바일 풀스크린 느낌 */
  .video-modal,
  .auth-modal {
    padding: 12px;
    align-items: flex-start;
  }
  .video-modal .modal-content,
  .auth-modal .auth-modal-content {
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    max-width: 100%;
  }
  .modal-close,
  .auth-modal-close {
    min-width: 44px;
    min-height: 44px;
    font-size: 28px;
  }

  /* 댓글 입력 터치 영역 */
  .comment-input-area input,
  .comment-input-area button,
  .comment-submit,
  #comment-submit,
  #community-comment-input,
  #community-comment-submit {
    min-height: 44px;
  }

  /* 단톡방 모바일 */
  .dialogue-container {
    flex-direction: column;
  }
  .dialogue-room-list {
    padding: 16px;
  }
  .dialogue-chat-view {
    flex-direction: column;
    height: calc(100vh - 140px);
    min-height: 300px;
  }
  .dialogue-chat-header {
    flex-shrink: 0;
    padding: 12px 16px;
  }
  .dialogue-back-btn,
  .dialogue-invite-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  .dialogue-input-area {
    flex-shrink: 0;
    padding: 12px;
  }
  .dialogue-input-area textarea {
    min-height: 44px;
  }
  .dialogue-send-btn {
    min-width: 48px;
    min-height: 44px;
  }
  .dialogue-media-btn {
    min-height: 44px;
  }

  /* 친구 패널 - 모바일 풀스크린 */
  .friend-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    z-index: 150;
    border-radius: 0;
    box-shadow: none;
    padding: 60px 16px 24px;
  }
}

/* 작은 모바일 (480px 이하) */
@media (max-width: 480px) {
  .tabs {
    padding: 10px 12px;
  }
  .content {
    padding: 12px;
  }
  .video-grid,
  .image-grid {
    grid-template-columns: 1fr;
  }
  .recommend-section h2 {
    font-size: 16px;
  }
  .upload-btn {
    bottom: calc(68px + env(safe-area-inset-bottom));
    right: 16px;
    width: 52px;
    height: 52px;
    font-size: 22px;
  }
}
