/* ============================================================
   モンスターハウス画面
   ============================================================ */

/* ---- ハウス画面全体 ---- */
#app.portrait-mode #monster-house-screen {
    position: relative;
    padding: 0;
    overflow: hidden;
    flex-direction: column;
}

#app.portrait-mode #monster-house-screen .top-bg-img {
    opacity: 1;
}

/* ---- セリフバブル ---- */
#app.portrait-mode .mh-clerk-quote {
    position: absolute;
    top: calc(50% - 450px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 42px !important;
    width: 600px;
    max-width: 90%;
    min-height: 200px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: pre-wrap;
    box-sizing: border-box;
    z-index: 1;
    pointer-events: none;
    animation: none !important;
    /* .special-quote の specialQuoteFadeIn を打ち消す */
    background: rgba(0, 60, 120, 0.8);
}

/* ---- コンテンツエリア初期非表示 ---- */
#app.portrait-mode .mh-content-area.mh-hidden {
    display: none;
}

/* ---- 下部タブコンテナ ---- */
#app.portrait-mode .mh-bottom {
    padding-top: 0;
}

/* ---- コンテンツエリア ---- */
#app.portrait-mode .mh-content-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 2;
    background: rgba(0, 0, 0, 0.75);
    margin: 0 20px 10px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
}

#app.portrait-mode .mh-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#app.portrait-mode .mh-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* ---- ソートバー ---- */
#app.portrait-mode .mh-sort-bar {
    display: flex;
    gap: 12px;
    padding-bottom: 12px;
    flex-shrink: 0;
}

#app.portrait-mode .mh-sort-btn {
    font-family: var(--font-pixel);
    font-size: 26px;
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(30, 30, 80, 0.7);
    color: #ccc;
    cursor: pointer;
}

#app.portrait-mode .mh-sort-btn.active {
    background: rgba(0, 100, 200, 0.8);
    color: #fff;
    border-color: rgba(100, 180, 255, 0.6);
}

/* ---- モンスターカードグリッド ---- */
#app.portrait-mode .mh-monster-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

#app.portrait-mode .mh-monster-card {
    background: rgba(20, 30, 80, 0.85);
    border: 2px solid rgba(100, 150, 255, 0.3);
    border-radius: 12px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s;
    position: relative;
}

#app.portrait-mode .mh-monster-card:hover {
    border-color: rgba(100, 180, 255, 0.7);
}

#app.portrait-mode .mh-monster-card:active {
    transform: scale(0.96);
}

#app.portrait-mode .mh-monster-card.active-partner {
    border-color: #ff9500;
    background: rgba(60, 30, 0, 0.85);
}

#app.portrait-mode .mh-monster-card-img {
    width: 100%;
    height: 130px;
    object-fit: contain;
}

#app.portrait-mode .mh-monster-card-name {
    font-family: var(--font-pixel);
    font-size: 22px;
    color: #ddd;
    text-align: center;
    word-break: break-all;
}

#app.portrait-mode .mh-medal-badge {
    font-family: var(--font-pixel);
    font-size: 18px;
    background: rgba(255, 215, 0, 0.25);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.5);
    border-radius: 6px;
    padding: 2px 8px;
}

#app.portrait-mode .mh-partner-badge {
    font-family: var(--font-pixel);
    font-size: 18px;
    background: rgba(255, 149, 0, 0.3);
    color: #ff9500;
    border: 1px solid rgba(255, 149, 0, 0.5);
    border-radius: 6px;
    padding: 2px 8px;
}

/* ---- 詳細パネル ---- */
#app.portrait-mode .mh-detail-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px;
    gap: 16px;
    overflow-y: auto;
    position: relative;
}

#app.portrait-mode .mh-detail-img-wrapper {
    position: relative;
    display: inline-block;
}

#app.portrait-mode .mh-detail-partner-badge {
    position: absolute;
    top: 0;
    right: 0;
    font-family: var(--font-pixel);
    font-size: 30px;
    /* 元のサイズに戻す */
    background: rgba(255, 149, 0, 0.85);
    color: #fff;
    border: 2px solid rgba(255, 149, 0, 0.9);
    /* 元の2pxに戻す */
    border-radius: 10px;
    /* 元の10pxに戻す */
    padding: 6px 20px;
    /* 元に戻す */
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    box-shadow: 0 2px 10px rgba(255, 149, 0, 0.5);
    /* 元に戻す */
}

