/* =====================================================
 * ツキモノダンジョン LP用CSS
 * ショートコード [tsukimono_dungeon] と合わせて使用
 * ===================================================== */

.post_content div>:first-child, .post_content>:first-child {
    margin-top: initial !important;
}

/* WPテーマの見出し装飾をゲーム内でリセット */
.tsukimono-game-container h2 {
    border: none;
    padding: 0;
    margin: 0;
    background: none;
}

.tsukimono-game-container h2::before,
.tsukimono-game-container h2::after {
    content: none;
    display: none;
}

.tsukimono-game-container {
    text-align: center;
    margin: 20px auto;
    background-color: #111;
    color: #e0e0e0;
    border: 2px solid #fff;
    border-radius: 10px;
    padding: 20px;
    max-width: 800px;
    min-height: 480px;
    position: relative;
}

.tsukimono-mapbox{
    display: flex;
}

#tsukimono-maze {
    display: grid;
    justify-content: center;
    grid-template-columns: repeat(21, 22px);
    grid-template-rows: repeat(21, 22px);
    gap: 0;
    max-width: 500px;
    background-color: #0a0a0a;
    border: 2px solid #fff;
    padding: 10px;
    border-radius: 10px;
}

#tsukimono-maze div {
    width: 22px;
    height: 22px;
    background-color: #0a0a0a;
    position: relative;
}

.tsukimono-status-map {
    background-color: #1a1a1a;
    padding: 12px;
    border-radius: 10px;
    border: 2px solid #fff;
    color: #fff;
    margin-left: 12px;
    width: 100%;
    text-align: left;
}

.tsukimono-status-map div {
    margin: 3px 0;
    font-size: 13px;
}

#tsukimono-maze .player {
    background-size: cover;
}

#tsukimono-maze .player .player-sprite,
#tsukimono-maze .item-sprite {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#tsukimono-maze .player .player-sprite {
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.9));
}

#tsukimono-maze .item-sprite {
    filter: drop-shadow(1px 0 0 #000) drop-shadow(-1px 0 0 #000);
}

.key-status-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.key-status-icon {
    height: 16px;
    width: 16px;
    object-fit: contain;
}

#tsukimono-maze .goal {
    background-size: cover;
}

.tsukimono-enemy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
}

.enemy-name {
    font-size: 14px;
    color: #ccc;
}

#tsukimono-enemyImage {
    width: 150px;
    height: auto;
}

#tsukimono-enemyImage.mid-boss-image {
    transform: scale(1.3);
    transform-origin: center bottom;
}

.enemy-hp {
    font-size: 14px;
    color: #fff;
}

.enemy-hp-bar-container {
    width: 120px;
    height: 6px;
    background-color: #333;
    border-radius: 3px;
    overflow: hidden;
    margin: 2px auto 0;
}

.enemy-hp-bar {
    width: 100%;
    height: 100%;
    background-color: #44cc44;
    border-radius: 3px;
    transition: width 0.3s ease-out, background-color 0.3s;
}

.tsukimono-textToType {
    background-color: #1a1a1a;
    border: 2px solid #fff;
    padding: 6px;
    display: block;
    margin: 10px auto;
    max-width: 70%;
    border-radius: 5px;
    font-size: 1.5em;
}

.tsukimono-shift-hint {
    color: #ffcc00;
    font-size: 0.85em;
    text-align: center;
    margin-top: -5px;
    margin-bottom: 5px;
    animation: blink 1s ease-in-out infinite;
}

.tsukimono-mode-hint {
    color: #ff9966;
    font-size: 0.85em;
    text-align: center;
    margin-top: -5px;
    margin-bottom: 5px;
    animation: blink 1s ease-in-out infinite;
}

/* 図鑑 */
.tsukimono-encyclopedia {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px;
    box-sizing: border-box;
    overflow-y: auto;
    border-radius: 10px;
    color: #fff;
}

.tsukimono-encyclopedia h2 {
    margin: 0 0 5px;
    font-size: 1.3em;
}

.tsukimono-encyclopedia p {
    margin: 0 0 10px;
    color: #aaa;
    font-size: 0.9em;
}

