* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    /* Remove tap highlight on mobile */
}

body {
    background-color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #000;
    height: 100vh;
    overflow: hidden;
    /* Try to keep it one screen */
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    padding: 12px 0 8px;
    flex-shrink: 0;
}

.title {
    font-size: 14px;
    font-weight: normal;
    margin-bottom: 4px;
}

.stats {
    font-size: 11px;
    font-weight: bold;
    color: #333;
}

#list-container {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    /* Pack items tightly */
    justify-content: center;
    padding: 0 10px 10px;
    overflow-y: auto;
    /* Allow scroll if absolutely necessary, but try to fit */
    gap: 4px 4px;
    /* Vertical 4px, Horizontal 4px */
}

.item {
    font-size: 10px;
    line-height: 1.4;
    padding: 2px 4px;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease;
    user-select: none;
    white-space: nowrap;
    /* No wrapping within tags */
    border-radius: 2px;
    /* Slight rounding for better look */
}

/* Hover effect */
@media (hover: hover) {
    .item:hover {
        transform: scale(1.05);
        background-color: #f0f0f0;
        /* Subtle hover state before selection */
    }
}

/* Active/Smeared state */
.item.active {
    background-color: #f4a6c9;
    color: #000;
    /* Keep text black as per "highlight text itself" usually implies bg change or text change. Request said "smear", usually means marker effect (bg). */
}

.item:active {
    transform: scale(0.95);
}

/* Mobile optimization */
@media (max-width: 400px) {
    #list-container {
        gap: 3px 3px;
    }

    .item {
        font-size: 10px;
        /* Keep requested size */
        padding: 1px 3px;
    }
}