/* The watch surface uses the reference's reading order with ASAPANIME's own
   emerald and violet identity. Player controls remain native and uncropped. */
body:has(#detailOverlay.open) { overflow: hidden; }
#authOverlay { z-index: 180; }
#authOverlay [hidden] { display: none !important; }
body:has(#detailOverlay.open) > :is(header.site, main, footer) { visibility: hidden; }
#detailOverlay {
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: #02090966;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overscroll-behavior: contain;
  scrollbar-color: #435b50 #08100e;
}
#detailOverlay .modal.watch {
  max-width: 1440px;
  padding: 0;
  background: #0b0d14;
  background-image: none;
  border: 1px solid #426654;
  border-radius: 20px;
  box-shadow: 0 18px 70px #0008, inset 0 1px #b5ffd622;
  min-width: 0;
}
#detailOverlay .watch-back {
  z-index: 4;
  top: 14px;
  left: 14px;
  right: auto;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 9px;
  border-radius: 50%;
  border: 1px solid #ffffff30;
  background: #07110ee8;
  color: #f1fff7;
  box-shadow: 0 2px 8px #0005;
  display: grid;
  place-items: center;
}
#detailOverlay .watch-back svg { width: 25px; height: 25px; }
#detailOverlay .watch-back:hover { background: #193c2e; border-color: #79efaf; }
#detailBody > :is(.empty,p) { padding: 70px 24px 24px; }
#detailBody .watch-grid { grid-template-columns: minmax(0, 1fr) minmax(290px, 340px); gap: 0; }
#detailBody .watch-main { grid-column: 1; min-width: 0; }
#detailBody .watch-poster-header {
  display: flex; align-items: center; gap: 15px; margin: 0;
  padding: 12px 24px 12px 76px; min-width: 0;
  background: #0d1915; border-bottom: 1px solid #294738;
  border-radius: 19px 0 0 0;
}
#detailBody .watch-compact-poster {
  display: block; width: 60px; height: 90px; flex: 0 0 60px;
  object-fit: contain; background: #07100c; border-radius: 5px;
}
#detailBody .watch-poster-header figcaption { display: grid; gap: 5px; min-width: 0; }
#detailBody .watch-poster-header figcaption > span { color: #9ebead; font-size: .8rem; }
#detailBody .watch-poster-header :is(a,strong) { color: #f0fff5; font-size: 1rem; line-height: 1.4; overflow-wrap: anywhere; }
#detailBody .watch-poster-header + .watch-player { border-radius: 0; }
#detailBody .watch-player {
  border: 0;
  border-radius: 19px 0 0 0;
  box-shadow: none;
  background: #000;
  isolation: isolate;
}
#detailBody .watch-player :is(video,img) { object-fit: contain; }
#detailBody .watch-player.audio { padding: 76px 24px 24px; }
.watch-playhead { position: absolute; height: 3px; inset: auto 0 0; background: #303943; pointer-events: none; z-index: 2; }
.watch-playhead span { position: absolute; inset: 0 auto 0 0; width: 0; }
.watch-buffered { background: #64736e; }
.watch-played { background: linear-gradient(90deg,#4ae596,#80ffc0); }
.watch-info { padding: 24px 28px 18px; }
#detailBody .watch-series {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  color: #79edb5;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 600;
  margin: 0 0 9px;
  overflow-wrap: anywhere;
}
#detailBody .watch-series a { color: inherit; text-decoration: none; }
#detailBody .watch-series a:hover { text-decoration: underline; text-underline-offset: 4px; }
#detailBody .watch-title {
  font-family: "Sora", system-ui, sans-serif;
  font-style: normal;
  font-size: clamp(1.4rem, 2.1vw, 2rem);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.3;
  text-shadow: none;
  color: #f5f6fb;
  margin: 0;
  overflow-wrap: anywhere;
}
#detailBody .watch-meta { display: flex; gap: 8px; flex-wrap: wrap; color: #a9afbe; font-size: 1rem; font-weight: 400; margin: 12px 0 0; }
#detailBody .watch-channel-row { border-block: 1px solid #ffffff13; padding-block: 20px; margin-top: 22px; gap: 12px; flex-wrap: nowrap; }
#detailBody .watch-channel-row .v-ava { flex: 0 0 auto; }
#detailBody .watch-channel-row .avatar { width: 48px; height: 48px; border: 1px solid #9cf4be38; box-shadow: none; }
#detailBody .wc-info { min-width: 0; flex: 1 1 auto; }
#detailBody .wc-name { font-size: 1.05rem; line-height: 1.35; overflow-wrap: anywhere; font-weight: 700; }
#detailBody .wc-subs { color: #a9afbe; font-size: .9rem; margin-top: 4px; }
#detailBody .wc-action { flex: 0 0 auto; margin: 0; }
#detailBody .sub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 23px;
  background: #7befb0;
  border: 1px solid #95ffc2;
  box-shadow: inset 0 1px #e0ffeb90, 0 3px 0 #184e34;
  font-style: normal;
  font-size: 1rem;
  color: #062416;
  white-space: nowrap;
}
#detailBody .sub-btn:hover { background: #a1ffc9; }
#detailBody .sub-btn.subscribed { background: #132a20; border-color: #548b6c; color: #bafad4; box-shadow: none; }
#detailBody .sub-note { display: inline-flex; align-items: center; min-height: 44px; font-size: .87rem; }
#detailBody .watch-actions { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
#detailBody .watch-actions :is(.icon-btn,.lib-btn), #detailBody .watch-more > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  border-radius: 999px;
  padding: 10px 15px;
  background: #0c0f16;
  border: 1px solid #505560;
  color: #eff0f6;
  box-shadow: none;
  font-size: .95rem;
  font-weight: 600;
  font-style: normal;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
#detailBody .watch-actions :is(.icon-btn,.lib-btn) svg { width: 21px; height: 21px; flex: none; }
#detailBody .watch-actions :is(.icon-btn,.lib-btn):hover, #detailBody .watch-more > summary:hover { border-color: #7befb0; background: #14231d; }
#detailBody .watch-actions :is(.icon-btn,.lib-btn)[aria-pressed="true"] { background: #123326; color: #a0ffca; border-color: #55b989; }
#detailBody .watch-actions .community-link { flex-basis: 100%; justify-content: flex-start; margin-top: 5px; padding: 8px 0; border: 0; background: none; color: #bdadf0; box-shadow: none; min-height: 44px; font-size: .95rem; }
.watch-more { position: relative; margin: 0; }
#detailBody .watch-more > summary { list-style: none; width: 46px; padding: 10px; }
.watch-more > summary::-webkit-details-marker { display: none; }
.watch-more > summary svg { width: 23px; height: 23px; }
.watch-more-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 9; width: 205px; max-width: 80vw; padding: 6px; background: #171d25; border: 1px solid #587566; border-radius: 13px; box-shadow: 0 12px 32px #0009; }
.watch-more-menu :is(button,a) { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 10px 12px; background: none; border: 0; color: #eefbf3; font-size: .95rem; text-align: left; text-decoration: none; border-radius: 8px; font-style: normal; }
.watch-more-menu :is(button,a):hover { background: #263c31; }
#detailBody .watch-side { grid-column: 2; grid-row: 1 / span 2; min-width: 0; padding: 24px 18px; border-left: 1px solid #ffffff13; align-self: stretch; }
.watch-side-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.watch-side-heading h4 { color: #bd9bff; font-family: inherit; font-size: 1.15rem; font-weight: 750; font-style: normal; letter-spacing: .09em; text-transform: uppercase; margin: 0; text-shadow: none; }
.watch-side-heading > span { font-size: .85rem; color: #a2acb6; }
#detailBody .chips { margin: 14px 0; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
#detailBody .chips button { flex: 0 0 auto; max-width: 100%; min-height: 40px; padding: 8px 13px; border-radius: 999px; border: 1px solid #363d49; font-size: .9rem; font-style: normal; background: #151923; color: #b9c1ce; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#detailBody .chips button[aria-pressed="true"] { color: #c2ffe0; background: #193c2c; border-color: #508b6c; }
#detailBody .upnext-row {
  display: grid;
  grid-template-columns: 43% minmax(0,1fr);
  gap: 12px;
  width: 100%;
  padding: 10px;
  margin: 0 0 10px;
  border: 1px solid #353543;
  border-radius: 14px;
  background: #12151e;
  color: #f4f5f8;
  text-align: left;
  font: inherit;
  font-style: normal;
  box-shadow: none;
}
#detailBody .upnext-row:hover { border-color: #a680f4; background: #1b1c2c; }
#detailBody .upnext-thumb { width: 100%; display: block; align-self: start; aspect-ratio: 16/9; border-radius: 8px; border: 0; background: #080a0f; }
#detailBody .upnext-meta { display: grid; align-content: start; gap: 4px; min-width: 0; }
#detailBody .upnext-meta :is(.u-context,.u-sub,.u-chan) { display: block; color: #aab2c3; font-size: .82rem; line-height: 1.35; }
#detailBody .upnext-meta .u-context { color: #b8a3e2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#detailBody .upnext-meta .u-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .95rem; font-weight: 700; line-height: 1.35; }
.watch-next-card { display: grid; grid-template-columns: 43% minmax(0,1fr); gap: 12px; width: 100%; text-align: left; padding: 11px; border-radius: 15px; background: #13251d; border: 1px solid #73e6a4; color: #f0fff5; font: inherit; box-shadow: inset 0 0 0 2px #41815b24; cursor: pointer; }
.watch-next-card:hover { background: #1c3628; }
.watch-next-art { display: block; position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; align-self: center; background: #060c08; }
.watch-next-art img { width: 100%; height: 100%; object-fit: cover; }
.watch-next-art .cssart { min-height: 100%; padding: 8px; }
.watch-next-art .cssart .card { font-size: .75rem; }
.watch-next-play { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%); width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #abffd45c; border-radius: 50%; background: #06150dbb; }
.watch-next-play svg { width: 16px; height: 16px; }
.watch-next-copy { display: grid; gap: 5px; align-content: center; min-width: 0; }
.watch-next-copy strong { font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }
.watch-next-copy > span { color: #b9cfc2; font-size: .85rem; }
.watch-next-copy .watch-next-label { color: #8bf1b5; font-size: .82rem; font-weight: 650; }
.watch-series-end { color: #a5bbae; font-size: .9rem; padding: 11px 13px; border: 1px solid #314d3d; border-radius: 10px; background: #101d16; }
#detailBody .watch-discussion { grid-column: 1; min-width: 0; padding: 0 28px 28px; }
#detailBody .watch-desc { margin-top: 2px; background: #11151f; border-color: #303644; border-radius: 13px; padding: 16px; }
#detailBody .watch-desc-text { color: #ced6e1; font-size: 1rem; line-height: 1.6; }
#detailBody .desc-toggle { font-size: .95rem; color: #9befbd; min-height: 44px; }
#detailBody .watch-comments { scroll-margin-top: 22px; margin-top: 28px; }
#detailBody .watch-comments h4 { font-family: inherit; font-style: normal; text-shadow: none; font-size: 1.15rem; }
#detailBody .watch-comments .c-count { font-weight: 500; color: #a9afbe; margin-left: 6px; }
#detailBody .watch-comment-form input { font-size: 1rem; min-width: 0; background: #151b24; border-color: #3b4c46; }
#detailBody .viewer-slot { padding: 0 24px; }
#detailBody .resume-bar { background: #11231a; border-color: #46755b; margin-top: 14px; }
#detailBody .sponsored-slot { margin-inline: 24px; }
#detailBody :is(button,a,summary,video):focus-visible { outline: 2px solid #b2ffd1; outline-offset: 3px; }
@media (max-width: 1040px) and (min-width: 761px) {
  #detailBody .watch-grid { grid-template-columns: minmax(0,1fr) 290px; }
  .watch-info { padding-inline: 20px; }
  #detailBody .watch-discussion { padding-inline: 20px; }
  #detailBody .watch-side { padding-inline: 12px; }
  .watch-side-heading > span { display: none; }
  #detailBody .upnext-row { grid-template-columns: 40% minmax(0,1fr); padding: 8px; gap: 8px; }
}
@media (max-width: 760px) {
  #detailOverlay { padding: max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); }
  #detailOverlay .modal.watch { padding: 0; border-radius: 16px; overflow-wrap: anywhere; }
  #detailOverlay .watch-back { width: 44px; height: 44px; top: 10px; left: 10px; }
  #detailBody .watch-grid { display: flex; flex-direction: column; gap: 0; }
  #detailBody .watch-grid > * { width: 100%; min-width: 0; }
  #detailBody .watch-player { border-radius: 15px 15px 0 0; }
  #detailBody .watch-poster-header { padding: 10px 16px 10px 66px; gap: 12px; border-radius: 15px 15px 0 0; }
  #detailBody .watch-compact-poster { width: 48px; height: 72px; flex-basis: 48px; }
  #detailBody .watch-poster-header :is(a,strong) { font-size: .92rem; }
  #detailBody .watch-poster-header + .watch-player { border-radius: 0; }
  .watch-info { padding: 21px 18px 8px; }
  #detailBody .watch-title { font-size: clamp(1.4rem,6vw,1.8rem); }
  #detailBody .watch-series { font-size: .95rem; margin-bottom: 10px; }
  #detailBody .watch-meta { font-size: .95rem; margin-top: 13px; }
  #detailBody .watch-channel-row { padding-block: 20px; margin-top: 21px; gap: 10px; }
  #detailBody .watch-channel-row .avatar { width: 44px; height: 44px; }
  #detailBody .wc-name { font-size: 1rem; }
  #detailBody .wc-subs { font-size: .875rem; }
  #detailBody .sub-btn { padding: 10px 18px; }
  #detailBody .watch-actions { gap: 6px; margin-top: 18px; }
  #detailBody .watch-actions :is(.icon-btn,.lib-btn) { padding: 10px 8px; min-width: 44px; gap: 5px; font-size: .92rem; }
  #detailBody .watch-actions :is(.icon-btn,.lib-btn) svg { width: 18px; height: 18px; }
  #detailBody .watch-more { position: static; }
  #detailBody .watch-more-menu { top: calc(100% + 5px); right: 0; }
  #detailBody .watch-side { width: 100%; border-left: 0; padding: 18px 18px 12px; }
  .watch-side-heading { margin: 0 0 16px; }
  .watch-side-heading h4 { font-size: 1.1rem; }
  #detailBody .upnext-row { grid-template-columns: 42% minmax(0,1fr); border-color: #51416f; }
  #detailBody .upnext-row:first-child { border-color: #9d79e8; box-shadow: inset 0 0 0 1px #9d79e85c; }
  #detailBody .upnext-meta .u-title { font-size: 1rem; }
  #detailBody .watch-discussion { padding: 4px 18px 24px; }
  #detailBody .watch-comment-form { flex-wrap: wrap; }
  #detailBody .watch-comment-form input { flex: 1 1 150px; }
  #detailBody .viewer-slot { padding-inline: 18px; }
  #detailBody .sponsored-slot { margin-inline: 18px; }
}
@media (max-width: 360px) {
  .watch-info { padding-inline: 13px; }
  #detailBody .watch-side, #detailBody .watch-discussion { padding-inline: 13px; }
  #detailBody .watch-channel-row { gap: 8px; }
  #detailBody .sub-btn { padding-inline: 12px; font-size: .94rem; }
  #detailBody .watch-actions :is(.icon-btn,.lib-btn) { padding-inline: 8px; }
  #detailBody .watch-actions :is([data-watch-share],[data-watch-save]) span { display: none; }
  #detailBody .watch-more > summary { width: 44px; }
  #detailBody .watch-actions .community-link { font-size: .9rem; }
  .watch-side-heading > span { display: none; }
}
