:root {
    --widget-width: 720px;
    --widget-height: 210px;
    --icon-size: 210px;
    --background: #000;
    --border: #fff;
    --primary-text: #fff;
    --secondary-text: rgba(255, 255, 255, 0.68);
    --rotation-duration: 7s;
}

* { box-sizing: border-box; }

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: transparent;
    font-family: Inter, Arial, Helvetica, sans-serif;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-widget {
    position: relative;
    display: grid;
    grid-template-columns: var(--icon-size) 1fr;
    width: var(--widget-width);
    height: var(--widget-height);
    overflow: hidden;
    color: var(--primary-text);
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    clip-path: inset(0 100% 0 0);
}

body::before,
body::after {
    content: "";
    position: fixed;
    left: calc(50% - (var(--widget-width) / 2));
    top: calc(50% - (var(--widget-height) / 2));
    width: 2px;
    height: var(--widget-height);
    background: var(--border);
    border-radius: 2px;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
}

body::before {
    transform: scaleY(0);
    transform-origin: center;
}

body.widget-revealing::before {
    animation: drawLeftBorder 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

body.widget-revealing::after {
    animation: moveRightBorder 0.62s 0.36s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.social-widget.reveal-animation {
    visibility: visible;
    animation: revealWidget 0.62s 0.36s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.social-widget.ready {
    opacity: 1;
    visibility: visible;
    clip-path: inset(0);
}

body.widget-ready::before,
body.widget-ready::after { opacity: 0; }

.platform-panel,
.social-information { opacity: 0; }

.social-widget.reveal-animation .platform-panel {
    animation: iconIn 0.3s 0.72s ease-out forwards;
}

.social-widget.reveal-animation .social-information {
    animation: informationIn 0.34s 0.78s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.social-widget.ready .platform-panel,
.social-widget.ready .social-information {
    opacity: 1;
    transform: none;
}

.platform-panel {
    display: grid;
    place-items: center;
    width: var(--icon-size);
    height: 100%;
    border-right: 2px solid var(--border);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.06), transparent 55%),
        #000;
}

.platform-icon {
    width: 88px;
    height: 88px;
}

.platform-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: #fff;
}

.social-information {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 28px 32px;
}

.social-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 17px;
    color: var(--primary-text);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.25em;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.12);
}

.platform-name {
    margin-bottom: 6px;
    color: var(--secondary-text);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.handle {
    max-width: 100%;
    overflow: hidden;
    color: var(--primary-text);
    font-size: 34px;
    font-weight: 850;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rotation-track {
    width: 100%;
    height: 4px;
    margin-top: 24px;
    overflow: hidden;
    background: rgba(255,255,255,0.2);
    border-radius: 999px;
}

.rotation-fill {
    width: 0;
    height: 100%;
    background: #fff;
    border-radius: inherit;
}

.social-widget.ready .rotation-fill.running {
    animation: rotationProgress var(--rotation-duration) linear forwards;
}

.social-widget.hide-animation {
    opacity: 1;
    visibility: visible;
    animation: collapseToRight 0.55s cubic-bezier(0.65, 0, 0.35, 1) forwards;
    border-right-color: transparent;
}

.social-widget.hide-animation .platform-panel,
.social-widget.hide-animation .social-information {
    animation: contentOut 0.22s ease-in forwards;
}

.social-widget.hide-animation .platform-panel { border-right-color: transparent; }
body.widget-hiding::before { opacity: 0; }

body.widget-hiding::after {
    opacity: 1;
    animation: returnBorderToLeft 1.05s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

body.widget-waiting::after {
    opacity: 1;
    transform: translateX(0);
}

body.widget-item-revealing::before {
    opacity: 1;
    transform: scaleY(1);
}

body.widget-item-revealing::after {
    animation: moveRightBorder 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.social-widget.item-reveal-animation {
    visibility: visible;
    animation: revealWidget 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.social-widget.item-reveal-animation .platform-panel {
    animation: iconIn 0.28s 0.34s ease-out forwards;
}

.social-widget.item-reveal-animation .social-information {
    animation: informationIn 0.34s 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes drawLeftBorder {
    from { opacity: 1; transform: scaleY(0); }
    to { opacity: 1; transform: scaleY(1); }
}

@keyframes moveRightBorder {
    0% { opacity: 1; transform: translateX(0); }
    99% { opacity: 1; transform: translateX(calc(var(--widget-width) - 2px)); }
    100% { opacity: 0; transform: translateX(calc(var(--widget-width) - 2px)); }
}

@keyframes revealWidget {
    from { opacity: 1; clip-path: inset(0 100% 0 0); }
    to { opacity: 1; clip-path: inset(0); }
}

@keyframes iconIn {
    from { opacity: 0; transform: scale(1.08); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes informationIn {
    from { opacity: 0; transform: translateX(-18px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes contentOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(12px); }
}

@keyframes collapseToRight {
    from { clip-path: inset(0); }
    /* The separate body::after line draws the moving border. */
    to { clip-path: inset(0 0 0 100%); }
}

@keyframes returnBorderToLeft {
    0%, 52% { opacity: 1; transform: translateX(calc(var(--widget-width) - 2px)); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes rotationProgress {
    from { width: 0; }
    to { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; }
}
