/* ========================================
   Jeux des Moulins - Feuille de styles
   Nine Men's Morris - intégration omesjeux
   Palette inspirée de Pulse Pattern, scopée #game-main
   ======================================== */

#game-main {
    --jdm-gold: #f0c040;
    --jdm-silver: #d0d0e0;
    --jdm-accent: #00d2ff;
    --jdm-danger: #ff5252;
    --jdm-success: #00e676;
    --jdm-text: #e0e0e0;
    --jdm-text-dim: #888;

    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: var(--jdm-text);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

#game-main *,
#game-main *::before,
#game-main *::after {
    box-sizing: border-box;
}

#game-main #game-container {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 14px;
    gap: 6px;
}

/* ===== En-tête ===== */
#game-main #game-header {
    width: 100%;
    text-align: center;
    flex-shrink: 0;
}

#game-main #game-title {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(90deg, #00d2ff, #7b2ff7, #ff6fd8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#game-main .jdm-subtitle {
    font-size: 0.75rem;
    color: var(--jdm-text-dim);
    margin-top: 2px;
}

#game-main #scores-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 6px;
}

#game-main .score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#game-main .score-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--jdm-text-dim);
}

#game-main .score-number {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
}

/* ===== Difficulté ===== */
#game-main .jdm-difficulty-bar {
    width: 100%;
    max-width: 500px;
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 2px 0;
}

#game-main .jdm-diff-btn {
    padding: 6px 12px;
    border: 2px solid transparent;
    border-radius: 20px;
    background: rgba(255,255,255,0.08);
    color: var(--jdm-text-dim);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#game-main .jdm-diff-btn.active {
    border-color: var(--jdm-accent);
    color: var(--jdm-accent);
    background: rgba(0,210,255,0.15);
}

#game-main .jdm-diff-btn:active {
    transform: scale(0.95);
}

/* ===== Barre d'infos ===== */
#game-main .jdm-info-bar {
    width: 100%;
    max-width: 500px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    font-size: 0.85rem;
}

#game-main .jdm-player-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

#game-main .jdm-piece-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
}

#game-main .jdm-piece-dot.gold { background: var(--jdm-gold); }
#game-main .jdm-piece-dot.silver { background: var(--jdm-silver); }

#game-main .jdm-captures {
    font-size: 0.75rem;
    color: var(--jdm-danger);
    font-weight: 600;
}

#game-main .jdm-pieces-left {
    font-size: 0.7rem;
    color: var(--jdm-text-dim);
}

#game-main .jdm-ia-label {
    color: var(--jdm-silver);
}

#game-main .jdm-phase-label {
    font-size: 0.7rem;
    color: var(--jdm-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ===== Message d'état ===== */
#game-main .jdm-status-msg {
    width: 100%;
    max-width: 500px;
    text-align: center;
    padding: 4px 8px;
    font-size: 0.85rem;
    min-height: 1.6em;
    color: #b0b0ff;
    font-weight: 500;
}

#game-main .jdm-status-msg.highlight {
    animation: jdm-pulse 0.5s ease;
    color: var(--jdm-gold);
}

/* ===== Canvas ===== */
#game-main .jdm-canvas-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-main #gameCanvas {
    display: block;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    touch-action: none;
}

/* ===== Boutons ===== */
#game-main .jdm-controls {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 6px 0;
}

#game-main .jdm-btn {
    padding: 11px 22px;
    border: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    min-width: 72px;
    color: #fff;
}

#game-main .jdm-btn:active {
    transform: scale(0.95);
}

#game-main .jdm-btn-play {
    background: linear-gradient(135deg, #00d2ff, #7b2ff7);
    box-shadow: 0 4px 15px rgba(0,210,255,0.3);
}

#game-main .jdm-btn-stop {
    background: linear-gradient(135deg, #ff5252, #d50000);
    box-shadow: 0 4px 15px rgba(255,82,82,0.3);
}

