/* MecchaVideo — 위장/페인트 컨셉의 다크 테마 */

:root {
  --bg:        #0d1210;
  --bg-2:      #141b18;
  --card:      #18211d;
  --card-hi:   #1f2b25;
  --line:      #26332c;
  --text:      #e8f2ec;
  --muted:     #8ba396;
  --lime:      #7bf06a;
  --lime-dim:  #4dbb43;
  --pink:      #ff5f9e;
  --amber:     #ffc23d;
  --sky:       #56c8ff;
  --radius:    14px;
  --shadow:    0 8px 28px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
               "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ── 헤더 ───────────────────────────────────────────── */
.hero {
  position: relative;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 380px at 12% -10%, rgba(123,240,106,.16), transparent 60%),
    radial-gradient(700px 320px at 88% -20%, rgba(255,95,158,.13), transparent 60%),
    var(--bg-2);
}

.hero-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 20px 18px;
}

.logo { display: flex; align-items: center; gap: 14px; }

.logo-mark {
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 0 14px rgba(123,240,106,.5));
}

h1 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -.5px;
  background: linear-gradient(92deg, var(--lime), var(--sky) 55%, var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

/* ── 검색 ───────────────────────────────────────────── */
.search-wrap { position: relative; margin: 20px 0 14px; }

#search {
  width: 100%;
  padding: 13px 44px 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.28);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#search::placeholder { color: #63776c; }
#search:focus {
  border-color: var(--lime-dim);
  box-shadow: 0 0 0 3px rgba(123,240,106,.13);
}

.clear-btn {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 22px; line-height: 1;
  cursor: pointer;
}
.clear-btn:hover { background: rgba(255,255,255,.07); color: var(--text); }

/* ── 카테고리 탭 ────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: .15s;
}
.tab:hover { color: var(--text); border-color: #38493f; }
.tab.is-on {
  color: #0c1a0f;
  background: linear-gradient(135deg, var(--lime), var(--lime-dim));
  border-color: transparent;
}
.tab .n { opacity: .65; font-weight: 500; margin-left: 5px; font-size: 12.5px; }

/* ── 툴바 ───────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
}

#lang-filter { flex: 1 1 auto; min-width: 0; }
#shorts-filter { flex: 0 0 auto; border-left: 1px solid var(--line); padding-left: 14px; }

@media (max-width: 720px) {
  #shorts-filter { border-left: 0; padding-left: 0; }
}

/* 언어 칩은 30개 가까이 늘어날 수 있어 가로 스크롤로 처리 (쇼츠 필터도 재사용) */
.chips {
  display: flex;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: .15s;
}
.chip:hover { color: var(--text); }
.chip.is-on { color: var(--text); background: var(--card-hi); border-color: #3d5147; }
.chip .n { opacity: .6; font-size: 11.5px; }

.count { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }

.lang-hint {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.lang-hint[hidden] { display: none; }
.lang-hint #lang-hint-reset {
  border: 0;
  background: transparent;
  color: var(--lime);
  font-size: 12.5px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.lang-hint #lang-hint-reset:hover { color: var(--lime-dim); }

/* ── 그리드 ─────────────────────────────────────────── */
main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; }

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform .16s ease, border-color .16s, box-shadow .16s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--lime-dim);
  box-shadow: var(--shadow);
}
.card:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0a0f0c;
  overflow: hidden;
}
.thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.card:hover .thumb img { transform: scale(1.05); }

.play-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.28);
  opacity: 0;
  transition: opacity .16s;
  font-size: 40px;
}
.card:hover .play-badge { opacity: 1; }

