/* Coin panel footer actions sit in a nested-modal stack; keep them tappable
   even when the dialog itself uses pointer-events: none. */
#kt_coin_panel_modal .modal-footer .btn {
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.swal2-container .swal2-popup:not(.swal2-toast) {
    width: min(32em, calc(100vw - 2rem)) !important;
    padding: 1.75rem 1.75rem 1.5rem !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    justify-items: center !important;
    align-content: center !important;
    gap: 1rem !important;
    text-align: center !important;
    border-radius: 1.25rem !important;
}

/* Keep meet-list avatars square when row actions leave little horizontal space. */
#kt_hole_list_offcanvas .conversation-list__identity > .symbol.symbol-50 {
    width: 50px;
    min-width: 50px;
    max-width: 50px;
    height: 50px;
    flex: 0 0 50px;
    overflow: hidden;
}

#kt_hole_list_offcanvas .conversation-list__identity > .symbol.symbol-50 > img {
    display: block;
    width: 50px;
    min-width: 50px;
    max-width: 50px;
    height: 50px;
    object-fit: cover;
}

.user-profile-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.user-profile-tag {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(54, 153, 255, 0.12);
    color: #1d4ed8;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
}

.user-profile-tag--empty {
    background: rgba(148, 163, 184, 0.14);
    color: #64748b;
    font-weight: 600;
}

.user-profile-ending-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.user-profile-ending-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.15rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(217, 119, 6, 0.24);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.96), rgba(255, 251, 235, 0.92));
    color: #92400e;
    box-shadow: 0 0.35rem 0.9rem rgba(180, 83, 9, 0.1);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
}

.user-profile-ending-badge i {
    color: #d97706;
    font-size: 0.95rem;
}

.chat-dice-message {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    min-width: 120px;
}

.chat-dice-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
}

.chat-dice-face {
    position: relative;
    width: 84px;
    height: 84px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.chat-dice-face.is-animating {
    transform: rotate(-6deg) scale(0.96);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16);
}

.chat-dice-pip {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #0f172a;
}

.chat-dice-pip--top-left {
    top: 18px;
    left: 18px;
}

.chat-dice-pip--top-right {
    top: 18px;
    right: 18px;
}

.chat-dice-pip--middle-left {
    top: 36px;
    left: 18px;
}

.chat-dice-pip--middle-right {
    top: 36px;
    right: 18px;
}

.chat-dice-pip--bottom-left {
    bottom: 18px;
    left: 18px;
}

.chat-dice-pip--bottom-right {
    bottom: 18px;
    right: 18px;
}

.chat-dice-pip--center {
    top: 36px;
    left: 36px;
}

.chat-dice-caption {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.3;
    color: #334155;
    white-space: nowrap;
}

.chat-dice-message--fallback {
    gap: 0.45rem;
}

.chat-dice-fallback {
    font-size: 2rem;
    line-height: 1;
}

.chat-game-card {
    min-width: min(280px, 72vw);
    max-width: min(360px, 86vw);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.chat-game-badge {
    display: inline-flex;
    width: 1.5rem;
    height: 1.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
}

.chat-game-card .chat-game-answer-input {
    resize: vertical;
}

.chat-game-card .btn.disabled,
.chat-game-card .btn[disabled] {
    pointer-events: none;
    opacity: 0.65;
}

.chat-game-rps-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chat-game-rps-btn {
    min-width: 4.5rem;
}

.expression-popover {
    width: min(420px, calc(100vw - 24px));
    max-width: min(420px, calc(100vw - 24px));
    max-height: min(360px, calc(100vh - 150px));
}

.expression-popover-body {
    padding: 0.5rem !important;
    overflow: hidden;
}

.expression-picker {
    display: flex;
    flex-direction: column;
    max-height: calc(min(360px, calc(100vh - 150px)) - 1rem);
    overflow: hidden;
}

.expression-content {
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.expression-content .tab-pane {
    height: 100%;
}

.expression-emoji-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 0.25rem;
    max-height: 240px;
    min-height: 0;
    padding: 0.25rem;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.expression-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 30px;
    margin: 0;
    border-radius: 6px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.12s ease, transform 0.12s ease;
}

.expression-emoji:hover,
.expression-emoji:focus {
    background: #f1f5f9;
    transform: translateY(-1px);
}

.expression-tabs-scroll {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    min-height: 42px;
    margin-top: 0.5rem;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

.expression-tabs {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
    min-width: 100%;
}

.expression-tabs .nav-item {
    flex: 0 0 auto;
    margin-bottom: 0 !important;
}

.expression-tabs .nav-link {
    white-space: nowrap;
}

@media (max-width: 480px) {
    .expression-popover {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
    }

    .expression-emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
        max-height: 220px;
    }

    .expression-emoji {
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 20px;
    }
}
.swal2-container .swal2-popup:not(.swal2-toast) .swal2-icon {
    margin: 0 auto !important;
    justify-self: center !important;
}

.swal2-container .swal2-popup:not(.swal2-toast) .swal2-title {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: center !important;
}

.swal2-container .swal2-popup:not(.swal2-toast) .swal2-html-container {
    width: 100% !important;
    margin: 0 !important;
    text-align: center !important;
}

.swal2-container .swal2-popup:not(.swal2-toast) .swal2-actions {
    width: 100% !important;
    margin: 0 !important;
    justify-content: center !important;
}

.swal2-container .swal2-popup:not(.swal2-toast) .swal2-styled {
    margin: 0 !important;
}

.swal2-container .swal2-popup:not(.swal2-toast) .swal2-styled.swal2-confirm,
.swal2-container .swal2-popup:not(.swal2-toast) .swal2-styled.swal2-cancel {
    margin: 0 0.5rem !important;
}

.swal2-container .swal2-popup:not(.swal2-toast) .swal2-close {
    align-self: end !important;
}

.swal2-container .swal2-popup.swal2-toast {
    width: min(24rem, calc(100vw - 1rem)) !important;
    padding: 0.9rem 1rem !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    grid-template-areas:
        "icon title"
        "icon body" !important;
    align-items: start !important;
    justify-items: start !important;
    align-content: start !important;
    gap: 0.15rem 0.75rem !important;
    text-align: left !important;
    border-radius: 1rem !important;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16) !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-icon {
    grid-area: icon !important;
    width: 1.9rem !important;
    min-width: 1.9rem !important;
    height: 1.9rem !important;
    margin: 0.1rem 0 0 !important;
    align-self: start !important;
    justify-self: start !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-title {
    grid-area: title !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    text-align: left !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-html-container {
    grid-area: body !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 12px !important;
    line-height: 1.45 !important;
    color: #64748b !important;
    text-align: left !important;
    overflow: hidden !important;
}

.swal2-container .swal2-popup.swal2-toast .swal2-actions,
.swal2-container .swal2-popup.swal2-toast .swal2-close {
    display: none !important;
}

/* Toast alerts must not cover the chat composer. Theme CSS otherwise paints a
   full-viewport .swal2-container that intercepts taps after a background resume. */
body.swal2-toast-shown .swal2-container,
.swal2-container:has(.swal2-popup.swal2-toast) {
    inset: 0.75rem 0.75rem auto auto !important;
    width: auto !important;
    height: auto !important;
    max-width: calc(100vw - 1.5rem) !important;
    background-color: transparent !important;
    pointer-events: none !important;
    overflow: visible !important;
    padding: 0 !important;
}

body.swal2-toast-shown .swal2-container .swal2-popup,
.swal2-container:has(.swal2-popup.swal2-toast) .swal2-popup {
    pointer-events: auto !important;
}

#kt_header_mobile .landing-brand-link,
#kt_header .landing-brand-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: auto !important;
    min-width: 88px !important;
    min-height: 40px !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 6 !important;
    text-decoration: none !important;
    background: none !important;
}

#kt_header_mobile .landing-brand-text,
#kt_header .landing-brand-text {
    display: inline-block !important;
    position: relative !important;
    z-index: 7 !important;
    color: #10cfc3 !important;
    -webkit-text-fill-color: #10cfc3 !important;
    opacity: 1 !important;
    visibility: visible !important;
    text-indent: 0 !important;
    font-family: "Trebuchet MS", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif !important;
    font-size: 2rem !important;
    font-weight: 900 !important;
    letter-spacing: -0.06em !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    transform: none !important;
}

#kt_header_mobile .landing-brand-image,
#kt_header .landing-brand-image {
    position: static !important;
    display: block !important;
    width: auto !important;
    height: 32px !important;
    max-width: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

#kt_landing_desktop_topbar_host .landing-topbar,
#kt_landing_mobile_topbar_host .landing-topbar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

#kt_landing_desktop_topbar_host .landing-topbar__icon,
#kt_landing_mobile_topbar_host .landing-topbar__icon {
    width: 40px !important;
    height: 40px !important;
    flex: 0 0 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#kt_landing_desktop_topbar_host .landing-topbar__button,
#kt_landing_mobile_topbar_host .landing-topbar__button {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 0 !important;
    color: #94a3b8 !important;
    background: transparent !important;
}