#app.portrait-mode .mh-detail-panel.mh-detail-panel--partner {
    border: 6px solid #ffd700;
    border-radius: 12px;
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.4);
}

#app.portrait-mode .mh-monster-detail-img {
    width: 480px;
    /* 元のサイズに戻す */
    height: 480px;
    /* 元のサイズに戻す */
    object-fit: contain;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 6px rgba(255, 255, 255, 0.5));
}

#app.portrait-mode .mh-monster-detail-name {
    font-family: var(--font-pixel);
    font-size: 40px;
    /* 元のサイズに戻す */
    color: #fff;
    text-align: center;
}

#app.portrait-mode .mh-detail-medal-label {
    font-family: var(--font-pixel);
    font-size: 28px;
    /* 元のサイズに戻す */
    color: #ffd700;
    display: flex;
    align-items: center;
    gap: 12px;
    /* 元のサイズに戻す */
}

#app.portrait-mode .mh-detail-medal-label.mh-no-medal {
    color: #888;
}

#app.portrait-mode .mh-detail-medal-icon {
    width: 48px;
    /* 元のサイズに戻す */
    height: 48px;
    /* 元のサイズに戻す */
    object-fit: contain;
}

#app.portrait-mode .mh-detail-medal-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#app.portrait-mode .mh-detail-medal-large-icon {
    width: 150px;
    height: 150px;
    object-fit: contain;
}

#app.portrait-mode .mh-detail-medal-large-icon.rarity-bronze {
    filter: drop-shadow(0 0 8px rgba(205, 127, 50, 0.9));
}

#app.portrait-mode .mh-detail-medal-large-icon.rarity-silver {
    filter: drop-shadow(0 0 8px rgba(192, 192, 192, 0.9));
}

#app.portrait-mode .mh-detail-medal-large-icon.rarity-gold {
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 1.0));
}

#app.portrait-mode .mh-detail-medal-large-icon.rarity-diamond {
    filter: drop-shadow(0 0 12px rgba(185, 242, 255, 1.0));
}

#app.portrait-mode .mh-detail-medal-effect-text {
    font-family: var(--font-pixel);
    font-size: 32px;
    color: #7df;
    text-align: center;
}

#app.portrait-mode .mh-detail-medal-name {
    font-family: var(--font-pixel);
    font-size: 36px;
    color: #ffd700;
    text-align: center;
    margin-bottom: 4px;
}

#app.portrait-mode .mh-detail-divider {
    width: 90%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.6), transparent);
    margin: 8px 0;
    border: none;
}

#app.portrait-mode .mh-detail-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* 元の間隔に戻す（垂直だけ広げるならここも24もありだが一旦元に戻す） */
    width: 100%;
    max-width: 500px;
    /* 元の幅に戻す */
    margin: 0 auto;
}

#app.portrait-mode .mh-detail-btn {
    font-size: 32px;
    /* 元のサイズに戻す */
    padding: 16px 20px;
    /* 元のサイズに戻す */
}

#app.portrait-mode .mh-detail-buttons button {
    background: rgba(30, 40, 80, 1);
    border: 2px solid rgba(55, 80, 155, 0.8);
    border-radius: 10px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

#app.portrait-mode .mh-detail-buttons button:active {
    background: rgba(20, 60, 120, 1);
    border-color: var(--primary-color);
    transform: translateY(2px);
}

/* ---- メダルカードグリッド ---- */
#app.portrait-mode .mh-medal-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

#app.portrait-mode .mh-medal-card {
    background: rgba(20, 30, 80, 0.85);
    border: 2px solid rgba(100, 150, 255, 0.3);
    border-radius: 12px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
    position: relative;
}

#app.portrait-mode .mh-medal-card.equipped {
    border-color: #ffd700;
    background: rgba(50, 40, 0, 0.85);
}

#app.portrait-mode .mh-medal-card-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

#app.portrait-mode .mh-medal-card-img.rarity-bronze {
    filter: drop-shadow(0 0 6px rgba(205, 127, 50, 0.8));
}

