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

 body {
     font-family: 'Arial', sans-serif;
     background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
     display: flex;
     justify-content: center;
     align-items: center;
    
 }

 .scale-wrapper {
     display: flex;
     justify-content: center;
     align-items: center;
     width: 100vw;
     height: 100vh;
     overflow: hidden;
 }


 .game-container {
     width: 780px;
     height: 750px;
     background: rgb(255, 201, 150);
     border-radius: 20px;
     box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
     position: relative;
     overflow: hidden;
     border: 10px solid rgb(216, 86, 66); ;
 }

 .home-btn {
     position: absolute;
     top: 15px;
     right: 15px;
     background: #ff6b6b;
     color: white;
     border: none;
     padding: 10px 15px;
     border-radius: 8px;
     cursor: pointer;
     font-weight: bold;
     z-index: 100;
     transition: all 0.3s ease;
 }

 .home-btn:hover {
     background: #e74c3c;
     transform: scale(1.05);
 }

 .screen {
     width: 100%;
     height: 100%;
     display: none;
     flex-direction: column;
     justify-content: center;
     align-items: center;
     padding: 40px;
 }

 .screen.active {
     display: flex;
 }

 /* Start Screen */
 .start-screen {
     background: linear-gradient(45deg, #84fab0 0%, #8fd3f4 100%);
     text-align: center;
     position: relative;
     z-index: 1;
 }

 .start-screen h1 {
     font-size: 3.5rem;
     color: #2c3e50;
     margin-bottom: 20px;
     text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
 }

 .start-screen p {
     font-size: 1.2rem;
     color: #34495e;
     margin-bottom: 40px;
     max-width: 500px;
 }

 .start-btn,
 .replay-btn {
     background: linear-gradient(45deg, #667eea, #764ba2);
     color: white;
     border: none;
     padding: 15px 40px;
     font-size: 1.3rem;
     border-radius: 12px;
     cursor: pointer;
     transition: all 0.3s ease;
     font-weight: bold;
 }

 .start-btn:hover,
 .replay-btn:hover {
     transform: scale(1.05);
     box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
 }

 /* Game Screen */
 .game-screen {
     padding: 20px;
 }

 .game-header {
     display: flex;
     justify-content: center;
     gap: 50px;
     align-items: center;
     margin-bottom: 20px;
     width: 100%;
     position: absolute;
     top: 100px;
 }

 .score-display {
     background: #27ae60;
     color: white;
     padding: 10px 20px;
     border-radius: 8px;
     font-weight: bold;
     font-size: 1.1rem;
     width: 160px;
     position: absolute;
     top: 15px;
     left: 15px;
 }

 .word-counter {
     background: #9b59b6;
     color: white;
     padding: 10px 20px;
     border-radius: 8px;
     font-weight: bold;
     font-size: 1.1rem;
 }

 .lives-counter {
     background: #204513;
     color: white;
     padding: 10px 20px;
     border-radius: 8px;
     font-weight: bold;
     font-size: 1.1rem;
 }

 .hint-box {
     background: #3498db;
     color: white;
     padding: 10px 20px;
     border-radius: 8px;
     font-weight: bold;
     max-width: 300px;
     text-align: center;
     position: absolute;
     bottom: 120px;
     left: 75px;
 }

 .game-content {
     display: flex;
     gap: 30px;
     height: 580px;
 }

 .hangman-section {
     flex: 1;
     display: flex;
     flex-direction: column;
     align-items: center;
 }

 .hangman-drawing {
     width: 300px;
     height: 350px;
     border: 3px solid #34495e;
     border-radius: 10px;
     background: #ecf0f1;
     margin-bottom: 20px;
     position: absolute;
     left: 50px;
     top: 200px;
 }

 .word-display {
     font-size: 2.5rem;
     font-weight: bold;
     color: #2c3e50;
     letter-spacing: 8px;
     margin-bottom: 20px;
     text-align: center;
     min-height: 60px;
     width: 400px;
     position: absolute;
     top: 200px;
     right: 10px;
     /* border: 2px solid black; */
 }

 .controls-section {
     flex: 1;
     display: flex;
     flex-direction: column;
 }

 .keyboard {
     display: grid;
     grid-template-columns: repeat(6, 1fr);
     gap: 8px;
     margin-top: 20px;
     position: absolute;
     top: 270px;

 }

 .key {
     background: #3498db;
     color: white;
     border: none;
     padding: 12px;
     border-radius: 8px;
     cursor: pointer;
     font-size: 1.1rem;
     font-weight: bold;
     transition: all 0.3s ease;
 }

 .key:hover {
     background: #2980b9;
     transform: scale(1.05);
 }

 .key:disabled {
     background: #bdc3c7;
     cursor: not-allowed;
     transform: none;
 }

 .key.correct {
     background: #27ae60;
 }

 .key.incorrect {
     background: #e74c3c;
 }

 /* End Screen */
.end-screen {
    background: linear-gradient(45deg, #ffecd2 0%, #fcb69f 100%);
    text-align: center;
    position: absolute;   /* overlay */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;         /* higher than hangman/keyboard */
    display: none;        /* default hidden */
    justify-content: center;
    align-items: center;
    flex-direction: column;
}


 .end-screen.win {
     background: linear-gradient(45deg, #a8edea 0%, #fed6e3 100%);
 }

 .end-screen.lose {
     background: linear-gradient(45deg, #ffecd2 0%, #fcb69f 100%);
 }

 .end-screen h2 {
     font-size: 3rem;
     margin-bottom: 20px;
     color: #2c3e50;
 }

 .end-screen p {
     font-size: 1.3rem;
     margin-bottom: 30px;
     color: #34495e;
 }

 .word-reveal {
     font-size: 2rem;
     font-weight: bold;
     color: #e74c3c;
     margin-bottom: 20px;
 }

 /* Win Popup */
 .win-popup {
     position: absolute;
     top: 50%;
     left: 50%;
     transform: translate(-50%, -50%);
     background: white;
     padding: 40px;
     border-radius: 20px;
     box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
     text-align: center;
     z-index: 200;
     display: none;
     border: 4px solid #27ae60;
 }

 .win-popup.show {
     display: block;
     animation: popupAppear 0.5s ease-out;
 }

 @keyframes popupAppear {
     from {
         opacity: 0;
         transform: translate(-50%, -50%) scale(0.8);
     }

     to {
         opacity: 1;
         transform: translate(-50%, -50%) scale(1);
     }
 }

 .win-popup h3 {
     color: #27ae60;
     font-size: 2rem;
     margin-bottom: 15px;
 }

 .win-popup p {
     color: #2c3e50;
     margin-bottom: 20px;
     font-size: 1.2rem;
 }

 .next-btn {
     background: #27ae60;
     color: white;
     border: none;
     padding: 12px 30px;
     font-size: 1.1rem;
     border-radius: 8px;
     cursor: pointer;
     font-weight: bold;
     transition: all 0.3s ease;
 }

 .next-btn:hover {
     background: #219a52;
     transform: scale(1.05);
 }