/* 基本設定 */
body {
    font-family: sans-serif;
    background-color: #333;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

#game-board {
    width: 1000px;
    height: 700px;
    background-color: #444;
    border: 2px solid #888;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

/* プレイヤーエリア */
.player-area {
    flex: 1;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s;
}
.player-area.inactive {
    background-color: rgba(0, 0, 0, 0.4);
}

.stats-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}
.stats span {
    margin-left: 15px;
    font-size: 1.1em;
    font-weight: bold;
}
.deck-info {
    text-align: right;
    padding: 0 10px;
    font-size: 0.9em;
    color: #ccc;
}
.deck-info span {
    margin-left: 10px;
}

/* 手札エリア */
.hand {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    min-height: 120px;
}

/* カードのデザイン */
.card {
    width: 80px;
    height: 110px;
    background-color: #2c3e50;
    border: 2px solid #7f8c8d;
    border-radius: 6px;
    padding: 8px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
}
.card:hover {
    transform: translateY(-10px) scale(1.1);
    box-shadow: 0 0 15px #f1c40f;
    border-color: #f1c40f;
}
.card.playable {
    border-color: #2ecc71;
}

.card-name {
    font-weight: bold;
    font-size: 13px;
    border-bottom: 1px solid #7f8c8d;
    padding-bottom: 4px;
}

.card-stats {
    flex-grow: 1; /* 残りのスペースを埋める */
    display: flex;
    flex-direction: column; /* 情報を縦に並べる */
    justify-content: center; /* 縦方向の中央に配置 */
    gap: 4px; /* 各情報の間隔 */
}

/* 各情報の行のスタイル */
.stat {
    width: 100%;
    display: flex;
    justify-content: space-between; /* 名前を左、値を右に配置 */
    align-items: baseline; /* テキストの下端を揃える */
    font-weight: bold;
    font-size: 1.1em;
}

/* 情報名（例: "帯:", "C:"）のスタイル */
.stat-name {
    color: #bdc3c7; /* 少し薄い色 */
    font-size: 0.9em;
}

/* 情報の値（例: "2", "3"）のスタイル */
.stat-value {
    color: #f1c40f; /* 強調する黄色 */
    font-size: 1.2em;
}
.card.opponent-card {
    background-color: #594535;
    cursor: default;
}
.card.opponent-card:hover {
    transform: none;
    box-shadow: none;
    border-color: #7f8c8d;
}


/* 中央エリア */
#center-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}
#game-log {
    width: 80%;
    height: 80px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid #666;
    border-radius: 4px;
    overflow-y: scroll;
    padding: 5px;
    font-size: 0.9em;
}
#game-log p {
    margin: 2px 0;
}
#game-log .log-player { color: #87CEFA; } /* 水色 */
#game-log .log-opponent { color: #F08080; } /* 明るい赤色 */
#game-log .log-system { color: #F1C40F; font-weight: bold;} /* 黄色 */
#end-turn-btn {
    padding: 15px 25px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    border: none;
    background-color: #e74c3c;
    color: white;
}
#end-turn-btn:disabled {
    background-color: #777;
    cursor: not-allowed;
}

/* ゲームオーバー画面 */
#game-over-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.85);
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #fff;
}
#restart-btn {
    padding: 10px 20px;
    font-size: 1em;
    margin-top: 10px;
    cursor: pointer;
}
.hidden {
    display: none !important;
}
.params-container {
    display: flex;
    gap: 15px;
}
.param {
    font-size: 1.1em;
    font-weight: bold;
}
/* style.css の末尾に追加 */

/* --- ツールチップのスタイル --- */
.has-tooltip {
    position: relative; /* ツールチップの基準点となる */
    cursor: help;
}

/* 吹き出し本体 */
.has-tooltip::after {
    content: attr(data-description); /* data-description属性の内容を表示 */
    position: absolute;
    bottom: 110%; /* 要素の上側に表示 */
    left: 50%;
    transform: translateX(-50%);
    
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #ddd;
    font-size: 14px;
    line-height: 1.4;
    width: 200px; /* 吹き出しの幅を固定 */
    text-align: center;
    
    /* 最初は隠しておく */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 10;
}

/* 吹き出しの矢印部分 */
.has-tooltip::before {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translate(-50%, 12px); /* 吹き出し本体の下に配置 */

    border: 8px solid transparent;
    border-top-color: #ddd; /* 吹き出しの枠線の色と合わせる */

    /* 最初は隠しておく */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 10;
}


/* ホバー時にツールチップを表示 */
.has-tooltip:hover::after,
.has-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* カード専用のツールチップ位置調整 */
.card.has-tooltip::after,
.card.has-tooltip::before {
    bottom: 105%; /* カードの上部ギリギリに表示 */
}