.encyclopedia-close-btn {
    position: sticky;
    top: 0;
    align-self: flex-start;
    padding: 6px 16px;
    cursor: pointer;
    background-color: #555;
    color: #fff;
    border: 1px solid #888;
    border-radius: 5px;
    font-size: 0.85em;
    z-index: 1;
}

.encyclopedia-close-btn:hover {
    background-color: #666;
}

.encyclopedia-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 440px;
}

.encyclopedia-card {
    background-color: #222;
    border: 1px solid #555;
    border-radius: 5px;
    padding: 6px;
    text-align: center;
    font-size: 0.7em;
}

.encyclopedia-card.undiscovered {
    opacity: 0.4;
}

.encyclopedia-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.encyclopedia-unknown {
    width: 50px;
    height: 50px;
    line-height: 50px;
    margin: 0 auto;
    font-size: 2em;
    color: #888;
}

.encyclopedia-name {
    margin-top: 2px;
    font-weight: bold;
}

.encyclopedia-stats {
    color: #aaa;
    font-size: 0.85em;
}

.encyclopedia-card:not(.undiscovered) {
    cursor: pointer;
    transition: border-color 0.2s;
}

.encyclopedia-card:not(.undiscovered):hover {
    border-color: #fff;
}

.encyclopedia-detail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 95;
    border-radius: 10px;
}

.detail-content {
    text-align: center;
    padding: 20px;
    max-width: 300px;
}

.detail-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.detail-content h3 {
    margin: 10px 0 5px;
    font-size: 1.3em;
}

.detail-stats {
    color: #ccc;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.detail-type {
    color: #ccc;
    font-size: 0.85em;
    margin-bottom: 4px;
}

.detail-size {
    color: #999;
    font-size: 0.8em;
    margin-bottom: 8px;
}

.detail-desc {
    color: #ddd;
    font-size: 0.85em;
    line-height: 1.5;
    margin-top: 8px;
    text-align: left;
}

.detail-content button {
    margin-top: 15px;
    padding: 8px 30px;
    cursor: pointer;
    background-color: #555;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 5px;
}

.detail-content button:hover {
    background-color: #666;
}

.tsukimono-battle, .tsukimono-town {
    margin-top: 20px;
}

.tsukimono-battle {
    position: relative;
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('assets/dungeon-bg.jpg');
    background-size: 100% auto;
    background-position: top center;
    background-repeat: no-repeat;
    border-radius: 10px;
    padding: 15px;
}

.tsukimono-status {
    display: flex;
    justify-content: space-around;
    align-items: end;
    flex-wrap: wrap;
    max-width: 74%;
    margin: 10px auto;
    border: 2px solid #fff;
    border-radius: 10px;
    padding: 7px;
}

.tsukimono-status div {
    font-size: 14px;
}

.tsukimono-actions button {
    margin: 3px;
    padding: 5px 10px;
    background-color: #333;
    color: #ccc;
    border: 2px solid #888;
    border-radius: 5px;
    font-size: 14px;
}

.tsukimono-actions button:hover {
    background-color: #444;
    color: #fff;
    border-color: #aaa;
}

.tsukimono-actions {
    margin-top: 14px;
    line-height: 1.05em;
}

/* 逃げるボタン: 他のアクションと視覚的に分離 */
.escape-btn {
    background-color: transparent !important;
    color: #999 !important;
    border-color: #666 !important;
    margin-left: 10px !important;
}

.escape-btn:hover {
    color: #fff !important;
    border-color: #aaa !important;
}

.action-sub {
    font-size: 0.75em;
    opacity: 0.85;
}

.action-cost {
    font-size: 0.7em;
    opacity: 0.75;
}

.tsukimono-messages {
    height: 100px;
    overflow-y: auto;
    border: 2px solid #fff;
    padding: 10px;
    margin-top: 14px;
    background-color: #1a1a1a;
    border-radius: 10px;
}

.tsukimono-timer {
    font-size: 14px;
    margin-top: 10px;
    color: #fff;
}

.tsukimono-timer-container {
    width: 100%;
    background-color: #555;
    border-radius: 3px;
    margin-top: 10px;
    height: 8px;
    overflow: hidden;
    position: relative;
}

.tsukimono-timer-bar {
    height: 100%;
    background-color: #fff;
    width: 100%;
    transition: width 0.1s linear;
}

