/* ゲーム開始画面 */
.start-container {
    text-align: center;
    background: rgba(255,255,255,0.95);
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    position: relative;
}

/* マリガン画面 */
.mulligan-container {
    text-align: center;
    background: rgba(255,255,255,0.95);
    padding: 24px 20px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    max-width: 800px;
    width: 90%;
}

.mulligan-title {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 12px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.mulligan-description {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 16px;
    line-height: 1.6;
}

.mulligan-hand {
    margin: 12px 0;
    display: flex;
    justify-content: center;
    overflow: visible;
}

.mulligan-hand .card { position: relative; z-index: 1; }
.mulligan-hand .card.place-selected { z-index: 10; }

.mulligan-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 12px 0;
}

.mulligan-info {
    font-size: 1.1em;
    color: #666;
    margin-top: 20px;
    padding: 10px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 8px;
}

.online-mulligan-status {
    margin: 14px auto 0;
    max-width: 560px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.08);
    color: #111827;
    font-weight: 700;
    line-height: 1.4;
}

/* 先行決定画面 */
.first-player-container {
    text-align: center;
    background: rgba(255,255,255,0.95);
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 90%;
}

.first-player-title {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.first-player-description {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 40px;
    line-height: 1.6;
}

.first-player-cards {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
}

.first-player-card {
    width: 120px;
    height: 180px;
    cursor: pointer;
    perspective: 1000px;
    transition: transform 0.3s ease;
}

.first-player-card:hover {
    transform: translateY(-10px);
}

.first-player-card.selected {
    transform: translateY(-10px) scale(1.05);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.first-player-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: bold;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.card-front {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

.card-back {
    background: white;
    color: #2c3e50;
    transform: rotateY(180deg);
    border: 2px solid #3498db;
}

/* 結果表示 */
.first-player-result {
    margin-top: 40px;
}

.result-cards {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin-bottom: 30px;
}

.result-card {
    text-align: center;
}

.result-card .card-inner {
    width: 100px;
    height: 150px;
    margin: 0 auto 10px;
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.result-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.result-card .card-front,
.result-card .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.result-card .card-front {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    font-size: 2em;
    font-weight: bold;
}

.result-card .card-back {
    background: white !important;
    color: #2c3e50;
    font-size: 3em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #3498db;
    text-align: center;
    line-height: 1;
    transform: rotateY(180deg);
}

.result-vs {
    font-size: 2em;
    font-weight: bold;
    color: #e74c3c;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.card-label {
    font-size: 1.1em;
    font-weight: bold;
    color: #2c3e50;
}

.result-message {
    font-size: 1.5em;
    font-weight: bold;
    color: #27ae60;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    animation: resultMessageGlow 1s ease-in-out infinite alternate;
}

@keyframes resultMessageGlow {
    from {
        text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    }
    to {
        text-shadow: 0 0 10px rgba(39, 174, 96, 0.5);
    }
}

.game-title {
    font-size: 3em;
    color: #2c3e50;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    animation: titleGlow 2s ease-in-out infinite alternate;
}

/* タイトル画面のテストプレイボタン */
.test-play-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(52, 152, 219, 0.8);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.test-play-btn:hover {
    background: rgba(52, 152, 219, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.test-play-btn:active {
    transform: translateY(0);
}

@keyframes titleGlow {
    from { text-shadow: 2px 2px 4px rgba(0,0,0,0.1); }
    to { text-shadow: 2px 2px 20px rgba(52, 152, 219, 0.5); }
}

.card-animation {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin: 40px 0;
    height: 120px;
    position: relative;
    transform: translateY(-5px);
}

.floating-card {
    width: 60px;
    height: 90px;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.4em;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    position: absolute;
    bottom: 35px;
    transform-origin: bottom center;
    transition: all 0.3s ease;
}

/* 扇型配置 - 各カードを異なる角度で配置 */
.floating-card:nth-child(1) {
    transform: rotate(-20deg) translateX(-120px);
    background: linear-gradient(45deg, #3498db, #2980b9);
    z-index: 1;
}

.floating-card:nth-child(2) {
    transform: rotate(-10deg) translateX(-60px);
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    z-index: 2;
}

.floating-card:nth-child(3) {
    transform: rotate(0deg) translateX(0px);
    background: linear-gradient(45deg, #f39c12, #e67e22);
    z-index: 3;
}

.floating-card:nth-child(4) {
    transform: rotate(10deg) translateX(60px);
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    z-index: 2;
}

.floating-card:nth-child(5) {
    transform: rotate(20deg) translateX(120px);
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    z-index: 1;
}

/* ホバー効果 */
.floating-card:hover {
    transform: scale(1.1) rotate(0deg) translateY(-10px);
    z-index: 10;
    box-shadow: 0 12px 24px rgba(0,0,0,0.3);
}

/* 軽い揺れアニメーション */
@keyframes gentleSway {
    0%, 100% { transform: rotate(var(--rotation)) translateX(var(--translation)) translateY(0px); }
    50% { transform: rotate(var(--rotation)) translateX(var(--translation)) translateY(-5px); }
}

.floating-card:nth-child(1) {
    --rotation: -20deg;
    --translation: -120px;
    animation: gentleSway 3s ease-in-out infinite;
}

.floating-card:nth-child(2) {
    --rotation: -10deg;
    --translation: -60px;
    animation: gentleSway 3s ease-in-out infinite 0.5s;
}

.floating-card:nth-child(3) {
    --rotation: 0deg;
    --translation: 0px;
    animation: gentleSway 3s ease-in-out infinite 1s;
}

.floating-card:nth-child(4) {
    --rotation: 10deg;
    --translation: 60px;
    animation: gentleSway 3s ease-in-out infinite 1.5s;
}

.floating-card:nth-child(5) {
    --rotation: 20deg;
    --translation: 120px;
    animation: gentleSway 3s ease-in-out infinite 2s;
}

.game-description {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 40px;
    line-height: 1.6;
}

.start-btn {
    padding: 20px 40px;
    font-size: 1.5em;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.start-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 24px rgba(0,0,0,0.3);
}

/* ゲーム終了画面 */
.end-container {
    text-align: center;
    background: rgba(255,255,255,0.95);
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
}

.end-title {
    font-size: 2.5em;
    color: #e74c3c;
    margin-bottom: 30px;
    animation: endTitleGlow 1s ease-in-out infinite alternate;
}

@keyframes endTitleGlow {
    from { text-shadow: 2px 2px 4px rgba(231, 76, 60, 0.3); }
    to { text-shadow: 2px 2px 20px rgba(231, 76, 60, 0.8); }
}

.end-message {
    font-size: clamp(2rem, 5.2vw, 3.4rem);
    font-weight: 900;
    line-height: 1.08;
    color: #2c3e50;
    margin-bottom: 30px;
    padding: 8px 10px 18px;
    background: transparent;
    border-radius: 0;
    text-shadow: 0 4px 16px rgba(44, 62, 80, 0.18);
    white-space: nowrap;
}

.end-message.end-result-win {
    color: #d97706;
}

.end-message.end-result-lose {
    color: #475569;
}

.end-message.end-result-draw {
    color: #2563eb;
}

.end-stats {
    display: none;
    justify-content: space-around;
    margin: 30px 0;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: #2c3e50;
}

.end-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.restart-btn, .menu-btn {
    padding: 15px 30px;
    font-size: 1.2em;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.restart-btn {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.menu-btn {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    color: white;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.restart-btn:hover, .menu-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}
