/**
 * 共用元件樣式 - Component Styles
 * 按鈕、卡片、下拉選單、表單元件等
 */

/* ========== 按鈕樣式 ========== */
.btn {
    display: inline-flex;
    padding: 0.5rem 1.25rem;
    background: linear-gradient(135deg, #d4a520 0%, #b8860b 50%, #8b6914 100%);
    color: #fff;
    border-radius: 2rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: var(--font-size-sm);
    font-weight: 600;
    border: 1px solid rgba(255, 215, 0, 0.2);
    cursor: pointer;
    font-family: inherit;
    min-height: 2.25rem;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 15px rgba(212, 165, 32, 0.4),
        0 0 20px rgba(255, 215, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.btn:hover,
.btn:focus {
    background: linear-gradient(135deg, #f5c542 0%, #d4a520 50%, #b8860b 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 8px 25px rgba(212, 165, 32, 0.5),
        0 0 35px rgba(255, 215, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    outline: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-slow);
}

.btn:hover::before {
    left: 100%;
}

.btn--disabled {
    background: linear-gradient(135deg, #666 0%, #555 50%, #444 100%);
    cursor: default;
    box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.3);
    opacity: 0.7;
}

.btn--disabled:hover,
.btn--disabled:focus {
    background: linear-gradient(135deg, #666 0%, #555 50%, #444 100%);
    transform: none;
    outline: none;
    box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.3);
}

.btn--disabled::before {
    display: none;
}

/* ========== 環境切換器 ========== */
.env-switcher {
    position: relative;
    margin-left: 1.5rem;
}

.env-switcher__btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: linear-gradient(165deg, rgba(30, 25, 20, 0.7) 0%, rgba(20, 18, 15, 0.9) 100%);
    border: 1px solid rgba(212, 165, 32, 0.25);
    border-radius: 0.625rem;
    padding: 0.375rem 0.625rem;
    color: #f5c542;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.env-switcher__label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.env-switcher__btn:hover {
    background: linear-gradient(165deg, rgba(212, 165, 32, 0.2) 0%, rgba(184, 134, 11, 0.15) 100%);
    border-color: rgba(212, 165, 32, 0.5);
    box-shadow: 0 4px 15px rgba(212, 165, 32, 0.2);
}

.env-switcher__btn:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.env-switcher__arrow {
    font-size: var(--font-size-xs);
    transition: transform var(--transition-normal);
}

.env-switcher__btn[aria-expanded="true"] .env-switcher__arrow {
    transform: rotate(180deg);
}

.env-switcher__dropdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 50%;
    transform: translateX(-50%) translateY(-0.5rem);
    min-width: 100%;
    width: max-content;
    max-width: 300px;
    background: var(--bg-dark-secondary);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all var(--transition-fast);
}

.env-switcher__dropdown--open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.env-switcher__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    position: relative;
    border-bottom: 1px solid #2a2a2a;
    white-space: nowrap;
}

.env-switcher__item:last-child {
    border-bottom: none;
}

.env-switcher__item:hover {
    background: rgba(212, 165, 32, 0.1);
}

.env-switcher__item:focus {
    outline: none;
    background: rgba(212, 165, 32, 0.15);
}

.env-switcher__item--active {
    background: rgba(212, 165, 32, 0.2);
}

.env-switcher__item--active::after {
    content: '✓';
    color: var(--color-primary);
    font-weight: bold;
    font-size: var(--font-size-sm);
    margin-left: 0.5rem;
}

.env-switcher__item-name {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-dark);
}

/* ========== 語言切換器樣式 ========== */
.language-switcher {
    position: relative;
    margin-left: 1rem;
}

/* ========== 彈窗遊戲模式切換 ========== */
.game-mode-switcher {
    display: flex;
    align-items: center;
    margin-left: 0.75rem;
    margin-right: auto;
}

.game-mode-switcher__label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 2rem;
    background: linear-gradient(165deg, rgba(212, 165, 32, 0.12) 0%, rgba(184, 134, 11, 0.08) 100%);
    border: 1px solid rgba(212, 165, 32, 0.25);
    color: #f5c542;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-normal);
}

.game-mode-switcher__label:hover {
    border-color: rgba(212, 165, 32, 0.45);
}

.game-mode-switcher__text {
    white-space: nowrap;
}

.game-mode-switcher__switch {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.game-mode-switcher__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.game-mode-switcher__track {
    display: inline-block;
    width: 2.25rem;
    height: 1.25rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.18);
    transition: background 0.2s ease;
}

.game-mode-switcher__thumb {
    display: block;
    width: 0.9rem;
    height: 0.9rem;
    margin: 0.175rem;
    border-radius: 50%;
    background: #f5f5f5;
    transition: transform 0.2s ease;
}

.game-mode-switcher__input:checked ~ .game-mode-switcher__track {
    background: linear-gradient(135deg, #e6c04a, #d4a520);
}

.game-mode-switcher__input:checked ~ .game-mode-switcher__track .game-mode-switcher__thumb {
    transform: translateX(1rem);
}

.game-mode-switcher__input:focus-visible ~ .game-mode-switcher__track {
    outline: 2px solid rgba(212, 165, 32, 0.6);
    outline-offset: 2px;
}

.language-switcher__btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(165deg, rgba(212, 165, 32, 0.15) 0%, rgba(184, 134, 11, 0.1) 100%);
    border: 1px solid rgba(212, 165, 32, 0.3);
    border-radius: 2rem;
    padding: 0.375rem 1rem;
    color: #f5c542;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
    min-width: 5.5rem;
    box-shadow:
        0 2px 8px rgba(212, 165, 32, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.language-switcher__label {
    letter-spacing: 0.5px;
    white-space: nowrap;
    line-height: 1;
}

.language-switcher__btn:hover {
    background: linear-gradient(165deg, rgba(212, 165, 32, 0.25) 0%, rgba(184, 134, 11, 0.2) 100%);
    border-color: rgba(212, 165, 32, 0.5);
    color: #ffe066;
    transform: translateY(-2px);
    box-shadow:
        0 4px 15px rgba(212, 165, 32, 0.3),
        0 0 20px rgba(212, 165, 32, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

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

.language-switcher__btn i {
    font-size: var(--font-size-sm);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.language-switcher__btn:hover i {
    transform: rotate(180deg);
}

.language-switcher__dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(-0.5rem);
    width: max-content;
    max-width: 420px;
    background: linear-gradient(165deg, rgba(25, 22, 18, 0.98) 0%, rgba(18, 16, 12, 0.99) 100%);
    border: 1px solid rgba(212, 165, 32, 0.25);
    border-radius: var(--radius-lg);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 4px 16px rgba(212, 165, 32, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    overflow: hidden;
    backdrop-filter: blur(12px);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 0.375rem;
    gap: 0.25rem;
}

.language-switcher__dropdown--open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.language-switcher__item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.625rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    white-space: nowrap;
    border-radius: var(--radius-md, 0.5rem);
    border-bottom: none;
}

.language-switcher__item:last-child {
    border-bottom: none;
}

.language-switcher__item:hover {
    background: linear-gradient(90deg, rgba(212, 165, 32, 0.15) 0%, rgba(184, 134, 11, 0.1) 100%);
}

.language-switcher__item:focus {
    outline: none;
    background: linear-gradient(90deg, rgba(212, 165, 32, 0.2) 0%, rgba(184, 134, 11, 0.15) 100%);
}

.language-switcher__item--active {
    background: linear-gradient(90deg, rgba(212, 165, 32, 0.2) 0%, rgba(184, 134, 11, 0.15) 100%);
    border: 1px solid rgba(212, 165, 32, 0.3);
}

.language-switcher__item--active::after {
    content: '';
    display: none;
}

.language-switcher__item--active .language-switcher__item-label {
    color: #ffe066;
    font-weight: 600;
}

.language-switcher__item-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    transition: color var(--transition-fast);
    text-align: center;
}

.language-switcher__item:hover .language-switcher__item-label {
    color: #ffe066;
}

/* ========== 設定選單（手機版彙整環境/語系/主題）========== */
/* 桌面預設隱藏；按鈕外觀沿用 .header__icon，故此處只處理定位與面板 */
.header-settings {
    position: relative;
    display: none;
}

.header-settings__panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 11rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(165deg, rgba(25, 22, 18, 0.98) 0%, rgba(18, 16, 12, 0.99) 100%);
    border: 1px solid rgba(212, 165, 32, 0.25);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 4px 16px rgba(212, 165, 32, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    z-index: var(--z-modal);
    max-height: 70vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all var(--transition-fast);
}

.header-settings__panel--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 手機版：顯示 ⚙ 並把搬入面板的三項改為整列、內層選單就地展開 */
@media (max-width: 48rem) {
    .header-settings {
        display: flex;
        order: 2;          /* 排序：錢包 → 個人(1) → 設定(2) → 登出(3) */
        flex-shrink: 0;
    }

    /* 三項搬入面板後：去除原浮層定位、改整列 */
    .header-settings__panel .language-switcher,
    .header-settings__panel .env-switcher,
    .header-settings__panel .game-mode-switcher {
        position: static;
        margin: 0;
        width: 100%;
    }

    .header-settings__panel .game-mode-switcher__label {
        width: 100%;
        justify-content: space-between;
        min-height: 2.5rem;
        border-radius: var(--radius-md, 0.5rem);
        font-size: 0.8rem;
    }

    .header-settings__panel .game-mode-switcher__text {
        margin-right: auto;
    }

    .header-settings__panel .language-switcher__btn,
    .header-settings__panel .env-switcher__btn,
    .header-settings__panel .theme-toggle,
    .header-settings__panel #logoutBtn {
        width: 100%;
        min-width: 0;
        min-height: 2.5rem;
        margin: 0;
        justify-content: space-between;
        border-radius: var(--radius-md, 0.5rem);
        font-size: 0.8rem;
    }

    /* 主題 / 登出列補文字標籤（按鈕本身僅有圖示）*/
    .header-settings__panel .theme-toggle::before {
        content: "主題";
        font-size: 0.8rem;
        font-weight: 500;
        color: rgba(255, 255, 255, 0.9);
    }

    .header-settings__panel #logoutBtn::before {
        content: "登出";
        font-size: 0.8rem;
        font-weight: 500;
        color: rgba(255, 255, 255, 0.9);
    }

    /* 登出為動作型項目，與設定項稍作間隔 */
    .header-settings__panel #logoutBtn {
        margin-top: 0.25rem;
    }

    /* 內層選單改「就地展開」：關閉時不佔位，開啟時於面板內向下展開 */
    .header-settings__panel .language-switcher__dropdown,
    .header-settings__panel .env-switcher__dropdown {
        position: static;
        transform: none;
        width: 100%;
        max-width: none;
        margin-top: 0.25rem;
        box-shadow: none;
        display: none;
    }

    .header-settings__panel .env-switcher__dropdown--open {
        display: block;
        transform: none;
    }

    .header-settings__panel .language-switcher__dropdown--open {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        transform: none;
    }
}

/* ========== 使用者資訊 ========== */
.user-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
    font-size: var(--font-size-md);
    line-height: 1.2;
    cursor: pointer;            /* 點擊頭像/名稱可開啟個人資訊 */
}

/* 名稱左側頭像：有圖顯示圖，無圖顯示首字母 */
.user-info__avatar {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #d4a520 0%, #f5c542 100%);
    color: #1a1206;
    font-weight: 700;
    font-size: 0.85rem;
    border: 1px solid rgba(245, 197, 66, 0.3);
}

