/**
 * AnimeKai inner pages — watch (single episode) sheet, built on inner.css.
 * Classic AnimeStream structure (breadcrumb, title box, player, server
 * dropdown + tools, Prev / All / Next, keyword / content / download boxes)
 * in AnimeKai colours.
 */

/* The header is fixed and #wrapper.watch main has margin-top:0. */
.ak-watch {
    padding-top: 7rem;
}

/* Neutralise the legacy theme-colour inline CSS (#0c70de). */
.ak-watch .releases span {
    background: transparent !important;
    border-color: transparent !important;
}

.ak-watch .commentx #submit.ak-send,
.ak-watch .cmt #submit.ak-send {
    background: var(--ak-primary);
    color: #fff;
}

.ak-watch .commentx #submit.ak-send:hover {
    background: #cf512e;
}

/* Expand: player row takes the full width, sidebar drops below. */
.ak-watch-layout.ak-wide {
    grid-template-columns: minmax(0, 1fr);
}

/* ---------- breadcrumb (slim text row) ---------- */
.ak-watch .ts-breadcrumb {
    background: none;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    padding: 0 .1rem;
    margin: 0 0 .75rem;
    font-size: .85rem;
    color: var(--ak-muted);
}

.ak-watch .ts-breadcrumb > div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ak-watch .ts-breadcrumb a {
    color: var(--ak-primary);
    text-decoration: none;
}

.ak-watch .ts-breadcrumb a:hover {
    color: #fff;
}

.ak-watch .ts-breadcrumb > div > span:last-of-type a {
    color: var(--ak-muted);
}

/* ---------- title box ---------- */
.ak-watch .ak-ep-head {
    margin-bottom: .8rem;
}

.ak-watch .ak-ep-head .ak-bix-head h1 {
    font-size: 1.2rem;
}

.ak-watch .ak-ep-head .ak-bix-body {
    padding: .65rem 1.2rem;
}

.ak-watch .item.meta .lm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem 1.2rem;
    font-size: .84rem;
    color: var(--ak-muted);
}

.ak-watch .item.meta .lm i {
    color: var(--ak-primary);
    font-size: .8rem;
    margin-right: .15rem;
}

.ak-watch .item.meta .lm a {
    color: #fff;
    text-decoration: none;
}

.ak-watch .item.meta .lm a:hover {
    color: var(--ak-primary);
}

.ak-watch .item.meta .lm b {
    color: rgba(255, 255, 255, .85);
    font-weight: 500;
}

.ak-watch .item.meta .lm .lg {
    background: var(--ak-secondary);
    color: #0c1116;
    border-radius: .25rem;
    padding: .05rem .45rem;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
}

/* ---------- player ---------- */
.ak-watch .megavid {
    position: relative;
    background: #000;
    border-radius: .5rem;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}

.ak-watch .megavid .video-content {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.ak-watch .megavid #embed_holder,
.ak-watch .megavid #pembed {
    position: absolute;
    inset: 0;
}

.ak-watch .megavid #pembed iframe,
.ak-watch .megavid #pembed video,
.ak-watch .megavid #pembed embed,
.ak-watch .megavid #pembed object,
.ak-watch .megavid #pembed > div {
    width: 100% !important;
    height: 100% !important;
    border: 0;
    display: block;
}

.ak-watch .megavid #overplay {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(0, 0, 0, .7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ak-watch .megavid #close-teaser {
    text-align: right;
    font-size: 1.4rem;
}

/* ---------- servers box (built like the download box) + tools ---------- */
.ak-watch .ak-srv.video-nav {
    display: block;
    margin: .8rem 0;
    padding: 0;
    background: var(--ak-panel);
    border-radius: .5rem;
    overflow: hidden;
}

.ak-watch .ak-srv .ak-bix-head {
    flex-wrap: wrap;
    padding: .5rem .8rem .5rem 1.2rem;
}

.ak-watch .ak-srv .ak-bix-body {
    padding: .8rem 1.2rem 1rem;
}

.ak-srv-group {
    overflow: hidden;
    background: var(--ak-panel-2);
    border-radius: .4rem;
}

.ak-srv-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .3rem 1rem;
    padding: .55rem .9rem;
    background: rgba(228, 95, 58, .14);
    border-left: 3px solid var(--ak-primary);
}

