/* comment.css  --  per-game comment section (comments.js) + the
   "X replied to your comment" toasts (comment-notify.js).
   Ported from unblockedgames88, re-coloured for Funny School: a glass card
   on the navy theme with the theme's purple (#8200e9 family) as the accent
   and the lime (#90FF03) for replies. Dark is the default; the light theme
   (settings.js, :root[data-fs-theme="light"]) only swaps the tokens below. */

.comment-section,
.cmt-notif-stack {
    --cmt-card: rgba(255, 255, 255, .045);
    --cmt-card-line: rgba(255, 255, 255, .1);
    --cmt-field: rgba(255, 255, 255, .05);
    --cmt-field-focus: rgba(255, 255, 255, .08);
    --cmt-line: rgba(255, 255, 255, .08);
    --cmt-line-2: rgba(255, 255, 255, .16);
    --cmt-ink: #ffffff;
    --cmt-text: #dcdff0;
    --cmt-muted: rgba(255, 255, 255, .55);
    --cmt-faint: rgba(255, 255, 255, .38);
    --cmt-accent: #a855f7;
    --cmt-accent-strong: #8200e9;
    --cmt-accent-soft: rgba(168, 85, 247, .4);
    --cmt-reply: #90ff03;
    --cmt-reply-ink: #13200a;
    --cmt-admin: #c084fc;
    --cmt-good: #4ade80;
    --cmt-bad: #f87171;
    --cmt-toast: #141b44;
}

:root[data-fs-theme="light"] .comment-section,
:root[data-fs-theme="light"] .cmt-notif-stack {
    --cmt-card: #ffffff;
    --cmt-card-line: rgba(17, 29, 94, .12);
    --cmt-field: rgba(17, 29, 94, .04);
    --cmt-field-focus: #ffffff;
    --cmt-line: rgba(17, 29, 94, .08);
    --cmt-line-2: rgba(17, 29, 94, .18);
    --cmt-ink: #111D5E;
    --cmt-text: #2a3358;
    --cmt-muted: #667090;
    --cmt-faint: #8a92ad;
    --cmt-accent: #6d28d9;
    --cmt-accent-strong: #6d28d9;
    --cmt-accent-soft: rgba(109, 40, 217, .35);
    --cmt-reply: #0e7490;
    --cmt-reply-ink: #ffffff;
    --cmt-admin: #6d28d9;
    --cmt-good: #16a34a;
    --cmt-bad: #dc2626;
    --cmt-toast: #ffffff;
}

/* the band between Overview/How to Play (which ends in mb--120) and the
   Similar Games block */
.fs-comments-area {
    position: relative;
    z-index: 1;
    margin-top: -60px;
    padding-bottom: 20px;
}

.comment-section {
    max-width: 100%;
    margin: 0;
    padding: 26px 26px 20px;
    border-radius: 18px;
    background: var(--cmt-card);
    border: 1px solid var(--cmt-card-line);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--cmt-text);
    font-family: inherit;
    text-align: left;
}

:root[data-fs-theme="light"] .comment-section {
    box-shadow: 0 6px 20px rgba(17, 29, 94, .08);
}

.comment-section,
.comment-section * {
    text-align: left;
}

/* style.css gives EVERY button `width: 100%` and `transition: all .4s` */
.comment-section button,
.cmt-notif-stack button {
    width: auto;
    font-family: inherit;
}

.comment-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 18px;
    color: var(--cmt-ink);
}

.comment-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--cmt-accent-strong);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}


/* ---- form ---- */

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.comment-section .comment-form input,
.comment-section .comment-form textarea {
    width: 100%;
    height: auto;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--cmt-line-2);
    background: var(--cmt-field);
    color: var(--cmt-ink);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    box-shadow: none;
    transition: border-color .15s, background .15s;
}

.comment-section .comment-form textarea {
    min-height: 90px;
    resize: vertical;
    line-height: 1.5;
}

.comment-section .comment-form input:focus,
.comment-section .comment-form textarea:focus {
    border-color: var(--cmt-accent);
    background: var(--cmt-field-focus);
}

.comment-section .comment-form input::placeholder,
.comment-section .comment-form textarea::placeholder {
    color: var(--cmt-faint);
}

.comment-section .comment-form input:disabled {
    opacity: .75;
    cursor: not-allowed;
}

