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

html, body {
    width: 100%;
    height: 100%;
    background: transparent;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* 1080-wide stage centered horizontally. Height fills viewport; the user can
   crop the bottom freely in OBS because effects anchor to the top. */
.scene-stage {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1080px;
    height: 100vh;
    pointer-events: none;
}

/* Two 540-wide zones. */
.zone {
    position: absolute;
    top: 0;
    width: 540px;
    height: 100%;
    overflow: visible;
}
.zone.left  { left: 0; }
.zone.right { right: 0; }

/* Effect videos: exactly 540 wide, natural aspect, pinned to the top of the
   zone. Hidden until a clip is actively playing (JS toggles .visible). */
.fx {
    position: absolute;
    top: 0;
    left: 0;
    width: 540px;
    height: auto;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.fx.visible { opacity: 1; }

/* One-shot (time) effects render above looping (diff) effects. */
.fx-diff { z-index: 1; }
.fx-time { z-index: 2; }
.fx-heart { z-index: 4; }

/* ── Hearts HUD ── */
.hearts-hud {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(15, 23, 42, 0.75);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 
                inset 0 0 10px rgba(255, 255, 255, 0.05);
    z-index: 6;
    animation: hud-pulse 3s ease-in-out infinite;
}
.hearts-hud.visible {
    display: flex;
}
.hearts-hud.down {
    background: rgba(8, 47, 73, 0.85);
    border-color: rgba(6, 182, 212, 0.6);
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.5);
    animation: hud-down-pulse 1.5s ease-in-out infinite;
}

/* Gained Hearts / Healing flash glow */
.hearts-hud.heal-flash {
    animation: heal-flash-glow 0.8s ease-out forwards;
}
@keyframes heal-flash-glow {
    0% {
        box-shadow: 0 0 35px rgba(51, 204, 102, 0.85);
        border-color: #33cc66;
        background: rgba(51, 204, 102, 0.15);
    }
    100% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
        border-color: rgba(255, 255, 255, 0.15);
        background: rgba(15, 23, 42, 0.75);
    }
}

/* Revived flash glow */
.hearts-hud.revived-flash {
    animation: revive-flash-glow 1s ease-out forwards;
}
@keyframes revive-flash-glow {
    0% {
        box-shadow: 0 0 40px rgba(103, 232, 249, 1);
        border-color: #67e8f9;
        background: rgba(103, 232, 249, 0.3);
    }
    100% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
        border-color: rgba(255, 255, 255, 0.15);
        background: rgba(15, 23, 42, 0.75);
    }
}

.hud-label {
    font-family: 'Rajdhani', 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 14px;
    color: #ff4d6d;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(255, 77, 109, 0.5);
}
.hearts-hud.down .hud-label {
    color: #67e8f9;
    text-shadow: 0 0 8px rgba(103, 232, 249, 0.5);
}

.hearts-list {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Multiplier text when hearts > 7 */
.heart-counter-label {
    font-family: 'Rajdhani', 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 20px;
    color: #ff4d6d;
    margin-left: 6px;
    letter-spacing: 1.5px;
    text-shadow: 0 0 10px rgba(255, 77, 109, 0.6), 0 2px 4px rgba(0, 0, 0, 0.6);
    vertical-align: middle;
    display: inline-block;
    line-height: 22px;
}

/* SVG Heart Icon (3D Crystal Gemstone) */
.heart-svg {
    width: 24px;
    height: 22px;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.6));
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.heart-svg .heart-socket {
    fill: rgba(15, 23, 42, 0.8);
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1.5px;
}
.heart-svg .heart-body {
    transition: fill 0.3s ease, stroke 0.3s ease;
}
.heart-svg.active {
    animation: heart-beat 1.6s ease-in-out infinite;
}
.heart-svg.active .heart-body {
    fill: url(#heart-radial-active);
    stroke: url(#gold-border-grad);
    stroke-width: 1.8px;
}
.heart-svg.empty .heart-body {
    fill: transparent;
    stroke: transparent;
}
.heart-svg .heart-glint {
    display: none;
}
.heart-svg.active .heart-glint {
    display: block;
    fill: #ffffff;
    opacity: 0.35;
}

/* Crumbling stone heart effect for loss */
.heart-shatter {
    position: absolute;
    width: 24px;
    height: 22px;
    pointer-events: none;
    z-index: 10;
    animation: heart-crumble 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.heart-shatter .heart-socket {
    fill: #374151;
    stroke: #1f2937;
}
.heart-shatter .heart-body {
    fill: #4b5563 !important;
    stroke: #1f2937 !important;
}
.heart-shatter .heart-glint {
    display: none !important;
}

/* Revive Badge showing inside the HUD */
.revive-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Rajdhani', 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 900;
    color: #67e8f9;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(103, 232, 249, 0.7);
    text-transform: uppercase;
}

.revive-icon-svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    animation: revive-spin 2s linear infinite;
    filter: drop-shadow(0 0 4px rgba(103, 232, 249, 0.6));
}

@keyframes revive-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes hud-down-pulse {
    0%, 100% { border-color: rgba(6, 182, 212, 0.4); transform: translateX(-50%) scale(1); }
    50% { border-color: rgba(103, 232, 249, 0.85); transform: translateX(-50%) scale(1.04); }
}
@keyframes heart-beat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
@keyframes heart-crumble {
    0% {
        transform: scale(1.1) rotate(0deg);
        filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.8));
        opacity: 1;
    }
    30% {
        transform: scale(1.3) rotate(-10deg) translateY(-5px);
        filter: drop-shadow(0 0 10px rgba(0,0,0,0.5)) blur(0.5px);
        opacity: 0.9;
    }
    100% {
        transform: scale(0.6) rotate(25deg) translateY(25px);
        filter: blur(4px);
        opacity: 0;
    }
}
@keyframes hud-pulse {
    0%, 100% { border-color: rgba(255, 255, 255, 0.15); }
    50% { border-color: rgba(255, 77, 109, 0.4); }
}
@keyframes hud-shake-pulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-52%) scale(1); }
    20%, 40%, 60%, 80% { transform: translateX(-48%) scale(1); }
}

