/* ==========================================================================
   MOXGAME 門戶（www.moxgame.com）— M1 骨架樣式
   亮色：沿用 Vue 版白底設計（navbar 76px、#575757 13px、footer #222426、#409EFF）
   暗色：新設計（沿用遊戲站深色家族 #0f0f1a / #16213e / #2a2a4a / #e0e0e0）
   ========================================================================== */

:root {
    --p-page: #ffffff;
    --p-surface: #ffffff;
    --p-soft: #f5f7fa;
    --p-border: #dcdfe6;
    --p-text: #2c3e50;
    --p-muted: #909399;
    --p-primary: #409EFF;
    --p-warning: #E6A23C;
    --p-footer: #222426;
    --p-footer-text: #f1f1f1;
    --p-nav-link: #575757;
    --p-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    --p-radius: 4px;
}

html[data-theme="dark"] {
    --p-page: #0f0f1a;
    --p-surface: #16213e;
    --p-soft: #1a1a2e;
    --p-border: #2a2a4a;
    --p-text: #e0e0e0;
    --p-muted: #888;
    --p-primary: #57a6ff;
    --p-warning: #ffaa00;
    --p-footer: #0b0d14;
    --p-footer-text: #d8d8d8;
    --p-nav-link: #c9c9d4;
    --p-shadow: 0 2px 10px rgba(0, 0, 0, .35);
    --p-radius: 4px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.portal-body {
    background: var(--p-page);
    color: var(--p-text);
    font-family: "Noto Sans KR", "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--p-primary); text-decoration: none; }
a:hover { color: var(--p-primary); text-decoration: underline; }

code { font-family: Consolas, "Courier New", monospace; background: var(--p-soft); padding: 1px 6px; border-radius: 3px; }

/* ---- navbar（對齊 Vue：高 76px、連結 13px #575757）---- */
.portal-nav {
    background: var(--p-surface);
    border-bottom: 1px solid var(--p-border);
}
.portal-nav-inner {
    max-width: 1277px;
    margin: 0 auto;
    padding: 0 12px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.portal-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
}
.portal-logo:hover { text-decoration: none; }
.portal-logo-img {
    display: block;
    width: 126px;
    height: 17px;
    position: relative;
    top: 0;                    /* nav 高 64（對齊遊戲站）*/
}
html[data-theme="dark"] .portal-logo-img { filter: invert(1); }
.portal-nav-links {
    margin-left: auto;
    display: flex;
    gap: 0;
    align-items: stretch;
    height: 64px;
}
.portal-nav-links a {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--p-text);
    text-decoration: none;
    transition: background .2s;
}
.portal-nav-links a::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: #E53934;
    opacity: 0;
    transition: width .25s ease, opacity .25s ease;
}
.portal-nav-links a:hover { background: rgba(127, 127, 127, .08); color: var(--p-text); text-decoration: none; }
.portal-nav-links a:hover::after { width: 100%; opacity: 1; }
.theme-toggle {
    margin-left: 6px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--p-border);
    border-radius: 50%;
    background: transparent;
    color: var(--p-text);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle .tt-moon { display: none; }
html[data-theme="dark"] .theme-toggle .tt-sun { display: none; }
html[data-theme="dark"] .theme-toggle .tt-moon { display: inline; }

/* ---- main / hero（容器 1281、標題 24px）---- */
.portal-main { flex: 1 0 auto; }

.portal-hero {
    background: var(--p-soft);
    border-bottom: 1px solid var(--p-border);
    padding: 72px 12px 56px;
    text-align: center;
}
.portal-hero-inner { max-width: 1281px; margin: 0 auto; }
.portal-hero h1 {
    font-size: 42px;
    margin: 0 0 6px;
    letter-spacing: 2px;
    color: var(--p-text);
}
.portal-hero-sub { font-size: 20px; margin: 0 0 22px; color: var(--p-muted); }
.portal-hero-note {
    max-width: 720px;
    margin: 0 auto 26px;
    color: var(--p-muted);
    font-size: 14px;
}
.btn-portal-primary {
    display: inline-block;
    min-width: 228px;
    height: 40px;
    line-height: 40px;
    padding: 0 22px;
    background: var(--p-primary);
    color: #fff;
    border-radius: var(--p-radius);
    font-size: 14px;
    text-decoration: none;
}
.btn-portal-primary:hover { color: #fff; filter: brightness(1.05); text-decoration: none; }

.portal-section {
    max-width: 1281px;
    margin: 0 auto;
    padding: 40px 12px;
}
.portal-section-title {
    font-size: 24px;
    font-weight: 400;
    margin: 0 0 18px 4px;
    color: var(--p-text);
}
.portal-check {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--p-border);
    border-radius: 6px;
    background: var(--p-surface);
    box-shadow: var(--p-shadow);
}
.portal-check li {
    padding: 12px 16px;
    border-bottom: 1px solid var(--p-border);
    font-size: 14px;
}
.portal-check li:last-child { border-bottom: 0; }

