/* 全体のスクロールを強制的に解放 */
html {
    height: auto !important;
    overflow-y: auto !important; /* 縦スクロールを常に許可 */
}

body {
    height: auto !important;
    overflow-y: auto !important;
    background-color: #0d0d0d;
    color: #e0e0e0;
    font-family: 'Hiragino Kaku Gothic ProN', sans-serif;
    margin: 0;
    padding-bottom: 80px; /* 下部に余白を持たせてスクロールしやすくする */
}

/* ゲームコンテナ：高さ固定を解除 */
#game-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 10px;
    background: #1a1a1a;
    border: 2px solid #332a1e;
    
    /* 重要な修正点 */
    height: auto !important;
    min-height: 100vh; /* 最低でも画面いっぱいの高さにする */
    overflow: visible !important; /* 中身がはみ出ても隠さない */
}

/* アコーディオンパネル：高さ制限をかけない */
/* パネルの基本状態（閉じている時） */
.panel {
    background-color: #111;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    /* cubic-bezierを使うと、重厚感のある「スッ…」とした動きになります */
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s ease, 
                padding 0.4s ease;
    border: 1px solid transparent;
    padding: 0 15px;
    box-sizing: border-box;
}

.panel.is-open {
    opacity: 1;
    padding: 15px;
    border-color: #333;
}

/* --- 以下、見た目の調整 --- */

.main-title {
    text-align: center;
    color: #d4af37;
    text-shadow: 2px 2px 4px #000;
    margin: 20px 0;
}

.menu-btn {
    width: 100%;
    padding: 15px;
    background-color: #262626;
    color: #d4af37;
    border: 1px solid #4a3c28;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 8px;
    font-weight: bold;
}

.menu-btn.active {
    background-color: #333;
    border-color: #d4af37;
}

.sub-btn, .start-action-btn {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    background: #332a1e;
    color: #d4af37;
    border: 1px solid #d4af37;
    cursor: pointer;
    font-weight: bold;
}

.start-action-btn {
    background: #5e0000;
    color: white;
}

/* style.css の該当箇所を上書き */

#game-controls {
    text-align: center; /* 中央寄せ */
    margin-top: 20px;
    padding-bottom: 50px;
}

.control-row {
    display: flex;
    justify-content: center; /* ボタンを中央に揃える */
    gap: 10px; /* ボタン同士の間隔 */
}

.ctrl-btn {
    width: 80px;  /* サイズを大きく（前回より少し大きめ） */
    height: 80px; /* サイズを大きく */
    font-size: 2rem; /* 矢印を大きく */
    background: #222;
    color: #d4af37;
    border: 2px solid #4a3c28;
    border-radius: 12px;
    margin: 5px;
    cursor: pointer;
    touch-action: manipulation; /* スマホのダブルタップズームを防止 */
}

.ctrl-btn:active {
    background: #444; /* 押した時の反応 */
}

/* style.css */

.canvas-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

#dungeon-canvas {
    display: block;
    margin: 15px auto;
    background: #000;
    border: 4px solid #4a3c28;
    
    /* これらが重要：ブラウザの標準挙動を完全にシャットアウト */
    touch-action: none !important;      /* ズーム・スクロール禁止 */
    -webkit-user-select: none !important; /* テキスト選択禁止 */
    -webkit-touch-callout: none !important; /* 長押しメニュー禁止 */
    user-select: none !important;
    
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
    cursor: pointer;
}

/* 選択中のカードを目立たせる */
.card-thumb.selected {
    border: 2px solid #ffcc00;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.7);
    transform: translateY(-5px);
}

/* 小さなインフォメーション */
.small-info {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 10px;
}

/* 披露用ボタン */
.sub-btn {
    background: #4a3c2c;
    color: #d4af37;
    border: 1px solid #d4af37;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.sub-btn:hover {
    background: #d4af37;
    color: #111;
}

.card-action-area {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* 披露ボタンを少し豪華に */
.card-action-area .sub-btn {
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    border: none;
}

.showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 10px 0;
}

.showcase-item {
    background: #222;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #444;
    text-align: center;
}

.showcase-owner {
    font-size: 0.7rem;
    color: #d4af37;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.remove-btn {
    margin-top: 8px;
    background: #600;
    color: #fff;
    border: none;
    padding: 4px 8px;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 4px;
    width: 100%;
}

.remove-btn:hover {
    background: #a00;
}

canvas {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    -webkit-touch-callout: none;
    outline: none;
}

/* クイズ回答ボタンの高さ調整 */
#answer-buttons button {
    padding: 10px 10px; /* 上下の余白を15pxに設定（以前の約1.5倍の高さ感） */
    margin: 3px 0;      /* ボタン同士の間隔を少し広げて押しやすく */
    width: 100%;        /* 横幅いっぱいに広げる */
    cursor: pointer;
    font-size: 1rem;    /* 文字サイズは標準を維持 */
}

#quiz-history {
    height: 150px;       /* ログを表示するエリアの高さ */
    overflow-y: auto;    /* 縦に溢れたらスクロールバーを出す */
    padding: 10px;
    background: rgba(0, 0, 0, 0.5); /* 背景を少し暗くすると見やすいです */
    border-radius: 5px;
}

/* アコーディオンの中のボタンエリア */
.trade-menu-buttons {
    display: flex;
    gap: 10px;
    padding: 15px 10px;
    justify-content: center;
}

/* トレード用サブボタンの装飾 */
.trade-menu-buttons .sub-btn {
    flex: 1;
    background: linear-gradient(145deg, #222, #000); /* 黒グラデーション */
    color: #d4af37; /* ゴールド文字 */
    border: 1px solid #d4af37; /* 金枠 */
    padding: 12px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Hiragino Kaku Gothic ProN', sans-serif;
    transition: all 0.2s;
}

.trade-menu-buttons .sub-btn:hover {
    background: #333;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* 一覧表示エリアの余白 */
#trade-display-area {
    padding: 10px 0;
    min-height: 50px;
}

/* 空の状態のメッセージ */
.empty-msg {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    padding: 20px;
}