.ak-srv-title h4 {
    margin: 0;
    font-size: .9rem;
    font-weight: 500;
    color: #fff;
}

.ak-srv-now {
    font-size: .8rem;
    color: var(--ak-muted);
}

.ak-srv-now b {
    font-weight: 500;
    color: var(--ak-secondary);
}

.ak-srv-row {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .5rem .9rem;
    border-top: 1px solid var(--ak-line);
    font-size: .88rem;
    line-height: 1.5;
}

.ak-srv-tag {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    min-width: 4rem;
    padding: .1rem .45rem;
    background: var(--ak-primary);
    border-radius: .25rem;
    color: #fff;
    font-size: .76rem;
    font-weight: 600;
    text-transform: uppercase;
}

.ak-srv-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: .3rem;
}

.ak-srv-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .15rem 0;
    background: none;
    border: 0;
    color: var(--ak-secondary);
    font: inherit;
    cursor: pointer;
    transition: color .15s;
}

.ak-srv-btn i {
    display: none;
    font-size: .65rem;
}

.ak-srv-btn:hover {
    color: #fff;
}

.ak-srv-btn.active {
    color: #fff;
    font-weight: 500;
}

.ak-srv-btn.active i {
    display: inline-block;
    color: var(--ak-primary);
}

.ak-srv-btn.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--ak-primary);
}

.ak-srv-sep {
    margin: 0 .6rem;
    color: rgba(255, 255, 255, .15);
}

.ak-srv-note {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: .7rem 0 0;
    font-size: .8rem;
    color: var(--ak-muted);
}

.ak-srv-note i {
    color: var(--ak-primary);
}

.ak-watch .ak-srv select.mirror {
    display: none;
}

.ak-watch .iconx {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem;
    float: none;
    margin: 0;
    overflow: visible;
}

.ak-watch .iconx .icol {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    padding: .45rem .7rem;
    background: none;
    border: 0;
    border-radius: .4rem;
    color: rgba(255, 255, 255, .75);
    font-size: .85rem;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s, color .2s;
}

.ak-watch .iconx .icol:hover,
.ak-watch .iconx .icol.active {
    background: var(--ak-panel-2);
    color: #fff;
}

.ak-watch .iconx .icol i {
    font-size: .9rem;
}

.ak-watch .iconx .icol.expand i {
    color: var(--ak-secondary);
}

.ak-watch .iconx .icol.light i {
    color: #ecbc2a;
}

.ak-watch .iconx .icol.dl i {
    color: var(--ak-primary);
}

/* ---------- Prev / All Episodes / Next ---------- */
.ak-watch .naveps.bignav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .6rem;
    float: none;
    margin: 0 0 1.5rem;
    padding: 0;
    overflow: visible;
}

.ak-watch .naveps.bignav .nvs {
    float: none;
    width: auto;
    margin: 0;
    min-width: 0;
}

.ak-watch .naveps.bignav .nvs a,
.ak-watch .naveps.bignav .nvs .nolink {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    height: 2.8rem;
    padding: 0 .8rem;
    margin: 0;
    border-radius: .4rem;
    background: var(--ak-panel-2);
    box-shadow: none;
    color: #fff;
    font-size: .92rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color .2s, color .2s;
}

.ak-watch .naveps.bignav .nvs a:hover {
    background: #2b333c;
    color: #fff;
}

.ak-watch .naveps.bignav .nvs.nvsc a {
    background: var(--ak-primary);
    color: #fff;
}

.ak-watch .naveps.bignav .nvs.nvsc a:hover {
    background: #cf512e;
}

.ak-watch .naveps.bignav .nvs .nolink {
    background: var(--ak-panel);
    color: rgba(255, 255, 255, .25);
    cursor: default;
}

.ak-watch .naveps.bignav .tl {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- download-only notice ---------- */
.ak-dl-notice {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .8rem 1rem;
    margin-bottom: .8rem;
    padding: 1rem 1.2rem;
    background: var(--ak-panel);
    border-left: 3px solid var(--ak-primary);
    border-radius: .5rem;
    color: var(--ak-muted);
}

.ak-dl-notice > i {
    font-size: 1.5rem;
    color: var(--ak-primary);
}

.ak-dl-notice > span {
    flex: 1 1 12rem;
}

/* lights off */
body.ak-lights-off::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    z-index: 1040;
}