.btn-submit-comment {
    align-self: flex-end;
    padding: 11px 26px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #a855f7, #8200e9);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .3px;
    cursor: pointer;
    transition: transform .12s, box-shadow .15s, opacity .15s;
}

.btn-submit-comment:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(130, 0, 233, .45);
}

.btn-submit-comment:active {
    transform: translateY(0);
    opacity: .9;
}

/* not configured yet: show the box, but nothing to type into */
.comment-section.cmt-offline .comment-form {
    display: none;
}


/* ---- list ---- */

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.comment-empty {
    color: var(--cmt-muted);
    font-size: 15px;
    text-align: center !important;
    padding: 24px 0;
    margin: 0;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--cmt-line);
    animation: comment-fade-in .25s ease;
}

.comment-item:last-child {
    border-bottom: none;
}

/* arrived here from a notification toast / admin link */
.comment-item.comment-hilite {
    animation: comment-hilite 2.6s ease;
    border-radius: 10px;
}
@keyframes comment-hilite {
    0%, 60% { background: rgba(168, 85, 247, .16); box-shadow: 0 0 0 1px var(--cmt-accent-soft); }
    100% { background: transparent; box-shadow: none; }
}

.comment-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    text-transform: uppercase;
}

/* custom identity: image avatar (admin, or a badges/<name> entry) */
.comment-avatar.comment-avatar-custom {
    background: #fff;
    padding: 0;
    box-shadow: 0 0 0 2px currentColor, 0 0 10px rgba(168, 85, 247, .35);
}

.comment-avatar.comment-avatar-custom img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* badge chip next to the name -- inline background colour comes from JS */
.comment-badge {
    display: inline-block;
    margin-left: 2px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #7c8190;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    vertical-align: 1px;
    white-space: nowrap;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: baseline;
    /* wrap: name + ADMIN badge + date + PINNED tag is wider than a phone's
       comment column */
    flex-wrap: wrap;
    gap: 2px 8px;
    margin-bottom: 3px;
}

.comment-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
    font-size: 14.5px;
    color: var(--cmt-ink);
}

.comment-time {
    font-size: 12px;
    color: var(--cmt-faint);
}

.comment-text {
    font-size: 15px;
    line-height: 1.55;
    color: var(--cmt-text);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.comment-reactions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin-top: 8px;
}

.cmt-react-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border: 1px solid var(--cmt-line-2);
    border-radius: 999px;
    background: transparent;
    color: var(--cmt-muted);
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    transition: color .12s, border-color .12s, background .12s;
}

.cmt-react-ico {
    font-size: 13px;
    filter: grayscale(1);
    opacity: .85;
}

.cmt-react-btn:hover {
    color: var(--cmt-ink);
    border-color: var(--cmt-accent-soft);
}

.cmt-react-btn:hover .cmt-react-ico,
.cmt-react-btn.react-liked .cmt-react-ico,
.cmt-react-btn.react-disliked .cmt-react-ico {
    filter: none;
    opacity: 1;
}

.cmt-react-btn.is-disabled {
    opacity: .45;
    cursor: default;
    pointer-events: none;
}

.cmt-react-btn.react-liked {
    color: var(--cmt-good);
    border-color: var(--cmt-good);
    background: rgba(74, 222, 128, .12);
}

.cmt-react-btn.react-disliked {
    color: var(--cmt-bad);
    border-color: var(--cmt-bad);
    background: rgba(248, 113, 113, .12);
}

.comment-delete,
.comment-edit,
.comment-reply-btn,
.comment-pin {
    padding: 4px 8px;
    border: none;
    border-radius: 999px;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color .12s;
}

.comment-delete { color: var(--cmt-bad); opacity: .75; }
.comment-delete:hover { opacity: 1; }
.comment-edit { color: var(--cmt-muted); }
.comment-edit:hover { color: var(--cmt-ink); }

.comment-edited {
    font-size: 11px;
    color: var(--cmt-faint);
    font-style: italic;
}

/* inline edit box */
.comment-item [hidden] {
    display: none !important;
}

.comment-edit-box {
    margin: 6px 0 2px;
}

.comment-edit-input,
.comment-reply-input {
    width: 100%;
    min-height: 64px;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--cmt-accent);
    background: var(--cmt-field);
    color: var(--cmt-ink);
    font-size: 15px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    outline: none;
}

