:root {
  color-scheme: dark;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: #0b0b12;
  color: #f4f1f8;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 280px;
  background:
    radial-gradient(circle at 92% -8%, #3c204f 0, transparent 32rem),
    radial-gradient(circle at 6% 18%, #1a233e 0, transparent 30rem),
    #0b0b12;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }

.app-shell {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 56px);
}

.provider {
  margin: 0;
  padding: 22px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  color: #e7e1ef;
  font-size: clamp(1rem, 1.65vw, 1.15rem);
  letter-spacing: .02em;
}

.provider a {
  color: #e0baff;
  text-decoration-color: #aa6bdd;
  text-underline-offset: .22em;
  font-weight: 700;
}

.provider a:hover { color: #fff; }
.provider a:focus-visible, button:focus-visible { outline: 2px solid #e0baff; outline-offset: 4px; }

.hero {
  min-height: 280px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 52px 0 45px;
}

.eyebrow {
  margin: 0 0 12px;
  color: #b694d8;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .2em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(2.7rem, 6vw, 5.6rem); line-height: 1.08; letter-spacing: -.055em; }
.hero-copy { margin-bottom: 0; color: #a9a8b8; font-size: clamp(.98rem, 1.5vw, 1.12rem); }

.video-count {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 6px;
  padding: 15px 18px;
  border: 1px solid rgba(224, 186, 255, .23);
  border-radius: 18px;
  background: rgba(138, 87, 181, .12);
  white-space: nowrap;
}
.video-count strong { font-size: 2rem; line-height: 1; }
.video-count span { color: #bcb5c9; font-size: .86rem; }

.player-panel {
  margin: 0 0 56px;
  padding: clamp(16px, 3vw, 30px);
  border: 1px solid rgba(224, 186, 255, .22);
  border-radius: 25px;
  background: rgba(26, 24, 37, .9);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .25);
  scroll-margin-top: 20px;
}

.player-heading, .section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}
.player-heading { margin-bottom: 18px; }
.player-heading h2 { margin-bottom: 0; font-size: clamp(1.1rem, 2.5vw, 1.6rem); overflow-wrap: anywhere; }
.position-text { color: #bcb5c9; white-space: nowrap; font-variant-numeric: tabular-nums; }

.video-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
  border-radius: 17px;
  overflow: hidden;
  background: #050509;
}
.video-frame video {
  display: block;
  width: min(100%, 430px);
  max-height: min(72vh, 780px);
  aspect-ratio: 416 / 752;
  object-fit: contain;
  background: #050509;
}

.player-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}
.player-navigation { display: flex; flex-wrap: wrap; gap: 10px; }
.control-button {
  cursor: pointer;
  padding: 10px 16px;
  border: 1px solid #49435c;
  border-radius: 11px;
  background: #2b2837;
  color: #f4f1f8;
  transition: border-color .18s ease, background .18s ease;
}
.control-button:hover:not(:disabled) { border-color: #b694d8; background: #393047; }
.control-button:disabled { opacity: .42; cursor: not-allowed; }
.control-button-primary { border-color: #bb8ce4; background: #724998; }
.player-status { margin: 0; color: #d7cce0; font-size: .9rem; text-align: right; }
.player-status[data-kind="error"] { color: #ffb3b3; }
.player-status[data-kind="warning"] { color: #f4d59c; }
.player-status[data-kind="complete"] { color: #c7e4cb; }

.library { padding-bottom: 70px; }
.section-heading { margin-bottom: 26px; }
.section-heading h2 { margin-bottom: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.03em; }
.list-hint { margin-bottom: 2px; color: #a9a8b8; font-size: .9rem; }

.video-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 25px);
}
.video-card {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.thumbnail {
  position: relative;
  display: block;
  aspect-ratio: 416 / 752;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 15px;
  background: linear-gradient(145deg, #3c2d55, #181c30 52%, #2f243d);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.video-card:hover .thumbnail, .video-card:focus-visible .thumbnail {
  transform: translateY(-4px);
  border-color: rgba(224, 186, 255, .75);
  box-shadow: 0 16px 30px rgba(0, 0, 0, .3);
}
.video-card.is-active .thumbnail { border-color: #d9a6ff; box-shadow: 0 0 0 2px rgba(217, 166, 255, .32); }
.thumbnail-image { width: 100%; height: 100%; object-fit: cover; }
.thumbnail-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .48);
  font-size: 2rem;
}
.card-number {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(5, 5, 9, .72);
  color: #f4f1f8;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
}
.card-play {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(245, 241, 249, .93);
  color: #24202f;
  font-size: .85rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, .3);
}
.card-name {
  display: block;
  padding: 12px 3px 0;
  overflow: hidden;
  color: #ddd8e5;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .94rem;
  font-weight: 600;
}
.video-card.is-active .card-name { color: #e0baff; }

.empty-state {
  margin: 20px 0 80px;
  padding: 68px 20px;
  border: 1px dashed #665575;
  border-radius: 20px;
  background: rgba(26, 24, 37, .75);
  text-align: center;
}
.empty-state > span { display: inline-block; margin-bottom: 18px; color: #b694d8; font-size: 2.2rem; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { margin-bottom: 0; color: #a9a8b8; }
.page-footer { padding: 25px 0 35px; border-top: 1px solid rgba(255,255,255,.1); color: #7e7b8b; font-size: .75rem; letter-spacing: .12em; }
.noscript-message { margin: 0; padding: 14px; background: #493d59; text-align: center; }

@media (max-width: 1100px) { .video-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .hero { min-height: 230px; padding: 44px 0 36px; }
  .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .player-footer { align-items: start; flex-direction: column; }
  .player-status { text-align: left; }
}
@media (max-width: 540px) {
  .provider { padding: 18px 0; font-size: .95rem; }
  .hero { display: block; min-height: 0; }
  .video-count { display: inline-flex; margin: 26px 0 0; }
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-heading { align-items: start; flex-direction: column; gap: 6px; }
  .list-hint { margin: 0; }
  .card-play { width: 34px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  .thumbnail, .control-button { transition: none; }
  .video-card:hover .thumbnail, .video-card:focus-visible .thumbnail { transform: none; }
}