#kt_landing_desktop_topbar_host .landing-topbar__button:hover,
#kt_landing_mobile_topbar_host .landing-topbar__button:hover {
    background: #f1f5f9 !important;
    color: #64748b !important;
}

#kt_landing_desktop_topbar_host .landing-topbar__glyph,
#kt_landing_mobile_topbar_host .landing-topbar__glyph {
    width: 22px !important;
    height: 22px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#kt_landing_desktop_topbar_host .landing-topbar__symbol,
#kt_landing_mobile_topbar_host .landing-topbar__symbol {
    width: 22px !important;
    height: 22px !important;
    display: block !important;
    stroke: currentColor !important;
    stroke-width: 1.75 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    fill: none !important;
    overflow: visible !important;
}

@media (max-width: 991.98px) {
    #kt_header_mobile {
        justify-content: space-between !important;
    }

    #kt_landing_mobile_topbar_host {
        width: auto !important;
        min-width: max-content !important;
        height: 100% !important;
        position: relative !important;
        z-index: 8 !important;
    }

    #kt_header_mobile .landing-brand-text {
        font-size: 1.95rem !important;
    }

    #kt_header_mobile .landing-brand-link {
        min-width: 82px !important;
        z-index: 9 !important;
    }

    #kt_header_mobile .landing-brand-image {
        height: 28px !important;
    }

    #kt_landing_mobile_topbar_host .landing-topbar {
        position: static !important;
        inset: auto !important;
        width: auto !important;
        height: 100% !important;
        margin-top: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        z-index: auto !important;
    }

    #kt_landing_mobile_topbar_host .landing-topbar__icon,
    #kt_landing_mobile_topbar_host .landing-topbar__button {
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
    }

    #kt_landing_mobile_topbar_host .landing-topbar__glyph,
    #kt_landing_mobile_topbar_host .landing-topbar__symbol {
        width: 22px !important;
        height: 22px !important;
    }
}

.square-header {
    position: sticky;
    top: 0;
    z-index: 1040;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 30px rgba(19, 40, 72, 0.08);
    backdrop-filter: blur(16px);
}

.square-header__inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.square-header__brand {
    flex: 0 0 auto;
}

.square-header__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.square-header__icon {
    position: relative;
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #94a3b8;
    transition: all 0.15s ease;
}

.square-header__icon:hover {
    background: #f1f5f9;
    color: #64748b;
}

.square-header__icon.is-active {
    background: #eff6ff;
    color: #3699ff;
}

.square-header__count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.square-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(54, 153, 255, 0.12), transparent 26%),
        radial-gradient(circle at top right, rgba(27, 197, 189, 0.12), transparent 22%),
        linear-gradient(180deg, #f9fbff 0%, #f4f7fb 48%, #edf2f7 100%);
}

.square-page__hero {
    padding: 26px 0 20px;
}

.square-page__hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    align-items: stretch;
}

.square-page__hero-copy,
.square-page__hero-panel {
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 24px 60px rgba(19, 40, 72, 0.08);
    backdrop-filter: blur(18px);
}

.square-page__hero-copy {
    padding: 28px 32px;
}

.square-page__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(54, 153, 255, 0.12);
    color: #2273d9;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.square-page__title {
    margin: 18px 0 12px;
    color: #1f2a44;
    font-size: clamp(38px, 6vw, 56px);
    line-height: 1.04;
    letter-spacing: -0.04em;
}

.square-page__lead {
    margin: 0;
    max-width: 680px;
    color: #54627a;
    font-size: 17px;
    line-height: 1.8;
}

.square-page__hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

.square-page__hero-panel {
    display: grid;
    gap: 14px;
    padding: 24px;
}