#tsukimono-timer {
    color: #555;
    position: absolute;
}

.tsukimono-title {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 10px;
    box-sizing: border-box;
}

.title-logo {
    font-size: 2.5em;
    color: #fff;
    margin-bottom: 30px;
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.4),
        0 0 30px rgba(255, 255, 255, 0.15),
        2px 2px 0 #333;
    letter-spacing: 0.1em;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.title-logo-img {
    max-width: 90%;
    max-height: 200px;
    object-fit: contain;
    margin-bottom: 24px;
}

.title-instructions {
    color: #aaa;
    margin-bottom: 30px;
    line-height: 1.8;
}

.tsukimono-start-btn {
    padding: 10px 40px;
    font-size: 1.2em;
    cursor: pointer;
    background-color: #555;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 5px;
}

.tsukimono-start-btn:hover {
    background-color: #666;
}

.result-score {
    font-size: 1.5em;
    margin: 10px 0;
}

.new-record {
    color: #ffdd00;
    font-size: 1.3em;
    font-weight: bold;
}

.tsukimono-gameover {
    display: none;
    background-color: rgba(17, 17, 17, 0.95);
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.tsukimono-gameclear {
    display: none;
    background-color: rgba(17, 17, 17, 0.95);
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.dungeon-clear-img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* チュートリアルオーバーレイ */
.tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 60;
    cursor: pointer;
    border-radius: 10px;
}

.tutorial-master-comment {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.tutorial-master-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.tutorial-master-bubble {
    background: #333;
    border: 2px solid #fff;
    border-radius: 10px;
    padding: 12px 16px;
    color: #e0e0e0;
    font-size: 0.9em;
    max-width: 380px;
    white-space: pre-line;
    line-height: 1.5;
}

.tutorial-tap-hint {
    color: #999;
    font-size: 0.75em;
    margin-top: 16px;
}

.tsukimono-gameover button,
.tsukimono-gameclear button {
    background-color: #555;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 5px;
    padding: 8px 24px;
    cursor: pointer;
    font-size: 0.95em;
}

.tsukimono-gameover button:hover,
.tsukimono-gameclear button:hover {
    background-color: #666;
}

#tsukimono-inputField {
    font-size: 16px;
    text-align: center;
    width: 60%;
    color: #333;
}

.floor-display, .high-score {
    position: absolute;
    top: 0;
    padding: 4px 18px;
    background-color: #111;
    color: #fff;
    border-radius: 10px;
}

.floor-display {
    left: 0;
}

.high-score {
    right: 0;
}

.bgm-toggle {
    position: absolute;
    top: -40px;
    right: 10px;
    width: 50px;
    height: 30px;
    border-radius: 34px;
    cursor: pointer;
    padding: 0;
}

.bgm-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.bgm-toggle .slider:before {
    content: "";
    position: absolute;
    height: 24px;
    width: 24px;
    bottom: 3px;
    left: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

.bgm-toggle.on .slider {
    background-color: #666;
}

.bgm-toggle.on .slider:before {
    transform: translateX(20px);
}

.bgm-text{
    display: grid;
    color: #333;
    width: 100%;
    position: absolute;
    right: 3.4em;
    top: 2px;
    font-size: 14px;
    justify-content: center;
    align-items: center;
}

/* 攻撃ボタン: Primary（入力確定の主操作） */
.tsukimono-attackButton {
    padding: 6px 20px;
    font-size: 14px;
    cursor: pointer;
    background-color: #555;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 5px;
    font-weight: bold;
}

.tsukimono-attackButton:hover {
    background-color: #666;
}

#tsukimono-typing {
    margin: 20px 0 20px 52px;
    position: relative;
}

.damage-popup-container {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 50;
}

.damage-popup {
    position: absolute;
    font-size: 1.4em;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(0,0,0,0.8), 0 0 2px rgba(0,0,0,0.9);
    animation: damage-popup-anim 1.2s ease-out forwards;
    white-space: nowrap;
}

.damage-popup.damage {
    color: #ff4444;
}

.damage-popup.heal {
    color: #44ff44;
}

.damage-popup.critical {
    color: #fff;
    font-size: 1.8em;
    text-shadow: 0 0 10px rgba(255,255,255,0.8), 0 0 4px rgba(255,255,255,0.9);
}

.damage-popup.enemy-damage {
    color: #fff;
}

@keyframes damage-popup-anim {
    0% { opacity: 1; transform: translateY(0); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-40px); }
}

