/* Comments live as an independent final section, below all anime content. */
body.anime-detail-page .anime-comments-bottom {
    display: block;
    width: min(calc(100% - 48px), 1680px);
    margin: clamp(52px, 6vw, 82px) auto 0;
    padding: 30px 0 clamp(46px, 6vw, 76px);
    border-top: 1px solid rgba(255, 255, 255, .08);
    animation: none;
}

body.anime-detail-page .anime-comments-bottom .anime-comments-body {
    display: grid;
    gap: 22px;
    width: 100%;
    padding: clamp(20px, 2.4vw, 30px);
    border: 1px solid rgba(255, 255, 255, .075);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(16, 18, 24, .82), rgba(8, 10, 14, .72));
    box-shadow: 0 18px 44px rgba(0, 0, 0, .16);
}

body.anime-detail-page .anime-comments-bottom .anime-comments-toolbar {
    padding-bottom: 18px;
}

body.anime-detail-page .anime-comments-bottom .anime-season-title {
    color: rgba(255, 255, 255, .94);
    font-size: clamp(27px, 3vw, 38px);
    font-weight: 850;
    line-height: 1;
    letter-spacing: -.035em;
}

body.anime-detail-page .anime-comments-bottom .anime-comments-count {
    background: rgba(255, 255, 255, .045);
}

body.anime-detail-page .anime-comments-bottom .anime-comment-form {
    padding-bottom: 22px;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-input {
    min-height: 104px;
    padding: 19px 20px 16px;
}

body.anime-detail-page .anime-comments-bottom .anime-comments-empty {
    color: rgba(255, 255, 255, .42);
}

@media (max-width: 900px) {
    body.anime-detail-page .anime-comments-bottom {
        width: min(calc(100% - 32px), 720px);
        margin-top: 42px;
        padding-top: 22px;
    }
}

@media (max-width: 640px) {
    body.anime-detail-page .anime-comments-bottom .anime-comments-body {
        padding: 18px 15px;
        border-radius: 12px;
    }

    body.anime-detail-page .anime-comments-bottom .anime-comment-input {
        min-height: 86px;
        padding: 15px 16px 12px;
    }

    body.anime-detail-page .anime-comments-bottom .anime-comments-toolbar {
        align-items: center;
        text-align: left;
    }
}

/* Match the comment experience used on the watch page. */
body.anime-detail-page .anime-comments-bottom .anime-comments-body {
    gap: 18px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .015)), rgba(18, 18, 20, .9);
}

body.anime-detail-page .anime-comments-compose-head {
    order: 1;
}