.square-page__hero-chip {
    padding: 18px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.square-page__hero-chip-label {
    display: block;
    margin-bottom: 6px;
    color: #8f9bb0;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.square-page__hero-chip strong {
    color: #22314d;
    font-size: 18px;
    font-weight: 700;
}

.square-page__content {
    padding: 22px 0 72px;
}

.square-page__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.square-page__filters {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.square-page__filter {
    border: 0;
    border-radius: 0;
    padding: 10px 18px;
    background: transparent;
    color: #64748b;
    font-weight: 500;
    transition: all 0.15s ease;
}

.square-page__filter:first-child {
    border-radius: 8px 0 0 8px;
}

.square-page__filter:last-child {
    border-radius: 0 8px 8px 0;
}

.square-page__filter.is-active {
    background: #3699ff;
    color: #fff;
    font-weight: 600;
}

.square-page__hint {
    color: #7b879d;
    font-size: 14px;
}

.square-page__notifications {
    margin-bottom: 18px;
    padding: 22px 24px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #1e293b;
}

.square-page__notifications-head {
    display: flex;
    gap: 16px;
    align-items: start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.square-page__notifications-title {
    font-size: 22px;
    font-weight: 700;
}

.square-page__notifications-subtitle {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.square-page__notifications-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 18px;
    font-weight: 800;
}

.square-page__notifications-list {
    display: grid;
    gap: 10px;
}

.square-page__notice-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 0;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.square-page__notice-item:hover {
    background: #f8fafc;
}

.square-page__notice-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3699ff;
}

.square-page__notice-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.square-page__notice-copy strong,
.square-page__notice-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.square-page__notice-copy span {
    color: #94a3b8;
    font-size: 13px;
}

.square-page__notice-time {
    color: #94a3b8;
    font-size: 13px;
}

.square-feed-card {
    margin-bottom: 18px;
    border-radius: 28px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 22px 50px rgba(19, 40, 72, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.square-feed-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 28px 60px rgba(19, 40, 72, 0.1);
}

.square-feed-card__meta,
.square-feed-card__comment-meta,
.square-feed-card__composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.square-feed-card__meta,
.square-feed-card__comment-meta {
    color: #90a0b8;
    font-size: 13px;
}

.square-feed-card__content {
    margin: 14px 0 16px;
    color: #27344d;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.85;
    overflow: visible;
    white-space: pre-wrap;
    word-break: break-word;
}


.square-feed-card__toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.square-feed-card__icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #8090a8;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.square-feed-card__icon-btn svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.square-feed-card__icon-btn svg path[fill="none"] {
    fill: none;
}

.square-feed-card__icon-btn.js_square_like_post svg path {
    fill: currentColor;
    opacity: 0.22;
    transition: opacity 0.15s ease;
}

.square-feed-card__icon-btn:hover {
    background: rgba(99, 120, 154, 0.08);
    color: #4b5d7a;
}

.square-feed-card__icon-btn.is-active,
.square-feed-card__icon-btn[aria-expanded="true"] {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.square-feed-card__icon-btn.js_square_like_post.is-active {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.square-feed-card__icon-btn.js_square_like_post.is-active svg path {
    opacity: 1;
}

.square-feed-card__icon-btn.js_square_report_post:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

.square-feed-card__comment-count {
    color: #73819b;
    font-size: 14px;
    font-weight: 600;
}

.square-feed-card__detail {
    margin-top: 14px;
    padding-top: 18px;
    border-top: 1px solid rgba(115, 129, 155, 0.12);
}



.square-feed-card__media {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.square-feed-card__media[data-image-count="1"] {
    grid-template-columns: minmax(0, 1fr);
}

.square-feed-card__media-item {
    display: block;
    min-width: 0;
    max-height: 560px;
    overflow: hidden;
    border: 1px solid rgba(115, 129, 155, 0.12);
    border-radius: 8px;
    background: #f3f6fa;
}

.square-feed-card__media-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.square-feed-card__media.is-preview {
    grid-template-columns: minmax(0, 1fr);
    margin: 0 0 16px;
}

.square-feed-card__media.is-preview .square-feed-card__media-item {
    max-height: 280px;
}

.square-feed-card__media.is-preview img {
    object-fit: cover;
}

.square-feed-card__actions {
    margin-top: 16px;
    justify-content: flex-start;
}

.square-feed-card__comments {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.square-feed-card__comment {
    padding: 16px;
    border-radius: 18px;
    background: #f6f9fc;
    border: 1px solid rgba(115, 129, 155, 0.1);
}

.square-feed-card__comment.is-deleted {
    background: #fbfcfd;
    color: #9aa6ba;
}

.square-feed-card__comment-body {
    margin: 10px 0 14px;
    color: #34425d;
    font-size: 14px;
    line-height: 1.75;
}

.square-feed-card__comment.is-deleted .square-feed-card__comment-body {
    color: inherit;
}

.square-feed-card__comment-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.square-feed-card__composer {
    margin-top: 20px;
    padding: 18px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.square-feed-card__composer textarea {
    min-height: 98px;
    resize: vertical;
    border-radius: 16px;
    border-color: rgba(115, 129, 155, 0.16);
    background: rgba(255, 255, 255, 0.96);
}

.square-feed-card__composer-footer {
    margin-top: 12px;
    color: #8090a8;
    font-size: 13px;
}

.square-feed-card__comment-empty,
.square-feed-card__loading,
.square-page__status {
    padding: 20px 22px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.85);
    color: #6b7a92;
    text-align: center;
    box-shadow: 0 18px 40px rgba(19, 40, 72, 0.06);
}

.square-page__status {
    margin-top: 16px;
}

.square-page__status--error {
    color: #d94452;
    background: rgba(255, 232, 236, 0.94);
}

.square-page__loadmore {
    margin-top: 28px;
    text-align: center;
}

@media (max-width: 991.98px) {
    .square-header__inner {
        min-height: 64px;
        padding-top: 4px;
        padding-bottom: 4px;
    }

    .square-header__actions {
        gap: 4px;
    }

    .square-header__icon {
        width: 40px;
        min-width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .square-header__symbol {
        width: 24px;
        height: 24px;
    }

    .square-page__hero-copy,
    .square-page__hero-panel,
    .square-feed-card {
        padding: 22px;
        border-radius: 24px;
    }

    .square-page__toolbar,
    .square-page__notifications-head,
    .square-feed-card__meta,
    .square-feed-card__composer-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .square-feed-card__media {
        grid-template-columns: minmax(0, 1fr);
    }

    .square-page__toolbar,
    .square-page__filters,
    .square-page__sort,
    .square-page__topics {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .square-page__filters {
        justify-content: space-between;
    }

    .square-page__sort {
        justify-content: space-between;
    }

    .square-page__filter,
    .square-page__sort-btn {
        flex: 1 1 0;
    }

    .square-page__topics {
        align-self: stretch;
    }

    .square-page__notice-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .square-page__notice-time {
        grid-column: 2;
    }

    .square-page__content {
        padding-top: 16px;
    }
}

/* 排序按钮 */
.square-page__sort {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.square-page__sort-btn {
    border: 0;
    border-radius: 0;
    padding: 8px 18px;
    background: transparent;
    color: #64748b;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.15s ease;
}

.square-page__sort-btn:first-child {
    border-radius: 8px 0 0 8px;
}

.square-page__sort-btn:last-child {
    border-radius: 0 8px 8px 0;
}

.square-page__sort-btn.is-active {
    background: #3699ff;
    color: #fff;
    font-weight: 600;
}

/* 话题标签栏 */
.square-page__topics {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 8px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.square-page__topics::-webkit-scrollbar {
    display: none;
}

.square-page__topic {
    flex: 0 0 auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 7px 14px;
    background: #fff;
    color: #64748b;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.15s ease;
    white-space: nowrap;
    cursor: pointer;
}

.square-page__topic:hover {
    border-color: #cbd5e1;
    color: #475569;
}

.square-page__topic.is-active {
    background: #3699ff;
    border-color: #3699ff;
    color: #fff;
    font-weight: 600;
}

/* 帖子话题标签 */
.square-feed-card__topic {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 10px;
}

/* 点赞按钮 */
.square-feed-card__like {
    display: inline-flex;
    align-items: center;
}

.square-feed-card__like button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #94a3b8;
    font-weight: 500;
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 8px;
    transition: all 0.15s ease;
    background: transparent;
    border: 0;
}

.square-feed-card__like button:hover {
    background: #fef2f2;
    color: #ef4444;
}

.square-feed-card__like.is-liked button {
    color: #ef4444;
    font-weight: 600;
}

.square-feed-card__like.is-liked button:hover {
    background: #fee2e2;
}

.square-feed-card__like-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    stroke: none;
}

/* 错误重试按钮 */
.square-page__retry {
    margin-top: 12px;
}

/* Square workspace refresh */
body[data-page="square"] {
    background: #f7f5f1;
}

.square-page {
    --square-ink: #172126;
    --square-muted: #768087;
    --square-line: #e5e1da;
    --square-paper: #fffdf9;
    --square-accent: #e06f5d;
    min-height: calc(100vh - 72px);
    background: #f7f5f1;
    color: var(--square-ink);
}

.square-header {
    background: rgba(255, 253, 249, 0.96);
    border-bottom: 1px solid var(--square-line);
    box-shadow: none;
}

.square-header__inner {
    width: min(100%, 1440px);
    margin: 0 auto;
    padding-right: clamp(20px, 4vw, 64px);
    padding-left: clamp(20px, 4vw, 64px);
}

.square-header__icon {
    border-radius: 8px;
    color: #a1a7aa;
}

.square-header__icon:hover {
    background: #f1ede7;
    color: var(--square-ink);
}

.square-header__icon.is-active {
    background: #fbe8e3;
    color: var(--square-accent);
}

.square-page__content {
    padding: clamp(28px, 5vw, 64px) 0 88px;
}

.square-page__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(232px, 288px);
    gap: clamp(32px, 5vw, 76px);
    align-items: start;
}

.square-page__main {
    min-width: 0;
}

.square-page__intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 0 0 30px;
    border-bottom: 1px solid var(--square-line);
}

.square-page__intro-copy {
    min-width: 0;
}

.square-page__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--square-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.square-page__eyebrow span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.square-page__title {
    margin: 0;
    color: var(--square-ink);
    font-size: clamp(42px, 5vw, 68px);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 0.98;
}

.square-page__lead {
    max-width: 520px;
    margin: 13px 0 0;
    color: var(--square-muted);
    font-size: 15px;
    line-height: 1.75;
}

.square-page__intro-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
    padding-bottom: 3px;
}

.square-page__compose-link,
.square-page__auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 7px;
    padding: 0 13px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.square-page__compose-link {
    gap: 9px;
    background: var(--square-accent);
    color: #fff;
}

.square-page__compose-link:hover,
.square-page__compose-link:focus {
    background: #c85c4c;
    color: #fff;
    text-decoration: none;
}

.square-page__compose-link svg {
    width: 16px;
    height: 16px;
}

.square-page__auth-button {
    border: 1px solid var(--square-line);
    background: transparent;
    color: var(--square-ink);
    cursor: pointer;
}

.square-page__auth-button:hover,
.square-page__auth-button:focus {
    border-color: #d5b1a8;
    background: #fff8f5;
    color: #b94d3d;
}

.square-page__auth-button.btn-light-success {
    border-color: #cfe2d6;
    background: #f1f8f3;
    color: #356548;
}

.square-page__hint {
    margin: 10px 0 0;
    color: #9a9d9a;
    font-size: 12px;
    line-height: 1.6;
}

.square-page__toolbar {
    display: grid;
    gap: 17px;
    align-items: stretch;
    margin: 26px 0 24px;
}

.square-page__toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.square-page__filters,
.square-page__sort {
    border: 0;
    border-bottom: 1px solid var(--square-line);
    border-radius: 0;
    background: transparent;
}

.square-page__filter,
.square-page__sort-btn {
    position: relative;
    border: 0;
    border-radius: 0;
    padding: 0 0 10px;
    background: transparent;
    color: #9a9d9a;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.square-page__filter + .square-page__filter,
.square-page__sort-btn + .square-page__sort-btn {
    margin-left: 20px;
}

.square-page__filter.is-active,
.square-page__sort-btn.is-active {
    background: transparent;
    color: var(--square-ink);
}

.square-page__filter.is-active::after,
.square-page__sort-btn.is-active::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--square-accent);
    content: "";
}

.square-page__topics {
    display: flex;
    gap: 8px;
    max-width: 100%;
    overflow-x: auto;
    padding: 0 0 4px;
    scrollbar-width: none;
}

.square-page__topics::-webkit-scrollbar {
    display: none;
}

.square-page__topic {
    flex: 0 0 auto;
    border: 1px solid var(--square-line);
    border-radius: 999px;
    padding: 7px 12px;
    background: transparent;
    color: #878e90;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.square-page__topic:hover {
    border-color: #d6b2aa;
    color: #bd5c4d;
}

.square-page__topic.is-active {
    border-color: var(--square-accent);
    background: var(--square-accent);
    color: #fff;
}

.square-page__notifications {
    margin: 0 0 20px;
    border: 1px solid #f0cfc7;
    border-radius: 8px;
    padding: 18px 20px;
    background: #fff8f5;
    color: var(--square-ink);
    box-shadow: none;
}

.square-page__notifications-head {
    margin-bottom: 14px;
}

.square-page__notifications-title {
    color: var(--square-ink);
    font-size: 16px;
}

.square-page__notifications-subtitle {
    color: var(--square-muted);
    font-size: 12px;
    line-height: 1.5;
}

.square-page__notifications-count {
    align-self: flex-start;
    flex: 0 0 28px;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    padding: 0;
    background: var(--square-accent);
    color: #fff;
    font-size: 12px;
}

.square-page__notice-item {
    border: 1px solid #f1dfda;
    border-radius: 6px;
    padding: 11px 12px;
    background: #fffdfb;
}

.square-page__notice-item:hover {
    background: #fff;
}

.square-page__notice-dot {
    background: var(--square-accent);
}

.square-feed-card {
    margin-bottom: 14px;
    border: 1px solid var(--square-line);
    border-radius: 8px;
    padding: 22px 23px 16px;
    background: var(--square-paper);
    box-shadow: none;
    transition: border-color 0.18s ease, background-color 0.18s ease;
}

.square-feed-card:hover {
    transform: none;
    border-color: #d8c7be;
    box-shadow: none;
}

.square-feed-card__meta,
.square-feed-card__comment-meta {
    color: #9a9d9a;
    font-size: 12px;
}

.square-feed-card__meta span:first-child {
    color: #636b6d;
    font-weight: 700;
}

.square-feed-card__topic {
    margin: 14px 0 0;
    border-radius: 999px;
    padding: 5px 9px;
    background: #f3eee9;
    color: #8e665d;
    font-size: 11px;
    font-weight: 700;
}

.square-feed-card__content {
    margin: 14px 0 18px;
    color: var(--square-ink);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.85;
}

.square-feed-card__toolbar {
    margin-top: 4px;
    padding-top: 11px;
    border-top: 1px solid #eeeae4;
}

.square-feed-card__icon-btn {
    min-height: 32px;
    border-radius: 6px;
    padding: 5px 8px;
    color: #969c9c;
    font-size: 12px;
}

.square-feed-card__icon-btn:hover {
    background: #f3eee9;
    color: var(--square-ink);
}

.square-feed-card__icon-btn.is-active,
.square-feed-card__icon-btn[aria-expanded="true"] {
    background: #fbe8e3;
    color: #c65a4b;
}

.square-feed-card__icon-btn.js_square_like_post.is-active {
    background: #fbe8e3;
    color: var(--square-accent);
}

.square-feed-card__detail {
    border-top-color: #eeeae4;
}

.square-feed-card__comment {
    border: 1px solid #eeeae4;
    border-radius: 6px;
    padding: 13px 14px;
    background: #f8f6f2;
}

.square-feed-card__comment-body {
    color: #505b5e;
    font-size: 13px;
}

.square-feed-card__composer {
    border: 1px solid #e8e2db;
    border-radius: 6px;
    padding: 14px;
    background: #f8f6f2;
}

.square-feed-card__composer textarea {
    min-height: 84px;
    border: 1px solid #e3ded7;
    border-radius: 5px;
    background: #fffdfb;
}

.square-page__status,
.square-feed-card__comment-empty,
.square-feed-card__loading {
    border: 1px dashed #dcd6ce;
    border-radius: 8px;
    background: transparent;
    color: var(--square-muted);
    box-shadow: none;
}

.square-page__loadmore .btn {
    border: 1px solid var(--square-line);
    border-radius: 6px;
    background: transparent;
    color: var(--square-ink);
}

.square-page__rail {
    position: sticky;
    top: 102px;
    display: grid;
    gap: 28px;
    padding-top: 8px;
}

.square-page__rail-section {
    padding-top: 17px;
    border-top: 1px solid var(--square-line);
}

.square-page__rail-label {
    margin-bottom: 13px;
    color: var(--square-accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.square-page__rail h2 {
    margin: 0;
    color: var(--square-ink);
    font-size: 19px;
    line-height: 1.4;
}

.square-page__rail p {
    margin: 11px 0 0;
    color: var(--square-muted);
    font-size: 13px;
    line-height: 1.75;
}

.square-page__rail-link {
    display: inline-flex;
    gap: 7px;
    margin-top: 17px;
    color: #bd5c4d;
    font-size: 12px;
    font-weight: 700;
}

.square-page__rail-link:hover {
    color: #9d4034;
}

.square-page__guide-list {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.square-page__guide-list li {
    display: grid;
    gap: 3px;
}

.square-page__guide-list strong {
    color: #4c5759;
    font-size: 13px;
}

.square-page__guide-list span {
    color: #9a9d9a;
    font-size: 12px;
}

.square-page__rail-note {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 12px;
    align-items: end;
    padding-top: 18px;
    border-top: 1px solid var(--square-line);
}

.square-page__rail-note img {
    width: 62px;
    height: 78px;
    object-fit: cover;
    object-position: 50% 32%;
    border-radius: 5px;
    background: #eee9e3;
}

.square-page__rail-note strong {
    color: #4c5759;
    font-size: 13px;
}

.square-page__rail-note p {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.55;
}

@media (max-width: 991.98px) {
    .square-page__layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .square-page__rail {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }

    .square-page__rail-note {
        grid-column: 1 / -1;
    }
}

@media (max-width: 639.98px) {
    .square-page__content {
        padding-top: 24px;
    }

    .square-page__intro {
        display: block;
        padding-bottom: 24px;
    }

    .square-page__intro-actions {
        align-items: stretch;
        margin-top: 20px;
    }

    .square-page__compose-link,
    .square-page__auth-button {
        flex: 1 1 0;
    }

    .square-page__toolbar-row {
        align-items: flex-start;
    }

    .square-page__rail {
        grid-template-columns: minmax(0, 1fr);
    }

    .square-page__rail-note {
        grid-column: auto;
    }

    .square-feed-card {
        padding: 18px 17px 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .square-page__compose-link,
    .square-page__auth-button,
    .square-feed-card__icon-btn,
    .square-feed-card,
    .square-page__topic {
        transition: none;
    }
}

/* ===== Custom Sticker Messages ===== */
.sticker {
    display: inline-block;
    max-width: 120px;
    max-height: 120px;
    line-height: 0;
}

.sticker img {
    max-width: 120px;
    max-height: 120px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
    object-fit: contain;
}

/* ===== Sticker Popover (in expression popover) ===== */
.sticker-popover-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 2px 6px;
    flex: 0 0 auto;
}

.sticker-popover-header .sticker-popover-pack-select {
    flex: 1 1 auto;
    min-width: 0;
}

.sticker-popover-header .sticker-popover-manage-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.sticker-popover-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 6px;
    max-height: 220px;
    min-height: 60px;
    padding: 4px;
    overflow-x: hidden;
    overflow-y: auto;
}

.sticker-popover-item {
    cursor: pointer;
    aspect-ratio: 1;
    border-radius: 6px;
    background: #f7f8fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background-color 0.12s ease, transform 0.12s ease;
}

.sticker-popover-item:hover,
.sticker-popover-item:focus {
    background: #e8eef5;
    transform: translateY(-1px);
}

.sticker-popover-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sticker-popover-expand-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #b5b5c3;
    color: #7e8299;
    cursor: pointer;
}

.sticker-popover-expand-slot:hover {
    border-color: #3699ff;
    color: #3699ff;
    background: #f0f7ff;
}

.sticker-popover-add-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #b5b5c3;
    color: #7e8299;
    cursor: pointer;
}

.sticker-popover-add-slot:hover {
    border-color: #1bc5bd;
    color: #1bc5bd;
    background: #f0fffc;
}

.sticker-popover-expand-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 11px;
}

.sticker-popover-expand-inner i {
    font-size: 18px;
}

.sticker-popover-item .sticker-popover-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: rgba(246, 78, 96, 0.9);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-popover-item:hover .sticker-popover-delete-btn,
.sticker-popover-item .sticker-popover-delete-btn:focus {
    opacity: 1;
}

.sticker-popover-delete-btn:hover {
    background: #f64e60;
}

.sticker-popover-empty {
    grid-column: 1 / -1;
    padding: 12px 4px;
    font-size: 13px;
}

.sticker-popover-header {
    gap: 4px;
}

.sticker-popover-header .sticker-popover-create-btn,
.sticker-popover-header .sticker-popover-delete-pack-btn {
    min-width: 32px;
    padding: 0.25rem 0.4rem;
    line-height: 1;
    font-size: 16px;
}

.sticker-popover-footer {
    padding: 4px 2px 0;
    text-align: right;
    flex: 0 0 auto;
}

.sticker-popover-footer .font-size-sm {
    font-size: 12px;
}

/* ===== Sticker Popover ===== */
@media (max-width: 480px) {
    .sticker-popover-grid {
        grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
        max-height: 200px;
    }
}

.square-page__layout.script-page {
    grid-template-columns: minmax(0, 1fr);
}

.script-page .square-page__lead {
    max-width: 46rem;
    margin: 8px 0 0;
    color: #5e6278;
    font-size: 15px;
    line-height: 1.7;
}


.script-genre-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
}

.script-genre-filters.d-none {
    display: none !important;
}

.script-genre-filter {
    appearance: none;
    border: 1px solid rgba(19, 40, 72, 0.12);
    border-radius: 999px;
    padding: 8px 14px;
    background: #fff;
    color: #3f4254;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.script-genre-filter:hover,
.script-genre-filter:focus-visible {
    border-color: #f0c2b8;
    color: #c85c4c;
    outline: none;
}

.script-genre-filter.is-active {
    border-color: transparent;
    background: #e06f5d;
    color: #fff;
}

.script-list-empty {
    grid-column: 1 / -1;
    padding: 28px 18px;
    border: 1px dashed rgba(19, 40, 72, 0.14);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    text-align: center;
    color: #5e6278;
}

.script-list-empty__action {
    display: inline-flex;
    margin-top: 12px;
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    background: #1f3f76;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.script-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.script-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(19, 40, 72, 0.08);
    border-radius: 18px;
    padding: 0;
    background: #fff;
    box-shadow: 0 16px 40px rgba(19, 40, 72, 0.06);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.script-card:visited {
    color: inherit;
}

.script-card:hover,
.script-card:focus-within {
    color: inherit;
    transform: translateY(-2px);
    box-shadow: 0 20px 48px rgba(19, 40, 72, 0.1);
}

.script-card__visual {
    position: relative;
    aspect-ratio: 4 / 5;
    background-color: #d7dde8;
    background-position: center 18%;
    background-size: cover;
    background-repeat: no-repeat;
}

.script-card__visual.is-empty {
    background-image: linear-gradient(160deg, #3a4a63 0%, #1d2433 100%);
}

.script-card__scrim {
    position: absolute;
    inset: auto 0 0;
    height: 46%;
    background: linear-gradient(180deg, transparent, rgba(18, 22, 32, 0.62));
}

.script-card__genre {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 1;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: #3f4254;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: none;
}

.script-card__role {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 28px);
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    background: rgba(18, 22, 32, 0.62);
    color: #fff;
    backdrop-filter: blur(10px);
}

.script-card__role-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    background-position: center 15%;
    background-size: cover;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.script-card__role-avatar + .script-card__role-avatar {
    margin-left: -8px;
}

.script-card__role-name {
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.script-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 16px 16px 18px;
}

.script-card__title {
    margin: 0;
    color: #181c32;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.25;
}

.script-card__summary {
    display: -webkit-box;
    margin: 8px 0 0;
    color: #7e8299;
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.script-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.script-card__cta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: var(--square-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.script-card__cta:hover,
.script-card__cta:focus {
    background: #c85c4c;
    color: #fff;
}

.script-card__meta {
    color: #7e8299;
    font-size: 13px;
}

.script-detail {
    max-width: 760px;
}

.script-detail__hero {
    position: relative;
    overflow: hidden;
    min-height: 340px;
    margin: 8px 0 20px;
    border-radius: 20px;
    background-color: #d7dde8;
    background-position: center 18%;
    background-size: cover;
}

.script-detail__hero.is-empty {
    background-image: linear-gradient(160deg, #3a4a63 0%, #1d2433 100%);
}

.script-detail__scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(18, 22, 32, 0.08), rgba(18, 22, 32, 0.72));
}

.script-detail__cast {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    gap: 16px;
    min-height: 340px;
    padding: 24px;
}

.script-detail__portraits {
    display: flex;
    align-items: center;
    min-width: 0;
}

.script-detail__portrait {
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    border-radius: 50%;
    background-position: center 15%;
    background-size: cover;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85);
}

.script-detail__portrait + .script-detail__portrait {
    margin-left: -16px;
}

.script-detail__genre {
    display: inline-block;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.script-detail__title {
    margin: 0;
    color: #fff;
    font-size: 40px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.1;
}

.script-detail__role-name {
    margin: 6px 0 0;
    color: rgba(255, 255, 255, 0.92);
    font-size: 16px;
    font-weight: 600;
}

.script-detail__summary,
.script-detail__bio {
    color: #5e6278;
    font-size: 15px;
    line-height: 1.75;
}

.script-detail__section {
    margin: 28px 0 8px;
}

.script-detail__section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.script-detail__section-head h2,
.script-detail__section-head h3 {
    margin: 0;
    color: #181c32;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.script-detail__section-head span {
    color: #7e8299;
    font-size: 13px;
    font-weight: 600;
}

.script-chapter-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.script-chapter {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 8px 12px;
    border: 1px solid var(--square-line);
    border-radius: 12px;
    background: var(--square-paper);
    color: var(--square-ink);
}

.script-chapter__index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 8px;
    background: #f1ede7;
    color: var(--square-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.script-chapter__name {
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.script-chapter.is-current {
    border-color: #f0c2b8;
    background: #fbe8e3;
}

.script-chapter.is-current .script-chapter__index {
    background: var(--square-accent);
    color: #fff;
}

.script-chapter.is-done {
    background: #f7f5f1;
}

.script-chapter.is-done .script-chapter__index {
    background: #fbe8e3;
    color: var(--square-accent);
}

.script-detail__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 24px 0 8px;
}

.script-detail__cta,
.script-detail__ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.script-detail__cta {
    border: 0;
    background: var(--square-accent);
    color: #fff;
    min-width: 148px;
    text-decoration: none;
}

.script-detail__cta:hover,
.script-detail__cta:focus {
    background: #c85c4c;
    color: #fff;
}

.script-detail__ghost {
    border: 1px solid var(--square-line);
    background: var(--square-paper);
    color: var(--square-ink);
}

.script-detail__ghost:hover,
.script-detail__ghost:focus {
    border-color: #d5b1a8;
    background: #f1ede7;
    color: var(--square-ink);
}

.script-detail .text-danger {
    margin: 0;
}

.script-detail .script-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--square-accent);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.script-detail .script-back::before {
    content: "←";
}

.landing-shell.is-script-scene,
#kt_chat_entry.is-script-scene {
    background-image:
        linear-gradient(180deg, rgba(247, 245, 241, 0.28), rgba(247, 245, 241, 0.5)),
        var(--script-cover, none) !important;
    background-size: cover !important;
    background-position: center 18% !important;
    background-repeat: no-repeat !important;
}

#kt_chat_content.is-script-room > .card {
    position: relative;
    overflow: hidden;
    background-color: rgba(255, 253, 249, 0.56) !important;
    background-image:
        linear-gradient(180deg, rgba(247, 245, 241, 0.42), rgba(255, 253, 249, 0.62)),
        var(--script-cover, none);
    background-size: cover;
    background-position: center 18%;
    background-repeat: no-repeat;
    transition: background-image 0.45s ease;
}

#kt_chat_content.is-script-room > .card > :not(.script-stage) {
    position: relative;
    z-index: 1;
}

#kt_chat_content.is-script-room .card-header,
#kt_chat_content.is-script-room .card-footer,
#kt_chat_content.is-script-room #kt_chat_match_dropzone {
    background: transparent !important;
    backdrop-filter: none;
    border-color: transparent !important;
    box-shadow: none !important;
}

.landing-shell #kt_chat_content.is-script-room #kt_chat_match_dropzone {
    background: transparent !important;
}