.user-info__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-info__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 600;
    color: var(--color-primary);
}

.user-role {
    color: #888;
    font-size: var(--font-size-sm);
}

/* 手機版：顯示頭像/名稱/權限（緊湊版）；頭像取代通用 👤，名稱過長以 … 收縮 */
@media (max-width: 48rem) {
    .header__right .user-info {
        margin-right: 0;
        min-width: 0;           /* 允許名稱在窄螢幕收縮，避免擠壓餘額 */
        flex-shrink: 1;
    }

    .user-info__avatar {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.75rem;
    }

    .user-info__text {
        min-width: 0;
    }

    .user-name {
        font-size: 0.8rem;
        max-width: 7rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-role {
        font-size: 0.6rem;
        max-width: 7rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* 頭像已代表使用者，隱藏冗餘的通用個人圖標（!important 覆寫 JS inline display）*/
    .header__right .header__icon[aria-label="User Profile"] {
        display: none !important;
    }
}

@media (max-width: 30rem) {
    .user-info {
        gap: 0.375rem;
    }

    .user-name,
    .user-role {
        max-width: 5rem;
    }

    .user-name {
        font-size: 0.75rem;
    }
}

@media (max-width: 25rem) {
    .user-info__avatar {
        width: 1.5rem;
        height: 1.5rem;
    }

    .user-name,
    .user-role {
        max-width: 4rem;
    }
}

/* ========== 錢包資訊 ========== */
.wallet-info {
    display: flex;
    align-items: center;
    margin-right: 1.25rem;
    font-size: var(--font-size-md);
    line-height: 1.2;
    min-height: 2.75rem;
    position: relative;
}

.wallet-info__toggle {
    margin-right: 1rem;
    color: inherit;
    font-size: 1.5rem;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-normal);
}

.wallet-info__toggle:hover {
    color: var(--color-primary);
}

.wallet-info__toggle:focus-visible {
    outline: 0.125rem solid var(--color-primary);
    outline-offset: 0.125rem;
}

.wallet-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.balance-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* 餘額觸發（桌機純文字呈現；手機為下拉觸發按鈕） */
.wallet-balance-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: none;
    border: none;
    color: inherit;
    padding: 0;
    margin: 0;
    font: inherit;
    line-height: 1;
    cursor: default;
}

.wallet-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.wallet-balance {
    font-weight: 600;
    color: inherit;
    font-size: 1.5rem;
    line-height: 1;
    margin: 0;
}

.wallet-currency {
    font-size: var(--font-size-sm);
    color: var(--text-dark-secondary);
    opacity: 0.8;
}

/* 錢包刷新按鈕 */
.wallet-refresh {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: var(--font-size-lg);
    padding: 0.25rem;
    transition: color var(--transition-normal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
}

.wallet-refresh:hover:not(:disabled) {
    color: var(--color-primary);
}

.wallet-refresh:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.wallet-refresh:focus {
    outline: 0.125rem solid var(--color-primary);
    outline-offset: 0.125rem;
}

.wallet-refresh i {
    transition: transform var(--transition-normal);
}

.wallet-refresh i.rotating {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 金流紀錄按鈕 */
.wallet-transactions {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: var(--font-size-lg);
    padding: 0.25rem;
    transition: color var(--transition-normal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
}

.wallet-transactions:hover {
    color: var(--color-primary);
}

.wallet-transactions:focus {
    outline: 0.125rem solid var(--color-primary);
    outline-offset: 0.125rem;
}

/* ========== Snackbar 訊息提示 ========== */
.snackbar {
    visibility: hidden;
    min-width: 280px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 14px 24px;
    position: fixed;
    z-index: var(--z-toast);
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.snackbar--error {
    background-color: var(--color-error);
}

.snackbar--success {
    background-color: var(--color-success);
}

.snackbar--show {
    visibility: visible;
    animation: snackbar-fadein 0.3s, snackbar-fadeout 0.3s 2.7s;
}

@keyframes snackbar-fadein {
    from {
        bottom: 0;
        opacity: 0;
    }
    to {
        bottom: 30px;
        opacity: 1;
    }
}

@keyframes snackbar-fadeout {
    from {
        bottom: 30px;
        opacity: 1;
    }
    to {
        bottom: 0;
        opacity: 0;
    }
}

/* ========== 側邊欄動畫 ========== */
@keyframes sidebarIconFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sidebarTextFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* ========== 側邊欄 (前台專用，排除後台頁面) ========== */
body:not(.admin-page) .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width-expanded, 240px);
    height: 100vh;
    background: linear-gradient(180deg, rgba(18, 16, 12, 0.98) 0%, rgba(12, 10, 8, 0.99) 100%);
    border-right: 1px solid rgba(212, 165, 32, 0.2);
    z-index: var(--z-modal);
    transform: translateX(0);
    transition: width var(--transition-normal), transform var(--transition-normal);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* 側邊欄頂部列 */
.sidebar__header-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: linear-gradient(180deg, rgba(25, 22, 18, 0.95) 0%, rgba(18, 16, 12, 0.9) 100%);
    border-bottom: 1px solid rgba(212, 165, 32, 0.15);
    flex-shrink: 0;
}

/* 側邊欄內部切換按鈕 - 基礎樣式（預設隱藏，桌面版會顯示） */
.sidebar__toggle {
    display: none;
}

/* Casino/Lobby 按鈕 */
.sidebar__lobby-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.sidebar__lobby-btn:hover {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.sidebar__lobby-btn--active {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 縮起時的 Casino 按鈕 */
body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__lobby-btn span {
    display: none;
}

body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__lobby-btn {
    flex: none;
    padding: 0.5rem;
    min-width: 2.5rem;
    width: 100%;
    max-width: 3rem;
}

body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__lobby-btn::before {
    content: "\f522";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.1rem;
}

/* 桌面版：預設顯示，支援展開/縮起 */
@media (min-width: 48.0625rem) {
    body:not(.admin-page) .sidebar {
        transform: translateX(0);
        top: 0;
        height: 100vh;
        z-index: calc(var(--z-sticky) - 1);
    }

    .sidebar__header {
        display: none;
    }

    /* 側邊欄頂部列 - 桌面版 */
    .sidebar__header-row {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    /* 側邊欄內部切換按鈕 - 桌面版顯示 */
    .sidebar__toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        background: transparent;
        border: 1px solid rgba(212, 165, 32, 0.2);
        border-radius: 0.5rem;
        color: rgba(212, 165, 32, 0.8);
        font-size: 1rem;
        cursor: pointer;
        transition: all var(--transition-fast);
        flex-shrink: 0;
    }

    .sidebar__toggle:hover {
        background: rgba(212, 165, 32, 0.15);
        border-color: rgba(212, 165, 32, 0.4);
        color: #d4a520;
    }

    /* 縮起時調整頂部列 */
    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__header-row {
        flex-direction: column;
        padding: 0.75rem 0.5rem;
        gap: 1rem;
    }

    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__toggle {
        width: 100%;
        max-width: 3rem;
    }

    body:not(.admin-page) .sidebar.sidebar--collapsed {
        width: var(--sidebar-width-collapsed, 64px);
    }

    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__section-title {
        opacity: 0;
        height: 0;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }

    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__item,
    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__nav-item {
        justify-content: center;
        padding: 0.875rem 0;
        border-left-width: 0;
        padding-left: 0;
        padding-right: 0;
    }

    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__item span,
    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__nav-item span {
        display: none;
    }

    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__item,
    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__nav-item {
        position: relative;
    }

    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__item i,
    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__nav-item i {
        font-size: 1.25rem;
    }

    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__divider {
        margin: 0.5rem 0.75rem;
    }

    /* 側邊欄項目動畫 - 使用 class 控制 */
    .sidebar__item,
    .sidebar__nav-item {
        opacity: 1;
        transform: translateY(0);
    }

    /* 過渡期間隱藏所有內容 */
    .sidebar.sidebar--hiding .sidebar__item,
    .sidebar.sidebar--hiding .sidebar__nav-item,
    .sidebar.sidebar--hiding .sidebar__section-title,
    .sidebar.sidebar--hiding .sidebar__divider {
        opacity: 0 !important;
        visibility: hidden !important;
        transition: none !important;
    }

    /* 切換按鈕和 Casino 按鈕不參與隱藏動畫 */
    .sidebar.sidebar--hiding .sidebar__toggle,
    .sidebar.sidebar--hiding .sidebar__lobby-btn {
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* 整個項目一起動畫 - 由下往上出現 */
    .sidebar.sidebar--animating .sidebar__item,
    .sidebar.sidebar--animating .sidebar__nav-item,
    .sidebar.sidebar--animating .sidebar__section-title,
    .sidebar.sidebar--animating .sidebar__divider {
        animation: sidebarIconFadeIn 0.2s ease-out backwards;
    }

    /* 錯開動畫延遲 - 由下往上依序出現 */
    /* 第四區塊（遊戲分類）- 最先出現 (header-row是第1, section是第2, divider是第3, section是第4) */
    .sidebar.sidebar--animating .sidebar__section:nth-child(4) .sidebar__item:nth-child(3) { animation-delay: 0s; }
    .sidebar.sidebar--animating .sidebar__section:nth-child(4) .sidebar__item:nth-child(2) { animation-delay: 0.03s; }
    .sidebar.sidebar--animating .sidebar__section:nth-child(4) .sidebar__item:nth-child(1) { animation-delay: 0.06s; }
    .sidebar.sidebar--animating .sidebar__section:nth-child(4) .sidebar__section-title { animation-delay: 0.09s; }

    /* 分隔線 */
    .sidebar.sidebar--animating .sidebar__divider { animation-delay: 0.12s; }

    /* 第二區塊（個人選項）- 較晚出現 */
    .sidebar.sidebar--animating .sidebar__section:nth-child(2) .sidebar__item:nth-child(3) { animation-delay: 0.15s; }
    .sidebar.sidebar--animating .sidebar__section:nth-child(2) .sidebar__item:nth-child(2) { animation-delay: 0.18s; }
    .sidebar.sidebar--animating .sidebar__section:nth-child(2) .sidebar__item:nth-child(1) { animation-delay: 0.21s; }

    /* 縮起時隱藏滾動條 */
    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__nav::-webkit-scrollbar {
        width: 0;
    }

    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__nav {
        scrollbar-width: none;
    }
}

/* 手機版：維持原本的開關行為 */
@media (max-width: 48rem) {
    body:not(.admin-page) .sidebar {
        transform: translateX(-100%);
        width: 260px;
        padding-top: 0;
        z-index: var(--z-modal);
    }

    /* 手機版頂部列樣式 */
    .sidebar__header-row {
        justify-content: space-between;
    }

    /* 手機版顯示切換按鈕（作為關閉按鈕） */
    .sidebar__toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 0.5rem;
        color: rgba(255, 255, 255, 0.7);
        font-size: 1.1rem;
        cursor: pointer;
        flex-shrink: 0;
    }

    .sidebar__toggle:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    body:not(.admin-page) .sidebar.sidebar--open {
        transform: translateX(0);
    }
}

body:not(.admin-page) .sidebar.sidebar--open {
    transform: translateX(0);
}

/* 縮起狀態的 tooltip */
@media (min-width: 48.0625rem) {
    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__item,
    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__nav-item {
        position: relative;
    }

    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__item::after,
    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__nav-item::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 0.5rem);
        top: 50%;
        transform: translateY(-50%);
        background: rgba(25, 22, 18, 0.98);
        color: #ffe066;
        padding: 0.5rem 0.75rem;
        border-radius: 0.5rem;
        font-size: 0.8rem;
        font-weight: 500;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-fast);
        z-index: calc(var(--z-modal) + 1);
        border: 1px solid rgba(212, 165, 32, 0.3);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        pointer-events: none;
    }

    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__item:hover::after,
    body:not(.admin-page) .sidebar.sidebar--collapsed .sidebar__nav-item:hover::after {
        opacity: 1;
        visibility: visible;
    }
}

.sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(212, 165, 32, 0.15);
    background: linear-gradient(180deg, rgba(25, 22, 18, 0.9) 0%, rgba(18, 16, 12, 0.95) 100%);
}

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

