:root {
  color-scheme: dark;
  --background: #0b0b0d;
  --panel: #17171b;
  --panel-raised: #202026;
  --text: #f7f5ef;
  --muted: #aaa8a1;
  --accent: #ff3b30;
  --gold: #ffd34e;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 59, 48, 0.17), transparent 42%),
    var(--background);
  color: var(--text);
  font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 44px 0;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.video-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.video-card:hover { transform: translateY(-3px); }

.video-card.winner {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 18px 60px rgba(255, 211, 78, 0.2);
}

.thumbnail-link {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #25252a;
}

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

.thumbnail-link:hover img { transform: scale(1.025); }

.rank {
  position: absolute;
  top: 14px;
  left: 14px;
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 50%;
  background: rgba(11, 11, 13, 0.88);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  backdrop-filter: blur(8px);
}

.crown {
  position: absolute;
  z-index: 2;
  top: 13px;
  right: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--gold);
  color: #221a00;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.crown-symbol { font-size: 20px; line-height: 1; }

.card-body { padding: 20px 21px 22px; }

.video-title {
  min-height: 2.8em;
  margin: 0 0 18px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.4;
  letter-spacing: -0.025em;
}

.view-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.view-count {
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.055em;
}

.view-label { margin-left: 6px; color: var(--muted); font-size: 13px; }

.published {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  line-height: 1.55;
}

.difference {
  margin: 14px 0 0;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 13px;
}

.winner .difference { color: var(--gold); font-weight: 800; }

.loading { min-height: 420px; }
.loading .thumbnail, .loading .card-body {
  background: linear-gradient(100deg, #17171b 25%, #24242a 42%, #17171b 60%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
.loading .thumbnail { aspect-ratio: 16 / 9; }
.loading .card-body { height: 150px; margin: 20px; padding: 0; border-radius: 9px; }

.error-message {
  width: min(520px, 100%);
  margin: 28px auto 0;
  padding: 16px 18px;
  border: 1px solid rgba(255, 59, 48, 0.5);
  border-radius: 12px;
  background: rgba(255, 59, 48, 0.1);
  color: #ffaaa5;
  text-align: center;
}

@keyframes shimmer { to { background-position-x: -200%; } }

@media (max-width: 760px) {
  main { width: min(100% - 24px, 1180px); padding: 22px 0; }
  .video-grid { grid-template-columns: 1fr; gap: 16px; }
  .loading { min-height: 330px; }
}

@media (max-width: 420px) {
  .card-body { padding: 17px; }
  .view-row { align-items: start; flex-direction: column; gap: 10px; }
  .published { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .video-card, .thumbnail-link img { transition: none; }
  .loading .thumbnail, .loading .card-body { animation: none; }
}
