:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #6f6a63;
  --line: #e4ddd2;
  --accent: #f3ad32;
  --accent-strong: #3f3f3d;
  --soft: #fff4dc;
  --charcoal: #242424;
  --shadow: 0 16px 40px rgba(23, 23, 23, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Noto Sans KR", "Malgun Gothic", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, #252525 0%, #181818 100%);
  padding: 18px 14px;
}

.brand {
  display: grid;
  gap: 12px;
  padding: 8px 8px 22px;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 210px;
  height: auto;
  object-fit: contain;
}

.brand-copy,
.brand-copy strong,
.brand-copy span {
  display: block;
}

.brand-copy {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 13px;
  color: #fff;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-english {
  margin-top: 2px;
  color: var(--accent);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0;
}

.library-count {
  margin-top: 9px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
}

.category-list {
  display: grid;
  gap: 8px;
}

.category-group {
  display: grid;
  gap: 4px;
}

.category-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.category-button.has-thumb {
  grid-template-columns: 92px minmax(0, 1fr) auto;
}

.category-button-main,
.category-button-group {
  min-height: 52px;
}

.category-button-child {
  min-height: 70px;
  padding: 8px 10px;
}

.nav-thumb {
  width: 92px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.22);
}

.category-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.category-button.active {
  background: rgba(243, 173, 50, 0.16);
  color: #fff;
  font-weight: 700;
}

.category-button-group {
  grid-template-columns: 18px minmax(0, 1fr) auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  margin-top: 4px;
}

.category-button-group:hover {
  background: transparent;
}

.nav-caret {
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.nav-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.nav-text strong,
.nav-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-text strong {
  font-size: 14px;
}

.nav-text small {
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  font-weight: 400;
}

.nav-count {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.category-sublist {
  display: grid;
  gap: 5px;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 244, 239, 0.92);
  padding: 14px 28px;
  backdrop-filter: blur(16px);
}

.site-title {
  display: grid;
  flex: 0 1 360px;
  min-width: 220px;
  gap: 2px;
}

.site-title span {
  color: #8a8176;
  font-size: 13px;
  font-weight: 700;
}

.site-title strong {
  color: var(--charcoal);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(640px, 100%);
  margin-left: auto;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 0 14px;
}

.search-box span {
  color: #9d7a38;
  font-size: 22px;
  line-height: 1;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover {
  color: var(--ink);
}

.menu-toggle {
  display: none;
}

.menu-close {
  display: none;
}

.hero-banner {
  padding: 18px 28px 0;
}

.hero-banner img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
  border: 1px solid rgba(228, 221, 210, 0.9);
  border-radius: 8px;
  background: #fff8ed;
  box-shadow: var(--shadow);
}

.home-view .browse-area {
  padding-top: 22px;
}

.home-view .section-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.home-view .section-head h2 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 30px;
}

.watch-area {
  padding: 20px 28px 8px;
}

.player-frame {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: calc(100vh - 170px);
  min-height: 260px;
  border-radius: 8px;
  background: #101010;
  box-shadow: var(--shadow);
}

.player-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: #c7ced8;
  text-align: center;
  padding: 24px;
}

.watch-meta {
  padding: 18px 2px 12px;
}

.category-label,
.eyebrow {
  margin: 0;
  color: #9b6b17;
  font-size: 13px;
  font-weight: 700;
}

.watch-meta h1 {
  margin: 5px 0 8px;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.22;
  letter-spacing: 0;
}

.watch-meta p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.browse-area {
  padding: 12px 28px 36px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 4px 0 0;
  font-size: 22px;
  letter-spacing: 0;
}

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

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.video-card {
  display: grid;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  padding: 10px;
  text-align: left;
  box-shadow: 0 6px 18px rgba(18, 20, 23, 0.04);
}

.video-card:hover,
.video-card.active {
  border-color: rgba(243, 173, 50, 0.68);
  box-shadow: 0 10px 26px rgba(63, 63, 61, 0.13);
}

.video-card.active {
  outline: 2px solid rgba(243, 173, 50, 0.24);
}

.thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(243, 173, 50, 0.88), rgba(36, 36, 36, 0.92)),
    #242424;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 52%, rgba(0, 0, 0, 0.56) 100%);
  pointer-events: none;
}

.video-card:hover .thumb img,
.video-card.active .thumb img {
  transform: scale(1.035);
}

.play-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #a06e16;
  font-size: 20px;
  font-weight: 800;
}

.series-badge {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}

.video-card h3 {
  display: -webkit-box;
  min-height: 42px;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.video-card p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-card {
  gap: 12px;
  padding: 12px;
}

.playlist-card h3 {
  min-height: auto;
  font-size: 17px;
  font-weight: 800;
}

.playlist-card p {
  font-size: 13px;
}

.playlist-thumb::before {
  background: linear-gradient(180deg, transparent 58%, rgba(0, 0, 0, 0.68) 100%);
}

.playlist-count {
  position: absolute;
  right: 9px;
  bottom: 9px;
  z-index: 2;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
}

.empty-state {
  margin: 28px 0 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(90vw, 380px);
    height: 100dvh;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 0;
    padding: 16px 14px 24px;
    transform: translateX(-104%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.28);
  }

  .menu-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: grid;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  body.menu-open {
    overflow: hidden;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  .brand {
    grid-template-columns: 118px minmax(0, 1fr);
    align-items: center;
    padding: 4px 50px 16px 6px;
  }

  .brand-logo {
    max-width: 118px;
  }

  .brand-copy {
    border-top: 0;
    padding-top: 0;
  }

  .category-list {
    display: grid;
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 112px);
    overflow: auto;
    padding-right: 2px;
  }

  .category-button {
    width: auto;
  }

  .category-button.has-thumb {
    grid-template-columns: 104px minmax(0, 1fr) auto;
  }

  .category-button-child {
    min-height: 78px;
  }

  .nav-thumb {
    width: 104px;
  }

  .menu-toggle {
    display: grid;
  }

  .topbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
  }

  .site-title {
    grid-column: 2 / 4;
    min-width: 0;
  }

  .site-title strong {
    font-size: 21px;
  }

  .search-box {
    grid-column: 1 / 3;
    margin-left: 0;
    width: 100%;
  }

  #clearSearch {
    grid-column: 3;
  }

  .watch-area,
  .hero-banner,
  .browse-area {
    padding-left: 16px;
    padding-right: 16px;
  }

  .player-frame {
    min-height: 190px;
  }
}

@media (max-width: 560px) {
  .brand {
    padding-bottom: 14px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }
}
