/* ========================================
   STAGEBILL - Netflix-style OTT Design
   ======================================== */

:root {
  --bg-primary: #141414;
  --bg-secondary: #1a1a1a;
  --bg-card: #222;
  --bg-hover: #333;
  --text-primary: #fff;
  --text-secondary: #b3b3b3;
  --text-muted: #777;
  --accent: #E50914;
  --accent-hover: #f40612;
  --gradient-hero: linear-gradient(to top, var(--bg-primary) 0%, transparent 60%);
  --gradient-hero-left: linear-gradient(to right, var(--bg-primary) 30%, transparent 70%);
  --card-radius: 6px;
  --modal-radius: 12px;
  --transition: 0.3s ease;
  --nav-height: 68px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans KR', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #888;
}

/* ========== Navbar ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: transparent;
  transition: background var(--transition);
  padding: 0 4%;
  display: flex;
  flex-direction: column;
}

.navbar.scrolled {
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

/* Top row: Logo + right controls */
.nav-top {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Category links row (PC: same line as logo; Mobile: own row) */
.nav-links {
  display: flex;
  list-style: none;
  gap: 24px;
  /* On PC, pull into the same visual row by adding left margin after logo */
  margin-left: 40px;
  /* Visually inline with logo on desktop via flex in nav-top */
  align-items: center;
  height: var(--nav-height);
}

/* Logo */
.logo {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 3px;
  cursor: pointer;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.logo:hover {
  transform: scale(1.05);
}

/* We'll keep nav-links in a second row by default and override for desktop */
.nav-links {
  height: auto;
  margin-left: 0;
  padding: 0 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
  gap: 20px;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 400;
  transition: color var(--transition);
  position: relative;
  padding-bottom: 4px;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* On desktop, collapse the second nav-links row into the top row */
@media (min-width: 769px) {
  .navbar {
    flex-direction: row;
    align-items: center;
    height: var(--nav-height);
    padding: 0 4%;
  }

  .nav-top {
    height: auto;
    flex: 0 0 auto;
    gap: 40px;
  }

  .nav-links {
    flex: 1;
    height: auto;
    padding: 0;
    overflow-x: visible;
    flex-wrap: nowrap;
    gap: 24px;
    border-top: none;
    padding-bottom: 0;
    order: 0;
    margin-left: 48px;
  }

  .nav-right {
    order: 1;
    margin-left: auto;
  }
}

/* ========== Language Switcher ========== */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 3px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.5px;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ========== Search ========== */
.search-container {
  display: flex;
  align-items: center;
  position: relative;
}

.search-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.search-btn:hover {
  color: var(--accent);
}

.search-input {
  width: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: width 0.4s ease, padding 0.4s ease, background 0.4s ease;
}

.search-container.active .search-input {
  width: 280px;
  padding: 8px 14px;
  background: rgba(0,0,0,0.75);
  border: 1px solid var(--text-muted);
  border-radius: 4px;
}

.search-container.active .search-input:focus {
  border-color: var(--text-primary);
}

/* ========== Hero Banner ========== */
.hero {
  position: relative;
  width: 100%;
  height: 85vh;
  min-height: 500px;
  max-height: 800px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  /* 자동 슬라이드 페이드 전환 */
  transition: opacity 0.42s ease;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(20,20,20,0.9) 0%,
    rgba(20,20,20,0.4) 50%,
    rgba(20,20,20,0.2) 100%);
  z-index: 1;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(to top, var(--bg-primary) 0%, transparent 100%);
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  padding: 0 4% 8%;
  max-width: 700px;
}

/* ── Hero navigation arrows ── */
.hero-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: background 0.2s, opacity 0.2s, transform 0.2s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.hero-nav-btn:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: translateY(-50%) scale(1.08);
}
.hero-nav-btn.disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}
.hero-prev { left: 20px; }
.hero-next { right: 20px; }


.hero-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 3px;
  letter-spacing: 1px;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.hero-title {
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 12px;
  text-shadow: 2px 4px 12px rgba(0,0,0,0.6);
}

