:root {
    --nintendo: #e60012;
    --playstation: #003087;
    --xbox: #107c10;
    --sega: #0082c8;
    --arcade: #f0b400;
    /* สีใหม่สำหรับ Arcade */
    --atari: #8a0000;
    /* สีใหม่สำหรับ Atari */
    --pc: #6a1b9a;
    --android: #42ca5f;
    --java: #a8c5e6;
    --driver: #FF9800;
    --default: #16162b;
    --text-light: #fff;
    --card-bg: #fff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --radius: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Prompt', sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Header Styles */
header {
    background-color: var(--default);
    color: var(--text-light);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

.brand-nintendo {
    background-color: var(--nintendo);
}

.brand-playstation {
    background-color: var(--playstation);
}

.brand-xbox {
    background-color: var(--xbox);
}

.brand-sega {
    background-color: var(--sega);
}

.brand-pc {
    background-color: var(--pc);
}

.brand-driver {
    background-color: var(--driver);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.5rem;
}

.logo-icon {
    user-select: none;
}

/* Filter Zone */
.filter-zone {
    padding: 12px 16px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 56px;
    z-index: 90;

}

.search-input {
    width: 100%;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 4px;
}

.filter-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.dropdown {
    position: relative;
    flex: 1;
}

.dropdown-toggle {
    width: 100%;
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    min-height: 36px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.dropdown-item:last-child {
    border-bottom: none;
}

/* Filter Menu Styles */
.filter-menu {
    width: 200px;
    padding: 12px;
}

.filter-group {
    margin-bottom: 8px;
}

.filter-title {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 8px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 4px;
}

/* Card Zone */
.card-zone {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px;
    overflow: hidden;
    max-height: 90px !important;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    border-bottom: 3px solid var(--default);
}

.card:hover {
    border-color: #e0e0e0;
    transform: translateY(-2px);
    transition: transform 0.2s ease;
}

.card.expanded {
    max-height: 260px !important;
}

.card-content {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding-bottom: 1px;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
    flex-shrink: 0;
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    flex: 1;
    min-width: 0;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    justify-content: space-between;
}

.card-title {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.card-chips {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.chip {
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    color: white;
    white-space: nowrap;
}

.chip-brand {
    background-color: var(--default);
}

.chip-platform {
    background-color: var(--default);
}

.card-supported {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.support-tag {
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.65rem;
    color: white;
    white-space: nowrap;
}

.support-android {
    background-color: #26b92b;
}

.support-ios {
    background-color: #8c9faf;
}

.support-pc {
    background-color: #9C27B0;
}

.card-details {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 2);
}

.card.expanded .card-details {
    max-height: 200px;
    opacity: 1;
    transform: translateY(0);
}

.card-desc {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 8px;
    line-height: 1.4;
}

.card-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.btn {
    padding: 4px 8px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    margin-right: 8px;
    transition: var(--transition);
    min-height: 32px;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--default);
    color: white;
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
}

.btn-ios {
    background-color: #7c9ba5 !important;
    color: rgb(255, 255, 255);
}

/* Results Count */
#results-count {
    padding: 8px 16px;
    font-size: 0.9rem;
    color: #666;
    border-bottom: 1px solid #eee;
    background-color: #f9f9f9;
}

/* Responsive */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: row;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .dropdown {
        flex: 1;
        min-width: 0;
    }

    .dropdown-toggle {
        font-size: 0.8rem;
        padding: 6px 8px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .filter-menu {
        width: 180px;
        right: 0;
        left: auto;
    }

    .card-zone {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 8px;
    }

    .card {
        max-height: 70px;
        padding: 10px;
    }

    .card-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .card-title {
        font-size: 0.9rem;
    }

    .chip {
        font-size: 0.65rem;
        padding: 1px 4px;
    }

    .support-tag {
        font-size: 0.6rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .card-zone {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .card-zone {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Info Modal Styles */
#info-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

#info-modal .modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#info-modal .modal-header {
    padding: 20px;
    border-bottom: 1px solid #E5E5EA;
    text-align: center;
}

#info-modal .modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #000;
    margin: 0;
}

#info-modal .modal-body {
    padding: 20px;
    text-align: left;
    line-height: 1.6;
}

#info-modal .modal-body p {
    margin-bottom: 16px;
    color: #333;
    font-size: 14px;
}

#info-modal .modal-body strong {
    color: #007AFF;
}

#info-modal .modal-actions {
    padding: 0px 260px 20px;
    text-align: center;
}

#info-modal .btn {
    min-width: 100px;
    padding: 4px 38px;
    font-size: 18px;
}

/* Info Button in Header */
.info-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.info-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.info-btn:active {
    background-color: rgba(255, 255, 255, 0.3);
}