:root {
  --portal-width: 1240px;
  --portal-shadow: 0 12px 35px rgba(16, 37, 63, .08);
}

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body > main { flex: 1 0 auto; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: .5rem;
  left: .5rem;
  padding: .65rem .9rem;
  color: #fff;
  background: var(--navy);
  border-radius: 6px;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.portal-header {
  position: sticky;
  z-index: 20;
  top: 0;
  flex-shrink: 0;
  min-height: 72px;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .2s ease;
}

.portal-header.scrolled { box-shadow: 0 5px 22px rgba(16, 37, 63, .09); }

.portal-header-inner {
  width: min(100% - 2rem, var(--portal-width));
  min-height: 72px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.portal-brand { flex: 0 0 auto; }
.portal-brand .system-logo { width: 162px; }

.portal-navigation {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .25rem;
}

.portal-navigation a {
  padding: .55rem .7rem;
  color: var(--navy);
  border-radius: 7px;
  font-size: .92rem;
  font-weight: 680;
}

.portal-navigation a:hover { background: #edf5fb; text-decoration: none; }
.portal-navigation a.active { color: var(--blue); background: #eaf5fd; }
.portal-navigation .nav-login { margin-left: .35rem; border: 1px solid var(--line); }

.nav-toggle { display: none; }

.portal {
  width: min(100% - 2rem, var(--portal-width));
  margin: 0 auto;
  padding-bottom: 3.5rem;
}

.portal-intro {
  padding: clamp(2.25rem, 5vw, 4.1rem) 0 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 560px);
  align-items: end;
  gap: 3rem;
}

.eyebrow,
.portal-category {
  margin: 0;
  color: var(--blue);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.portal-intro h1 {
  margin: .25rem 0 .65rem;
  color: var(--navy);
  font-size: clamp(2.4rem, 4.5vw, 3.5rem);
  line-height: 1.03;
  letter-spacing: -.035em;
}

.portal-intro > div > p:last-child {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.portal-notice {
  max-width: 610px;
  margin-top: .9rem;
  padding: .75rem .9rem;
  color: var(--navy);
  background: #edf6fc;
  border: 1px solid #c9e2f3;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
}

.portal-notice strong { display: block; margin-bottom: .15rem; font-size: .9rem; }
.portal-notice p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.4; }

.portal-search {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .25rem;
  padding: .3rem;
  background: #fff;
  border: 1px solid #b9c6d2;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(16, 37, 63, .05);
}

.portal-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20, 121, 201, .16); }
.portal-search input { min-width: 0; padding: .55rem .3rem; border: 0; outline: 0; }
.portal-search input:focus-visible { outline: 0; }
.search-icon { padding-left: .55rem; color: var(--muted); font-size: 1.35rem; line-height: 1; }
.search-clear { width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); border-radius: 50%; font-size: 1.35rem; }
.search-clear:hover { background: var(--bg); text-decoration: none; }
.portal-search button { min-height: 42px; padding-inline: 1.05rem; }

.category-filter {
  padding: .9rem 0;
  display: flex;
  align-items: center;
  gap: .8rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.category-label { flex: 0 0 auto; color: var(--navy); font-size: .82rem; font-weight: 800; }
.category-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.category-chips a { padding: .35rem .65rem; color: var(--navy); background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: .84rem; font-weight: 650; white-space: nowrap; }
.category-chips a:hover { border-color: #9eb1c2; text-decoration: none; }
.category-chips a.active { color: #fff; background: var(--navy); border-color: var(--navy); }
.category-chips span { margin-left: .2rem; opacity: .7; font-variant-numeric: tabular-nums; }

.results {
  min-height: 65px;
  padding: 1.1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: .9rem;
}

.results strong { color: var(--navy); }

.portal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.35rem;
  align-items: start;
}

.portal-card {
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 5px 22px rgba(16, 37, 63, .045);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.portal-card:hover { transform: translateY(-2px); border-color: #c4d1dc; box-shadow: var(--portal-shadow); }
.portal-card:focus-within { outline: 3px solid #f9b233; outline-offset: 3px; }
.portal-card:focus-within a { outline: none; }

.portal-poster {
  position: relative;
  aspect-ratio: 16 / 9;
  display: block;
  overflow: hidden;
  background: #07111b;
}

.portal-poster img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .25s ease; }
.portal-card:hover .portal-poster img { transform: scale(1.018); }

.play-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: rgba(255, 255, 255, .94);
  border-radius: 50%;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .24);
  transform: translate(-50%, -50%);
}

.duration {
  position: absolute;
  right: .55rem;
  bottom: .5rem;
  padding: .15rem .35rem;
  color: #fff;
  background: rgba(5, 9, 13, .84);
  border-radius: 4px;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}

.portal-card-body { padding: 1rem; }
.portal-card-body h2 { margin: .25rem 0 .4rem; font-size: 1.12rem; line-height: 1.32; }
.portal-card-body h2 a { color: var(--navy); display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.portal-card-body h2 a:hover { color: var(--blue); text-decoration: none; }
.card-description { margin: 0 0 .8rem; color: var(--muted); display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: .91rem; }
.portal-card-meta { padding-top: .75rem; display: flex; justify-content: space-between; gap: .5rem; color: var(--muted); border-top: 1px solid var(--line); font-size: .79rem; }

.portal-empty { max-width: 660px; margin: 1rem 0; padding: 2rem; }
.portal-empty h2 { margin-top: 0; color: var(--navy); }

.watch { min-height: 0; background: var(--bg); }
.watch-inner { width: min(100% - 2rem, 1120px); max-width: none; margin: auto; padding: 2rem 0 3.5rem; }
.watch-nav { margin-bottom: 1rem; }
.watch-nav a { padding: .35rem 0; display: inline-flex; color: var(--navy); font-weight: 700; }
.watch-heading { max-width: 880px; margin-bottom: 1.4rem; }
.watch-heading h1 { margin: .3rem 0 .55rem; color: var(--navy); font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -.025em; }
.watch-heading .lead { max-width: 760px; margin: 0 0 .65rem; color: var(--muted); font-size: 1.08rem; }
.meta { margin: 0; display: flex; flex-wrap: wrap; gap: .45rem; color: var(--muted); font-size: .88rem; }
.watch .dwo-player { width: 100%; border-radius: 10px; box-shadow: 0 14px 38px rgba(16, 37, 63, .18); }

.share-panel {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem 1.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.share-panel > div:first-child { margin-right: auto; }
.share-panel h2 { margin: 0; color: var(--navy); font-size: 1rem; }
.share-panel > div:first-child p { margin: .1rem 0 0; color: var(--muted); font-size: .8rem; }
.share-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
.share-actions a,
.share-actions button { min-height: 42px; padding: .5rem .75rem; display: inline-flex; align-items: center; justify-content: center; color: var(--navy); background: #edf2f6; border-radius: 7px; font-size: .84rem; font-weight: 700; }
.share-actions a:hover { background: #e1eaf1; text-decoration: none; }
.share-actions button:last-child { color: #fff; background: var(--blue); }
.share-status { flex-basis: 100%; margin: 0; color: var(--muted); font-size: .82rem; }
.share-status:empty { display: none; }

.watch-grid { margin-top: 1.5rem; grid-template-columns: minmax(0, 2fr) minmax(250px, .8fr); gap: 1.5rem; }
.description { max-width: 75ch; }
.description h2 { margin: 0 0 .5rem; color: var(--navy); font-size: 1.25rem; }
.description > p { margin-top: 0; }
.reactions { margin: 1.5rem 0 0; padding: .8rem; box-shadow: none; }
.public-list { padding: 1rem; align-self: start; }
.related { margin-top: 1.75rem; }

.portal-footer {
  flex-shrink: 0;
  padding: .4rem 0;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--line);
  text-align: left;
}

.portal-footer-inner {
  width: min(100% - 2rem, var(--portal-width));
  margin: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .6rem;
}

.footer-brand { display: flex; align-items: center; gap: .4rem; color: var(--navy); font-size: .72rem; font-weight: 650; line-height: 1.2; }
.footer-brand img { width: 72px; height: auto; }
.portal-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: .25rem .75rem; line-height: 1.2; }
.portal-footer nav a { color: var(--navy); font-size: .76rem; }
.portal-footer p { margin: 0; font-size: .72rem; line-height: 1.2; white-space: nowrap; }

@media (max-width: 1050px) {
  .portal-navigation { gap: 0; }
  .portal-navigation a { padding-inline: .5rem; font-size: .85rem; }
  .portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-intro { grid-template-columns: 1fr minmax(340px, .9fr); gap: 2rem; }
  .portal-footer-inner { grid-template-columns: 1fr auto; }
  .portal-footer nav { grid-row: 2; grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 820px) {
  .portal-header-inner { justify-content: space-between; }
  .nav-toggle { width: 44px; height: 44px; padding: 10px; display: grid; align-content: center; gap: 5px; background: transparent; }
  .nav-toggle span:not(.visually-hidden) { width: 100%; height: 2px; display: block; background: var(--navy); transition: transform .2s ease, opacity .2s ease; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .portal-navigation { position: absolute; top: 72px; left: 0; right: 0; padding: .65rem 1rem 1rem; display: none; align-items: stretch; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--portal-shadow); }
  .portal-navigation.open { display: grid; }
  .portal-navigation a { min-height: 44px; padding: .7rem; display: flex; align-items: center; font-size: .95rem; }
  .portal-navigation .nav-login { margin: .3rem 0 0; }
  .portal-intro { grid-template-columns: 1fr; gap: 1.4rem; }
  .watch-grid { grid-template-columns: 1fr; }
  .share-panel { align-items: flex-start; flex-direction: column; }
  .share-actions { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .portal-header-inner,
  .portal,
  .watch-inner,
  .portal-footer-inner { width: min(100% - 1.25rem, var(--portal-width)); }
  .portal-brand .system-logo { width: 145px; }
  .portal-intro { padding-top: 2rem; }
  .portal-intro h1 { font-size: clamp(2.1rem, 10vw, 2.5rem); }
  .portal-search { grid-template-columns: auto minmax(0, 1fr) auto; }
  .portal-search button { grid-column: 1 / -1; width: 100%; }
  .category-filter { display: block; overflow: hidden; }
  .category-label { display: block; margin-bottom: .55rem; }
  .category-chips { margin: 0 -.625rem; padding: 0 .625rem .3rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .results { min-height: 0; padding-block: 1rem; align-items: flex-start; flex-direction: column; gap: .2rem; }
  .portal-grid { grid-template-columns: 1fr; }
  .portal-card-meta { justify-content: flex-start; }
  .watch-inner { padding-top: 1.25rem; }
  .watch-heading h1 { font-size: 2rem; }
  .share-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .share-actions > * { text-align: center; }
  .reactions { align-items: flex-start; }
  .portal-footer-inner { display: flex; align-items: flex-start; flex-direction: column; gap: .3rem; }
  .portal-footer nav { justify-content: flex-start; }
  .portal-footer p { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
