/* 和風サバイバーシューティング『もののけサバイバー：平安百鬼夜行』スタイルシート */
@import url('https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@500;700;900&family=Yuji+Boku&display=swap');

:root {
    --gold: #d4af37;
    --gold-light: #fef08a;
    --gold-glow: rgba(212, 175, 55, 0.4);
    --shikigami-blue: #38bdf8;
    --shikigami-glow: rgba(56, 189, 248, 0.5);
    --crimson: #e11d48;
    --dark-bg: #0c0a09;
    --washi-bg: rgba(28, 25, 23, 0.85);
}

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

body, html {
    width: 100%;
    height: 100%;
    position: fixed;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
    background-color: #050508;
    font-family: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
    color: #f5f5f4;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    touch-action: none;
}

/* UIレイヤー */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 画面上部HUD */
.hud-top {
    width: 100%;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(to bottom, rgba(5, 5, 8, 0.85) 0%, rgba(5, 5, 8, 0) 100%);
    pointer-events: auto;
}

/* 経験値（霊力）バー */
.exp-bar-container {
    width: 100%;
    height: 12px;
    background: rgba(30, 27, 45, 0.8);
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.exp-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #0284c7, #38bdf8, #7dd3fc);
    box-shadow: 0 0 12px #38bdf8;
    transition: width 0.2s ease-out;
}

.exp-bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* ステータス行 */
.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.level-badge {
    background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
    border: 1.5px solid #fde047;
    color: #fef08a;
    font-weight: 900;
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 18px;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    gap: 6px;
}

.crest-icon-yin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #000;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    border: 1px solid #fde047;
    box-shadow: 0 0 6px rgba(253, 224, 71, 0.5);
    flex-shrink: 0;
}

.hp-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hp-bar-outer {
    width: 160px;
    height: 12px;
    background: rgba(30, 10, 15, 0.9);
    border: 1.5px solid #991b1b;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 6px rgba(185, 28, 28, 0.3);
}

.hp-bar-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #991b1b 0%, #dc2626 50%, #f87171 100%);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
    transition: width 0.15s ease-out;
}

.hp-text {
    font-size: 11px;
    color: #fca5a5;
    font-weight: 700;
    text-shadow: 0 1px 2px #000;
}

/* タイマー & 討伐数 */
.timer-container {
    text-align: center;
}

.game-timer {
    font-size: 26px;
    font-weight: 900;
    color: #fffbeb;
    letter-spacing: 3px;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.8), 0 2px 4px #000;
    font-family: 'Cinzel', 'Shippori Mincho', serif;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.status-sub-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.kill-koban-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.koban-count {
    font-size: 13px;
    font-weight: 700;
    color: #fef08a;
    display: flex;
    align-items: center;
    gap: 5px;
    text-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
}

