/* Chess Banter Emote Animations and Styles */

:root {
    --bg: #f7f4ef;
    --card: #fff;
    --surf: #f5efe7;
    --bd: rgba(28, 24, 21, .12);
    --tx: #1c1815;
    --tx2: #6e645b;
    --ac: #ea580c;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    color-scheme: light
}

@media(prefers-color-scheme:dark) {
    :root:not([data-theme=light]) {
        --bg: #171412;
        --card: #211d1a;
        --surf: #2b2521;
        --bd: rgba(255, 245, 235, .1);
        --tx: #f7f3ee;
        --tx2: #a89f96;
        --ac: #f97316;
        color-scheme: dark
    }
}

:root[data-theme=dark] {
    --bg: #171412;
    --card: #211d1a;
    --surf: #2b2521;
    --bd: rgba(255, 245, 235, .1);
    --tx: #f7f3ee;
    --tx2: #a89f96;
    --ac: #f97316;
    color-scheme: dark
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--tx);
    padding: 28px 18px;
    min-height: 100vh
}

.wrap {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 22px
}

.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap
}

h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.02em
}

.sub {
    font-size: 13px;
    color: var(--tx2);
    margin-top: 4px
}

.btn {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--bd);
    background: var(--card);
    color: var(--tx);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer
}

.arena {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    background: var(--card);
    border: 1px solid var(--bd);
    border-radius: 18px;
    padding: 18px
}

@media(max-width:640px) {
    .arena {
        grid-template-columns: 1fr
    }
}

.fighter {
    background: var(--surf);
    border: 1px solid var(--bd);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 150px;
    gap: 10px
}

.fn {
    font-size: 15px;
    font-weight: 700
}

.fr {
    font-size: 12px;
    color: var(--tx2);
    margin-top: 2px
}

.bub {
    background: #fff;
    color: #1c1815;
    border: 2px solid #e2d8cc;
    border-radius: 20px;
    padding: 6px 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
    animation: in .45s cubic-bezier(.3, 1.6, .5, 1)
}

.bub svg {
    width: 104px;
    height: 104px
}

.cap {
    font-size: 11px;
    font-weight: 800;
    color: #c2410c;
    white-space: nowrap
}

@keyframes in {
    0% {
        opacity: 0;
        transform: translateY(14px) scale(.4) rotate(-6deg)
    }

    100% {
        opacity: 1;
        transform: none
    }
}

.deck {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 12px
}

.db {
    background: var(--card);
    border: 1px solid var(--bd);
    border-radius: 14px;
    padding: 10px 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--tx);
    transition: transform .15s, border-color .15s
}

.db:hover {
    transform: translateY(-3px);
    border-color: var(--ac)
}

.db svg {
    width: 76px;
    height: 76px
}

.dn2 {
    font-size: 12px;
    font-weight: 700;
    text-align: center
}

/* ---------- emote rig ---------- */
svg.st {
    overflow: visible
}

.b {
    transform-box: fill-box;
    transform-origin: 50% 100%
}

.fb {
    transform-box: fill-box;
    transform-origin: 50% 50%
}

.ln {
    fill: none;
    stroke: #2a1408;
    stroke-width: 3.4;
    stroke-linecap: round;
    stroke-linejoin: round
}

.ol {
    stroke: #2a1408;
    stroke-width: 2
}

.pl {
    fill: none;
    stroke: #ffb347;
    stroke-width: 3;
    stroke-linecap: round
}

.bl {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: blink 3.6s infinite
}

@keyframes blink {

    0%,
    92%,
    100% {
        transform: scaleY(1)
    }

    95% {
        transform: scaleY(.08)
    }
}

.ds {
    animation: dart 1.5s ease-in-out infinite
}

@keyframes dart {

    0%,
    38% {
        transform: translateX(-2.6px)
    }

    50%,
    88% {
        transform: translateX(2.6px)
    }

    100% {
        transform: translateX(-2.6px)
    }
}

.jw {
    transform-box: fill-box;
    transform-origin: 50% 0;
    animation: jaw .24s ease-in-out infinite alternate
}

@keyframes jaw {
    from {
        transform: scaleY(.7)
    }

    to {
        transform: scaleY(1.15)
    }
}