.tag {
  position: absolute;
  left: 8px; top: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #0c1a0f;
  background: var(--lime);
}
.tag[data-c="funny"]    { background: var(--amber); }
.tag[data-c="streamer"] { background: var(--pink); color: #2a0714; }
.tag[data-c="play"]     { background: var(--sky); color: #04222f; }
.tag[data-c="review"]   { background: #c79bff; color: #1c0a33; }
.tag[data-c="etc"]      { background: #8ba396; color: #0c1a0f; }

.shorts-tag {
  position: absolute;
  right: 8px; top: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(0,0,0,.72);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
}

/* 영상 언어 표시 — 글로벌 서비스라 어떤 언어권 영상인지 한눈에 보이게 */
.lang-badge {
  position: absolute;
  right: 8px; bottom: 8px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 14px;
  background: rgba(0,0,0,.72);
  border: 1px solid rgba(255,255,255,.18);
}

/* 임베드가 막힌 영상 — 클릭하면 유튜브 새 탭으로 */
.ext-tag {
  position: absolute;
  left: 8px; bottom: 8px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(0,0,0,.78);
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
}
.card.is-external:hover { border-color: #ff5f9e; }
.card.is-external .play-badge { font-size: 34px; color: #fff; }

.card-body { padding: 12px 13px 14px; }

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

.card-sub {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* ── 모달 (도킹 가능한 플레이어) ─────────────────────── */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }   /* display:grid 가 [hidden] 을 덮어쓰지 않도록 */
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.78); backdrop-filter: blur(3px); }

.modal-box {
  position: relative;
  width: min(960px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.modal-dragbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  background: rgba(0,0,0,.35);
  border-bottom: 1px solid var(--line);
}
.drag-grip { color: var(--muted); font-size: 13px; letter-spacing: -1px; }
.drag-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.modal-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0; border-radius: 7px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 16px; line-height: 1;
  cursor: pointer;
}
.modal-btn:hover { background: rgba(255,255,255,.14); }
.modal-btn[hidden] { display: none; }   /* .modal-btn 의 display:grid 가 [hidden] 을 덮어쓰지 않도록 */
#btn-close:hover { background: var(--pink); color: #2a0714; }

.player { aspect-ratio: 16 / 9; background: #000; }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }

.modal-meta { padding: 14px 16px 16px; }
.modal-meta h2 { margin: 0 0 8px; font-size: 16px; font-weight: 600; line-height: 1.45; }

.yt-link { color: var(--lime); font-size: 13.5px; text-decoration: none; }
.yt-link:hover { text-decoration: underline; }

/* 도킹 상태 — 화면 구석의 작은 위젯으로 축소되어 뒤 페이지를 조작할 수 있다 */
.modal.is-docked {
  inset: auto;
  display: block;
  padding: 0;
  pointer-events: none;   /* 위젯 바깥은 완전히 클릭 통과 */
}
.modal.is-docked .modal-backdrop { display: none; }
.modal.is-docked .modal-box {
  position: fixed;
  width: 340px;
  pointer-events: auto;
  box-shadow: 0 12px 32px rgba(0,0,0,.55);
}
.modal.is-docked .modal-dragbar { cursor: grab; touch-action: none; }
.modal.is-docked .modal-dragbar:active { cursor: grabbing; }
.modal.is-docked .modal-meta { display: none; }   /* 좁은 위젯에서는 설명 생략 */

/* ── 푸터 ───────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--line);
  padding: 22px 20px 40px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}
.footer p { margin: 4px 0; }
.footer .muted { opacity: .7; }
.footer code { background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 5px; }

@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px 12px; }
  .card-title { font-size: 13px; }
  .count { margin-left: 0; width: 100%; }
}

/* 카드가 <a> 로 바뀌면서 필요한 링크 리셋 */
a.card { text-decoration: none; color: inherit; }

/* ── 영상 상세 페이지 (/v/<id>.html) ────────────────────
   검색 유입 사용자가 곧바로 착지하는 SEO 랜딩 페이지 */
.watch-wrap { max-width: 960px; margin: 0 auto; padding: 20px 20px 60px; }

.watch-top {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0 18px;
}
.watch-top .logo-mark { font-size: 30px; }
.watch-brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.watch-brand span {
  background: linear-gradient(92deg, var(--lime), var(--sky) 55%, var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* 클릭 전엔 썸네일만 보여주고(퍼포먼스), 누르면 iframe 로 교체 (lite embed) */
.lite {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  cursor: pointer;
  border: 1px solid var(--line);
}
.lite img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lite .lite-play {
  position: absolute; inset: 0; margin: 0; border: 0; padding: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,.25);
  display: grid; place-items: center;
  cursor: pointer;
}
.lite .lite-play::after {
  content: "▶";
  font-size: 30px; color: #fff;
  width: 78px; height: 54px;
  background: rgba(0,0,0,.6);
  border-radius: 14px;
  display: grid; place-items: center;
  transition: background .15s;
}
.lite:hover .lite-play::after { background: var(--pink); color: #2a0714; }
.lite iframe { width: 100%; height: 100%; border: 0; display: block; }

.watch-title { margin: 18px 0 8px; font-size: 22px; line-height: 1.35; }
.watch-meta { margin: 0; color: var(--muted); font-size: 14px; }
.watch-meta .flag { margin-right: 4px; }

.watch-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 8px; }
.watch-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--line);
}
.watch-btn.primary { background: linear-gradient(135deg, var(--lime), var(--lime-dim)); color: #0c1a0f; border-color: transparent; }
.watch-btn.ghost { color: var(--text); }
.watch-btn.ghost:hover { background: var(--card-hi); }

.watch-external-note {
  margin: 14px 0 0; padding: 12px 14px;
  background: rgba(255,95,158,.08);
  border: 1px solid rgba(255,95,158,.25);
  border-radius: 10px;
  color: var(--text); font-size: 13.5px;
}

.related h2 { font-size: 16px; margin: 34px 0 14px; }
.related .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

@media (max-width: 560px) {
  .watch-title { font-size: 18px; }
}