.kill-count {
    font-size: 13px;
    color: #e2e8f0;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 帝の天罰ゲージ & サポート状態 */
.ally-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 画質・速度切替ボタン & HUDアクションボタン */
.perf-btn {
    background: linear-gradient(135deg, rgba(30, 25, 38, 0.9), rgba(12, 10, 16, 0.95));
    border: 1.5px solid var(--gold);
    color: var(--gold-light);
    font-family: 'Shippori Mincho', 'Noto Serif JP', serif;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.perf-btn:hover {
    transform: translateY(-1px) scale(1.04);
}

.perf-btn:active {
    transform: translateY(1px) scale(0.97);
}

.hud-action-btn {
    border-color: #38bdf8 !important;
    color: #7dd3fc !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 8px rgba(56, 189, 248, 0.25) !important;
}

/* 共通落款・印章パーツ */
.btn-crest {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid currentColor;
    border-radius: 3px;
    font-size: 9px;
    line-height: 1;
    font-weight: 900;
    flex-shrink: 0;
}

.sub-crest-purify {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    background: rgba(185, 28, 28, 0.3);
    border: 1px solid #f87171;
    color: #fca5a5;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.sub-crest-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    background: rgba(180, 83, 9, 0.35);
    border: 1px solid #fbbf24;
    color: #fef08a;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

.crest-imperial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 5px;
    background: linear-gradient(135deg, #78350f, #451a03);
    border: 1px solid #fde047;
    color: #fef08a;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1px;
}

.mikado-gauge-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.mikado-label {
    font-size: 11px;
    color: #fef08a;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mikado-gauge-outer {
    width: 110px;
    height: 10px;
    background: rgba(30, 20, 10, 0.8);
    border: 1px solid var(--gold);
    border-radius: 4px;
    overflow: hidden;
}

.mikado-gauge-inner {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #d97706, #fbbf24, #fffbeb);
    box-shadow: 0 0 10px #fbbf24;
    transition: width 0.2s;
}

/* 画面下部HUD (式神・装備アイコン) */
.hud-bottom {
    width: 100%;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    background: linear-gradient(to top, rgba(5, 5, 8, 0.85) 0%, rgba(5, 5, 8, 0) 100%);
    pointer-events: none;
}

.familiars-list {
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.familiar-slot {
    width: 44px;
    height: 44px;
    background: var(--washi-bg);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

.familiar-icon {
    font-size: 20px;
}

.familiar-level {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #451a03;
    border: 1px solid var(--gold);
    color: var(--gold-light);
    font-size: 9px;
    font-weight: 900;
    padding: 1px 4px;
    border-radius: 4px;
}

/* モバイル用バーチャルジョイスティック */
#virtual-joystick {
    position: absolute;
    bottom: 40px;
    left: 40px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, rgba(212, 175, 55, 0.03) 70%, transparent 100%);
    border: 2px dashed rgba(212, 175, 55, 0.4);
    border-radius: 50%;
    pointer-events: auto;
    touch-action: none;
    display: none; /* スマホ・タッチ時のみJSで表示 */
    z-index: 15;
}

#joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin-top: -25px;
    margin-left: -25px;
    background: radial-gradient(circle, #fbbf24 0%, #b45309 100%);
    border: 2px solid #fef3c7;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
    pointer-events: none;
}

/* 全画面天罰カットイン演出 */
#mikado-cutin {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(254, 240, 138, 0.28) 0%, rgba(15, 23, 42, 0.72) 80%);
    animation: cutinFade 1.6s forwards;
    padding: 0 16px;
    box-sizing: border-box;
}

.cutin-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    max-width: 680px;
    animation: cutinZoom 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cutin-badge {
    font-size: clamp(14px, 3.2vw, 22px);
    font-weight: 700;
    color: #fde047;
    letter-spacing: clamp(4px, 1.2vw, 8px);
    text-shadow: 0 0 12px rgba(245, 158, 11, 0.9), 0 0 24px rgba(217, 119, 6, 0.7);
    font-family: 'Shippori Mincho', serif;
    margin-bottom: 6px;
    white-space: nowrap;
    opacity: 0.95;
}

.cutin-title {
    font-size: clamp(32px, 8vw, 64px);
    font-weight: 900;
    background: linear-gradient(180deg, #ffffff 0%, #fef08a 45%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: clamp(4px, 1.6vw, 14px);
    filter: drop-shadow(0 0 20px rgba(245, 158, 11, 0.85)) drop-shadow(0 0 45px rgba(217, 119, 6, 0.65));
    font-family: 'Shippori Mincho', serif;
    white-space: nowrap;
    line-height: 1.15;
}

.cutin-sub {
    font-size: clamp(12px, 2.6vw, 18px);
    color: #f1f5f9;
    letter-spacing: clamp(2px, 0.8vw, 5px);
    margin-top: 10px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 0, 0, 0.7);
    white-space: nowrap;
}

@keyframes cutinFade {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes cutinZoom {
    0% { transform: scale(0.7); filter: blur(4px); }
    30% { transform: scale(1.05); filter: blur(0); }
    100% { transform: scale(1.1); filter: blur(1px); }
}

/* モーダル共通（開始・レベルアップ・ゲームオーバー） */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

/* レベルアップカードモーダル */
.levelup-modal {
    max-width: 900px;
    width: 92%;
    max-height: 90vh !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden !important;
    box-sizing: border-box;
}

.levelup-title {
    font-size: 28px;
    font-weight: 900;
    color: var(--gold-light);
    letter-spacing: 4px;
    text-shadow: 0 0 20px var(--gold-glow);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    text-align: center;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-content: start;
    gap: 16px;
    width: 100%;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    padding: 4px 6px 16px 6px;
    box-sizing: border-box;
}

/* カードコンテナ内の全要素でスワイプを許可 */
.cards-container * {
    touch-action: pan-y !important;
}

/* 和風金箔スクロールバー */
.cards-container::-webkit-scrollbar {
    width: 6px;
}
.cards-container::-webkit-scrollbar-track {
    background: rgba(28, 25, 23, 0.6);
    border-radius: 3px;
}
.cards-container::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 3px;
    box-shadow: 0 0 4px #fbbf24;
}

@media (max-width: 768px) {
    .levelup-modal {
        gap: 8px !important;
        width: 94% !important;
        max-height: 94vh !important;
        padding: 14px 12px 10px 12px !important;
    }

    .levelup-title {
        font-size: clamp(16px, 4.5vw, 20px) !important;
        letter-spacing: 1px !important;
        gap: 6px !important;
    }

    .cards-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 2px 4px 16px 4px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
    }

    .upgrade-card {
        height: auto !important;
        min-height: fit-content !important;
        flex: 0 0 auto !important;
        padding: 8px 12px 10px 12px !important;
        gap: 4px !important;
    }

    .card-type-badge {
        font-size: 10px !important;
        padding: 1px 8px !important;
    }

    .card-icon {
        font-size: 26px !important;
        margin: 1px 0 !important;
    }

    .card-name {
        font-size: 14px !important;
    }

    .card-desc {
        font-size: 11px !important;
        line-height: 1.35 !important;
        flex: 0 0 auto !important;
        margin: 2px 0 !important;
    }

    .card-footer {
        margin-top: 4px !important;
        padding-top: 5px !important;
        padding-bottom: 2px !important;
        flex: 0 0 auto !important;
        width: 100% !important;
    }

    .level-change-badge {
        font-size: 12px !important;
        padding: 2px 10px !important;
        gap: 5px !important;
        line-height: 1.3 !important;
    }

    .level-change-badge .level-cur {
        font-size: 11px !important;
    }

    .level-change-badge .level-arrow {
        font-size: 9px !important;
    }

    .level-change-badge .level-next {
        font-size: 12px !important;
    }
}

.upgrade-card {
    background: linear-gradient(145deg, #1c1917, #0c0a09);
    border: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 12px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
}

.upgrade-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: var(--gold);
    box-shadow: 0 12px 30px var(--gold-glow);
    background: linear-gradient(145deg, #292524, #141210);
}

.upgrade-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.card-type-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 10px;
    letter-spacing: 1px;
}

.badge-shikigami {
    background: rgba(2, 132, 199, 0.3);
    border: 1px solid #38bdf8;
    color: #7dd3fc;
}

.badge-human {
    background: rgba(180, 83, 9, 0.3);
    border: 1px solid #f59e0b;
    color: #fef08a;
}

.badge-spell {
    background: rgba(124, 58, 237, 0.3);
    border: 1px solid #a855f7;
    color: #d8b4fe;
}

.badge-evolution {
    background: radial-gradient(circle, rgba(234, 179, 8, 0.4), rgba(56, 189, 248, 0.3));
    border: 1px solid #fbbf24;
    color: #fef08a;
    box-shadow: 0 0 10px #fbbf24;
    animation: pulseGlow 1.5s infinite alternate;
}

/* 神化・進化カードの特別ハイライト */
.evolution-card {
    border: 2px solid #fbbf24 !important;
    background: linear-gradient(145deg, #2e1065, #1e1b4b) !important;
    box-shadow: 0 0 25px rgba(251, 191, 36, 0.6) !important;
    animation: evoCardGlow 2s infinite alternate;
}

@keyframes evoCardGlow {
    0% { transform: scale(1); box-shadow: 0 0 15px rgba(251, 191, 36, 0.4); }
    100% { transform: scale(1.03); box-shadow: 0 0 30px rgba(56, 189, 248, 0.8); }
}

@keyframes pulseGlow {
    0% { opacity: 0.85; }
    100% { opacity: 1; filter: drop-shadow(0 0 6px #fbbf24); }
}

/* 永続強化（メタアップグレード）項目スタイル */
.meta-item-card {
    background: rgba(28, 25, 23, 0.85);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.meta-item-info {
    text-align: left;
    flex: 1;
}

.meta-item-title {
    font-size: 14px;
    font-weight: 900;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item-desc {
    font-size: 11px;
    color: #a8a29e;
    margin-top: 2px;
}

.meta-buy-btn {
    background: radial-gradient(circle, #b45309, #78350f);
    border: 1px solid #fbbf24;
    color: #fef08a;
    font-family: 'Shippori Mincho', serif;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.meta-buy-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px #fbbf24;
}

.meta-buy-btn:disabled {
    background: #292524;
    border-color: #57534e;
    color: #78716c;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.card-icon {
    font-size: 44px;
    margin: 4px 0;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.card-name {
    font-size: 18px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 1px;
    text-align: center;
}

.card-desc {
    font-size: 12px;
    color: #d6d3d1;
    line-height: 1.6;
    text-align: center;
    flex-grow: 1;
}

.card-footer {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 8px;
    padding-bottom: 2px;
    margin-top: auto;
    border-top: 1px dashed rgba(212, 175, 55, 0.35);
    flex-shrink: 0 !important;
    box-sizing: border-box;
}

.level-change-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 3px 12px;
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
    box-sizing: border-box;
}

.level-change-badge .level-cur {
    color: #a8a29e;
    font-size: 12px;
}

.level-change-badge .level-arrow {
    color: #fbbf24;
    font-size: 10px;
    margin: 0 1px;
}

.level-change-badge .level-next {
    color: #fef08a;
    font-size: 13px;
    font-weight: 900;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.level-change-badge.evolution-badge {
    background: rgba(56, 189, 248, 0.15);
    border-color: #38bdf8;
    color: #7dd3fc;
    font-size: 12px;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

/* タイトル・ゲームオーバー画面・モーダル共通枠 */
.menu-box {
    background: radial-gradient(circle at 50% 0%, rgba(35, 28, 42, 0.98), rgba(12, 10, 16, 0.98)), linear-gradient(180deg, #181420 0%, #0a080e 100%);
    border: 2px solid #d4af37;
    border-radius: 16px;
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-shadow: 
        0 0 0 1px rgba(212, 175, 55, 0.35),
        0 20px 50px rgba(0, 0, 0, 0.95),
        inset 0 0 35px rgba(0, 0, 0, 0.85),
        inset 0 1px 0 rgba(254, 240, 138, 0.4);
    text-align: center;
    max-width: 480px;
    width: 92%;
    animation: modalPop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

/* メニュー枠の四隅金箔飾りアクセント */
.menu-box::before,
.menu-box::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-color: #fde047;
    pointer-events: none;
}
.menu-box::before {
    top: 6px;
    left: 6px;
    border-top: 2px solid #fde047;
    border-left: 2px solid #fde047;
}
.menu-box::after {
    bottom: 6px;
    right: 6px;
    border-bottom: 2px solid #fde047;
    border-right: 2px solid #fde047;
}

.main-title {
    font-size: clamp(24px, 6.8vw, 36px);
    font-weight: 900;
    letter-spacing: clamp(2px, 1.2vw, 5px);
    line-height: 1.2;
    white-space: nowrap;
    text-align: center;
    background: linear-gradient(180deg, #ffffff 0%, #fef08a 28%, #f59e0b 65%, #92400e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 16px rgba(245, 158, 11, 0.5));
    font-family: 'Shippori Mincho', 'Noto Serif JP', serif;
}

.main-sub {
    font-size: clamp(11px, 3.2vw, 13px);
    color: #cbd5e1;
    letter-spacing: clamp(2px, 1.2vw, 4px);
    white-space: nowrap;
    margin-top: 4px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.instructions {
    background: linear-gradient(145deg, rgba(20, 18, 26, 0.8), rgba(10, 8, 14, 0.9));
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-left: 3px solid #d4af37;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.7;
    text-align: left;
    width: 100%;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* ─── 和風モダン・ボタンシステム（文字溢れ完全防止＆美グラデーション） ─── */
.start-btn {
    font-family: 'Shippori Mincho', 'Noto Serif JP', serif;
    font-weight: 900;
    cursor: pointer;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.start-btn:hover {
    transform: translateY(-2px) scale(1.02);
}

.start-btn:active {
    transform: translateY(1px) scale(0.98);
}

/* ボタン光沢シマーエフェクト */
.start-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transform: rotate(25deg);
    transition: none;
}
.start-btn:hover::after {
    left: 130%;
    transition: all 0.6s ease-out;
}

/* 1段目：主役メインボタン（合戦開始・再起） */
.main-action-btn {
    width: 100%;
    padding: 13px 24px;
    font-size: 19px;
    letter-spacing: 3px;
    color: #fff;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 45%, #7f1d1d 100%);
    border: 2px solid #fde047;
    border-radius: 30px;
    box-shadow: 
        0 4px 18px rgba(220, 38, 38, 0.55),
        0 0 15px rgba(253, 224, 71, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.main-action-btn:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 45%, #991b1b 100%);
    box-shadow: 
        0 6px 24px rgba(239, 68, 68, 0.7),
        0 0 22px rgba(253, 224, 71, 0.6);
}

.btn-icon {
    font-size: 20px;
    line-height: 1;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

.btn-caption {
    font-weight: 900;
}

/* 2段目：サブボタングループ（横2列） */
.title-btn-group,
.gameover-btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.sub-btn-row {
    display: flex;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.sub-action-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 10px;
    font-size: 14px;
    letter-spacing: 1px;
    border-radius: 24px;
    color: #f1f5f9;
}

/* 陰陽強化ボタン：藍染霊気グラデーション */
.meta-title-btn {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #075985 100%);
    border: 1.5px solid #38bdf8;
    box-shadow: 
        0 3px 12px rgba(2, 132, 199, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.meta-title-btn:hover {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 50%, #0369a1 100%);
    box-shadow: 0 4px 18px rgba(56, 189, 248, 0.7);
}

/* 百鬼絵巻ボタン：金泥古文書グラデーション */
.bestiary-title-btn {
    background: linear-gradient(135deg, #b45309 0%, #92400e 50%, #78350f 100%);
    border: 1.5px solid #fbbf24;
    box-shadow: 
        0 3px 12px rgba(180, 83, 9, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.bestiary-title-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 50%, #92400e 100%);
    box-shadow: 0 4px 18px rgba(251, 191, 36, 0.7);
}

/* 都へ戻るボタン：漆黒銀鼠グラデーション */
.to-title-btn {
    background: linear-gradient(135deg, #334155 0%, #1e293b 50%, #0f172a 100%);
    border: 1.5px solid #94a3b8;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
}
.to-title-btn:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 50%, #1e293b 100%);
    box-shadow: 0 4px 16px rgba(148, 163, 184, 0.4);
}

.btn-icon-sub {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    font-size: 11px;
    line-height: 1;
    font-weight: 900;
    color: #fef08a;
    flex-shrink: 0;
}

@keyframes modalPop {
    0% { transform: scale(0.92); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ダメージ数値ポップアップ */
.damage-number {
    position: absolute;
    font-weight: 900;
    font-size: 16px;
    pointer-events: none;
    z-index: 20;
    text-shadow: 0 0 4px #000, 0 0 8px #000;
    animation: damageFloat 0.7s ease-out forwards;
}

.damage-player {
    color: #ef4444;
    font-size: 20px;
}

.damage-enemy {
    color: #fef08a;
}

.damage-crit {
    color: #f97316;
    font-size: 22px;
}

@keyframes damageFloat {
    0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    50% { transform: translate(-50%, -24px) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -40px) scale(0.9); }
}

/* スマホ向けレスポンシブ最適化 */
@media (max-width: 640px) {
    .hud-top {
        padding: 8px 12px;
        gap: 6px;
    }

    .hp-bar-outer {
        width: 80px;
        height: 10px;
    }

    .hp-text {
        font-size: 9px;
    }

    .level-badge {
        font-size: 11px;
        padding: 2px 8px;
    }

    .game-timer {
        font-size: 18px;
        letter-spacing: 1px;
    }

    .kill-count {
        font-size: 10px;
    }

    .mikado-gauge-outer {
        width: 60px;
        height: 8px;
    }

    .mikado-label {
        font-size: 9px;
    }

    .perf-btn {
        font-size: 9px;
        padding: 2px 6px;
    }

    .cutin-badge {
        font-size: 13px;
        letter-spacing: 4px;
        margin-bottom: 4px;
    }

    .cutin-title {
        font-size: 28px;
        letter-spacing: 5px;
    }

    .cutin-sub {
        font-size: 12px;
        letter-spacing: 1.5px;
        margin-top: 6px;
    }

    .menu-box {
        padding: 24px 18px;
        gap: 16px;
    }

    .main-title {
        font-size: clamp(20px, 6vw, 28px);
        letter-spacing: clamp(1px, 1vw, 2px);
    }

    .main-action-btn {
        font-size: clamp(16px, 4.5vw, 18px) !important;
        padding: 11px 16px !important;
    }

    .sub-action-btn {
        font-size: clamp(12px, 3.5vw, 14px) !important;
        padding: 9px 6px !important;
    }
}

/* 永続強化モーダル専用（スマホ縦画面で確実なスクロール） */
.meta-upgrade-dialog {
    max-width: 500px;
    width: 92%;
    height: 78vh !important;
    max-height: 560px !important;
    display: flex;
    flex-direction: column;
    padding: 18px 16px !important;
    gap: 10px !important;
    overflow: hidden !important;
    box-sizing: border-box;
    touch-action: auto !important;
}

.meta-header {
    flex-shrink: 0;
    text-align: center;
}

.meta-title {
    font-size: 22px;
    font-weight: 900;
    color: #fef08a;
    letter-spacing: 2px;
}

.meta-subtitle {
    font-size: 11px;
    color: #a8a29e;
    margin-top: 4px;
}

.meta-scroll-list {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding-right: 6px;
    padding-bottom: 12px;
    box-sizing: border-box;
}

/* スクロール領域内の全子要素でタッチスクロールを許可 */
.meta-scroll-list * {
    touch-action: pan-y !important;
}

/* 和風金箔スクロールバー */
.meta-scroll-list::-webkit-scrollbar {
    width: 6px;
}
.meta-scroll-list::-webkit-scrollbar-track {
    background: rgba(28, 25, 23, 0.6);
    border-radius: 3px;
}
.meta-scroll-list::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 3px;
    box-shadow: 0 0 4px #fbbf24;
}

.meta-footer {
    flex-shrink: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    padding-top: 8px;
    border-top: 1px solid rgba(212, 175, 55, 0.25);
}

/* HUD 刻（時間帯）＆現在地バイオームバッジ */
.hud-time-biome {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    margin-top: 3px;
}

.time-badge {
    background: linear-gradient(135deg, rgba(45, 20, 30, 0.9), rgba(20, 10, 20, 0.95));
    border: 1px solid #f59e0b;
    border-radius: 4px;
    padding: 2px 7px;
    color: #fef08a;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
}

.biome-badge {
    background: linear-gradient(135deg, rgba(10, 30, 55, 0.9), rgba(5, 15, 30, 0.95));
    border: 1px solid #38bdf8;
    border-radius: 4px;
    padding: 2px 7px;
    color: #7dd3fc;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
}

/* ─── 百鬼絵巻（妖怪図鑑＆封印任務）モーダル ─── */
.bestiary-dialog {
    max-width: 820px !important;
    width: 95% !important;
    max-height: 88vh !important;
    height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 16px 20px !important;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(8, 12, 22, 0.98)) !important;
    border: 2px solid #d4af37 !important;
    box-shadow: 0 0 35px rgba(212, 175, 55, 0.35), inset 0 0 15px rgba(0, 0, 0, 0.8) !important;
}

.bestiary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid rgba(212, 175, 55, 0.35);
    padding-bottom: 12px;
    flex-shrink: 0;
}

.bestiary-title-group {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.bestiary-main-title {
    font-size: 24px;
    font-weight: 900;
    color: var(--gold-light);
    letter-spacing: 3px;
    text-shadow: 0 0 15px var(--gold-glow);
}

.bestiary-tabs {
    display: flex;
    gap: 8px;
}

.bestiary-tab-btn {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bestiary-tab-btn:hover {
    background: rgba(51, 65, 85, 0.9);
    color: #fff;
    border-color: #d4af37;
}

.bestiary-tab-btn.active {
    background: linear-gradient(135deg, #b45309, #d97706);
    color: #fef08a;
    border-color: #fde047;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.close-icon-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}

.close-icon-btn:hover {
    color: #ef4444;
}

.bestiary-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 12px 0;
    padding-right: 6px;
    -webkit-overflow-scrolling: touch;
}

.bestiary-footer {
    display: flex;
    justify-content: center;
    padding-top: 10px;
    border-top: 1px solid rgba(212, 175, 55, 0.25);
    flex-shrink: 0;
}

.bestiary-summary-bar {
    background: rgba(30, 41, 59, 0.5);
    border-left: 4px solid #d4af37;
    padding: 8px 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px;
    font-size: 13px;
}

/* 妖怪図鑑グリッド */
.bestiary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.mononoke-card {
    background: rgba(24, 24, 27, 0.85);
    border: 1px solid rgba(120, 113, 108, 0.4);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    transition: all 0.2s;
}

.card-discovered {
    border-color: rgba(212, 175, 55, 0.6);
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(20, 25, 35, 0.85));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.card-undiscovered {
    opacity: 0.6;
    filter: grayscale(0.8);
    background: rgba(15, 15, 18, 0.8);
    border-style: dashed;
}

.card-icon {
    font-size: 32px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    flex-shrink: 0;
}

.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
    text-align: left;
}

.card-name-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.card-name {
    font-weight: 900;
    font-size: 14px;
    color: #fef08a;
}

.card-furigana {
    font-size: 10px;
    color: #a8a29e;
}

.card-biome {
    font-size: 10px;
    color: #38bdf8;
}

.card-desc {
    font-size: 11px;
    color: #cbd5e1;
    line-height: 1.35;
    margin: 3px 0;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #94a3b8;
    border-top: 1px dotted rgba(255, 255, 255, 0.15);
    padding-top: 3px;
    margin-top: 2px;
}

/* 封印任務リスト */
.missions-scroll-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mission-item {
    background: rgba(24, 24, 27, 0.85);
    border: 1px solid rgba(120, 113, 108, 0.4);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s;
    text-align: left;
}

.mission-item.mission-done {
    border-color: #22c55e !important;
    background: linear-gradient(135deg, rgba(20, 83, 45, 0.25), rgba(15, 23, 42, 0.7)) !important;
}

.mission-item.mission-hard {
    border-color: rgba(239, 68, 68, 0.6);
    background: linear-gradient(135deg, rgba(88, 28, 135, 0.2), rgba(20, 10, 25, 0.8));
    box-shadow: 0 0 10px rgba(185, 28, 28, 0.2);
}

.mission-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mission-badge-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mission-difficulty-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
}

.badge-normal {
    background: rgba(14, 116, 144, 0.3);
    border: 1px solid #38bdf8;
    color: #7dd3fc;
}

.badge-hard {
    background: rgba(185, 28, 28, 0.35);
    border: 1px solid #f87171;
    color: #fca5a5;
    animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 4px rgba(239, 68, 68, 0.3); }
    100% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.7); }
}

.mission-item-name {
    font-size: 15px;
    font-weight: 900;
    color: #fff;
}

.mission-status-tag {
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
}

.status-cleared {
    background: rgba(22, 101, 52, 0.8);
    color: #86efac;
    border: 1px solid #4ade80;
}

.status-progress {
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.mission-item-desc {
    font-size: 12px;
    color: #cbd5e1;
}

.mission-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
    padding-top: 6px;
    flex-wrap: wrap;
    gap: 6px;
}

.mission-progress-bar-container strong {
    color: #fef08a;
}

/* 任務達成トースト通知 */
#mission-toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 420px;
}

.mission-toast {
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.95), rgba(15, 23, 42, 0.98));
    border: 2px solid #d4af37;
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 0 15px rgba(212, 175, 55, 0.5);
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.mission-toast.toast-show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.mission-toast.toast-hard {
    border-color: #ef4444;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 0 20px rgba(239, 68, 68, 0.6);
}

.toast-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.toast-body {
    flex: 1;
    text-align: left;
}

.toast-header {
    font-size: 11px;
    font-weight: 800;
    color: #fbbf24;
    letter-spacing: 1px;
}

.toast-hard .toast-header {
    color: #f87171;
}

.toast-title {
    font-size: 15px;
    font-weight: 900;
    color: #fff;
    margin: 1px 0;
}

.toast-reward {
    font-size: 11px;
    color: #93c5fd;
}