.yw {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: yaw 2.4s ease-in-out infinite
}

@keyframes yaw {

    0%,
    15%,
    100% {
        transform: scale(.35)
    }

    45%,
    70% {
        transform: scale(1.2, 1.1)
    }
}

.qv {
    transform-box: fill-box;
    transform-origin: 50% 0;
    animation: qv .16s ease-in-out infinite alternate
}

@keyframes qv {
    from {
        transform: scale(1, .85)
    }

    to {
        transform: scale(1.08, 1.1)
    }
}

/* body animations: squash/stretch pivoting on the base */
.ha {
    animation: ha .5s ease-in-out infinite
}

@keyframes ha {

    0%,
    100% {
        transform: rotate(-4deg) scale(1.06, .93)
    }

    50% {
        transform: rotate(4deg) translateY(-9px) scale(.95, 1.06)
    }
}

.qk {
    animation: qk .2s ease-in-out infinite alternate
}

@keyframes qk {
    from {
        transform: translateX(-1.6px) scale(1.03, .97)
    }

    to {
        transform: translateX(1.6px) scale(.98, 1.02)
    }
}

.tl {
    animation: tl 2.4s ease-in-out infinite
}

@keyframes tl {

    0%,
    100% {
        transform: rotate(0) scale(1.01, .99)
    }

    40%,
    70% {
        transform: rotate(-6deg) scale(.99, 1.02)
    }
}

.jt {
    animation: jt .09s linear infinite alternate
}

@keyframes jt {
    from {
        transform: translate(-1.4px, .6px)
    }

    to {
        transform: translate(1.4px, -.6px) scale(1.01)
    }
}

.sw {
    animation: sw 1.8s ease-in-out infinite alternate
}

@keyframes sw {
    from {
        transform: rotate(-4deg) scale(1.02, .98)
    }

    to {
        transform: rotate(4deg) scale(.98, 1.02)
    }
}

.hp {
    animation: hp .36s ease-in-out infinite
}

@keyframes hp {

    0%,
    100% {
        transform: scale(1.08, .9)
    }

    45% {
        transform: translateY(-10px) scale(.93, 1.1)
    }
}

.pp {
    animation: pp 1.8s ease-in-out infinite
}

@keyframes pp {

    0%,
    12%,
    100% {
        transform: scale(1)
    }

    20% {
        transform: scale(1.14, .82)
    }

    32% {
        transform: translateY(-14px) scale(.84, 1.24)
    }

    46% {
        transform: scale(1.05, .95)
    }

    58% {
        transform: scale(.98, 1.03)
    }
}

.sl {
    animation: sl 1.8s ease-in-out infinite
}

@keyframes sl {

    0%,
    25%,
    100% {
        transform: rotate(0)
    }

    35%,
    75% {
        transform: rotate(-7deg) translateY(2px) scale(1.03, .95)
    }
}

.sp2 {
    animation: sp2 2.2s ease-in-out infinite
}

@keyframes sp2 {

    0%,
    100% {
        transform: rotate(0)
    }

    45%,
    65% {
        transform: rotate(3deg) scale(.99, 1.02)
    }
}

.bo {
    animation: bo 1.3s ease-in-out infinite
}

@keyframes bo {

    0%,
    100% {
        transform: scale(1.04, .96)
    }

    40% {
        transform: translateY(-6px) scale(.97, 1.04)
    }
}

.tw {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: tw 1s ease-in-out infinite alternate
}

@keyframes tw {
    from {
        transform: scale(.3) rotate(0);
        opacity: .3
    }

    to {
        transform: scale(1.1) rotate(45deg);
        opacity: 1
    }
}

.fl {
    animation: fl 2.1s ease-out infinite
}

@keyframes fl {
    0% {
        transform: translate(0, 6px) scale(.6);
        opacity: 0
    }

    30% {
        opacity: 1
    }

    100% {
        transform: translate(8px, -16px) scale(1.1);
        opacity: 0
    }
}

.dn {
    animation: dn .9s ease-in infinite
}

@keyframes dn {
    0% {
        transform: translateY(-3px) scale(.7);
        opacity: 0
    }

    25% {
        opacity: 1
    }

    100% {
        transform: translateY(18px);
        opacity: 0
    }
}