.sidebar__title i {
    font-size: 1.25rem;
    color: #d4a520;
}

.sidebar__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(212, 165, 32, 0.2);
    border-radius: 0.5rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar__close:hover {
    background: rgba(212, 165, 32, 0.15);
    border-color: rgba(212, 165, 32, 0.4);
    color: #ffe066;
}

.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0;
}

/* 桌面版側邊欄內容區域滾動 */
@media (min-width: 48.0625rem) {
    body:not(.admin-page) .sidebar {
        padding-top: 0;
    }

    .sidebar__section:first-child {
        padding-top: 0.25rem;
    }
}

.sidebar__nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
}

.sidebar__nav-item:hover {
    background: linear-gradient(90deg, rgba(212, 165, 32, 0.1) 0%, transparent 100%);
    color: #ffe066;
    border-left-color: rgba(212, 165, 32, 0.5);
}

.sidebar__nav-item--active {
    background: linear-gradient(90deg, rgba(212, 165, 32, 0.2) 0%, rgba(184, 134, 11, 0.1) 100%);
    color: #d4a520;
    border-left-color: #d4a520;
}

.sidebar__nav-item i {
    width: 1.25rem;
    text-align: center;
    font-size: 1rem;
}


/* 側邊欄區塊 */
.sidebar__section {
    padding: 0.5rem 0;
}

.sidebar__section-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
}

.sidebar__divider {
    height: 1px;
    background: linear-gradient(90deg, rgba(212, 165, 32, 0.2) 0%, transparent 100%);
    margin: 0.5rem 1rem;
}

/* 側邊欄個人選項按鈕 */
.sidebar__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.sidebar__item:hover {
    background: linear-gradient(90deg, rgba(212, 165, 32, 0.1) 0%, transparent 100%);
    color: #ffe066;
    border-left-color: rgba(212, 165, 32, 0.5);
}

.sidebar__item[aria-pressed="true"],
.sidebar__item--active {
    background: linear-gradient(90deg, rgba(212, 165, 32, 0.2) 0%, rgba(184, 134, 11, 0.1) 100%);
    color: #d4a520;
    border-left-color: #d4a520;
}

.sidebar__item i {
    width: 1.25rem;
    text-align: center;
    font-size: 1rem;
}

/* ========== Light Theme 側邊欄 ========== */
.light-theme.light-theme body:not(.admin-page) .sidebar,
body.light-theme:not(.admin-page) .sidebar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 246, 240, 0.99) 100%);
    border-right: 1px solid rgba(184, 134, 11, 0.15);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.08);
}

.light-theme .sidebar__header-row {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 246, 240, 0.9) 100%);
    border-bottom: 1px solid rgba(184, 134, 11, 0.1);
}

.light-theme .sidebar__section-title {
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .sidebar__divider {
    background: linear-gradient(90deg, rgba(184, 134, 11, 0.15) 0%, transparent 100%);
}

.light-theme .sidebar__item,
.light-theme .sidebar__nav-item {
    color: rgba(0, 0, 0, 0.65);
}

.light-theme .sidebar__item:hover,
.light-theme .sidebar__nav-item:hover {
    background: linear-gradient(90deg, rgba(184, 134, 11, 0.08) 0%, transparent 100%);
    color: #b8860b;
    border-left-color: rgba(184, 134, 11, 0.5);
}

.light-theme .sidebar__item[aria-pressed="true"],
.light-theme .sidebar__item--active,
.light-theme .sidebar__nav-item--active {
    background: linear-gradient(90deg, rgba(184, 134, 11, 0.12) 0%, rgba(184, 134, 11, 0.05) 100%);
    color: #b8860b;
    border-left-color: #b8860b;
}

.light-theme .sidebar__toggle {
    border-color: rgba(184, 134, 11, 0.15);
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .sidebar__toggle:hover {
    background: rgba(184, 134, 11, 0.1);
    border-color: rgba(184, 134, 11, 0.3);
    color: #b8860b;
}

.light-theme .sidebar__close {
    border-color: rgba(184, 134, 11, 0.15);
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .sidebar__close:hover {
    background: rgba(184, 134, 11, 0.1);
    border-color: rgba(184, 134, 11, 0.3);
    color: #b8860b;
}

/* 側邊欄遮罩 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.sidebar-overlay--visible {
    opacity: 1;
    visibility: visible;
}

/* 側邊欄切換按鈕 (Header 內的按鈕) */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(212, 165, 32, 0.15);
    border-radius: 0.75rem;
    background: linear-gradient(165deg, rgba(30, 25, 18, 0.6) 0%, rgba(20, 18, 12, 0.8) 100%);
    color: rgba(255, 215, 0, 0.8);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-right: 0.75rem;
}

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

.sidebar-toggle:focus {
    outline: none;
    color: #f5c542;
    background: linear-gradient(165deg, rgba(212, 165, 32, 0.2) 0%, rgba(184, 134, 11, 0.15) 100%);
    border-color: rgba(212, 165, 32, 0.4);
}

/* Light Theme 側邊欄切換按鈕 */
.light-theme .sidebar-toggle {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(184, 134, 11, 0.15);
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .sidebar-toggle:hover {
    color: #b8860b;
    background: rgba(184, 134, 11, 0.1);
    border-color: rgba(184, 134, 11, 0.3);
    box-shadow: 0 4px 15px rgba(184, 134, 11, 0.15);
}

.light-theme .sidebar-toggle:focus {
    color: #b8860b;
    background: rgba(184, 134, 11, 0.1);
    border-color: rgba(184, 134, 11, 0.3);
}

/* 桌面版隱藏 header 的側邊欄切換按鈕 (前台專用) */
@media (min-width: 48.0625rem) {
    body:not(.admin-page) .sidebar-toggle {
        display: none;
    }
}

/* 當前篩選標籤 */
.current-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(165deg, rgba(212, 165, 32, 0.15) 0%, rgba(184, 134, 11, 0.1) 100%);
    border: 1px solid rgba(212, 165, 32, 0.3);
    border-radius: 2rem;
    font-size: 0.85rem;
    color: #f5c542;
    flex-shrink: 0;
}

.current-filter__label {
    font-weight: 500;
}

.current-filter__clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.65rem;
}

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

/* ========== 列表控制區 ========== */
.list-controls {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 0 1rem 0;
    gap: 1rem;
}

/* ========== 遊戲篩選 ========== */
.game-filter {
    flex: 1;
    max-width: 20rem;
}

.game-filter__input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.game-filter__icon {
    position: absolute;
    left: 0.75rem;
    color: #888;
    font-size: var(--font-size-md);
    pointer-events: none;
}

.game-filter__input {
    width: 100%;
    padding: 0.875rem 2.75rem 0.875rem 2.75rem;
    border: 1px solid rgba(212, 165, 32, 0.2);
    border-radius: 2rem;
    background: linear-gradient(165deg, rgba(25, 22, 18, 0.9) 0%, rgba(18, 16, 12, 0.95) 100%);
    color: var(--text-dark);
    font-size: var(--font-size-md);
    font-family: inherit;
    transition: all var(--transition-normal);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.game-filter__input::placeholder {
    color: rgba(200, 180, 140, 0.5);
}

.game-filter__input:focus {
    outline: none;
    border-color: rgba(212, 165, 32, 0.5);
    box-shadow:
        0 0 0 3px rgba(212, 165, 32, 0.1),
        0 4px 20px rgba(212, 165, 32, 0.15),
        0 0 30px rgba(212, 165, 32, 0.1);
    background: linear-gradient(165deg, rgba(30, 27, 22, 0.95) 0%, rgba(22, 20, 16, 1) 100%);
}

.game-filter__clear {
    position: absolute;
    right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.game-filter__clear:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-dark);
}

.game-filter__clear:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

/* ========== 檢視切換 ========== */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    background-color: rgba(30, 30, 30, 0.8);
    padding: 0.25rem;
    border-radius: var(--radius-md);
}

.view-toggle__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background-color: transparent;
    color: #888;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--font-size-lg);
}

.view-toggle__btn:hover {
    color: var(--color-primary);
    background-color: rgba(212, 165, 32, 0.1);
}

.view-toggle__btn--active {
    color: var(--color-primary);
    background-color: rgba(212, 165, 32, 0.2);
}