#kt_chat_content.is-script-room .script-peer__name {
    color: #fffdf9;
    text-shadow: 0 1px 8px rgba(23, 33, 38, 0.55);
}

#kt_chat_content.is-script-room .script-peer__title {
    color: rgba(255, 253, 249, 0.88);
    text-shadow: 0 1px 8px rgba(23, 33, 38, 0.55);
}

#kt_chat_content.is-script-room .messages .bg-light-success {
    background-color: #ead9c8 !important;
    color: #172126 !important;
}

#kt_chat_content.is-script-room .messages .bg-light-primary,
#kt_chat_content.is-script-room .messages .bg-light-primary.text-primary {
    background-color: #e06f5d !important;
    color: #fff !important;
}

#kt_chat_content.is-script-room .messages .text-muted {
    color: rgba(255, 253, 249, 0.92) !important;
    text-shadow: 0 1px 6px rgba(23, 33, 38, 0.55);
}

#kt_chat_content.is-script-room .messages .badge {
    background: #f1ede7 !important;
    color: #768087 !important;
    border: 1px solid #e5e1da;
    font-weight: 600;
}

#kt_chat_content.is-script-room .chat-safety-notice span {
    background: #fbe8e3;
    color: #c85c4c;
}

#kt_chat_content.is-script-room textarea {
    background: #fffdf9 !important;
    border-color: #e5e1da !important;
    color: #172126;
}