hr.tsukimono-hr {
    border-bottom: 1px solid #fff;
    margin: 1em 0;
}

.tsukimono-status-map button {
    border-radius: 5px;
    font-size: 11px;
    padding: 0 6px;
    margin-left: 16px;
}

.hp-style {
    font-size: 1.2em !important;
}

.encounter-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

.encounter-effect.active {
    animation: encounter-animation 1s forwards;
}

@keyframes encounter-animation {
    0% {
        opacity: 0;
        background-size: 0% 0%;
    }
    50% {
        opacity: 1;
        background-size: 200% 200%;
    }
    100% {
        opacity: 1;
        background-size: 400% 400%;
    }
}

.clear-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ff0;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

.clear-effect.active {
    animation: clear-animation 240s forwards;
}


@keyframes clear-animation {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

#fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1000;
}

.firework {
    position: absolute;
    width: 5px;
    height: 5px;
    background-color: yellow;
    border-radius: 50%;
    animation: fireworks-animation 2s ease-out forwards;
}

@keyframes fireworks-animation {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(50);
        opacity: 0;
    }
}

/* ラスト階（10階）の演出 */
.tsukimono-game-container.last-floor {
    background-color: #0d0000;
    border-color: #8b0000;
    box-shadow: 0 0 30px rgba(139, 0, 0, 0.5), inset 0 0 20px rgba(139, 0, 0, 0.2);
}

.tsukimono-game-container.last-floor .tsukimono-status-map {
    border-color: #8b0000;
    background-color: #150505;
}

.tsukimono-game-container.last-floor .tsukimono-messages {
    background-color: #1a0005;
    border-color: #8b0000;
}

.tsukimono-game-container.last-floor .floor-display {
    color: #ff4444;
    background-color: #1a0005;
}

/* HPピンチ演出 */
.tsukimono-game-container.hp-caution {
    border-color: #ffdd00;
    box-shadow: 0 0 15px rgba(255, 221, 0, 0.3), inset 0 0 10px rgba(255, 221, 0, 0.1);
}

.tsukimono-game-container.hp-caution .tsukimono-status {
    border-color: #ffdd00;
}

.tsukimono-game-container.hp-caution .tsukimono-messages {
    border-color: #ffdd00;
}

.tsukimono-game-container.hp-danger {
    border-color: #ff8800;
    box-shadow: 0 0 25px rgba(255, 136, 0, 0.4), inset 0 0 15px rgba(255, 136, 0, 0.15);
}

.tsukimono-game-container.hp-danger .tsukimono-status {
    border-color: #ff8800;
}

.tsukimono-game-container.hp-danger .tsukimono-messages {
    border-color: #ff8800;
}

/* 攻撃エフェクト（敵が被弾 - 点滅） */
.attack-flash {
    animation: attack-flash-anim 0.5s steps(1) forwards;
}

@keyframes attack-flash-anim {
    0% { opacity: 1; }
    10% { opacity: 0.1; }
    20% { opacity: 1; }
    30% { opacity: 0.1; }
    40% { opacity: 1; }
    50% { opacity: 0.1; }
    60% { opacity: 1; }
    70% { opacity: 0.1; }
    80% { opacity: 1; }
    100% { opacity: 1; }
}

.damage-flash::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
    animation: damage-flash-anim 0.4s ease-out forwards;
}

@keyframes damage-flash-anim {
    0% { background-color: rgba(255, 0, 0, 0.4); }
    100% { background-color: transparent; }
}

.screen-shake {
    animation: screen-shake-anim 0.3s ease-out;
}

@keyframes screen-shake-anim {
    0% { transform: translate(0, 0); }
    15% { transform: translate(-6px, 3px); }
    30% { transform: translate(5px, -4px); }
    45% { transform: translate(-4px, 2px); }
    60% { transform: translate(3px, -2px); }
    75% { transform: translate(-2px, 1px); }
    100% { transform: translate(0, 0); }
}

