body {
    background: #f5fbff;
    color: #0f394c;
    transition: background 0.3s ease, color 0.3s ease;
}

body.dark-theme {
    background: #0f394c;
    color: #ffffff;
}

body.dark-theme .game-container .game-header, body.dark-theme .swal2-cancel, body.dark-theme .keyboard-row .key-btn:not([data-status]), body.dark-theme .next-btn, body.dark-theme .share-btn, body.dark-theme #setCustomWordBtn, body.dark-theme #applyCustomWord {
    background: #185977!important;
    color: #ffffff;
}

body.dark-theme #themeToggle, body.dark-theme .modal-content h2, body.dark-theme .game-container .game-header h1, body.dark-theme .stats-content h2, body.dark-theme .stats-content h3 {
    color: #fff!important;
}

body.dark-theme .modal-content, body.dark-theme .stats-content, body.dark-theme .swal2-popup {
    background: #0f394c;
    color: #ffffff;
}

body.dark-theme .letter-box:not(.correct):not(.present):not(.absent) {
    border: 2px solid grey;
    color: #fff;
    background: #0f394c;
}

body.dark-theme .letter-box.filled {
  animation: pop-in-dark 0.2s ease;
}

@keyframes pop-in-dark {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

body.dark-theme .bars-container div:not(.bar-filled) {
    background: #185977;
}

body.dark-theme .keyboard-row button.clicked  {
    background: #0f394c!important;
}


body.dark-theme header, body.dark-theme footer {
    background: #185977;
    color: #ffffff;
}

body.dark-theme header img {
    filter: invert(1) brightness(2);
}

body.dark-theme footer .copyright {
    background: #0f394c;
}

body.dark-theme nav ul .dropdown-active, body.dark-theme nav ul .dropdown i {
    background-color: #185977!important;
}

body.dark-theme header i, body.dark-theme nav ul li a, body.dark-theme footer span, body.dark-theme footer h4, body.dark-theme footer a {
    color: #ffffff!important;
}



#themeToggle {
    background: none;
    border: none;
    color: #0f394c;
}

.game-wrapper {
    max-width: 600px;
    width: 100%;
}

.hidden {
    display: none;
}

/* Header */
.game-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(15, 57, 76, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Word Grid */
.word-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 1.5rem auto;
    width: fit-content;
}