.comment-edit-actions,
.comment-reply-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-cmt-save,
.btn-cmt-cancel {
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-cmt-save {
    background: var(--cmt-accent-strong);
    color: #fff;
}

.btn-cmt-save:hover { filter: brightness(1.12); }

.btn-cmt-cancel {
    background: transparent;
    border-color: var(--cmt-line-2);
    color: var(--cmt-muted);
}

.btn-cmt-cancel:hover { color: var(--cmt-ink); }

/* "Change name" control next to the name field */
.cmt-change-name {
    align-self: flex-start;
    margin-top: -2px;
    padding: 2px 4px;
    border: none;
    background: transparent;
    color: var(--cmt-accent);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.cmt-change-name:hover { text-decoration: underline; }
.cmt-change-name:disabled { opacity: .5; cursor: default; }
.cmt-cancel-name { color: var(--cmt-muted); }

.cmt-name-msg {
    font-size: 12.5px;
    color: var(--cmt-muted);
    margin-top: -2px;
}

.cmt-name-msg.is-error {
    color: var(--cmt-bad);
}

/* Banned visitor (banned/<uid> set from the admin panel): notice on top of
   the form, form greyed out, every way to write hidden. Reading and
   reacting still work; the rules reject posts/replies/edits anyway. */
.cmt-ban-note {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(248, 113, 113, .45);
    background: rgba(248, 113, 113, .12);
    color: var(--cmt-bad);
    font-size: 13.5px;
    font-weight: 600;
}
.comment-section.cmt-banned .comment-form textarea,
.comment-section.cmt-banned .comment-form input,
.comment-section.cmt-banned .btn-submit-comment {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}
.comment-section.cmt-banned .comment-reply-btn,
.comment-section.cmt-banned .comment-edit,
.comment-section.cmt-banned .comment-reply-form-slot,
.comment-section.cmt-banned .cmt-change-name {
    display: none !important;
}

@keyframes comment-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ===== Threaded replies + one bounded scroll box ===== */

/* The whole list is a scroll box (JS adds .is-scroll when there are
   comments); it only shows a scrollbar once content passes max-height. */
.comment-section .comment-list.is-scroll {
    max-height: 1000px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--cmt-line-2) transparent;
}
.comment-section .comment-list.is-scroll::-webkit-scrollbar { width: 10px; }
.comment-section .comment-list.is-scroll::-webkit-scrollbar-track { background: transparent; margin: 6px 0; }
.comment-section .comment-list.is-scroll::-webkit-scrollbar-thumb {
    background: var(--cmt-line-2);
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.comment-item { scroll-margin: 14px; }

.comment-thread {
    border-bottom: 1px solid var(--cmt-line);
    animation: comment-fade-in .25s ease;
}
.comment-thread:last-child { border-bottom: none; }

/* the root/reply items do not carry their own divider */
.comment-thread .comment-item {
    border-bottom: none;
}

.comment-reply-btn { color: var(--cmt-muted); }
.comment-reply-btn:hover { color: var(--cmt-reply); }

/* ---- Replies block, indented under the root ---- */
.comment-replies {
    margin-left: 52px;
    padding-left: 14px;
    border-left: 2px solid var(--cmt-line);
}
.comment-replies:not(.has-replies) {
    border-left: none;
    padding-left: 0;
}

.comment-replies-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 4px;
    padding: 4px;
    border: none;
    background: transparent;
    color: var(--cmt-reply);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.comment-replies-toggle::before {
    content: "";
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    opacity: .5;
}
.comment-replies-toggle:hover { text-decoration: underline; }
.comment-replies-toggle[hidden] { display: none; }

/* collapses to 0 for "View N replies"; the big max-height is just the
   animation ceiling */
.comment-reply-list {
    overflow: hidden;
    max-height: 20000px;
    opacity: 1;
    transition: max-height .3s ease, opacity .22s ease;
}
.comment-reply-list.is-collapsed {
    max-height: 0;
    opacity: 0;
}

/* smaller reply items */
.comment-item-reply {
    padding: 10px 4px;
    gap: 10px;
}
.comment-item-reply .comment-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
}
.comment-item-reply .comment-text { font-size: 14px; }
.comment-item-reply .comment-name { font-size: 13.5px; }

/* ---- inline reply form ---- */
.comment-reply-form-slot { margin-top: 2px; }

.comment-reply-box {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    transition: max-height .2s ease, opacity .18s ease, margin-top .2s ease;
}
.comment-reply-box.is-open {
    max-height: 240px;
    opacity: 1;
    margin-top: 8px;
    margin-bottom: 10px;
}

.comment-reply-input {
    min-height: 56px;
    font-size: 14px;
    border-color: var(--cmt-line-2);
}
.comment-reply-input:focus { border-color: var(--cmt-reply); }

.btn-reply-post {
    background: var(--cmt-reply);
    color: var(--cmt-reply-ink);
}


/* ===== Pinned comment ===== */

.comment-thread.is-pinned-thread {
    position: relative;
    border: 1px solid var(--cmt-accent-soft);
    border-radius: 14px;
    background: rgba(168, 85, 247, .06);
    padding: 4px 8px 2px;
    margin-bottom: 14px;
}

.comment-pinned-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    background: var(--cmt-accent-strong);
    color: #fff;
    vertical-align: middle;
}