.pf {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: pf .8s ease-out infinite
}

@keyframes pf {
    0% {
        transform: translate(0, 0) scale(.4);
        opacity: .95
    }

    100% {
        transform: translate(var(--x, -14px), -14px) scale(1.5);
        opacity: 0
    }
}

.pu {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: pu .55s ease-out infinite
}

@keyframes pu {
    0% {
        transform: scale(.7);
        opacity: 1
    }

    100% {
        transform: scale(1.4);
        opacity: 0
    }
}

.sh {
    animation: sh 2.4s cubic-bezier(.3, 1.5, .5, 1) infinite
}

@keyframes sh {

    0%,
    10% {
        transform: translateY(-34px);
        opacity: 0
    }

    30%,
    88% {
        transform: none;
        opacity: 1
    }

    100% {
        transform: translateY(-34px);
        opacity: 0
    }
}

.gl {
    animation: gl 2.4s ease-in-out infinite
}

@keyframes gl {

    0%,
    40% {
        transform: translateX(-24px);
        opacity: 0
    }

    52% {
        opacity: .9
    }

    66%,
    100% {
        transform: translateX(30px);
        opacity: 0
    }
}

.sk {
    animation: sk 1.8s ease-in-out infinite
}

@keyframes sk {

    0%,
    8%,
    100% {
        transform: translate(34px, 30px) rotate(28deg);
        opacity: 0
    }

    28%,
    78% {
        transform: none;
        opacity: 1
    }
}

.cv {
    animation: cv 2.4s ease-in-out infinite
}

@keyframes cv {

    0%,
    18%,
    100% {
        transform: translate(10px, 18px) rotate(16deg);
        opacity: 0
    }

    40%,
    68% {
        transform: none;
        opacity: 1
    }
}

.cl1 {
    animation: cl1 .6s ease-in infinite alternate
}

@keyframes cl1 {
    from {
        transform: translateX(-9px) rotate(-14deg)
    }

    to {
        transform: translateX(2px)
    }
}

.cl2 {
    animation: cl2 .6s ease-in infinite alternate
}

@keyframes cl2 {
    from {
        transform: translateX(9px) rotate(14deg)
    }

    to {
        transform: translateX(-2px)
    }
}

.cb {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: cb .6s steps(2) infinite alternate
}

@keyframes cb {
    from {
        opacity: 0;
        transform: scale(.4)
    }

    to {
        opacity: 1;
        transform: scale(1.15)
    }
}

.tc {
    animation: tc 2.4s ease-in-out infinite
}

@keyframes tc {

    0%,
    100% {
        transform: translateY(0)
    }

    40%,
    66% {
        transform: translateY(-13px) rotate(-9deg)
    }
}

.md {
    animation: md 1.9s cubic-bezier(.3, .8, .4, 1) infinite
}

@keyframes md {

    0%,
    10% {
        transform: translateY(-26px) rotate(-20deg)
    }

    40% {
        transform: translateY(8px) rotate(14deg)
    }

    50% {
        transform: translateY(-3px) rotate(8deg)
    }

    60%,
    90% {
        transform: translateY(7px) rotate(16deg)
    }

    100% {
        transform: translateY(-26px) rotate(-20deg)
    }
}

.rg {
    animation: rg 1.9s ease-out infinite
}

@keyframes rg {

    0%,
    38% {
        transform: scale(.3);
        opacity: 0
    }

    46% {
        opacity: .9
    }

    100% {
        transform: scale(1.5);
        opacity: 0
    }
}

.sp {
    animation: sp .9s linear infinite
}

@keyframes sp {
    to {
        transform: rotate(360deg)
    }
}

.wv {
    animation: wv .8s ease-in-out infinite alternate
}

@keyframes wv {
    from {
        transform: rotate(-9deg)
    }

    to {
        transform: rotate(11deg)
    }
}

.rk {
    animation: rk .12s ease-in-out infinite alternate
}

@keyframes rk {
    from {
        transform: rotate(-14deg)
    }

    to {
        transform: rotate(14deg)
    }
}