/* クリティカルフラッシュ */
.critical-flash::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
    animation: critical-flash-anim 0.4s ease-out forwards;
}

@keyframes critical-flash-anim {
    0% { background-color: rgba(255, 220, 50, 0.5); }
    100% { background-color: transparent; }
}

/* 撃破エフェクト */
.defeat-anim {
    animation: defeat-anim 0.8s ease-in forwards;
}

@keyframes defeat-anim {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
    100% { opacity: 0; transform: scale(0.3) rotate(15deg); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ターン表示 */
.turn-indicator {
    text-align: center;
    font-size: 13px;
    color: #aaa;
    margin: 4px 0;
    min-height: 18px;
}

.turn-indicator.player-turn {
    color: #fff;
}

.turn-indicator.enemy-turn {
    color: #999;
}

/* ==========================
 * 修行モード・背景選択
 * ========================== */

.title-buttons {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.training-btn {
    background-color: #555;
}

.training-btn:hover {
    background-color: #666;
}

.great-adventure-btn {
    background-color: #8b4513;
    border-color: #d4a030;
    color: #ffd700;
}

.great-adventure-btn:hover {
    background-color: #a0522d;
}

.continue-btn {
    background-color: #336;
    border-color: #66a;
}

.continue-btn:hover {
    background-color: #448;
}

.save-load-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    z-index: 110;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px;
    box-sizing: border-box;
    border-radius: 10px;
    color: #fff;
}

.save-load-screen h2 {
    margin: 0 0 15px;
    font-size: 1.3em;
}

.save-load-close-btn {
    align-self: flex-start;
    padding: 6px 16px;
    cursor: pointer;
    background-color: #555;
    color: #fff;
    border: 1px solid #888;
    border-radius: 5px;
    font-size: 0.85em;
    margin-bottom: 10px;
}

.save-load-close-btn:hover {
    background-color: #666;
}

.save-slot-list {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.save-slot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #222;
    border: 1px solid #555;
    border-radius: 5px;
    cursor: pointer;
}

.save-slot:hover {
    background-color: #333;
    border-color: #888;
}

.save-slot-label {
    font-weight: bold;
    font-size: 0.95em;
}

.save-slot-info {
    color: #aaa;
    font-size: 0.85em;
}

#save-slot-auto {
    border-color: #444;
    opacity: 0.7;
    cursor: default;
}

#save-slot-auto:hover {
    background-color: #222;
    border-color: #444;
}

.great-adventure-unlock {
    color: #ffd700;
    font-size: 1.1em;
    font-weight: bold;
    margin: 10px 0;
}

.title-sub-btn {
    padding: 8px 24px;
    font-size: 0.9em;
    cursor: pointer;
    background-color: transparent;
    color: #aaa;
    border: 1px solid #666;
    border-radius: 5px;
    margin-top: 10px;
}

.title-sub-btn:hover {
    color: #fff;
    border-color: #aaa;
}

#btn-bg-select {
    background-color: rgba(34, 34, 34, 0.8);
    color: #ccc;
}

/* 修行設定画面 */
.training-setup {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    background-image: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)), url('assets/doujou-bg.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 10px;
    box-sizing: border-box;
    padding: 20px;
    gap: 12px;
}

/* もどるボタンを左上に小さく配置 */
.training-setup > .title-sub-btn:last-child {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    font-size: 0.75em;
    margin-top: 0;
}

.training-master-intro {
    color: #aaa;
    margin-bottom: 4px;
}

/* タブコンテンツの固定高さコンテナ */
.training-tab-content {
    min-height: 220px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* Primaryボタン(修行開始)とサブボタン(もどる)の分離 */
.training-setup .tsukimono-start-btn {
    margin-bottom: 6px;
}

.training-difficulty {
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: center;
    gap: 6px;
}

.training-difficulty p {
    grid-column: 1 / -1;
    text-align: center;
    color: #ccc;
    margin-bottom: 2px;
    font-size: 0.9em;
}

.training-difficulty button {
    padding: 6px 14px;
    font-size: 0.85em;
    cursor: pointer;
    background-color: #333;
    color: #ccc;
    border: 1px solid #555;
    border-radius: 5px;
}

.training-difficulty button:hover {
    background-color: #444;
    color: #fff;
}

.training-difficulty button.selected {
    background-color: #fff;
    color: #000;
    border-color: #fff;
}

/* 修行結果画面 */
.training-result {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 10px;
    box-sizing: border-box;
    padding: 20px;
    gap: 12px;
}

/* タイトルに戻るボタンを左上に小さく配置 */
.training-result > .title-sub-btn:last-child {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    font-size: 0.75em;
    margin-top: 0;
}

.training-result h2 {
    font-size: 1.5em;
    color: #fff;
}

/* 師匠コメント */
.training-master-comment {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 4px;
}

.training-master-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex-shrink: 0;
}