/* ========== 響應式調整 ========== */
@media (max-width: 48rem) {
    .sidebar__header {
        padding: 1rem 0.75rem;
    }

    .sidebar__title {
        font-size: 0.9rem;
    }

    .sidebar__nav-item {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .sidebar-toggle {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1rem;
        margin-right: 0.5rem;
    }

    .current-filter {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }

    .env-switcher {
        margin-left: 0.5rem;
    }

    .env-switcher__btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
        gap: 0.25rem;
    }

    .env-switcher__dropdown {
        left: 50%;
        right: auto;
    }

    .language-switcher {
        margin-left: 0.5rem;
    }

    .language-switcher__btn {
        padding: 0.25rem 0.625rem;
        font-size: 0.7rem;
        gap: 0.375rem;
        min-width: auto;
    }

    .language-switcher__label {
        font-size: 0.65rem;
    }

    .language-switcher__dropdown {
        left: auto;
        right: 0;
        transform: translateX(0) translateY(-0.5rem);
        grid-template-columns: repeat(4, 1fr);
        max-width: 320px;
    }

    .language-switcher__dropdown--open {
        transform: translateX(0) translateY(0);
    }

    /* 手機版錢包 - 改為下拉選單 */
    .header__right .wallet-info {
        order: 0;
        margin-right: 0;
        min-width: auto;
        flex-shrink: 0;
        overflow: visible;
        min-height: auto;
        position: relative;
    }

    .header__right .wallet-info__toggle {
        margin-right: 0;
        font-size: 1.125rem;
        cursor: pointer;
        color: rgba(255, 255, 255, 0.7);
        border: 1px solid rgba(212, 165, 32, 0.2);
        background: linear-gradient(165deg, rgba(30, 30, 30, 0.8) 0%, rgba(20, 20, 20, 0.9) 100%);
        padding: 0.5rem;
        min-width: 2.25rem;
        min-height: 2.25rem;
        border-radius: 0.75rem;
        transition: all var(--transition-normal);
    }

    .header__right .wallet-info__toggle:hover,
    .header__right .wallet-info__toggle:focus {
        color: #ffd700;
        background: linear-gradient(165deg, rgba(212, 165, 32, 0.2) 0%, rgba(184, 134, 11, 0.15) 100%);
        border-color: rgba(212, 165, 32, 0.5);
        outline: none;
    }

    /* 餘額明細保持 inline 可視；下拉面板移至 .wallet-actions */
    .header__right .wallet-details {
        display: flex;
        position: static;
    }

    .balance-row {
        gap: 0.375rem;
        flex-wrap: nowrap;
        position: relative;
    }

    /* 餘額數字在手機版為下拉觸發按鈕 */
    .wallet-balance-trigger {
        cursor: pointer;
        padding: 0.4rem 0.6rem;
        border: 1px solid rgba(212, 165, 32, 0.2);
        border-radius: 0.75rem;
        background: linear-gradient(165deg, rgba(30, 30, 30, 0.8) 0%, rgba(20, 20, 20, 0.9) 100%);
        transition: all var(--transition-normal);
    }

    .wallet-balance-trigger:hover,
    .wallet-balance-trigger:focus,
    .wallet-info--open .wallet-balance-trigger {
        border-color: rgba(212, 165, 32, 0.5);
        outline: none;
    }

    .wallet-info--open .wallet-balance-trigger .wallet-balance {
        color: #ffd700;
    }

    .wallet-balance {
        font-size: 1rem;
        margin: 0;
        white-space: nowrap;
        font-weight: 600;
    }

    .wallet-currency {
        font-size: 0.7rem;
        white-space: nowrap;
    }

    /* 刷新 / 金流紀錄按鈕收進下拉面板 */
    .wallet-actions {
        display: none;
        position: absolute;
        top: calc(100% + 0.5rem);
        right: 0;
        background: linear-gradient(165deg, rgba(25, 22, 18, 0.98) 0%, rgba(18, 16, 12, 0.99) 100%);
        border: 1px solid rgba(212, 165, 32, 0.25);
        border-radius: 0.75rem;
        padding: 0.5rem 0.75rem;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(212, 165, 32, 0.1);
        z-index: var(--z-modal);
        gap: 0.75rem;
        backdrop-filter: blur(12px);
    }

    .wallet-info--open .wallet-actions {
        display: inline-flex;
    }

    .wallet-refresh,
    .wallet-transactions {
        font-size: 0.95rem;
        padding: 0.2rem;
        width: 1.75rem;
        height: 1.75rem;
    }

    /* 手機版元素排序：錢包圖示 → 玩家資訊 → 主題切換 → 登出 */
    .header__icon[aria-label="User Profile"] {
        order: 1;
    }

    .theme-toggle {
        order: 2;
    }

    .header__icon[aria-label="Logout"] {
        order: 3;
    }

    .list-controls {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .game-filter {
        order: 2;
        flex: 1 1 100%;
        max-width: none;
    }

    .view-toggle {
        order: 1;
        margin-left: auto;
    }
}

@media (max-width: 30rem) {
    body:not(.admin-page) .sidebar {
        width: 240px;
    }

    .sidebar-toggle {
        width: 2rem;
        height: 2rem;
        font-size: 0.9rem;
        margin-right: 0.25rem;
    }

    .env-switcher {
        margin-left: 0.25rem;
    }

    .env-switcher__btn {
        padding: 0.2rem 0.375rem;
        font-size: 0.65rem;
    }

    .env-switcher__item {
        padding: 0.25rem 0.4rem;
    }

    .env-switcher__item-name {
        font-size: 0.65rem;
    }

    .language-switcher {
        margin-left: 0.25rem;
    }

    .language-switcher__btn {
        padding: 0.2rem 0.5rem;
        font-size: 0.65rem;
        min-width: auto;
    }

    .language-switcher__label {
        font-size: 0.6rem;
        white-space: nowrap;
    }

    .language-switcher__dropdown {
        grid-template-columns: repeat(3, 1fr);
        max-width: 260px;
    }

    .language-switcher__item {
        padding: 0.25rem 0.4rem;
    }

    .language-switcher__item-label {
        font-size: 0.65rem;
    }

    .header__right .wallet-info__toggle {
        font-size: 0.95rem;
        padding: 0.375rem;
        min-width: 2rem;
        min-height: 2rem;
    }
}

@media (max-width: 25rem) {
    .sidebar-toggle {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.8rem;
        margin-right: 0.2rem;
    }

    .env-switcher {
        margin-left: 0.2rem;
    }

    .env-switcher__btn {
        padding: 0.15rem 0.3rem;
        font-size: 0.6rem;
    }

    .env-switcher__dropdown {
        left: 50%;
        right: auto;
    }

    .language-switcher {
        margin-left: 0.2rem;
    }

    .language-switcher__btn {
        padding: 0.15rem 0.4rem;
        font-size: 0.6rem;
        min-width: auto;
    }

    .language-switcher__label {
        font-size: 0.55rem;
        white-space: nowrap;
    }

    .language-switcher__dropdown {
        left: auto;
        right: 0;
        transform: translateX(0) translateY(-0.5rem);
        grid-template-columns: repeat(3, 1fr);
        max-width: 220px;
    }

    .language-switcher__dropdown--open {
        transform: translateX(0) translateY(0);
    }

    .header__right .wallet-info__toggle {
        font-size: 0.85rem;
        padding: 0.35rem;
        min-width: 1.75rem;
        min-height: 1.75rem;
    }

    .btn {
        font-size: 0.5rem;
        padding: 0.125rem 0.375rem;
        min-height: 1.5rem;
        border-radius: 0.75rem;
    }
}

/* ========== 個人資訊 Modal — Premium Redesign ========== */
.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: var(--z-toast);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.profile-modal-overlay--open {
    opacity: 1;
    visibility: visible;
}

.profile-modal {
    width: 90%;
    max-width: 380px;
    max-height: 85vh;
    background: #111010;
    border: 1px solid rgba(212, 165, 32, 0.1);
    border-radius: 1.5rem;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(212, 165, 32, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
    transform: translateY(30px) scale(0.94);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.profile-modal-overlay--open .profile-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Hero banner */
.profile-modal__hero {
    position: relative;
    background: linear-gradient(135deg, #1a1508 0%, #2a1f0a 40%, #1a1508 100%);
    padding: 1.75rem 1.5rem 2.5rem;
    text-align: center;
    overflow: hidden;
}

.profile-modal__hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background: radial-gradient(ellipse at 50% 30%, rgba(212, 165, 32, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.profile-modal__hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 5%, rgba(212, 165, 32, 0.2) 50%, transparent 95%);
}

/* Close button — top right corner */
.profile-modal__close {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    z-index: 2;
}

.profile-modal__close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
    transform: rotate(90deg);
}

/* Avatar */
.profile-modal__avatar {
    position: relative;
    display: inline-flex;
    z-index: 1;
    margin-bottom: 1rem;
}

.profile-modal__avatar-ring {
    position: relative;
    padding: 3px;
    border-radius: 50%;
    box-shadow:
        0 0 24px rgba(212, 165, 32, 0.25),
        0 0 48px rgba(212, 165, 32, 0.08);
}

/* 只讓金色外圈旋轉（漸層無高頻細節，旋轉不會糊）；圖片本身保持靜止以維持清晰 */
.profile-modal__avatar-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #d4a520, #f5c542, #d4a520, #b8860b, #d4a520);
    animation: profileRingSpin 6s linear infinite;
    z-index: 0;
}

@keyframes profileRingSpin {
    to { transform: rotate(360deg); }
}

.profile-modal__avatar-icon {
    position: relative;
    z-index: 1;
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background: #111010;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #f5c542;
    border: 3px solid #111010;
    letter-spacing: -0.02em;
}

/* 更換頭像：把外圈做成可點擊按鈕 */
.profile-modal__avatar-btn {
    position: relative;
    display: block;
    border: none;
    cursor: pointer;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.profile-modal__avatar-btn:focus-visible {
    outline: 2px solid #f5c542;
    outline-offset: 3px;
}

/* 頭像圖片：保持靜止（不套旋轉動畫），避免每幀 transform 取樣造成模糊 */
.profile-modal__avatar-img {
    position: relative;
    z-index: 1;
    display: block;
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    object-fit: cover;
    background: #111010;
    border: 3px solid #111010;
}

/* 相機覆蓋層：hover / focus 時浮現提示可更換 */
.profile-modal__avatar-overlay {
    position: absolute;
    inset: 3px;
    z-index: 2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #f5c542;
    font-size: 1.25rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.profile-modal__avatar-btn:hover .profile-modal__avatar-overlay,
.profile-modal__avatar-btn:focus-visible .profile-modal__avatar-overlay {
    opacity: 1;
}

/* 隱藏的檔案輸入 */
.profile-modal__avatar-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* 上傳中：鎖定互動並以旋轉圖示提示 */
.profile-modal__avatar--loading .profile-modal__avatar-btn {
    pointer-events: none;
    cursor: progress;
}

.profile-modal__avatar--loading .profile-modal__avatar-overlay {
    opacity: 1;
}

/* User identity */
.profile-modal__identity {
    position: relative;
    z-index: 1;
}

.profile-modal__name {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.375rem;
    letter-spacing: -0.01em;
}

.profile-modal__id-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: rgba(212, 165, 32, 0.1);
    border: 1px solid rgba(212, 165, 32, 0.15);
    font-size: 0.7rem;
    font-weight: 600;
    color: #d4a520;
    letter-spacing: 0.04em;
}

.profile-modal__id-badge i {
    font-size: 0.55rem;
    opacity: 0.7;
}

/* 名稱列右側（顯示模式）：暱稱值 + 編輯按鈕；編輯模式時可換行容納輸入框 */
.profile-modal__row-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-width: 60%;
    min-width: 0;
}

/* 名稱列的暱稱值不換行，過長以省略號顯示，避免擠成多行 */
.profile-modal__row-right .profile-modal__row-value {
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
    word-break: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-modal__edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid rgba(212, 165, 32, 0.25);
    border-radius: 50%;
    background: rgba(212, 165, 32, 0.1);
    color: #d4a520;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.profile-modal__edit-btn:hover {
    background: rgba(212, 165, 32, 0.22);
    border-color: rgba(212, 165, 32, 0.5);
    transform: scale(1.08);
}

.profile-modal__edit-btn:focus-visible {
    outline: 2px solid rgba(212, 165, 32, 0.6);
    outline-offset: 2px;
}

/* 暱稱編輯模式：輸入框 + 確認/取消 */
.profile-modal__nickname-edit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.profile-modal__nickname-input {
    width: clamp(6rem, 34vw, 9rem);
    padding: 0.35rem 0.55rem;
    border: 1px solid rgba(212, 165, 32, 0.35);
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: right;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-modal__nickname-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-weight: 400;
}

.profile-modal__nickname-input:focus {
    border-color: rgba(212, 165, 32, 0.7);
    box-shadow: 0 0 0 3px rgba(212, 165, 32, 0.15);
}

.profile-modal__nickname-input--error {
    border-color: #e5534b;
    box-shadow: 0 0 0 3px rgba(229, 83, 75, 0.18);
}

.profile-modal__nickname-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.profile-modal__nickname-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    font-size: 0.75rem;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.profile-modal__nickname-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.profile-modal__nickname-btn:not(:disabled):hover {
    transform: scale(1.08);
    filter: brightness(1.1);
}

.profile-modal__nickname-btn--confirm {
    background: linear-gradient(135deg, #d4a520, #f5c542);
    color: #1a1508;
}

.profile-modal__nickname-btn--cancel {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.profile-modal__nickname-error {
    flex-basis: 100%;
    text-align: right;
    color: #ff8a82;
    font-size: 0.72rem;
    line-height: 1.2;
}

.profile-modal__nickname-error:empty {
    display: none;
}

/* 幣別下拉選單（編輯模式） */
.profile-modal__currency-select {
    width: clamp(7rem, 42vw, 10.5rem);
    max-width: 100%;
    min-width: 0;
    padding: 0.35rem 0.5rem;
    border: 1px solid rgba(212, 165, 32, 0.35);
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-modal__currency-select:focus {
    border-color: rgba(212, 165, 32, 0.7);
    box-shadow: 0 0 0 3px rgba(212, 165, 32, 0.15);
}

.profile-modal__currency-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.profile-modal__currency-select option {
    background: #1a1508;
    color: #fff;
}

/* Body content */
.profile-modal__body {
    padding: 1.25rem 1.5rem 1.5rem;
    overflow-y: auto;
    max-height: calc(85vh - 14rem);
}

/* Section */
.profile-modal__section {
    margin-bottom: 1.25rem;
}

.profile-modal__section:last-child {
    margin-bottom: 0;
}

.profile-modal__section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(212, 165, 32, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    padding-left: 0.125rem;
}

.profile-modal__section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(212, 165, 32, 0.12), transparent);
}

/* Info rows */
.profile-modal__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s ease;
}

.profile-modal__row:last-child {
    border-bottom: none;
}

.profile-modal__row:hover {
    background: rgba(212, 165, 32, 0.02);
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-radius: 0.5rem;
}

.profile-modal__row-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.profile-modal__row-icon {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: rgba(212, 165, 32, 0.06);
    color: #d4a520;
    font-size: 0.75rem;
}

.profile-modal__row-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
}

.profile-modal__row-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-align: right;
    max-width: 55%;
    word-break: break-word;
    line-height: 1.35;
}

