/* 1. 基礎與通用樣式 */
:root {
    --color-primary: #FFD700; /* 亮金色 */
    --color-secondary: #00B200; /* 綠色 */
    --color-danger: #D60000; /* 紅色 */
    --color-background-dark: #121212;
    --color-surface-dark: #1E1E1E;
    --color-text-light: #E0E0E0;
    --color-link-blue: #00A9FF;
    --color-glass-bg: rgba(255, 255, 255, 0.08);
    --shadow-deep: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --border-radius-large: 16px;
    --spacing-unit: 1rem;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background: var(--color-background-dark);
    /* 請準備一張 bg-new.jpg 作為背景圖，或刪除此行使用純黑背景 */
    background: var(--color-background-dark) url(bg-new.png) center center fixed no-repeat;
    background-size: cover;
    color: var(--color-text-light);
    
    /* ***** 修正 Chrome 頂部遮擋問題的關鍵變更 START ***** */
    display: flex;
    flex-direction: column; /* 讓內容垂直堆疊 */
    justify-content: flex-start; /* CRITICAL: 讓內容從頂部開始，避免垂直置中 */
    align-items: center; /* 保持 .main-container 水平置中 */
    min-height: 100vh; /* 確保內容不足時也能佔滿整個視口 */
    /* ***** 修正 END ***** */
}

a {
    color: var(--color-link-blue);
    text-decoration: none;
    transition: color 0.3s;
}
a:hover {
    color: #4dc2ff;
}

/* 2. 佈局容器 */
.main-container {
    width: 90%;
    max-width: 1200px; /* PC 寬度限制 */
    margin: 20px auto;
    padding: 20px;
    box-sizing: border-box;
}