/* ── Hearts gift guide (which gift = damage / heal / revive) ── */
.hearts-guide-layer {
    position: absolute;
    z-index: 8;
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}
.hearts-guide-layer.visible { display: flex; }
/* per side, top or bottom - placed safely to avoid collision with badges or score progress bar */
.hearts-guide-layer.side-left.pos-top { top: 160px; left: 16px; }
.hearts-guide-layer.side-right.pos-top { top: 160px; right: 16px; }
.hearts-guide-layer.side-left.pos-bottom { bottom: 120px; left: 16px; }
.hearts-guide-layer.side-right.pos-bottom { bottom: 120px; right: 16px; }
.guide-row { display: flex; align-items: center; gap: 6px; }
.guide-icon { width: 32px; height: 32px; object-fit: contain; }
.guide-label {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* ── Solo "full" layout: a single 1080-wide zone, effects full-width. ──
   PK uses the default "split" (two 540 zones) above. Driven by scene_feed.mode. */
body.layout-full .zone.left { width: 1080px; }
body.layout-full .zone.right { display: none; }
body.layout-full .divider { display: none; }
body.layout-full .fx { width: 1080px; }

/* ── Center divider ── */
.divider {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: var(--divider-color, #89c4e2);
    opacity: 0.6;
    display: none;
    z-index: 3;
}
.divider.visible { display: block; }

/* ── Combo-win badges ── */
.combo-badge {
    position: absolute;
    z-index: 5;
    display: none;
    padding: 8px 20px;
    color: #fff;
    font-size: 26px;
    font-weight: 900;
    text-transform: uppercase;
    font-style: italic;
    letter-spacing: 0.06em;
    border: 2px solid #fff;
    border-radius: 6px;
    white-space: nowrap;
    transform: skewX(-12deg);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.combo-badge.visible { display: block; }

/* Left/Right specific gradient themes */
.combo-badge.left {
    background: linear-gradient(135deg, rgba(0, 199, 240, 0.9) 0%, rgba(0, 110, 220, 0.9) 100%);
    border-color: #2ffefb;
    box-shadow: 0 0 15px rgba(0, 199, 240, 0.6), inset 0 0 8px rgba(255, 255, 255, 0.4);
}
.combo-badge.right {
    background: linear-gradient(135deg, rgba(254, 20, 148, 0.9) 0%, rgba(220, 10, 100, 0.9) 100%);
    border-color: #ff55af;
    box-shadow: 0 0 15px rgba(254, 20, 148, 0.6), inset 0 0 8px rgba(255, 255, 255, 0.4);
}

/* Combo pop trigger animation class */
.combo-badge.pop {
    animation: combo-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes combo-pop {
    0% { transform: skewX(-12deg) scale(1); }
    50% { transform: skewX(-12deg) scale(1.25); filter: brightness(1.2); }
    100% { transform: skewX(-12deg) scale(1); }
}

/* Default placement: top of each zone, toward the outer edge. */
.combo-badge.left  { top: 24px; left: 24px; }
.combo-badge.right { top: 24px; right: 24px; }

/* Anchor presets (class set on .scene-stage by JS). */
.scene-stage.anchor-top-left .combo-badge,
.scene-stage.anchor-top-right .combo-badge { top: 24px; }
.scene-stage.anchor-above-avatar .combo-badge { top: 96px; }
.scene-stage.anchor-below-avatar .combo-badge { top: 220px; }

/* Horizontal positioning based on anchors */
/* anchor-top-left: left badge is outer left, right badge is outer right */
.scene-stage.anchor-top-left .combo-badge.left { left: 24px; right: auto; }
.scene-stage.anchor-top-left .combo-badge.right { right: 24px; left: auto; }

/* anchor-top-right: left badge is inner right, right badge is inner left */
.scene-stage.anchor-top-right .combo-badge.left { right: 24px; left: auto; }
.scene-stage.anchor-top-right .combo-badge.right { left: 24px; right: auto; }

/* Center-aligned anchors for above/below avatar */
.scene-stage.anchor-above-avatar .combo-badge,
.scene-stage.anchor-below-avatar .combo-badge {
    left: 50%;
    transform: translateX(-50%) skewX(-12deg);
}