/* Timestamps — compact style */
.profile-modal__timestamps {
    display: flex;
    gap: 0.5rem;
}

.profile-modal__timestamp {
    flex: 1;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    text-align: center;
    transition: border-color 0.2s ease;
}

.profile-modal__timestamp:hover {
    border-color: rgba(212, 165, 32, 0.12);
}

.profile-modal__timestamp-label {
    display: block;
    font-size: 0.6rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.4rem;
}

.profile-modal__timestamp-value {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

/* Entrance animations */
.profile-modal__row,
.profile-modal__timestamp {
    opacity: 0;
    transform: translateY(8px);
    animation: profileFadeIn 0.35s ease forwards;
}

.profile-modal__row:nth-child(1) { animation-delay: 0.05s; }
.profile-modal__row:nth-child(2) { animation-delay: 0.1s; }
.profile-modal__row:nth-child(3) { animation-delay: 0.15s; }
.profile-modal__row:nth-child(4) { animation-delay: 0.2s; }

.profile-modal__timestamp:nth-child(1) { animation-delay: 0.25s; }
.profile-modal__timestamp:nth-child(2) { animation-delay: 0.3s; }

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

/* Loading */
.profile-modal__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

.profile-modal__loading i {
    font-size: 1.5rem;
    color: #d4a520;
}

/* Error */
.profile-modal__error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 0.75rem;
    text-align: center;
}

.profile-modal__error i {
    font-size: 1.75rem;
    color: #ef4444;
    opacity: 0.8;
}

.profile-modal__error span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ===== Light Theme ===== */
.light-theme .profile-modal {
    background: #fefefe;
    border-color: rgba(184, 134, 11, 0.1);
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(184, 134, 11, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.light-theme .profile-modal__hero {
    background: linear-gradient(135deg, #fdf8ed 0%, #faf0d6 40%, #fdf8ed 100%);
}

.light-theme .profile-modal__hero::before {
    background: radial-gradient(ellipse at 50% 30%, rgba(184, 134, 11, 0.08) 0%, transparent 60%);
}

.light-theme .profile-modal__hero::after {
    background: linear-gradient(90deg, transparent 5%, rgba(184, 134, 11, 0.15) 50%, transparent 95%);
}

.light-theme .profile-modal__close {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.35);
}

.light-theme .profile-modal__close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.7);
}

.light-theme .profile-modal__avatar-ring::before {
    background: conic-gradient(from 0deg, #b8860b, #d4a520, #b8860b, #8b6914, #b8860b);
}

.light-theme .profile-modal__avatar-icon {
    background: #fefefe;
    color: #8b6914;
    border-color: #fefefe;
}

.light-theme .profile-modal__avatar-img {
    background: #fefefe;
    border-color: #fefefe;
}

.light-theme .profile-modal__name {
    color: #1a1814;
}

.light-theme .profile-modal__id-badge {
    background: rgba(184, 134, 11, 0.08);
    border-color: rgba(184, 134, 11, 0.15);
    color: #8b6914;
}

.light-theme .profile-modal__edit-btn {
    background: rgba(184, 134, 11, 0.1);
    border-color: rgba(184, 134, 11, 0.25);
    color: #8b6914;
}

.light-theme .profile-modal__edit-btn:hover {
    background: rgba(184, 134, 11, 0.2);
    border-color: rgba(184, 134, 11, 0.45);
}

.light-theme .profile-modal__nickname-input {
    background: #fffdf7;
    border-color: rgba(184, 134, 11, 0.35);
    color: #1a1814;
}

.light-theme .profile-modal__nickname-input::placeholder {
    color: rgba(26, 24, 20, 0.35);
}

.light-theme .profile-modal__nickname-input:focus {
    border-color: rgba(184, 134, 11, 0.7);
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.15);
}

.light-theme .profile-modal__nickname-btn--confirm {
    background: linear-gradient(135deg, #b8860b, #d4a520);
    color: #fff;
}

.light-theme .profile-modal__nickname-btn--cancel {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.5);
}

.light-theme .profile-modal__nickname-error {
    color: #c0392b;
}

.light-theme .profile-modal__currency-select {
    background: #fffdf7;
    border-color: rgba(184, 134, 11, 0.35);
    color: #1a1814;
}

.light-theme .profile-modal__currency-select:focus {
    border-color: rgba(184, 134, 11, 0.7);
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.15);
}

.light-theme .profile-modal__currency-select option {
    background: #fff;
    color: #1a1814;
}

.light-theme .profile-modal__section-title {
    color: rgba(139, 105, 20, 0.5);
}

.light-theme .profile-modal__section-title::after {
    background: linear-gradient(90deg, rgba(184, 134, 11, 0.1), transparent);
}

.light-theme .profile-modal__row {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

.light-theme .profile-modal__row:hover {
    background: rgba(184, 134, 11, 0.03);
}

.light-theme .profile-modal__row-icon {
    background: rgba(184, 134, 11, 0.07);
    color: #8b6914;
}

.light-theme .profile-modal__row-label {
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .profile-modal__row-value {
    color: rgba(0, 0, 0, 0.8);
}

.light-theme .profile-modal__timestamp {
    background: rgba(0, 0, 0, 0.015);
    border-color: rgba(0, 0, 0, 0.05);
}

.light-theme .profile-modal__timestamp:hover {
    border-color: rgba(184, 134, 11, 0.15);
}

.light-theme .profile-modal__timestamp-label {
    color: rgba(0, 0, 0, 0.35);
}

.light-theme .profile-modal__timestamp-value {
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .profile-modal__loading {
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .profile-modal__loading i {
    color: #b8860b;
}

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

/* ===== 響應式 ===== */
@media (max-width: 30rem) {
    .profile-modal {
        width: 94%;
        max-height: 90vh;
        border-radius: 1.25rem;
    }

    .profile-modal__hero {
        padding: 1.5rem 1.25rem 2rem;
    }

    .profile-modal__avatar-icon {
        width: 4rem;
        height: 4rem;
        font-size: 1.5rem;
    }

    .profile-modal__name {
        font-size: 1.15rem;
    }

    .profile-modal__body {
        padding: 1rem 1.25rem 1.25rem;
    }

    .profile-modal__timestamps {
        flex-direction: column;
        gap: 0.375rem;
    }
}

/* ========== 金流紀錄 Modal — Premium Glassmorphism + Neon ========== */

/* --- Overlay --- */
.txn-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.txn-modal-overlay--open {
    opacity: 1;
    visibility: visible;
}

/* --- Modal Container --- */
.txn-modal {
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    background: linear-gradient(165deg,
        rgba(22, 20, 16, 0.96) 0%,
        rgba(14, 12, 10, 0.98) 100%);
    border: 1px solid rgba(212, 165, 32, 0.12);
    border-radius: 1.5rem;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(212, 165, 32, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transform: translateY(2rem) scale(0.94);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.35s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.txn-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(212, 165, 32, 0.25) 30%,
        rgba(245, 197, 66, 0.4) 50%,
        rgba(212, 165, 32, 0.25) 70%,
        transparent 100%);
}

.txn-modal-overlay--open .txn-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* --- Header --- */
.txn-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.375rem;
    background: linear-gradient(180deg, rgba(212, 165, 32, 0.03) 0%, transparent 100%);
}

.txn-modal__header h2 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(245, 197, 66, 0.85);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.02em;
}

.txn-modal__header h2 i {
    font-size: 0.9rem;
    color: rgba(245, 197, 66, 0.6);
}

.txn-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.625rem;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.txn-modal__close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    transform: rotate(90deg);
}

/* --- Body --- */
.txn-modal__body {
    padding: 0 1.375rem 1rem;
    overflow-y: auto;
    flex: 1;
    max-height: 32rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 165, 32, 0.15) transparent;
}

.txn-modal__body::-webkit-scrollbar {
    width: 4px;
}

.txn-modal__body::-webkit-scrollbar-track {
    background: transparent;
}

.txn-modal__body::-webkit-scrollbar-thumb {
    background: rgba(212, 165, 32, 0.15);
    border-radius: 2px;
}

.txn-modal__body {
    -webkit-mask-image: linear-gradient(to bottom, #000 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 85%, transparent 100%);
}

.txn-modal__body:hover,
.txn-modal__body:active {
    -webkit-mask-image: none;
    mask-image: none;
}

/* --- Summary Bar --- */
.txn-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    margin-bottom: 0.75rem;
    background: rgba(212, 165, 32, 0.04);
    border: 1px solid rgba(212, 165, 32, 0.06);
    border-radius: 0.75rem;
}

.txn-summary__item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
}

.txn-summary__item i {
    color: rgba(212, 165, 32, 0.5);
    font-size: 0.7rem;
}

.txn-summary__item strong {
    color: rgba(245, 197, 66, 0.9);
    font-weight: 700;
}

.txn-summary__page {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.25);
    font-variant-numeric: tabular-nums;
}

/* --- Skeleton Loading --- */
@keyframes txnShimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.txn-skeleton {
    display: flex;
    border-radius: 0.75rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.txn-skeleton__accent {
    width: 3px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.04);
}

