/**
 * Gozigen Gokigenz 3D - 重要な修正CSS
 * PC動作、スマホ表示、文字色、サイズの問題を修正
 */

/* ==================== */
/* メインコンテナ修正 */
/* ==================== */
#ggz3d-container {
    position: relative;
    width: 100% !important;
    min-height: 100vh !important; /* スマホでフルスクリーン */
    height: auto !important;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: linear-gradient(135deg, #1a1f36 0%, #2f4169 50%, #20bf6b 100%);
    overflow-x: hidden;
}

/* ==================== */
/* メニューエリア修正 */
/* ==================== */
#ggz3d-menu {
    width: 100%;
    min-height: 100vh; /* フルハイト */
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* ==================== */
/* タイトル文字色修正 */
/* ==================== */
.ggz3d-title-top {
    color: #4169e1 !important; /* 青色 */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 
                 0 0 10px rgba(65, 105, 225, 0.5) !important;
}

.ggz3d-title-bottom {
    color: #20bf6b !important; /* 緑色 */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5),
                 0 0 10px rgba(32, 191, 107, 0.5) !important;
}

.ggz3d-subtitle-jp {
    color: #ffffff !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8) !important;
}

.ggz3d-subtitle-jp .text-blue {
    color: #4facfe !important;
}

.ggz3d-subtitle-jp .text-green {
    color: #00f2fe !important;
}

/* ==================== */
/* ボタンコンテナ修正 */
/* ==================== */
.ggz3d-buttons {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    box-sizing: border-box;
    margin-top: 30px;
}

/* ==================== */
/* ボタンスタイル修正 */
/* ==================== */
.ggz3d-btn {
    width: 100%;
    padding: 18px 25px !important;
    font-size: 18px !important;
    font-weight: bold;
    border: 2px solid rgba(255,255,255,0.3) !important;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    text-transform: none;
    white-space: nowrap;
    color: white !important; /* 文字色を白に */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.ggz3d-btn span {
    font-size: 24px;
}

.ggz3d-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

/* ==================== */
/* ゲームエリア修正 */
/* ==================== */
#ggz3d-game-area {
    width: 100%;
    min-height: 100vh;
    position: relative;
    padding: 20px;
    box-sizing: border-box;
}

/* ==================== */
/* キャンバスコンテナ修正 */
/* ==================== */
#ggz3d-canvas-container {
    width: 100% !important;
    height: 60vh !important; /* ビューポート高さの60% */
    min-height: 400px !important;
    position: relative;
    background: radial-gradient(circle at center, #2f4169, #1a1f36);
    border-radius: 15px;
    overflow: hidden;
    margin: 20px auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

#ggz3d-canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    touch-action: none; /* タッチ操作を有効化 */
}

/* ==================== */
/* プレイヤー情報修正 */
/* ==================== */
#ggz3d-header {
    background: rgba(0, 0, 0, 0.5) !important;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
}

.player-card {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 15px;
    border-radius: 15px;
}

.player-card h3 {
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    margin: 0 0 10px;
    font-size: 18px;
}

.pieces-count {
    color: white !important;
}

.pieces-count span {
    background: rgba(255, 255, 255, 0.25);
    color: white !important;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

.turn-indicator {
    color: white !important;
}

#current-turn {
    color: #ffd700 !important;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#timer {
    color: white !important;
    font-size: 28px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

/* ==================== */
/* モーダル文字色修正 */
/* ==================== */
.ggz3d-modal-content {
    background: white !important;
    color: #333 !important; /* ダークグレー文字 */
}

.ggz3d-modal-content h2,
.ggz3d-modal-content h3 {
    color: #2f4169 !important; /* 濃い青 */
}

.ggz3d-modal-content p {
    color: #555 !important; /* グレー */
}

.ggz3d-modal-content label {
    color: #333 !important;
}

/* プレイヤー名入力 */
#player-name-input {
    color: #333 !important;
    background: white !important;
    border: 2px solid #2f4169 !important;
}

/* 難易度カード */
.diff-btn {
    background: white !important;
    color: #333 !important;
    border: 2px solid #e0e0e0 !important;
}

.diff-btn.selected {
    background: linear-gradient(135deg, #2f4169, #20bf6b) !important;
    color: white !important;
    border-color: transparent !important;
}

.diff-icon {
    font-size: 36px !important;
}

.diff-name {
    font-size: 20px !important;
    font-weight: bold !important;
}

.diff-desc {
    font-size: 14px !important;
    color: #666 !important;
}

.diff-btn.selected .diff-desc {
    color: rgba(255,255,255,0.9) !important;
}

/* ==================== */
/* スマホ専用修正 */
/* ==================== */
@media (max-width: 768px) {
    #ggz3d-container {
        min-height: 100vh !important;
        border-radius: 0;
    }
    
    #ggz3d-menu {
        min-height: 100vh;
        padding: 15px;
        justify-content: flex-start;
        padding-top: 50px;
    }
    
    .game-logo-container {
        transform: scale(1.2); /* ロゴを大きく */
        margin: 30px auto;
    }
    
    .ggz3d-title-top,
    .ggz3d-title-bottom {
        font-size: 36px !important; /* 文字を大きく */
    }
    
    .ggz3d-subtitle-jp {
        font-size: 20px !important;
    }
    
    .ggz3d-buttons {
        width: 100%;
        max-width: none;
        padding: 10px;
    }
    
    .ggz3d-btn {
        padding: 20px 30px !important;
        font-size: 18px !important;
        min-height: 60px;
    }
    
    .ggz3d-btn span {
        font-size: 28px !important;
    }
    
    #ggz3d-canvas-container {
        height: 50vh !important;
        min-height: 300px !important;
    }
    
    /* モーダルをフルスクリーン */
    .ggz3d-modal-content {
        width: 95% !important;
        max-width: none !important;
        margin: 10px !important;
    }
    
    .difficulty-buttons {
        grid-template-columns: 1fr !important;
    }
    
    .diff-btn {
        padding: 25px !important;
        min-height: 80px !important;
    }
}

/* ==================== */
/* 超小型スマホ対応 */
/* ==================== */
@media (max-width: 480px) {
    .ggz3d-title-top,
    .ggz3d-title-bottom {
        font-size: 28px !important;
    }
    
    .ggz3d-subtitle-jp {
        font-size: 16px !important;
    }
    
    .ggz3d-btn {
        font-size: 16px !important;
        padding: 16px 20px !important;
    }
    
    #ggz3d-canvas-container {
        height: 40vh !important;
        min-height: 250px !important;
    }
}

/* ==================== */
/* ロゴ全面配置 */
/* ==================== */
.board-logo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/5d-management-logo.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15;
    pointer-events: none;
    z-index: 1;
}

/* ==================== */
/* アニメーション改善 */
/* ==================== */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ggz3d-btn {
    animation: fadeInScale 0.5s ease forwards;
}

.ggz3d-btn:nth-child(1) { animation-delay: 0.1s; }
.ggz3d-btn:nth-child(2) { animation-delay: 0.2s; }
.ggz3d-btn:nth-child(3) { animation-delay: 0.3s; }
.ggz3d-btn:nth-child(4) { animation-delay: 0.4s; }
.ggz3d-btn:nth-child(5) { animation-delay: 0.5s; }
.ggz3d-btn:nth-child(6) { animation-delay: 0.6s; }

/* ==================== */
/* タッチフィードバック */
/* ==================== */
.ggz3d-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

/* ==================== */
/* スクロールバー美化 */
/* ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

/* ==================== */
/* 重要度最優先 */
/* ==================== */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

input, textarea, select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}