#app.portrait-mode .mh-medal-card-img.rarity-silver {
    filter: drop-shadow(0 0 6px rgba(192, 192, 192, 0.8));
}

#app.portrait-mode .mh-medal-card-img.rarity-gold {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.9));
}

#app.portrait-mode .mh-medal-card-img.rarity-diamond {
    filter: drop-shadow(0 0 10px rgba(185, 242, 255, 1.0));
}

#app.portrait-mode .mh-medal-card-name {
    font-family: var(--font-pixel);
    font-size: 20px;
    color: #ddd;
    text-align: center;
    word-break: break-all;
}

#app.portrait-mode .mh-medal-card-count {
    font-family: var(--font-pixel);
    font-size: 26px;
    color: #aaa;
}

#app.portrait-mode .mh-medal-equipped-badge {
    font-family: var(--font-pixel);
    font-size: 18px;
    background: rgba(255, 215, 0, 0.25);
    color: #ffd700;
    border-radius: 6px;
    padding: 2px 8px;
}

/* ---- メダル詳細オーバーレイ ---- */
#app.portrait-mode #mh-medal-detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

#app.portrait-mode #mh-medal-detail-overlay.active {
    display: flex;
}

#app.portrait-mode .mh-medal-detail-content {
    background: linear-gradient(135deg, #1a2444, #0d1222);
    border: 3px solid rgba(79, 172, 254, 0.5);
    border-radius: 20px;
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 600px;
    max-width: 90%;
}

#app.portrait-mode .mh-medal-detail-img {
    width: 240px;
    height: 240px;
    object-fit: contain;
}

#app.portrait-mode .mh-medal-detail-name {
    font-family: var(--font-pixel);
    font-size: 38px;
    text-align: center;
}

#app.portrait-mode .mh-medal-detail-rarity,
#app.portrait-mode .mh-medal-detail-effect,
#app.portrait-mode .mh-medal-detail-count,
#app.portrait-mode .mh-medal-detail-equipped {
    font-family: var(--font-pixel);
    font-size: 28px;
    color: #ccc;
    text-align: center;
}

#app.portrait-mode .mh-medal-detail-equipped {
    color: #ffd700;
}

#app.portrait-mode .mh-medal-detail-effect {
    color: #7df;
}


/* ---- おわかれ確認ダイアログ ---- */
#mh-farewell-confirm-overlay .shop-msg-text {
    color: #fff;
    font-size: 42px;
    margin-bottom: 32px;
}

#mh-farewell-confirm-overlay .mh-farewell-confirm-buttons {
    margin-top: 0;
}

/* ---- おわかれタブ ---- */
#app.portrait-mode .mh-farewell-card {
    border-color: rgba(255, 80, 80, 0.4);
}

#app.portrait-mode .mh-farewell-card:hover {
    border-color: rgba(255, 80, 80, 0.8);
}

/* ---- 空メッセージ ---- */
#app.portrait-mode .mh-empty-msg {
    font-family: var(--font-pixel);
    font-size: 30px;
    color: #888;
    text-align: center;
    padding: 40px 20px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ---- もどるボタン ---- */
#app.portrait-mode .mh-back-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 12px 16px;
    font-size: 30px;
    padding: 14px 20px;
    flex-shrink: 0;
}

/* ---- メダルサブパネルヘッダー ---- */
#app.portrait-mode .mh-medal-sub-header {
    font-family: var(--font-pixel);
    font-size: 34px;
    color: #fff;
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 12px;
}

/* ---- 捕獲フェード (未使用) ---- */
#capture-fade {
    display: none;
}

/* ---- 汎用通知バブル ---- */
.game-notification-bubble {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    background: rgba(0, 60, 120, 0.95);
    border: 6px solid rgba(79, 172, 254, 0.8);
    border-radius: 40px;
    padding: 48px 80px;
    font-family: var(--font-pixel);
    font-size: 38px;
    color: #fff;
    text-align: center;
    z-index: 300;
    line-height: 1.5;
    pointer-events: none;
}

.game-notification-bubble.active {
    display: block;
    animation: game-bubble-in 0.3s ease forwards;
}

@keyframes game-bubble-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(calc(-50% + 20px));
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(-50%);
    }
}