.letter-box {
    width: 54px;
    height: 54px;
    border: 2px solid rgba(15, 57, 76, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    background: white;
    color: #0f394c;
    transition: all 0.2s ease;
}

/*.letter-box.filled { border-color: #49b5e7; }*/
.letter-box.correct { background: #6aaa64; color: white; }
.letter-box.present { background: #c9b458; color: white; }
.letter-box.absent { background: #787c7e; color: white; }

/* Virtual Keyboard */
.virtual-keyboard {
    border-radius: 12px;
    margin-top: 1.5rem;
}

.keyboard-row {
    display: flex;
    justify-content: center;
}

.key-btn {
    padding: clamp(0.4rem, 1vh, 1.1rem) clamp(0.6rem, 2vw, 1.1rem);
    min-width: min-content;
    width: clamp(2.5rem, 8vw, 5rem);
    margin: 0.5rem clamp(0.2rem, 1vw, 1rem);;
    font-size: clamp(0.8125rem, 0.0625rem + 4vw, 1.5625rem);
    border: none;
    border-radius: 6px;
    background: #e3e3e3;
    cursor: pointer;
    font-weight: 600;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}
.key-btn[data-status="correct"] { background: #6aaa64; color: white; }
.key-btn[data-status="present"] { background: #c9b458; color: white; }
.key-btn[data-status="absent"] { background: #787c7e; color: white; }

.keyboard-row .key-btn:active {
  transform: scale(0.95);
}

.stats-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
}

.progress-bar {
    height: 20px;
    background: #eee;
    border-radius: 10px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #6aaa64;
    transition: width 0.3s ease;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    animation: toastFade 3s forwards;
    z-index: 1100;
    display: none;
    width: 75%;
    max-width: 300px;
    text-align: center;
}

@keyframes toastFade {
    0% { opacity: 0; top: -60px; }
    10% { opacity: 1; top: 60px; }
    90% { opacity: 1; top: 60px; }
    100% { opacity: 0; top: -60px; }
}

/* Rules Modal */
.rules-modal, .stats-modal, .setting-modal, .customWord-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.rules-modal.show, .stats-modal.show, .setting-modal.show, .customWord-modal.show {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.rules-modal.hide, .stats-modal.hide, .setting-modal.hide, .customWord-modal.hide {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    margin: 1rem;
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: #0f394c;
}

.modal-content li {
    margin-bottom: 1rem;
}

.example-row {
    display: flex;
    gap: 5px;
    margin: 1rem 0;
}

.example-box {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.correct-example { background: #6aaa64; color: white; border-color: #6aaa64; }
.present-example { background: #c9b458; color: white; border-color: #c9b458; }
.absent-example { background: #787c7e; color: white; border-color: #787c7e; }

.close-btn, .next-btn, .share-btn, #setCustomWordBtn, #applyCustomWord, .cancel-btn {
    background: #49b5e7;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
}

.close-btn:hover, .next-btn:hover, .share-btn:hover, #setCustomWordBtn:hover, #applyCustomWord:hover, .cancel-btn:hover {
    opacity: 0.8;
}

.cancel-btn {
    background: rgb(221, 51, 51);
}

.game-container .game-header i {
    cursor: pointer;
    font-size: 30px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.statsDivContainer {
    display: flex;
    justify-content: space-evenly;
    margin: 20px 0;
}

.statsDivContainer .statsDiv {
    text-align: center;
    font-size: 18px;
}

.statsDivContainer .statsDiv span {
    font-weight: 700;
}

.statsDivContainer .statsDiv p {
    margin: 0;
}

.bars-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: baseline;
    margin: 10px 0;
}

.bars-container div {
    width: 100%;
    height: 20px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
}

.bars-container .bar-filled {
    height: 100%;
    background-color: rgb(106, 170, 100);
    transition: width 0.3s;
    text-align: right;
    padding-right: 10px;
    color: #fff;
    min-width: 30px;
    display: flex;
    justify-content: end;
    align-items: center;
    font-weight: 600;
    transition: width 1s ease-in-out;
}

.stats-content .key-btn.wide {
    font-size: 14px;
}

.stats-modal .stats-content .fa-xmark, .setting-modal .fa-xmark {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 20px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.stats-modal .stats-content i:hover {
    opacity: 0.8;
}

@keyframes pop-in {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pop-out {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.8);
  }
  100% {
    transform: scale(1);
  }
}

.letter-box.filled {
  animation: pop-in 0.2s ease;
}

.letter-box.removed {
  animation: pop-out 0.2s ease;
}

.keyboard-row button {
    transition: transform 0.1s ease, background-color 0.1s ease;
}

.keyboard-row button.clicked  {
    transform: scale(0.95);
    background: #d0f0c0;
}

.sub-head {
    display: flex;
    gap: 20px;
}

.letter-box.filled.absent, .letter-box.filled.present, .letter-box.filled.correct {
    animation: pop-in 0.2s ease;
}

.flip {
    animation: flip 0.3s ease forwards;
}


.game-container {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 87px);
}

.stats-modal .stats-content .fa-share, .close-btn i {
    margin-right: 5px;
}

.stats-modal .stats-content .fa-arrow-right {
    margin-left: 5px;
}

.setting-modal .setting-content .setting-child {
    border-top: 1px solid grey;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 10px 0;
}

.setting-modal .setting-content .setting-child:last-child {
     border-bottom: 1px solid grey;
}

.setting-modal .setting-content .setting-child h3 {
    text-align: left;
    font-size: 20px;
}

.setting-modal .setting-content .setting-child span {
    font-size: 15px;
}

.setting-modal .setting-content .setting-child i {
    font-size: 30px;
}

.setting-modal .setting-content .setting-child i:hover {
    opacity: 0.8;
}

/* Toggle Switch */
.setting-modal .setting-content .toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.setting-modal .setting-content .toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.setting-modal .setting-content .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.setting-modal .setting-content .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.setting-modal .setting-content input:checked + .slider {
  background-color: #4CAF50;
}

.setting-modal .setting-content input:checked + .slider:before {
  transform: translateX(24px);
}

.setting-modal .setting-content i {
    cursor: pointer;
}

.setting-modal .setting-content #setCustomWordBtn {
    padding: 4px 15px;
    text-transform: uppercase;
}

.setting-modal .setting-content {
    text-align: left;
}

.customWord-modal .modal-content h2 {
    text-align: center;
}

.customWord-modal .button-div {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.customWord-modal .button-div i {
    font-size: 15px;
    margin-right: 5px;
}

.custom-wordle {
    position: fixed;
    right: 10px;
    bottom: 10px;
}

@media screen and (max-width: 650px) {
  .game-container { 
    min-height: calc(100dvh - 70px);
  }
}

@media screen and (max-width: 1199px) {
    body.dark-theme nav ul {
        background: #0f394c;
    }
}

@media screen and (min-width: 1200px) {
    body.dark-theme nav ul .dropdown ul {
        background: #0f394c;
    }
}

.game-container h1 {
    margin: 0;
}

@keyframes flip {
    0% {
        transform: rotateX(0);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0);
    }
}

/* Pop effect */
.pop {
    animation: pop 0.2s ease!important;
}

@keyframes pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}