#kt_chat_content.is-script-room textarea::placeholder {
    color: #a1a7aa;
}

#kt_chat_content.is-script-room .chat-toolbar .btn-clean {
    color: rgba(255, 253, 249, 0.9);
    filter: drop-shadow(0 1px 4px rgba(23, 33, 38, 0.45));
}

#kt_chat_content.is-script-room .chat-operate[data-operate="send"] {
    background-color: #e06f5d !important;
    border-color: #e06f5d !important;
    color: #fff !important;
}

#kt_chat_content.is-script-room .chat-operate[data-operate="send"]:hover,
#kt_chat_content.is-script-room .chat-operate[data-operate="send"]:focus {
    background-color: #c85c4c !important;
    border-color: #c85c4c !important;
    color: #fff !important;
}

#kt_chat_content.is-script-room .script-usage-meter,
#kt_chat_content.is-script-room .script-usage-meter__tokens {
    color: rgba(255, 253, 249, 0.82);
    text-shadow: 0 1px 6px rgba(23, 33, 38, 0.5);
}

#kt_chat_content.is-script-room .script-usage-meter__model {
    color: rgba(255, 253, 249, 0.92);
}

#kt_chat_content.is-script-room .scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 253, 249, 0.42) transparent;
}

#kt_chat_content.is-script-room .scroll::-webkit-scrollbar {
    width: 6px;
}