.tr {
    animation: tr 1.3s ease-in-out infinite alternate
}

@keyframes tr {
    from {
        transform: translateY(3px) rotate(-3deg)
    }

    to {
        transform: translateY(-6px) rotate(3deg)
    }
}

.bs {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: bs 1.8s ease-out infinite
}

@keyframes bs {

    0%,
    15% {
        transform: scale(.2) rotate(0);
        opacity: 0
    }

    30% {
        opacity: 1
    }

    60% {
        transform: scale(1.15) rotate(12deg);
        opacity: 1
    }

    100% {
        transform: scale(1.3) rotate(18deg);
        opacity: 0
    }
}

.sm {
    animation: sm .7s ease-in infinite
}

@keyframes sm {

    0%,
    40% {
        transform: translateY(-24px) rotate(-12deg)
    }

    55%,
    100% {
        transform: none
    }
}

.pj {
    animation: pj .7s ease-out infinite
}

@keyframes pj {

    0%,
    50% {
        transform: none
    }

    60% {
        transform: translateY(-12px)
    }

    75%,
    100% {
        transform: none
    }
}

.ev {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: ev 2.4s ease-in-out infinite alternate
}

@keyframes ev {
    from {
        transform: scaleY(.35)
    }

    to {
        transform: scaleY(.95)
    }
}

.tp {
    animation: tp 2.6s ease-in infinite
}

@keyframes tp {

    0%,
    30% {
        transform: rotate(0)
    }

    55% {
        transform: rotate(80deg) translateX(6px)
    }

    72% {
        transform: rotate(74deg)
    }

    92%,
    100% {
        transform: rotate(0)
    }
}

@media(prefers-reduced-motion:reduce) {
    svg.st * {
        animation-duration: 6s !important
    }
}


.animate-fade-in {
    animation: chatFadeIn 200ms ease-out;
}

@keyframes chatFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#emote-picker-drawer {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#emote-picker-grid::-webkit-scrollbar,
#live-chat-messages::-webkit-scrollbar {
    width: 4px;
}

#emote-picker-grid::-webkit-scrollbar-thumb,
#live-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(251, 146, 60, 0.25);
    border-radius: 999px;
}

#emote-picker-grid::-webkit-scrollbar-thumb:hover,
#live-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #ea580c;
}

.play-sidebar-tab {
    cursor: pointer;
    color: #94a3b8;
    background: transparent;
    transition: all 0.2s ease;
}

.play-sidebar-tab:hover {
    color: #f8fafc;
}

.play-sidebar-tab.active {
    background: #ff8a1f;
    color: #0b0f19 !important;
    font-weight: 900;
    box-shadow: 0 2px 10px rgba(255, 138, 31, 0.35);
}

/* Isolated chessboard sticker layer; deliberately distinct from chat bubble CSS. */
.board-emote-layer {
    position: absolute;
    inset: 0;
    z-index: 120;
    overflow: visible;
    pointer-events: none;
}

.board-emote-host {
    position: absolute;
    width: auto;
    max-width: min(320px, calc(100% - 16px));
    animation: board-emote-pop 220ms cubic-bezier(.2, 1.35, .45, 1) both;
}

.board-emote-host-opponent { top: 8px; left: 8px; }
.board-emote-host-player { right: 8px; bottom: 8px; }

.board-emote-card {
    display: flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: 100%;
    padding: 4px 10px 4px 5px;
    color: #f7f3ee;
    background: #211d1a;
    border: 2px solid #ff8a1f;
    border-radius: 20px;
    box-sizing: border-box;
}

.board-emote-icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
}

.board-emote-icon svg { display: block; width: 100%; height: 100%; overflow: visible; }
.board-emote-copy { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.board-emote-name { color: #ffb36b; font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.board-emote-caption { max-width: 190px; color: #f7f3ee; font-size: 11px; font-weight: 800; line-height: 1.2; }

@keyframes board-emote-pop {
    from { opacity: 0; transform: scale(.78); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 480px) {
    .board-emote-host { max-width: min(260px, calc(100% - 16px)); }
    .board-emote-icon { flex-basis: 42px; width: 42px; height: 42px; }
    .board-emote-caption { max-width: 145px; }
}