.training-master-bubble {
    position: relative;
    background-color: #222;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.95em;
    color: #e0e0e0;
    max-width: 240px;
}

.training-master-bubble::before {
    content: "";
    position: absolute;
    left: -8px;
    bottom: 12px;
    border-width: 6px 8px 6px 0;
    border-style: solid;
    border-color: transparent #555 transparent transparent;
}

.training-master-bubble::after {
    content: "";
    position: absolute;
    left: -6px;
    bottom: 13px;
    border-width: 5px 7px 5px 0;
    border-style: solid;
    border-color: transparent #222 transparent transparent;
}

/* Primaryボタン(もう一度)とサブボタンの間に余白 */
.training-result .tsukimono-start-btn {
    margin-bottom: 8px;
}

.result-stats {
    text-align: center;
    line-height: 2;
}

.result-stats p {
    font-size: 1.1em;
}

#training-unlock-msg {
    color: #ffdd00;
    font-size: 1.2em;
    padding: 10px;
    text-align: center;
}

/* 修行中の全体タイマー・スコア・コンボ */
.training-global-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 1.3em;
    padding: 6px 10px;
    color: #fff;
}

.training-global-timer.time-danger #training-time-left {
    color: #ff4444;
    animation: blink 0.5s infinite;
}

.training-live-score {
    color: #fff;
    font-size: 0.9em;
}

.training-combo {
    color: #ffcc00;
    font-size: 0.85em;
    font-weight: bold;
}

.training-progress {
    color: #aaa;
    font-size: 0.75em;
}

.combo-pulse {
    animation: combo-pulse-anim 0.4s ease-out;
}