.txn-skeleton__body {
    flex: 1;
    padding: 0.875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.txn-skeleton__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.txn-skeleton__pill {
    width: 3.5rem;
    height: 1.125rem;
    border-radius: 0.375rem;
    background: linear-gradient(90deg,
        rgba(255,255,255,0.03) 25%,
        rgba(255,255,255,0.06) 50%,
        rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: txnShimmer 1.5s ease infinite;
}

.txn-skeleton__amount {
    width: 4.5rem;
    height: 1rem;
    border-radius: 0.25rem;
    background: linear-gradient(90deg,
        rgba(255,255,255,0.03) 25%,
        rgba(255,255,255,0.06) 50%,
        rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: txnShimmer 1.5s ease infinite;
    animation-delay: 0.1s;
}

.txn-skeleton__text {
    height: 0.625rem;
    border-radius: 0.25rem;
    background: linear-gradient(90deg,
        rgba(255,255,255,0.02) 25%,
        rgba(255,255,255,0.04) 50%,
        rgba(255,255,255,0.02) 75%);
    background-size: 200% 100%;
    animation: txnShimmer 1.5s ease infinite;
    animation-delay: 0.2s;
}

.txn-skeleton__text--md { width: 6rem; }
.txn-skeleton__text--sm { width: 4rem; }

/* --- Error State --- */
.txn-modal__error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 1.5rem;
    gap: 0.5rem;
}

.txn-modal__error-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.txn-modal__error-icon i {
    font-size: 1.25rem;
    color: #f87171;
}

.txn-modal__error-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
}

.txn-modal__error-msg {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    line-height: 1.5;
    max-width: 28ch;
}

.txn-modal__retry {
    margin-top: 0.75rem;
    padding: 0.5rem 1.125rem;
    border: 1px solid rgba(212, 165, 32, 0.2);
    border-radius: 0.5rem;
    background: rgba(212, 165, 32, 0.08);
    color: rgba(245, 197, 66, 0.85);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.txn-modal__retry:hover {
    background: rgba(212, 165, 32, 0.15);
    border-color: rgba(212, 165, 32, 0.3);
}

/* --- Empty State --- */
.txn-modal__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem;
    gap: 0.375rem;
}

.txn-modal__empty-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: rgba(212, 165, 32, 0.04);
    border: 1px dashed rgba(212, 165, 32, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.txn-modal__empty-icon i {
    font-size: 1.4rem;
    color: rgba(212, 165, 32, 0.3);
}

.txn-modal__empty-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
}

.txn-modal__empty-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.25);
}

/* --- Transaction List --- */
.txn-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* --- Transaction Row — Timeline Card Design --- */
@keyframes txnSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.txn-row {
    --accent-color: rgba(255, 255, 255, 0.08);
    display: flex;
    border-radius: 0.75rem;
    overflow: visible;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: all 0.25s ease;
    cursor: default;
    animation: txnSlideIn 0.35s ease backwards;
    animation-delay: var(--txn-delay, 0ms);
}


.txn-row__accent {
    width: 3px;
    flex-shrink: 0;
    background: var(--accent-color);
    border-radius: 0.75rem 0 0 0.75rem;
    transition: background 0.2s;
}

/* Game icon — sits directly inside .txn-row as first visual element */
.txn-row__game-icon {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.75rem;
    object-fit: cover;
    flex-shrink: 0;
    margin: 0.625rem 0 0.625rem 0.625rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    align-self: center;
}


.txn-row__icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0.625rem 0 0.625rem 0.625rem;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.2s;
    align-self: center;
}


/* Content — right of icon */
.txn-row__content {
    flex: 1;
    padding: 0.625rem 0.75rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
}

