* {
    margin-top: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    overscroll-behavior-y: contain;
  }
  body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: Arial, sans-serif;
  background-color: #001f3f;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  }
  
.loader-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background: #fdfdfd;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

.loader-screen img {
    width: 150px;
    height: auto;
    margin-bottom: 20px;
    animation: fadeIn 1.5s ease-in-out;
}
.loader-screen h1 {
    font-size: 24px;
    color: #333;
    animation: fadeIn 2s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.home-page {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    padding: 10px;
    margin-top: 4px;
    margin-left: 1px;
    margin-right: 1px;
    align-items: center;
    flex-direction: column;
    position: relative;
    display: none;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    margin-bottom: 20px;
}

.back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 5;
}

.overlay.active {
    display: block;
}

.popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    z-index: 10;
    padding: 10px;
    text-align: center;
}

.popup.active {
    display: block;
}

.popup-header {
    background-color: #3498db;
    color: white;
    padding: 10px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 22px;
}

.popup-header .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
}

.popup-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 0;
}

.popup-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.popup-option {
    display: flex;
    align-items: center;
    padding: 5px;
    cursor: pointer;
}

.popup-option select {
    padding: 5px;
    border-radius: 5px;
    cursor: pointer;
}

.popup-option button {
    width: 65px;
    height: 40px;
    border: none;
    border-radius: 20%;
    margin-right: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.music-btn, .sound-btn, .vibration-btn {
    background-color: #e74c3c;
    color: rgb(233, 231, 231);
}
.music-btn.on, .sound-btn.on, .vibration-btn.on {
    background-color: #2ecc71;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.coin-counter {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 18px;
}

.claim-btn {
    background-color: #e74c3c;
    border: none;
    color: white;
    font-size: 16px;
    padding: 2px 8px;
    border-radius: 50%;
    cursor: pointer;
}

.daily-btn {
    background-color: #3498db;
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin-bottom: 80px;
}

.puzzle-card {
    background-color: #2c3e50;
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.puzzle-card img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.puzzle-card p {
    margin: 5px 0;
    font-size: 14px;
}

.crown {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    color: yellow;
    font-size: 20px;
}

.lock {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lock i {
    color: white;
    font-size: 20px;
}

.locked {
    opacity: 0.5;
}

progress {
    width: 100%;
    height: 10px;
}

footer {
    text-align: center;
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    background: linear-gradient(45deg, #1ef, #1e90ff);
    padding: 10px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

footer button, .ad-banner {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 15px;
}

.ad-banner {
    background: linear-gradient(45deg, #1ef, #1e90ff);
    color: white;
    padding: 10px 15px;
    border: 2px solid ;
    border-color: white;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ad-banner:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.daily-reward-btn {
    background: #1afa;
    border: none;
    color: white;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.footer-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 12px;
}

.footer-info a {
    color: rgb(26, 5, 5);
    text-decoration: underline;
}

.daily-reward-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 300px;
    z-index: 10;
    padding: 10px;
    text-align: center;
}

.daily-reward-popup.active {
    display: block;
}

.daily-reward-popup .popup-header {
    background-color: #3498db;
    color: white;
    padding: 10px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
}

.daily-reward-popup .collect-btn {
    background: #2ecc71;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px 0;
    font-size: 16px;
}

.level-indicator {
    background-color: #27ae60;
    padding: 10px;
    border-radius: 5px;
    display: inline-block;
    font-size: 18px;
}

.game-container {
    background: linear-gradient(to bottom, #003366, #000033);
    width: 100%;
    height: 100vh;
    padding: 15px;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
    display: none;
    max-width: 500px;
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
}

.pause-btn {
    background: #1e90ff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
}

h1 {
    color: white;
    font-size: 28px;
    font-weight: bold;
}

.header-right {
    display: flex;
    gap: 10px;
}

.coin-btn {
    background: #1e90ff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
}

.coin-btn i {
    color: white;
    font-size: 16px;
    margin-left: 5px;
}

.word-list {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 10px;
    font-family: 'Arial Black', Gadget, sans-serif;
    font-weight: bold;
    font-size: 18px;
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
}

.word-row {
    display: flex;
    justify-content: space-evenly;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 5px;
}

.word-row span {
    font-size: 18px;
    color: #333;
    padding: 5px 10px;
}

.word-row span.found {
    text-decoration: line-through;
}

.game-grid-container {
    background: #f5f5f5;
    border: 2px solid #ccc;
    padding: 12px;
    margin-bottom: 16px;
    width: 100%;
    border-radius: 20px;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    transition: border-color 0.3s ease;
}

.game-grid-container.sparkle {
    border-color: #f5dd57;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 2px;
    width: 100%;
}

.game-grid span {
    background: none;
    border: none;
    padding: 3px;
    font-family: 'Arial Black', Gadget, sans-serif;
    font-weight: bold;
    font-size: 28px;
    margin-bottom: 18px;
    color: #333;
    cursor: pointer;
    user-select: none;
    position: relative;
    text-align: center;
}

.game-grid span.selected {
    color: #1e90ff;
}

.game-grid span.found {
    color: white;
    border-radius: 4px;
}

.highlight-box {
    position: absolute;
    border: 2px solid #32cd32;
    background: rgba(50, 205, 50, 0.3);
    z-index: 10;
    pointer-events: none;
    box-sizing: border-box;
    transition: all 0.2s;
    display: none;
}

.footer {
    display: flex;
    justify-content: space-between;
    background: #1e90ff;
    padding: 10px 15px;
    border-radius: 10px;
    height: 60px;
    width: 100%;
    max-width: 500px;
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.footer button {
    background: none;
    border: none;
    color: white;
    font-size: 15px;
    cursor: pointer;
}

.pause-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pause-modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    padding: 15px;
    width: 80%;
    max-width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.modal-header h2 {
    color: white;
    background: #1e90ff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #ff0000;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
}

.music-btn, .sound-btn, .vibration-btn {
    background-color: #e74c3c;
    color: white;
}
.music-btn.on, .sound-btn.on, .vibration-btn.on {
    background-color: #2ecc71;
}

.continue-btn { background: #32cd32; }
.exit-btn { background: #a9a9a9; }

.icon {
    margin-right: 10px;
}

.congrats-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.congrats-modal.active {
    display: flex;
}

.congrats-modal .modal-content {
    background: transparent;
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

@media (max-width: 600px) {
    .home-page {
        padding: 5px;
    }

    .puzzle-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
        margin-bottom: 100px;
    }

    .puzzle-card {
        padding: 10px;
        min-height: 100px;
    }

    .puzzle-card img {
        width: 40px;
        height: 40px;
    }

    .puzzle-card p {
        font-size: 12px;
    }

    footer {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    footer button, .daily-reward-btn, .ad-banner {
        font-size: 14px;
        padding: 8px;
    }

    .footer-info {
        align-items: center;
    }

    .game-container {
        padding: 10px;
    }

    h1 {
        font-size: 24px;
    }

    .pause-btn, .coin-btn {
        width: 35px;
        height: 35px;
    }

    .word-row span {
        font-size: 14px;
        padding: 3px 8px;
    }

    .game-grid span {
        font-size: 14px;
    }

    .modal-content {
        max-width: 250px;
    }

    .congrats-modal .modal-content {
        font-size: 20px;
    }
}

@media (min-width: 601px) {
    .puzzle-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    footer {
        flex-direction: row;
    }
}

.modal-backdrop {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.6);
backdrop-filter: blur(2px);
display: none;
align-items: center;
justify-content: center;
animation: fadeIn 0.3s ease-out forwards;
z-index: 1000;
}

/* card */
.modal-card {
background: #fff;
border-radius: 12px;
box-shadow: 0 8px 24px rgba(0,0,0,0.2);
width: 320px;
max-width: 90%;
padding: 24px;
text-align: center;
position: relative;
transform: translateY(-20px);
animation: slideIn 0.4s ease-out forwards;
}

/* close button */
.modal-close {
position: absolute;
top: 12px;
right: 12px;
background: transparent;
border: none;
font-size: 1.2rem;
cursor: pointer;
color: #555;
}
.modal-close:hover { color: #000; }

/* image */
.modal-image {
width: 100%;
border-radius: 8px;
margin-bottom: 16px;
}

/* text */
.modal-title {
margin: 0 0 8px;
font-size: 1.4rem;
color: #333;
}
.modal-text {
margin: 0 0 20px;
font-size: 0.95rem;
color: #666;
line-height: 1.4;
}

/* button */
.modal-button {
display: inline-block;
padding: 12px 24px;
font-size: 1rem;
border-radius: 8px;
background: linear-gradient(135deg, #6a11cb, #2575fc);
color: #fff;
text-decoration: none;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.modal-button:hover {
transform: translateY(-2px) scale(1.02);
box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* animations */
@keyframes fadeIn {
from { opacity: 0; }
to   { opacity: 1; }
}
@keyframes slideIn {
from { transform: translateY(-20px); opacity: 0; }
to   { transform: translateY(0);     opacity: 1; }
}