:root {
    --color-primary: #E63946;
    --color-secondary: #F1FAEE;
    --color-accent: #FFD60A;
    --color-bg: #1D3557;
    --color-correct: #E63946;
    --color-present: #FFD60A;
    --color-absent: #457B9D;
    --color-empty: #A8DADC;
    --shadow-glow: 0 0 20px rgba(230, 57, 70, 0.4);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #3a3732 0%, #383632 100%);
    background-image: url('background.jpg');
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;	
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 214, 10, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(230, 57, 70, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* TV Frame */
.tv-frame {
    position: relative;
    background: linear-gradient(145deg, #a69f7c, #4b3427);
    border-radius: 40px;
    padding: 30px;
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.5),
        inset 0 2px 0 rgba(255, 255, 255, 0.1),
        inset 0 -2px 10px rgba(0, 0, 0, 0.5);
    z-index: 1;
    animation: tvPowerOn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tvPowerOn {
    0% {
        transform: scale(0.8) rotateX(10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1) rotateX(0);
        opacity: 1;
    }
}

.tv-screen {
    background: var(--color-bg);
    border-radius: 20px;
    padding: 40px 30px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
    min-height: 600px;
}

/* Scanlines effect */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        transparent 1px,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 3px
    );
    pointer-events: none;
    z-index: 10;
    opacity: 0.3;
    animation: scanlineMove 8s linear infinite;
}

@keyframes scanlineMove {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(10px);
    }
}

/* TV Buttons */
.tv-buttons {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tv-button {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 0.5),
        0 2px 5px rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.tv-button:hover {
    transform: scale(1.1);
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 0.5),
        0 2px 10px rgba(255, 255, 255, 0.3);
}