#game-main .jdm-btn-rules {
    background: linear-gradient(135deg, #ff6fd8, #7b2ff7);
    box-shadow: 0 4px 15px rgba(123,47,247,0.3);
}

#game-main .jdm-btn-scores {
    background: linear-gradient(135deg, #f0c040, #ff9800);
    color: #1a1a2e;
    box-shadow: 0 4px 15px rgba(240,192,64,0.3);
}

/* ===== Modales ===== */
#game-main .jdm-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 18px;
}

#game-main .jdm-modal-overlay.show {
    display: flex;
    animation: jdm-fadeIn 0.25s ease;
}

#game-main .jdm-modal {
    background: linear-gradient(135deg, #1a1a3e, #2a2a5e);
    border: 1px solid rgba(123,47,247,0.4);
    border-radius: 16px;
    padding: 22px 20px;
    max-width: 420px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    animation: jdm-slideUp 0.3s ease;
}

#game-main .jdm-modal h2 {
    text-align: center;
    margin-bottom: 12px;
    font-size: 1.25rem;
    background: linear-gradient(90deg, #00d2ff, #7b2ff7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#game-main .jdm-modal p,
#game-main .jdm-modal li {
    font-size: 0.85rem;
    line-height: 1.55;
    color: #ccc;
    margin-bottom: 8px;
}

#game-main .jdm-modal ul {
    padding-left: 18px;
}

#game-main .jdm-close-btn {
    display: block;
    margin: 14px auto 0;
    padding: 10px 30px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #00d2ff, #7b2ff7);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

#game-main .jdm-close-btn:active {
    transform: scale(0.95);
}

/* ===== Liste des scores ===== */
#game-main .jdm-scores-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#game-main .jdm-scores-list li {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 0.8rem;
}

#game-main .jdm-scores-empty {
    color: var(--jdm-text-dim);
    justify-content: center !important;
}

#game-main .jdm-scores-list li .rank {
    color: var(--jdm-gold);
    font-weight: 700;
    width: 30px;
}

#game-main .jdm-scores-list li .score-name {
    flex: 1;
}

#game-main .jdm-scores-list li .score-val {
    color: var(--jdm-accent);
    font-weight: 600;
}

/* ===== Fin de partie ===== */
#game-main .jdm-end-modal h2 {
    font-size: 1.4rem;
}

#game-main .jdm-result-icon {
    font-size: 3rem;
    text-align: center;
    margin: 6px 0;
}

#game-main .jdm-result-text {
    text-align: center;
    font-size: 1rem;
    margin-bottom: 10px;
    -webkit-text-fill-color: initial;
}

#game-main .jdm-score-detail {
    text-align: center;
    color: var(--jdm-gold);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

#game-main .jdm-name-input {
    width: 100%;
    padding: 9px 12px;
    border: 2px solid var(--jdm-accent);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: var(--jdm-text);
    font-size: 0.9rem;
    margin: 8px 0;
    outline: none;
}

#game-main .jdm-name-input::placeholder {
    color: var(--jdm-text-dim);
}

#game-main .jdm-save-btn {
    display: block;
    margin: 8px auto;
    padding: 9px 24px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #f0c040, #ff9800);
    color: #1a1a2e;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* ===== Animations ===== */
@keyframes jdm-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes jdm-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes jdm-slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== Responsive ===== */
@media (max-width: 360px) {
    #game-main #game-title { font-size: 1.2rem; }
    #game-main .jdm-btn { padding: 9px 14px; font-size: 0.8rem; min-width: 62px; }
    #game-main .jdm-diff-btn { padding: 5px 8px; font-size: 0.65rem; }
    #game-main .jdm-info-bar { font-size: 0.75rem; padding: 4px 6px; }
}

@media (min-width: 768px) {
    #game-main #game-title { font-size: 2rem; }
    #game-main .jdm-canvas-container { max-width: 520px; }
}