#kt_chat_content.is-script-room .scroll::-webkit-scrollbar-track {
    margin: 8px 0;
    background: transparent;
}

#kt_chat_content.is-script-room .scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 253, 249, 0.38);
    border-radius: 999px;
}

#kt_chat_content.is-script-room .scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(224, 111, 93, 0.72);
}

.script-stage {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.script-stage__bg {
    position: absolute;
    inset: 0;
    background-position: center 18%;
    background-size: cover;
    filter: saturate(0.9);
    opacity: 0.42;
}

.script-stage__figure {
    position: absolute;
    left: 0;
    bottom: 8%;
    width: min(34%, 228px);
    aspect-ratio: 3 / 4;
    background-position: center 12%;
    background-size: cover;
    -webkit-mask-image:
        linear-gradient(90deg, #000 42%, transparent 96%),
        linear-gradient(180deg, transparent 0%, #000 16%, #000 78%, transparent);
    -webkit-mask-composite: destination-in;
    mask-image:
        linear-gradient(90deg, #000 42%, transparent 96%),
        linear-gradient(180deg, transparent 0%, #000 16%, #000 78%, transparent);
    mask-composite: intersect;
    opacity: 0.88;
}

#kt_chat_content.is-script-room .script-stage__figure {
    display: none;
}

#kt_chat_content.is-script-room .script-peer {
    flex-wrap: wrap;
    gap: 8px 12px;
}

#kt_chat_content.is-script-room .script-peer__back {
    margin-right: 8px;
    color: #fffdf9;
    text-shadow: 0 1px 8px rgba(23, 33, 38, 0.55);
    font-size: 13px;
    font-weight: 600;
}

#kt_chat_content.is-script-room .script-peer .script-usage-meter {
    margin-left: auto;
}

#kt_chat_content.is-script-room .script-choice-dock {
    margin: 0 0 10px;
}

.script-choice-dock__group + .script-choice-dock__group {
    margin-top: 10px;
}

.script-choice-dock__caption {
    margin: 0 0 6px;
    color: #768087;
    font-size: 12px;
    font-weight: 600;
}

.script-choice-dock__btn.is-suggest {
    background: transparent;
    border-style: dashed;
    color: #5c656b;
}

.script-complete-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 1px solid #e5e1da;
    border-radius: 14px;
    background: #fffdf9;
}

.script-complete-bar__eyebrow {
    color: #768087;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.script-complete-bar__title {
    color: #172126;
    font-size: 16px;
    font-weight: 700;
}

.script-complete-bar__actions {
    display: flex;
    gap: 8px;
}

.script-complete-bar__link,
.script-complete-bar__replay {
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
}

.script-complete-bar__link {
    color: #5c656b;
    background: #f1ede7;
}

.script-complete-bar__replay {
    border: 0;
    color: #fff;
    background: #e06f5d;
}

.conversation-list__section {
    padding: 8px 4px 6px;
    color: #768087;
    font-size: 12px;
    font-weight: 700;
}

@media (min-width: 992px) {
    #kt_chat_content.is-script-room .messages {
        padding-left: 0;
    }
}

.script-peer {
    display: flex;
    align-items: center;
    min-width: 0;
    margin-left: 8px;
    gap: 10px;
}

.script-peer__avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    background-position: center 15%;
    background-size: cover;
    box-shadow: 0 0 0 2px rgba(24, 28, 50, 0.08);
}

.script-peer__copy {
    min-width: 0;
}

.script-peer__name {
    overflow: hidden;
    color: #181c32;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.script-peer__title {
    overflow: hidden;
    color: #7e8299;
    font-size: 12px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 991.98px) {
    .script-stage__figure {
        width: 42%;
        bottom: 18%;
        opacity: 0.5;
    }

    .script-detail__hero,
    .script-detail__cast {
        min-height: 240px;
    }
}

@media (max-width: 639.98px) {
    .script-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .script-card__visual {
        aspect-ratio: 5 / 4;
    }

    .script-detail {
        width: 100%;
        min-width: 0;
    }

    .script-detail__hero,
    .script-detail__cast {
        min-height: 360px;
    }

    .script-detail__hero {
        border-radius: 12px;
        background-position: center 20%;
    }

    .script-detail__cast {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-end;
        gap: 14px;
        padding: 18px;
    }

    .script-detail__cast-copy {
        order: -1;
        min-width: 0;
    }

    .script-detail__portraits {
        width: 100%;
        padding-left: 3px;
    }

    .script-detail__portrait {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.88);
    }

    .script-detail__portrait + .script-detail__portrait {
        margin-left: -10px;
    }

    .script-detail__title {
        max-width: 100%;
        font-size: 28px;
        overflow-wrap: anywhere;
    }

    .script-detail__role-name {
        max-width: 100%;
        margin-top: 7px;
        font-size: 14px;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .script-chapter-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .script-detail__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .script-detail__cta,
    .script-detail__ghost {
        width: 100%;
    }

    .script-stage__figure {
        display: none;
    }
}

.script-ai-notice,
.script-ai-badge {
    display: inline-block;
    font-size: 12px;
    color: #8950fc;
}

.script-ai-notice {
    display: block;
    margin: 0 0 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f3eaff;
}

.script-ai-badge {
    margin-right: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #eee5ff;
}

.user-profile-avatar-image {
    background-size: cover;
    background-position: center;
}

.user-profile-bio-text {
    line-height: 1.6;
    white-space: pre-wrap;
}

#kt_profile_aside.is-ai-profile .user-profile-stranger-actions,
#kt_profile_aside.is-ai-profile .user-profile-mole-row {
    display: none !important;
}

#kt_chat_content.is-script-room .chat-dice-trigger,
#kt_chat_content.is-script-room .chat-game-trigger,
#kt_chat_content.is-script-room .chat-image-picker,
#kt_chat_content.is-script-room .chat-coin-gift-trigger,
#kt_chat_content.is-script-room [data-toggle="popover-expression"] {
    display: none !important;
}

#kt_chat_content.is-script-room .script-usage-meter {
    display: flex !important;
}

.script-usage-meter {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    min-width: 7.5rem;
    max-width: 46%;
    padding: 0 2px;
    color: #8a93a6;
    font-size: 11px;
    line-height: 1.35;
    text-align: right;
}

.script-usage-meter__model {
    font-weight: 600;
    color: #5e6678;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.script-usage-meter__tokens {
    white-space: nowrap;
}

.script-choice-dock {
    position: relative;
    z-index: 3;
    margin: 8px 0 10px;
    padding: 0;
    pointer-events: auto;
}

.script-choice-dock__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.script-choice-dock__btn {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid #e5e1da;
    background: #fffdf9;
    color: #172126;
    border-radius: 12px;
    padding: 10px 12px;
    line-height: 1.4;
    cursor: pointer;
    pointer-events: auto;
}

.script-choice-dock__btn:hover:not(:disabled) {
    background: #fbe8e3;
    border-color: #f0c2b8;
    color: #9a4a3d;
}

.script-choice-dock__btn:disabled,
.script-choice-dock__btn.disabled {
    opacity: 0.55;
    cursor: default;
}

/* Script rooms keep Galgame beats, but use the same paper chrome as square/scripts. */
.script-player {
    display: none;
}

body.script-player-active #kt_profile_aside {
    display: none !important;
}

body.script-player-active #kt_chat_content {
    margin-left: 0 !important;
}

body.script-player-active .landing-shell,
body.script-player-active #kt_chat_entry {
    background-image: none !important;
    background-color: #f7f5f1 !important;
}

#kt_chat_content.is-script-player {
    --square-ink: #172126;
    --square-muted: #768087;
    --square-line: #e5e1da;
    --square-paper: #fffdf9;
    --square-accent: #e06f5d;
}

#kt_chat_content.is-script-player > .card {
    position: relative;
    height: min(820px, calc(100dvh - 142px));
    min-height: 560px;
    overflow: hidden;
    border: 1px solid rgba(19, 40, 72, 0.08);
    border-radius: 18px;
    background: #f7f5f1 !important;
    box-shadow: 0 16px 40px rgba(19, 40, 72, 0.08);
    isolation: isolate;
}

