/* Public site theme inspired by JavBus: red/yellow mark, light gray paper,
   thin-bordered poster cards and a pale blue announcement strip. */
:root {
  --ink: #333;
  --ink-deep: #222;
  --muted: #777;
  --line: #ddd;
  --paper: #eeeeeb;
  --card: #fafafa;
  --accent: #cc0000;
  --accent-dark: #a00000;
  --accent-soft: #f9eeee;
  --brand-yellow: #febe01;
  --focus: #cc0000;
  --header: 64px;
}

body.site-body {
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, "Helvetica Neue", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
textarea:focus-visible {
  outline-color: #cc000066;
}

.shell {
  width: min(1840px, calc(100% - 48px));
}

main {
  min-height: calc(100vh - 260px);
}

/* Keep the image channel at its intended reading width inside the wider shell. */
.image-page,
.image-detail-page {
  width: min(1200px, calc(100% - 48px));
}

/* Top bar */
.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  height: var(--header);
  border-bottom: 1px solid #ddd;
  background: #f5f5f3;
  box-shadow: none;
}

.nav-shell {
  width: min(1840px, 100%);
  margin: 0 auto;
  gap: 16px;
  padding: 0 24px;
}

.brand {
  flex: 0 0 auto;
  gap: 0;
}

.brand-word {
  display: flex;
  align-items: stretch;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.brand-word > .brand-red {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 4px 0 0 4px;
  background: #cc0000;
  color: #fff;
}

.brand-word > .brand-yellow {
  margin-left: -2px;
  padding: 7px 10px;
  border-radius: 0 4px 4px 0;
  background: var(--brand-yellow);
  color: #000;
}

.brand-flower {
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.search {
  flex: 0 0 auto;
  width: min(340px, 30vw);
  height: 40px;
  padding: 0 0 0 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
}

.search:focus-within {
  border-color: #999;
  background: #fff;
  box-shadow: none;
}

.search input {
  height: 38px;
  color: #333;
  font-size: 14px;
}

.search input::placeholder {
  color: #aaa;
}

.search button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 38px;
  padding: 0 15px;
  border-left: 1px solid #ccc;
  border-radius: 0 2px 2px 0;
  background: #eee;
  color: #333;
  font-size: 14px;
  white-space: nowrap;
}

.search button:hover {
  background: #e2e2df;
  color: #000;
}

.search button .icon {
  display: none;
}

.primary-nav {
  display: flex;
  flex: 1;
  align-items: stretch;
  align-self: stretch;
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.primary-nav a {
  display: inline-flex;
  align-items: center;
  height: var(--header);
  padding: 0 14px;
  border-radius: 0;
  background: transparent;
  color: #555;
  font-size: 16px;
  white-space: nowrap;
  transition: background-color .12s, color .12s;
}

.primary-nav a:hover {
  background: #e9e9e6;
  color: #000;
}

.primary-nav a[aria-current="page"] {
  background: #e6e6e3;
  color: #000;
  font-weight: 600;
}

.nav-menu {
  display: block;
  position: relative;
  align-self: stretch;
  flex: 0 0 auto;
  height: var(--header);
}

.nav-menu > summary,
.account-menu > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #555;
  list-style: none;
  cursor: pointer;
}

.nav-menu > summary {
  width: 44px;
}

.nav-menu > summary span {
  display: none;
}

.nav-menu > summary:hover,
.account-menu > summary:hover {
  background: #e9e9e6;
  color: #000;
}

.nav-menu > summary .icon,
.account-menu > summary .icon {
  width: 23px;
  height: 23px;
}

.nav-menu > summary::-webkit-details-marker,
.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu {
  position: relative;
  display: flex;
  align-items: center;
  align-self: stretch;
  flex: 0 0 auto;
  height: var(--header);
}

.account-menu > summary {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e4e4e1;
  overflow: hidden;
}

.header-avatar {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

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

.header-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% - 8px);
  right: 0;
  min-width: 196px;
  padding: 4px;
  border: 1px solid #ccc;
  border-radius: 0 0 3px 3px;
  background: #fff;
  box-shadow: 0 6px 18px rgb(0 0 0 / 12%);
}

.nav-menu .header-panel {
  right: 0;
  left: auto;
}

.header-panel a,
.header-panel button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #444;
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
}

.header-panel a:hover,
.header-panel button:hover {
  background: #efefec;
  color: var(--accent);
}

.header-panel form {
  margin: 0;
}

.nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  border-radius: 2px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
}

/* Page heading and announcement */
.listing-page {
  padding-top: 15px;
  padding-bottom: 40px;
  min-height: calc(100vh - var(--header) - 190px);
}

