:root {
    /* Monochrome Dark Theme */

    --md-sys-color-background: #000000;
    --md-sys-color-on-background: #FFFFFF;

    /* Surfaces */
    --md-sys-color-surface: #111111;
    --md-sys-color-surface-container: #1C1C1C;
    /* Card Background */
    --md-sys-color-surface-container-high: #222222;
    /* Hover/Header */

    /* Grayscale Palette */
    --md-sys-color-primary: #FFFFFF;
    --md-sys-color-secondary: #AAAAAA;
    --md-sys-color-outline: #444444;
    --md-sys-color-outline-variant: #333333;

    /* Functional Colors (Only for comparison) */
    --color-success: #4CAF50;
    /* Green for up */
    --color-error: #F44336;
    /* Red for down */

    /* Elevations */
    --elevation-1: 0px 1px 2px 0px rgba(255, 255, 255, 0.05);

    /* Radii */
    --radius-full: 100px;
    --radius-l: 12px;
    --radius-m: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    font-family: 'Inter';
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 24px;
}

.container {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Header --- */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: linear-gradient(180deg, var(--md-sys-color-surface-container), var(--md-sys-color-surface-container-high));
    border-radius: var(--radius-full);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}


@keyframes ripple {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(76, 175, 80, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0px;
}

p {
    font-weight: 600;
}

/* --- Controls & Input --- */
.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.split-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--md-sys-color-surface-container);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.split-control span {
    font-size: 0.8rem;
    color: var(--md-sys-color-secondary);
    font-weight: 500;
}

#split-input {
    background: transparent;
    border: none;
    color: #FFFFFF;
    width: 40px;
    font-family: inherit;
    font-weight: 700;
    text-align: center;
    outline: none;
    border-bottom: 2px solid var(--md-sys-color-outline);
}

#split-input:focus {
    border-color: #FFFFFF;
}

/* --- Sound Button (Icon Only) --- */
.sound-btn {
    background: transparent;
    color: var(--md-sys-color-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(1);
}

/* Material Icons styling */
.material-icons-round {
    font-size: 20px;
}

.sound-btn:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
}

.sound-btn:active {
    transform: scale(0.85);
}

.sound-btn.active {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.2);
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: var(--md-sys-color-surface-container);
    border-radius: 12px;
    width: fit-content;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--md-sys-color-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #FFFFFF;
}

.tab-btn.active {
    background: var(--md-sys-color-surface-container-high);
    color: #FFFFFF;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* --- Stats Panel --- */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-card {
    background: linear-gradient(180deg, var(--md-sys-color-surface-container), var(--md-sys-color-surface-container-high));
    padding: 24px;
    border-radius: var(--radius-l);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    border: 1px solid var(--md-sys-color-outline-variant);
    min-height: 160px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* --- Morphing Segmented Control --- */
.segmented-control {
    position: relative;
    display: inline-flex;
    background: var(--md-sys-color-surface-dim);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--md-sys-color-outline-variant);
    isolation: isolate;
    /* Create stacking context */
}

.segment-btn {
    position: relative;
    background: transparent;
    border: none;
    color: var(--md-sys-color-secondary);
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px;
    transform: scale(1);
}

.segment-btn:hover:not(.active) {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.05);
}

.segment-btn:active {
    transform: scale(.9);
}

.segment-btn.active {
    color: #000000;
}

.segment-glider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: #FFFFFF;
    border-radius: 6px;
    z-index: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transform: scale(1);
    transform-origin: center;
}

.stat-card h3 {
    font-size: 1rem;
    color: var(--md-sys-color-secondary);
    font-weight: 300;
    text-transform: capitalize;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    min-height: 48px;
}

.stat-card p {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -1px;
    color: #FFFFFF;
}

/* Comparison Badge - Pill Style */
.stat-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #333;
    color: #AAA;
}