/* 3. 卡片式介面 */
.card {
    background: var(--color-surface-dark);
    border-radius: var(--border-radius-large);
    padding: var(--spacing-unit) * 2;
    margin-bottom: var(--spacing-unit) * 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.glass-effect {
    /* 玻璃擬態效果 */
    background: var(--color-glass-bg);
    box-shadow: var(--shadow-deep);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.card-title {
    color: var(--color-primary);
    text-align: center;
    margin-top: 0;
    font-weight: 700;
}

.section-title {
    color: var(--color-primary);
    border-bottom: 2px solid rgba(255, 215, 0, 0.2);
    padding-bottom: 8px;
    margin-top: 25px;
}

/* 4. 按鈕樣式 */
.btn, button {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: background-color 0.3s, transform 0.1s;
    margin: 5px;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #121212;
}
.btn-primary:hover {
    background-color: #ffe066;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--color-surface-dark);
    color: var(--color-text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-secondary:hover {
    background-color: #2a2a2a;
    transform: translateY(-1px);
}

.btn-danger-small, .btn-secondary-small {
    padding: 5px 10px;
    font-size: 0.85rem;
    border-radius: 6px;
}
.btn-danger-small {
    background-color: var(--color-danger);
    color: var(--color-text-light);
}
.btn-secondary-small {
    background-color: var(--color-surface-dark);
    color: var(--color-text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
}


.button-group {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

/* 5. 帳戶資訊與行動按鈕 */
.account-info {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}
.account-info p {
    margin: 5px 20px 5px 0;
}

.highlight-text {
    color: var(--color-primary);
    font-weight: 700;
}
.highlight-money {
    color: #00FF00; /* 綠色，表示金錢 */
    font-weight: 700;
    font-size: 1.2rem;
}

/* 行動瓷磚按鈕 (Action Tiles) */
.action-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.btn-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 120px;
    border-radius: 12px;
    transition: all 0.3s;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-action-tile:hover {
    transform: scale(1.05);
}

.payment-logo {
    width: 100px;
    height: auto;
    object-fit: contain;
    margin-bottom: 5px;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
}
.tile-text {
    font-size: 1.1rem;
    font-weight: bold;
    margin-top: 5px;
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
}

.green-tile { background: linear-gradient(135deg, #00B200, #007f00); }
.blue-tile { background: linear-gradient(135deg, #005691, #003355); }


/* 6. 表格樣式 (遊戲帳號列表) */
.table-responsive {
    overflow-x: auto; /* 手機上可橫向捲動 */
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px; /* 行間距 */
}

.data-table th, .data-table td {
    padding: 12px;
    text-align: center;
    vertical-align: middle;
}

.data-table th {
    background-color: rgba(255, 215, 0, 0.1);
    color: var(--color-primary);
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.data-table tr {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: background-color 0.2s;
}

.data-table tr:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.active {
    color: var(--color-secondary); /* 綠色 */
    font-weight: bold;
}
.expired, .pending {
    color: var(--color-danger); /* 紅色/警告色 */
    font-weight: bold;
}
.pending {
    color: orange;
}

.action-group {
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap; /* 允許換行 */
}

.btn-action-mini, .btn-delete-mini {
    padding: 5px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    min-width: 45px; /* 確保小按鈕不會太小 */
}
.btn-action-mini { background-color: #3f51b5; color: white; }
.btn-delete-mini { background-color: var(--color-danger); color: white; }

.form-select {
    background-color: var(--color-surface-dark);
    color: var(--color-text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px;
    border-radius: 4px;
}

/* 7. 表單樣式 */
.form-card {
    max-width: 450px;
    margin: 50px auto;
}

.form-layout {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 400;
    color: var(--color-text-light);
}

.form-input {
    background: rgba(0, 0, 0, 0.3);
    color: var(--color-text-light);
    border: 1px solid var(--color-primary);
    padding: 10px;
    border-radius: 6px;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-link-blue);
    box-shadow: 0 0 5px rgba(0, 169, 255, 0.5);
}

/* 驗證碼特殊樣式 */
.captcha-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.captcha-input {
    flex-grow: 1;
    max-width: 120px;
}
.captcha-display {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    text-align: center;
    min-width: 120px;
    font-size: 0.8rem;
    color: #999;
}
.captcha-img {
    vertical-align: middle;
}

.warning-text {
    color: var(--color-danger);
    font-size: 0.9rem;
    text-align: center;
}

.hint-text {
    color: #999;
    font-size: 0.8rem;
    margin-top: 5px;
}

.btn-link {
    padding: 10px 18px;
    font-size: 1rem;
    border-radius: 8px;
    min-width: 90px;
	background-color: #3f51b5; color: white;
}


.bottom-action-bar {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.warning-list {
    padding-left: 20px;
    list-style: disc;
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin: 10px 0;
}
.warning-list li {
    margin-bottom: 5px;
}

/* 8. 響應式設計 (手機優先) */
.pc-only {
    display: none; /* 在手機上隱藏密碼欄位 */
}

/* 適用於 PC (min-width: 768px) */
@media (min-width: 768px) {
    .main-container {
        padding: 40px;
    }
    
    .account-info {
        justify-content: flex-start;
    }
    .account-info form {
        margin-left: auto;
    }
    
    .data-table th, .data-table td {
        padding: 15px 10px;
    }
    
    .action-buttons-grid {
        /* 在 PC 上可以有更多列 */
        grid-template-columns: repeat(4, 1fr); 
    }

    .pc-only {
        display: table-cell; /* 在 PC 上顯示密碼欄位 */
    }
}

/* 適用於手機 (max-width: 767px) */
@media (max-width: 767px) {
    body {
        align-items: flex-start;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .main-container {
        width: 100%;
        padding: 10px;
    }

    .card {
        padding: 15px;
    }

    .account-info {
        flex-direction: column;
        align-items: flex-start;
    }
    .account-info p {
        width: 100%;
        margin-right: 0;
    }
    /* 登出按鈕在手機上單獨一行 */
    .account-info form {
        width: 100%;
        text-align: right;
        margin-top: 10px;
    }
    
    .action-buttons-grid {
        /* 在手機上兩欄佈局 */
        grid-template-columns: repeat(2, 1fr); 
    }

    .data-table th, .data-table td {
        font-size: 0.8rem;
        word-break: break-all;
    }

    .action-group {
        flex-direction: column;
        gap: 2px;
    }

    .time-select {
        margin-bottom: 5px;
    }
    
    .captcha-group {
        flex-wrap: wrap;
    }
    
    .captcha-group label {
        width: 100%;
    }
    
    .captcha-input {
        flex-grow: 1;
        max-width: 50%;
    }
    .captcha-display {
        min-width: 100px;
    }
}


/* 9. Toast Notification 樣式 (已放大四倍化 + Unicode 碼點) */

#toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    /* ?? 調整：增大 padding，讓整體視窗變大 (約四倍) */
    padding: 40px 60px; 
    /* ?? 調整：增大圓角 */
    border-radius: 20px; 
    color: #fff;
    /* ?? 調整：增大字體大小 */
    font-size: 1.8rem; 
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7); /* 陰影加深 */
    display: flex;
    align-items: center;
    gap: 25px; /* 圖標與文字間距增加 */
    transition: all 0.5s ease-in-out;
    max-width: 90%;
}

.toast-hidden {
    opacity: 0;
    transform: translateX(100%);
}

.toast-show {
    opacity: 1;
    transform: translateX(0);
}

/* 類型樣式：錯誤 (預設) */
.toast-error {
    background-color: #5c0000; /* 深紅色背景 */
    border: 4px solid var(--color-danger); /* 邊框加粗 */
}
.toast-error #toast-icon::before {
    /* ? 符號已替換為 Unicode 碼點 \274C */
    content: "\274C"; 
    font-size: 2.5rem; /* 放大圖標 */
}

/* 類型樣式：成功 */
.toast-success {
    background-color: #004d00; /* 深綠色背景 */
    border: 4px solid var(--color-secondary);
}
.toast-success #toast-icon::before {
    /* ? 符號已替換為 Unicode 碼點 \2705 */
    content: "\2705"; 
    font-size: 2.5rem; /* 放大圖標 */
}

/* 類型樣式：警告/資訊 */
.toast-warning {
    background-color: #664f00; /* 深黃色背景 */
    border: 4px solid var(--color-primary);
}
.toast-warning #toast-icon::before {
    /* ?? 符號已替換為 Unicode 碼點 \26A0 */
    content: "\26A0"; 
    font-size: 2.5rem; /* 放大圖標 */
}

/* 手機版適應 */
@media (max-width: 767px) {
    #toast-notification {
        top: 10px;
        right: 10px;
        left: 10px; 
        max-width: none;
        padding: 25px 35px; /* 手機上適度放大 */
        font-size: 1.3rem;
        gap: 20px;
    }
    .toast-hidden {
        transform: translateY(-100%);
    }
    .toast-show {
        transform: translateY(0);
    }
    .toast-error #toast-icon::before,
    .toast-success #toast-icon::before,
    .toast-warning #toast-icon::before {
         font-size: 2rem;
    }
}