.hero-hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.hero-hashtags .hashtag {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.1);
  padding: 3px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
}

.hero-hashtags .hashtag:hover {
  background: var(--accent);
  color: white;
}

.hero-description {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: rgba(255,255,255,0.8);
}

.btn-secondary {
  background: rgba(109, 109, 110, 0.7);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(109, 109, 110, 0.5);
}

/* ========== Content Rows ========== */
.content-area {
  position: relative;
  z-index: 4;
  margin-top: -80px;
  padding-bottom: 60px;
}

.content-row {
  margin-bottom: 40px;
  padding: 0 4%;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4%;
}

.content-row .row-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.row-slider-wrap {
  position: relative;
}

.row-slider {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 10px;
}

.row-slider::-webkit-scrollbar {
  display: none;
}

/* ── Row nav arrows (desktop) ── */
.row-nav-btn {
  position: absolute;
  top: 0;
  bottom: 10px; /* matches row-slider padding-bottom */
  width: 72px;
  border: none;
  cursor: pointer;
  z-index: 5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.row-nav-btn svg {
  background: rgba(30, 30, 30, 0.75);
  border-radius: 50%;
  padding: 8px;
  width: 44px;
  height: 44px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.row-nav-btn:hover svg {
  background: rgba(229, 9, 20, 0.85);
  transform: scale(1.12);
}
.row-nav-prev {
  left: 0;
  background: linear-gradient(to right, rgba(20,20,20,0.92) 25%, transparent);
}
.row-nav-next {
  right: 0;
  background: linear-gradient(to left,  rgba(20,20,20,0.92) 25%, transparent);
}
/* Show on row hover, hide when at boundary */
.content-row:hover .row-nav-btn:not(.row-nav-hidden) {
  opacity: 1;
  pointer-events: auto;
}
.row-nav-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ========== Cards ========== */
.card {
  flex: 0 0 auto;
  width: 250px;
  border-radius: var(--card-radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  scroll-snap-align: start;
  position: relative;
  background: var(--bg-card);
}

.card:hover {
  transform: scale(1.08);
  z-index: 10;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.card-thumbnail {
  width: 100%;
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.card-thumbnail .card-title-display {
  font-size: 1.5rem;
  font-weight: 900;
  text-align: center;
  padding: 20px;
  text-shadow: 1px 2px 6px rgba(0,0,0,0.5);
  z-index: 2;
  position: relative;
}

.card-thumbnail .card-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.15;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.2) 0%, transparent 50%);
}

.card-thumbnail.has-image {
  background: var(--bg-card);
}

.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.card-info {
  padding: 12px;
}

.card-info-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-info-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-category-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
  color: white;
}

.card-hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.card-hashtags .hashtag-sm {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.card-hashtags .hashtag-sm:hover {
  color: var(--accent);
}

/* ========== Search Results ========== */
.search-results-section {
  position: relative;
  z-index: 5;
  padding: 100px 4% 40px;
}

.search-results-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
}

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

.card-grid .card {
  width: 100%;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.no-results h3 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--modal-radius);
  width: 100%;
  max-width: 850px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(0,0,0,0.8);
  animation: modalSlideUp 0.35s ease-out;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.modal-close:hover {
  background: var(--accent);
}

.modal-hero {
  position: relative;
  height: 300px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.modal-hero.has-image {
  height: 420px;
}

.modal-hero-gradient {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.modal-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 150px;
  background: linear-gradient(to top, var(--bg-secondary), transparent);
  z-index: 1;
}

.modal-hero-content {
  position: relative;
  z-index: 2;
  padding: 30px;
}

.modal-hero-content h1 {
  font-size: 2.4rem;
  font-weight: 900;
  margin-bottom: 10px;
  text-shadow: 2px 4px 10px rgba(0,0,0,0.5);
}

.modal-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-category {
  font-size: 0.8rem;
  padding: 3px 12px;
  border-radius: 3px;
  font-weight: 600;
  color: white;
}

.modal-curator,
.modal-year {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.modal-body {
  padding: 10px 30px 40px;
}

.modal-section {
  margin-bottom: 30px;
}

.modal-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-section h3::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.modal-section p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

/* Number List */
.number-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.number-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  transition: background var(--transition);
}

.number-item:hover {
  background: rgba(255,255,255,0.1);
}

.number-index {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 24px;
  text-align: center;
  line-height: 1.4;
  flex-shrink: 0;
}

.number-info {
  flex: 1;
}

.number-info .number-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.number-info .number-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Idea Notes */
.idea-note {
  background: rgba(255,255,255,0.05);
  border-left: 3px solid var(--accent);
  padding: 18px 22px;
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

/* Playlist Link */
.playlist-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
  background: rgba(255,0,0,0.15);
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background var(--transition);
}

.playlist-link:hover {
  background: rgba(255,0,0,0.3);
}

/* Reference Links */
.reference-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reference-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  background: rgba(255,255,255,0.05);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  border: 1px solid rgba(255,255,255,0.08);
  transition: all var(--transition);
  width: fit-content;
}

.reference-link:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.2);
}

