/* =================================================================
   改版預覽：可愛 Q 版冒險風主題（照 ChatGPT 設計圖製作）
   -----------------------------------------------------------------
   圖案素材都放在 /theme/ 資料夾（ChatGPT 畫的木牌、緞帶、風景、圖示）。
   所有樣式都限定在 <html class="theme-rpg"> 底下才會生效。
   這個 class 只會加在預覽帳號（window.isPreviewUser）身上，
   其他會員完全看不到、也不受影響（見 index.html 裡的 applyRpgTheme）。

   要正式讓所有人都看到新版時，只要把 index.html 的
   applyRpgTheme 判斷改成永遠加上 theme-rpg 即可，不用改這支檔案。
   ================================================================= */

/* ---------- 0. 色票（取自設計圖） ---------- */
html.theme-rpg {
    --q-bg: #fbeedd;
    --q-card: #fdf5e8;
    --q-card-2: #f8e6cc;
    --q-rim: #ecd3ae;            /* 卡片外框淡褐 */
    --q-rim-dark: #d8b78c;
    --q-ink: #5a3418;            /* 主要文字：深咖啡 */
    --q-ink-soft: #8a6044;
    --q-line: #7a4a26;           /* 圖示描邊色 */
    --q-orange: #fbbf5d;
    --q-orange-deep: #ef9a32;
    --q-hp: #d9503f;
    --q-hp-track: #6c3a29;
    --q-tile-green: #cfd59c;
    --q-tile-purple: #d6c6dd;
    --q-tile-peach: #f3c992;
    --q-tile-blue: #c4d4e4;
    --q-adventure: #d9cde4;
    --q-font: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;

    --color-text-primary: var(--q-ink);
    --color-text-secondary: var(--q-ink-soft);
    --color-frame-gold: var(--q-rim-dark);
    --color-frame-gold-light: var(--q-orange-deep);
    --color-card-background: var(--q-card);
    --color-cta-background: var(--q-orange);
    --color-cta-hover: var(--q-orange-deep);
    --font-primary: var(--q-font);

    /* 蓋掉 style.css 給 html 的底色，避免 body 背景被瀏覽器拿去畫滿整個畫布（見 style.css 註解） */
    background-color: var(--q-bg);
}

/* 只在新版藏起來的表情符號（舊版照常顯示） */
html.theme-rpg .q-emoji { display: none; }

/* ---------- 1. 背景：頂部風景帶＋奶油底 ---------- */
html.theme-rpg body {
    font-family: var(--q-font);
    color: var(--q-ink);
    background-color: var(--q-bg);
    background-image:
        url('theme/scene-top.png'),
        radial-gradient(circle, rgba(214, 170, 120, 0.12) 1.3px, transparent 1.5px);
    background-repeat: no-repeat, repeat;
    background-position: center top, 0 0;
    background-size: 100% auto, 20px 20px;
    background-attachment: scroll, scroll;
}
html.theme-rpg h1,
html.theme-rpg h2,
html.theme-rpg h3 {
    font-family: var(--q-font);
    font-weight: 900;
    color: var(--q-ink);
}
html.theme-rpg p { color: var(--q-ink-soft); }

/* ---------- 2. 頁面主標題：ChatGPT 木牌 ---------- */
html.theme-rpg .page-main-title,
html.theme-rpg .page-main-title[style] {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(88%, 360px);
    aspect-ratio: 640 / 148; /* 改成比木牌原圖(640/180)矮，把下方垂下去的緞帶尾巴裁掉一截，讓方塊的範圍更貼近木牌本體，文字置中才會對齊木牌本體的中間，而不是偏下 */
    min-height: min-content; /* 標題字太長、木牌裝飾圖高度不夠裝時，讓方塊跟著長高，避免文字被擠出木牌外面 */
    overflow: hidden;
    margin: 4px auto 14px !important;
    padding: 0 10px !important;
    font-size: clamp(1.1rem, 6.4vw, 1.7rem);
    font-weight: 900;
    letter-spacing: 0.12em;
    color: var(--q-ink) !important;
    text-shadow: 0 1px 0 #fff2d6;
    background: url('theme/sign.png') center top / 100% auto no-repeat; /* 高度改 auto（維持原圖比例），配合上面較矮的方塊，裁掉的是下緣多出來的緞帶尾巴 */
    border: none;
    box-shadow: none;
}
html.theme-rpg .page-main-title::before,
html.theme-rpg .page-main-title::after { content: none; }
html.theme-rpg .news-header { margin-bottom: 4px; }
html.theme-rpg .news-header-decoration { display: none; }

/* 小標題：ChatGPT 緞帶（我的收藏、冒險與成長紀錄、職業公會排行、店家資訊各區塊） */
html.theme-rpg .collection-section-header,
html.theme-rpg .profile-contribution-title,
html.theme-rpg .profile-slot-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(66%, 250px);
    aspect-ratio: 480 / 99;
    min-height: min-content; /* 標題字太長時讓緞帶跟著長高，避免文字被擠出緞帶外面 */
    margin: -24px auto 8px;
    padding: 0 10px 3px;
    background: url('theme/ribbon.png') center / 100% 100% no-repeat;
    border: none;
}
html.theme-rpg .profile-contribution-title {
    font-size: 0.98rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: var(--q-ink);
    margin: 0 auto 10px;
}
html.theme-rpg .collection-section-title,
html.theme-rpg .profile-slot-label {
    font-size: 0.98rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: var(--q-ink);
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
}
html.theme-rpg .collection-section-title::before,
html.theme-rpg .collection-section-title::after,
html.theme-rpg .profile-slot-label::before,
html.theme-rpg .profile-slot-label::after,
html.theme-rpg .profile-contribution-title::before,
html.theme-rpg .profile-contribution-title::after {
    content: '✦';
    margin: 0 6px;
    font-size: 0.7em;
    color: var(--q-ink);
}