body.ak-lights-off .ak-watch .megavid,
body.ak-lights-off .ak-watch .video-nav {
    position: relative;
    z-index: 1041;
}

/* ---------- extras: notices, keywords, content, downloads ---------- */
.ak-watch .warning,
.ak-watch .announ,
.ak-watch .kln {
    border-radius: .5rem;
    padding: .8rem 1rem;
    margin-bottom: 1rem;
    background: rgba(228, 95, 58, .12);
    border-left: 3px solid var(--ak-primary);
    color: #fff;
}

.ak-watch .kln {
    background: transparent;
    border: 0;
    padding: 0;
    text-align: center;
}

.ak-watch .ak-bix.infx .ak-bix-body {
    font-size: .82rem;
    line-height: 1.6;
    text-align: justify;
    color: var(--ak-muted);
}

.ak-watch .ak-bix.infx p {
    margin: 0;
}

.ak-watch .ak-bix.infx b {
    color: rgba(255, 255, 255, .8);
    font-weight: 500;
}

.ak-watch .mctn {
    color: rgba(255, 255, 255, .8);
    font-size: .92rem;
    line-height: 1.7;
}

.ak-watch .mctn > :last-child {
    margin-bottom: 0;
}

.ak-watch .mctn a {
    color: var(--ak-secondary);
}

.ak-watch .ak-ep-thumb img {
    border-radius: .4rem;
    max-width: 320px;
    height: auto;
    display: block;
}

.ak-watch .ak-dl .soraddlx {
    overflow: hidden;
    margin: 0 0 .9rem;
    background: var(--ak-panel-2);
    border-radius: .4rem;
}

.ak-watch .ak-dl .soraddlx:last-child {
    margin-bottom: 0;
}

.ak-watch .ak-dl .soraddlx .sorattlx {
    margin: 0;
    padding: .55rem .9rem;
    background: rgba(228, 95, 58, .14) !important;
    border-left: 3px solid var(--ak-primary);
    color: #fff;
}

.ak-watch .ak-dl .sorattlx h3 {
    margin: 0;
    font-size: .9rem;
    font-weight: 500;
    color: #fff;
}

.ak-watch .ak-dl .soraurlx {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin: 0;
    padding: .45rem .9rem;
    background: transparent;
    border-top: 1px solid var(--ak-line);
    font-size: .88rem;
    line-height: 1.5;
}

.ak-watch .ak-dl .soraurlx strong {
    flex: 0 0 auto;
    min-width: 4rem;
    margin: 0;
    padding: .1rem .4rem;
    background: var(--ak-primary) !important;
    border-radius: .25rem;
    color: #fff;
    font-size: .76rem;
    font-weight: 600;
    text-align: center;
}

.ak-watch .ak-dl-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: .2rem;
}

.ak-watch .ak-dl-links a {
    color: var(--ak-secondary);
    text-decoration: none;
}

.ak-watch .ak-dl-links a:hover {
    color: #fff;
}

.ak-watch .ak-dl-links a::after {
    content: "|";
    margin: 0 .55rem;
    color: rgba(255, 255, 255, .15);
}

.ak-watch .ak-dl-links a:last-child::after {
    display: none;
}

/* episodes panel */
.ak-watch .episode-section.ak-eps {
    flex: 0 0 400px;
    width: 400px;
    min-width: 0;
    max-width: none;
    padding: 1.5rem;
}

.ak-eps .head-top .title i {
    color: var(--ak-primary);
    margin-right: .35rem;
}

.ak-eps .head-top form {
    margin: 0;
}

.ak-eps .head-top form .form-group input {
    background: #0c1116;
    border: 1px solid var(--ak-line);
    color: #fff;
    font-size: .9rem;
    box-shadow: none;
}

.ak-eps .head-top form .form-group input:focus {
    border-color: var(--ak-primary);
}

.ak-eps .head-top .list-sw {
    color: #fff;
    border-radius: .6rem;
    display: inline-flex;
    align-items: center;
}

.ak-ep-ranges {
    margin-top: 1rem;
}

.ak-ep-range {
    width: 100%;
    height: 2.2rem;
    background: #20272e;
    color: #fff;
    border: 0;
    border-radius: .6rem;
    padding: 0 .8rem;
    font-size: .9rem;
}