@keyframes combo-pulse-anim {
    0% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* 修行ポップアップ */
.damage-popup.training-point {
    color: #fff;
}

.damage-popup.training-miss {
    color: #999;
    font-size: 1.2em;
}

/* 修行モード選択 */
.training-mode-select {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.training-mode-btn {
    padding: 8px 20px;
    border: 2px solid #555;
    border-radius: 5px;
    background-color: #333;
    color: #aaa;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.training-mode-btn:hover {
    background-color: #444;
    color: #fff;
}

.training-mode-btn.selected {
    background-color: #fff;
    color: #000;
    border-color: #fff;
}

/* 修行中やめるボタン */
.training-quit-btn {
    padding: 2px 12px;
    border: 1px solid #888;
    border-radius: 5px;
    background-color: transparent;
    color: #aaa;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s;
}

.training-quit-btn:hover {
    background-color: #555;
    color: #fff;
    border-color: #aaa;
}

/* 冒険中タイトルに戻るボタン */
.quit-adventure-btn {
    font-size: 0.75rem;
    color: #aaa;
    background: transparent;
    border: 1px solid #666;
    padding: 3px 8px;
    border-radius: 5px;
    cursor: pointer;
}

.quit-adventure-btn:hover {
    color: #fff;
    border-color: #aaa;
}

/* 確認パネル */
.confirm-panel {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.confirm-panel-inner {
    background: #222;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 24px 32px;
    text-align: center;
    color: #ddd;
    white-space: pre-line;
}

.confirm-panel-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.confirm-btn-yes,
.confirm-btn-no {
    padding: 8px 24px;
    border-radius: 5px;
    border: 1px solid #666;
    font-size: 0.95rem;
    cursor: pointer;
}

.confirm-btn-yes {
    background: #555;
    color: #fff;
    border-color: #fff;
}

.confirm-btn-yes:hover {
    background: #666;
}

.confirm-btn-no {
    background: #444;
    color: #ccc;
}

.confirm-btn-no:hover {
    background: #555;
    color: #fff;
}

/* 全体タイマーバー */
.training-global-bar-container {
    position: absolute;
    top: 0;
    left: 2px;
    width: calc(100% - 4px);
    height: 4px;
    background-color: #333;
    z-index: 100;
    border-radius: 10px;
}

.training-global-bar {
    width: 100%;
    height: 100%;
    background-color: #85b1d5;
    transition: width 1s linear;
}

/* 本修行設定画面の報酬表示 */
.hard-training-info {
    text-align: center;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hard-training-desc {
    color: #ccc;
    margin-bottom: 8px;
}

.hard-training-highscore {
    color: #fff;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.hard-training-rewards {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.reward-item {
    text-align: center;
    width: 80px;
}

.reward-preview {
    width: 80px;
    height: 50px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    border: 1px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    color: #666;
    position: relative;
}

.reward-preview.reward-unlocked::after {
    content: "";
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    background-image: url('assets/zumi-hanko.png');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0.6;
}

.reward-locked {
    background-color: #222;
}

.reward-label {
    font-size: 0.7em;
    color: #aaa;
    margin-top: 4px;
}

/* 背景選択画面 */
.bg-select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 10px;
    box-sizing: border-box;
    gap: 15px;
}

.bg-select h2 {
    font-size: 1.5em;
    color: #fff;
}

.bg-select-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.bg-card {
    width: 140px;
    cursor: pointer;
    border: 2px solid #555;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.bg-card.unlocked:hover {
    border-color: #fff;
}

.bg-card.selected {
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.bg-card.locked {
    opacity: 0.5;
    cursor: default;
}

.bg-card-preview {
    width: 100%;
    height: 80px;
    background-size: cover;
    background-position: center;
}

.bg-card-preview.locked-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #222;
    font-size: 1.5em;
    color: #666;
}

.bg-card-name {
    text-align: center;
    padding: 6px;
    font-size: 0.8em;
    color: #ccc;
}

/* 修行クリア済みマーク（済みハンコ） */
#training-difficulty-section button.training-cleared {
    position: relative;
}

#training-difficulty-section button.training-cleared::after {
    content: "";
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    background-image: url('assets/zumi-hanko.png');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0.6;
}

/* 修行クリアメッセージ */
.training-clear-msg {
    color: #999;
    font-size: 0.9em;
    margin-top: 4px;
}

/* 修行タブ報酬セクション */
.training-rewards-section {
    margin-top: 8px;
}

/* 裏モードタブ */
.training-mode-ura {
    background-color: #333;
    border-color: #555;
}

.training-mode-ura.selected {
    background-color: #fff;
    border-color: #fff;
    color: #000;
}

/* 裏モード情報 */
.ura-mode-info {
    text-align: center;
    padding: 10px 0;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ura-mode-locked {
    color: #999;
    font-size: 1em;
    padding: 20px 0;
}

.ura-mode-unlocked {
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ura-mode-desc {
    margin-bottom: 10px;
    font-size: 0.95em;
    color: #ccc;
}

/* ジャンル選択画面 */
.pack-select-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    z-index: 100;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
    box-sizing: border-box;
    border-radius: 10px;
    color: #fff;
}

.pack-select-screen h2 {
    margin: 0 0 20px;
    font-size: 1.3em;
}

.pack-select-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 360px;
    margin-bottom: 24px;
}

.pack-card {
    padding: 16px 12px;
    background-color: #333;
    border: 2px solid #666;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s, background-color 0.2s;
}

.pack-card:hover {
    background-color: #444;
    border-color: #aaa;
}

.pack-card-selected {
    border-color: #fff;
    background-color: #555;
}

.pack-card-name {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 6px;
}

.pack-card-desc {
    font-size: 0.8em;
    color: #aaa;
}

.pack-card-selected .pack-card-desc {
    color: #ccc;
}

.pack-select-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 360px;
}

/* もどるボタン: 左上に小さく配置（修行画面と同じパターン） */
.pack-select-back-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    font-size: 0.75em;
    cursor: pointer;
    background-color: transparent;
    color: #aaa;
    border: 1px solid #666;
    border-radius: 5px;
}

.pack-select-back-btn:hover {
    color: #fff;
    border-color: #aaa;
}
