/**
 * 首頁樣式 - Home Page Styles
 * 遊戲列表、遊戲卡片
 */

/* ========== 遊戲區塊 ========== */
.game-section {
    margin-bottom: 2rem;
}

.game-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(212, 165, 32, 0.2);
}

.game-section__title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffe066;
    margin: 0;
}

.game-section__title i {
    font-size: 1.1rem;
    color: #d4a520;
}

.game-section__clear {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 100, 100, 0.3);
    border-radius: 2rem;
    color: rgba(255, 150, 150, 0.8);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
}

.game-section__clear:hover {
    background: rgba(255, 100, 100, 0.15);
    border-color: rgba(255, 100, 100, 0.5);
    color: #ff8888;
}

.game-section__clear i {
    font-size: 0.75rem;
}

/* 橫向滾動遊戲列表 */
.games--horizontal {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.5rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.games--horizontal::-webkit-scrollbar {
    height: 6px;
}

.games--horizontal::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.games--horizontal::-webkit-scrollbar-thumb {
    background: rgba(212, 165, 32, 0.3);
    border-radius: 3px;
}

.games--horizontal::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 165, 32, 0.5);
}

.games--horizontal .game-card {
    flex: 0 0 auto;
    width: 9rem;
    min-height: 11.5rem;
}

/* 網格模式 (用於快捷切換視圖) */
.games--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 0.875rem;
    overflow-x: visible;
    padding-bottom: 0;
}

.games--grid .game-card {
    width: auto;
    min-height: 13rem;
}

/* ========== 篩選列 ========== */
.filter-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.filter-bar .search-bar {
    justify-self: start;
    margin-left: 0;
}

.filter-bar .category-tabs {
    justify-self: center;
}

/* ========== 搜尋列 ========== */
.search-bar {
    flex-shrink: 0;
}