.comment-pinned-tag::before {
    content: "\1F4CC";   /* pushpin emoji */
    font-size: 9px;
}

/* admin-only marker on a held-back comment (comments.js) */
.comment-hidden-tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    background: rgba(248, 113, 113, .16);
    color: var(--cmt-bad);
    border: 1px solid rgba(248, 113, 113, .45);
    vertical-align: middle;
}

.comment-pin { color: var(--cmt-muted); }
.comment-pin:hover,
.comment-pin.is-pinned { color: var(--cmt-accent); }

@media (max-width: 575px) {
    .comment-section {
        padding: 18px 14px;
        border-radius: 14px;
    }
    .comment-section-title {
        font-size: 19px;
    }
    .btn-submit-comment {
        align-self: stretch;
    }
    .comment-replies,
    .comment-replies:not(.has-replies) {
        margin-left: 20px;
        padding-left: 10px;
    }
    .comment-replies:not(.has-replies) {
        padding-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .comment-item,
    .comment-thread,
    .comment-item.comment-hilite,
    .comment-reply-list,
    .comment-reply-box {
        animation: none;
        transition: none;
    }
}


/* ===========================================================================
   Reply-notification toasts (comment-notify.js) -- right edge, vertically
   centred (bottom-right is taken by back-to-top + the game nudge). Stay
   until dismissed.
   ======================================================================== */

.cmt-notif-stack {
    position: fixed;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: min(340px, calc(100vw - 36px));
    max-height: 96vh;
    pointer-events: none;
}

.cmt-notif {
    pointer-events: auto;
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--cmt-toast);
    border: 1px solid var(--cmt-card-line);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
    color: var(--cmt-text);
    font-size: 13.5px;
    line-height: 1.4;
    max-height: 200px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .22s ease, transform .26s cubic-bezier(.2, .9, .3, 1.15);
}

:root[data-fs-theme="light"] .cmt-notif {
    box-shadow: 0 14px 34px rgba(17, 29, 94, .18);
}

.cmt-notif.is-in {
    opacity: 1;
    transform: translateY(0);
}
.cmt-notif.is-out {
    opacity: 0;
    transform: translateY(-4px);
    max-height: 0 !important;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    transition:
        opacity .16s ease,
        transform .16s ease,
        max-height .22s ease .08s,
        border-width .22s ease .08s,
        margin-bottom .22s ease .08s,
        padding-top .22s ease .08s,
        padding-bottom .22s ease .08s;
}

.cmt-notif.is-link { cursor: pointer; }
.cmt-notif.is-link:hover { border-color: var(--cmt-accent); }

.cmt-notif-icon {
    flex: 0 0 auto;
    font-size: 16px;
    line-height: 1.3;
}

.cmt-notif-msg {
    flex: 1;
    min-width: 0;
}
.cmt-notif-msg strong { color: var(--cmt-ink); }

.cmt-notif-close {
    flex: 0 0 auto;
    margin: -4px -4px 0 0;
    padding: 2px 6px;
    border: none;
    background: transparent;
    color: var(--cmt-faint);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
}
.cmt-notif-close:hover {
    color: var(--cmt-ink);
    background: var(--cmt-line);
}

@media (max-width: 575px) {
    /* bottom strip, but above the back-to-top button (bottom 30 + 46px) */
    .cmt-notif-stack {
        left: 10px;
        right: 10px;
        top: auto;
        bottom: 90px;
        transform: none;
        width: auto;
    }
}
