/* Box Model Hack */
* {
    box-sizing: border-box;
}

/* Matrix Background */
html {
   background: black;
   height: 100%;
   overflow: hidden;
}

#matrix-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -100; /* Keep it behind all other elements */
    background-color: black; /* Matrix-style background */
}

/* Base Styles */

body {
   font-family: Arial, sans-serif;
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   margin: 0;
   padding: 0;
   height: 100%;
   color: #00ff00;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: auto; /* Allow scrolling when needed */
    touch-action: manipulation; /* Improves touch interactions */
}

.grid {
    display: grid;
    grid-template-rows: repeat(6, 60px);
    grid-template-columns: repeat(5, 60px);
    gap: 5px;
    margin: 5px 0 25px;
    justify-content: center;
    max-width: 100%;
}

.grid, .keyboard {
    max-width: 90vw; /* Prevents overflow on small screens */
}

.grid, .keyboard{
   position: relative;
   z-index: 10; /* Clearly above the canvas */
}

.keyboard {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 5px;
   width: 100%;
   max-width: 600px;
}

.keyboard-row {
   display: flex;
   gap: 5px;
   justify-content: center;
}

.key {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 50px;
    max-width: 60px;
    height: 50px;
    font-size: 22px;
    font-weight: bold;
    border: 1px solid #00ff00;
    border-radius: 5px;
    background-color: #d4eadc;
    color: #000000;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.key.enter, .key.backspace {
   min-width: 80px;
   max-width: 100px;
}

/* Media Queries */

@media (max-width: 600px) {
   .grid {
       grid-template-rows: repeat(6, 40px);
       grid-template-columns: repeat(5, 40px);
       gap: 3px;
   }

@media (orientation: landscape) {
.grid {
    transform: scale(0.8); /* Shrinks grid slightly in landscape */
}

.keyboard {
    transform: scale(0.9); /* Reduces keyboard size to fit */
    }
}

.keyboard {
       max-width: 90vw;
   }
.key {
    min-width: 7vw;
    max-width: 9vw;
    height: 40px;
    font-size: 14px;
   }
.key.enter, .key.backspace {
    min-width: 12vw;
    max-width: 14vw;
   }
}

.modal {
   display: none;
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: rgba(0, 0, 0, 0.8);
   justify-content: center;
   align-items: center;
   z-index: 1;
}

.tile {
   display: flex;
   align-items: center;
   justify-content: center;
   border: 2px solid #00ff007b;
   border-radius: 5%;
   font-size: 24px;
   font-weight: bold;
   text-transform: uppercase;
   background-color: #222222;
   color: #ffffff;
   transition: background-color 0.5s ease, transform 0.5s ease;
}

.tile.flip {
   transform: rotateX(90deg);
}

.modal-content {
   background-color: #111111;
   padding: 20px;
   border-radius: 10px;
   text-align: center;
   border: 2px solid #00ff00;
   color: #00ff00;
}

#play-again {
    margin-bottom: 22px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: #003300;
    color: #00ff00;
    border: 2px solid #00ff00;
    transition: background-color 0.3s ease;
}

#play-again:hover {
   background-color: #005500;
}

/* Fonts */

.revalia-regular {
    font-family: "Revalia", serif;
    font-weight: 400;
    font-style: normal;
}
  
h1{
    font-family: "Revalia", sans-serif;
    font-size: 40px;
    background: linear-gradient(to right, #027400, #cfff60, #027400);
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
    text-align: center;
}

/* How to Play Modal */
#how-to-play-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#close-how-to-play {
    /* margin-top: 10px; */
    /* padding: 10px 20px; */
    font-size: 16px;
    position: relative;
    bottom: 14px;
    left: 135px;
    cursor: pointer;
    background-color: #003300;
    color: #ffffff;
    border: 2px solid #09ff00;
    transition: background-color 0.3s ease;
}

#close-how-to-play:hover {
    background-color: #005500;
}

.modal-content {
    background-color: #111;
    padding: 5px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #00ff00;
    color: #00ff00;
    width: 90%;
    max-width: 400px;
}

.example-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 10px 0;
}

.example-tile {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    border: 2px solid #555;
}

.green {
    background-color: #00ff00;
    color: black;
}

.yellow {
    background-color: #ffff00;
    color: black;
}

.gray {
    background-color: #333;
    color: white;
}

.green-box, .yellow-box, .gray-box {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 5px;
}

.green-box { background-color: #00ff00; }
.yellow-box { background-color: #ffff00; }
.gray-box { background-color: #333; }

#invalid-word-notification {
    position: fixed;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 25px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
    z-index: 1000; /* Ensures it's above the grid */
    display: block;
}

#invalid-word-notification.show {
    opacity: 1;
}
.surelyKnott{
    font-size: 10px;
}

/* Matrix Music Player */

.music-player {
    width: 300px;
    background-color: #2d542d;
    color: #d8f5d8;
    padding: 10px;
    border-radius: 20px;
    position: relative;
    z-index: 1; /* Ensure it's above the matrix */
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    margin: 20px auto;
}

.profile-image {
    width: 60px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.progress-section {
    width: 100%;
    margin: 10px 0;
}

.player-content {
    display: flex;
    align-items: center;
}

.time {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

#progress-bar {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #3d703d;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

#progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #d8f5d8;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

#progress-bar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #d8f5d8;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.control-btn {
    background: none;
    border: none;
    color: #d8f5d8;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
}

.control-btn:hover {
    color: #aff5a3;
    transform: scale(1.1);
}

/* Hidden YouTube Player */
#youtube-player {
    visibility: hidden;
    width: 0;
    height: 0;
    pointer-events: none;
}