.ak-watch .episode-section .eplist {
    margin-top: 1rem;
    min-height: 220px;
}

.ak-watch .episode-section .eplist ul > li {
    width: 20%;
    min-width: 0;
}

.ak-watch .episode-section .eplist ul > li[hidden] {
    display: none;
}

.ak-watch .episode-section .eplist ul > li a {
    background: #1b2127;
    text-decoration: none;
}

.ak-watch .episode-section .eplist ul > li a:hover {
    background: #262e36 !important;
}

.ak-watch .episode-section .eplist ul > li a.active,
.ak-watch .episode-section .eplist ul > li a.active:hover {
    background: var(--ak-primary) !important;
    color: #fff !important;
    font-weight: 600;
}

.ak-watch .episode-section .eplist.titles ul > li a span {
    font-weight: 400;
}

.ak-ep-empty {
    color: var(--ak-muted);
    margin: 1rem 0 0;
}

/* ---------- anime info ---------- */
.ak-box.ak-info {
    position: relative;
    overflow: hidden;
    padding: 0;
}

.ak-info-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(24px);
    opacity: .12;
    transform: scale(1.15);
    pointer-events: none;
}

.ak-info-inner {
    position: relative;
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr) 260px;
    gap: 2rem;
    padding: 2rem;
}

.ak-info-poster {
    display: block;
    border-radius: .8rem;
    overflow: hidden;
    align-self: start;
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .4);
}

.ak-info-poster img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
}

.ak-info .title {
    font-size: 1.9rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 .35rem;
}

.ak-info .title a {
    color: #fff;
    text-decoration: none;
}

.ak-info .title a:hover {
    color: var(--ak-primary);
}

.ak-info .al-title {
    color: var(--ak-muted);
    font-size: .95rem;
    margin-bottom: .9rem;
}

.ak-info-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1.1rem;
}

.ak-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .6rem;
    border-radius: .4rem;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: .8rem;
    font-weight: 500;
    line-height: 1.3;
}

.ak-badge.sub {
    background: var(--ak-primary);
}

.ak-badge.dub {
    background: var(--ak-secondary);
    color: #0c1116;
}

.ak-badge.raw {
    background: #6c757d;
}

.ak-badge.rating {
    background: #fff;
    color: #0c1116;
}

.ak-badge.rating i {
    color: var(--ak-primary);
}