/* ---- コンパニオンカットインオーバーレイ ---- */
.companion-cutin-overlay {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 100%;
    background: transparent;
    z-index: 10001;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 15%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.companion-cutin-overlay.active {
    opacity: 1;
}

/* メダルタイプ別背景画像（画面全体を覆う） */
.companion-cutin-overlay .companion-cutin-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    z-index: 0;
}

.companion-cutin-overlay .companion-cutin-bg.visible {
    display: block;
}

/* モンスター画像はウィンドウ外へ切り離してアニメーション */
.companion-cutin-overlay .companion-cutin-img {
    position: fixed;
    bottom: calc(15% + 240px);
    width: 810px;
    height: 810px;
    object-fit: contain;
    left: 50%;
    margin-left: -405px;
    z-index: 10002;
    transform: translateX(calc(-50vw - 500px));
    will-change: transform;
}

.companion-cutin-overlay.active .companion-cutin-img {
    animation: companion-img-slide 2.1s forwards;
}

@keyframes companion-img-slide {
    0% {
        transform: translateX(calc(50vw + 500px));
        animation-timing-function: ease-out;
    }

    15% {
        transform: translateX(80px);
        animation-timing-function: linear;
    }

    80% {
        transform: translateX(-80px);
        animation-timing-function: ease-in;
    }

    100% {
        transform: translateX(calc(-50vw - 500px));
    }
}

.companion-cutin-overlay .companion-cutin-msg {
    font-family: var(--font-pixel);
    font-size: 52px;
    color: #fff;
    line-height: 1.5;
    text-align: center;
    white-space: pre-wrap;
    position: relative;
    z-index: 1;
    background: rgba(0, 20, 60, 0.92);
    border: 6px solid rgba(79, 172, 254, 0.6);
    border-radius: 40px;
    padding: 40px 48px;
    width: 100%;
    box-sizing: border-box;
}

/* ---- バトル画面コンパニオンスロット ---- */
#companion-slot-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
}

.companion-slot-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid rgba(255, 149, 0, 0.8);
    background: rgba(60, 30, 0, 0.5);
}

/* ---- コンパニオンレベル: Lvバッジ / EXPバー ---- */
#app.portrait-mode .mh-lv-badge {
    display: inline-block;
    font-family: var(--font-pixel);
    font-size: 18px;
    line-height: 1;
    color: #cfe6ff;
    background: rgba(40, 80, 160, 0.85);
    border: 1px solid rgba(120, 180, 255, 0.7);
    border-radius: 6px;
    padding: 3px 8px;
    vertical-align: middle;
}

#app.portrait-mode .mh-monster-card .mh-lv-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
}

#app.portrait-mode .mh-lv-badge.mh-lv-max {
    color: #3a2a00;
    background: linear-gradient(180deg, #ffe27a, #ffc400);
    border-color: #fff3b0;
    box-shadow: 0 0 8px rgba(255, 200, 0, 0.7);
}

#app.portrait-mode .mh-monster-detail-name .mh-lv-badge,
#app.portrait-mode #battle-companion-detail .mh-lv-badge {
    font-size: 26px;
    padding: 4px 12px;
}

#app.portrait-mode .mh-exp-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 80%;
    max-width: 420px;
}

#app.portrait-mode .mh-exp-bar {
    width: 100%;
    height: 16px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(120, 180, 255, 0.6);
    border-radius: 8px;
    overflow: hidden;
}

#app.portrait-mode .mh-exp-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe, #6ee7ff);
    transition: width 0.3s ease;
}

#app.portrait-mode .mh-exp-label {
    font-family: var(--font-pixel);
    font-size: 18px;
    color: #bcd6ff;
}

#app.portrait-mode .mh-exp-label.mh-exp-max {
    color: #ffd700;
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
}

/* ---- 詳細パネル: メダルスロット(最大2) / レベル倍率 ---- */
#app.portrait-mode .mh-detail-medal-slots {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

#app.portrait-mode .mh-detail-medal-x {
    font-family: var(--font-pixel);
    font-size: 18px;
    margin-left: 12px;
    padding: 4px 12px;
    border-radius: 6px;
}

#app.portrait-mode .mh-detail-mult-label {
    font-family: var(--font-pixel);
    font-size: 24px;
    color: #ffd700;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}