.search-bar__wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 14rem;
    background: rgba(45, 50, 60, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 2rem;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.search-bar__wrapper:focus-within {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(50, 55, 65, 0.9);
}

.search-bar__icon {
    position: absolute;
    left: 0.875rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    pointer-events: none;
}

.search-bar__input {
    width: 100%;
    padding: 0.5rem 2.25rem 0.5rem 2.5rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
}

.search-bar__input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-bar__clear {
    position: absolute;
    right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.6rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.search-bar__clear:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ========== Light Theme 搜尋列 ========== */
.light-theme .search-bar__wrapper {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.light-theme .search-bar__wrapper:focus-within {
    border-color: rgba(184, 134, 11, 0.4);
    background: #fff;
    box-shadow: 0 2px 12px rgba(184, 134, 11, 0.1);
}

.light-theme .search-bar__icon {
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .search-bar__input {
    color: rgba(0, 0, 0, 0.85);
}

.light-theme .search-bar__input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .search-bar__clear {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.5);
}

.light-theme .search-bar__clear:hover {
    background: rgba(0, 0, 0, 0.15);
    color: rgba(0, 0, 0, 0.8);
}

/* ========== 分類頁籤 ========== */
.category-tabs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.category-tabs__scroll {
    display: inline-flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    background: rgba(23, 27, 33, 0.9);
    border-radius: 2rem;
    padding: 0.25rem;
}

.category-tabs__scroll::-webkit-scrollbar {
    display: none;
}

.category-tabs__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.125rem;
    background: transparent;
    border: none;
    border-radius: 1.5rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

.category-tabs__btn i,
.category-tabs__icon {
    font-size: 0.85rem;
    opacity: 0.7;
}

.category-tabs__icon {
    font-style: normal;
    line-height: 1;
}

.category-tabs__btn:hover {
    color: rgba(255, 255, 255, 0.8);
}

.category-tabs__btn:hover i,
.category-tabs__btn:hover .category-tabs__icon {
    opacity: 0.9;
}

.category-tabs__btn--active {
    background: rgba(55, 65, 75, 0.95);
    color: #fff;
    box-shadow: none;
}

.category-tabs__btn--active:hover {
    background: rgba(65, 75, 85, 0.95);
    color: #fff;
}

.category-tabs__btn--active i,
.category-tabs__btn--active .category-tabs__icon {
    opacity: 1;
}

.category-tabs__clear {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 1.5rem;
    color: rgba(239, 68, 68, 0.7);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

.category-tabs__clear:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.category-tabs__clear i {
    font-size: 0.75rem;
}

/* ========== Light Theme 類別頁籤 ========== */
.light-theme .category-tabs__scroll {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.light-theme .category-tabs__btn {
    color: rgba(0, 0, 0, 0.5);
}

.light-theme .category-tabs__btn:hover {
    color: rgba(0, 0, 0, 0.8);
}

.light-theme .category-tabs__btn--active {
    background: rgba(184, 134, 11, 0.1);
    color: #b8860b;
}

.light-theme .category-tabs__btn--active:hover {
    background: rgba(184, 134, 11, 0.15);
    color: #b8860b;
}

/* ========== 舊版快捷切換按鈕 (保留相容性) ========== */
.quick-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.quick-tabs__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(165deg, rgba(30, 25, 18, 0.8) 0%, rgba(20, 18, 12, 0.9) 100%);
    border: 1px solid rgba(212, 165, 32, 0.2);
    border-radius: 2rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: inherit;
    position: relative;
}

.quick-tabs__btn i {
    font-size: 0.9rem;
    transition: transform var(--transition-fast);
}

.quick-tabs__btn:hover {
    background: linear-gradient(165deg, rgba(212, 165, 32, 0.15) 0%, rgba(184, 134, 11, 0.1) 100%);
    border-color: rgba(212, 165, 32, 0.4);
    color: #ffe066;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 165, 32, 0.2);
}

.quick-tabs__btn:hover i {
    transform: scale(1.1);
}

.quick-tabs__btn:focus {
    outline: 2px solid rgba(212, 165, 32, 0.5);
    outline-offset: 2px;
}

.quick-tabs__btn--active {
    background: linear-gradient(135deg, #d4a520 0%, #b8860b 50%, #8b6914 100%);
    border-color: rgba(212, 165, 32, 0.6);
    color: #fff;
    box-shadow:
        0 4px 15px rgba(184, 134, 11, 0.4),
        0 0 20px rgba(184, 134, 11, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.quick-tabs__btn--active:hover {
    background: linear-gradient(135deg, #f5c542 0%, #d4a520 50%, #b8860b 100%);
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(184, 134, 11, 0.5),
        0 0 30px rgba(212, 165, 32, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.quick-tabs__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0.625rem;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
}

.quick-tabs__btn--active .quick-tabs__badge {
    background: rgba(255, 255, 255, 0.25);
}

.quick-tabs__clear {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    margin-left: auto;
    background: transparent;
    border: 1px solid rgba(255, 100, 100, 0.3);
    border-radius: 2rem;
    color: rgba(255, 150, 150, 0.8);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
}

.quick-tabs__clear:hover {
    background: rgba(255, 100, 100, 0.15);
    border-color: rgba(255, 100, 100, 0.5);
    color: #ff8888;
}

.quick-tabs__clear i {
    font-size: 0.8rem;
}

/* ========== 空狀態 ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: rgba(212, 165, 32, 0.4);
}

.empty-state p {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0 0 0.5rem 0;
    color: rgba(255, 255, 255, 0.7);
}

.empty-state span {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ========== Light Theme 空狀態 ========== */
.light-theme .empty-state {
    color: rgba(0, 0, 0, 0.5);
}

.light-theme .empty-state i {
    color: rgba(184, 134, 11, 0.5);
}

.light-theme .empty-state p {
    color: rgba(0, 0, 0, 0.7);
}

.light-theme .empty-state span {
    color: rgba(0, 0, 0, 0.5);
}

/* ========== 遊戲列表 ========== */
.games {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 0.875rem;
}

/* CLS 佔位：遊戲卡由 JS 於 API 回應後才注入，注入前 #gameList 為空（:empty），
   預留一屏高度使 footer 落在首屏外，避免注入撐開時大幅位移（CLS 0.28 → <0.01）。
   一旦注入任何卡片（含篩選少量結果）即不再匹配 :empty，佔位自動取消、不留白。 */
.games:empty {
    min-height: 100vh;
}

/* 卡片進場動畫 */
@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-card {
    animation: cardFadeIn 0.5s ease-out backwards;
}

.game-card:nth-child(1) { animation-delay: 0.05s; }
.game-card:nth-child(2) { animation-delay: 0.1s; }
.game-card:nth-child(3) { animation-delay: 0.15s; }
.game-card:nth-child(4) { animation-delay: 0.2s; }
.game-card:nth-child(5) { animation-delay: 0.25s; }
.game-card:nth-child(6) { animation-delay: 0.3s; }
.game-card:nth-child(7) { animation-delay: 0.35s; }
.game-card:nth-child(8) { animation-delay: 0.4s; }
.game-card:nth-child(n+9) { animation-delay: 0.45s; }

/* 條列顯示模式 */
.games--list-view {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.games--list-view .game-card {
    flex-direction: row;
    height: auto;
    min-height: 5rem;
}

.games--list-view .game-card__image-container {
    width: 6rem;
    height: 5rem;
    flex-shrink: 0;
    padding: 0.5rem;
}

.games--list-view .game-card__image {
    max-width: 100%;
    max-height: 100%;
}

.games--list-view .game-card__info {
    flex: 1;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-top: none;
    border-left: 0.0625rem solid var(--border-dark);
}

.games--list-view .game-card__title {
    text-align: left;
    font-size: var(--font-size-lg);
}

.games--list-view .game-card__description {
    display: none;
}

/* ========== 遊戲卡片 ========== */
.game-card {
    background: linear-gradient(165deg, rgba(25, 22, 18, 0.95) 0%, rgba(18, 16, 12, 0.98) 100%);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    text-align: center;
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.4),
        0 1px 3px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 13rem;
    border: 1px solid rgba(212, 165, 32, 0.15);
}

.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 0.75rem;
    padding: 1px;
    background: linear-gradient(135deg, rgba(212, 165, 32, 0.3), transparent 50%, rgba(184, 134, 11, 0.2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.game-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(212, 165, 32, 0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow:
        0 20px 40px rgba(212, 165, 32, 0.25),
        0 8px 20px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(212, 165, 32, 0.3);
    border-color: rgba(212, 165, 32, 0.5);
}

.game-card:hover::before {
    opacity: 1;
}

.game-card:hover::after {
    opacity: 1;
}

.game-card:focus-within {
    outline: 0.125rem solid var(--color-primary);
    outline-offset: 0.125rem;
}

.game-card__image-container {
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(180deg, rgba(25, 22, 18, 0.6) 0%, rgba(15, 13, 10, 0.8) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem;
    position: relative;
    overflow: hidden;
}

.game-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter var(--transition-normal);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.game-card:hover .game-card__image {
    transform: scale(1.08);
    box-shadow: 0 8px 25px rgba(212, 165, 32, 0.2);
}

/* 禁用狀態的遊戲圖標 */
.game-card--disabled .game-card__image {
    filter: grayscale(100%);
}

/* 遊戲版本號標籤 */
.game-card__version {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: linear-gradient(135deg, #d4a520 0%, #8b6914 100%);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-full);
    box-shadow:
        0 2px 10px rgba(212, 165, 32, 0.5),
        0 0 20px rgba(212, 165, 32, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    z-index: 10;
    line-height: 1;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-card__version:hover,
.game-card__version:focus-visible {
    transform: scale(1.08);
    box-shadow:
        0 4px 14px rgba(212, 165, 32, 0.65),
        0 0 24px rgba(212, 165, 32, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    outline: none;
}

/* 遊戲代碼標籤（左下角，與版本號對稱） */
.game-card__code {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    max-width: 65%;
    background: linear-gradient(135deg, rgba(22, 20, 16, 0.85) 0%, rgba(12, 10, 8, 0.9) 100%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-full);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    z-index: 10;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    /* 純顯示用途，點擊穿透至卡片，不阻擋遊玩或版本號點擊 */
    pointer-events: none;
}

/* 線路未開啟警示（左上角驚嘆號）：demo 有開啟但該線路未開啟此遊戲 */
.game-card__operator-warning {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e6a817 0%, #c0392b 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50%;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.5),
        0 0 12px rgba(230, 168, 23, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    z-index: 12;
    line-height: 1;
    cursor: help;
}

/* Hover 提示（沿用 txn-remark-btn 的 ::after tooltip 模式），置於圖示下方避免溢出卡片頂部 */
.game-card__operator-warning::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    padding: 0.4rem 0.6rem;
    background: #0f0d0a;
    border: 1px solid rgba(230, 168, 23, 0.35);
    border-radius: 0.4rem;
    font-size: 0.65rem;
    font-weight: 500;
    line-height: 1.4;
    color: #fff;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
    z-index: 20;
}

.game-card__operator-warning:hover::after,
.game-card__operator-warning:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 加入最愛按鈕 */
.game-card__favorite {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.875rem;
    height: 1.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 15;
    backdrop-filter: blur(4px);
}

.game-card__favorite:hover {
    background: rgba(255, 100, 100, 0.3);
    border-color: rgba(255, 100, 100, 0.5);
    color: #ff6b6b;
    transform: scale(1.15);
}

.game-card__favorite:focus {
    outline: 2px solid rgba(255, 100, 100, 0.5);
    outline-offset: 2px;
}

.game-card__favorite--active {
    background: linear-gradient(135deg, rgba(255, 80, 80, 0.9) 0%, rgba(220, 50, 80, 0.9) 100%);
    border-color: rgba(255, 100, 100, 0.8);
    color: #fff;
    box-shadow:
        0 2px 10px rgba(255, 80, 80, 0.5),
        0 0 20px rgba(255, 80, 80, 0.3);
}

.game-card__favorite--active:hover {
    background: linear-gradient(135deg, rgba(255, 100, 100, 1) 0%, rgba(240, 70, 100, 1) 100%);
    color: #fff;
    transform: scale(1.15);
}

.game-card__favorite i {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-card__favorite:hover i {
    transform: scale(1.1);
}

.game-card__favorite--active i {
    animation: heartBeat 0.3s ease-out;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.game-card__info {
    flex: 0 0 auto;
    padding: 0.625rem 0.5rem;
    background: linear-gradient(180deg, rgba(22, 20, 16, 0.98) 0%, rgba(16, 14, 10, 1) 100%);
    border-top: 1px solid rgba(212, 165, 32, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 3rem;
    position: relative;
}

.game-card__title {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
    color: rgba(255, 255, 255, 0.95);
    text-align: center;
    line-height: 1.3;
    transition: all var(--transition-normal);
}

.game-card:hover .game-card__title {
    color: #f5c542;
    text-shadow: 0 0 20px rgba(212, 165, 32, 0.5);
}

.game-card__description {
    font-size: var(--font-size-sm);
    color: rgba(180, 180, 200, 0.7);
    margin: 0;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    line-height: 1.4;
}

/* 禁用狀態的遊戲卡片 */
.game-card--disabled {
    opacity: 0.6;
    cursor: default;
}

.game-card--disabled:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

/* ========== 響應式設計 ========== */
@media (max-width: 48rem) {
    /* 篩選列響應式 - 改為垂直堆疊 */
    .filter-bar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .filter-bar .search-bar {
        order: 2;
        width: 100%;
    }

    .filter-bar .category-tabs {
        order: 1;
        width: 100%;
        justify-content: center;
    }

    /* 搜尋列響應式 */
    .search-bar__wrapper {
        width: 100%;
    }

    /* 分類頁籤響應式 */
    .category-tabs {
        width: 100%;
        justify-content: center;
    }

    .category-tabs__scroll {
        max-width: 100%;
    }

    .category-tabs__btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        gap: 0.375rem;
    }

    .category-tabs__btn i {
        font-size: 0.75rem;
    }

    .category-tabs__clear {
        padding: 0.4rem 0.75rem;
        font-size: 0.7rem;
    }

    /* 快捷切換按鈕響應式 */
    .quick-tabs {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .quick-tabs__btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
        gap: 0.375rem;
    }

    .quick-tabs__btn i {
        font-size: 0.8rem;
    }

    .quick-tabs__badge {
        min-width: 1rem;
        height: 1rem;
        font-size: 0.6rem;
        padding: 0 0.25rem;
    }

    .quick-tabs__clear {
        padding: 0.5rem 0.875rem;
        font-size: 0.75rem;
    }

    .quick-tabs__clear span {
        display: none;
    }

    /* 網格模式響應式 */
    .games--grid {
        grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
        gap: 0.5rem;
    }

    .games--grid .game-card {
        min-height: auto;
    }

    /* 遊戲區塊響應式 */
    .game-section {
        margin-bottom: 1.5rem;
    }

    .game-section__header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
    }

    .game-section__title {
        font-size: 1rem;
        gap: 0.5rem;
    }

    .game-section__title i {
        font-size: 0.9rem;
    }

    .game-section__clear {
        padding: 0.375rem 0.75rem;
        font-size: 0.7rem;
    }

    .game-section__clear span {
        display: none;
    }

    .games--horizontal {
        gap: 0.75rem;
    }

    .games--horizontal .game-card {
        width: 8rem;
        min-height: auto;
    }

    .games {
        grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
        gap: 0.5rem;
    }

    .game-card {
        min-height: auto;
        border-radius: 0.625rem;
    }

    .game-card__image-container {
        padding: 0.25rem;
    }

    .game-card__image {
        border-radius: 0.375rem;
    }

    .game-card__info {
        padding: 0.375rem 0.25rem;
        min-height: auto;
        gap: 0.125rem;
    }

    .game-card__title {
        font-size: 0.65rem;
        line-height: 1.2;
    }

    .game-card__description {
        display: none;
    }

    .game-card__version {
        font-size: 0.5rem;
        padding: 0.25rem 0.5rem;
        bottom: 0.375rem;
        right: 0.375rem;
    }

    .game-card__code {
        font-size: 0.5rem;
        padding: 0.25rem 0.5rem;
        bottom: 0.375rem;
        left: 0.375rem;
    }

    .game-card__operator-warning {
        width: 1.25rem;
        height: 1.25rem;
        font-size: 0.6rem;
        top: 0.375rem;
        left: 0.375rem;
    }

    .game-card__favorite {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.8rem;
        top: 0.375rem;
        right: 0.375rem;
    }

    /* 小螢幕條列顯示調整 */
    .games--list-view .game-card__image-container {
        width: 3.5rem;
        aspect-ratio: 1 / 1;
    }

    .games--list-view .game-card__info {
        padding: 0.375rem 0.5rem;
    }

    .games--list-view .game-card__title {
        font-size: var(--font-size-sm);
    }

    .games--list-view .btn {
        font-size: 0.6rem;
        padding: 0.2rem 0.5rem;
        min-height: 1.5rem;
    }
}

@media (max-width: 26rem) {
    .quick-tabs__btn {
        padding: 0.4rem 0.625rem;
        font-size: 0.7rem;
    }

    .quick-tabs__btn span:not(.quick-tabs__badge) {
        display: none;
    }

    .quick-tabs__btn i {
        font-size: 1rem;
    }

    .quick-tabs__clear {
        padding: 0.4rem 0.625rem;
    }

    .games--grid {
        grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
        gap: 0.375rem;
    }

    .games--horizontal .game-card {
        width: 6.5rem;
    }

    .games {
        grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
        gap: 0.375rem;
    }

    .game-card {
        border-radius: 0.5rem;
    }

    .game-card__image-container {
        padding: 0.1875rem;
    }

    .game-card__image {
        border-radius: 0.25rem;
    }

    .game-card__info {
        padding: 0.25rem 0.1875rem;
    }

    .game-card__title {
        font-size: 0.55rem;
    }

    .game-card__version {
        font-size: 0.45rem;
        padding: 0.2rem 0.4rem;
        bottom: 0.25rem;
        right: 0.25rem;
    }

    .game-card__code {
        font-size: 0.45rem;
        padding: 0.2rem 0.4rem;
        bottom: 0.25rem;
        left: 0.25rem;
    }

    .game-card__favorite {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.7rem;
        top: 0.25rem;
        right: 0.25rem;
    }
}

/* ========== 手機版性能優化 ========== */
@media (max-width: 48rem) {
    /* 減少動畫以提升性能 */
    .game-card {
        transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    }

    .game-card:hover {
        transform: translateY(-0.125rem);
    }

    /* 優化圖片載入 */
    .game-card__image {
        will-change: auto;
    }

    /* 減少陰影複雜度 */
    .game-card {
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.15);
    }

    .game-card:hover {
        box-shadow: 0 0.25rem 0.5rem rgba(212, 165, 32, 0.35);
    }
}

/* ========== 觸控設備優化 ========== */
@media (hover: none) and (pointer: coarse) {
    /* 移除hover效果，改用active狀態 */
    .game-card:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }

    .game-card:active {
        transform: translateY(-0.125rem);
        box-shadow: 0 0.25rem 0.5rem rgba(212, 165, 32, 0.35);
    }

    /* 改善滾動性能 */
    body {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}
