/* === Enchaînement Royal - styles inspirés de Pulse Pattern === */

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

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

#game-main #game-container {
    width: 100%;
    max-width: 520px;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    gap: 8px;
}

/* --- Header --- */
#game-main #game-header {
    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;
    margin: 0 0 6px;
}

#game-main #header-info {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 6px 8px;
    gap: 6px;
}

#game-main .info-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

#game-main .info-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
}

#game-main .info-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
}

#game-main #moves-value.danger {
    color: #ff5252;
    animation: er-pulse 0.6s ease-in-out infinite;
}

@keyframes er-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* --- Canvas zone --- */
#game-main #canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
    min-height: 320px;
}

#game-main #game-canvas {
    display: block;
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

/* --- Bonus Bar --- */
#game-main #bonus-bar {
    display: flex;
    justify-content: space-around;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 6px 8px;
    flex-shrink: 0;
}

#game-main .bonus-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 6px 10px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
}

#game-main .bonus-btn:enabled {
    color: #fff;
    border-color: rgba(123, 47, 247, 0.6);
    background: rgba(123, 47, 247, 0.15);
    box-shadow: 0 2px 10px rgba(123, 47, 247, 0.25);
}

#game-main .bonus-btn:enabled:active {
    transform: scale(0.95);
    background: rgba(123, 47, 247, 0.3);
}

#game-main .bonus-btn.active {
    border-color: #00d2ff;
    background: rgba(0, 210, 255, 0.2);
    box-shadow: 0 0 16px rgba(0, 210, 255, 0.45);
}

#game-main .bonus-icon {
    font-size: 1.2rem;
}

#game-main .bonus-count {
    font-size: 0.7rem;
    font-weight: 700;
    color: #ff6fd8;
}

#game-main .bonus-label {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Boutons d'action --- */
#game-main #controls-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 0 12px;
    flex-shrink: 0;
}

#game-main .game-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 22px;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    color: #fff;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

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

#game-main .game-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

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

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

#game-main .btn-shuffle {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

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

#game-main .btn-lang {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.25);
    padding: 8px 16px;
    font-size: 0.8rem;
}

/* --- Modals --- */
#game-main .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: er-fadeIn 0.25s ease;
}

#game-main .modal-overlay.hidden {
    display: none !important;
}

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

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

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

#game-main .modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

#game-main .modal-close:hover { color: #fff; }

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

#game-main .modal-body {
    font-size: 0.88rem;
    line-height: 1.55;
}

#game-main .modal-body h3 {
    font-size: 0.95rem;
    color: #b0b0ff;
    margin: 12px 0 4px;
    font-weight: 600;
}

#game-main .modal-body p,
#game-main .modal-body li {
    color: #ccc;
}

#game-main .modal-body ol,
#game-main .modal-body ul {
    padding-left: 20px;
    margin-bottom: 8px;
}

#game-main .modal-body li {
    margin-bottom: 3px;
}

/* --- Game Over --- */
#game-main #gameover-modal {
    text-align: center;
}

#game-main #gameover-title.victory {
    background: linear-gradient(90deg, #00e676, #00d2ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#game-main #gameover-title.defeat {
    background: linear-gradient(90deg, #ff5252, #d50000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#game-main #gameover-message {
    color: #ccc;
    margin: 8px 0;
}

#game-main #gameover-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 12px 0 4px;
}

#game-main #gameover-highscore {
    font-size: 0.9rem;
    color: #b0b0ff;
    margin-bottom: 12px;
}

#game-main .gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

#game-main .hidden { display: none !important; }

/* --- Confetti --- */
.er-confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 2000;
    animation: er-confettiFall linear forwards;
}

@keyframes er-confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* --- Bonus notification --- */
.er-bonus-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 12, 41, 0.92);
    border: 1px solid rgba(123, 47, 247, 0.5);
    color: #ff6fd8;
    padding: 14px 22px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    z-index: 1500;
    animation: er-notify 1.5s ease forwards;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

@keyframes er-notify {
    0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    15%  { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    30%  { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    80%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}

/* --- Responsive --- */
@media (max-height: 640px) {
    #game-main #game-title { font-size: 1.2rem; margin-bottom: 2px; }
    #game-main .info-value { font-size: 1rem; }
    #game-main .bonus-btn { padding: 4px 8px; min-width: 64px; }
    #game-main .bonus-icon { font-size: 1rem; }
    #game-main .bonus-label { font-size: 0.5rem; }
    #game-main .game-btn { padding: 8px 14px; font-size: 0.8rem; }
    #game-main #canvas-container { min-height: 260px; }
}

@media (min-width: 768px) {
    #game-main #game-title { font-size: 1.9rem; }
    #game-main .info-value { font-size: 1.3rem; }
}
