/* チェス スタイルシート */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
}

.game-container {
    max-width: 950px;
    margin: 0 auto;
    padding: 20px;
}

/* ヘッダー */
.game-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 100;
}

.game-header h1 {
    font-size: 1.8rem;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.home-link {
    color: #fff;
    text-decoration: none;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.home-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.1rem;
}

/* モード選択ドロップダウン */
.mode-dropdown {
    position: relative;
    display: inline-block;
}

.mode-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: rgba(30, 30, 50, 0.98);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    margin-top: 8px;
    padding: 8px 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mode-dropdown-content.show {
    display: block;
}

.dropdown-section {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-section:last-child {
    border-bottom: none;
}

.dropdown-title {
    padding: 8px 16px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: #fff;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dropdown-item.active {
    background: rgba(102, 126, 234, 0.3);
    color: #667eea;
}

/* ゲーム情報パネル */
.game-info-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    margin-bottom: 20px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-info.active .turn-indicator {
    width: 12px;
    height: 12px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.player-icon {
    font-size: 2rem;
}

.player-details {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-weight: 600;
    font-size: 1rem;
}

.player-rank {
    font-size: 0.8rem;
    color: #aaa;
}

.captured-pieces {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    max-width: 120px;
    font-size: 1rem;
}

.game-status {
    text-align: center;
}

.current-turn {
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffd700;
}

.game-mode {
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 5px;
}

.check-status {
    font-size: 1rem;
    color: #f5576c;
    font-weight: 600;
    margin-top: 5px;
}

/* ボードラッパー */
.board-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

.board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.board-labels {
    display: flex;
    justify-content: space-around;
    color: #aaa;
    font-size: 0.9rem;
    font-weight: 600;
}

.files-top, .files-bottom {
    width: 440px;
    padding: 5px 0;
}

.files-top span, .files-bottom span {
    width: 55px;
    text-align: center;
}

.board-with-ranks {
    display: flex;
    align-items: center;
}

.ranks-left, .ranks-right {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 440px;
    padding: 0 10px;
}

.ranks-left span, .ranks-right span {
    height: 55px;
    display: flex;
    align-items: center;
}

/* チェス盤 */
.board {
    display: grid;
    grid-template-columns: repeat(8, 55px);
    grid-template-rows: repeat(8, 55px);
    border: 6px solid #5d4037;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.1);
    background: #8b7355;
}

.cell {
    width: 55px;
    height: 55px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.cell.light {
    background: #f0d9b5;
}

.cell.dark {
    background: #b58863;
}

.cell:hover {
    filter: brightness(1.15);
}

.cell.selected {
    background: #7cfc00 !important;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.4);
}

.cell.valid-move::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: rgba(0, 180, 0, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0, 180, 0, 0.5);
}

.cell.valid-capture {
    background: rgba(255, 80, 80, 0.5) !important;
    box-shadow: inset 0 0 15px rgba(255, 0, 0, 0.3);
}

.cell.last-move {
    background: rgba(255, 255, 100, 0.5) !important;
}

.cell.check {
    background: rgba(255, 50, 50, 0.6) !important;
    animation: checkPulse 0.5s infinite alternate;
}

/* 駒のスタイル */
.piece {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease;
}

.piece.white {
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8), -1px -1px 2px rgba(0, 0, 0, 0.8);
}

.piece.black {
    color: #1a1a1a;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

@keyframes checkPulse {
    from { box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.5); }
    to { box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.8); }
}

/* 駒のスタイル */
.piece {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s ease;
    user-select: none;
}

.piece.white {
    color: #fff;
    text-shadow: 
        1px 1px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        2px 2px 4px rgba(0, 0, 0, 0.5);
}

.piece.black {
    color: #1a1a1a;
    text-shadow: 
        1px 1px 0 #666,
        2px 2px 4px rgba(0, 0, 0, 0.3);
}

.cell:active .piece {
    transform: scale(1.1);
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #ffd700;
    font-size: 1.8rem;
}

.mode-options {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.mode-section h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #fff;
}

.difficulty-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.pvp-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    min-width: 100px;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ffd700;
    transform: translateY(-3px);
}

.mode-btn.wide {
    flex-direction: row;
    justify-content: flex-start;
    gap: 15px;
    width: 100%;
}

.mode-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.mode-btn.wide .mode-icon {
    margin-bottom: 0;
}

.mode-name {
    font-weight: 600;
    font-size: 1rem;
}

.mode-desc {
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 3px;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    margin-top: 25px;
    gap: 15px;
}

/* オンラインロビー */
.online-screen {
    text-align: center;
}

.online-description {
    color: #aaa;
    margin-bottom: 20px;
}

.name-input-section {
    margin: 20px 0;
}

.name-input-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.name-input-section input {
    width: 100%;
    max-width: 300px;
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    text-align: center;
}

.name-input-section input:focus {
    outline: none;
    border-color: #ffd700;
}

.matching-animation {
    padding: 30px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffd700;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.waiting-info {
    color: #aaa;
    font-size: 0.9rem;
}

/* プロモーション選択 */
.promotion-content {
    text-align: center;
}

.promotion-content p {
    color: #aaa;
    margin-bottom: 20px;
}

.promotion-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.promotion-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.promotion-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ffd700;
    transform: scale(1.05);
}

.promotion-piece {
    font-size: 3rem;
    margin-bottom: 5px;
}

.promotion-name {
    font-size: 0.9rem;
    font-weight: 600;
}

/* 結果モーダル */
.result-content {
    text-align: center;
}

.result-details {
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

#result-title {
    font-size: 2rem;
}

#result-message {
    font-size: 1.2rem;
    line-height: 1.8;
}

/* レスポンシブ */
@media (max-width: 600px) {
    .game-container {
        padding: 10px;
    }

    .game-header {
        flex-direction: column;
        gap: 15px;
    }

    .game-header h1 {
        font-size: 1.5rem;
    }

    .board {
        grid-template-columns: repeat(8, 40px);
        grid-template-rows: repeat(8, 40px);
    }

    .cell {
        width: 40px;
        height: 40px;
        font-size: 1.8rem;
    }

    .files-top, .files-bottom {
        width: 320px;
    }

    .files-top span, .files-bottom span {
        width: 40px;
    }

    .ranks-left, .ranks-right {
        height: 320px;
    }

    .ranks-left span, .ranks-right span {
        height: 40px;
    }

    .game-info-panel {
        flex-direction: column;
        gap: 15px;
    }

    .player-info {
        width: 100%;
        justify-content: center;
    }

    .captured-pieces {
        max-width: 80px;
        font-size: 0.8rem;
    }

    .modal-content {
        padding: 20px;
    }

    .difficulty-options {
        flex-direction: column;
    }

    .mode-btn {
        width: 100%;
    }
}