.site-announcement {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 15px;
  padding: 14px 42px 14px 20px;
  border: 1px solid #bce8f1;
  border-radius: 4px;
  background: #d3eaf5;
  color: #31708f;
  font-size: 15px;
  line-height: 1.6;
}

.site-announcement p {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.site-announcement strong {
  color: #333;
  font-weight: 700;
}

.site-announcement a {
  color: #337ab7;
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.site-announcement a:hover {
  color: #23527c;
}

.announcement-close {
  position: absolute;
  top: 7px;
  right: 9px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8aa3ae;
  font-size: 22px;
  line-height: 1;
}

.announcement-close:hover {
  color: #31708f;
}

.section-heading {
  align-items: flex-end;
  margin: 0 0 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid #ddd;
}

.section-heading h1 {
  position: static;
  margin: 0;
  padding: 0;
  border: 0;
  color: #333;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.section-heading h1::before {
  display: none;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.result-count {
  color: #999;
  font-size: 13px;
}

.heading-link {
  color: var(--accent);
  font-size: 13px;
  white-space: nowrap;
}

.heading-link:hover {
  color: var(--accent-dark);
}

/* Sort control */
.heading-actions form {
  margin: 0;
}

.sort-control label {
  color: #777;
  font-size: 13px;
}

.sort-control select {
  height: 32px;
  border-color: #ccc;
  border-radius: 2px;
  background: #fff;
  color: #333;
  font-size: 13px;
}

.sort-control select:focus {
  border-color: #999;
}

/* Poster cards */
.video-grid[data-masonry] {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  gap: 20px;
}

.video-grid[data-masonry].is-masonry-ready {
  grid-auto-rows: 1px;
  row-gap: 0;
}

.video-grid[data-masonry] .video-card {
  width: 100%;
  margin: 0;
  padding: 15px 15px 14px;
  overflow: hidden;
  border: 1px solid #ddd;
  border-radius: 2px;
  background: #fafafa;
  box-shadow: none;
  transition: border-color .12s;
}

.video-grid[data-masonry] .video-card:hover {
  border-color: #c3c3c0;
  box-shadow: none;
}

.video-grid[data-masonry] .cover-wrap {
  aspect-ratio: auto;
  overflow: hidden;
  border-radius: 0;
  background: #eee;
}

.video-grid[data-masonry] .cover-wrap img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: initial;
}

/* Reserve a poster-shaped area until each remote cover reports its real ratio. */
.video-grid[data-masonry] .cover-wrap img:not(.is-loaded) {
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.video-grid[data-masonry] .video-card:hover .cover-wrap img {
  transform: none;
}

.cover-play {
  display: none;
}

.duration {
  right: 7px;
  bottom: 7px;
  padding: 1px 5px;
  border-radius: 2px;
  background: rgb(0 0 0 / 68%);
  font-size: 11px;
}

.video-copy {
  padding: 12px 0 0;
}

.video-card h2 {
  margin: 0 0 9px;
  color: #333;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.8;
  overflow-wrap: anywhere;
  transition: color .12s;
}

.video-card:hover h2 {
  color: var(--accent);
}

.video-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  color: #777;
  font-size: 13px;
}

.video-category {
  max-width: 100%;
  overflow: hidden;
  padding: 2px 7px;
  border-radius: 3px;
  background: #7092b0;
  color: #fff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-meta time {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 3px;
  background: #d57572;
  color: #fff;
  font-size: 13px;
  font-variant-numeric: normal;
  white-space: nowrap;
}

/* Pagination */
.pagination {
  gap: 5px;
  margin-top: 24px;
}

.pagination a,
.pagination span {
  min-width: 38px;
  height: 38px;
  border-color: #ccc;
  border-radius: 2px;
  background: #fafafa;
  color: #555;
  font-size: 14px;
}

.pagination .selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination > span[aria-hidden="true"] {
  min-width: 20px;
  border: 0;
  background: transparent;
}

.pagination .icon {
  width: 15px;
  height: 15px;
}

/* Empty state and shared button */
.empty {
  border-color: #ddd;
  border-radius: 2px;
  background: #fafafa;
}

.empty-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.primary-button {
  border-radius: 2px;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

/* Footer */
.footer {
  margin-top: 34px;
  border-top: 0;
  padding: 28px 0;
  background: #222;
  color: #999;
}

.footer-inner {
  align-items: center;
}

.footer-brand-block {
  min-width: 0;
}

.footer-brand {
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -1px;
}

.footer-brand span {
  margin-left: 5px;
  color: #aaa;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .5px;
}

.footer-copy {
  margin: 5px 0 0;
  color: #8c8c8c;
  font-size: 12px;
}

.footer-links {
  gap: 22px;
  color: #aaa;
  font-size: 13px;
}

.footer-links a:hover,
.footer-links button:hover {
  color: #fff;
}

/* Detail page refinements */
.watch-page {
  padding-top: 20px;
}

.watch-screen {
  border-radius: 2px 2px 0 0;
}

.watch-toolbar {
  border-radius: 0 0 2px 2px;
}

.watch-recommendations {
  top: calc(var(--header) + 18px);
}

.watch-category {
  border-radius: 3px;
  background: #7092b0;
  color: #fff;
}

.watch-actions button {
  border-radius: 2px;
}

.watch-actions button:hover {
  border-color: #d9a2a6;
  color: var(--accent);
}

.watch-actions button[aria-pressed="true"] {
  border-color: #e3b4b8;
  background: var(--accent-soft);
  color: var(--accent);
}

.watch-resume {
  background: #d3eaf5;
  color: #31708f;
}

.watch-resume button {
  color: #31708f;
}

.watch-related-heading > a:hover,
.watch-related:hover h3,
.watch-related-empty a {
  color: var(--accent);
}

/* Responsive shell */
@media (min-width: 1600px) {
  .shell {
    width: min(1840px, calc(100% - 64px));
  }

  .video-grid[data-masonry] {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 1240px) {
  .video-grid[data-masonry] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .search {
    width: min(270px, 25vw);
  }

  .primary-nav a {
    padding: 0 10px;
    font-size: 14px;
  }
}

@media (max-width: 1000px) {
  .search {
    width: min(320px, 40vw);
  }

  .video-grid[data-masonry] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  :root {
    --header: 58px;
  }

  .topbar {
    height: auto;
  }

  .nav-shell {
    flex-wrap: wrap;
    height: auto;
    gap: 7px 8px;
    padding: 8px 12px 9px;
  }

  .brand-word {
    font-size: 21px;
  }

  .brand-word > .brand-red {
    padding: 6px 7px 6px 10px;
  }

  .brand-word > .brand-yellow {
    padding: 6px 10px 6px 7px;
  }

  .search {
    order: 4;
    flex: 1 0 100%;
    width: 100%;
    height: 38px;
    margin-top: 0;
  }

  .search input,
  .search button {
    height: 36px;
  }

  .nav-menu {
    order: 2;
    margin-left: auto;
  }

  .account-menu {
    order: 3;
  }

  .account-menu > summary {
    width: 34px;
    height: 34px;
  }

  .nav-menu > summary {
    width: 38px;
    height: 100%;
  }

  html {
    scroll-padding-top: 150px;
  }

  .shell {
    width: calc(100% - 24px);
  }

  .listing-page {
    padding-top: 10px;
    padding-bottom: 28px;
  }

  .site-announcement {
    gap: 7px;
    margin-bottom: 10px;
    padding: 10px 34px 10px 12px;
    font-size: 13px;
  }

  .announcement-close {
    top: 3px;
    right: 4px;
  }

  .section-heading {
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .heading-actions {
    gap: 10px;
  }

  .sort-control label {
    display: none;
  }

  .sort-control select {
    max-width: 118px;
  }

  .section-heading h1 {
    font-size: 18px;
  }

  .result-count {
    font-size: 12px;
  }


  .video-grid[data-masonry] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .video-grid[data-masonry] .video-card {
    padding: 9px 9px 10px;
  }

  .video-copy {
    padding-top: 9px;
  }

  .video-card h2 {
    margin-bottom: 7px;
    font-size: 13px;
    line-height: 1.7;
  }

  .video-meta {
    gap: 4px;
    font-size: 11px;
  }

  .video-category,
  .video-meta time {
    padding: 1px 5px;
    font-size: 11px;
  }

  .duration {
    font-size: 10px;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 4px;
  }

  .pagination a,
  .pagination span {
    min-width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .footer {
    margin-top: 24px;
    padding: 22px 0;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .watch-page {
    padding-top: 14px;
  }

  .watch-recommendations {
    top: auto;
  }
}

@media (max-width: 420px) {
  .video-grid[data-masonry] {
    gap: 10px;
  }
}

.header-notice {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #555;
  transition: background-color .12s, color .12s;
}

.header-notice:hover {
  background: #e9e9e6;
  color: #000;
}

.header-notice .icon {
  width: 22px;
  height: 22px;
}

.header-notice-count {
  position: absolute;
  top: 1px;
  right: -1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

@media (max-width: 700px) {
  .header-notice {
    order: 2;
    width: 34px;
    height: 34px;
  }

  .header-notice .icon {
    width: 20px;
    height: 20px;
  }
}