body.anime-detail-page .anime-comments-compose-head h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-form {
    position: relative;
    order: 2;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    margin: 0;
    padding: 18px 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 22px;
    background: rgba(7, 7, 9, .72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
    transition: border-color .28s ease, box-shadow .28s ease;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-form::after {
    content: "";
    position: absolute;
    inset: -1px;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(120deg, transparent, rgba(var(--anime-accent-rgb), .78), rgba(255, 255, 255, .72), rgba(var(--anime-accent-rgb), .78), transparent);
    background-size: 220% 220%;
    opacity: 0;
    pointer-events: none;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    transition: opacity .28s ease;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-form:hover,
body.anime-detail-page .anime-comments-bottom .anime-comment-form:focus-within {
    border-color: rgba(var(--anime-accent-rgb), .3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 12px 30px rgba(var(--anime-accent-rgb), .08);
}

body.anime-detail-page .anime-comments-bottom .anime-comment-form:hover::after,
body.anime-detail-page .anime-comments-bottom .anime-comment-form:focus-within::after {
    opacity: 1;
    animation: animeCommentBorderFlow 2.2s linear infinite;
}

@keyframes animeCommentBorderFlow {
    to { background-position: 200% 50%; }
}

body.anime-detail-page .anime-comments-bottom .anime-comment-form-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, rgba(var(--anime-accent-rgb), .82), rgba(var(--anime-accent-soft-rgb), .82));
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: none;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-form-shell {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) auto;
    align-items: center;
    gap: 14px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-input {
    width: 100%;
    height: 48px;
    min-height: 48px;
    max-height: 120px;
    padding: 12px 0;
    overflow-y: auto;
    color: #eef4ff;
    line-height: 24px;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-form-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-height: 40px;
    padding: 0;
    flex-wrap: nowrap;
    border: 0;
    background: transparent;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-check {
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    color: rgba(220, 226, 236, .78);
    white-space: nowrap;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-rating {
    flex: 0 1 auto;
    flex-wrap: nowrap;
    gap: 7px;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-star {
    width: 16px;
    height: 18px;
    font-size: 15px;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-submit {
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid rgba(var(--anime-accent-rgb), .28);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(var(--anime-accent-rgb), .96), rgba(var(--anime-accent-soft-rgb), .92));
    box-shadow: 0 10px 22px rgba(var(--anime-accent-rgb), .18);
}

body.anime-detail-page .anime-comments-bottom .anime-comments-toolbar {
    order: 3;
    margin-top: 6px;
    padding: 0;
    border: 0;
}

body.anime-detail-page .anime-comments-bottom .anime-comments-toolbar .anime-season-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0;
}

body.anime-detail-page .anime-comments-bottom .anime-comments-count {
    min-height: 32px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, .06);
    font-size: 12px;
}

body.anime-detail-page .anime-comments-bottom .anime-comments-list {
    order: 4;
    gap: 12px;
}

body.anime-detail-page .anime-comment-auth-required {
    order: 2;
    display: grid;
    justify-items: center;
    gap: 13px;
    min-height: 180px;
    padding: 24px;
    place-content: center;
    border: 1px dashed rgba(255, 255, 255, .12);
    border-radius: 14px;
    background: rgba(255, 255, 255, .018);
    text-align: center;
}

body.anime-detail-page .anime-comment-auth-required[hidden] {
    display: none;
}

body.anime-detail-page .anime-comment-auth-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 13px;
    background: rgba(255, 255, 255, .04);
}

body.anime-detail-page .anime-comment-auth-icon img {
    width: 19px;
    height: 19px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: .42;
}

body.anime-detail-page .anime-comment-auth-required p {
    margin: 0;
    color: rgba(255, 255, 255, .46);
    font-size: 13px;
    font-weight: 750;
}

body.anime-detail-page .anime-comment-auth-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

body.anime-detail-page .anime-comment-auth-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 11px;
    color: #fff;
    font-size: 12px;
    font-weight: 850;
    text-decoration: none;
    transition: border-color .22s ease, background-color .22s ease, box-shadow .22s ease, filter .22s ease;
}

body.anime-detail-page .anime-comment-auth-actions img {
    width: 14px;
    height: 14px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

body.anime-detail-page .anime-comment-auth-login {
    border: 1px solid rgba(20, 157, 188, .54);
    background: #0d819d;
    box-shadow: 0 8px 20px rgba(13, 129, 157, .18);
}

body.anime-detail-page .anime-comment-auth-register {
    border: 1px solid rgba(255, 255, 255, .11);
    background: rgba(255, 255, 255, .035);
}

body.anime-detail-page .anime-comment-auth-actions a:hover,
body.anime-detail-page .anime-comment-auth-actions a:focus-visible {
    border-color: rgba(255, 255, 255, .28);
    filter: brightness(1.12);
}

body.anime-detail-page .anime-comments-body.is-comment-guest .anime-comments-compose-head,
body.anime-detail-page .anime-comments-body.is-comment-guest .anime-comment-form {
    display: none !important;
}

body.anime-detail-page .anime-comments-body.is-comment-guest .anime-comments-toolbar {
    order: 1;
}

body.anime-detail-page .anime-comments-body.is-comment-guest .anime-comments-list {
    order: 3;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-card {
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .03));
}

body.anime-detail-page .anime-comments-bottom .anime-comment-card::before {
    display: none;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-main {
    gap: 2px;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-bubble {
    padding: 0;
    margin-top: -2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

body.anime-detail-page .anime-comments-bottom .anime-comment-bubble:hover,
body.anime-detail-page .anime-comments-bottom .anime-comment-card:focus-within .anime-comment-bubble {
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
}

@media (max-width: 1050px) {
    body.anime-detail-page .anime-comments-bottom .anime-comment-form-shell {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    body.anime-detail-page .anime-comments-bottom .anime-comment-form-row {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    body.anime-detail-page .anime-comments-bottom .anime-comments-body {
        padding: 14px 10px;
        gap: 14px;
    }

    body.anime-detail-page .anime-comments-bottom .anime-comment-form {
        grid-template-columns: 40px minmax(0, 1fr);
        align-items: start;
        gap: 10px;
        padding: 12px;
        border-radius: 18px;
    }

    body.anime-detail-page .anime-comments-bottom .anime-comment-form-avatar {
        width: 40px;
        height: 40px;
    }

    body.anime-detail-page .anime-comments-bottom .anime-comment-input {
        height: 44px;
        min-height: 44px;
        padding: 9px 0 6px;
    }

    body.anime-detail-page .anime-comments-bottom .anime-comment-form-row {
        align-items: stretch;
    }

    body.anime-detail-page .anime-comments-bottom .anime-comment-rating {
        width: 100%;
        overflow-x: auto;
    }

    body.anime-detail-page .anime-comments-bottom .anime-comment-submit {
        flex: 1 1 140px;
    }
}