.reference-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

/* YouTube embed */
.video-embed-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  margin-top: 8px;
  background: #000;
}

.video-embed-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

.ref-embed-item {
  margin-bottom: 16px;
}

.ref-embed-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.ref-embed-title svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.ref-embed-link {
  color: var(--text-secondary);
  text-decoration: none;
}

.ref-embed-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Hashtags */
.hashtag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hashtag-list .hashtag {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.08);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.hashtag-list .hashtag:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ========== Footer ========== */
.footer {
  border-top: 1px solid #333;
  padding: 40px 4%;
  text-align: center;
}

.footer-logo {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.footer-description {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.footer-copyright {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.footer-copyright a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-copyright a:hover {
  color: var(--accent);
}

/* ========== Category Colors ========== */
.category-과학 { background: #00ACC1; }
.category-가족 { background: #FF7043; }
.category-진로 { background: #43A047; }
.category-힐링 { background: #7E57C2; }
.category-일상 { background: #1E88E5; }
.category-성장 { background: #F4511E; }
.category-결실 { background: #8D6E63; }
.category-컬러 { background: #E91E63; }

/* ========== Sibling Category Switcher ========== */
.modal-sibling-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 24px;
}

.sibling-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
  flex-shrink: 0;
}

.modal-sibling-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sibling-btn {
  border: none;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  color: #fff;
  opacity: 0.6;
}

.sibling-btn:hover:not([disabled]) {
  opacity: 1;
  transform: translateY(-2px);
}

.sibling-btn.current {
  opacity: 1;
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
  cursor: default;
}

/* ========== Responsive - Tablet (≤768px) ========== */
@media (max-width: 768px) {
  /* Navbar: two-row layout (top: logo+controls, bottom: category links) */
  .navbar {
    flex-direction: column;
    padding: 0 4%;
  }

  .nav-top {
    height: 56px;
  }

  .nav-links {
    height: auto;
    padding: 0 0 10px;
    gap: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  /* Push hero content down to account for taller navbar */
  .hero {
    height: 70vh;
    min-height: 380px;
    padding-top: 104px; /* 56px top row + ~48px nav-links row */
    align-items: flex-end;
  }

  .hero-nav-btn {
    width: 40px;
    height: 40px;
  }
  .hero-prev { left: 10px; }
  .hero-next { right: 10px; }

  /* Row nav arrows: hidden on mobile (touch swipe handles it) */
  .row-nav-btn { display: none; }

  .hero-content {
    padding: 0 4% 10%;
    max-width: 100%;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-description {
    font-size: 0.9rem;
    -webkit-line-clamp: 2;
  }

  /* Buttons: side by side but smaller, not stacked */
  .hero-buttons {
    gap: 10px;
    flex-wrap: nowrap;
  }

  .btn-primary,
  .btn-secondary {
    padding: 10px 16px;
    font-size: 0.85rem;
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  /* Cards */
  .card {
    width: 180px;
  }

  .card-thumbnail .card-title-display {
    font-size: 1.1rem;
  }

  /* Modal */
  .modal-overlay {
    padding: 20px 12px;
    align-items: flex-end;
  }

  .modal {
    margin: 0;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    overflow-y: auto;
  }

  .modal-hero {
    height: 200px;
  }

  .modal-hero.has-image {
    height: 280px;
  }

  .modal-hero-content h1 {
    font-size: 1.6rem;
  }

  .modal-body {
    padding: 10px 20px 30px;
  }

  /* Search input */
  .search-container.active .search-input {
    width: 160px;
  }

  /* Content rows */
  .content-row .row-title {
    font-size: 1.1rem;
  }

  /* Fix: no negative overlap on mobile so content-area never covers hero buttons */
  .content-area {
    margin-top: 0;
    z-index: 3;
  }

  /* Lang switcher */
  .lang-btn {
    font-size: 0.68rem;
    padding: 4px 8px;
  }
}

/* ========== Responsive - Mobile (≤480px) ========== */
@media (max-width: 480px) {
  .nav-top {
    height: 50px;
  }

  .logo {
    font-size: 1.3rem;
    letter-spacing: 2px;
  }

  .nav-links {
    gap: 16px;
  }

  .nav-links a {
    font-size: 0.8rem;
  }

  .hero {
    height: 65vh;
    min-height: 360px;
    padding-top: 96px;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .hero-badge {
    font-size: 0.65rem;
  }

  /* Buttons stay side by side even on smallest screens */
  .btn-primary,
  .btn-secondary {
    padding: 9px 12px;
    font-size: 0.8rem;
    gap: 6px;
  }

  .btn-primary svg,
  .btn-secondary svg {
    width: 18px;
    height: 18px;
  }

  .card {
    width: 145px;
  }

  .card-thumbnail .card-title-display {
    font-size: 0.9rem;
    padding: 12px;
  }

  .card-info {
    padding: 8px;
  }

  .card-info-title {
    font-size: 0.8rem;
  }

  .card-info-meta {
    font-size: 0.68rem;
    gap: 4px;
  }

  .card-category-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
  }

  .search-container.active .search-input {
    width: 130px;
    font-size: 0.8rem;
  }

  .lang-switcher {
    gap: 2px;
  }

  .lang-btn {
    font-size: 0.65rem;
    padding: 3px 7px;
  }

  /* Modal on tiny screens */
  .modal-hero-content {
    padding: 20px;
  }

  .modal-hero-content h1 {
    font-size: 1.4rem;
  }

  .modal-body {
    padding: 10px 16px 24px;
  }

  .number-item {
    padding: 10px 12px;
    gap: 10px;
  }

  .content-area {
    margin-top: 0;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
}

/* ========== Landscape Mode (phone horizontal) ========== */
/* Targets phones in landscape where height is tight (≤500px) */
@media (orientation: landscape) and (max-height: 500px) {
  /* Revert navbar to single row — no room for two rows in landscape */
  .navbar {
    flex-direction: row;
    align-items: center;
    height: 50px;
    padding: 0 3%;
  }

  .nav-top {
    height: 50px;
    flex: 1;
    gap: 16px;
  }

  .nav-links {
    flex: 1;
    height: auto;
    padding: 0;
    border-top: none;
    overflow-x: auto;
    gap: 14px;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  /* Hero: compact, no fixed height */
  .hero {
    height: auto;
    min-height: 0;
    padding-top: 50px; /* match navbar height */
    padding-bottom: 0;
  }

  .hero-content {
    padding: 16px 4% 20px;
    max-width: 100%;
  }

  /* Hide long description to save space */
  .hero-description {
    display: none;
  }

  /* Buttons: always horizontal, compact */
  .hero-buttons {
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 12px;
  }

  .btn-primary,
  .btn-secondary {
    padding: 8px 14px;
    font-size: 0.82rem;
    flex: 0 0 auto;
  }

  /* Content starts right below hero — no overlap */
  .content-area {
    margin-top: 0;
    z-index: 3;
  }

  /* Cards slightly smaller in landscape */
  .card {
    width: 140px;
  }
}

/* ========== Loading Animation ========== */
.loading-shimmer {
  background: linear-gradient(90deg,
    var(--bg-card) 25%,
    rgba(255,255,255,0.05) 50%,
    var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ========== Page Transition ========== */
.fade-in {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================
   Upload Button & Modal
   ========================================== */

/* ── 업로드 버튼 ──────────────────────────────────── */
.upload-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
}
.upload-btn:hover { background: var(--accent-hover); }

/* 데스크톱: navbar 우측 끝 */
@media (min-width: 769px) {
  .upload-btn { margin-left: 20px; }
}

/* 모바일: 우하단 FAB */
@media (max-width: 768px) {
  .upload-btn {
    position: fixed;
    bottom: 22px;
    right: 18px;
    z-index: 999;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.45);
  }
  .upload-btn span { display: none; }
}

/* ── 업로드 오버레이 (전체화면 팝업) ──────────────── */
.upload-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.78);
  z-index: 2000;
  padding: 16px;
}
.upload-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal card */
.upload-modal {
  position: relative;
  background: #1e1e1e;
  border-radius: 12px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: modalSlideUp 0.25s ease;
}

.upload-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
}
.upload-close:hover { color: var(--text-primary); background: rgba(255,255,255,0.1); }

/* Password step */
.upload-modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-primary);
}
.upload-modal-sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 20px;
}
.upload-pwd-wrap {
  display: flex;
  gap: 10px;
}
.upload-pwd-input {
  flex: 1;
  padding: 10px 14px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
}
.upload-pwd-input:focus { border-color: var(--accent); }
.upload-pwd-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.upload-pwd-btn:hover { background: var(--accent-hover); }
.upload-pwd-error {
  color: #ff6b6b;
  font-size: 0.82rem;
  margin-top: 8px;
  min-height: 1.2em;
}

/* Form */
.upload-form { margin-top: 4px; }

.upload-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 14px 0 8px;
  border-bottom: 1px solid #333;
  margin-bottom: 12px;
  cursor: default;
  list-style: none;
}
details.upload-details > summary.upload-section-label { cursor: pointer; }
details.upload-details > summary.upload-section-label:hover { color: var(--text-primary); }
details.upload-details { margin-top: 4px; }

.upload-field {
  margin-bottom: 12px;
}
.upload-field label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.upload-field small { font-size: 0.72rem; opacity: 0.7; }
.req { color: var(--accent); }
.opt { color: #888; font-size: 0.78rem; font-weight: normal; }

.upload-field input[type="text"],
.upload-field input[type="url"],
.upload-field input[type="number"],
.upload-field input[type="password"],
.upload-pwd-input,
.upload-field select,
.upload-field textarea {
  width: 100%;
  padding: 9px 12px;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.upload-field input:focus,
.upload-field select:focus,
.upload-field textarea:focus { border-color: var(--accent); }
.upload-field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23999' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.upload-field select option { background: #2a2a2a; }
.upload-field textarea { resize: vertical; min-height: 70px; }

.upload-color { padding: 4px; height: 38px; cursor: pointer; }

.upload-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.upload-inline-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.upload-actions {
  margin-top: 20px;
  text-align: right;
}
.upload-submit-btn {
  padding: 11px 32px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}
.upload-submit-btn:hover { background: var(--accent-hover); }
.upload-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.upload-result {
  margin-top: 12px;
  font-size: 0.88rem;
  min-height: 1.4em;
}
.upload-result.success { color: #4caf50; }
.upload-result.error   { color: #ff6b6b; }

/* Google Form 임베드 */
.upload-modal { max-width: 720px; }
.upload-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.upload-newtab-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  transition: background 0.15s, color 0.15s;
}
.upload-newtab-link:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}
.upload-form-frame-wrap {
  position: relative;
  margin-top: 14px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  height: min(72vh, 720px);
}
#uploadFormFrame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@media (max-width: 480px) {
  .upload-modal { padding: 28px 18px 22px; }
  .upload-inline-2 { grid-template-columns: 1fr; }
  .upload-form-frame-wrap { height: 65vh; }
}
