:root {
    --primary-color: #0d6efd; /* A slightly brighter blue for dark mode */
    --success-color: #198754;
    --error-color: #dc3545;
    --background-color: #121212; /* Main dark background */
    --surface-color: #151515; /* Color for cards, containers */
    --tile-color: #2c2c2c; /* Tile background */
    --tile-border: #444444;
    --text-color: #e0e0e0; /* Primary text color */
    --text-muted-color: #a0a0a0; /* Secondary text color */
}

body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    transition: align-items 0.3s ease; /* Smooth transition for centering */
}

body.is-start-screen {
    align-items: center;
}

body.no-scroll {
    overflow: hidden;
    overscroll-behavior-y: contain;
}

.hidden {
    display: none !important;
}

.game-container {
    width: 100%;
    max-width: 500px;
    text-align: center;
}




.game-area {
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--tile-border);
}

/* Styles for tablets (min-width: 768px) */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }
  .game-area {
    padding: 0;
    border: none;
  }
}


h1 {
    margin-top: 0;
    margin-bottom: 5px; /* MOVED HERE */
    font-family: 'Caprasimo', cursive;
    font-size: 3rem;
    font-weight: 400;
}

#start-button, #play-again-button, #rules-button, #summary-share-button, #summary-play-again-button, #close-rules-main-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 5px;
}

#summary-share-button {
    background-color: #17a2b8;
}

#start-button:hover, #play-again-button:hover, #rules-button:hover, #summary-share-button:hover, #summary-play-again-button:hover {
    filter: brightness(1.2);
}

#daily-summary-container {
    border: 2px solid var(--tile-border);
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
    background-color: var(--background-color);
}

#daily-summary-container .found-words-container {
    margin-top: 20px;
    margin-bottom: 20px;
}

#daily-summary-container h3 {
    margin-top: 0;
}

#daily-summary-container p {
    font-size: 18px;
}

#come-back-message {
    color: var(--text-muted-color);
    margin-top: 15px;
    font-style: italic;
}

.info-panel {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.info-box {
    background: var(--tile-color);
    padding: 10px 20px;
    border-radius: 5px;
    flex-grow: 1;
    margin-right: 15px;
}

.lives-box {
    margin-right: 0px;
}

.info-box h3 {
    margin: 0 0 5px;
    font-size: 16px;
    color: var(--text-muted-color);
}

.info-box p {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

.word-display {
    min-height: 40px;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 20px;
    padding: 10px;
    border: 2px solid var(--tile-border);
    border-radius: 5px;
    color: var(--primary-color);
    background-color: var(--background-color);
}

.grid-container {
    display: grid;
    gap: 5px;
    margin: -5px;
    -webkit-user-select: none;
    user-select: none;
}

.tile {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: transparent;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    pointer-events: none; 
}

.tile-letter {
    width: 75%;
    height: 75%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1em;
    cursor: pointer;
    pointer-events: auto;
    border-radius: 2px;
    background-color: var(--tile-color);
    border: 1px solid var(--tile-color);
    transition: background-color 0.2s;
}

.tile .tile-letter:before {
    opacity: 0;
    display: block;
    content: "";
    position: absolute;
    background-color: var(--primary-color);
    z-index: -30;
    transition: opacity 0.5s;
    pointer-events: none;
}
.tile.left .tile-letter:before,
.tile.right .tile-letter:before,
.tile.top .tile-letter:before,
.tile.bot .tile-letter:before {
    opacity: 1;
}
.tile.left .tile-letter:before,
.tile.right .tile-letter:before {
    width: 50%;
    height: 20%;
}
.tile.top .tile-letter:before,
.tile.bot .tile-letter:before {
    width: 20%;
    height: 50%;
}
.tile.left .tile-letter:before {
    left: -30%;
}
.tile.right .tile-letter:before {
    right: -30%;
}
.tile.top .tile-letter:before {
    top: -30%;
}
.tile.bot .tile-letter:before {
    bottom: -30%;
}
.tile.bot.left .tile-letter:before,
.tile.bot.right .tile-letter:before {
    bottom: -60%;
    height: 100%;
    width: 20%;
}
.tile.bot.left .tile-letter:before {
    left: -19%;
    transform: rotate(45deg);
}
.tile.bot.right .tile-letter:before {
    right: -19%;
    transform: rotate(-45deg);
}
.tile.top.right .tile-letter:before,
.tile.top.left .tile-letter:before {
    top: -60%;
    height: 100%;
    width: 20%;
}
.tile.top.right .tile-letter:before {
    right: -19%;
    transform: rotate(45deg);
}
.tile.top.left .tile-letter:before {
    left: -19%;
    transform: rotate(-45deg);
}

.tile.selected .tile-letter {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tile.selected {
    transition: transform 0.1s;
}

.tile.selected.first {
    z-index: 100;
}

.tile.selected.first .tile-letter {
    background-color: #002a67;
    box-shadow: inset 0 0 0 3px var(--primary-color);
}

.found-words-container {
    margin-top: 20px;
    text-align: left;
}

.found-words-container h4 {
    margin-bottom: 5px;
    text-align: center;
}

#found-words-list, #summary-found-words-list {
    list-style-type: none;
    padding: 10px;
    max-height: 150px;
    overflow-y: auto;
    background: var(--tile-color);
    border-radius: 5px;
    margin: 0;
}

#found-words-list li, #summary-found-words-list li {
    padding: 5px;
    border-bottom: 1px solid var(--tile-border);
}

#found-words-list li:last-child, #summary-found-words-list li:last-child {
    border-bottom: none;
}

.grid-container.valid {
    animation: feedback-anim-dark 0.5s ease;
    --feedback-color: var(--success-color);
}

.grid-container.invalid {
    animation: feedback-anim-dark 0.5s ease;
    --feedback-color: var(--error-color);
}

@keyframes feedback-anim-dark {
    0%, 100% {
        box-shadow: 0 0 0px var(--feedback-color);
    }
    50% {
        box-shadow: 0 0 15px 5px var(--feedback-color);
    }
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface-color);
    padding: 25px;
    margin: 15px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--tile-border);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    max-width: 460px;
}


.modal-content ul {
    list-style-position: outside;
    text-align: left;
    margin-bottom: 20px;
    padding-left: 0;
    
}

.modal-content ul li {
    margin-bottom: 10px;
}

.close-button {
    position: absolute;
    top: 5px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-muted-color);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}

.close-button:hover {
    color: var(--text-color);
}

/* NEW: Toast Notification Styles */
.toast {
    position: fixed;
    left: 50%;
    bottom: -100px; /* Start off-screen */
    transform: translateX(-50%);
    background-color: var(--success-color);
    color: white;
    padding: 16px;
    border-radius: 8px;
    z-index: 2000;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    transition: bottom 0.5s ease-in-out;
}

.toast.show {
    bottom: 30px; /* Slide into view */
}

.copy-right {
    position: fixed; bottom: 10px; right: 15px; font-family: 'Poppins', sans-serif; font-size: 14px; color: rgba(255, 255, 255, 0.6); z-index: 50; text-align: right; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    display: none;;
}

.is-start-screen .copy-right {
    display: block;
}


/* Styles for tablets (min-width: 768px) */
@media (max-width: 520px) {
    .modal-content {
        margin: 0px;
        padding: 30px;
        height: calc(100% - 60px);
        overflow: scroll;
        border: none;
    }
    .copy-right {
        font-size: 10px;
    }
}