/* 基本設定 */
:root {
    --bg-color: #1a1a2e;
    --card-bg: #f5f5dc;
    --card-border: #333;
    --text-color: #e0e0e0;
    --primary-color: #e94560;
    --secondary-color: #0f3460;
    --cpu-color: #4a4e69;
    --user-color: #162447;
    --field-bg: #2a2a4a;
    --highlight: #ffd700;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

.game-container {
    width: 100%;
    max-width: 900px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    padding: 10px;
    box-sizing: border-box;
}

/* プレイヤーエリア */
.player-area {
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.05);
}

.opponent-area {
    align-items: flex-start;
}

.user-area {
    align-items: flex-end;
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 5px;
}

.player-info h2 {
    margin: 0;
    font-size: 1.2rem;
}

.score {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--highlight);
}

/* 獲得札エリア */
.captured-area {
    width: 100%;
    min-height: 50px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    display: flex;
    padding: 5px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.captured-title {
    font-size: 0.8rem;
    margin-right: 10px;
    opacity: 0.7;
}

.captured-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.captured-cards .card {
    width: 30px;
    height: 45px;
    font-size: 0.6rem;
}

/* 手札・場札エリア */
.hand,
.field {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 90px;
}

.field-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--field-bg);
    border-radius: 10px;
    margin: 10px 0;
    padding: 20px;
    position: relative;
}

.deck-area {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.deck {
    width: 60px;
    height: 90px;
    background-color: var(--primary-color);
    border: 2px solid white;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    cursor: default;
}

/* カードのデザイン */
.card {
    width: 60px;
    height: 90px;
    background-color: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #333;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 2px 7px 10px rgba(0, 0, 0, 0.5);
}

.card.selected {
    border-color: var(--highlight);
    box-shadow: 0 0 10px var(--highlight);
    transform: translateY(-10px);
}

.card.hidden-card {
    background-color: var(--primary-color);
    border-color: white;
    color: transparent;
    cursor: default;
}

.card.hidden-card:hover {
    transform: none;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.card .month {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.6rem;
    color: #666;
    background: rgba(255, 255, 255, 0.7);
    padding: 1px 3px;
    border-radius: 3px;
    z-index: 2;
}

.card .picture {
    font-size: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.card .type {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.6rem;
    font-weight: bold;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    padding: 1px 3px;
    border-radius: 3px;
    z-index: 2;
}

/* 種類別のスタイル */
.type-hikari {
    background: linear-gradient(135deg, #fff9e6, #ffd700);
    border-color: gold;
}

.type-tane {
    background: linear-gradient(135deg, #ffe6e6, #ff9999);
    border-color: crimson;
}

.type-tanzaku {
    background: linear-gradient(135deg, #e6e6ff, #9999ff);
    border-color: blue;
}

.type-kasu {
    background-color: #f0f0f0;
    border-color: #888;
}

/* アクションメッセージ */
.action-message {
    position: absolute;
    font-weight: bold;
    color: var(--highlight);
    text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.action-message.show {
    opacity: 1;
}

/* オーバーレイ＆モーダル */
.overlay,
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* 0.85から0.5に変更して背景のカードを見えるように */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.hidden,
.modal.hidden {
    display: none;
}

.overlay-content,
.modal-content {
    background-color: var(--secondary-color);
    padding: 25px 40px;
    /* パディングを少し減らして小さく */
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--primary-color);
    max-width: 80%;
    /* 幅を制限 */
}

.game-title {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-shadow: 2px 2px 0px white;
}

.btn {
    padding: 10px 20px;
    font-size: 1.2rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    margin: 5px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #ff5c77;
}

.btn-danger {
    background-color: #cc0000;
    color: white;
}

.btn-danger:hover {
    background-color: #ff3333;
}

.btn-large {
    font-size: 1.5rem;
    padding: 15px 30px;
    margin-top: 20px;
}

/* Home Link */
.home-link {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #888;
    text-decoration: none;
    font-size: 1rem;
    font-family: sans-serif;
    border: none;
    padding: 8px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
    z-index: 1000;
}

.home-link svg {
    stroke: var(--text-color);
    transition: stroke 0.3s ease;
}

.home-link:hover {
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.1);
}

.home-link:hover svg {
    stroke: #fff;
}