#kt_chat_content.is-script-player > .card > .card-header,
#kt_chat_content.is-script-player > .card > .card-body {
    display: none !important;
}

#kt_chat_content.is-script-player .script-stage {
    display: block !important;
    z-index: 0;
}

#kt_chat_content.is-script-player .script-stage::after {
    position: absolute;
    inset: 0;
    z-index: 0;
    content: "";
    background: linear-gradient(180deg, rgba(23, 33, 38, 0.12) 0%, rgba(23, 33, 38, 0.04) 42%, rgba(23, 33, 38, 0.38) 100%);
}

#kt_chat_content.is-script-player .script-stage__bg {
    opacity: 1;
    filter: saturate(0.96) contrast(1.02);
    transform: scale(1.015);
    transition: opacity 420ms ease, transform 1.2s ease;
}

#kt_chat_content.is-script-player .script-stage__bg.is-changing {
    opacity: 0;
}

#kt_chat_content.is-script-player .script-stage__figure {
    z-index: 2;
    bottom: 18%;
    left: 2%;
    width: min(35%, 290px);
    opacity: 1;
    filter: saturate(0.98) drop-shadow(0 16px 24px rgba(23, 33, 38, 0.28));
}

#kt_chat_content.is-script-player .script-player {
    position: absolute !important;
    inset: 0;
    z-index: 3 !important;
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--square-ink);
}

.script-player__topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 64px;
    padding: 8px 12px 8px 8px;
    background: var(--square-paper);
    border-bottom: 1px solid var(--square-line);
}

.script-player__identity {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    gap: 10px;
}

.script-player__actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 8px;
}

.script-player__scene-button {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 12px;
    border: 1px solid var(--square-line);
    border-radius: 999px;
    color: #566168;
    background: #f7f5f1;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.script-player__scene-button:hover,
.script-player__scene-button:focus-visible,
.script-player__scene-button.is-active {
    border-color: #efc9c1;
    color: #b85445;
    background: #fbe8e3;
    outline: none;
}

.script-player__scene-button:disabled {
    cursor: default;
    opacity: 0.45;
}

.script-player__avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    background-position: center 18%;
    background-size: cover;
    background-repeat: no-repeat;
    background-color: #d7dde8;
    box-shadow: 0 0 0 2px rgba(24, 28, 50, 0.08);
}

.script-player__avatar[hidden] {
    display: none !important;
}

.script-player__copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.script-player__title {
    overflow: hidden;
    max-width: 34ch;
    color: var(--square-ink);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.script-player__chapter,
.script-player__safety {
    color: var(--square-muted);
    font-size: 12px;
    line-height: 1.4;
}

.script-player__safety {
    width: 100%;
}

.script-player__icon {
    display: inline-grid;
    width: 40px;
    height: 40px;
    min-width: 40px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #a1a7aa;
    background: transparent;
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease;
}

.script-player__icon:hover,
.script-player__icon:focus-visible {
    color: var(--square-ink);
    background: #f1ede7;
    outline: none;
}

.script-player__icon.is-active {
    color: var(--square-accent);
    background: #fbe8e3;
}

.script-player__icon:active {
    transform: translateY(1px);
}

#kt_chat_content.is-script-player .script-player__topbar .script-usage-meter {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    width: auto;
    min-width: 0;
    max-width: 18rem;
    margin: 0;
    gap: 6px;
    padding: 0;
    color: var(--square-muted) !important;
    font-size: 12px;
    line-height: 1.3;
    text-align: right;
    text-shadow: none;
}

#kt_chat_content.is-script-player .script-player__topbar .script-usage-meter__model,
#kt_chat_content.is-script-player .script-player__topbar .script-usage-meter__tokens {
    overflow: hidden;
    color: inherit !important;
    font-weight: 600;
    text-overflow: ellipsis;
    text-shadow: none !important;
    white-space: nowrap;
}

.script-player__interaction {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: min(650px, calc(100% - 36px));
    min-height: 0;
    margin: auto auto 20px;
    gap: 10px;
}

.script-player__dialogue {
    position: relative;
    z-index: 2;
    flex: 0 1 auto;
    width: min(650px, calc(100% - 36px));
    min-height: 112px;
    max-height: 43%;
    margin: clamp(24px, 6vh, 56px) auto 12px;
    padding: 20px 22px;
    overflow-y: auto;
    border: 1px solid var(--square-line);
    border-radius: 18px;
    color: var(--square-ink);
    background: var(--square-paper);
    box-shadow: 0 16px 40px rgba(19, 40, 72, 0.08);
}

.script-player__line + .script-player__line {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--square-line);
}

.script-player__speaker {
    margin-bottom: 7px;
    overflow: hidden;
    color: var(--square-accent);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

button.script-player__speaker {
    display: block;
    max-width: 100%;
    padding: 0 0 2px;
    border: 0;
    border-bottom: 1px dashed currentColor;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
}

button.script-player__speaker:hover,
button.script-player__speaker:focus-visible {
    color: #b94f40;
    outline: none;
}

.script-player__text {
    color: var(--square-ink);
    font-size: 16px;
    line-height: 1.75;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.script-player__waiting {
    position: absolute;
    right: 22px;
    bottom: 82px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--square-line);
    border-radius: 999px;
    color: var(--square-muted);
    background: var(--square-paper);
    box-shadow: 0 8px 20px rgba(19, 40, 72, 0.08);
    font-size: 12px;
    font-weight: 600;
}

.script-player__waiting span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--square-accent);
    animation: script-wait 900ms ease-in-out infinite alternate;
}

.script-player__narration {
    color: var(--square-ink);
    font-size: 16px;
    line-height: 1.75;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.script-player__narration.is-dialogue-context {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--square-line);
    color: #4f5a60;
}

@keyframes script-wait {
    to { opacity: 0.3; transform: scale(0.72); }
}

#kt_chat_content.is-script-player .script-choice-dock {
    z-index: 5;
    width: min(650px, 100%);
    min-width: 0;
    max-height: 38vh;
    margin: 0 auto;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
}

#kt_chat_content.is-script-player .script-choice-dock__list {
    min-width: 0;
    gap: 8px;
}

#kt_chat_content.is-script-player .script-choice-dock__btn {
    position: relative;
    min-height: 46px;
    padding: 11px 18px;
    border: 1px solid var(--square-line);
    border-radius: 12px;
    color: var(--square-ink);
    background: var(--square-paper);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    box-shadow: none;
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

#kt_chat_content.is-script-player .script-choice-dock__btn:hover:not(:disabled),
#kt_chat_content.is-script-player .script-choice-dock__btn:focus-visible {
    border-color: #d5b1a8;
    color: var(--square-ink);
    background: #fbe8e3;
    outline: none;
}

.script-player__custom {
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    width: min(650px, 100%);
    min-height: 48px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--square-line);
    border-radius: 12px;
    background: var(--square-paper);
}

.script-player__custom:focus-within {
    border-color: #f0c2b8;
    box-shadow: 0 0 0 3px rgba(224, 111, 93, 0.16);
}

#kt_chat_content.is-script-player .script-player__custom textarea {
    width: 100%;
    min-height: 48px;
    max-height: 112px;
    padding: 12px 14px;
    overflow-y: auto;
    border: 0;
    color: var(--square-ink) !important;
    background: transparent !important;
    font: inherit;
    font-size: 14px;
    line-height: 1.55;
    outline: none;
    resize: none;
}

#kt_chat_content.is-script-player .script-player__custom textarea::placeholder {
    color: var(--square-muted);
}

.script-player__custom button {
    display: grid;
    width: 48px;
    min-height: 48px;
    place-items: center;
    padding: 0;
    border: 0;
    color: #fff;
    background: var(--square-accent);
    cursor: pointer;
}

.script-player__custom button:hover:not(:disabled),
.script-player__custom button:focus-visible {
    color: #fff;
    background: #c85c4c;
    outline: none;
}

.script-player__custom button:disabled,
#kt_chat_content.is-script-player .script-player__custom textarea:disabled {
    cursor: default;
    opacity: 0.45;
}

.script-player__transition {
    position: absolute;
    top: 45%;
    left: 50%;
    z-index: 8;
    padding: 10px 18px;
    border: 1px solid var(--square-line);
    border-radius: 999px;
    color: var(--square-ink);
    background: var(--square-paper);
    box-shadow: 0 12px 28px rgba(19, 40, 72, 0.1);
    font-size: 14px;
    font-weight: 700;
    opacity: 0;
    transform: translate(-50%, -44%);
    transition: opacity 260ms ease, transform 260ms ease;
    white-space: nowrap;
}

.script-player__transition.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%);
}

.script-scene-detail {
    position: absolute;
    inset: 0;
    z-index: 15;
    display: grid;
    place-items: center;
    padding: 22px;
}