.tv-button.red {
    background: radial-gradient(circle at 30% 30%, #ff4444, #cc0000);
}

.tv-button.green {
    background: radial-gradient(circle at 30% 30%, #44ff44, #00cc00);
}

.tv-button.blue {
    background: radial-gradient(circle at 30% 30%, #4444ff, #0000cc);
}

/* Header */
.game-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
}

.game-title {
    font-family: "Macondo Swash Caps", cursive;
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.title-letter {
    display: inline-block;
    color: var(--color-secondary);
    text-shadow: 
        3px 3px 0 var(--color-primary),
        6px 6px 0 var(--color-accent),
        6px 6px 20px rgba(230, 57, 70, 0.5);
    animation: titleBounce 2s ease-in-out infinite;
}

.title-letter:nth-child(1) { animation-delay: 0s; }
.title-letter:nth-child(2) { animation-delay: 0.1s; }
.title-letter:nth-child(3) { animation-delay: 0.2s; }
.title-letter:nth-child(4) { animation-delay: 0.3s; }
.title-letter:nth-child(5) { animation-delay: 0.4s; }

@keyframes titleBounce {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    10% {
        transform: translateY(-10px) rotate(-2deg);
    }
    20% {
        transform: translateY(0) rotate(0deg);
    }
}

.subtitle {
	font-family: "Macondo Swash Caps", cursive;
	font-weight: 400;
  font-style: normal;
    font-size: 1.4rem;
    color: var(--color-accent);
    /* font-weight: 600; */
    /* text-transform: uppercase; */
    letter-spacing: 0.2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Game Info */
.game-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.info-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 30px;
    border-radius: 15px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.info-label {
    font-size: 0.9rem;
    color: var(--color-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.info-value {
    font-size: 1.8rem;
    color: var(--color-accent);
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Game Board */
.game-board {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 auto 30px;
    max-width: 500px;
}

.board-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.tile {
    width: 60px;
    height: 60px;
    border: 3px solid var(--color-empty);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.tile.filled {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
    animation: tilePop 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes tilePop {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

.tile.correct {
    background: var(--color-correct);
    border-color: var(--color-correct);
    animation: tileFlip 0.6s ease-in-out;
    box-shadow: 0 4px 20px rgba(230, 57, 70, 0.6);
}

.tile.present {
    background: var(--color-present);
    border-color: var(--color-accent);
    color: #333;
    animation: tileFlip 0.6s ease-in-out;
    box-shadow: 0 4px 20px rgba(255, 214, 10, 0.6);
}

.tile.absent {
    background: var(--color-absent);
    border-color: var(--color-absent);
    animation: tileFlip 0.6s ease-in-out;
    box-shadow: 0 4px 10px rgba(69, 123, 157, 0.4);
}

.tile.locked {
    background: var(--color-correct);
    border-color: var(--color-correct);
    box-shadow: 0 0 20px rgba(230, 57, 70, 0.8);
    animation: pulseLocked 2s ease-in-out infinite;
}

@keyframes pulseLocked {
    0%, 100% {
        box-shadow: 0 0 20px rgba(230, 57, 70, 0.8);
    }
    50% {
        box-shadow: 0 0 30px rgba(230, 57, 70, 1);
    }
}

@keyframes tileFlip {
    0% {
        transform: rotateX(0);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0);
    }
}

/* Keyboard */
.keyboard-container {
    max-width: 600px;
    margin: 0 auto 20px;
}

.keyboard-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 8px;
}

.key {
    min-width: 40px;
    height: 55px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #4a6fa5, #2e5984);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    padding: 0 12px;
}

.key:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.key:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.key.key-wide {
    min-width: 70px;
    font-size: 0.85rem;
}

.key.correct {
    background: linear-gradient(145deg, #ff5252, var(--color-correct));
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.6);
}

.key.present {
    background: linear-gradient(145deg, #ffd700, #ffb700);
    color: #333;
    box-shadow: 0 4px 15px rgba(255, 214, 10, 0.6);
}

.key.absent {
    background: linear-gradient(145deg, #5a7fa0, #3d5a7a);
    opacity: 0.5;
}

/* New Game Button */
.new-game-btn {
    display: block;
    margin: 0 auto;
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--color-primary), #c42b36);
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(230, 57, 70, 0.4);
    font-family: "Macondo Swash Caps", cursive;
    /* text-transform: uppercase; */
    letter-spacing: 0.1em;
}

.new-game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(230, 57, 70, 0.6);
}

.new-game-btn:active {
    transform: translateY(-1px);
}

/* New Game Button */
.valider-btn {
    display: block;
    margin: 0 auto;
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #39E695, #3a8666);
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(46, 166, 98, 0.4);
    font-family: "Macondo Swash Caps", cursive;
    /* text-transform: uppercase; */
    letter-spacing: 0.1em;
}

.valider-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(46, 166, 98, 0.6);
}

.valider-btn:active {
    transform: translateY(-1px);
}

.btn-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 1.3rem;
    animation: iconRotate 2s ease-in-out infinite;
}

@keyframes iconRotate {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-10deg);
    }
    75% {
        transform: rotate(10deg);
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease-in-out;
}

.modal.show {
    display: flex;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(145deg, #1D3557, #14273f);
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    max-width: 500px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 3px rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 3px solid rgba(255, 255, 255, 0.2);
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.7) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-title {
    font-family: "Macondo Swash Caps", cursive;
    font-size: 2.5rem;
    color: var(--color-accent);
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

.modal-message {
    font-size: 1.3rem;
    color: var(--color-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
}

.modal-btn {
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--color-primary), #c42b36);
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(230, 57, 70, 0.4);
    font-family: "Macondo Swash Caps", cursive;
    /* text-transform: uppercase; */
}

.modal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(230, 57, 70, 0.6);
}

/* Instructions */
.instructions {
    max-width: 600px;
    margin: 30px auto 0;
    padding: 25px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.instructions h3 {
    /* font-family: 'Fredoka', sans-serif; */
		font-family: "Macondo Swash Caps", cursive;
	font-weight: 400;
  font-style: normal;
    color: var(--color-primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    margin-bottom: 12px;
    padding-left: 10px;
    color: #333;
    font-size: 1rem;
    line-height: 1.6;
}

.inst-highlight {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 700;
    margin-right: 5px;
}

.inst-highlight.correct {
    background: var(--color-correct);
    color: white;
}

.inst-highlight.present {
    background: var(--color-present);
    color: #333;
}

.inst-highlight.absent {
    background: var(--color-absent);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .tv-frame {
        padding: 15px;
        border-radius: 25px;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
    
    .tv-screen {
        padding: 20px 15px;
        border-radius: 15px;
    }
    
    .game-title {
        font-size: 2.5rem;
    }
    
    .tile {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
    
    .keyboard-container {
        max-width: 100%;
        width: 100%;
    }
    
    .key {
        min-width: 32px;
        height: 48px;
        font-size: 0.9rem;
    }
    
    .key.key-wide {
        min-width: 55px;
        font-size: 0.75rem;
    }
    
    .instructions {
        margin: 20px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    /* Frame TV adapté pour smartphone */
    .tv-frame {
        padding: 10px;
        border-radius: 20px;
        width: calc(100vw - 10px);
        max-width: calc(100vw - 10px);
        box-shadow: 
            0 15px 30px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.1),
            inset 0 -1px 5px rgba(0, 0, 0, 0.4);
    }
    
    .tv-screen {
        padding: 15px 10px;
        border-radius: 12px;
        min-height: auto;
    }
    
    .tv-buttons {
        right: 8px;
        gap: 10px;
    }
    
    .tv-button {
        width: 18px;
        height: 18px;
    }
    
    .game-header {
        margin-bottom: 20px;
    }
    
    .game-title {
        font-size: 2rem;
        gap: 3px;
    }
    
    .subtitle {
        font-size: 0.85rem;
        letter-spacing: 0.15em;
    }
    
    .game-info {
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .info-box {
        padding: 10px 20px;
        border-radius: 12px;
        border-width: 2px;
    }
    
    .info-label {
        font-size: 0.8rem;
    }
    
    .info-value {
        font-size: 1.5rem;
    }
    
    .game-board {
        margin-bottom: 20px;
    }
    
    .tile {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
        border-width: 2px;
        border-radius: 8px;
    }
    
    .board-row {
        gap: 5px;
    }
    
    /* Clavier agrandi pour smartphone */
    .keyboard-container {
        max-width: 100%;
        width: 100%;
        margin: 0 auto 15px;
    }
    
    .keyboard-row {
        gap: 5px;
        margin-bottom: 6px;
        display: flex;
        justify-content: center;
        width: 100%;
    }
    
    .key {
        min-width: 28px;
        flex: 1;
        max-width: 38px;
        height: 52px;
        font-size: 0.95rem;
        padding: 0 6px;
        border-radius: 6px;
        font-weight: 700;
    }
    
    .key.key-wide {
        min-width: 52px;
        flex: 1.5;
        max-width: 70px;
        font-size: 0.75rem;
        padding: 0 8px;
    }
    
    .new-game-btn {
        padding: 12px 30px;
        font-size: 1rem;
        border-radius: 40px;
    }
    
    .btn-icon {
        font-size: 1.1rem;
    }
    
    .modal-content {
        padding: 30px 20px;
        margin: 10px;
        border-radius: 20px;
        max-width: calc(100vw - 40px);
    }
    
    .modal-title {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .modal-message {
        font-size: 1.1rem;
        margin-bottom: 20px;
    }
    
    .modal-btn {
        padding: 12px 30px;
        font-size: 1rem;
    }
    
    .instructions {
        margin: 15px 5px 0;
        padding: 20px;
        border-radius: 15px;
    }
    
    .instructions h3 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .instructions li {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
}

/* Optimisation pour très petits écrans */
@media (max-width: 360px) {
    .tile {
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
    }
    
    .key {
        min-width: 24px;
        max-width: 32px;
        height: 48px;
        font-size: 0.85rem;
        padding: 0 4px;
    }
    
    .key.key-wide {
        min-width: 45px;
        max-width: 60px;
        font-size: 0.7rem;
    }
    
    .game-title {
        font-size: 1.6rem;
    }
    
    .keyboard-row {
        gap: 4px;
    }
}