/* ---------- 3. 卡片：奶油底＋淡褐雙層框 ---------- */
html.theme-rpg .card,
html.theme-rpg .profile-card,
html.theme-rpg .gg-card,
html.theme-rpg .info-section,
html.theme-rpg .announcement-box,
html.theme-rpg #gg-modal-card,
html.theme-rpg #collection-modal-box,
html.theme-rpg #asset-popover,
html.theme-rpg .chest-modal-box,
html.theme-rpg .modal-content,
html.theme-rpg .sb-score-popup-inner,
html.theme-rpg .gh-detail-panel {
    color: var(--q-ink);
    background: var(--q-card);
    border: 2px solid var(--q-rim-dark);
    border-radius: 20px;
    box-shadow: inset 0 0 0 4px var(--q-card), inset 0 0 0 6px #f3e2c8, 0 3px 0 var(--q-rim), 0 6px 14px rgba(170, 120, 70, 0.12);
    backdrop-filter: none;
}

/* ---------- 4. 按鈕 ---------- */
html.theme-rpg .cta-button,
html.theme-rpg .tool-start-btn,
html.theme-rpg #dice-roll-btn,
html.theme-rpg #go-to-booking-step-btn,
html.theme-rpg .monster-attack-btn,
html.theme-rpg .chest-demo-btn,
html.theme-rpg .next-step-btn {
    --color-text-secondary: #f6e3c8;
    font-family: var(--q-font);
    font-weight: 900;
    letter-spacing: 0.08em;
    color: var(--q-ink);
    text-shadow: 0 1px 0 rgba(255, 245, 220, 0.8);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0, rgba(255, 255, 255, 0) 45%),
        linear-gradient(180deg, #ffd27a, var(--q-orange-deep));
    border: 3px solid #b8692b;
    border-radius: 18px;
    box-shadow: inset 0 -4px 0 rgba(200, 110, 30, 0.35), inset 0 0 0 2px rgba(255, 236, 190, 0.7), 0 4px 0 #9b5626, 0 7px 12px rgba(160, 100, 50, 0.22);
    transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
html.theme-rpg .cta-button:hover,
html.theme-rpg .tool-start-btn:hover,
html.theme-rpg .monster-attack-btn:hover { transform: none; filter: brightness(1.04); }
html.theme-rpg .cta-button:active,
html.theme-rpg .tool-start-btn:active,
html.theme-rpg #dice-roll-btn:active,
html.theme-rpg #go-to-booking-step-btn:active,
html.theme-rpg .monster-attack-btn:active,
html.theme-rpg .chest-demo-btn:active,
html.theme-rpg .next-step-btn:active {
    transform: translateY(3px);
    box-shadow: inset 0 -3px 0 rgba(200, 110, 30, 0.35), inset 0 0 0 2px rgba(255, 236, 190, 0.7), 0 1px 0 #9b5626, 0 3px 6px rgba(160, 100, 50, 0.2);
}
html.theme-rpg .monster-attack-btn:disabled { filter: grayscale(0.6); opacity: 0.8; cursor: not-allowed; }
/* 次要按鈕（inline 背景是 var(--color-text-secondary) 的那些）：奶茶色 */
html.theme-rpg .cta-button[style*="color-text-secondary"] {
    background: linear-gradient(180deg, #fff8ec, #f3dfc2) !important;
    border-color: var(--q-rim-dark);
    box-shadow: 0 4px 0 var(--q-rim), 0 7px 12px rgba(160, 100, 50, 0.12);
}

/* 小按鈕：標籤、篩選、返回 */
html.theme-rpg .details-back-button,
html.theme-rpg .news-filter-btn,
html.theme-rpg .filter-tag-btn,
html.theme-rpg #more-tags-btn,
html.theme-rpg .gg-filter-toggle,
html.theme-rpg .gg-past-toggle,
html.theme-rpg #view-my-bookings-btn,
html.theme-rpg .tools-option-btn,
html.theme-rpg .dice-type-btn,
html.theme-rpg .dice-count-btn,
html.theme-rpg .timer-preset-btn,
html.theme-rpg .collection-subnav-btn {
    font-family: var(--q-font);
    font-weight: 700;
    color: var(--q-ink);
    background: var(--q-card);
    border: 2px solid var(--q-rim-dark);
    border-radius: 999px;
    box-shadow: 0 3px 0 var(--q-rim);
}
html.theme-rpg .news-filter-btn.active,
html.theme-rpg .filter-tag-btn.active,
html.theme-rpg .gg-filter-toggle.active,
html.theme-rpg .tools-option-btn.active,
html.theme-rpg .dice-type-btn.active,
html.theme-rpg .dice-count-btn.active,
html.theme-rpg .collection-subnav-btn.active {
    background: linear-gradient(180deg, #ffe39e, var(--q-orange));
    border-color: #c07a35;
    box-shadow: 0 3px 0 #c07a35;
}
html.theme-rpg #clear-filters {
    font-weight: 700;
    color: #fff;
    background: var(--q-hp);
    border: 2px solid #a8392b;
    border-radius: 999px;
    box-shadow: 0 3px 0 #a8392b;
}
html.theme-rpg .details-back-button { padding: 6px 14px; margin-bottom: 14px; cursor: pointer; }

/* 分頁切換列（桌遊揪團 / 場地預約） */
html.theme-rpg .booking-tab-bar {
    padding: 4px;
    gap: 4px;
    background: var(--q-card-2);
    border: 2px solid var(--q-rim-dark);
    border-radius: 999px;
    box-shadow: 0 3px 0 var(--q-rim);
}
html.theme-rpg .booking-tab-btn {
    font-family: var(--q-font);
    font-weight: 700;
    color: var(--q-ink-soft);
    border-radius: 999px;
}
html.theme-rpg .booking-tab-btn.active {
    color: var(--q-ink);
    background: linear-gradient(180deg, #ffe39e, var(--q-orange));
    box-shadow: inset 0 0 0 2px #c07a35;
}

/* ---------- 5. 輸入框 ---------- */
html.theme-rpg input[type="text"],
html.theme-rpg input[type="search"],
html.theme-rpg input[type="tel"],
html.theme-rpg input[type="email"],
html.theme-rpg input[type="number"],
html.theme-rpg input[type="date"],
html.theme-rpg select,
html.theme-rpg textarea,
html.theme-rpg #gg-filter-bar input[type="text"] {
    font-family: var(--q-font);
    color: var(--q-ink);
    background: #fffaf2;
    border: 2px solid var(--q-rim-dark);
    border-radius: 14px;
    box-shadow: inset 0 2px 0 rgba(200, 150, 100, 0.12);
}
html.theme-rpg input::placeholder,
html.theme-rpg textarea::placeholder { color: #b8957a; }
html.theme-rpg input:focus,
html.theme-rpg select:focus,
html.theme-rpg textarea:focus {
    border-color: var(--q-orange-deep);
    box-shadow: 0 0 0 3px rgba(251, 191, 93, 0.45);
}
html.theme-rpg input[readonly] { background: #f1e3cf !important; color: #9a7a60; }
html.theme-rpg .input-group label { font-weight: 700; color: var(--q-ink); }

/* ---------- 6. 底部導覽列：草地＋道具欄方塊，所在分頁會亮起 ---------- */
html.theme-rpg body { padding-bottom: 104px; }
html.theme-rpg #tab-bar {
    height: 78px;
    padding: 0 6px env(safe-area-inset-bottom);
    box-sizing: content-box;
    gap: 6px;
    background: linear-gradient(180deg, #e9e3b2 0, #f6ecd6 22px, #f6ecd6 100%);
    backdrop-filter: none;
    border-top: none;
    box-shadow: none;
    z-index: 1000;
}
/* ChatGPT 畫的草地矮樹叢，蓋在導覽列上方 */
html.theme-rpg #tab-bar::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% - 18px);
    height: 46px;
    background: url('theme/scene-bottom.png') center top / 100% auto repeat-x;
    pointer-events: none;
    z-index: -1;
}
html.theme-rpg .tab-button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    flex: 1 1 0;
    min-width: 0;
    height: 64px;
    padding: 0 0 6px;
    font-family: var(--q-font);
    font-size: 0.68rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0;
    white-space: nowrap;
    color: var(--q-ink);
    background: linear-gradient(180deg, #fdf3e2, #f4e1c4);
    border: 2px solid #c79d6e;
    border-radius: 14px;
    box-shadow: inset 0 0 0 2px #fff8ea, 0 3px 0 #d8b98f;
    transform: none;
    transition: transform 0.15s, box-shadow 0.15s;
}
html.theme-rpg .tab-button br { display: none; }
html.theme-rpg .tab-button::before {
    content: '';
    display: block;
    width: 34px;
    height: 34px;
    margin-bottom: 1px;
    background: center / contain no-repeat;
    filter: saturate(0.85);
}
html.theme-rpg .tab-button[data-target="page-home"]::before { background-image: url('theme/nav-news.png'); }
html.theme-rpg .tab-button[data-target="page-games"]::before { background-image: url('theme/nav-games.png'); }
html.theme-rpg .tab-button[data-target="page-profile"]::before { background-image: url('theme/nav-profile.png'); }
html.theme-rpg .tab-button[data-target="page-booking"]::before { background-image: url('theme/nav-booking.png'); }
html.theme-rpg .tab-button[data-target="page-tools"]::before { background-image: url('theme/nav-tools.png'); }
html.theme-rpg .tab-button[data-target="page-info"]::before { background-image: url('theme/nav-info.png'); }

/* 目前所在的分頁：亮黃色、浮起來、上方有閃光 */
html.theme-rpg .tab-button.active {
    font-weight: 900;
    transform: translateY(-8px);
    background:
        radial-gradient(ellipse at 50% 35%, #fffbe8 0, rgba(255, 251, 232, 0) 70%),
        linear-gradient(180deg, #fff1bf, #ffd77a);
    border: 3px solid #f0a73a;
    box-shadow: inset 0 0 0 2px #fffbe8, 0 4px 0 #d98a2b, 0 0 0 4px rgba(255, 214, 120, 0.45), 0 0 16px rgba(255, 196, 80, 0.75);
    animation: q-nav-glow 2s ease-in-out infinite;
}
html.theme-rpg .tab-button.active::before {
    width: 38px;
    height: 38px;
    filter: none;
}
/* 上方三道閃光 */
html.theme-rpg .tab-button.active::after {
    content: '';
    position: absolute;
    top: -16px;
    left: 50%;
    width: 34px;
    height: 14px;
    transform: translateX(-50%);
    background:
        linear-gradient(#f5b532, #f5b532) 50% 0 / 3px 11px no-repeat,
        linear-gradient(#f5b532, #f5b532) 6px 6px / 3px 9px no-repeat,
        linear-gradient(#f5b532, #f5b532) calc(100% - 6px) 6px / 3px 9px no-repeat;
}
@keyframes q-nav-glow {
    0%, 100% { box-shadow: inset 0 0 0 2px #fffbe8, 0 4px 0 #d98a2b, 0 0 0 4px rgba(255, 214, 120, 0.45), 0 0 12px rgba(255, 196, 80, 0.6); }
    50% { box-shadow: inset 0 0 0 2px #fffbe8, 0 4px 0 #d98a2b, 0 0 0 5px rgba(255, 214, 120, 0.6), 0 0 22px rgba(255, 196, 80, 0.9); }
}

/* ---------- 7. 冒險者資料 ---------- */
html.theme-rpg #app-content:has(.profile-card) .profile-card {
    margin-top: 6px;
    padding: 16px 14px 14px;
}
/* 頭像：淡金圓框 */
html.theme-rpg .profile-header-section { gap: 12px; align-items: center; }
html.theme-rpg .profile-avatar-container { width: 116px; height: 116px; }
html.theme-rpg .profile-avatar-img {
    border: 4px solid #e6c48c;
    box-shadow: 0 0 0 3px #b98450, 0 0 0 7px #f6e2bf, 0 0 0 9px #e2c294;
    background: #fff3dc;
}
/* 右側資訊：名字（置中＋底線）、職業膠囊、星星等級、EXP 條＋數字 */
html.theme-rpg .profile-basic-info {
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 8px;
    row-gap: 6px;
}
html.theme-rpg .profile-basic-info > div:first-child {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-content: center !important;
    padding-bottom: 6px;
    border-bottom: 2px solid #ecdcc4;
}
html.theme-rpg .profile-name {
    padding-right: 0 !important;
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: var(--q-ink);
}
html.theme-rpg #qr-icon-btn { top: -6px !important; right: -4px !important; }
html.theme-rpg #qr-icon-btn svg { width: 24px; height: 24px; border: 2px solid var(--q-rim-dark); box-shadow: none !important; }
html.theme-rpg .profile-basic-info > .profile-row-item:has(#user-class) { grid-column: 1 / -1; grid-row: 2; margin-top: 2px !important; }
html.theme-rpg .profile-level-container { display: contents; }
html.theme-rpg .profile-level-container .profile-row-item:has(#user-level) { grid-column: 1 / -1; grid-row: 3; }
html.theme-rpg .exp-bar-row { grid-column: 1 / 3; grid-row: 4; margin-top: 0; }
html.theme-rpg .profile-level-container .profile-row-item:has(#user-exp) { grid-column: 3; grid-row: 4; }
html.theme-rpg .profile-quick-link { grid-column: 1 / -1; grid-row: 5; justify-self: start; }

/* 隱藏「職業：」「等級：」「經驗：」字樣 */
html.theme-rpg .profile-basic-info .profile-row-item:has(#user-class) .profile-label,
html.theme-rpg .profile-level-container .profile-label { display: none; }
html.theme-rpg #user-class {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 14px 2px 8px;
    font-weight: 900;
    color: var(--q-ink);
    background: #f6e3c6;
    border-radius: 999px;
}
html.theme-rpg #user-class::before {
    content: '';
    width: 22px;
    height: 22px;
    background: url('theme/ico-attack.png') center / contain no-repeat;
}
html.theme-rpg #user-perk-text { color: var(--q-ink-soft) !important; }
html.theme-rpg #user-level {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--q-ink);
}
html.theme-rpg #user-level::before {
    content: 'Lv.';
    order: -1;
    margin-right: -6px;
}
html.theme-rpg #user-level::after {
    content: '';
    order: -2;
    width: 22px;
    height: 22px;
    background: url('theme/log-exp.png') center / contain no-repeat;
}
html.theme-rpg #user-level { flex-direction: row; }
html.theme-rpg #user-exp { font-weight: 900; color: var(--q-ink); white-space: nowrap; }
/* 經驗值：橘色圓角條＋深咖啡底 */
html.theme-rpg .exp-bar-row .profile-label { font-weight: 900; color: var(--q-ink-soft); margin-right: 2px; }
html.theme-rpg .exp-bar {
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: #a07a62;
    border: 2px solid #8a6044;
    border-radius: 999px;
}
html.theme-rpg .exp-bar-segment { height: 12px; background: transparent; border: none; border-radius: 0; }
html.theme-rpg .exp-bar-segment.filled {
    background: linear-gradient(180deg, #ffe3a0, #f6ac3a);
    box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.5);
}
html.theme-rpg .exp-bar-segment.filled:has(+ .exp-bar-segment:not(.filled)) { border-radius: 0 999px 999px 0; }
html.theme-rpg .profile-divider { border-color: #ecdcc4 !important; }
html.theme-rpg .profile-quick-link { color: var(--q-ink-soft); font-weight: 700; font-size: 0.82rem; }

/* 職業公會排行（設計圖沒有，用同樣的緞帶標題） */
html.theme-rpg .profile-contribution-section { padding-top: 28px; }

/* 收合欄位：出去冒險（設計圖是展開的紫色區塊）、寶箱 */
html.theme-rpg .profile-details-section-v2 { gap: 30px !important; padding-top: 18px; }
html.theme-rpg .profile-slot-field {
    overflow: visible;
    background: var(--q-card-2);
    border: 2px solid var(--q-rim-dark);
    border-radius: 20px;
    box-shadow: inset 0 0 0 4px var(--q-card-2), inset 0 0 0 6px #f3e2c8, 0 3px 0 var(--q-rim);
}
html.theme-rpg .profile-slot-header { cursor: pointer; }
html.theme-rpg .profile-slot-toggle { display: none; }
html.theme-rpg #field-adventure {
    background:
        url('theme/ico-sparkle.png') 6% 18% / 26px no-repeat,
        url('theme/ico-sparkle.png') 92% 70% / 18px no-repeat,
        linear-gradient(180deg, #e6dcee, var(--q-adventure));
}
/* 出去冒險固定展開，版面：左邊怪物、右邊名稱／血量／攻擊 */
html.theme-rpg #field-adventure .profile-slot-body {
    display: grid;
    grid-template-columns: 44% 1fr;
    grid-template-areas:
        "img name"
        "img hp"
        "img foot";
    align-items: center;
    column-gap: 10px;
    row-gap: 10px;
    padding: 0 14px 16px;
    position: relative;
}
html.theme-rpg #field-adventure .monster-image { grid-area: img; }
html.theme-rpg #field-adventure .monster-name { grid-area: name; }
html.theme-rpg #field-adventure .monster-hp-bar-track { grid-area: hp; }
html.theme-rpg #field-adventure .monster-battle-footer { grid-area: foot; }
html.theme-rpg .monster-name {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 5px 10px;
    font-weight: 900;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    color: var(--q-ink);
    background: #fbf1e2;
    border: 2px solid #e8cfaf;
    border-radius: 12px;
}
html.theme-rpg .monster-image {
    width: 100%;
    max-width: none;
    margin: 0;
    border: none;
    border-radius: 14px;
    background: transparent;
    object-fit: contain;
}
html.theme-rpg .monster-hp-bar-track {
    height: 24px;
    margin: 0;
    background: var(--q-hp-track);
    border: 2px solid #4e2718;
    border-radius: 999px;
}
html.theme-rpg .monster-hp-bar-fill {
    background: linear-gradient(180deg, #f08a77, var(--q-hp));
    border-radius: 999px;
    box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35);
}
html.theme-rpg .monster-hp-text {
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 0 #4e2718, 1px 0 0 #4e2718, -1px 0 0 #4e2718, 0 -1px 0 #4e2718;
}
html.theme-rpg .monster-battle-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 6px;
    margin: 0;
}
html.theme-rpg .monster-attacks-left { text-align: center; font-size: 0.8rem; color: var(--q-ink-soft); font-weight: 700; }
html.theme-rpg .monster-attack-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 1.35rem;
    letter-spacing: 0.12em;
}
html.theme-rpg .monster-attack-btn::before {
    content: '';
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    background: url('theme/ico-attack.png') center / contain no-repeat;
}
/* 寶箱 demo（設計圖沒有）維持一般收合列 */
html.theme-rpg #field-chest-demo .profile-slot-header {
    width: 100%;
    aspect-ratio: auto;
    margin: 0;
    padding: 12px 16px;
    justify-content: space-between;
    background: none;
}
html.theme-rpg #field-chest-demo .profile-slot-label::before,
html.theme-rpg #field-chest-demo .profile-slot-label::after { content: none; }
html.theme-rpg #field-chest-demo .profile-slot-toggle { display: inline; }
html.theme-rpg #field-chest-demo .profile-slot-body { padding: 0 14px 14px; }
html.theme-rpg #field-chest-demo:not(.open) .profile-slot-body { display: none; }

/* 我的收藏：淡褐面板＋四格粉嫩色塊，圖示用 ChatGPT 道具圖 */
html.theme-rpg .collection-section {
    padding: 0 10px 12px;
    background: var(--q-card-2);
    border: 2px solid var(--q-rim-dark);
    border-radius: 20px;
    box-shadow: inset 0 0 0 4px var(--q-card-2), inset 0 0 0 6px #f3e2c8, 0 3px 0 var(--q-rim);
}
html.theme-rpg .collection-tiles { gap: 8px; }
html.theme-rpg .collection-tile {
    position: relative;
    gap: 6px;
    padding: 10px 4px 6px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    box-shadow: 0 0 0 2px #e2c79f, 0 3px 0 #d8b98f;
    transition: transform 0.1s;
}
html.theme-rpg .collection-tile[data-collection-type="title"] { background: var(--q-tile-green); }
html.theme-rpg .collection-tile[data-collection-type="achievement"] { background: var(--q-tile-purple); }
html.theme-rpg .collection-tile[data-collection-type="skill"] { background: var(--q-tile-peach); }
html.theme-rpg .collection-tile[data-collection-type="equipment"] { background: var(--q-tile-green); }
html.theme-rpg .collection-tile::after {
    content: '';
    position: absolute;
    inset: 4px 4px auto auto;
    width: 14px;
    height: 14px;
    background: url('theme/ico-sparkle.png') center / contain no-repeat;
    opacity: 0.9;
}
html.theme-rpg .collection-tile:active { transform: translateY(2px); }
html.theme-rpg .collection-tile-icon {
    width: 58px;
    height: 58px;
    font-size: 0;
    background: center / contain no-repeat;
}
html.theme-rpg .collection-tile[data-collection-type="title"] .collection-tile-icon { background-image: url('theme/col-title.png'); }
html.theme-rpg .collection-tile[data-collection-type="achievement"] .collection-tile-icon { background-image: url('theme/col-achievement.png'); }
html.theme-rpg .collection-tile[data-collection-type="skill"] .collection-tile-icon { background-image: url('theme/col-skill.png'); }
html.theme-rpg .collection-tile[data-collection-type="equipment"] .collection-tile-icon { background-image: url('theme/col-equipment.png'); }
html.theme-rpg .collection-tile-label {
    align-self: stretch;
    margin: 0 2px;
    padding: 2px 0;
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--q-ink);
    background: rgba(255, 252, 244, 0.7);
    border-radius: 999px;
}

/* 冒險與成長紀錄：每列前面放 ChatGPT 小圖示、右邊深咖啡三角形 */
html.theme-rpg .activity-section {
    padding: 0 10px 12px;
    background: var(--q-card-2);
    border: 2px solid var(--q-rim-dark);
    border-radius: 20px;
    box-shadow: inset 0 0 0 4px var(--q-card-2), inset 0 0 0 6px #f3e2c8, 0 3px 0 var(--q-rim);
}
html.theme-rpg .activity-list {
    padding: 2px 12px;
    background: #fdf8ef;
    border: 2px solid #ecdcc4;
    border-radius: 14px;
}
html.theme-rpg .activity-list-row {
    gap: 10px;
    padding: 10px 2px;
    font-size: 1rem;
    font-weight: 900;
    color: var(--q-ink);
    border-bottom: 2px solid #efe1cd;
}
html.theme-rpg .activity-list-row > span:first-child { display: flex; align-items: center; gap: 12px; }
html.theme-rpg .activity-list-row > span:first-child::before {
    content: '';
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    background: center / contain no-repeat;
}
html.theme-rpg .activity-list-row[data-navigate="page-my-exp-history"] > span:first-child::before { background-image: url('theme/log-exp.png'); }
html.theme-rpg .activity-list-row[data-navigate="page-game-history"] > span:first-child::before { background-image: url('theme/log-games.png'); }
html.theme-rpg .activity-list-row[data-navigate="page-rental-history"] > span:first-child::before { background-image: url('theme/log-rental.png'); }
html.theme-rpg .activity-list-row[data-navigate="page-my-gatherings"] > span:first-child::before { background-image: url('theme/log-gather.png'); }
html.theme-rpg .activity-list-arrow {
    width: 0;
    height: 0;
    font-size: 0;
    border-style: solid;
    border-width: 7px 0 7px 10px;
    border-color: transparent transparent transparent #6b4129;
}

/* 收藏彈窗、道具介紹 */
html.theme-rpg #collection-modal-header h3 { color: var(--q-ink); }
html.theme-rpg .profile-slot-item {
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 14px;
    box-shadow: 0 0 0 2px #e2c79f, 0 3px 0 #d8b98f;
}
html.theme-rpg .profile-slot-item:nth-child(4n+1) { background: var(--q-tile-green); }
html.theme-rpg .profile-slot-item:nth-child(4n+2) { background: var(--q-tile-purple); }
html.theme-rpg .profile-slot-item:nth-child(4n+3) { background: var(--q-tile-peach); }
html.theme-rpg .profile-slot-item:nth-child(4n) { background: var(--q-tile-blue); }
html.theme-rpg .profile-slot-item-name { font-weight: 700; color: var(--q-ink); }
html.theme-rpg .popover-close-btn {
    font-weight: 700;
    color: var(--q-ink);
    background: linear-gradient(180deg, #ffe39e, var(--q-orange));
    border: 2px solid #c07a35;
    border-radius: 999px;
}
html.theme-rpg #gg-modal-overlay,
html.theme-rpg #collection-modal-overlay,
html.theme-rpg .chest-modal-overlay { background: rgba(90, 58, 36, 0.45); }

/* ---------- 8. 最新情報 ---------- */
html.theme-rpg .news-card { overflow: hidden; }
html.theme-rpg .news-card-header {
    align-items: center;
    padding: 10px 16px;
    background: transparent;
    border-bottom: 2px solid #efe1cd;
}
html.theme-rpg .news-card-category {
    padding: 2px 12px;
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--q-ink);
    background: var(--q-tile-peach);
    border-radius: 999px;
}
html.theme-rpg .news-card[data-news-id]:nth-child(3n+2) .news-card-category { background: var(--q-tile-purple); }
html.theme-rpg .news-card[data-news-id]:nth-child(3n) .news-card-category { background: var(--q-tile-green); }
html.theme-rpg .news-card-pinned { padding: 2px 9px; color: #fff; background: var(--q-hp); border-radius: 999px; }
html.theme-rpg .news-card-date { color: var(--q-ink-soft); font-size: 0.8rem; }
html.theme-rpg .news-card-title { font-weight: 900; color: var(--q-ink); }
html.theme-rpg .news-card-image-container { border-radius: 14px; }

/* ---------- 9. 桌遊圖鑑 ---------- */
html.theme-rpg .game-card { padding: 9px 9px 10px; gap: 8px; transition: transform 0.12s; }
html.theme-rpg .game-card:active { transform: translateY(2px) scale(0.98); }
html.theme-rpg .game-image { border: 2px solid #ecdcc4; border-radius: 14px; }
html.theme-rpg .game-info { min-height: 0; }
html.theme-rpg .game-title { text-align: center; font-weight: 900; font-size: 1rem; color: var(--q-ink); }
html.theme-rpg .game-details { font-size: 0.75rem; color: var(--q-ink-soft); }
html.theme-rpg .game-tags { border-top: 2px solid #efe1cd; }
html.theme-rpg .game-tag { font-weight: 700; color: var(--q-ink); background: #f6e3c6; border-radius: 999px; }
html.theme-rpg .game-tag.sale-tag { background: #f6df95; }
html.theme-rpg .game-tag.rent-tag { background: var(--q-tile-green); }
html.theme-rpg .details-image-main { border: 2px solid #ecdcc4; border-radius: 18px; }

/* ---------- 10. 揪團 ---------- */
html.theme-rpg .gg-card { padding: 12px 14px 10px; }
html.theme-rpg .gg-card-name { font-weight: 900; color: var(--q-ink); }
html.theme-rpg .gg-status-badge { font-weight: 900; border-radius: 999px; }
html.theme-rpg .gg-card-deadline { border-top: 2px solid #efe1cd; color: var(--q-ink-soft); }
html.theme-rpg .gather-section-title { color: var(--q-ink); }

/* ---------- 11. 桌遊工具 ---------- */
html.theme-rpg .tool-card { transition: transform 0.1s; }
html.theme-rpg .tool-card:active { transform: translateY(2px); }
html.theme-rpg .tool-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    font-size: 1.8rem;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    box-shadow: 0 0 0 2px #e2c79f;
}
html.theme-rpg .tools-list .tool-card:nth-child(4n+1) .tool-card-icon { background: var(--q-tile-peach); }
html.theme-rpg .tools-list .tool-card:nth-child(4n+2) .tool-card-icon { background: var(--q-tile-purple); }
html.theme-rpg .tools-list .tool-card:nth-child(4n+3) .tool-card-icon { background: var(--q-tile-green); }
html.theme-rpg .tools-list .tool-card:nth-child(4n) .tool-card-icon { background: var(--q-tile-blue); }
html.theme-rpg .tool-card-info h3 { font-weight: 900; color: var(--q-ink); }
html.theme-rpg .tool-card-arrow {
    width: 0;
    height: 0;
    font-size: 0;
    border-style: solid;
    border-width: 7px 0 7px 10px;
    border-color: transparent transparent transparent #6b4129;
}
html.theme-rpg .tools-ext-label { font-weight: 900; color: var(--q-ink-soft); }
html.theme-rpg .tools-ext-card {
    background: var(--q-card);
    border: 2px solid var(--q-rim-dark);
    border-radius: 16px;
    box-shadow: 0 3px 0 var(--q-rim);
}
html.theme-rpg .tools-ext-name { font-weight: 700; color: var(--q-ink); }
html.theme-rpg .tools-ext-url { color: var(--q-ink-soft); }
html.theme-rpg .tools-ext-arrow { color: var(--q-ink-soft); }
html.theme-rpg .tool-overlay { background: var(--q-bg); }
html.theme-rpg .tool-overlay-title { font-weight: 900; color: var(--q-ink); }
html.theme-rpg .tool-overlay-close {
    font-weight: 700;
    color: var(--q-ink);
    background: var(--q-card);
    border: 2px solid var(--q-rim-dark);
    border-radius: 999px;
    box-shadow: 0 3px 0 var(--q-rim);
}

/* ---------- 12. 店家資訊 ---------- */
html.theme-rpg .info-section { padding: 0 16px 12px; margin: 34px 0 16px; }
html.theme-rpg .info-section h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(66%, 250px);
    aspect-ratio: 480 / 99;
    min-height: min-content; /* 標題字太長時讓緞帶跟著長高，避免文字被擠出緞帶外面 */
    margin: -22px auto 10px;
    padding: 0 10px 3px;
    font-size: 0.98rem;
    letter-spacing: 0.1em;
    color: var(--q-ink);
    background: url('theme/ribbon.png') center / 100% 100% no-repeat;
    border: none;
}
html.theme-rpg .info-section p,
html.theme-rpg .info-section pre { color: var(--q-ink); }

/* ---------- 13. 其他 ---------- */
html.theme-rpg .booking-step h2 { text-align: center; }
html.theme-rpg #fab-quiz-btn { bottom: 112px; }

/* 寶箱 demo 列：前面放後台圖庫的寶箱圖 */
html.theme-rpg #field-chest-demo .profile-slot-label { display: flex; align-items: center; gap: 10px; }
html.theme-rpg #field-chest-demo .profile-slot-label::before {
    content: '';
    width: 30px;
    height: 30px;
    margin: 0;
    background: url('theme/ico-chest.png') center / contain no-repeat;
}

/* =================================================================
   15. 精簡版面：減少空白，手機上盡量一頁看完（放在最後，覆蓋上面的間距）
   ================================================================= */
html.theme-rpg #app-content { padding: 6px 10px; }
html.theme-rpg body { background-size: 100% auto, 20px 20px; }

/* 標題木牌縮小、上下距離收緊 */
html.theme-rpg .page-main-title,
html.theme-rpg .page-main-title[style] {
    width: min(66%, 270px);
    margin: 0 auto 6px !important;
    font-size: clamp(1.05rem, 5vw, 1.35rem);
}
html.theme-rpg #news-filter-container { margin-bottom: 10px; gap: 6px; }
html.theme-rpg .news-filter-btn { padding: 5px 14px; }

/* 緞帶小標題縮小 */
html.theme-rpg .collection-section-header,
html.theme-rpg .profile-contribution-title,
html.theme-rpg .profile-slot-header,
html.theme-rpg .info-section h2 {
    width: min(52%, 200px);
    margin-top: -18px;
    margin-bottom: 4px;
}
html.theme-rpg .collection-section-title,
html.theme-rpg .profile-contribution-title,
html.theme-rpg .profile-slot-label,
html.theme-rpg .info-section h2 { font-size: 0.85rem; }

/* 冒險者資料卡 */
html.theme-rpg #app-content:has(.profile-card) .profile-card,
html.theme-rpg .profile-card { margin: 2px 0 0; padding: 10px 10px 10px; }
html.theme-rpg .profile-header-section { gap: 10px; margin-bottom: 6px; }
html.theme-rpg .profile-avatar-container { width: 84px; height: 84px; }
html.theme-rpg .profile-basic-info { row-gap: 3px; }
html.theme-rpg .profile-basic-info > div:first-child { padding-bottom: 3px; }
html.theme-rpg .profile-name { font-size: 1.15rem; }
html.theme-rpg #user-class { padding: 0 10px 0 6px; font-size: 0.85rem; }
html.theme-rpg #user-class::before, html.theme-rpg #user-level::after { width: 18px; height: 18px; }
html.theme-rpg #user-level { font-size: 0.95rem; }
html.theme-rpg .exp-bar-segment { height: 9px; }
html.theme-rpg .profile-quick-link { font-size: 0.75rem; }
html.theme-rpg .profile-divider { margin: 6px 0 !important; }

/* 職業公會排行：沙漏縮小 */
html.theme-rpg .profile-contribution-section { padding-top: 20px; }
html.theme-rpg .profile-contribution-list { gap: 4px; }
html.theme-rpg .hourglass-frame { transform: scale(0.8); transform-origin: center top; margin-bottom: -8px; }
html.theme-rpg .hourglass-item-label, html.theme-rpg .hourglass-item-value { font-size: 0.75rem; }

/* 區塊之間的距離 */
html.theme-rpg .profile-details-section-v2 { gap: 22px !important; padding-top: 16px; }

/* 出去冒險：怪物圖縮小、按鈕變矮 */
html.theme-rpg #field-adventure .profile-slot-body {
    grid-template-columns: 36% 1fr;
    row-gap: 6px;
    column-gap: 10px;
    padding: 0 10px 10px;
}
html.theme-rpg #field-adventure .monster-image { max-height: 120px; }
html.theme-rpg .monster-name { padding: 3px 8px; font-size: 0.92rem; }
html.theme-rpg .monster-hp-bar-track { height: 20px; }
html.theme-rpg .monster-attack-btn { padding: 6px 10px; font-size: 1.1rem; border-radius: 14px; }
html.theme-rpg .monster-attack-btn::before { width: 26px; height: 26px; }
html.theme-rpg .monster-attacks-left { font-size: 0.72rem; }

/* 我的收藏：格子變矮 */
html.theme-rpg .collection-section { padding: 0 8px 8px; }
html.theme-rpg .collection-tiles { gap: 6px; }
html.theme-rpg .collection-tile { gap: 2px; padding: 6px 2px 4px; border-radius: 14px; }
html.theme-rpg .collection-tile-icon { width: 44px; height: 44px; }
html.theme-rpg .collection-tile-label { font-size: 0.78rem; padding: 1px 0; }

/* 寶箱列 */
html.theme-rpg #field-chest-demo .profile-slot-header { padding: 7px 14px; }
html.theme-rpg #field-chest-demo .profile-slot-label::before { width: 24px; height: 24px; }

/* 冒險與成長紀錄：改成 2×2 方塊，不用一列一列往下滑 */
html.theme-rpg .activity-section { padding: 0 8px 8px; }
html.theme-rpg .activity-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 0;
    background: none;
    border: none;
}
html.theme-rpg .activity-list-row {
    padding: 8px 10px;
    font-size: 0.85rem;
    background: #fdf8ef;
    border: 2px solid #ecdcc4;
    border-radius: 12px;
}
html.theme-rpg .activity-list-row:last-child { border-bottom: 2px solid #ecdcc4; }
html.theme-rpg .activity-list-row > span:first-child { gap: 6px; }
html.theme-rpg .activity-list-row > span:first-child::before { width: 24px; height: 24px; }
html.theme-rpg .activity-list-arrow { border-width: 5px 0 5px 7px; }

/* 底部導覽列：變矮一點 */
html.theme-rpg body { padding-bottom: 88px; }
html.theme-rpg #tab-bar { height: 66px; gap: 5px; }
html.theme-rpg #tab-bar::before { height: 36px; bottom: calc(100% - 14px); }
html.theme-rpg .tab-button { height: 54px; padding-bottom: 4px; font-size: 0.64rem; border-radius: 12px; }
html.theme-rpg .tab-button::before { width: 28px; height: 28px; }
html.theme-rpg .tab-button.active { transform: translateY(-6px); }
html.theme-rpg .tab-button.active::before { width: 31px; height: 31px; }
html.theme-rpg #fab-quiz-btn { bottom: 96px; }

/* 其他頁的卡片也收緊 */
html.theme-rpg #news-list-container { gap: 12px; }
html.theme-rpg .news-card-header { padding: 7px 14px; }
html.theme-rpg .news-card-content { padding: 10px 14px; }
html.theme-rpg .news-card-title { margin-bottom: 6px; font-size: 1.05rem; }
html.theme-rpg .news-card-image-container { margin-bottom: 8px; }
html.theme-rpg .news-card-snippet { margin: 0; line-height: 1.6; }
html.theme-rpg #game-list-container { gap: 10px; }
html.theme-rpg .game-card { padding: 7px; gap: 5px; }
html.theme-rpg .game-title { margin-bottom: 4px; }
html.theme-rpg .game-description { margin-bottom: 4px; line-height: 1.5; }
html.theme-rpg .tools-list { gap: 8px; }
html.theme-rpg .tool-card { padding: 10px 12px; }
html.theme-rpg .tool-card-icon { width: 44px; height: 44px; font-size: 1.5rem; }
html.theme-rpg .tool-card-info h3 { margin: 0 0 2px; font-size: 1rem; }
html.theme-rpg .tool-card-info p { margin: 0; line-height: 1.5; }
html.theme-rpg .info-section { margin: 26px 0 10px; padding: 0 14px 8px; }
html.theme-rpg .info-section p { margin: 6px 0; line-height: 1.6; }
html.theme-rpg .booking-tab-bar { margin-bottom: 10px; }
html.theme-rpg .gg-card { padding: 9px 12px 8px; }
html.theme-rpg .page-main-title,
html.theme-rpg .page-main-title[style] { padding: 2.5% 0 0 !important; }
