* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #050505;
    color: #f5f5f7;
    display: flex;
    flex-direction: column;
}

/* ---------- 導覽列 ---------- */
.topup-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 66px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(to bottom, #86efac, #22c55e);
    border-bottom: 1px solid rgba(6,78,59,.38);
    box-shadow: 0 8px 26px rgba(0,0,0,.18);
}
.topup-nav .brand img { height: 46px; display: block; }
.topup-nav-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

.topup-balance-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(0,0,0,.28);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}
.topup-balance-chip strong { color: #fff59d; }
.topup-balance-chip.is-coin strong { color: #ffe066; }
.topup-balance-chip img { display: block; image-rendering: pixelated; }

.topup-back {
    padding: 8px 14px;
    border-radius: 6px;
    background: rgba(0,0,0,.32);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    transition: background .2s ease;
}
.topup-back:hover { background: rgba(0,0,0,.5); }

/* ---------- 主體 ---------- */
.topup-main { flex: 1; width: min(1100px, 100%); margin: 0 auto; padding: 40px 16px 60px; }

.topup-head { text-align: center; margin-bottom: 34px; }
.topup-head h1 {
    font-size: 40px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 4px 20px rgba(34,197,94,.35);
}
.topup-head p { margin-top: 12px; color: #9aa4ad; font-size: 14px; line-height: 1.7; }

.topup-message {
    width: min(680px, 100%);
    margin: 0 auto 24px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.6;
    text-align: center;
}
.topup-message.error { border: 1px solid rgba(239,68,68,.35); background: rgba(239,68,68,.1); color: #fca5a5; }
.topup-message.success { border: 1px solid rgba(34,197,94,.35); background: rgba(34,197,94,.1); color: #86efac; }
.topup-message.info { border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.05); color: #cbd5d1; }

/* ---------- 方案卡 ---------- */
.topup-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.topup-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.045);
    box-shadow: 0 16px 40px rgba(0,0,0,.3);
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.topup-card:hover {
    transform: translateY(-4px);
    border-color: rgba(34,197,94,.4);
    box-shadow: 0 22px 50px rgba(0,0,0,.42);
}

/* 像素字體的金額區 */
.topup-amount {
    aspect-ratio: 16 / 10;
    display: grid;
    place-items: center;
    gap: 8px;
    background:
        linear-gradient(135deg, rgba(34,197,94,.2), rgba(0,0,0,.55)),
        repeating-linear-gradient(0deg, #1d2126 0 8px, #23282e 8px 16px);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.topup-amount .pixel {
    font-family: "Press Start 2P", "Courier New", monospace;
    font-size: 34px;
    line-height: 1.2;
    color: #fff;
    text-shadow: 3px 3px 0 rgba(0,0,0,.85), 0 0 22px rgba(34,197,94,.45);
}
.topup-amount .pixel-unit { font-size: 15px; margin-left: 4px; }

.topup-body { padding: 16px; display: grid; gap: 11px; }
.topup-rows { display: grid; gap: 7px; }
.topup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.topup-row span { color: #9aa4ad; }
.topup-row strong { color: #fff; font-weight: 800; }
.topup-row.is-bonus strong { color: #ffe066; }
.topup-row.is-total { padding-top: 9px; border-top: 1px solid rgba(255,255,255,.1); }
.topup-row.is-total strong { color: #4ade80; font-size: 17px; }

.topup-buy {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(to bottom, #4ade80, #22c55e);
    color: #06301a;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    transition: filter .2s ease, transform .12s ease;
}
.topup-buy:hover { filter: brightness(1.08); }
.topup-buy:active { transform: scale(.98); }
.topup-buy:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.5); }

/* ---------- 確認視窗 ---------- */
.topup-confirm { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.topup-confirm[hidden] { display: none; }
.topup-confirm-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
.topup-confirm-panel {
    position: relative;
    width: min(420px, 100%);
    padding: 24px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 12px;
    background: #14181d;
    box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.topup-confirm-panel h2 { color: #fff; font-size: 20px; font-weight: 900; }
.topup-confirm-lead { margin-top: 8px; color: #9aa4ad; font-size: 13px; line-height: 1.6; }

.topup-confirm-rows { margin: 20px 0 14px; border-top: 1px solid rgba(255,255,255,.1); }
.topup-confirm-rows div {
    padding: 11px 2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.topup-confirm-rows dt { color: #9aa4ad; font-size: 13px; }
.topup-confirm-rows dd { color: #fff; font-size: 14px; font-weight: 800; }
.topup-confirm-rows div:nth-child(2) dd { color: #ffe066; }
.topup-confirm-rows .is-total dd { color: #4ade80; font-size: 19px; }

/* 聯絡資料表單 */
.topup-buyer-form { margin-bottom: 14px; display: grid; gap: 9px; }
.topup-buyer-form h3 {
    margin-bottom: 2px;
    color: #cbd5d1;
    font-size: 13px;
    font-weight: 800;
}
.topup-buyer-form label { display: grid; gap: 4px; }
.topup-buyer-form label span { color: #9aa4ad; font-size: 11px; }
.topup-buyer-form input {
    padding: 9px 11px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 6px;
    background: #1b2026;
    color: #f5f5f7;
    font-size: 13px;
}
.topup-buyer-form input:focus { outline: none; border-color: #22c55e; }

.topup-confirm-error {
    margin-bottom: 12px;
    padding: 9px 12px;
    border: 1px solid rgba(239,68,68,.35);
    border-radius: 6px;
    background: rgba(239,68,68,.1);
    color: #fca5a5;
    font-size: 12px;
    font-weight: 700;
}
.topup-confirm-error[hidden] { display: none; }

.topup-confirm-panel { max-height: 90vh; overflow-y: auto; }

.topup-confirm-note {
    padding: 11px 13px;
    border-radius: 7px;
    background: rgba(255,255,255,.05);
    color: #9aa4ad;
    font-size: 12px;
    line-height: 1.65;
}

.topup-confirm-actions { margin-top: 18px; display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.topup-confirm-actions button {
    min-height: 46px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    transition: filter .2s ease;
}
#confirmCancel { border: 1px solid rgba(255,255,255,.18); background: transparent; color: #cbd5d1; }
#confirmCancel:hover { background: rgba(255,255,255,.06); }
#confirmGo { border: 0; background: linear-gradient(to bottom, #4ade80, #22c55e); color: #06301a; }
#confirmGo:hover { filter: brightness(1.08); }
#confirmGo:disabled { opacity: .6; cursor: wait; }

/* ---------- 說明 ---------- */
.topup-notes {
    margin-top: 40px;
    padding: 22px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.03);
}
.topup-notes h2 { margin-bottom: 12px; color: #fff; font-size: 16px; }
.topup-notes ul { padding-left: 18px; display: grid; gap: 7px; }
.topup-notes li { color: #9aa4ad; font-size: 13px; line-height: 1.7; }

.legal-footer {
    padding: 22px 16px;
    display: flex;
    justify-content: center;
    gap: 18px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.legal-footer a { color: #7d8a83; font-size: 12px; text-decoration: none; }
.legal-footer a:hover { color: #86efac; }

@media (max-width: 820px) {
    .topup-grid { grid-template-columns: 1fr; gap: 14px; }
    .topup-head h1 { font-size: 28px; }
    .topup-head p { font-size: 13px; }
    .topup-main { padding: 26px 12px 40px; }
    .topup-amount { aspect-ratio: 16 / 7; }
    .topup-amount .pixel { font-size: 30px; }
    .topup-nav .brand img { height: 38px; }
}
