* { box-sizing: border-box; }
html, body, body * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}
input, textarea, select {
    -webkit-user-select: text;
    user-select: text;
}
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #1e1e2f 0%, #2a2a40 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: manipulation;
}

.pet-device {
    background: #ffb6c1;
    border: 6px solid #ff69b4;
    border-radius: 28px;
    padding: 12px;
    width: calc(100vw - 24px);
    height: calc(100dvh - 24px);
    max-width: 440px;
    max-height: 850px;
    isolation: isolate;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0,0,0,0.6);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding: 0 4px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-badge {
    background-color: #ff1493;
    color: white;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-badge:active { transform: scale(0.92); }

.weather-badge {
    background-color: rgba(255, 255, 255, 0.6); /* 改為半透明淺色背景 */
    color: #333; /* 文字改為深色 */
    font-weight: bold;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); /* 加上輕微陰影增加立體感 */
}

.weather-badge:active { transform: scale(0.95); }

.coin-badge {
    background-color: #ffd700;
    color: #333;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
.coin-badge:active { transform: scale(0.95); }

.event-banner {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
    padding: 5px 8px;
    margin-bottom: 6px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.pet-info-bar-bottom {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
    z-index: 5;
    display: flex;
    justify-content: center;
    gap: 6px;
    align-items: center;
    cursor: pointer;
    background: rgba(255,255,255,0.6);
    padding: 3px 8px;
    border-radius: 12px;
}

.screen {
    background: #f0fff0;
    border: 4px solid #333;
    border-radius: 20px;
    padding: 8px 10px;
    margin-bottom: 6px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
    overflow-y: auto;
    position: relative;
    min-height: 0;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

/* 確保回家分頁固定大小，絕對不出現捲軸 */
.screen.tab-home {
    overflow: hidden !important;
}

.theme-default { background: linear-gradient(to bottom, #FFE4CA, #FFFFCE); }
.theme-beach { background: linear-gradient(to bottom, #a1c4fd, #c2e9fb); }
.theme-park { background: linear-gradient(to bottom, #BBFFBB, #CEFFCE); }
.theme-sakura { background: linear-gradient(to bottom, #FFBFFF, #FFD9EC, #FFD9EC); }
.theme-work { background: linear-gradient(to bottom, #ece9e6, #868f96); }

.screen.tab-home.theme-default {
    background-image: url('theme/default_day.png'); /* 替換成你的圖片檔名 */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.screen.tab-home.theme-default.dark {
    background-image: url('theme/default_night.png'); /* 換成你的夜晚背景圖檔名 */
    background-blend-mode: normal;
}

.screen.tab-home.theme-beach {
    background-image: url('theme/beach_day.png'); /* 替換成你的圖片檔名 */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.screen.tab-home.theme-beach.dark {
    background-image: url('theme/beach_night.png'); /* 換成你的夜晚背景圖檔名 */
    background-blend-mode: normal;
}

.screen.tab-home.theme-park {
    background-image: url('theme/park_day.png'); /* 替換成你的圖片檔名 */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.screen.tab-home.theme-park.dark {
    background-image: url('theme/park_night.png'); /* 換成你的夜晚背景圖檔名 */
    background-blend-mode: normal;
}

.screen.tab-home.theme-sakura {
    background-image: url('theme/sakura_day.png'); /* 替換成你的圖片檔名 */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.screen.tab-home.theme-sakura.dark {
    background-image: url('theme/sakura_night.png'); /* 換成你的夜晚背景圖檔名 */
    background-blend-mode: normal;
}

.screen.dark {
    background-color: #1a2530 !important; /* 保留深色底色 */
    background-blend-mode: multiply;      /* 👉 加上這行：讓底色與背景圖片混合，產生變暗的濾鏡效果 */
    color: white;
}

.lamp-hitbox {
    position: absolute;
    /* 👇 這兩個數值請依照你的背景圖吊燈位置進行微調 */
    top: 2%;      /* 距離頂部 5% */
    left: 50%;    /* 放在正中間 */
    transform: translateX(-50%); /* 確保正中央對齊 */

    /* 👇 點擊範圍的大小，請依照吊燈大小微調 */
    width: 75px;
    height: 75px;

    cursor: pointer; /* 滑鼠移過去會變成點擊的手勢 */
    z-index: 20;     /* 確保它在最上層，不會被寵物擋住 */

    /* 🛠️ 測試用：幫它加上紅色框線，對準吊燈後請把這行刪掉或註解掉！ */
    /* border: 2px solid red; */
}

.top-left-buffs {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    z-index: 10;
}

.buff-tag {
    background: rgba(255,255,255,0.88);
    padding: 2px 6px;
    border-radius: 8px;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.1s ease;
    user-select: none;
}

/* 新增點擊時的縮放效果 */
.buff-tag:active {
    transform: scale(0.92);
}

.top-right-status {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 20px;
    display: flex;
    gap: 4px;
    z-index: 10;
    cursor: pointer;
}

.poop-item {
    position: absolute;
    font-size: 24px;
    z-index: 10;
}

.pet-avatar-container {
    /* 刪除原本的 flex: 1; 和 position: relative; */
    position: absolute; /* 讓容器脫離流動排版，改為絕對定位 */
    top: 55%; /* 🌟 這裡控制寵物的絕對高度 (50%是螢幕正中央，數字越大越靠近底部) */
    left: 50%;
    transform: translate(-50%, -50%); /* 讓容器中心點精準對齊 */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5; /* 確保寵物在背景之上，但在 UI 面板之下 */
    pointer-events: none; /* 🛑 關鍵：讓整個全螢幕透明容器「無法被點擊」，避免擋住地上的大便 */
}

/* 🌟 因為上方設定了 pointer-events: none，我們必須特別把寵物和按鈕的點擊能力加回來 */
.pet-wrapper,
#adopt-center-box,
#cancel-work-btn,
#dead-pet-actions,
#dead-pet-actions button {
    pointer-events: auto;
}
#pet-info-bar { min-width:0; max-width:65%; }
#pet-name-display { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#pet-switch-button { display:inline-block; visibility:visible; }

/* 🌟 新增的包裝器，確保手和寵物永遠一起移動 */
.pet-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pet-avatar {
    font-size: 80px;
    display: inline-block;
    transition: transform 0.2s;
    z-index: 3;
    cursor: pointer;
}

@keyframes pet-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.animate-bounce { animation: pet-bounce 1.5s infinite ease-in-out; }

@keyframes pet-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}
.animate-shake { animation: pet-shake 0.8s infinite linear; }

/* 寵物照顧動作由多張透明 Sprite 逐格切換，CSS 僅維持畫框尺寸。 */
.pet-wrapper {
    width: clamp(150px, 42vw, 185px);
    height: clamp(145px, 40vw, 175px);
}

.pet-avatar {
    width: clamp(118px, 34vw, 150px);
    height: clamp(118px, 34vw, 150px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pet-avatar > .pet-img-element {
    filter: drop-shadow(0 5px 3px rgba(42, 35, 25, .22));
}

/* 固定角色的顯示盒，動作只做位移，不再用縮放造成忽大忽小。 */
.pet-avatar.pet-state-eat {
    animation: pet-gentle-nod .7s ease-in-out infinite;
}

.pet-avatar.pet-state-drink {
    animation: pet-gentle-tilt .85s ease-in-out infinite;
}

.pet-avatar.pet-state-happy {
    animation: pet-happy-hop .9s ease-in-out infinite;
}

.pet-avatar.pet-state-petting {
    animation: petting-cuddle .56s ease-in-out infinite;
}

.pet-avatar.pet-state-sad {
    animation: pet-sad-sway 1.6s ease-in-out infinite;
}

.pet-avatar.pet-state-sick {
    animation: pet-sick-shiver .72s ease-in-out infinite;
}

/* 睡覺時寵物本體完全不動，只有旁邊的 Z 會飄動。 */
.pet-avatar.pet-state-sleep {
    animation: none;
    transform: none;
}

@keyframes pet-gentle-nod {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

@keyframes pet-gentle-tilt {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(3px); }
}

@keyframes pet-happy-hop {
    0%, 100% { transform: translateY(0); }
    45% { transform: translateY(-7px); }
    70% { transform: translateY(-2px); }
}

@keyframes petting-cuddle {
    0%, 100% { transform: translate(0, 0); }
    35% { transform: translate(-4px, 2px); }
    70% { transform: translate(4px, 2px); }
}

@keyframes pet-sad-sway {
    0%, 100% { transform: translateX(0); }
    35% { transform: translateX(-2px); }
    70% { transform: translateX(2px); }
}

@keyframes pet-sick-shiver {
    0%, 100% { transform: translateX(0); }
    30% { transform: translateX(-2px); }
    65% { transform: translateX(2px); }
}

.pet-thought-bubble {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%);
    width: max-content;
    max-width: min(230px, 76vw);
    min-width: 86px;
    padding: 8px 12px;
    border: 2px solid rgba(255, 143, 177, .72);
    border-radius: 16px;
    background: rgba(255, 255, 255, .94);
    color: #70445a;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 5px 14px rgba(91, 57, 71, .16);
    z-index: 8;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
}

.pet-thought-bubble.visible {
    opacity: 1;
}

.pet-thought-bubble::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, .94);
    border-right: 2px solid rgba(255, 143, 177, .72);
    border-bottom: 2px solid rgba(255, 143, 177, .72);
    transform: translate(-50%, -7px) rotate(45deg);
}

.pet-symbol-effects {
    position: absolute;
    inset: -12px -20px 0;
    z-index: 6;
    pointer-events: none;
    overflow: visible;
}

.pet-symbol {
    position: absolute;
    opacity: 0;
    font-weight: 900;
    user-select: none;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .18));
}

.pet-symbol-effects.effect-happy .symbol-one {
    left: 24%; bottom: 52%; font-size: 22px;
    animation: pet-heart-float 1.35s ease-out infinite;
}
.pet-symbol-effects.effect-happy .symbol-two {
    right: 23%; bottom: 57%; font-size: 18px;
    animation: pet-heart-float 1.35s ease-out .4s infinite;
}
.pet-symbol-effects.effect-happy .symbol-three {
    left: 52%; bottom: 72%; font-size: 16px;
    animation: pet-heart-float 1.35s ease-out .8s infinite;
}

.pet-symbol-effects.effect-petting .symbol-one {
    left: 47%; bottom: 78%; font-size: 30px;
    animation: pet-hand-pat .7s ease-in-out infinite;
}
.pet-symbol-effects.effect-petting .symbol-two {
    left: 21%; bottom: 55%; font-size: 20px;
    animation: pet-heart-float 1.15s ease-out infinite;
}
.pet-symbol-effects.effect-petting .symbol-three {
    right: 20%; bottom: 61%; font-size: 18px;
    animation: pet-heart-float 1.15s ease-out .38s infinite;
}

@keyframes pet-hand-pat {
    0%, 100% { opacity: .9; transform: translate(-50%, -5px); }
    50% { opacity: 1; transform: translate(-50%, 6px); }
}

.pet-symbol-effects.effect-sleep .symbol-one {
    right: 27%; bottom: 62%; color: #fff; font-size: 23px;
    animation: pet-z-float 2s ease-out infinite;
}
.pet-symbol-effects.effect-sleep .symbol-two {
    right: 18%; bottom: 75%; color: #d6eaf8; font-size: 17px;
    animation: pet-z-float 2s ease-out .65s infinite;
}
.pet-symbol-effects.effect-sleep .symbol-three {
    right: 11%; bottom: 84%; color: #aed6f1; font-size: 13px;
    animation: pet-z-float 2s ease-out 1.3s infinite;
}

@keyframes pet-heart-float {
    0% { opacity: 0; transform: translateY(8px) scale(.55) rotate(-8deg); }
    25% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-38px) scale(1.2) rotate(10deg); }
}

@keyframes pet-z-float {
    0% { opacity: 0; transform: translate(0, 6px) scale(.6); }
    25% { opacity: 1; }
    100% { opacity: 0; transform: translate(14px, -28px) scale(1.18); }
}

@media (prefers-reduced-motion: reduce) {
    .pet-symbol { animation: none !important; opacity: .85 !important; }
}


.adopt-center-btn {
    background: linear-gradient(135deg, #ff69b4, #ff1493);
    color: white;
    font-size: 15px;
    font-weight: bold;
    padding: 14px 20px;
    border-radius: 20px;
    border: 3px solid #fff;
    box-shadow: 0 8px 20px rgba(255, 20, 147, 0.4);
    cursor: pointer;
    animation: pet-bounce 1.8s infinite ease-in-out;
}

.stats-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 20;
    position: relative;
}

.progress-row {
    display: flex;
    align-items: center;
    font-size: 10px;
    font-weight: bold;
}

.progress-label { width: 62px; text-align: left; }

.progress-bar-bg {
    flex: 1;
    height: 8px;
    background-color: #ddd;
    border-radius: 5px;
    overflow: hidden;
    margin: 0 4px;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    width: 50%;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.bg-hunger { background-color: #4caf50; }
.bg-thirst { background-color: #2196f3; }
.bg-happiness { background-color: #ff6f91; }
.bg-affinity { background-color: #ab47bc; }
.bg-exp { background-color: #f39c12; }

.progress-val { width: 30px; text-align: right; font-size: 10px; }

.controls-care-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    width: 100%;
    margin-top: 4px;
}

.tab-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-top: 4px;
}

.tab-btn {
    background-color: #34495e;
    color: #ddd;
    border: none;
    padding: 10px 2px;
    font-size: 12px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 3px 0 rgba(0,0,0,0.15);
    -webkit-tap-highlight-color: transparent;
    line-height: 1.2;
}

.tab-btn.active {
    background-color: #ff1493 !important;
    color: white !important;
    transform: translateY(1px);
    box-shadow: none;
}

button {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 7px 1px;
    font-size: 11px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s, background-color 0.2s;
    box-shadow: 0 2px 0 rgba(0,0,0,0.15);
    -webkit-tap-highlight-color: transparent;
    line-height: 1.2;
}

button:active { transform: translateY(2px); box-shadow: none; }
button:disabled {
    background-color: #cccccc !important;
    color: #666666 !important;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-feed { background-color: #e67e22; }
.btn-drink { background-color: #3498db; }
.btn-pet { background-color: #ff6f91; }
.btn-game { background-color: #00bcd4; }
.btn-clean { background-color: #9b59b6; }

.modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.2s ease;
}

/* 非作用中的彈窗與其子元素一律不能攔截觸控，避免手機捲動後發生幽靈點擊。 */
.modal-overlay:not(.active),
.modal-overlay:not(.active) * {
    pointer-events: none !important;
}

button, [role="button"], .item-action, .tab-btn {
    touch-action: manipulation;
}

/* 兵營與所有其他彈窗都限制在粉紅色遊戲主視窗內。 */
#pet-barracks-modal {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 22px;
    z-index: 8000;
    overscroll-behavior: contain;
}

#pet-barracks-modal .modal-content {
    max-height: 90%;
}

.modal-content {
    background: white;
    border-radius: 18px;
    padding: 16px;
    width: 92%;
    max-height: 88%;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    text-align: center;
    position: relative;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.modal-title { font-weight: bold; font-size: 17px; margin-bottom: 12px; color: #333; }

.close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    color: #888;
    border: none;
    font-size: 22px;
    padding: 0;
    cursor: pointer;
    box-shadow: none;
}

.pet-select-btn {
    font-size: 32px;
    background: #f8f9fa;
    border: 3px solid #e0e0e0;
    border-radius: 14px;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.pet-select-btn.selected {
    background: #ffe6f2;
    border-color: #ff1493;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 20, 147, 0.3);
}

.gender-select-btn {
    padding: 8px 18px;
    font-size: 14px;
    background: #f0f0f0;
    color: #666;
    border: 2px solid #ccc;
    border-radius: 20px;
    box-shadow: none;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

#gender-btn-male.selected, #user-gender-male.selected {
    background: #2196f3 !important;
    color: white !important;
    border-color: #1976d2 !important;
    box-shadow: 0 3px 10px rgba(33, 150, 243, 0.4);
}

#gender-btn-female.selected, #user-gender-female.selected {
    background: #e91e63 !important;
    color: white !important;
    border-color: #c2185b !important;
    box-shadow: 0 3px 10px rgba(233, 30, 99, 0.4);
}

/* 單欄直排選單佈局 */
.menu-grid-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 設定為一行 3 個等寬的欄位 */
    gap: 10px; /* 按鈕之間的間距 */
    width: 100%;
}

.menu-grid-list button {
    aspect-ratio: 1 / 1; /* 強制按鈕保持 1:1 正方形 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px;
    font-size: 12px; /* 配合正方形空間稍微調整文字大小 */
    width: 100%;
    border-radius: 16px; /* 讓正方形帶有圓角，像 App 圖示 */
    text-align: center;
    gap: 6px; /* 圖示與文字之間的間距 */

    background-color: transparent !important;
    box-shadow: none !important;

    /* 以下屬性是為了未來替換真實圖片做準備 */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 將按鈕內的 Emoji 放大 */
.menu-grid-list button .icon {
    font-size: 26px;
}

.profile-card {
    background: #fff5f8;
    border: 2px solid #ffb6c1;
    border-radius: 14px;
    padding: 12px;
    font-size: 13px;
    text-align: left;
    line-height: 1.8;
}
.oauth-binding-section { margin:8px 0; padding:8px; border-radius:10px; background:#fff; border:1px solid #f2c6d2; }
.oauth-binding-list { display:grid; gap:6px; margin-top:5px; }
.oauth-binding-row { display:grid; grid-template-columns:28px minmax(0,1fr) auto; align-items:center; gap:7px; padding:6px; border:1px solid #e1e5e8; border-radius:8px; line-height:1.25; }
.oauth-binding-row.linked { border-color:#a9dfbf; background:#f1fbf5; }
.oauth-binding-copy { min-width:0; }
.oauth-binding-copy strong,.oauth-binding-copy small { display:block; overflow-wrap:anywhere; }
.oauth-binding-copy small { margin-top:2px; color:#687078; font-size:9px; }
.oauth-binding-row button { padding:5px 7px; font-size:10px; }
.oauth-binding-row .oauth-unlink-button { background:#c0392b; color:#fff; }

.profile-avatar-box {
    text-align: center;
    font-size: 55px;
    background: #fff;
    border-radius: 50%;
    width: 75px;
    height: 75px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #ff69b4;
}

.item-list { display: flex; flex-direction: column; gap: 6px; width: 100%; }

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-width: 0;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 10px;
    font-size: 12px;
    text-align: left;
    color: #333;
}

.item-row > :not(button) { min-width: 0; }
.item-row button { padding: 5px 10px; font-size: 11px; }
.item-row-responsive { overflow: hidden; }
.item-copy {
    flex: 1 1 0;
    min-width: 0;
    text-align: left;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.item-title { color:#333; font-size:13px; font-weight:700; line-height:1.35; }
.item-desc { color:#7f8c8d; font-size:11px; line-height:1.4; margin-top:2px; }
.item-owned { color:#666; display:block; margin-top:2px; }
.item-action {
    flex:0 0 auto;
    max-width:42%;
    white-space:nowrap;
    padding:6px 9px !important;
}
.item-actions { flex:0 0 auto; display:flex; gap:4px; }
.item-actions button { padding:5px 7px; white-space:nowrap; }
.skill-picker-row { border:1px solid #ddd; }
.skill-slot-cooldown-hint {
    margin:-4px 0 10px;
    padding:8px 10px;
    border:1px solid #f5c26b;
    border-radius:8px;
    background:#fff7e6;
    color:#9a5b00;
    font-size:11px;
    font-weight:700;
    line-height:1.5;
}
.skill-cooldown-note { margin-top:3px; color:#b36b00; font-size:10px; font-weight:700; }
.skill-list-icon {
    width:48px;
    height:48px;
    aspect-ratio:1 / 1;
    flex:0 0 48px;
    object-fit:cover;
    object-position:center;
    display:block;
    border-radius:9px;
    border:1px solid #d6eaf8;
    background:#fffaf0;
    image-rendering:auto;
    box-sizing:border-box;
}
.skill-list-icon-small { width:38px; height:38px; flex-basis:38px; }
.skill-icon-unowned {
    filter: grayscale(1);
    opacity: .48;
}
.skill-book-row {
    display:grid;
    grid-template-columns:38px minmax(0,1fr);
    align-items:start;
    gap:7px 9px;
    overflow:visible;
}
.skill-book-row .item-copy { width:100%; line-height:1.35; }
.skill-book-description { margin:4px 0; color:#566573; font-size:10px; line-height:1.5; white-space:normal; overflow-wrap:anywhere; }
.skill-book-row .item-actions { grid-column:2; width:100%; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
.skill-book-row .item-actions button { width:100%; min-width:0; }
#skill-book-manage-list { max-height:min(45dvh,360px) !important; }
.skill-list-title { color:#2980b9; font-size:14px; }
.skill-equip-button { background:#27ae60; }

.dungeon-entry-button {
    width: 100%;
    padding: 12px 14px 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    text-align: left;
    transition: filter .18s ease, opacity .18s ease, transform .12s ease;
}
.dungeon-entry-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.dungeon-entry-arrow { flex: 0 0 auto; }
.dungeon-entry-button small {
    display: block;
    margin-top: 4px;
    color: rgba(255, 255, 255, .84);
    font-size: 11px;
    font-weight: 600;
}
.dungeon-entry-button.equipment-dungeon {
    background: linear-gradient(135deg, #3498db, #2471a3);
    box-shadow: 0 3px 0 #1b4f72;
}
.dungeon-entry-button.skill-dungeon {
    background: linear-gradient(135deg, #9b59b6, #6c3483);
    box-shadow: 0 3px 0 #512e5f;
}
.dungeon-entry-button.is-unavailable {
    cursor: not-allowed;
    filter: grayscale(.48);
    opacity: .68;
}

.work-card {
    background: #f0f4f8;
    border: 2px solid #3498db;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 8px;
    text-align: left;
    font-size: 12px;
    color: #333;
}

.hide-game-box {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 120px;
    background: #e8f5e9;
    border-radius: 14px;
    margin-top: 10px;
}

.bush { font-size: 30px; cursor: pointer; position: relative; user-select: none; }
.input-field {
    width: 85%;
    padding: 8px;
    font-size: 13px;
    border: 2px solid #ffb6c1;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 10px;
}

.copy-btn {
    background: #ff1493;
    color: white;
    border: none;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 10px;
    cursor: pointer;
    margin-left: 6px;
    box-shadow: none;
}
.copy-btn:active { transform: scale(0.92); }

/* 當 body 處於睡覺狀態 (is-sleeping) 時，只把標記了 sleep-text-white 的文字變淺色 */
body.is-sleeping .sleep-text-white {
    color: #f1f2f6 !important; /* 接近白色的淺灰色，閱讀起來比較柔和 */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); /* 加上微弱的黑底陰影，避免被背景完全吃掉 */
}

/* ==========================================
   登入前隱藏遊戲介面的專用樣式
   ========================================== */
.pet-device.login-mode {
    background: transparent;
    border: none;
    box-shadow: none;
}
/* 隱藏除了彈跳視窗 (Modal) 以外的所有遊戲元素 */
.pet-device.login-mode > :not(.modal-overlay) {
    display: none !important;
}
/* 取消登入 Modal 的黑底，讓它與網頁背景自然融合 */
.pet-device.login-mode #user-setup-modal {
    background: transparent;
}

/* 登入畫面 Logo 樣式 */
.login-logo {
    display: block;
    max-width: 200px; /* 控制 Logo 在登入視窗不要太大 */
    height: auto;     /* 保持比例 */
    margin: 0 auto 20px; /* 居中，並與下方內容保持距離 */
}
.oauth-login-divider { width:85%; margin:14px auto 9px; display:flex; align-items:center; gap:8px; color:#8a8a8a; font-size:10px; }
.oauth-login-divider::before,.oauth-login-divider::after { content:""; flex:1; height:1px; background:#ddd; }
.oauth-login-buttons { width:85%; margin:0 auto; display:grid; gap:7px; }
.oauth-provider-button { width:100%; display:flex; align-items:center; justify-content:center; gap:8px; padding:9px; font-size:12px; box-shadow:0 2px 0 rgba(0,0,0,.16); }
.oauth-provider-button.google { color:#3c4043; background:#fff; border:1px solid #dadce0; }
.oauth-provider-button.discord { color:#fff; background:#5865f2; }
.oauth-provider-mark { flex:0 0 22px; width:22px; height:22px; display:inline-grid; place-items:center; border-radius:50%; background:#fff; border:1px solid #d7dce0; color:#34495e; font-size:12px; font-weight:900; line-height:1; }
.oauth-login-note { width:85%; margin:7px auto 0; color:#888; font-size:9px; line-height:1.4; }

/* 主視窗 Logo 樣式 */
.main-screen-logo {
    display: block;
    width: 40%;       /* 佔據螢幕寬度的 90% */
    max-width: 300px; /* 最大寬度限制，避免在 PC 端過大 */
    height: auto;     /* 保持比例 */
    margin: 5px 0; /* 上下留一點邊距，左右居中 */
    z-index: 2;       /* 確保蓋在 poop-container 上面 */

    /* === 關鍵樣式 === */
    /* 如果你的 Logo 是像素風格，加上這行可以防止圖片縮放時變模糊 */
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ==========================================
   寵物 PNG 圖片自適應樣式
   ========================================== */
.pet-img-element {
    width: 100%;
    height: 100%;
    max-width: 140px;
    max-height: 140px;
    object-fit: contain; /* 確保圖片不變形 */
    vertical-align: middle;
}

/* 針對清單與按鈕內的小圖示微調縮放 */
.item-row .pet-img-element,
.pet-select-btn .pet-img-element,
.profile-avatar-box .pet-img-element,
#search-result-box .pet-img-element,
.bush .pet-img-element {      /* 🌟 加入這行，限制捉迷藏草叢內的圖片大小 */
    max-width: 50px;
    max-height: 50px;
}

/* 圖鑑與寵物小屋統一使用固定圖框，避免透明留白不同造成神寵忽大忽小或偏位。 */
.pet-list-avatar {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    line-height: 1;
    font-size: 32px;
}
.pet-list-avatar .pet-img-element {
    display: block;
    width: 44px;
    height: 44px;
    max-width: 44px;
    max-height: 44px;
    object-fit: contain;
    object-position: center center;
}

.god-pet-exchange-row {
    border:2px solid #f39c12;
    background:#fffdf5;
    margin-bottom:8px;
    align-items:center;
}
.god-pet-exchange-identity { display:flex; align-items:center; gap:10px; min-width:0; }
.god-pet-exchange-avatar { width:52px; height:52px; flex:0 0 52px; display:grid; place-items:center; }
.god-pet-exchange-copy { min-width:0; text-align:left; display:flex; flex-direction:column; justify-content:center; }
.god-pet-exchange-copy .god-pet-name { display:block; line-height:1.25; }
.barracks-special-stats { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; text-align:left; }
.barracks-special-stats span { padding:3px 6px; border-radius:999px; background:#f4ecf7; color:#6c3483; font-size:10px; font-weight:700; }
.barracks-special-stats .is-empty { background:#f4f6f7; color:#7f8c8d; font-weight:500; }
.barracks-base-rolls { grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; margin-top:6px; padding:6px; border:1px solid #f3cf72; border-radius:8px; background:#fff9e8; text-align:left; }
.barracks-base-rolls span { color:#76520a; font-size:10px; }
.barracks-base-rolls b { color:#b36b00; }
#pet-passive-info, #pet-passive-info * { color:#5d4037 !important; }
.pet-book-avatar { flex-basis: 50px; width: 50px; height: 50px; }
.pet-book-row {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:10px;
    padding:10px;
    margin-bottom:6px;
    border:2px solid #ff1493;
    background:#fff;
}
.pet-book-row.is-unowned { border-color:#dcdde1; background:#f1f2f6; }
.pet-book-row.is-unowned:not(.is-limited) .pet-book-main { opacity:.55; filter:grayscale(1); }
.pet-book-row.is-unowned.is-limited .pet-book-main { opacity:.82; }
.pet-book-main { min-width:0; display:flex; align-items:center; gap:12px; }
.pet-book-copy { flex:1 1 auto; min-width:0; text-align:left; }
.pet-book-description { margin-top:3px; color:#666; font-size:11px; line-height:1.45; white-space:normal; overflow-wrap:anywhere; word-break:break-word; }
.pet-book-status { align-self:center; color:#27ae60; font-size:12px; font-weight:bold; white-space:nowrap; }
.pet-book-row.is-unowned .pet-book-status { color:#e74c3c; }

/* 確保系統提示與確認視窗永遠在最上層 */
#message-modal, #confirm-modal {
    z-index: 30000 !important;
}

#message-modal, #confirm-modal, #input-modal { z-index: 32000 !important; }
#exp-card-modal { z-index: 31000 !important; }
.exp-card-current { margin-bottom:10px; color:#555; font-size:13px; }
.exp-card-label { display:block; margin-bottom:6px; color:#333; font-weight:700; }
.exp-card-quote { margin:10px 0 14px; padding:10px; border-radius:10px; background:#f4ecf7; color:#512e5f; font-size:13px; line-height:1.6; }
.exp-card-quote.is-insufficient { background:#fdecea; color:#a93226; }
.daily-shop-date { margin:4px 0 10px; color:#117864; font-size:11px; font-weight:700; }
.daily-shop-row { align-items:center; }
.daily-shop-row.is-sold-out { opacity:.62; }
.daily-tier-picker { display:flex; align-items:center; gap:6px; margin:6px 0; color:#555; font-size:11px; }
.daily-tier-picker select { padding:4px 6px; border:1px solid #ccc; border-radius:7px; background:#fff; }
.daily-original-price { display:block; color:#999; font-size:10px; text-decoration:line-through; }
.shop-empty-state { padding:20px 8px; color:#888; font-size:13px; }

#confirm-modal-msg { white-space: pre-line; }

.confirm-checkbox-row {
    align-items: center;
    gap: 8px;
    margin: -6px 0 13px;
    padding: 8px 9px;
    border: 1px solid #ffc6d9;
    border-radius: 9px;
    background: #fff5f8;
    color: #555;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

.confirm-checkbox-row input {
    width: 17px;
    height: 17px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: #ff1493;
}

/* ==========================================
   簽到系統日曆樣式
   ========================================== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px; /* 縮小間距，與星期標題對齊 */
    margin-top: 5px;
}
.calendar-day {
    background: #f1f2f6;
    border: 1px solid #dfe4ea; /* 邊框變細，節省水平空間 */
    border-radius: 6px;
    padding: 2px 0; /* 縮小內距，讓內容有更多彈性空間 */
    font-size: 11px;
    text-align: center;
    position: relative;
    min-height: 45px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s;
    min-width: 0; /* 🌟 關鍵：防止內容過寬撐爆網格，確保與標題完美對齊 */
}
.calendar-day.claimed {
    background: #e8f5e9;
    border-color: #4caf50;
    opacity: 0.7;
}
.calendar-day.today {
    background: #fff3cd;
    border-color: #ffc107;
    box-shadow: 0 0 6px rgba(255, 193, 7, 0.6);
    cursor: pointer;
    animation: pet-bounce 2s infinite ease-in-out;
}
.calendar-day.today:active {
    transform: scale(0.9);
}
.calendar-day.missed {
    background: #f8d7da;
    border-color: #f5c6cb;
    opacity: 0.5;
}
.check-mark {
    position: absolute;
    font-size: 18px; /* 稍微縮小圖示，避免蓋到文字 */
    color: #4caf50;
    font-weight: bold;
    z-index: 2;
    text-shadow: 0 0 4px #fff;
}
.miss-mark {
    position: absolute;
    font-size: 16px; /* 稍微縮小圖示，避免蓋到文字 */
    color: #e74c3c;
    font-weight: bold;
    z-index: 2;
    text-shadow: 0 0 4px #fff;
}

/* ==========================================
   🔴 UI 紅點提示共用樣式 (帶呼吸燈效果)
   ========================================== */
.has-red-dot {
    position: relative !important;
}

.has-red-dot::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background-color: #ff1493; /* 醒目的桃紅色 */
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    animation: pulse-red-dot 1.5s infinite;
    pointer-events: none; /* 避免點擊被紅點阻擋 */
}

@keyframes pulse-red-dot {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* ==========================================
   神寵名稱特效樣式
   ========================================== */
.god-pet-name {
    display: inline-block;
    color: #ffd700 !important; /* 尊貴金 */
    font-weight: 900 !important;
    text-shadow: 0 0 4px #ff8c00, 0 0 8px #ff0080;
    padding: 0 2px;
    letter-spacing: 0.5px;
    animation: god-pet-glow 1.5s infinite alternate;
}

@keyframes god-pet-glow {
    from { text-shadow: 0 0 2px #ff8c00, 0 0 5px #ff0080; transform: scale(1); }
    to { text-shadow: 0 0 6px #ff8c00, 0 0 12px #ff1493; transform: scale(1.02); }
}

/* ==========================================
   PVE 裝備欄位樣式
   ========================================== */
.equip-slot {
    background: #fdfbf7;
    border: 2px dashed #bdc3c7;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    position: relative;
    z-index: 1;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    color: #333;
    font: inherit;
    box-shadow: none;
}
.equip-slot:active { transform: scale(0.95); }
.equip-slot.equipped {
    border: 2px solid #3498db;
    background: #ebf5fb;
}
.equipment-icon-frame {
    width:52px;
    height:52px;
    aspect-ratio:1 / 1;
    flex:0 0 52px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    overflow:hidden;
    border:2px solid rgba(255,255,255,.88);
    border-radius:12px;
    box-shadow:0 2px 5px rgba(44,62,80,.22), inset 0 0 0 1px rgba(52,73,94,.12);
    vertical-align:middle;
}
.equipment-icon-frame img {
    width:90%;
    height:90%;
    object-fit:contain;
    object-position:center;
    display:block;
    image-rendering:auto;
    box-sizing:border-box;
    filter:drop-shadow(0 2px 1px rgba(23,32,42,.25));
}
.equipment-icon-frame.tier-0 { background:#f2f3f4; filter:grayscale(.5); opacity:.65; }
.equipment-icon-frame.tier-1 { background:linear-gradient(145deg,#edf1f2,#aeb9c0); }
.equipment-icon-frame.tier-2 { background:linear-gradient(145deg,#e5f5ff,#76bde8); }
.equipment-icon-frame.tier-3 { background:linear-gradient(145deg,#e7fff1,#59c98a); }
.equipment-icon-frame.tier-4 { background:linear-gradient(145deg,#f2e9ff,#a675dd); }
.equipment-icon-frame.tier-5 { background:linear-gradient(145deg,#fff7cc,#efba3c); }
.equipment-list-row,.equipment-picker-row { border:1px solid #dde3e7; }
.equipment-list-icon { width:54px; height:54px; flex-basis:54px; }
#equip-select-modal { box-sizing:border-box; overflow:hidden; }
#equip-select-modal .modal-content { box-sizing:border-box; width:min(92%, 420px); max-width:420px; }
#equip-list-container { max-height:min(62vh, 520px) !important; min-width:0; padding-right:2px; }
.equipment-picker-row {
    display:grid;
    grid-template-columns:minmax(0, 1fr) 108px;
    flex:0 0 auto;
    align-items:start;
    min-height:86px;
    gap:10px;
    padding:10px;
    overflow:visible;
    box-sizing:border-box;
}
.equipment-picker-main {
    display:grid;
    grid-template-columns:54px minmax(0, 1fr);
    align-items:start;
    gap:10px;
    min-width:0;
}
.equipment-picker-copy { min-width:0; overflow:visible; line-height:1.5; }
.equipment-picker-heading { display:flex; align-items:center; flex-wrap:wrap; gap:4px; min-height:22px; }
.equipment-picker-name { color:#e74c3c; font-size:14px; font-weight:bold; overflow-wrap:anywhere; }
.equipment-picker-tier { flex:0 0 auto; color:#a04000; font-size:12px; font-weight:900; }
.equipment-picker-set-badge { margin-left:0; vertical-align:0; }
.equipment-picker-stats { display:flex; flex-direction:column; align-items:stretch; gap:2px; margin-top:5px; color:#555; font-size:11px; line-height:1.45; overflow-wrap:anywhere; }
.equipment-picker-stat-line { display:block; width:100%; padding-bottom:2px; border-bottom:1px dashed rgba(127,140,141,.22); }
.equipment-picker-stat-line:last-child { padding-bottom:0; border-bottom:0; }
.equipment-picker-affix { color:#8e44ad; font-weight:bold; }
.equipment-picker-note { margin-top:3px; font-size:10px; line-height:1.45; overflow-wrap:anywhere; }
.equipment-picker-note.is-owner { color:#2980b9; }
.equipment-picker-note.is-locked { color:#e74c3c; }
.equipment-picker-action {
    align-self:start;
    width:108px;
    max-width:108px;
    min-height:36px;
    margin:0;
    padding:7px 5px !important;
    white-space:normal;
    line-height:1.25;
    text-align:center;
    box-sizing:border-box;
    position:relative;
    z-index:2;
    pointer-events:auto;
}

/* 手機／觸控裝置採直向文件流，說明多寡都不會與操作按鈕重疊。 */
#equip-list-container.is-compact-equipment-picker .equipment-picker-row {
    display:flex;
    flex-direction:column;
    flex:0 0 auto !important;
    align-items:start;
    min-height:0;
    gap:8px;
    padding:9px;
    overflow:visible;
    isolation:isolate;
}
#equip-list-container.is-compact-equipment-picker .equipment-picker-main {
    grid-template-columns:48px minmax(0, 1fr);
    width:100%;
}
#equip-list-container.is-compact-equipment-picker .equipment-picker-copy {
    width:100%;
    max-width:100%;
    min-width:0;
    overflow:hidden;
}
#equip-list-container.is-compact-equipment-picker .equipment-picker-action {
    display:block !important;
    visibility:visible !important;
    align-self:stretch;
    flex:0 0 auto !important;
    width:100% !important;
    max-width:100% !important;
    min-height:40px;
    margin:2px 0 0;
}

/* 手機保底：即使瀏覽器沒有即時套上 compact class，操作按鈕仍完整顯示。 */
@media (max-width: 600px) {
    #equip-list-container {
        padding-bottom:4px;
        overscroll-behavior:contain;
        -webkit-overflow-scrolling:touch;
    }
    #equip-list-container .equipment-picker-row {
        display:flex !important;
        flex-direction:column !important;
        flex:0 0 auto !important;
        align-items:stretch;
        min-height:0;
        gap:8px;
        overflow:visible;
    }
    #equip-list-container .equipment-picker-main {
        grid-template-columns:48px minmax(0, 1fr);
        width:100%;
    }
    #equip-list-container .equipment-picker-action {
        display:block !important;
        visibility:visible !important;
        position:relative !important;
        align-self:stretch;
        flex:0 0 auto !important;
        width:100% !important;
        max-width:none !important;
        min-height:40px;
        margin:2px 0 0;
        opacity:1;
        pointer-events:auto;
    }
}
.battle-loot-line { display:flex; align-items:center; gap:8px; padding:6px; background:#fff8e1; border-radius:9px; }
.battle-loot-icon { width:44px; height:44px; flex-basis:44px; }
.eq-icon {
    font-size: 24px;
    background: #ecf0f1;
    border-radius: 8px;
    padding: 4px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.eq-details { text-align: left; flex: 1; }
.eq-name { font-weight: bold; font-size: 13px; color: #333; }
.eq-stats { font-size: 11px; color: #7f8c8d; margin-top: 2px; }
.equipment-summary-slot { align-items:flex-start; min-width:0; width:100%; text-align:left; }
.equipment-summary-slot .eq-details { min-width:0; overflow:visible; }
.equipment-summary-slot .equipment-picker-heading { min-height:0; }
.equipment-summary-slot .equipment-picker-name { font-size:12px; }
.equipment-summary-slot .equipment-picker-stats { font-size:10px; }
.equipment-lock-state { flex:0 0 auto; }
.equipment-inventory-row {
    display:grid;
    grid-template-columns:54px minmax(0, 1fr) 92px;
    align-items:start;
    gap:9px;
    overflow:visible;
}
.equipment-inventory-copy { min-width:0; overflow:visible; }
.equipment-inventory-actions { display:flex; flex-direction:column; gap:3px; width:92px; margin:0; }
.equipment-inventory-actions button { width:100%; margin:0; white-space:normal; line-height:1.2; }

/* ==========================================
   PVE 競技場與動畫樣式
   ========================================== */
.pet-device.battle-mode .screen { margin-bottom: 0; }
.battle-arena-overlay {
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    align-items: stretch;
    background: #17212b;
}
.battle-arena-content {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 14px;
    padding: 10px;
    overflow-y: auto;
    background: linear-gradient(180deg, #273746 0%, #17202a 100%);
    display: flex;
    flex-direction: column;
}
.battle-arena-header { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:8px; flex:0 0 auto; }
.battle-arena-header .modal-title { color:#fff; margin:0; text-shadow:1px 1px 2px #000; }
.battle-pause-btn { background:#566573; padding:6px 12px; font-size:12px; }
.battle-pause-btn { justify-self:end; }
.battle-log-toggle-btn { justify-self:start; background:#283747; border:1px solid rgba(255,255,255,.55); padding:6px 10px; font-size:12px; box-shadow:none; }
#arena-view { display:flex; flex-direction:column; min-height:0; flex:1; }
.arena-box {
    background-image: url('/static/battlefields/battle-scene-sheet-cute.png');
    background-repeat: no-repeat;
    background-size: 500% 200%;
    background-position: 0 0;
    border: 3px solid #f5c451;
    border-radius: 16px;
    min-height: 430px;
    height: min(58vh, 520px);
    position: relative;
    margin: 8px 0 0;
    display: block;
    padding: 12px;
    overflow: hidden;
    isolation: isolate;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.38), 0 6px 18px rgba(0,0,0,.35);
}

.arena-box::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(11,25,38,.04) 0%, rgba(11,25,38,.08) 48%, rgba(11,25,38,.24) 100%);
}

.arena-char {
    position: relative;
    font-size: 58px;
    transition: transform 0.2s;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.4));
    z-index: 2;
}
.arena-side {
    position:absolute;
    width:min(47%, 190px);
    min-height:0;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
}
.arena-boss-side { top:28px; right:12px; }
.arena-party-side { bottom:25px; left:12px; }
.arena-avatar { width:116px; height:116px; display:flex; align-items:center; justify-content:center; line-height:1; }
.arena-avatar img { width:100%; height:100%; object-fit:contain; object-position:center; display:block; }
.arena-boss-side .arena-avatar { width:116px; height:194px; overflow:visible; border:0; box-shadow:none; background:transparent; }
.boss-sprite { width:100%; height:100%; background-image:url('/static/bosses/boss-sprite-sheet-cute.png'); background-repeat:no-repeat; background-size:500% 200%; }
.arena-side-label {
    width:100%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:6px;
    color:#fff;
    font-size:12px;
    text-shadow:1px 1px 3px #000;
    filter:none;
    background:rgba(15,25,35,.58);
    border:1px solid rgba(255,255,255,.5);
    border-radius:14px;
    padding:3px 8px;
    backdrop-filter:blur(2px);
}
.arena-side-label strong { max-width:62%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.arena-hp-wrap { width:94%; margin:4px 0; }
.arena-vs-divider { position:absolute; inset:0; z-index:3; pointer-events:none; display:flex; align-items:center; justify-content:center; }
.arena-vs-divider > span { display:none; }
.arena-dmg-anchor { position:absolute; top:60%; left:50%; }

/* 血條樣式 */
.arena-hp-bar-bg { width:100%; height:12px; background:#7b241c; border:2px solid #fff; border-radius:7px; overflow:hidden; box-shadow:0 1px 4px rgba(0,0,0,.6); }
.arena-hp-bar-fill { height: 100%; background: #2ecc71; width: 100%; border-radius: 3px; transition: width 0.3s; }
.battle-resource-row { display:flex; justify-content:space-between; flex-wrap:wrap; font-size:11px; margin-top:6px; font-weight:bold; padding:0 3px; gap:5px; }
.battle-log-container { background:#0e151b; color:#ecf0f1; padding:10px 12px; border-radius:8px; font-family:monospace; font-size:12px; text-align:left; height:min(58vh,430px); overflow-y:auto; line-height:1.55; margin-top:6px; }
.battle-log-effect { color:#ffe66d; font-weight:900; background:rgba(243,156,18,.15); border-left:3px solid #f39c12; padding-left:5px; }
.battle-effect-flash { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%) scale(.7); width:90%; opacity:0; pointer-events:none; color:#fff; font-size:18px; font-weight:900; text-align:center; text-shadow:0 2px 5px #000; z-index:30; }
.battle-effect-flash.active { animation:effectFlash 1.1s ease-out forwards; }
.battle-effect-flash.defense { color:#7fdbff; }
.battle-effect-flash.true-damage { color:#ffd700; }
.battle-effect-flash.break { color:#ff8a65; }
.battle-effect-flash.enemy-attack { color:#ff7675; }
@keyframes effectFlash { 0%{opacity:0;transform:translate(-50%,-50%) scale(.65)} 18%{opacity:1;transform:translate(-50%,-50%) scale(1.08)} 72%{opacity:1} 100%{opacity:0;transform:translate(-50%,-75%) scale(1)} }

/* 傷害跳字特效 */
.dmg-text {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateX(-50%);
    font-size: clamp(15px, 4vw, 20px);
    font-weight: bold;
    color: #ff3f34;
    text-shadow: 2px 2px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff;
    white-space: nowrap;
    pointer-events: none;
    animation: floatUp 0.8s ease-out forwards;
    z-index: 40;
}
.dmg-text.crit { font-size: clamp(18px, 5vw, 23px); color: #ff9f43; animation: floatUpCrit 1s ease-out forwards; }
.dmg-text.dodge { color: #0fb9b1; font-size: 16px; }
.dmg-text.heal { color:#2ecc71; font-size:18px; }
.dmg-text.status { color:#9b59b6; font-size:17px; }

@keyframes floatUp { 0% { transform: translate(-50%, 0) scale(1); opacity: 1; } 100% { transform: translate(-50%, -28px) scale(1.12); opacity: 0; } }
@keyframes floatUpCrit { 0% { transform: translate(-50%, 8px) scale(1.08); opacity: 1; } 100% { transform: translate(-50%, -18px) scale(1.2); opacity: 0; } }

/* 衝刺與受擊動畫 */
.anim-dash-right { animation: dashRight 0.3s ease-in-out; }
.anim-dash-left { animation: dashLeft 0.3s ease-in-out; }
.anim-shake { animation: shakeHurt 0.3s ease-in-out; }
.anim-enemy-strike { animation: enemyStrike 0.48s cubic-bezier(.2,.8,.25,1); z-index:20; }
.anim-enemy-target { animation: enemyTargetHit 0.48s ease-out; }

@keyframes dashRight { 0% { transform: translate(0, 0); } 50% { transform: translate(34px, -34px) scale(1.04); } 100% { transform: translate(0, 0); } }
@keyframes dashLeft { 0% { transform: translate(0, 0); } 50% { transform: translate(-34px, 34px) scale(1.04); } 100% { transform: translate(0, 0); } }
@keyframes shakeHurt { 0%, 100% { transform: translateX(0); filter: brightness(1); } 25% { transform: translateX(-5px); filter: brightness(2) inset(0 0 0 1000px rgba(255,0,0,0.5)); } 75% { transform: translateX(5px); } }
@keyframes enemyStrike {
    0%,100% { transform:translate(0,0) scale(1); filter:none; }
    35% { transform:translate(-42px,34px) scale(1.18); filter:brightness(1.45) drop-shadow(0 0 12px #ff3b30); }
    55% { transform:translate(-34px,26px) scale(1.1); filter:brightness(1.25) drop-shadow(0 0 8px #ff7675); }
}
@keyframes enemyTargetHit {
    0%,100% { filter:none; }
    30%,65% { transform:translateX(-6px); filter:brightness(2) drop-shadow(0 0 13px #ff3b30); }
    48% { transform:translateX(6px); }
}

/* ==========================================
   PVE 異常狀態 Icon 樣式
   ========================================== */
.status-icon-row {
    display: flex;
    justify-content:center;
    gap: 5px;
    min-height:25px;
    white-space: nowrap;
    z-index: 15;
    filter:none;
}

.status-icon {
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    border:2px solid rgba(255,255,255,.8);
    width:26px;
    height:26px;
    padding:0;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.4);
    position: relative;
    cursor: pointer;
    color:#222;
}
.status-icon:active { transform:scale(.9); }

.status-icon .turn-count {
    position: absolute;
    bottom: -3px;
    right: -3px;
    background: #e74c3c;
    color: white;
    font-size: 8px; /* 🌟 縮小剩餘回合數數字 */
    font-weight: bold;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 1px rgba(0,0,0,0.6);
}

.battle-party-selector { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.battle-party-option { display:flex; align-items:center; gap:6px; min-width:0; padding:7px; border:2px solid transparent; border-radius:9px; background:#fff; cursor:pointer; font-size:11px; }
.battle-party-option.selected { border-color:#3498db; background:#eaf4ff; }
.battle-party-option.disabled { opacity:.48; cursor:not-allowed; }
.battle-party-option input { width:auto; margin:0; }
.battle-party-option-avatar { width:36px; height:36px; flex:0 0 36px; display:flex; align-items:center; justify-content:center; overflow:hidden; font-size:24px; }
.battle-party-option-avatar img { width:100%; height:100%; object-fit:contain; }
.battle-party-option-info { min-width:0; overflow:hidden; }
.battle-party-option-info strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.arena-boss-side { width:92%; right:4%; top:18px; align-items:flex-end; }
.arena-party-side { width:92%; left:4%; bottom:18px; align-items:flex-start; }
.arena-unit-grid { display:flex; align-items:flex-end; justify-content:center; gap:5px; width:100%; min-width:0; filter:none; }
.enemy-unit-grid { justify-content:flex-end; }
.ally-unit-grid { justify-content:flex-start; }
.battle-unit { position:relative; flex:1 1 0; width:auto; min-width:0; max-width:92px; padding:0 2px; border:0; border-radius:0; background:transparent; color:#fff; text-align:center; font-size:10px; text-shadow:0 1px 3px #000; cursor:pointer; transition:transform .16s,filter .16s; }
.battle-unit.is-long-pressing,
.battle-skill-button.is-long-pressing { filter:brightness(1.15) drop-shadow(0 0 7px #ffe082); transform:scale(.97); }
.battle-unit.selected-target { transform:translateY(-4px); filter:drop-shadow(0 0 8px #ffd54f) drop-shadow(0 0 3px #fff); }
.battle-unit.current-actor { filter:drop-shadow(0 0 9px #55ef8b) drop-shadow(0 0 3px #fff); }
.battle-unit.defeated { opacity:.45; filter:grayscale(1); }
.battle-unit-name { display:inline-block; max-width:100%; height:15px; line-height:15px; padding:0 4px; border-radius:8px; background:rgba(13,25,36,.58); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:900; }
.battle-unit-avatar { width:64px; max-width:100%; height:64px; margin:0 auto; display:flex; align-items:center; justify-content:center; font-size:38px; }
.battle-unit-avatar img { width:100%; height:100%; object-fit:contain; }
.enemy-unit-grid .battle-unit-avatar { width:74px; height:112px; }
.enemy-unit-grid.is-pvp-pet-team .battle-unit-avatar { width:64px; height:64px; }
.battle-unit .boss-sprite { width:100%; height:100%; }
.battle-damage-layer { position:absolute; left:50%; top:62%; width:0; height:0; overflow:visible; z-index:35; pointer-events:none; }
.battle-global-damage-layer { position:fixed; inset:0; width:100vw; height:100dvh; overflow:visible; z-index:20000; pointer-events:none; }
.battle-unit-hp { height:8px; border:1px solid #fff; border-radius:5px; background:#6f1d18; overflow:hidden; }
.battle-unit-hp > span { display:block; height:100%; background:#2ecc71; transition:width .25s; }
.battle-unit-meta { display:flex; justify-content:space-between; gap:2px; margin-top:2px; font-size:8px; }
.battle-unit .status-icon-row { min-height:18px; gap:2px; flex-wrap:wrap; }
.battle-unit .status-icon { width:18px; height:18px; font-size:11px; border-width:1px; }
.battle-unit .status-icon .turn-count { width:9px; height:9px; font-size:6px; }

.party-member-list { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:6px; margin-bottom:10px; }
.party-member-card { min-width:0; height:105px; background:#fff; border-radius:9px; padding:6px 3px; text-align:center; box-shadow:0 2px 4px rgba(0,0,0,.1); display:flex; flex-direction:column; align-items:center; }
.party-member-avatar { width:52px; height:52px; display:flex; align-items:center; justify-content:center; font-size:30px; overflow:hidden; flex:0 0 52px; }
.party-member-avatar img { width:100%; height:100%; object-fit:contain; object-position:center; display:block; }
.barracks-pet-switcher { display:flex; gap:6px; overflow-x:auto; padding:3px 1px 9px; margin-bottom:7px; scrollbar-width:thin; }
.barracks-pet-choice { flex:0 0 76px; min-height:74px; padding:5px 3px; border:2px solid #d5d8dc; border-radius:10px; background:#fff; color:#34495e; box-shadow:none; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; }
.barracks-pet-choice.active { border-color:#e67e22; background:#fff4e8; box-shadow:0 0 0 2px rgba(230,126,34,.16); }
.barracks-pet-choice img { width:34px; height:34px; object-fit:contain; }
.barracks-pet-choice small { display:block; max-width:68px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:9px; }
.set-summary-row { padding:6px 7px; margin-bottom:5px; border-radius:7px; background:#f5eef8; border-left:4px solid #8e44ad; }
.equipment-set-badge { display:inline-block; padding:1px 5px; margin-left:3px; border-radius:10px; color:#fff; font-size:9px; font-weight:900; vertical-align:1px; }
.party-member-name { width:100%; height:16px; line-height:16px; font-size:10px; font-weight:bold; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.party-member-level { height:14px; line-height:14px; font-size:9px; color:#777; }

.battle-room-panel { background:#f0f4f8; border:2px dashed #aeb6bf; border-radius:12px; padding:12px; margin-bottom:20px; }
.coop-party-slots { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; margin-bottom:9px; }
.coop-party-slot { min-width:0; height:100px; padding:5px 3px; border:2px dashed #aeb6bf; border-radius:11px; background:rgba(255,255,255,.84); color:#34495e; box-shadow:none; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; }
.coop-party-slot:disabled { opacity:1; cursor:default; }
.coop-party-slot.empty span { font-size:25px; color:#3498db; }
.coop-party-slot.locked { opacity:.55; }
.coop-party-slot.occupied { border-style:solid; border-color:#d5d8dc; }
.coop-party-slot.editable { border-color:#3498db; box-shadow:0 0 0 2px rgba(52,152,219,.12); }
.coop-party-slot strong { display:block; width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10px; }
.coop-party-slot small { display:block; width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:8px; }
.coop-slot-avatar { width:52px; height:52px; display:flex; align-items:center; justify-content:center; font-size:30px; }
.coop-slot-avatar img { width:100%; height:100%; object-fit:contain; }
.coop-player-list { display:flex; flex-wrap:wrap; gap:4px; margin:0 0 8px; }
.coop-player-chip { font-size:9px; padding:3px 6px; border-radius:10px; background:#e5e7e9; color:#555; }
.coop-player-chip.ready { background:#d5f5e3; color:#196f3d; }
.room-pet-choice { width:100%; display:flex; align-items:center; gap:10px; padding:8px; margin-bottom:6px; background:#f8f9fa; color:#34495e; border:1px solid #ddd; box-shadow:none; text-align:left; }
.room-pet-avatar { width:46px; height:46px; display:flex; align-items:center; justify-content:center; flex:0 0 46px; }
.room-pet-avatar img { width:100%; height:100%; object-fit:contain; }
.room-pet-choice small { display:block; color:#777; margin-top:3px; }
.set-guide-card { border-left:5px solid #8e44ad; background:#f8f9fa; border-radius:9px; padding:9px; margin-bottom:8px; font-size:11px; line-height:1.55; }
.set-guide-card h4 { margin:0 0 6px; }
.set-guide-card > div + div { margin-top:6px; }
.skill-compendium-modal-content { max-width:390px; height:min(82dvh,720px); overflow:hidden; display:flex; flex-direction:column; }
.skill-compendium-tabs { display:flex; flex:0 0 auto; gap:5px; overflow-x:auto; padding:1px 1px 8px; scrollbar-width:thin; }
.skill-compendium-tabs button { flex:0 0 auto; padding:7px 9px; border:1px solid #bdd9ec; background:#eef7fc; color:#2471a3; box-shadow:none; font-size:11px; }
.skill-compendium-tabs button.active { color:#fff; background:#2471a3; border-color:#1f618d; }
.skill-compendium-list { min-height:0; flex:1 1 auto; overflow-y:auto; display:flex; flex-direction:column; gap:8px; padding:2px; text-align:left; }
.skill-compendium-card { display:flex; align-items:flex-start; gap:9px; padding:10px; border:1px solid #d6e7f3; border-radius:11px; background:linear-gradient(145deg,#fff,#f4f9fc); }
.skill-compendium-icon { flex:0 0 52px; width:52px; height:52px; object-fit:contain; border-radius:9px; background:#fff; border:1px solid #dce8ef; display:flex; align-items:center; justify-content:center; font-size:34px; overflow:hidden; }
.skill-compendium-icon img { width:100%; height:100%; object-fit:contain; }
.skill-compendium-copy { flex:1 1 auto; min-width:0; }
.skill-compendium-copy h4 { margin:0; color:#2c3e50; font-size:14px; overflow-wrap:anywhere; }
.skill-compendium-copy h4 span { display:inline-block; margin-left:3px; padding:2px 5px; border-radius:8px; background:#e8daef; color:#6c3483; font-size:9px; vertical-align:middle; }
.skill-compendium-copy p { margin:6px 0; color:#566573; font-size:11px; line-height:1.55; white-space:pre-wrap; overflow-wrap:anywhere; }
.skill-owner-label { display:inline-block; margin-top:4px; padding:2px 6px; border-radius:8px; color:#a65c00; background:#fff3cd; font-size:9px; }
.skill-compendium-values { display:grid; grid-template-columns:1fr; gap:3px; }
.skill-compendium-values > div { display:flex; justify-content:space-between; gap:8px; padding:4px 6px; border-radius:6px; background:#edf4f8; color:#52616b; font-size:10px; }
.skill-compendium-values b { color:#34495e; }
.skill-compendium-values span { text-align:right; overflow-wrap:anywhere; }
.skill-compendium-empty { padding:22px 8px; color:#888; text-align:center; font-size:12px; }
.title-section-heading { margin:10px 0 6px; color:#6c3483; font-size:13px; font-weight:bold; text-align:left; }
.pvp-title-list { display:flex; flex-direction:column; gap:6px; }
.pvp-title-card { display:flex; align-items:center; gap:8px; padding:8px; border:1px solid #ded4e8; border-radius:10px; background:#faf7fc; text-align:left; }
.pvp-title-card.locked { opacity:.6; filter:grayscale(.4); }
.pvp-title-icon { flex:0 0 30px; font-size:23px; text-align:center; }
.pvp-title-card > div { flex:1 1 auto; min-width:0; display:flex; flex-direction:column; }
.pvp-title-card strong { color:#5b2c6f; font-size:12px; }
.pvp-title-card small { color:#7f8c8d; font-size:9px; margin-top:2px; }
.pvp-title-card button { flex:0 0 auto; padding:5px 8px; font-size:10px; background:#8e44ad; }
.pvp-title-card button:disabled { background:#aeb6bf; box-shadow:none; }
.announcement-modal-content { max-width:390px; height:min(84dvh,760px); overflow:hidden; display:flex; flex-direction:column; }
.announcement-list-container { display:flex; flex:1 1 auto; min-height:0; flex-direction:column; gap:8px; overflow-y:auto; overflow-x:hidden; padding:1px; text-align:left; }
.announcement-card { flex:0 0 auto; padding:0; text-align:left; background:#fdfbf7; border-color:#3498db; overflow:visible; margin-bottom:8px; }
.announcement-heading { padding:12px; cursor:pointer; display:flex; justify-content:space-between; align-items:flex-start; gap:8px; user-select:none; }
.announcement-title { min-width:0; padding-right:4px; color:#ff1493; font-size:14px; font-weight:bold; line-height:1.35; overflow-wrap:anywhere; word-break:break-word; }
.announcement-date { flex:0 0 auto; color:#888; font-size:10px; white-space:nowrap; margin-top:3px; }
.ann-content-body { padding:10px 12px 14px; border-top:1px dashed #3498db; color:#444; font-size:12px; line-height:1.7; white-space:pre-wrap; overflow:visible; overflow-wrap:anywhere; word-break:break-word; }
.gacha-rate-button { position:absolute; top:8px; right:8px; padding:5px 8px; background:#5b2c6f; font-size:10px; box-shadow:none; }
.gacha-rate-table { width:100%; border-collapse:collapse; font-size:12px; }
.gacha-rate-table th,.gacha-rate-table td { padding:9px; border-bottom:1px solid #ddd; text-align:left; }
.gacha-rate-table th:last-child,.gacha-rate-table td:last-child { text-align:right; font-weight:bold; }
.gacha-result-bonus { color:#9a6700; font-weight:bold; margin-left:6px; }
.hidden-gacha-pet-result { color:#4a2155 !important; font-weight:900; text-shadow:none !important; }
.hidden-pet-result-bonus { display:block; margin-top:5px; padding:6px 8px; border-radius:8px; background:#f2e1f7; color:#5b176d; font-weight:900; line-height:1.45; text-shadow:none; }

.battle-skill-controls {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    width:100%;
    gap:6px;
    margin-top:10px;
}
.battle-skill-controls.has-exclusive { grid-template-columns:repeat(4,minmax(0,1fr)); }
.battle-skill-exclusive { border-color:#f5c451; background:#fff8e8; }
.battle-skill-exclusive .battle-skill-name,
.battle-skill-exclusive .battle-skill-charge { color:#b9770e; }
.battle-skill-button {
    min-width:0;
    padding:4px 3px 5px;
    border:1px solid #d5e2ea;
    border-radius:10px;
    background:rgba(255,255,255,.9);
    box-shadow:0 2px 5px rgba(52,73,94,.16);
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:3px;
}
.battle-skill-button:hover:not(:disabled):not(.is-disabled) .battle-skill-icon { transform:scale(1.05); }
.battle-skill-button:disabled,
.battle-skill-button.is-disabled { background:rgba(245,247,248,.86) !important; border-color:#e1e5e8; box-shadow:none; color:#7f8c8d !important; }
.battle-skill-button:disabled .battle-skill-icon,
.battle-skill-button.is-disabled .battle-skill-icon { filter:grayscale(.75); opacity:.55; }
.battle-skill-button.is-cooling-down,
.battle-skill-button.is-cooling-down:disabled {
    background:#aeb4b9 !important;
    border-color:#858c92 !important;
    color:#f4f6f7 !important;
    cursor:not-allowed;
    filter:grayscale(1);
    opacity:.82;
}
.battle-skill-button.is-cooling-down .battle-skill-name,
.battle-skill-button.is-cooling-down .battle-skill-charge { color:#f4f6f7 !important; }
.battle-skill-button.is-cooling-down .battle-skill-icon { filter:grayscale(1) brightness(.72) !important; opacity:.65; }
.battle-skill-button.is-ready { background:#faf5ff; border-color:#b784d7; box-shadow:0 0 0 2px rgba(155,89,182,.12); }
.battle-skill-button.is-ready .battle-skill-name,
.battle-skill-button.is-ready .battle-skill-charge { color:#7d3c98; }
.battle-skill-icon {
    width:54px;
    height:54px;
    aspect-ratio:1 / 1;
    flex:0 0 54px;
    object-fit:cover;
    object-position:center;
    display:block;
    border-radius:9px;
    border:1px solid #e8dccb;
    background:#fffaf0;
    image-rendering:auto;
    box-sizing:border-box;
    transition:transform .14s ease, filter .14s ease, opacity .14s ease;
}
.battle-skill-name { max-width:100%; font-size:10px; font-weight:bold; line-height:1.15; color:#34495e; overflow-wrap:anywhere; }
.battle-skill-charge { font-size:9px; line-height:1; color:#7f8c8d; }
.barracks-skill-icon {
    width:40px;
    height:40px;
    aspect-ratio:1 / 1;
    flex:0 0 40px;
    object-fit:cover;
    object-position:center;
    display:block;
    border-radius:8px;
    border:1px solid #d6eaf8;
    background:#fffaf0;
    image-rendering:auto;
    box-sizing:border-box;
}
.class-select-hint {
    font-size:12px;
    line-height:1.5;
    color:#6c3483;
    background:#f5eef8;
    border:1px solid #d2b4de;
    border-radius:8px;
    padding:8px;
    margin-bottom:12px;
}

@media (max-height: 700px) {
    .arena-box { min-height:350px; height:50vh; }
    .arena-avatar { width:88px; height:88px; }
    .arena-boss-side .arena-avatar { width:88px; height:147px; }
    .arena-boss-side { top:18px; }
    .arena-party-side { bottom:18px; }
    .battle-log-container { height:55vh; }
    #battle-controls button { padding:4px !important; }
    .battle-skill-icon { width:46px; height:46px; flex-basis:46px; }
}

@media (max-width: 420px) {
    .modal-content { padding:14px 12px; }
    .item-row { gap:6px; padding:7px; }
    .item-action { max-width:40%; padding:5px 7px !important; font-size:10px !important; }
    .item-actions { flex-direction:column; gap:3px; }
    .item-actions button { padding:4px 6px; font-size:10px; }
    .skill-list-icon { width:42px; height:42px; flex-basis:42px; }
    .skill-list-icon-small { width:34px; height:34px; flex-basis:34px; }
    .equipment-icon-frame { width:46px; height:46px; flex-basis:46px; }
    .equipment-list-icon { width:48px; height:48px; flex-basis:48px; }
    .equipment-picker-row {
        display:flex;
        flex-direction:column;
        min-height:0;
        gap:8px;
        padding:9px;
        overflow:hidden;
        isolation:isolate;
    }
    .equipment-picker-main { grid-template-columns:48px minmax(0, 1fr); width:100%; }
    .equipment-picker-copy { width:100%; max-width:100%; min-width:0; overflow:hidden; }
    .equipment-picker-action { align-self:stretch; width:100% !important; max-width:100% !important; min-height:40px; margin:2px 0 0; }
    .equipment-inventory-row { grid-template-columns:48px minmax(0, 1fr); }
    .equipment-inventory-actions { grid-column:1 / -1; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:100%; }
    .arena-party-side { left:2%; width:96%; }
    .ally-unit-grid.is-six-unit-team { gap:2px; }
    .ally-unit-grid.is-six-unit-team .battle-unit { min-width:0; padding:0 1px; font-size:8px; }
    .ally-unit-grid.is-six-unit-team .battle-unit-avatar { width:46px; height:50px; font-size:30px; }
    .ally-unit-grid.is-six-unit-team .battle-unit-name { height:13px; line-height:13px; padding:0 2px; font-size:8px; }
    .ally-unit-grid.is-six-unit-team .battle-unit-meta { gap:1px; font-size:7px; }
    .ally-unit-grid.is-six-unit-team .status-icon-row { min-height:14px; }
    .ally-unit-grid.is-six-unit-team .status-icon { width:14px; height:14px; font-size:9px; }
    .battle-loot-icon { width:40px; height:40px; flex-basis:40px; }
    .battle-skill-controls { gap:5px; }
    .battle-skill-button { padding:3px 2px 4px; }
    .battle-skill-icon { width:48px; height:48px; flex-basis:48px; }
    .battle-skill-controls.has-exclusive .battle-skill-icon { width:42px; height:42px; flex-basis:42px; }
}

@media (min-width: 520px) {
    .coop-party-slots { grid-template-columns:repeat(6,minmax(0,1fr)); }
}

.activity-menu-button {
    background-image:url('/static/B10.png') !important;
    background-size:cover !important;
    background-position:center !important;
    background-repeat:no-repeat !important;
    position:relative;
}
.activity-tab-bar { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; margin-bottom:12px; }
.activity-tab { padding:8px 4px; border:1px solid #e1d5ed; background:#f6f0fa; color:#6c3483; font-size:12px; }
.activity-tab.active { color:#fff; border-color:#9b59b6; background:linear-gradient(135deg,#9b59b6,#d2529d); box-shadow:0 3px 8px rgba(142,68,173,.24); }
.activity-intro { padding:9px 10px; margin-bottom:10px; border-radius:9px; background:#fff7dc; color:#76520d; font-size:12px; line-height:1.45; }
.activity-scroll-list { display:flex; flex-direction:column; gap:8px; max-height:56vh; overflow-y:auto; padding:2px; }
.activity-reward-card,.activity-task-card { border:1px solid #e5e7eb; border-radius:12px; background:#fff; box-shadow:0 2px 7px rgba(52,73,94,.09); }
.activity-reward-card { display:flex; align-items:center; gap:8px; padding:9px; text-align:left; }
.activity-card-icon { font-size:23px; flex:0 0 28px; }
.activity-card-copy { display:flex; flex:1 1 auto; min-width:0; flex-direction:column; gap:2px; }
.activity-card-copy strong { font-size:13px; color:#34495e; }
.activity-card-copy small { font-size:10px; color:#7f8c8d; overflow-wrap:anywhere; }
.activity-reward-card button,.activity-task-card button { flex:0 0 auto; padding:6px 8px; font-size:11px; background:#9b59b6; }
.activity-reward-card.available,.activity-task-card.available { border-color:#c99ae2; background:#fdf9ff; }
.activity-reward-card.claimed,.activity-task-card.claimed { border-color:#b7dfc2; background:#f3fbf5; }
.activity-reward-card.locked,.activity-task-card.locked { opacity:.72; }
.activity-reward-card button:disabled,.activity-task-card button:disabled { background:#bdc3c7; box-shadow:none; }
.activity-task-card { padding:11px; text-align:left; }
.activity-task-heading { display:flex; align-items:center; gap:8px; }
.activity-task-heading > span { font-size:25px; }
.activity-task-heading div { display:flex; flex-direction:column; }
.activity-task-heading small { color:#9b59b6; font-size:9px; font-weight:bold; }
.activity-task-heading strong { color:#2c3e50; font-size:14px; }
.activity-task-card p { margin:7px 0 5px; color:#5d6d7e; font-size:11px; line-height:1.45; }
.activity-task-reward { color:#a65c00; background:#fff8e7; border-radius:7px; padding:6px; font-size:10px; margin-bottom:7px; }
.activity-task-card > button { width:100%; }
.activity-task-card > .activity-guide-button { margin-top:5px; background:#3498db; }
.activity-skill-choice { width:100%; margin:0 0 7px; padding:7px; border:1px solid #d8c5e4; border-radius:7px; color:#6c3483; background:#fff; font-size:11px; }

.battle-result-card { text-align:center; border:2px solid #f2cb66; background:linear-gradient(180deg,#fffdf5,#fff); }
.battle-result-emblem { font-size:50px; line-height:1; margin:2px 0 8px; filter:drop-shadow(0 4px 5px rgba(90,63,0,.18)); }
.battle-result-summary { display:flex; flex-direction:column; gap:7px; margin:12px 0; text-align:left; }
.battle-result-row,.battle-result-loot,.battle-result-empty { border:1px solid #eadfca; border-radius:10px; background:#fffaf1; padding:9px 10px; color:#5d4b30; font-size:12px; }
.battle-result-row { display:flex; justify-content:space-between; gap:10px; }
.battle-result-loot { display:flex; align-items:center; gap:9px; }
.battle-result-loot span { min-width:0; overflow-wrap:anywhere; }
.battle-result-empty { text-align:center; line-height:1.6; }
.battle-result-confirm { width:100%; padding:11px; background:linear-gradient(135deg,#f39c12,#e67e22); font-weight:bold; }

/* 六套裝共用精靈圖：橫向四部位、縱向六套裝。 */
.equipment-set-sprite {
    display:block;
    width:100%;
    height:100%;
    background-image:url('/static/equipment/equipment_sets_sprite_v3.png?v=20260811-02');
    background-repeat:no-repeat;
    background-size:400% 600%;
    filter:drop-shadow(0 2px 2px rgba(0,0,0,.2));
}
.equipment-plus-mark,.equipment-plus-value { color:#e53935; font-weight:900; }
.equipment-plus-value { white-space:nowrap; margin-left:2px; }

.battle-result-detail-button {
    width:100%;
    border:1px solid #eadfca;
    text-align:left;
    font-family:inherit;
    cursor:pointer;
    box-shadow:none;
}
.battle-result-detail-button:active { transform:scale(.985); }

.battle-unit-hp { position:relative; }
.battle-unit-hp > .battle-unit-hp-fill { position:absolute; inset:0 auto 0 0; background:#2ecc71; z-index:1; }
.battle-unit-hp > .battle-unit-shield-fill {
    position:absolute;
    top:0;
    bottom:0;
    background:linear-gradient(90deg,#3498db,#76d7ff);
    box-shadow:inset 1px 0 rgba(255,255,255,.8);
    transition:left .25s,width .25s;
    z-index:2;
}

.solo-auto-battle-button {
    width:100%;
    margin:5px 0 7px;
    padding:8px;
    border:1px solid #7b61c8;
    background:#eee8ff;
    color:#533a9d;
    font-weight:800;
}
.solo-auto-battle-button.active { background:#5f47a8; color:#fff; }
.solo-auto-battle-button:disabled { background:#eee; border-color:#ccc; color:#888; }
.solo-auto-battle-button.is-locked { background:#eee; border-color:#bbb; color:#777; cursor:pointer; filter:grayscale(.35); }
.solo-auto-battle-button.is-locked:active { transform:translateY(1px); }

.dungeon-set-group {
    margin:4px 0;
    border:1px solid #e7c9d5;
    border-radius:14px;
    background:rgba(255,255,255,.72);
    overflow:hidden;
}
.dungeon-set-group > summary {
    display:grid;
    grid-template-columns:48px minmax(0,1fr) auto;
    align-items:center;
    gap:9px;
    padding:8px;
    cursor:pointer;
    list-style:none;
    color:#6f3550;
}
.dungeon-set-group > summary::-webkit-details-marker { display:none; }
.dungeon-set-group > summary span:nth-child(2) { display:flex; min-width:0; flex-direction:column; text-align:left; }
.dungeon-set-group > summary small { color:#8c7480; font-weight:normal; }
.dungeon-set-group > summary > b { font-size:20px; transition:transform .2s; }
.dungeon-set-group[open] > summary > b { transform:rotate(180deg); }
.dungeon-scene-preview {
    display:block;
    width:44px;
    height:44px;
    object-fit:cover;
    border:2px solid rgba(255,255,255,.9);
    border-radius:11px;
    box-shadow:0 2px 6px rgba(75,46,62,.22);
}
.dungeon-tier-grid { display:grid; gap:5px; padding:0 8px 7px; }
.dungeon-tier-grid .dungeon-entry-button { margin:0; }

.dungeon-mode-button {
    width:100%;
    display:grid;
    grid-template-columns:48px minmax(0,1fr) auto;
    align-items:center;
    gap:9px;
    margin:4px 0;
    padding:8px;
    border:1px solid #e7c9d5;
    border-radius:14px;
    background:rgba(255,255,255,.72);
    color:#6f3550;
    box-shadow:none;
    text-align:left;
}
.dungeon-mode-button:hover { background:rgba(255,255,255,.92); }
.dungeon-mode-button-copy { display:flex; min-width:0; flex-direction:column; }
.dungeon-mode-button-copy strong { font-size:13px; }
.dungeon-mode-button-copy small { color:#8c7480; font-weight:normal; }
.dungeon-mode-arrow { color:#8e44ad; font-size:14px; }
.pvp-modal-content { width:min(390px, calc(100% - 22px)); max-height:86vh; overflow-y:auto; box-sizing:border-box; }
.pvp-rating-board { display:grid; grid-template-columns:1fr; gap:6px; margin-bottom:10px; }
.pvp-rating-card { background:#f5effa; border:1px solid #d7bde2; border-radius:10px; padding:8px 4px; text-align:center; color:#5b2c6f; font-size:11px; }
.pvp-rating-card strong { display:block; color:#2c3e50; font-size:13px; margin:2px 0; }
.pvp-rank-info-button { width:100%; margin:-3px 0 10px; padding:7px; background:#6c5ce7; font-size:11px; }
.pvp-rank-info-modal-content { width:min(370px,calc(100% - 22px)); max-height:82vh; overflow-y:auto; }
.pvp-rank-info-note { margin-bottom:9px; padding:8px; border-radius:9px; background:#fff6d9; color:#7d6608; font-size:11px; line-height:1.5; }
.pvp-rank-info-list { display:grid; gap:6px; }
.pvp-rank-info-row { display:grid; grid-template-columns:34px minmax(0,1fr) auto; align-items:center; gap:7px; padding:8px; border:1px solid #ddd; border-radius:10px; background:#fff; color:#444; }
.pvp-rank-info-row.active { border:2px solid #8e44ad; background:#f5eef8; box-shadow:0 0 0 2px rgba(142,68,173,.12); }
.pvp-rank-info-row span:nth-child(2) { min-width:0; }
.pvp-rank-info-row strong { display:block; font-size:12px; color:#2c3e50; }
.pvp-rank-info-row small { display:block; color:#27ae60; font-size:9px; font-weight:bold; }
.pvp-rank-info-row > b { font-size:10px; color:#5b2c6f; white-space:nowrap; }
.pvp-rank-info-icon { font-size:22px; text-align:center; }
.pvp-rating-rule-title { margin-top:14px; }
.pvp-rating-rule-list { display:grid; gap:5px; }
.pvp-rating-rule-row { padding:7px 8px; border-left:4px solid #8e44ad; border-radius:6px; background:#f7f2fa; color:#4a3b50; font-size:10px; line-height:1.55; }
.pvp-section { background:#faf8fc; border:1px solid #ded2e8; border-radius:12px; padding:10px; margin-bottom:10px; }
.pvp-section-title { font-size:13px; font-weight:bold; color:#5b2c6f; margin-bottom:8px; }
.pvp-mode-tabs { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; }
.pvp-mode-tabs button { padding:8px 3px; background:#95a5a6; }
.pvp-mode-tabs button.active { background:#8e44ad; box-shadow:0 2px 0 #5b2c6f; }
.pvp-hint { min-height:18px; margin-top:7px; color:#666; font-size:11px; line-height:1.5; }
.pvp-pet-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
.pvp-pet-option { min-width:0; display:flex; align-items:center; gap:7px; border:2px solid #ddd; border-radius:10px; background:#fff; padding:7px; cursor:pointer; color:#444; }
.pvp-pet-option.selected { border-color:#8e44ad; background:#f5eef8; }
.pvp-pet-avatar { flex:0 0 34px; width:34px; height:34px; display:grid; place-items:center; overflow:hidden; }
.pvp-pet-avatar img { max-width:100%; max-height:100%; }
.pvp-pet-copy { min-width:0; font-size:10px; line-height:1.35; }
.pvp-pet-copy strong { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:12px; }
.pvp-primary-button,.pvp-secondary-button { width:100%; padding:10px; }
.pvp-primary-button { background:#8e44ad; }
.pvp-secondary-button { margin-top:6px; background:#7f8c8d; }
.pvp-party-slots { grid-template-columns:repeat(3,minmax(0,1fr)); }
.pvp-matching-panel { margin-top:10px; padding:16px 10px; border:2px solid #8e44ad; border-radius:13px; background:linear-gradient(135deg,#f8effc,#eee5f5); color:#5b2c6f; text-align:center; box-shadow:0 0 0 4px rgba(142,68,173,.10); }
.pvp-matching-panel strong { display:block; font-size:14px; margin:5px 0; }
.pvp-matching-panel #pvp-matching-text { min-height:20px; font-size:11px; color:#6c5a75; }
.pvp-matching-spinner { font-size:34px; animation:pvp-search-pulse .9s ease-in-out infinite alternate; }
@keyframes pvp-search-pulse { from { transform:scale(.88); opacity:.55; } to { transform:scale(1.12); opacity:1; filter:drop-shadow(0 0 7px #8e44ad); } }
.pvp-room-status { text-align:center; font-weight:bold; color:#5b2c6f; margin-bottom:9px; line-height:1.5; }
.pvp-room-members { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:9px; }
.pvp-member-card { border:1px solid #ddd; background:#fff; border-radius:10px; padding:8px; text-align:center; font-size:11px; overflow-wrap:anywhere; }
.pvp-member-card strong { display:block; color:#333; font-size:13px; margin-bottom:3px; }
.pvp-invite-card { display:flex; align-items:center; justify-content:space-between; gap:6px; background:#fff; border:1px solid #ead8f2; border-radius:9px; padding:7px; font-size:11px; }
.pvp-invite-actions { display:flex; gap:4px; flex:0 0 auto; }
.pvp-invite-actions button { padding:5px 7px; font-size:10px; }

@media (max-width:520px) {
    .pvp-modal-content { width:calc(100% - 14px); max-height:88vh; padding-left:10px; padding-right:10px; }
    .pvp-pet-list { grid-template-columns:1fr; }
    .pvp-rating-board { gap:4px; }
    .pvp-party-slots { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .pvp-room-members { grid-template-columns:1fr; }
}

@media (max-width:420px) {
    .activity-tab { font-size:11px; }
    .activity-reward-card { gap:5px; padding:8px 6px; }
    .activity-reward-card button { padding:6px 5px; font-size:10px; }
}

/* 後方各功能的個別 vh 設定也不能超出遊戲主視窗。 */
.pet-device > .modal-overlay > .modal-content {
    max-height: 88%;
}

/* 限定寵物隱藏版使用獨立原始圖，不再以原版圖片套濾鏡冒充不同花色。 */
.hidden-pet-visual {
    position:relative;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    isolation:isolate;
}
.hidden-pet-visual img { filter:none; object-fit:contain; }
.hidden-pet-name { color:#5b176d; font-size:14px; font-weight:900; text-shadow:none; }
.pet-book-row.is-hidden-variant { border-color:#bb6bd9; background:linear-gradient(135deg,#fff,#f8eaff); box-shadow:inset 0 0 12px rgba(187,107,217,.14); }
.barracks-base-rolls .is-positive { color:#18794e; }
.barracks-base-rolls .is-negative { color:#b42318; }