.portal-404 { padding-top: 80px; text-align: center; }
.portal-404 h1 { font-size: 64px; margin: 0 0 10px; color: var(--p-text); }

/* ---- footer（對齊 Vue：#222426、高度 400px、padding-top 40px）---- */
.portal-footer {
    flex-shrink: 0;
    background: var(--p-footer);
    color: var(--p-footer-text);
    min-height: 400px;
    height: 400px;
    box-sizing: border-box;
    padding: 40px 0 48px;
}
.portal-footer-inner {
    max-width: 1293px;   /* 對齊 Vue：外框 1269 + 左右 12，於 1280 時左緣 12 */
    margin: 0 auto;
    padding: 0 12px;
}
.portal-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .25);
    padding-bottom: 14px;
    margin-bottom: 14px;
}
.portal-footer-links a {
    color: var(--p-footer-text);
    font-size: 13px;
    padding-right: 14px;
    margin-right: 15px;
    border-right: 1px solid #5a5a5a;
    text-decoration: none;
}
.portal-footer-links a:last-child { border-right: 0; }
.portal-footer-links a:hover { color: #fff; }
.portal-copyright { color: #b4b4b4; font-size: 12px; margin-top: 15px; }
.portal-footer-logo { margin-top: 10px; }
.portal-footer-logo img {
    display: block;
    width: 126px;
    height: 17px;
    filter: invert(1);         /* Vue footer：黑 logo 反轉成白 */
}

.site-debug { margin: 0; padding: 8px 16px; background: #fffbcc; color: #333; font-size: 12px; }

/* ---- 手機（≤767px）：門戶做真 responsive，不像舊站整頁縮放 ---- */
@media (max-width: 767px) {
    .portal-nav-inner { height: auto; padding: 12px; flex-wrap: wrap; gap: 10px; }
    .portal-nav-links { margin-left: 0; order: 3; width: 100%; gap: 12px; flex-wrap: wrap; }
    .theme-toggle { margin-left: auto; }
    .portal-hero { padding: 44px 12px 36px; }
    .portal-hero h1 { font-size: 30px; }
    .portal-hero-sub { font-size: 16px; }
    .btn-portal-primary { width: 100%; max-width: 360px; }
    .portal-footer { padding: 28px 0 36px; }
}



/* ==========================================================================
   M4：首頁輪播／遊戲分類卡／內容頁／會員表單
   ========================================================================== */
.portal-nav-right { display: flex; align-items: center; gap: 10px; margin-left: 8px; }
.p-lang { display: inline-flex; align-items: center; gap: 6px; }
.p-lang-label { font-size: 12px; color: var(--p-muted); }
.p-lang-select {
    height: 30px; padding: 0 24px 0 8px; border: 1px solid var(--p-border);
    border-radius: 4px; background: var(--p-surface); color: var(--p-text);
    font-size: 12px; outline: none; cursor: pointer; appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 7px center;
}

.p-wrap { max-width: 1281px; margin: 0 auto; padding: 0 12px; }
.p-games { padding: 0 0 8px; }
.p-title {
    font-size: 24px; font-weight: 400; color: var(--p-text);
    margin: 50px 0 20px 0; font-family: "Noto Sans KR", "Microsoft JhengHei", sans-serif;
}
.p-page .p-title { margin-top: 0; margin-bottom: 18px; }
.p-muted { color: var(--p-muted); }
.p-small { font-size: 12px; }
.p-center { text-align: center; }

/* 輪播 */
.p-hero { background: var(--p-soft); }
.p-carousel { position: relative; width: 100%; max-width: none; margin: 0; overflow: hidden; background: #cfd8e3; }
.p-slide { display: none; }
.p-slide.is-active { display: block; }
.p-slide img { display: block; width: 100%; height: auto; }
html[data-theme="dark"] .p-carousel { background: #0b0d14; }
.p-dots {
    position: absolute; left: 0; right: 0; bottom: 14px;
    display: flex; justify-content: center; gap: 10px;
}
.p-dot {
    width: 26px; height: 3px; border: 0; padding: 0; cursor: pointer;
    background: rgba(255,255,255,.45); border-radius: 2px;
}
.p-dot.is-active { background: #fff; }

/* 遊戲分類卡（對齊 Vue：296×196 圖、10px 間距、無邊框、El-card 陰影） */
.p-cards {
    display: grid; grid-template-columns: repeat(auto-fill, 296px); gap: 10px;
}
.p-card {
    width: 296px;
    background: var(--p-surface);
    border: 0; border-radius: 0;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .1);
}
html[data-theme="dark"] .p-card { box-shadow: 0 2px 12px rgba(0, 0, 0, .45); }
.p-card-logo { display: block; background: #000; }
.p-card-logo img { display: block; width: 296px; height: 196px; object-fit: cover; }
.p-card-body { padding: 14px; }
.p-card-head { display: flex; align-items: center; gap: 8px; }
.p-card-name { flex: 1; min-width: 0; font-size: 14px; color: var(--p-text); }
.p-card-fb { color: var(--p-muted); display: inline-flex; }
.p-card-fb img { display: block; }
.p-card-fb:hover { opacity: .8; }
.p-card-tag { font-size: 12px; margin-top: 5px; }
.p-tag-live { color: #66CD00; }
.p-tag-closed { color: #ccc; }
html[data-theme="dark"] .p-tag-closed { color: #8a8a96; }
.p-card-genre {
    margin-top: 10px; font-size: 12px; color: #ccc;
    display: flex; align-items: center; gap: 10px;
}
html[data-theme="dark"] .p-card-genre { color: #8a8a96; }
.p-card-genre img { display: block; margin-bottom: -3px; }

/* 內容頁 */
.p-page { padding-top: 28px; }
.p-richtext {
    color: var(--p-text); font-size: 14px; line-height: 1.85;
    border: 1px solid var(--p-border); border-radius: 4px;
    background: var(--p-surface); padding: 24px 26px;
    overflow-wrap: anywhere;
}
.p-richtext p { margin: 0 0 10px; }
.p-richtext h1, .p-richtext h2, .p-richtext h3 { margin: 18px 0 10px; line-height: 1.4; }
.p-richtext h1 { font-size: 22px; }
.p-richtext h2 { font-size: 18px; }
.p-richtext h3 { font-size: 16px; }
.p-richtext img { max-width: 100%; height: auto; }
.p-richtext a { color: var(--p-primary); }
.p-richtext table { max-width: 100%; border-collapse: collapse; }
.p-richtext td, .p-richtext th { border: 1px solid var(--p-border); padding: 6px 8px; }
.p-richtext ul, .p-richtext ol { padding-left: 22px; margin: 0 0 10px; }

/* 表單 */
.p-form {
    max-width: 500px; margin: 0 auto;
    background: transparent; border: 0; padding: 0; box-shadow: none;
}
.p-field { margin-bottom: 20px; }
.p-label { display: block; font-size: 14px; color: var(--p-text); margin-bottom: 8px; }
.p-input, .p-select {
    height: 40px; padding: 0 12px; font-size: 14px; color: var(--p-text);
    background: var(--p-surface); border: 1px solid var(--p-border);
    border-radius: var(--p-radius); outline: none; width: 100%; box-sizing: border-box;
}
.p-input:focus, .p-select:focus { border-color: var(--p-primary); }
.p-email-row { display: flex; align-items: center; gap: 8px; }
.p-email-local { flex: 1 1 auto; }
.p-at { color: var(--p-muted); }
.p-email-domain { width: 220px; flex: 0 0 220px; }
.p-code-row { display: flex; gap: 10px; }
.p-code-row .p-input { flex: 1 1 auto; }
.p-btn {
    display: inline-flex; align-items: center; justify-content: center;
    height: 40px; padding: 0 18px; font-size: 14px; border-radius: var(--p-radius);
    border: 1px solid var(--p-border); background: var(--p-surface); color: var(--p-text);
    cursor: pointer; text-decoration: none; white-space: nowrap;
}
.p-btn:hover { text-decoration: none; }
.p-btn-primary { min-width: 228px; background: var(--p-primary); border-color: var(--p-primary); color: #fff; }
.p-btn-primary:hover { color: #fff; filter: brightness(1.05); }
.p-btn-warning { background: var(--p-warning); border-color: var(--p-warning); color: #fff; }
.p-btn-warning:hover { color: #fff; filter: brightness(1.04); }
.p-btn[disabled] { opacity: .55; cursor: not-allowed; }
.p-form-actions { display: flex; justify-content: center; margin-top: 6px; }
.p-error { color: #f56c6c; font-size: 12px; margin-top: 6px; }
.p-checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--p-text); line-height: 1.5; }
.p-checkbox input { margin-top: 3px; }
.p-checkbox a { color: var(--p-primary); }
.p-agree-field { margin-bottom: 8px; }

/* 提示 */
.p-alert {
    max-width: 1281px; margin: 14px auto 0; padding: 10px 16px;
    border-radius: 4px; font-size: 14px;
}
.p-alert-success { background: #f0f9eb; border: 1px solid #c2e7b0; color: #529b2e; }
.p-alert-error { background: #fef0f0; border: 1px solid #fbc4c4; color: #c45656; }
.p-alert-info { background: var(--p-soft); border: 1px solid var(--p-border); color: var(--p-text); margin: 0 0 18px; max-width: none; }
html[data-theme="dark"] .p-alert-success { background: #16251a; border-color: #2c4a32; color: #a5d99a; }
html[data-theme="dark"] .p-alert-error { background: #2a1717; border-color: #5a2a2a; color: #f3a3a3; }

.p-success-box {
    background: var(--p-surface); border: 1px solid var(--p-border);
    padding: 28px; border-radius: 6px; box-shadow: var(--p-shadow);
    margin: 16px auto 22px; max-width: 720px; color: var(--p-text);
}

/* 手機 */
@media (max-width: 767px) {
    .portal-nav-links { order: 3; width: 100%; }
    .portal-nav-right { margin-left: auto; }
    .p-wrap { padding: 0 12px; }
    .p-cards { grid-template-columns: 1fr; }
    .p-card { width: 100%; }
    .p-card-logo img { width: 100%; height: auto; aspect-ratio: 3 / 2; }
    .p-form { padding: 20px 16px; }
    .p-email-domain { width: 130px; flex-basis: 130px; }
    .p-btn-primary { width: 100%; }
    .p-code-row { flex-wrap: wrap; }
    .p-code-row .p-btn-warning { width: 100%; }
    .p-richtext { padding: 18px 14px; }
    .p-slide img { min-height: 160px; object-fit: cover; }
}


/* 最後一個遊戲區塊與 footer 的間距（對齊 Vue：50px container padding + 4px） */
.p-games:last-of-type { padding-bottom: 54px; }

/* Element Message 風格提示（固定上方置中、自動淡出） */
.p-toast-wrap {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: center;
    pointer-events: none;
}
.p-toast {
    min-width: 260px; max-width: 90vw; padding: 11px 18px;
    border-radius: 4px; font-size: 14px; line-height: 1.5;
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
    border: 1px solid var(--p-border); background: var(--p-surface); color: var(--p-text);
    transition: opacity .3s, transform .3s; opacity: 1; pointer-events: auto;
}
.p-toast.is-hide { opacity: 0; transform: translateY(-8px); }
.p-toast-success { background: #f0f9eb; border-color: #e1f3d8; color: #67c23a; }
.p-toast-error { background: #fef0f0; border-color: #fde2e2; color: #f56c6c; }
.p-toast-warning { background: #fdf6ec; border-color: #faecd8; color: #e6a23c; }
html[data-theme="dark"] .p-toast-success { background: #16251a; border-color: #2c4a32; color: #a5d99a; }
html[data-theme="dark"] .p-toast-error { background: #2a1717; border-color: #5a2a2a; color: #f3a3a3; }
html[data-theme="dark"] .p-toast-warning { background: #2a2317; border-color: #55452a; color: #f0c78a; }

/* ==========================================================================
   頂部導航：漢堡／右側抽屜、Banner 固定高度
   ========================================================================== */
.portal-ham {
    display: none;
    width: 34px; height: 34px; padding: 0;
    border: 0; background: transparent; cursor: pointer;
    flex-direction: column; justify-content: center; align-items: center; gap: 4px;
}
.portal-ham span { display: block; width: 20px; height: 2px; background: var(--p-text); border-radius: 1px; }
body.portal-drawer-open { overflow: hidden; }

.portal-drawer-overlay {
    position: fixed; inset: 0; z-index: 3998;
    background: rgba(0, 0, 0, .45);
    opacity: 0; transition: opacity .25s ease;
}
.portal-drawer-overlay.is-open { opacity: 1; }

.portal-drawer {
    position: fixed; top: 0; right: 0; z-index: 3999;
    width: 284px; max-width: 86vw; height: 100%;
    background: var(--p-surface);
    box-shadow: -8px 0 24px rgba(0, 0, 0, .18);
    transform: translateX(102%);
    transition: transform .28s ease;
    display: flex; flex-direction: column;
    padding: 18px 0 24px;
}
body.portal-drawer-open .portal-drawer { transform: translateX(0); }
.portal-drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px 14px; border-bottom: 1px solid var(--p-border);
}
.portal-drawer-title { font-size: 16px; color: var(--p-text); }
.portal-drawer-close {
    border: 0; background: transparent; color: var(--p-muted);
    font-size: 18px; cursor: pointer; padding: 4px;
}
.portal-drawer-nav { display: flex; flex-direction: column; padding: 8px 0; }
.portal-drawer-nav a {
    padding: 14px 18px; font-size: 16px; color: var(--p-text);
    text-decoration: none; border-bottom: 1px solid var(--p-border);
}
.portal-drawer-nav a:hover { background: rgba(127, 127, 127, .08); text-decoration: none; }
.portal-drawer-lang { padding: 16px 18px 0; }
.portal-drawer-lang .p-lang-label { display: none; }
.portal-drawer-lang .p-lang-select { width: 100%; height: 36px; }

/* Banner：固定高度，避免每張圖高度不一 */
.p-hero .p-carousel { height: 560px; }
.p-hero .p-slide img { width: 100%; height: 560px; object-fit: cover; display: block; }

@media (max-width: 767px) {
    .portal-nav-links { display: none; }
    .portal-ham { display: flex; }
    .portal-nav-right .p-lang { display: none; }
    .p-hero .p-carousel { height: 220px; }
    .p-hero .p-slide img { height: 220px; }
}

/* ==========================================================================
   字體／字重對齊 Vue（Element 表單、footer、按鈕、卡片名稱）
   ========================================================================== */
body.portal-body { font-family: "Avenir", Helvetica, Arial, sans-serif; }
.p-title { font-family: "Noto Sans KR", sans-serif; color: #000; }
html[data-theme="dark"] .p-title { color: var(--p-text); }
.p-label { color: #606266; font-weight: 400; }
html[data-theme="dark"] .p-label { color: #c9c9d4; }
.p-input, .p-select { color: #606266; font-weight: 400; }
.p-input::placeholder { color: #a8abb2; }
html[data-theme="dark"] .p-input, html[data-theme="dark"] .p-select { color: var(--p-text); }
html[data-theme="dark"] .p-input::placeholder { color: #7c8394; }
.p-card-name { font-size: 16px; color: #303133; }
html[data-theme="dark"] .p-card-name { color: var(--p-text); }
.p-btn { font-weight: 500; }
.p-checkbox { font-weight: 500; }
.p-checkbox a { color: var(--p-primary); }
.portal-footer { font-family: "Noto Sans KR", sans-serif; }
.portal-footer-links a { font-weight: 500; }
.p-richtext { font-family: "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; }

/* ==========================================================================
   語言切換（對齊 mh30：快捷 3 語 + 地球下拉）
   ========================================================================== */
.p-lang-switcher { display: flex; align-items: center; gap: 6px; }
.p-lang-quick { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.p-lang-quick .p-lang-item a {
    display: block; padding: 4px 8px; font-size: 12px; border-radius: 4px;
    color: var(--p-muted); text-decoration: none; transition: color .2s, background .2s;
}
.p-lang-quick .p-lang-item a:hover { color: #E53934; }
.p-lang-quick .p-lang-item.is-active a { background: #E53934; color: #fff; }
.p-lang-globe { position: relative; }
.p-lang-globe > svg { width: 20px; height: 20px; cursor: pointer; color: var(--p-muted); display: block; transition: color .2s; }
.p-lang-globe:hover > svg { color: #E53934; }
.p-lang-globe-menu {
    position: absolute; top: calc(100% + 10px); right: 0; min-width: 140px;
    background: var(--p-surface); border: 1px solid var(--p-border);
    border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: all .2s; z-index: 1200; padding: 4px;
}
.p-lang-globe.is-open .p-lang-globe-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.p-lang-globe-item {
    display: block; padding: 8px 10px; border-radius: 5px;
    color: var(--p-text); font-size: 13px; text-decoration: none; white-space: nowrap;
}
.p-lang-globe-item:hover { background: rgba(127, 127, 127, .1); text-decoration: none; }
.p-lang-globe-item.is-active { color: #E53934; font-weight: 500; }
.p-lang-globe-menu .p-lang-globe-item.is-quick { display: none; }

/* 抽屜語言格 */
.p-lang-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.p-lang-grid-item {
    display: block; padding: 8px 10px; border: 1px solid var(--p-border); border-radius: 5px;
    color: var(--p-text); font-size: 13px; text-align: center; text-decoration: none;
}
.p-lang-grid-item:hover { border-color: var(--p-primary); text-decoration: none; }
.p-lang-grid-item.is-active { background: #E53934; border-color: #E53934; color: #fff; }

@media (max-width: 767px) {
    .p-lang-quick { display: none; }
    .p-lang-globe-menu .p-lang-globe-item.is-quick { display: block; }
    .p-lang-globe-menu { right: 0; }
}

/* 登入頁／會員中心 */
.p-auth-links {
    margin: 18px 0 0;
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    font-size: 13px;
}
.p-auth-links a { color: var(--p-primary); text-decoration: none; }
.p-auth-links a:hover { text-decoration: underline; }
.p-auth-sep { color: var(--p-border); }
.p-member-card {
    max-width: 500px; margin-top: 6px; padding: 18px 20px;
    border: 1px solid var(--p-border); border-radius: 6px; background: var(--p-surface);
}
.p-member-row { display: flex; gap: 16px; padding: 8px 0; font-size: 14px; }
.p-member-label { width: 96px; color: var(--p-muted); }
.p-member-value { color: var(--p-text); word-break: break-all; }
.p-member-links { margin-top: 14px; }
.p-member-logout { margin-top: 18px; }

/* PC 語言選中：藍色（門戶主色） */
.p-lang-quick .p-lang-item a:hover { color: var(--p-primary); }
.p-lang-quick .p-lang-item.is-active a { background: var(--p-primary); color: #fff; }
.p-lang-globe:hover > svg { color: var(--p-primary); }
.p-lang-globe-item.is-active { color: var(--p-primary); }
.p-lang-grid-item.is-active { background: var(--p-primary); border-color: var(--p-primary); color: #fff; }

/* 登入頁：登入＋註冊並排、註冊白底大按鈕、下方文字連結 */
.p-auth-actions { display: flex; justify-content: center; gap: 12px; margin-top: 10px; }
.p-auth-actions .p-auth-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 200px; height: 40px; padding: 0 26px;
    font-size: 15px; font-weight: 500; letter-spacing: .5px;
}
.p-btn-white {
    background: var(--p-surface); color: var(--p-primary);
    border: 1px solid var(--p-primary);
}
.p-btn-white:hover { background: rgba(64, 158, 255, .08); color: var(--p-primary); }
.p-auth-links-center { justify-content: center; margin-top: 18px; }
.p-auth-links-center a { font-size: 13px; }

@media (max-width: 767px) {
    .p-auth-actions { gap: 10px; }
    .p-auth-actions .p-auth-btn {
        flex: 1 1 0; min-width: 0; width: auto; height: 40px; padding: 0 10px; font-size: 14px;
    }
    .p-auth-links-center { font-size: 13px; }
}

/* 登入/註冊：左右對齊表單 input、兩顆等寬大按鈕 */
.p-auth-actions {
    display: flex; width: 100%; gap: 12px;
    justify-content: stretch; margin-top: 10px;
}
.p-auth-actions .p-auth-btn {
    flex: 1 1 0; width: auto; min-width: 0;
    height: 50px; padding: 0 14px;
    font-size: 16px; font-weight: 500; border-radius: 6px;
}
@media (max-width: 767px) {
    .p-auth-actions { gap: 10px; }
    .p-auth-actions .p-auth-btn { height: 46px; font-size: 15px; }
}

/* 對齊遊戲站紅色：語言 hover/選中、主題按鈕 hover、會員表單提交 */
.p-lang-quick .p-lang-item a:hover,
.p-lang-globe:hover > svg,
.p-lang-globe-item:hover { color: #E53934; }
.p-lang-quick .p-lang-item.is-active a { background: #E53934; color: #fff; }
.p-lang-globe-item.is-active { color: #E53934; }
.p-lang-grid-item:hover { border-color: #E53934; }
.p-lang-grid-item.is-active { background: #E53934; border-color: #E53934; color: #fff; }

.theme-toggle:hover {
    border-color: #E53934;
    color: #E53934;
    box-shadow: 0 0 8px rgba(229, 57, 53, .45);
}

.p-btn-red {
    background: #E53934;
    border-color: #E53934;
    color: #fff;
    font-weight: 700;
}
.p-btn-red:hover {
    background: #c62e2a;
    border-color: #c62e2a;
    color: #fff;
    box-shadow: 0 6px 18px rgba(229, 57, 52, .35);
}

/* 登入也紅色、註冊白按鈕改紅框、同意條款連結紅色 */
.p-checkbox a { color: #E53934; }
.p-btn-white { background: var(--p-surface); color: #E53934; border: 1px solid #E53934; }
.p-btn-white:hover { background: rgba(229, 57, 52, .08); color: #E53934; }

/* ==========================================================================
   富文本內容頁（隱私／關於／聯絡）閱讀版型
   ========================================================================== */
.p-richtext {
    max-width: 920px;
    margin: 0 auto;
    padding: 38px 46px 42px;
    border: 1px solid var(--p-border);
    border-radius: 8px;
    background: var(--p-surface);
    font-size: 15px;
    line-height: 2;
    color: var(--p-text);
}
.p-richtext p { margin: 0 0 15px; }
.p-richtext .p-lead {
    font-size: 15px;
    color: var(--p-muted);
    line-height: 1.95;
    padding-bottom: 18px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--p-border);
}
.p-richtext .p-muted { color: var(--p-muted); font-size: 13px; }
.p-richtext h2 {
    font-size: 20px;
    line-height: 1.5;
    margin: 34px 0 14px;
    padding-left: 12px;
    border-left: 4px solid #E53934;
    color: var(--p-text);
}
.p-richtext h3 {
    font-size: 16px;
    line-height: 1.6;
    margin: 22px 0 8px;
    color: var(--p-text);
}
.p-richtext h2:first-child, .p-richtext h3:first-child { margin-top: 0; }
.p-richtext strong { color: var(--p-text); font-weight: 600; }
.p-richtext a { color: #E53934; }
.p-richtext a:hover { color: #c62e2a; text-decoration: underline; }
.p-richtext ul.p-list, .p-richtext ol { padding-left: 22px; margin: 0 0 16px; }
.p-richtext ul.p-list li { margin-bottom: 9px; line-height: 1.9; }

/* 關於我們：功能卡片 */
.p-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0 28px;
}
.p-feature-card {
    border: 1px solid var(--p-border);
    border-radius: 8px;
    background: var(--p-soft);
    padding: 18px 16px 16px;
}
.p-feature-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(229, 57, 52, .1);
    color: #E53934; font-size: 12px; font-weight: 700; margin-bottom: 10px;
}
.p-feature-card h3 { margin: 0 0 6px; font-size: 16px; }
.p-feature-card p { margin: 0; font-size: 13.5px; line-height: 1.75; color: var(--p-muted); }

/* 聯絡我們：相關連結 */
.p-link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.p-link-row span { color: var(--p-border); }

@media (max-width: 767px) {
    .p-richtext { padding: 22px 18px 26px; font-size: 14.5px; line-height: 1.95; border-radius: 6px; }
    .p-richtext h2 { font-size: 18px; margin: 26px 0 12px; }
    .p-feature-grid { grid-template-columns: 1fr; gap: 10px; }
    .p-feature-card { padding: 14px; }
}

/* 登入頁：找回／修改密碼改灰黑色文字按鈕 */
.p-auth-links-center a {
    color: var(--p-muted);
    font-size: 13px;
    padding: 4px 2px;
    text-decoration: none;
    transition: color .2s;
}
.p-auth-links-center a:hover { color: var(--p-text); text-decoration: underline; }
.p-auth-links-center .p-auth-sep { color: var(--p-border); }

/* 非中文語系字重對齊（英文／日韓等拉丁字若用 Arial 會偏細） */
html:not([lang^="zh"]) body.portal-body,
html:not([lang^="zh"]) .p-label,
html:not([lang^="zh"]) .p-input,
html:not([lang^="zh"]) .p-select,
html:not([lang^="zh"]) .p-btn,
html:not([lang^="zh"]) .p-nav-links a,
html:not([lang^="zh"]) .portal-drawer-nav a,
html:not([lang^="zh"]) .p-card-name {
    font-family: "Segoe UI", "Noto Sans KR", Arial, sans-serif;
}
html:not([lang^="zh"]) body.portal-body { font-weight: 500; }
html:not([lang^="zh"]) .p-label,
html:not([lang^="zh"]) .p-btn,
html:not([lang^="zh"]) .p-nav-links a,
html:not([lang^="zh"]) .portal-drawer-nav a { font-weight: 500; }

html:not([lang^="zh"]) .p-input,
html:not([lang^="zh"]) .p-select { font-weight: 500; }

/* 會員中心：功能按鈕與機器清單 */
.p-member-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 4px; }
.p-member-actions .p-btn { min-width: 0; padding: 9px 18px; font-size: 14px; }
.p-machine-list {
    max-width: 500px; margin: 0 0 14px; padding: 12px 16px;
    border: 1px solid var(--p-border); border-radius: 6px; background: var(--p-soft);
    list-style: none; font-size: 13px;
}
.p-machine-list li { padding: 4px 0; color: var(--p-muted); word-break: break-all; }
.p-machine-list code { color: var(--p-text); background: transparent; }

/* 會員中心：加大、居中的狀態表單 */
.p-member-panel {
    max-width: 860px;
    margin: 0 auto;
    padding: 26px 34px 22px;
    min-height: 362px;
    box-sizing: border-box;
    background: var(--p-surface);
    border: 1px solid var(--p-border);
    border-radius: 10px;
}
.p-member-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 56px;
    box-sizing: border-box;
    padding-bottom: 14px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--p-border);
}
.p-member-panel-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--p-text);
}
.p-member-panel-logout { margin: 0; }
.p-member-panel-logout .p-btn { min-width: 0; padding: 8px 18px; font-size: 14px; }
.p-member-rows { padding: 6px 0 2px; }
.p-member-panel .p-member-row {
    display: flex;
    gap: 16px;
    align-items: baseline;
    padding: 12px 0;
    font-size: 15px;
    border-bottom: 1px dashed var(--p-border);
}
.p-member-panel .p-member-row:last-child { border-bottom: 0; }
.p-member-panel .p-member-label { width: 140px; flex-shrink: 0; color: var(--p-muted); }
.p-member-panel .p-member-value { color: var(--p-text); word-break: break-all; }
.p-member-actions {
    max-width: 860px;
    margin: 20px auto 0;
    justify-content: center;
}
.p-member-actions .p-btn { min-width: 150px; text-align: center; }

@media (max-width: 767px) {
    .p-member-panel { padding: 18px 16px 14px; border-radius: 8px; min-height: 318px; }
    .p-member-panel-title { font-size: 18px; }
    .p-member-panel .p-member-row { font-size: 14px; gap: 10px; padding: 10px 0; }
    .p-member-panel .p-member-label { width: 104px; }
    .p-member-actions .p-btn { flex: 1 1 40%; min-width: 0; }
}

/* 解綁頁：加大面板與居中按鈕 */
.p-member-panel-badge {
    font-size: 12px; color: #E53934;
    background: rgba(229, 57, 52, .1);
    border: 1px solid rgba(229, 57, 52, .25);
    border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.p-machine-list-panel {
    max-width: none; margin: 16px 0 0; background: var(--p-soft); border-style: dashed;
}
.p-member-panel-note { margin: 10px 0 0; font-size: 13px; }
.p-member-panel-actions {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
    gap: 12px; margin-top: 22px;
}
.p-member-panel-actions form { margin: 0; }
.p-member-unbind-btn {
    min-width: 230px; height: 46px; padding: 0 28px;
    font-size: 15px; font-weight: 700;
}
.p-member-panel-actions .p-btn { height: 46px; display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 767px) {
    .p-member-panel-actions { flex-direction: column; align-items: stretch; }
    .p-member-panel-actions form { width: 100%; }
    .p-member-unbind-btn, .p-member-panel-actions .p-btn { width: 100%; min-width: 0; }
}


/* 遊戲卡平台 icon（動態由後台平台設定） */
.p-card-genre { display: flex; align-items: center; gap: 6px; }
.p-card-genre img { flex-shrink: 0; opacity: .85; }
.p-card-genre-text::before { content: "·"; color: var(--p-border); margin-right: 6px; }

/* 遊戲卡：多平台並列，icon 與名稱水平對齊 */
.p-card-platforms { display: inline-flex; align-items: center; gap: 12px; line-height: 1; }
.p-card-platform { display: inline-flex; align-items: center; gap: 5px; line-height: 1; white-space: nowrap; }
.p-card-platform img { display: block; width: 16px; height: 16px; object-fit: contain; flex-shrink: 0; }
.p-card-platform > span { display: inline-block; line-height: 16px; font-size: 12px; }
.p-card-genre .p-card-genre-text { display: inline-flex; align-items: center; line-height: 16px; }
.p-card-genre .p-card-genre-text::before { content: "·"; margin-right: 6px; color: var(--p-border); }
.p-card-genre .p-card-genre-text:first-child::before { display: none; }

/* 平台 icon 與名稱的視覺基線對齊（消除 img 預設基線偏移） */
.p-card-platform img { position: relative; top: -1.5px; }

/* Google／Apple 登入按鈕 */
.p-oauth { max-width: 500px; margin: 22px auto 4px; }
.p-oauth-sep { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; color: var(--p-muted); font-size: 12px; }
.p-oauth-sep::before, .p-oauth-sep::after { content: ""; flex: 1; height: 1px; background: var(--p-border); }
.p-oauth-buttons { display: flex; flex-direction: row; gap: 10px; align-items: stretch; }
.p-oauth-provider { flex: 1 1 0; min-width: 0; display: flex; align-items: stretch; }
.p-google-button { display: flex; flex: 1 1 auto; width: 100%; min-width: 0; height: 44px; align-items: stretch; }
.p-google-button > div { height: 44px !important; }
.p-google-button > div,
.p-google-button iframe { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
.p-google-button iframe { height: 44px !important; }
.p-oauth-apple {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; height: 44px; border-radius: 6px;
    border: 1px solid #000; background: #000; color: #fff;
    font-size: 14px; font-weight: 500; cursor: pointer;
}
.p-oauth-apple:hover { background: #1a1a1a; border-color: #1a1a1a; color: #fff; }
.p-oauth-error { display: none; margin-top: 10px; color: #f56c6c; font-size: 13px; }

/* 修改密碼：桌面壓縮間距，讓面板高度與會員狀態一致 */
@media (min-width: 768px) {
    .p-member-panel--form { padding-top: 18px; padding-bottom: 15px; }
    .p-member-panel--form .p-field { margin-bottom: 7px; }
    .p-member-panel--form .p-label { margin-bottom: 4px; }
    .p-member-panel--form .p-member-panel-actions { margin-top: 8px; }
}



/* 刪除賬號 */
.p-member-danger {
    max-width: 860px;
    margin: 32px auto 0;
    padding-top: 18px;
    border-top: 1px solid var(--p-border);
    text-align: center;
}
.p-member-danger .p-btn { min-width: 150px; }
.p-member-danger-note { margin-top: 8px; font-size: 12px; color: var(--p-muted); }
.p-member-danger-error { display: none; margin-top: 8px; font-size: 13px; color: #f56c6c; }

/* 自繪確認彈窗 */
.p-modal {
    position: fixed; inset: 0; z-index: 5000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; background: rgba(0, 0, 0, .55);
}
.p-modal[hidden] { display: none; }
.p-modal-card {
    width: min(460px, 100%);
    background: var(--p-surface); color: var(--p-text);
    border: 1px solid var(--p-border); border-radius: 12px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
    padding: 22px 24px 20px;
}
.p-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.p-modal-title { margin: 0; font-size: 20px; font-weight: 600; color: #E53934; }
.p-modal-close {
    border: 0; background: transparent; color: var(--p-muted);
    font-size: 18px; line-height: 1; cursor: pointer; padding: 4px;
}
.p-modal-body { padding-top: 12px; }
.p-modal-text { margin: 0 0 10px; font-size: 14px; }
.p-modal-list { margin: 0 0 16px; padding-left: 20px; font-size: 13px; color: var(--p-muted); }
.p-modal-list li { margin: 4px 0; }
.p-modal-error { display: none; margin-top: 10px; color: #f56c6c; font-size: 13px; }
.p-modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; }
.p-modal-actions .p-btn { min-width: 104px; }
@media (max-width: 480px) {
    .p-modal { padding: 14px; }
    .p-modal-card { padding: 18px 16px 16px; }
    .p-modal-actions .p-btn { flex: 1; }
}

@media (max-width: 600px) {
    .p-oauth-buttons { flex-direction: column; }
    .p-oauth-provider { flex: 1 1 auto; width: 100%; }
}


.p-oauth-google-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; height: 44px; border-radius: 6px;
    border: 1px solid #dadce0; background: #fff; color: #3c4043;
    font-size: 14px; font-weight: 500; cursor: pointer;
}
.p-oauth-google-btn:hover { background: #f8f9fa; border-color: #c6c9cc; }