.ak-info .desc {
    color: rgba(255, 255, 255, .8);
    font-size: .95rem;
    line-height: 1.6;
    max-height: 4.8em;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 1.2rem;
    -webkit-mask-image: linear-gradient(#000 55%, transparent);
    mask-image: linear-gradient(#000 55%, transparent);
}

.ak-info .desc.open {
    max-height: none;
    -webkit-mask-image: none;
    mask-image: none;
}

.ak-info .desc p {
    margin: 0 0 .6rem;
}

.ak-info .detail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: .35rem 2rem;
    font-size: .92rem;
    line-height: 1.6;
}

.ak-info .detail > div {
    color: var(--ak-muted);
}

.ak-info .detail > div.wide {
    grid-column: 1 / -1;
}

.ak-info .detail span,
.ak-info .detail a {
    color: #fff;
}

.ak-info .detail a:hover {
    color: var(--ak-secondary);
}

.ak-info .genre {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: 1.1rem;
}

.ak-info .genre a {
    background: rgba(255, 255, 255, .1);
    color: #fff;
    border-radius: .4rem;
    padding: .2rem .9rem;
    font-size: .85rem;
    text-decoration: none;
}

.ak-info .genre a:hover {
    color: var(--ak-secondary);
}

.ak-rate {
    align-self: start;
    background: rgba(24, 29, 34, .9);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    color: var(--ak-muted);
}

.ak-rate-label {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.ak-rate p {
    margin: .2rem 0 .4rem;
}

.ak-rate .value {
    color: #fff;
    font-size: 2.6rem;
    font-weight: 600;
    line-height: 1;
}

.ak-rate .stars {
    position: relative;
    display: inline-block;
    font-size: 1.25rem;
    letter-spacing: .15rem;
    margin-bottom: 1.1rem;
    white-space: nowrap;
}

.ak-rate .stars .base {
    color: #343a40;
}

.ak-rate .stars .fill {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    color: var(--ak-primary);
}

.ak-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    background: var(--ak-primary);
    color: #fff;
    border: 0;
    border-radius: .6rem;
    padding: .6rem 1.5rem;
    font-weight: 500;
    font-size: .92rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s;
}

.ak-send:hover,
.ak-send:focus {
    background: #cf512e;
    color: #fff;
}

.ak-rate-btn {
    width: 100%;
}

/* ---------- recommended sidebar ---------- */
.ak-recs.sidebar-section {
    margin-bottom: 2rem;
}

.ak-recs .aitem-wrapper .aitem {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: rgba(255, 255, 255, .85);
}

.ak-recs .aitem-wrapper .aitem .poster {
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.ak-recs .aitem-wrapper .aitem .poster > div,
.ak-recs .aitem-wrapper .aitem .poster img {
    width: 100%;
    height: 100%;
}

.ak-recs .aitem-wrapper .aitem .poster img {
    object-fit: cover;
    display: block;
}

.ak-recs .aitem-wrapper .aitem .detail {
    min-width: 0;
    flex: 1 1 auto;
}

.ak-recs .aitem-wrapper .aitem .title {
    font-size: .98rem;
    font-weight: 500;
    margin: 0 0 .25rem;
}

/* ---------- responsive ---------- */
@media (max-width: 1399.98px) {
    .ak-info-inner {
        grid-template-columns: 170px minmax(0, 1fr) 230px;
    }
}

@media (max-width: 1199.98px) {
    .ak-watch .episode-section.ak-eps {
        flex: 0 0 auto;
        width: 100%;
    }

    .ak-watch .episode-section .eplist {
        height: 260px;
        flex-grow: 0;
    }

    .ak-watch .episode-section .eplist ul > li {
        width: 10%;
    }

    .ak-info-inner {
        grid-template-columns: 170px minmax(0, 1fr);
    }

    .ak-rate {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: auto auto 1fr auto;
        align-items: center;
        gap: 0 1.2rem;
        text-align: left;
    }

    .ak-rate p,
    .ak-rate .stars {
        margin: 0;
    }

    .ak-rate-btn {
        width: auto;
    }
}

@media (max-width: 767.98px) {
    .ak-watch {
        padding-top: 6rem;
    }

    .ak-watch .ak-ep-head .ak-bix-head h1 {
        font-size: 1.05rem;
    }

    .ak-watch .item.meta .lm {
        gap: .3rem .9rem;
        font-size: .8rem;
    }

    .ak-watch .ak-srv .ak-bix-head {
        flex-direction: column;
        align-items: stretch;
    }

    .ak-srv-row {
        align-items: flex-start;
    }

    .ak-watch .iconx {
        justify-content: space-between;
    }

    .ak-watch .iconx .icol {
        padding: .4rem .5rem;
        font-size: .8rem;
    }

    .ak-watch .naveps.bignav .tl {
        display: none;
    }

    .ak-watch .naveps.bignav .nvs a,
    .ak-watch .naveps.bignav .nvs .nolink {
        height: 2.6rem;
        font-size: 1.1rem;
    }

    .ak-watch .ak-dl .soraurlx {
        align-items: flex-start;
    }

    .ak-watch .episode-section .eplist ul > li {
        width: 20%;
    }

    .ak-info-inner {
        grid-template-columns: minmax(0, 1fr);
        padding: 1.3rem;
        gap: 1.2rem;
    }

    .ak-info-poster {
        width: 140px;
        margin: 0 auto;
    }

    .ak-info-main {
        text-align: center;
    }

    .ak-info .title {
        font-size: 1.5rem;
    }

    .ak-info-badges,
    .ak-info .genre {
        justify-content: center;
    }

    .ak-info .detail {
        text-align: left;
        grid-template-columns: minmax(0, 1fr);
    }

    .ak-rate {
        grid-template-columns: 1fr;
        text-align: center;
        gap: .3rem;
    }

    .ak-rate-btn {
        width: 100%;
        margin-top: .6rem;
    }

    .ak-comment-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .ak-comments .comment-list .children {
        padding-left: 1.5rem;
    }

    .ak-comments .comment-respond {
        padding: 1rem;
    }
}