/* Head row: name + amount */
.txn-row__head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.txn-row__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.txn-amount {
    font-size: 0.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.txn-amount--positive { color: #4ade80; }
.txn-amount--negative { color: #f87171; }

/* Sub row: time + txnid | balance */
.txn-row__sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

/* Txn ID — inline copyable tag below sub row */
.txn-row__content > .txn-row__txnid {
    margin-top: 0.25rem;
}

.txn-row__time {
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.28);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}

.txn-row__balance {
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.22);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Txn ID — inline copyable tag */
.txn-row__txnid {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.375rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 0.25rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.2s;
    width: fit-content;
}

.txn-row__txnid:hover {
    background: rgba(212, 165, 32, 0.06);
    border-color: rgba(212, 165, 32, 0.1);
    color: rgba(255, 255, 255, 0.45);
}

.txn-row__txnid > i:first-child {
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}

.txn-row__copy-icon {
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
    transition: color 0.2s;
}

.txn-row__txnid:hover .txn-row__copy-icon {
    color: rgba(245, 197, 66, 0.6);
}

.txn-row__copy-icon.fa-check {
    color: #4ade80 !important;
}

/* Label row with remark button */
.txn-row__label-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.txn-remark-btn {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border: none;
    border-radius: 50%;
    background: none;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.55rem;
    cursor: help;
    flex-shrink: 0;
    transition: color 0.2s;
}

.txn-remark-btn::after {
    content: attr(data-tip);
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    padding: 0.4rem 0.6rem;
    width: auto;
    background: rgba(15, 13, 10, 0.95);
    border: 1px solid rgba(212, 165, 32, 0.15);
    border-radius: 0.4rem;
    font-size: 0.65rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.6);
    white-space: pre-wrap;
    word-break: break-all;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 10;
}

.txn-remark-btn:hover::after,
.txn-remark-btn.--active::after {
    opacity: 1;
    visibility: visible;
}

.txn-remark-btn:hover,
.txn-remark-btn.--active {
    color: rgba(245, 197, 66, 0.7);
}

/* --- Type-specific accent colors --- */
.txn-type--init     { --accent-color: #60a5fa; }
.txn-type--add      { --accent-color: #4ade80; }
.txn-type--deduct   { --accent-color: #f87171; }
.txn-type--settle   { --accent-color: #f5c542; }
.txn-type--refund   { --accent-color: #c084fc; }

.txn-type--init .txn-row__icon    { background: rgba(96,165,250,0.1); color: #60a5fa; }
.txn-type--add .txn-row__icon     { background: rgba(74,222,128,0.1); color: #4ade80; }
.txn-type--deduct .txn-row__icon  { background: rgba(248,113,113,0.1); color: #f87171; }
.txn-type--settle .txn-row__icon  { background: rgba(245,197,66,0.1); color: #f5c542; }
.txn-type--refund .txn-row__icon  { background: rgba(192,132,252,0.1); color: #c084fc; }

.txn-type--init:hover .txn-row__icon   { box-shadow: 0 0 12px rgba(96,165,250,0.15); }
.txn-type--add:hover .txn-row__icon    { box-shadow: 0 0 12px rgba(74,222,128,0.15); }
.txn-type--deduct:hover .txn-row__icon { box-shadow: 0 0 12px rgba(248,113,113,0.15); }
.txn-type--settle:hover .txn-row__icon { box-shadow: 0 0 12px rgba(245,197,66,0.15); }
.txn-type--refund:hover .txn-row__icon { box-shadow: 0 0 12px rgba(192,132,252,0.15); }

/* --- Pagination Footer --- */
.txn-modal__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0.875rem 1.375rem;
    border-top: 1px solid rgba(212, 165, 32, 0.06);
    background: rgba(0, 0, 0, 0.15);
}

.txn-footer__count {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    position: absolute;
    right: 1.375rem;
    white-space: nowrap;
}

.txn-footer__count i {
    color: rgba(212, 165, 32, 0.5);
    font-size: 0.65rem;
}

.txn-footer__count strong {
    color: rgba(245, 197, 66, 0.9);
    font-weight: 700;
}

.txn-pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.txn-pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.375rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.txn-pg-btn:hover:not(:disabled):not(.txn-pg-num--active) {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
}

.txn-pg-num {
    font-weight: 500;
    border-radius: 0.5rem;
}

.txn-pg-num--active {
    background: linear-gradient(135deg, rgba(212,165,32,0.2), rgba(245,197,66,0.15));
    border-color: rgba(212, 165, 32, 0.25);
    color: #f5c542;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(212, 165, 32, 0.1);
}

.txn-pg-dots {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.7rem;
    padding: 0 0.125rem;
    user-select: none;
}

.txn-pg-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

/* ===== Light Theme — 金流 Modal ===== */
.light-theme .txn-modal {
    background: linear-gradient(165deg,
        rgba(255, 253, 248, 0.98) 0%,
        rgba(248, 245, 238, 0.99) 100%);
    border-color: rgba(184, 134, 11, 0.1);
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(184, 134, 11, 0.05);
}

.light-theme .txn-modal::before {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(184, 134, 11, 0.15) 30%,
        rgba(212, 165, 32, 0.25) 50%,
        rgba(184, 134, 11, 0.15) 70%,
        transparent 100%);
}

.light-theme .txn-modal__header {
    background: linear-gradient(180deg, rgba(184, 134, 11, 0.02) 0%, transparent 100%);
}

.light-theme .txn-modal__header h2 {
    color: rgba(139, 105, 20, 0.75);
}

.light-theme .txn-modal__header h2 i {
    color: rgba(139, 105, 20, 0.5);
}

.light-theme .txn-modal__close {
    border-color: rgba(0, 0, 0, 0.04);
    background: rgba(0, 0, 0, 0.03);
    color: rgba(0, 0, 0, 0.3);
}

.light-theme .txn-modal__close:hover {
    background: rgba(0, 0, 0, 0.07);
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .txn-modal__body::-webkit-scrollbar-thumb {
    background: rgba(184, 134, 11, 0.12);
}

.light-theme .txn-summary {
    background: rgba(184, 134, 11, 0.03);
    border-color: rgba(184, 134, 11, 0.06);
}

.light-theme .txn-summary__item {
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .txn-summary__item i {
    color: rgba(139, 105, 20, 0.5);
}

.light-theme .txn-summary__item strong {
    color: #92400e;
}

.light-theme .txn-summary__page {
    color: rgba(0, 0, 0, 0.25);
}

.light-theme .txn-skeleton {
    background: rgba(0, 0, 0, 0.015);
    border-color: rgba(0, 0, 0, 0.03);
}

.light-theme .txn-skeleton__accent {
    background: rgba(0, 0, 0, 0.03);
}

.light-theme .txn-skeleton__pill,
.light-theme .txn-skeleton__amount {
    background: linear-gradient(90deg,
        rgba(0,0,0,0.03) 25%,
        rgba(0,0,0,0.06) 50%,
        rgba(0,0,0,0.03) 75%);
    background-size: 200% 100%;
    animation: txnShimmer 1.5s ease infinite;
}

.light-theme .txn-skeleton__text {
    background: linear-gradient(90deg,
        rgba(0,0,0,0.02) 25%,
        rgba(0,0,0,0.04) 50%,
        rgba(0,0,0,0.02) 75%);
    background-size: 200% 100%;
    animation: txnShimmer 1.5s ease infinite;
}

.light-theme .txn-modal__error-icon {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.1);
}

.light-theme .txn-modal__error-title {
    color: rgba(0, 0, 0, 0.7);
}

.light-theme .txn-modal__error-msg {
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .txn-modal__retry {
    border-color: rgba(184, 134, 11, 0.2);
    background: rgba(184, 134, 11, 0.06);
    color: #92400e;
}

.light-theme .txn-modal__retry:hover {
    background: rgba(184, 134, 11, 0.12);
}

.light-theme .txn-modal__empty-icon {
    background: rgba(184, 134, 11, 0.03);
    border-color: rgba(184, 134, 11, 0.1);
}

.light-theme .txn-modal__empty-icon i {
    color: rgba(139, 105, 20, 0.25);
}

.light-theme .txn-modal__empty-title {
    color: rgba(0, 0, 0, 0.45);
}

.light-theme .txn-modal__empty-desc {
    color: rgba(0, 0, 0, 0.25);
}

.light-theme .txn-row {
    background: rgba(0, 0, 0, 0.012);
    border-color: rgba(0, 0, 0, 0.04);
}


.light-theme .txn-row__icon {
    background: rgba(0, 0, 0, 0.03);
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .txn-row__label {
    color: rgba(0, 0, 0, 0.75);
}

.light-theme .txn-row__time {
    color: rgba(0, 0, 0, 0.3);
}

.light-theme .txn-row__balance {
    color: rgba(0, 0, 0, 0.22);
}

.light-theme .txn-amount--positive { color: #16a34a; }
.light-theme .txn-amount--negative { color: #dc2626; }

.light-theme .txn-type--init .txn-row__icon    { background: rgba(37,99,235,0.08); color: #2563eb; }
.light-theme .txn-type--add .txn-row__icon     { background: rgba(22,163,74,0.08); color: #16a34a; }
.light-theme .txn-type--deduct .txn-row__icon  { background: rgba(220,38,38,0.08); color: #dc2626; }
.light-theme .txn-type--settle .txn-row__icon  { background: rgba(184,134,11,0.08); color: #92400e; }
.light-theme .txn-type--refund .txn-row__icon  { background: rgba(124,58,237,0.08); color: #7c3aed; }

.light-theme .txn-type--init     { --accent-color: #2563eb; }
.light-theme .txn-type--add      { --accent-color: #16a34a; }
.light-theme .txn-type--deduct   { --accent-color: #dc2626; }
.light-theme .txn-type--settle   { --accent-color: #92400e; }
.light-theme .txn-type--refund   { --accent-color: #7c3aed; }

.light-theme .txn-row__game-icon {
    border-color: rgba(0, 0, 0, 0.06);
}


.light-theme .txn-row__txnid {
    background: rgba(0, 0, 0, 0.015);
    border-color: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.3);
}

.light-theme .txn-row__txnid:hover {
    background: rgba(184, 134, 11, 0.04);
    border-color: rgba(184, 134, 11, 0.1);
    color: rgba(0, 0, 0, 0.5);
}

.light-theme .txn-row__txnid > i:first-child {
    color: rgba(0, 0, 0, 0.2);
}

.light-theme .txn-row__copy-icon {
    color: rgba(0, 0, 0, 0.15);
}

.light-theme .txn-row__txnid:hover .txn-row__copy-icon {
    color: #92400e;
}

.light-theme .txn-remark-btn {
    color: rgba(0, 0, 0, 0.2);
}

.light-theme .txn-remark-btn:hover,
.light-theme .txn-remark-btn.--active {
    color: #92400e;
}

.light-theme .txn-remark-btn::after {
    background: rgba(255, 253, 248, 0.97);
    border-color: rgba(184, 134, 11, 0.12);
    color: rgba(0, 0, 0, 0.55);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.light-theme .txn-modal__footer {
    border-top-color: rgba(184, 134, 11, 0.06);
    background: rgba(0, 0, 0, 0.015);
}

.light-theme .txn-footer__count {
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .txn-footer__count i {
    color: rgba(139, 105, 20, 0.5);
}

.light-theme .txn-footer__count strong {
    color: #92400e;
}

.light-theme .txn-pg-btn {
    color: rgba(0, 0, 0, 0.35);
}

.light-theme .txn-pg-btn:hover:not(:disabled):not(.txn-pg-num--active) {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .txn-pg-num--active {
    background: linear-gradient(135deg, rgba(184,134,11,0.1), rgba(212,165,32,0.08));
    border-color: rgba(184, 134, 11, 0.15);
    color: #92400e;
    box-shadow: 0 0 8px rgba(184, 134, 11, 0.06);
}

.light-theme .txn-pg-dots {
    color: rgba(0, 0, 0, 0.2);
}

.light-theme .wallet-transactions:hover {
    color: #b8860b;
}

/* ===== 響應式 ===== */
@media (max-width: 30rem) {
    .txn-modal {
        width: 96%;
        max-height: 92vh;
        border-radius: 1.25rem;
    }

    .txn-modal__body {
        padding: 0 1rem 0.75rem;
    }

    .txn-row__icon,
    .txn-row__game-icon {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.7rem;
        margin-left: 0.5rem;
        border-radius: 0.5rem;
    }

    .txn-row__content {
        padding: 0.5rem 0.625rem;
    }

    .txn-amount {
        font-size: 0.8rem;
    }

    .txn-row__txnid {
        font-size: 0.5rem;
    }

    .txn-modal__footer {
        padding: 0.625rem 1rem;
    }

    .txn-pg-btn {
        min-width: 1.75rem;
        height: 1.75rem;
    }
}

/* 尊重使用者動畫偏好 */
@media (prefers-reduced-motion: reduce) {
    .txn-row {
        animation: none;
    }
    .txn-modal {
        transition: opacity 0.15s ease;
        transform: none !important;
    }
    .txn-modal-overlay--open .txn-modal {
        transform: none !important;
    }
    .txn-skeleton__pill,
    .txn-skeleton__amount,
    .txn-skeleton__text {
        animation: none;
    }
}

/* ========== 遊戲版本列表 Modal ========== */
.version-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.version-modal-overlay--open {
    opacity: 1;
    visibility: visible;
}

.version-modal {
    width: 92%;
    max-width: 640px;
    max-height: 85vh;
    background: linear-gradient(165deg,
        rgba(22, 20, 16, 0.96) 0%,
        rgba(14, 12, 10, 0.98) 100%);
    border: 1px solid rgba(212, 165, 32, 0.12);
    border-radius: 1.5rem;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(212, 165, 32, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transform: translateY(2rem) scale(0.94);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.35s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.version-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(212, 165, 32, 0.25) 30%,
        rgba(245, 197, 66, 0.4) 50%,
        rgba(212, 165, 32, 0.25) 70%,
        transparent 100%);
}

.version-modal-overlay--open .version-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.version-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.375rem;
    background: linear-gradient(180deg, rgba(212, 165, 32, 0.03) 0%, transparent 100%);
}

.version-modal__header h2 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(245, 197, 66, 0.85);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.version-modal__header h2 i {
    font-size: 0.9rem;
    color: rgba(245, 197, 66, 0.6);
}

.version-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.625rem;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.version-modal__close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    transform: rotate(90deg);
}

.version-modal__body {
    padding: 0 1.375rem 1.125rem;
    overflow-y: auto;
    flex: 1;
    max-height: 32rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 165, 32, 0.15) transparent;
}

.version-modal__body::-webkit-scrollbar {
    width: 4px;
}

.version-modal__body::-webkit-scrollbar-thumb {
    background: rgba(212, 165, 32, 0.15);
    border-radius: 4px;
}

.version-modal__summary {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    padding: 0.5rem 0 0.875rem;
    border-bottom: 1px dashed rgba(212, 165, 32, 0.1);
    margin-bottom: 0.75rem;
}

.version-modal__summary strong {
    color: rgba(245, 197, 66, 0.95);
    font-weight: 700;
}

.version-modal__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

@media (max-width: 420px) {
    .version-modal__list {
        grid-template-columns: minmax(0, 1fr);
    }
}

.version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.2s ease, background 0.2s ease;
    min-width: 0;
}

.version-item:hover {
    border-color: rgba(212, 165, 32, 0.2);
    background: rgba(212, 165, 32, 0.04);
}

.version-item__main {
    flex: 1;
    min-width: 0;
}

.version-item__version {
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.version-item__latest-tag {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #d4a520 0%, #8b6914 100%);
    color: #fff;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.version-item__date {
    margin-top: 0.2rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.45);
    font-variant-numeric: tabular-nums;
}

.version-item__open {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: auto;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.75rem;
    border: 1px solid rgba(212, 165, 32, 0.2);
    border-radius: 0.5rem;
    background: rgba(212, 165, 32, 0.08);
    color: rgba(245, 197, 66, 0.9);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.version-item__open:hover {
    background: rgba(212, 165, 32, 0.18);
    border-color: rgba(212, 165, 32, 0.4);
    color: #f5c542;
    transform: translateY(-1px);
}

.version-modal__loading,
.version-modal__empty,
.version-modal__error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
}

.version-modal__loading i,
.version-modal__empty i,
.version-modal__error i {
    font-size: 1.75rem;
    color: rgba(245, 197, 66, 0.6);
}

.version-modal__error-detail {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .version-modal-overlay,
    .version-modal {
        transition: none !important;
    }
    .version-modal-overlay--open .version-modal {
        transform: none !important;
    }
}

/* ========== 調整餘額 Modal ========== */
.balance-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 1rem;
}

.balance-modal-overlay--open {
    opacity: 1;
    visibility: visible;
}

.balance-modal {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(165deg,
        rgba(22, 20, 16, 0.96) 0%,
        rgba(14, 12, 10, 0.98) 100%);
    border: 1px solid rgba(212, 165, 32, 0.12);
    border-radius: 1.5rem;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(212, 165, 32, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transform: translateY(2rem) scale(0.94);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.balance-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(212, 165, 32, 0.25) 30%,
        rgba(245, 197, 66, 0.4) 50%,
        rgba(212, 165, 32, 0.25) 70%,
        transparent 100%);
}

.balance-modal-overlay--open .balance-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* --- Header --- */
.balance-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.375rem;
    background: linear-gradient(180deg, rgba(212, 165, 32, 0.03) 0%, transparent 100%);
}

.balance-modal__header h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: rgba(245, 197, 66, 0.9);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.02em;
}

.balance-modal__header h2 i {
    font-size: 0.9rem;
    color: rgba(245, 197, 66, 0.6);
}

.balance-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.625rem;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.balance-modal__close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    transform: rotate(90deg);
}

/* --- Body --- */
.balance-modal__body {
    padding: 0 1.375rem 0.5rem;
}

/* 目前餘額 */
.balance-modal__current {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1.25rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: 1rem;
    background: linear-gradient(165deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.2) 100%);
    border: 1px solid rgba(212, 165, 32, 0.1);
}

.balance-modal__current-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
}

.balance-modal__current-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: #f5c542;
    line-height: 1.1;
    word-break: break-all;
    text-align: center;
}

/* 表單 */
.balance-modal__form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.balance-modal__label {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
}

.balance-modal__hint {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
}

.balance-modal__input {
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.25rem;
    padding: 0.75rem 0.875rem;
    font-size: 1rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.balance-modal__input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.balance-modal__input:focus {
    border-color: rgba(212, 165, 32, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(212, 165, 32, 0.12);
}

.balance-modal__input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.balance-modal__input--error {
    border-color: rgba(248, 113, 113, 0.6);
}

.balance-modal__error {
    display: block;
    min-height: 1rem;
    font-size: 0.72rem;
    color: #f87171;
}

/* 試玩會狀態 */
.balance-modal__trial {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1.75rem 1rem;
    text-align: center;
    color: rgba(245, 197, 66, 0.9);
    background: rgba(212, 165, 32, 0.06);
    border: 1px solid rgba(212, 165, 32, 0.15);
    border-radius: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.balance-modal__trial i {
    font-size: 1.75rem;
    color: rgba(245, 197, 66, 0.7);
}

.balance-modal__trial[hidden] {
    display: none;
}

/* --- Footer --- */
.balance-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    padding: 1rem 1.375rem 1.375rem;
}

.balance-modal__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.balance-modal__btn--cancel {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.balance-modal__btn--cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.balance-modal__btn--confirm {
    background: linear-gradient(135deg, #d4a520 0%, #f5c542 100%);
    color: #1a1206;
    box-shadow: 0 4px 16px rgba(212, 165, 32, 0.25);
}

.balance-modal__btn--confirm:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(212, 165, 32, 0.4);
    transform: translateY(-1px);
}

.balance-modal__btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== Light Theme — 調整餘額 Modal ===== */
.light-theme .balance-modal {
    background: linear-gradient(165deg,
        rgba(255, 253, 248, 0.98) 0%,
        rgba(248, 245, 238, 0.99) 100%);
    border-color: rgba(184, 134, 11, 0.1);
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(184, 134, 11, 0.05);
}

.light-theme .balance-modal::before {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(184, 134, 11, 0.15) 30%,
        rgba(212, 165, 32, 0.25) 50%,
        rgba(184, 134, 11, 0.15) 70%,
        transparent 100%);
}

.light-theme .balance-modal__header {
    background: linear-gradient(180deg, rgba(184, 134, 11, 0.02) 0%, transparent 100%);
}

.light-theme .balance-modal__header h2 {
    color: rgba(139, 105, 20, 0.85);
}

.light-theme .balance-modal__header h2 i {
    color: rgba(139, 105, 20, 0.55);
}

.light-theme .balance-modal__close {
    border-color: rgba(0, 0, 0, 0.04);
    background: rgba(0, 0, 0, 0.03);
    color: rgba(0, 0, 0, 0.3);
}

.light-theme .balance-modal__close:hover {
    background: rgba(0, 0, 0, 0.07);
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .balance-modal__current {
    background: linear-gradient(165deg, rgba(184, 134, 11, 0.05) 0%, rgba(184, 134, 11, 0.02) 100%);
    border-color: rgba(184, 134, 11, 0.12);
}

.light-theme .balance-modal__current-label {
    color: rgba(0, 0, 0, 0.45);
}

.light-theme .balance-modal__current-value {
    color: #b8860b;
}

.light-theme .balance-modal__label {
    color: rgba(0, 0, 0, 0.8);
}

.light-theme .balance-modal__hint {
    color: rgba(0, 0, 0, 0.45);
}

.light-theme .balance-modal__input {
    color: #1a1a1a;
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.12);
}

.light-theme .balance-modal__input::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

.light-theme .balance-modal__input:focus {
    border-color: rgba(184, 134, 11, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(184, 134, 11, 0.1);
}

.light-theme .balance-modal__trial {
    color: #92400e;
    background: rgba(184, 134, 11, 0.08);
    border-color: rgba(184, 134, 11, 0.2);
}

.light-theme .balance-modal__trial i {
    color: rgba(184, 134, 11, 0.7);
}

.light-theme .balance-modal__btn--cancel {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .balance-modal__btn--cancel:hover {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.8);
}

@media (prefers-reduced-motion: reduce) {
    .balance-modal-overlay,
    .balance-modal {
        transition: none !important;
    }
    .balance-modal-overlay--open .balance-modal {
        transform: none !important;
    }
}

@media (max-width: 30rem) {
    .balance-modal__current-value {
        font-size: 1.5rem;
    }
    .balance-modal__footer {
        flex-direction: column-reverse;
    }
    .balance-modal__btn {
        width: 100%;
    }
}

/* ===== 頭像裁切 Modal ===== */
.avatar-crop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000; /* 高於個人資訊 Modal（--z-toast: 9999），疊在其上 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.avatar-crop-overlay--open {
    opacity: 1;
    visibility: visible;
}

.avatar-crop {
    width: 92%;
    max-width: 24rem;
    max-height: 90vh;
    background: linear-gradient(165deg,
        rgba(22, 20, 16, 0.96) 0%,
        rgba(14, 12, 10, 0.98) 100%);
    border: 1px solid rgba(212, 165, 32, 0.12);
    border-radius: 1.5rem;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(212, 165, 32, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transform: translateY(2rem) scale(0.94);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.35s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.avatar-crop-overlay--open .avatar-crop {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.avatar-crop__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.375rem;
    background: linear-gradient(180deg, rgba(212, 165, 32, 0.03) 0%, transparent 100%);
}

.avatar-crop__header h2 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(245, 197, 66, 0.9);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avatar-crop__close {
    width: 2rem;
    height: 2rem;
    border-radius: 0.625rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.avatar-crop__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.avatar-crop__body {
    padding: 0.5rem 1.375rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* 方形視口：圖片在此平移/縮放，外圈以遮罩標示裁切範圍 */
.avatar-crop__viewport {
    position: relative;
    width: 16rem;
    height: 16rem;
    max-width: 70vw;
    max-height: 70vw;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #0a0908;
    touch-action: none; /* 由 pointer 事件接管拖曳，避免頁面捲動 */
    user-select: none;
}

/* 原圖：固定 contain 顯示，由 JS 設定尺寸/位置，本身不可拖曳 */
.avatar-crop__img {
    position: absolute;
    top: 0;
    left: 0;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

/* 截取框：可拖曳移動，外圈以遮罩標示未選取範圍 */
.avatar-crop__box {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid rgba(245, 197, 66, 0.9);
    border-radius: 0.4rem;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55);
    cursor: grab;
    touch-action: none;
}

.avatar-crop__box:active {
    cursor: grabbing;
}

.avatar-crop__controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 16rem;
}

.avatar-crop__zoom-icon {
    color: rgba(245, 197, 66, 0.6);
    flex-shrink: 0;
}

.avatar-crop__zoom-icon--sm {
    font-size: 0.7rem;
}

.avatar-crop__zoom-icon--lg {
    font-size: 1.05rem;
}

.avatar-crop__zoom {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 0.375rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
    cursor: pointer;
}

.avatar-crop__zoom::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4a520 0%, #f5c542 100%);
    box-shadow: 0 2px 8px rgba(212, 165, 32, 0.4);
    cursor: pointer;
}

.avatar-crop__zoom::-moz-range-thumb {
    width: 1.1rem;
    height: 1.1rem;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4a520 0%, #f5c542 100%);
    box-shadow: 0 2px 8px rgba(212, 165, 32, 0.4);
    cursor: pointer;
}

.avatar-crop__hint {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.avatar-crop__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    padding: 0.5rem 1.375rem 1.375rem;
}

.avatar-crop__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.avatar-crop__btn--cancel {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.avatar-crop__btn--cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.avatar-crop__btn--confirm {
    background: linear-gradient(135deg, #d4a520 0%, #f5c542 100%);
    color: #1a1206;
    box-shadow: 0 4px 16px rgba(212, 165, 32, 0.25);
}

.avatar-crop__btn--confirm:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(212, 165, 32, 0.4);
    transform: translateY(-1px);
}

.avatar-crop__btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== Light Theme — 頭像裁切 Modal ===== */
.light-theme .avatar-crop {
    background: linear-gradient(165deg,
        rgba(255, 253, 248, 0.98) 0%,
        rgba(248, 245, 238, 0.99) 100%);
    border-color: rgba(184, 134, 11, 0.1);
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(184, 134, 11, 0.05);
}

.light-theme .avatar-crop__header h2 {
    color: rgba(139, 105, 20, 0.85);
}

.light-theme .avatar-crop__close {
    border-color: rgba(0, 0, 0, 0.04);
    background: rgba(0, 0, 0, 0.03);
    color: rgba(0, 0, 0, 0.3);
}

.light-theme .avatar-crop__close:hover {
    background: rgba(0, 0, 0, 0.07);
    color: rgba(0, 0, 0, 0.7);
}

.light-theme .avatar-crop__viewport {
    background: #e8e3d8;
}

.light-theme .avatar-crop__box {
    border-color: rgba(184, 134, 11, 0.85);
    box-shadow: 0 0 0 100vmax rgba(255, 255, 255, 0.5);
}

.light-theme .avatar-crop__zoom {
    background: rgba(0, 0, 0, 0.12);
}

.light-theme .avatar-crop__hint {
    color: rgba(0, 0, 0, 0.45);
}

.light-theme .avatar-crop__btn--cancel {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .avatar-crop__btn--cancel:hover {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.8);
}

@media (max-width: 30rem) {
    .avatar-crop__footer {
        flex-direction: column-reverse;
    }
    .avatar-crop__btn {
        width: 100%;
    }
}

/* ========== 遊戲 iframe Modal ========== */
.game-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(14px) saturate(1.15);
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.game-modal-overlay::selection,
.game-modal-overlay *::selection {
    background: transparent;
}

.game-modal-overlay--open {
    opacity: 1;
    visibility: visible;
}

.game-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 96vw;
    max-height: 96vh;
    transform: translateY(3rem) scale(0.96);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.game-modal-overlay--open .game-modal {
    transform: translateY(1.5rem) scale(1);
    opacity: 1;
}

/* iframe 容器：以 aspect-ratio 控制直/橫版 */
.game-modal__frame-wrap {
    position: relative;
    background: #000;
    color: #fff;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), 0 0 60px rgba(212, 165, 32, 0.05);
    border: 1px solid #000;
    outline: none;
}

/* 橫版：以寬度為主，受視窗高度上限約束 */
.game-modal--landscape .game-modal__frame-wrap {
    aspect-ratio: 16 / 9;
    width: min(90vw, calc((92vh - 4rem) * 16 / 9));
    height: auto;
}

/* 直版：以高度為主，窄長置中 */
.game-modal--portrait .game-modal__frame-wrap {
    aspect-ratio: 9 / 16;
    height: min(88vh, calc(96vw * 16 / 9));
    width: auto;
}

.game-modal__iframe {
    width: 100%;
    height: 100%;
    border: 0;
    outline: none;
    display: block;
    background: #000;
    color: #fff;
}

.game-modal__close {
    position: absolute;
    top: -1.3rem;
    right: -2.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(20, 18, 14, 0.92);
    color: #f5f5f5;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.2s ease, transform 0.2s ease;
}

.game-modal__close:hover {
    background: rgba(212, 165, 32, 0.9);
    color: #1a1710;
    transform: scale(1.06);
}

/* 底部直/橫切換工具列 */
.game-modal__toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.4rem;
    background: rgba(20, 18, 14, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.9rem;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.game-modal__orient-btn {
    width: 3rem;
    height: 2.5rem;
    border: 1px solid transparent;
    border-radius: 0.65rem;
    background: transparent;
    color: rgba(245, 245, 245, 0.65);
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.game-modal__orient-btn:hover {
    color: #f5f5f5;
    background: rgba(255, 255, 255, 0.06);
}

.game-modal__orient-btn.is-active {
    color: #1a1710;
    background: linear-gradient(135deg, #e6c04a, #d4a520);
    border-color: rgba(212, 165, 32, 0.5);
    box-shadow: 0 4px 12px rgba(212, 165, 32, 0.25);
}

.game-modal__toolbar-divider {
    width: 1px;
    align-self: stretch;
    margin: 0.25rem 0.15rem;
    background: rgba(255, 255, 255, 0.12);
}

/* 全螢幕時：容器鋪滿整個螢幕、iframe 撐滿 */
.game-modal__frame-wrap:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: 0;
}

.game-modal__frame-wrap:fullscreen .game-modal__iframe {
    width: 100%;
    height: 100%;
}

/* 手機版：近全螢幕 */
@media (max-width: 640px) {
    .game-modal {
        max-width: 100vw;
        max-height: 100vh;
        gap: 0.5rem;
    }

    .game-modal--landscape .game-modal__frame-wrap {
        width: 96vw;
    }

    .game-modal--portrait .game-modal__frame-wrap {
        height: min(82vh, calc(96vw * 16 / 9));
    }

    .game-modal__frame-wrap {
        border-radius: 0.5rem;
    }

    .game-modal__close {
        top: 0.25rem;
        right: 0.25rem;
    }
}