.stat-badge.positive {
    color: var(--color-success);
    /* Green Text */
    background: rgba(76, 175, 80, 0.1);
    /* Subtle Green BG */
}

.stat-badge.negative {
    color: var(--color-error);
    /* Red Text */
    background: rgba(244, 67, 54, 0.1);
    /* Subtle Red BG */
}

.stat-badge.neutral {
    color: #888;
}

.usd-sub {
    font-size: 0.9rem;
    color: var(--md-sys-color-secondary);
    font-weight: 500;
}

/* --- Feed --- */
.feed {
    display: flex;
    flex-direction: column;
    gap: 1px;
    /* Tighter gap for monochrome list */
    background: linear-gradient(180deg, var(--md-sys-color-surface-container), var(--md-sys-color-surface-container-high));
    border-radius: var(--radius-l);
    border: 1px solid var(--md-sys-color-outline-variant);
    overflow: hidden;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 60px 20px;
    color: var(--md-sys-color-secondary);
    background: transparent;
}

/* --- Sale Card --- */
.sale-card {
    background: transparent;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    animation: fadeIn 0.3s ease-out;
    transition: transform 0.2s;
}

.sale-card:last-child {
    border-bottom: none;
}

.sale-card:hover {
    background: var(--md-sys-color-surface-container-high);
}

.avatar-wrapper,
.item-thumb-wrapper {
    position: relative;
    overflow: hidden;
    background: #222;
    flex-shrink: 0;
}

/* Avatar */
.avatar-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: block;
    filter: grayscale(100%);
    /* Monochrome Images */
    transition: filter 0.3s, opacity 0.3s;
}

/* Item Thumb */
.item-thumb-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 6px;
}

.item-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: block;
    filter: grayscale(100%);
    /* Monochrome Images */
    transition: filter 0.3s, opacity 0.3s;
}

.sale-card:hover .avatar,
.sale-card:hover .item-thumb {
    filter: grayscale(0%);
    /* Color on hover */
}

/* Skeleton Loading State via class */
.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Content */
.sale-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.item-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.buyer-info {
    font-size: 0.8rem;
    color: #888;
}

.buyer-name {
    color: #BBB;
    font-weight: 500;
}

/* Right Side */
.sale-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.badge {
    color: #FFFFFF;
    background: #333;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    /* Tech feel */
    border: 1px solid #444;
}

.timestamp {
    display: none;
    /* Hide timestamp in mobile view or just generally cleaner */
}

/* --- Robux Icon --- */
.robux-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    display: inline-block;
}

/* --- Animations --- */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- Optimization --- */
.feed,
.stat-card,
.sale-card {
    will-change: transform, opacity;
    transform: translateZ(0);
    /* Hardware Acceleration */
}

@media (max-width: 600px) {
    body {
        padding: 12px;
    }

    .container {
        gap: 16px;
    }

    header {
        padding: 12px 16px;
        border-radius: 24px;
    }

    h1 {
        font-size: 1.3rem;
    }

    .header-controls {
        gap: 12px;
    }

    .segment-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .sound-btn {
        width: 36px;
        height: 36px;
    }

    .material-icons-round {
        font-size: 18px;
    }

    .stats-panel {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 18px;
        min-height: 140px;
    }

    .stat-card h3 {
        font-size: 0.9rem;
    }

    .stat-card p {
        font-size: 1.6rem;
    }

    .stat-badge {
        font-size: 0.75rem;
        padding: 3px 7px;
    }

    .usd-sub {
        font-size: 0.85rem;
    }

    .sale-card {
        padding: 12px 16px;
    }

    .avatar-wrapper {
        width: 42px;
        height: 42px;
    }

    .item-thumb-wrapper {
        width: 42px;
        height: 42px;
    }

    .item-name {
        font-size: 0.9rem;
    }

    .buyer-info {
        font-size: 0.75rem;
    }

    .badge {
        font-size: 0.8rem;
        padding: 3px 8px;
    }
}