.script-scene-detail__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(7, 13, 17, 0.88);
    cursor: pointer;
}

.script-scene-detail__panel {
    position: relative;
    z-index: 1;
    width: min(980px, 100%);
    max-height: 100%;
    margin: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    background: #090e11;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
}

.script-scene-detail__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    color: #172126;
    background: rgba(255, 253, 249, 0.94);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    cursor: pointer;
}

.script-scene-detail__close:hover,
.script-scene-detail__close:focus-visible {
    color: var(--square-accent);
    outline: none;
}

.script-scene-detail__image {
    display: block;
    width: 100%;
    max-height: calc(100dvh - 190px);
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #090e11;
}

.script-scene-detail__caption {
    padding: 11px 16px 13px;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.84);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.4;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.script-role-detail {
    position: absolute;
    inset: 0;
    z-index: 14;
    display: grid;
    place-items: center;
    padding: 20px;
}

.script-role-detail__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(15, 23, 28, 0.62);
    cursor: pointer;
}

.script-role-detail__panel {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    max-height: calc(100% - 20px);
    overflow: hidden auto;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 22px;
    color: var(--square-ink);
    background: var(--square-paper);
    box-shadow: 0 24px 70px rgba(7, 16, 22, 0.3);
}

.script-role-detail__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(23, 33, 38, 0.12);
    border-radius: 50%;
    color: var(--square-ink);
    background: rgba(255, 253, 249, 0.92);
    cursor: pointer;
}

.script-role-detail__close:hover,
.script-role-detail__close:focus-visible {
    color: var(--square-accent);
    outline: none;
}

.script-role-detail__photo-wrap {
    position: relative;
    display: grid;
    width: 100%;
    aspect-ratio: 4 / 3;
    place-items: center;
    overflow: hidden;
    background: #ece8e1;
}

.script-role-detail__photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 18%;
}

.script-role-detail__photo[hidden],
.script-role-detail__photo-fallback[hidden] {
    display: none !important;
}

.script-role-detail__photo-fallback {
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    border-radius: 50%;
    color: #a8a096;
    background: rgba(255, 255, 255, 0.68);
    font-size: 28px;
}

.script-role-detail__body {
    padding: 22px 24px 26px;
}

.script-role-detail__body h2 {
    margin: 0;
    color: var(--square-ink);
    font-size: 25px;
    font-weight: 800;
    line-height: 1.3;
}

.script-role-detail__meta {
    margin-top: 7px;
    color: var(--square-muted);
    font-size: 13px;
    font-weight: 600;
}

.script-role-detail__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}

.script-role-detail__tags span {
    padding: 5px 10px;
    border: 1px solid #efd8d2;
    border-radius: 999px;
    color: #a94f42;
    background: #fbeae6;
    font-size: 12px;
    font-weight: 700;
}

.script-role-detail__bio {
    margin: 16px 0 0;
    color: #465157;
    font-size: 15px;
    line-height: 1.8;
    white-space: pre-wrap;
}

.script-history {
    position: absolute;
    inset: 0;
    z-index: 12;
    display: flex;
    flex-direction: column;
    padding: 22px clamp(18px, 5vw, 70px) 34px;
    color: var(--square-ink);
    background: #f7f5f1;
}

.script-history__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--square-line);
}

.script-history__eyebrow,
.script-ending__eyebrow {
    color: var(--square-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.script-history__head h2,
.script-ending h2 {
    margin: 2px 0 0;
    color: var(--square-ink);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.3;
}

.script-history__more {
    align-self: center;
    margin: 15px 0 4px;
    padding: 6px 13px;
    border: 0;
    color: var(--square-muted);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.script-history__more:hover,
.script-history__more:focus-visible {
    color: var(--square-accent);
    outline: none;
}

.script-history__list {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 8px 10px 36px;
    overflow-y: auto;
    scrollbar-color: rgba(224, 111, 93, 0.4) transparent;
}

.script-history__item {
    display: grid;
    grid-template-columns: minmax(70px, 120px) minmax(0, 1fr);
    gap: 18px;
    padding: 13px 0;
    border-bottom: 1px solid var(--square-line);
}

.script-history__speaker {
    overflow: hidden;
    color: var(--square-accent);
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.script-history__text {
    color: var(--square-ink);
    font-size: 14px;
    line-height: 1.75;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.script-history__item.is-player .script-history__speaker {
    color: var(--square-muted);
}

.script-history__item.is-chapter {
    display: block;
    padding: 20px 0 10px;
    border: 0;
    text-align: center;
}

.script-history__item.is-chapter .script-history__speaker {
    color: var(--square-muted);
    font-weight: 600;
}

.script-ending {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 28px;
    text-align: center;
    background: #f7f5f1;
}

.script-ending h2 {
    margin-top: 8px;
    font-size: 34px;
}

.script-ending p {
    margin: 8px 0 24px;
    color: var(--square-muted);
}

.script-ending__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.script-ending__primary,
.script-ending__secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
    padding: 0 22px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.script-ending__primary {
    border: 0;
    color: #fff;
    background: var(--square-accent);
}

.script-ending__secondary {
    border: 1px solid var(--square-line);
    color: var(--square-ink);
    background: var(--square-paper);
}

.script-ending__primary:hover,
.script-ending__primary:focus-visible {
    background: #c85c4c;
    color: #fff;
    outline: none;
}

.script-ending__secondary:hover,
.script-ending__secondary:focus-visible {
    border-color: #d5b1a8;
    background: #f1ede7;
    outline: none;
}

#kt_chat_content.is-script-player > .card > #kt_chat_match_dropzone {
    display: none;
}

#kt_chat_content.is-script-player .chat-toolbar {
    display: none !important;
}

@media (max-width: 767.98px) {
    body.script-player-active #kt_chat_entry .container,
    body.script-player-active #kt_chat_entry .container-fluid {
        padding-right: 0;
        padding-left: 0;
    }

    #kt_chat_content.is-script-player > .card {
        height: calc(100dvh - 72px);
        min-height: 520px;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .script-player__topbar {
        align-items: center;
        min-height: 56px;
        padding: 6px 8px 6px 4px;
        gap: 4px;
    }

    .script-player__identity {
        gap: 8px;
    }

    .script-player__avatar {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .script-player__title {
        max-width: 14ch;
        font-size: 14px;
    }

    .script-player__safety,
    #kt_chat_content.is-script-player .script-player__topbar .script-usage-meter {
        display: none !important;
    }

    .script-player__icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    #kt_chat_content.is-script-player .script-stage__figure {
        display: none;
    }

    .script-player__interaction {
        width: calc(100% - 24px);
        margin-bottom: max(12px, env(safe-area-inset-bottom));
        gap: 8px;
    }

    .script-player__dialogue {
        width: calc(100% - 24px);
        min-height: 104px;
        max-height: 46%;
        margin-top: 20px;
        padding: 17px;
        border-radius: 18px;
    }

    .script-player__speaker {
        font-size: 12px;
    }

    .script-player__text,
    .script-player__narration {
        font-size: 15px;
        line-height: 1.7;
    }

    .script-player__waiting {
        right: 10px;
        bottom: 74px;
    }

    #kt_chat_content.is-script-player .script-choice-dock {
        max-height: 34vh;
    }

    #kt_chat_content.is-script-player .script-choice-dock__btn {
        min-height: 44px;
        padding-top: 9px;
        padding-bottom: 9px;
    }

    .script-player__scene-button {
        min-height: 34px;
        gap: 5px;
        padding: 0 10px;
        font-size: 12px;
    }

    .script-scene-detail {
        padding: 10px;
    }

    .script-scene-detail__panel {
        border-radius: 16px;
    }

    .script-scene-detail__image {
        max-height: calc(100dvh - 140px);
    }

    .script-role-detail {
        padding: 12px;
    }

    .script-role-detail__panel {
        max-height: calc(100% - 8px);
        border-radius: 18px;
    }

    .script-role-detail__photo-wrap {
        aspect-ratio: 16 / 11;
    }

    .script-role-detail__body {
        padding: 18px 18px 22px;
    }

    .script-history {
        padding: 16px 12px max(20px, env(safe-area-inset-bottom));
    }

    .script-history__item {
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 12px;
    }

    .script-ending h2 {
        font-size: 28px;
    }

    .script-ending__actions {
        width: min(300px, 100%);
        flex-direction: column;
    }

    .script-ending__primary,
    .script-ending__secondary {
        width: 100%;
    }

    .script-player__custom {
        grid-template-columns: minmax(0, 1fr) 44px;
        min-height: 44px;
    }

    .script-player__custom textarea,
    .script-player__custom button {
        min-height: 44px;
    }

    .script-player__custom button {
        width: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #kt_chat_content.is-script-player *,
    #kt_chat_content.is-script-player *::before,
    #kt_chat_content.is-script-player *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
