/* ============================================================================
   TABLE OF CONTENTS
   1. Font Declarations
   2. Base Styles
   3. Layout & Background
   4. Header & Title Section
   5. Game Board & Grid
   6. Item Tray
   7. Controls & Buttons
   8. Clues Section
   9. Notes Panel
   10. Timer & Attempts
   11. Dialogs
   12. Responsive Design
============================================================================ */

/* ============================================================================
   1. FONT DECLARATIONS
============================================================================ */
@font-face {
    font-family: 'Arial Rounded MT Bold';
    src: url('fonts/arialroundedmtbold.ttf');
}

@font-face {
    font-family: 'Jack Armstrong';
    src: url('fonts/Jack Armstrong.ttf');
}

/* ============================================================================
   2. BASE STYLES
============================================================================ */
html {
    height: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

/* ============================================================================
   3. LAYOUT & BACKGROUND
============================================================================ */
.bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(1px);
    z-index: 5000;
    transition: all 0.3s ease;
}

/* ============================================================================
   4. HEADER & TITLE SECTION
============================================================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.title {
    margin: 0 0 10px 0;
    position: relative;
    text-align: center;
    z-index: 1;
}

.title img {
    width: 230px;
    height: auto;
}

h1 {
    margin-bottom: 10px;
    margin-top: 0;
}

h1 img {
    display: block;
    position: relative;
    z-index: 2;
    width: 400px;
    height: auto;
}

h2 {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 0;
}

h2 img {
    display: block;
    width: 500px;
    height: auto;
}

.level-banner {
    position: relative;
    display: inline-block;
    margin: 0 auto 10px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-family: 'Arial Rounded MT Bold', sans-serif;
    z-index: 1;
}

.level-banner .level {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: 700;
    font-size: 30px;
}

.level-banner img {
    width: 330px;
    ;
    height: auto;
}

.level {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 36px;
    text-align: center;
    font-family: 'Arial Rounded MT Bold';
}

/* ============================================================================
   5. GAME BOARD & GRID
============================================================================ */
#gameContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

#board {
    display: grid;
    width: fit-content;
    margin: 0 auto 10px;
    justify-content: center;
    align-content: center;
}

#grid {
    display: flex;
    gap: 10px;
    margin: 20px;
}

.slot {
    width: 100px;
    height: 100px;
    background: rgba(230, 230, 230, 0.85);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    border: 2px dashed #bbb;
}

/* ============================================================================
   6. ITEM TRAY
============================================================================ */
#itemTray {
    width: 340px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    background: white;
    border-radius: 10px;
    padding: 10px;
    margin-top: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    scrollbar-width: thin;
    scrollbar-color: #bbb #f5f5f5;
}

#itemTray::-webkit-scrollbar {
    height: 8px;
}

#itemTray::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 4px;
}

#itemTray::-webkit-scrollbar-track {
    background: #f5f5f5;
}

#items {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin: 0 auto;
}

.item {
    flex: 0 0 auto;
    width: 90px;
    height: 90px;
    background: #ffffff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 90px;
    font-weight: bold;
    cursor: grab;
    user-select: none;
    transition: transform 0.2s;
}

.item:active {
    transform: scale(0.95);
    cursor: grabbing;
}

.slot .item {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin: 0 auto;
    font-size: 80px;
    border-radius: 10px;
    gap: 0;
    box-sizing: border-box;
}

/* ============================================================================
   7. CONTROLS & BUTTONS
============================================================================ */
#controls {
    margin-top: 5px;
    text-align: center;
}

#controls p {
    font-family: 'Arial Rounded MT Bold';
    font-size: 17px;
}

#feedback {
    font-weight: bold;
    margin: 15px;
    color: #444;
}

/* Submit Button */
#submitBtn {
    background: #9ACF7C;
    color: white;
    border: none;
    padding: 4px 18px;
    margin-top: 15px;
    border-radius: 11px;
    cursor: pointer;
    font-size: 28px;
    font-family: 'Arial Rounded MT Bold';
    box-shadow: 2px 5px 10px #4c5661;
}

#submitBtn:hover {
    background: #43a047;
    transform: scale(1.05);
}

/* Settings Button */
#settBtn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#settBtn img {
    width: 130%;
    height: 130%;
    object-fit: contain;
}

#settBtn:hover img {
    opacity: 0.7;
    transform: scale(1.1);
    transition: transform 0.1s ease-in-out;
}

/* Utility Buttons (Clear, Shuffle, Hint) */
#clearBtn,
#hintBtn,
#shufBtn {
    border-radius: 50%;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}

#hintBtn {
    position: absolute;
    left: 220px;
    top: 620px;
    z-index: 4000;
}

#clearBtn,
#shufBtn {
    position: absolute;
    right: 50px;
    z-index: 1000;
}

#clearBtn {
    top: 660px;
    right: 120px;
}

#shufBtn {
    top: 660px;
    right: 200px;
}

#clearBtn:hover,
#shufBtn:hover,
#hintBtn:hover {
    opacity: 0.7;
    transform: scale(1.1);
    transition: transform 0.1s ease-in-out;
}

#clearBtn img,
#shufBtn img,
#hintBtn img {
    margin: 0;
    width: 55px;
    height: 55px;
}

/* Enable Sound Button */
#enableSoundBtn {
    position: static;
    margin-top: 12px;
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-weight: 600;
}

#enableSoundBtn:hover {
    background: #43a047;
}

/* Icon Button (Generic) */
.iconBtn {
    position: absolute;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform 0.1s ease-in-out;
}

.iconBtn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.1s ease-in-out;
}

.iconBtn:hover img {
    opacity: 0.7;
    transform: scale(1.1);
}

/* Info Button */
#infoBtn {
    position: absolute;
    left: 10px;
    top: 10px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 100;
    width: 40px;
    height: 45px;
}

/* Navigation Buttons */
#navigation {
    display: flex;
    align-items: center;
    justify-content: center;

    margin-top: 20px;
}

#navigation button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.3s;
}

#navigation button:hover {
    background: #1976D2;
}

#navigation span {
    font-weight: bold;
    color: #333;
}

/* ============================================================================
   8. CLUES SECTION
============================================================================ */
#clues {
    position: absolute;
    left: 50px;
    top: 80px;
    width: 250px;
    height: 615px;
    padding: 0 30px;
    background: url(images/hintSection.png) no-repeat center center;
    background-size: cover;
    background-color: transparent;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    box-sizing: border-box;
    z-index: 4000;
    overflow: visible;
    box-shadow: 2px 5px 10px #b0b7bd;
    font-family: 'Arial Rounded MT Bold';
}

#storySentence {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 260px;
    font-size: clamp(13px, 1.5vw, 11px);
    text-align: center;
    padding: 0 10px;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

#storySentence p {
    margin: 12px 0 12px;
    line-height: 1.4;
    font-style: normal;
}

#storySentence p strong {
    display: block;
    margin-bottom: 4px;
    font-size: clamp(10px, 1.8vw, 12px);
}

#cluesContent {
    position: absolute;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 260px;
    text-align: left;
    box-sizing: border-box;
}

#cluesContent p {
    text-decoration: underline;
    margin: 5px 0;
    font-size: clamp(12px, 2vw, 14.5px);
    text-align: center;
}

#cluesContent ul {
    padding-left: 18px;
    margin: 8px 0 0 0;
    list-style-position: outside;
}

#cluesContent li {
    margin-bottom: 8px;
    font-size: clamp(11px, 1.8vw, 14px);
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Specific styling for Town 2, Level 5 clues */
body[data-town="2"][data-level="5"] #cluesContent li {
    font-size: clamp(12.5px, 1.5vw, 12px);
}

body[data-town="2"][data-level="5"] #cluesContent p {
    font-size: clamp(10px, 1.7vw, 13px);
}

/* ============================================================================
   9. NOTES PANEL
============================================================================ */
#notesContainer {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: absolute;
    right: 50px;
    top: 100px;
    margin-top: 40px;
    width: 297px;
    max-width: 35vw;
    overflow: auto;
    box-sizing: border-box;
    padding: 12px;
    background: url(images/notesBackground.png) no-repeat center center;
    background-size: cover;
    border-radius: 8px;
    z-index: 1000;
    align-items: flex-end;
}

#notesContainer h3 {
    font-family: 'Jack Armstrong';
    font-size: 18px;
    margin: 10px;
    color: #333;
}

#notesChild {
    margin-right: 13px;
    display: flex;
    align-content: space-around;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
    padding: 10px;
    border-radius: 6px;
    width: 80%;
}

#levelNotes {
    width: 100%;
    min-height: 400px;
    padding: 8px;
    box-sizing: border-box;
    border-radius: 4px;
    resize: vertical;
    font-family: 'Jack Armstrong';
    background: transparent;
    border: none;
}

.noteButtons {
    margin-top: 8px;
}

.noteButtons button {
    color: white;
    margin-right: 8px;
    padding: 6px 10px;
    background-color: #aabed7;
    border-radius: 30px;
    font-size: 15px;
    border: none;
    font-family: 'Arial Rounded MT Bold';
    cursor: pointer;
}

.noteButtons:hover {
    opacity: 0.7;
    transform: scale(1.1);
    transition: transform 0.1s ease-in-out;
}

#noteStatus {
    margin-top: 6px;
    color: #2b7a2b;
    font-size: 0.9rem;
}

/* ============================================================================
   10. TIMER & ATTEMPTS
============================================================================ */
#timerControls {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
}

#pauseBtn {
    cursor: pointer;
    background-color: transparent;
    border: none;
    padding: 3px;
}

#pauseBtn img {
    width: 65px;
    height: auto;
}

#pauseBtn:hover {
    opacity: 0.7;
    transform: scale(1.1);
    transition: transform 0.1s ease-in-out;
}

.stopwatch {
    display: flex;
    align-items: center;
    font-weight: bold;
    justify-content: center;
    margin-bottom: -5px;
    margin-top: -5px;
}

.digit {
    font-size: 24px;
    color: black;
    font-family: 'Arial Rounded MT Bold';
}

#attempts {
    position: absolute;
    right: 110px;
    top: 95px;
    color: #333333;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Arial Rounded MT Bold';
    z-index: 1001;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#attempts p {
    margin: 0;
}

/* ============================================================================
   11. DIALOGS
============================================================================ */

/* Common Dialog Styles */
dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.dialog-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s;
}

/* Settings Dialog */
dialog#settingsDialog {
    padding: 24px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    margin: auto;
    background: white;
}

dialog#settingsDialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

#settingsDialog h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.4em;
}

#settingsDialog h4 {
    margin: 16px 0 12px 0;
    color: #888;
    font-size: 0.9em;
    font-style: italic;
    font-weight: 400;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

.settings-content {
    margin-bottom: 24px;
}

.settings-group {
    margin-bottom: 16px;
}

.settings-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.volume-control input[type="range"] {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #e0e0e0;
    outline: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
}

.volume-control input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

#saveSettingsBtn {
    background: #4CAF50;
    color: white;
}

#closeSettingsBtn {
    background: #f5f5f5;
    color: #333;
}

#saveSettingsBtn:hover {
    background: #43a047;
    transform: translateY(-1px);
}

#closeSettingsBtn:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

/* Settings Overlay (fallback) */
#settingsOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
}

/* Info Dialog */
dialog#infoDialog {
    width: 50vw;
    height: 75vh;
    padding: 24px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    background: white;
    overflow-y: auto;
    overflow-x: hidden;
}

dialog#infoDialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

#infoDialog h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.6em;
    text-align: center;
}

.h4 {
    margin-top: 22px;
    margin-bottom: 10px;
    color: #444;
    font-size: 1.1em;
    font-weight: 600;
    padding-left: 8px;
}

#infoDialog p {
    line-height: 1.45;
    color: #575757;
    font-size: 0.97em;
    margin-bottom: 12px;
    text-align: left;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    padding: 10px 0;
}

.feature-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid #afadad;
    background: #fafafa;
    transition: transform 0.15s ease, background 0.2s ease;
}

.feature-card:hover {
    transform: scale(1.02);
    background: #ffffff;
}

/* Feature card colors */
.feature-card:nth-child(1) {
    border-left: 6px solid #766c65;
}

.feature-card:nth-child(2) {
    border-left: 6px solid #8e8df0;
}

.feature-card:nth-child(3) {
    border-left: 6px solid #5ab1e4;
}

.feature-card:nth-child(4) {
    border-left: 6px solid #f29c38;
}

.feature-card:nth-child(5) {
    border-left: 6px solid #90c97d;
}

.feature-card:nth-child(6) {
    border-left: 6px solid #ce6ad3;
}

.feature-card:nth-child(7) {
    border-left: 6px solid #e86a6a;
}

.feature-card:nth-child(8) {
    border-left: 6px solid #6ac7c2;
}

.feature-card:nth-child(9) {
    border-left: 6px solid #ebd773;
}

.feature-card:nth-child(10) {
    border-left: 6px solid #9b7df0;
}

.feature-card:nth-child(11) {
    border-left: 6px solid #ffa4cf;
}

.feature-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.feature-card:nth-child(7) .feature-icon,
.feature-card:nth-child(8) .feature-icon,
.feature-card:nth-child(9) .feature-icon {
    width: 120px;
    height: 80px;
}

#closeInfoBtn {
    background: #f5f5f5;
    color: #333;
}

#closeInfoBtn:hover {
    background: #e0e0e0;
    transform: scale(1.03);
}

/* Pause Dialog */
#pauseDialog {
    border: none;
    border-radius: 0;
    padding: 0;
    max-width: 600px;
    width: auto;
    height: auto;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: transparent;
    position: relative;
    text-align: center;
    overflow: visible;
}

#pauseDialog::backdrop {
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

#pauseDialog .dialog-content {
    padding: 2rem;
    text-align: center;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#pauseDialog h2 {
    margin: 1rem 0;
    font-size: 2rem;
    font-weight: bold;
}

#pauseDialog .dialog-buttons {
    display: flex;
    flex-direction: column;
    position: absolute;
    left: 24%;
    top: 26%;
    gap: 12px;
    margin-bottom: 27px;
    width: 100%;
    max-width: 300px;
}

#pauseDialog button {
    padding: 12px 24px;
    font-size: 30px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 2px 5px 10px #74777a;
    font-family: "Arial Rounded MT Bold";
    color: white;
}

#pauseDialog #resumeBtn {
    background: #9ACF7C;
}

#pauseDialog #resumeBtn:hover {
    background: #69c733;
    transform: scale(1.05);
}

#pauseDialog #pauseRetryBtn {
    background: #D26665;
}

#pauseDialog #pauseRetryBtn:hover {
    background: #a83a38;
    transform: scale(1.05);
}

#pauseDialog #pauseLevelsBtn {
    background: #FFC517;
}

#pauseDialog #pauseLevelsBtn:hover {
    background: #d6a410;
    transform: scale(1.05);
}

#pauseDialog #pauseTownsBtn {
    background: #5DADE2;
}

#pauseDialog #pauseTownsBtn:hover {
    background: #3498DB;
    transform: scale(1.05);
}

#pauseDialog #pauseHomeBtn {
    background: #9B59B6;
}

#pauseDialog #pauseHomeBtn:hover {
    background: #8E44AD;
    transform: scale(1.05);
}

/* Level End Dialog */
.level-end-dialog {
    text-align: center;
}

.level-end-dialog .dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.level-end-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.level-end-dialog h1 {
    margin: 0 0 20px 0;
    text-align: center;
    color: #00695C;
    font-weight: bold;
    font-size: 2em;
    font-family: "Arial Rounded MT Bold";
}

.level-end-dialog h3 {
    margin: 0 0 20px 0;
    text-align: center;
    color: #000000;
    font-weight: normal;
    font-size: 1.5em;
    font-family: "Arial Rounded MT Bold";
}

.level-end-dialog button {
    margin-top: 10px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s;
    color: white;
    font-family: "Arial Rounded MT Bold";
}

.level-end-dialog #endBtn {
    background: #FFC517;
}

.level-end-dialog #endBtn:hover {
    background: #d6a410;
    transform: translateY(-1px);
}

.level-end-dialog #retryBtn {
    background: #D26665;
}

.level-end-dialog #retryBtn:hover {
    background: #a83a38;
    transform: translateY(-1px);
}

.level-end-dialog #nextLevelBtn {
    background: #9ACF7C;
}

.level-end-dialog #nextLevelBtn:hover {
    background: #69c733;
    transform: translateY(-1px);
}

dialog#levelEndDialog {
    border: none;
    border-radius: 0;
    padding: 0;
    max-width: min(600px, 90vw);
    max-height: min(80vh, 80vh);
    width: auto;
    height: auto;
    background-image: url('images/Success.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: transparent;
    position: relative;
    text-align: center;
    overflow: visible;
}

dialog#levelEndDialog form {
    padding: 40px 40px 20px 40px;
    min-width: 400px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

#levelEndDialog h1 {
    margin-top: 41px;
    margin-bottom: 0;
    margin-left: 8px;
    font-size: 35px;
    color: #ffffff;
    font-family: "Arial Rounded MT Bold";
}

#levelEndDialog h3 {
    display: none;
}

#levelEndDialog .dialog-buttons {
    display: flex;
    position: absolute;
    bottom: 10%;
    gap: 12px;
    margin-bottom: 27px;
    width: 100%;
    max-width: 375px;
}

#levelEndDialog .dialog-buttons button {
    padding: 12px 24px;
    font-size: 30px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 2px 5px 10px #74777a;
    font-family: "Arial Rounded MT Bold";
}

dialog#levelEndDialog::before {
    display: none;
}

/* Stars Animation */
#starsContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    width: 100%;
}

#starsContainer .star {
    width: 19%;
    opacity: 0;
    animation: starPop 0.4s ease 0.2s both;
}

.stars-container .star:nth-child(2) {
    animation: starPop 0.4s ease 0.4s both;
}

.stars-container .star:nth-child(3) {
    animation: starPop 0.4s ease 0.6s both;
}

@keyframes starPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Game Complete Dialog */
dialog#gameCompleteDialog {
    border: none;
    border-radius: 0;
    padding: 0;
    max-width: min(600px, 90vw);
    max-height: min(80vh, 80vh);
    width: auto;
    height: auto;
    background-image: url('images/gameComplete.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: transparent;
    position: relative;
    text-align: center;
    overflow: visible;
}

dialog#gameCompleteDialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

dialog#gameCompleteDialog form {
    padding: 40px 40px 20px 40px;
    min-width: 400px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

dialog#gameCompleteDialog .dialog-art {
    display: none;
}

dialog#gameCompleteDialog .dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    position: absolute;
    bottom: -72%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
}

dialog#gameCompleteDialog .dialog-buttons button {
    padding: 14px 28px;
    font-size: 28px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Arial Rounded MT Bold';
    transition: all 0.3s ease;
    box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.3);
    min-width: 140px;
    border: none;
}

dialog#gameCompleteDialog .yellow-btn {
    background: #FFD029;
    color: #ffffff;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

dialog#gameCompleteDialog .yellow-btn:hover {
    background: #FFC517;
    transform: scale(1.05);
}

dialog#gameCompleteDialog .red-btn {
    background: #D56A6A;
    color: white;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

dialog#gameCompleteDialog .red-btn:hover {
    background: #C44B4B;
    transform: scale(1.05);
}
#confettiAnimation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}
/* Game Complete Dialog - stats */
dialog#gameCompleteDialog #gameStats {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;

    max-width: 365px;
    /* background: rgba(255, 255, 255, 0.9); */
    padding: 10px 14px;
    border-radius: 12px;
    /* box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

dialog#gameCompleteDialog .stats-text {
    font-family: 'Arial Rounded MT Bold';
    color: #333;
    font-size: 18px;
    letter-spacing: 0.3px;
}

.star-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-width: 100%;
    overflow: auto;
    padding: 4px 0;
}

.tiny-star {
    width: 30px;
    height: 25px;

    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

/* Responsive adjustments for Game Complete Dialog */
@media (max-width: 768px) {
    dialog#gameCompleteDialog form {
        min-width: 300px;
        padding: 30px 20px 20px 20px;
    }

    dialog#gameCompleteDialog .dialog-buttons {
        flex-direction: column;
        gap: 12px;
        max-width: 250px;
    }

    dialog#gameCompleteDialog .dialog-buttons button {
        font-size: 24px;
        padding: 12px 24px;
        width: 100%;
    }

    dialog#gameCompleteDialog #gameStats {
        top: 15%;
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    dialog#gameCompleteDialog {
        max-width: 95vw;
    }

    dialog#gameCompleteDialog form {
        min-width: 250px;
        padding: 20px 15px 15px 15px;
    }

    dialog#gameCompleteDialog .dialog-buttons button {
        font-size: 20px;
        padding: 10px 20px;
    }

    .tiny-star {
        width: 16px;
        height: 16px;
    }

    dialog#gameCompleteDialog .stats-text {
        font-size: 15px;
    }

    dialog#gameCompleteDialog #gameStats {
        top: 12%;
        max-width: 90%;
    }
}

/* ============================================================================
   12. RESPONSIVE DESIGN
============================================================================ */

/* Clues Panel - Mobile */
@media (max-width: 768px) {
    #clues {
        width: 220px;
        height: auto;
        min-height: 500px;
        left: 20px;
        padding: 0 20px;
    }

    #storySentence {
        top: 15px;
        max-width: 180px;
    }

    #cluesContent {
        top: 100px;
        max-width: 180px;
    }
}

@media (max-width: 480px) {
    #clues {
        position: static;
        width: 90%;
        max-width: 300px;
        margin: 20px auto;
        height: auto;
    }

    #storySentence,
    #cluesContent {
        position: static;
        transform: none;
        left: auto;
        top: auto;
        width: 100%;
        max-width: 100%;
        margin: 10px 0;
    }
}

/* Notes Panel - Mobile */
@media (max-width: 900px) {
    #notesContainer {
        position: static;
        width: auto;
        max-width: none;
        max-height: none;
        margin: 12px;
        background: url('images/notesBackground.png') no-repeat center center;
        background-size: cover;
    }
}

/* Level End Dialog - Laptop Breakpoints */
@media (min-width: 1280px) and (max-width: 1440px) and (min-height: 800px) and (max-height: 900px) {
    dialog#levelEndDialog {
        max-width: min(550px, 85vw);
        max-height: 68vh;
    }

    dialog#levelEndDialog form {
        min-width: 380px;
        padding: 38px 30px 20px 30px;
    }

    #levelEndDialog h1 {
        font-size: 32px;
        margin: 38px 0 0 15px;
    }

    #levelEndDialog .dialog-buttons {
        bottom: 15%;
        max-width: 350px;
        gap: 11px;
    }

    #levelEndDialog .dialog-buttons button {
        font-size: 28px;
        padding: 11px 22px;
    }

    #levelEndDialog #starsContainer {
        top: 32%;
    }

    #levelEndDialog #starsContainer .star {
        width: 18%;
    }
}

@media (min-width: 1366px) and (max-width: 1920px) and (min-height: 768px) and (max-height: 1080px) {
    dialog#levelEndDialog {
        max-width: min(520px, 82vw);
        max-height: 77vh;
    }

    dialog#levelEndDialog form {
        min-width: 360px;
        padding: 36px 28px 20px 28px;
    }

    #levelEndDialog h1 {
        font-size: 30px;
        margin: 36px 0 0 18px;
    }

    #levelEndDialog .dialog-buttons {
        bottom: 9%;
        max-width: 340px;
        gap: 10px;
    }

    #levelEndDialog .dialog-buttons button {
        font-size: 32px;
        padding: 10px 13px;
    }

    #levelEndDialog #starsContainer {
        top: 25%;
    }

    #levelEndDialog #starsContainer .star {
        width: 22%;
    }
}

@media (min-width: 1024px) and (max-width: 1366px) and (min-height: 600px) and (max-height: 768px) {
    dialog#levelEndDialog {
        max-width: min(480px, 80vw);
        max-height: 80vh;
    }

    dialog#levelEndDialog form {
        min-width: 330px;
        padding: 32px 24px 18px 24px;
    }

    #levelEndDialog h1 {
        font-size: 27px;
        margin: 32px 0 0 16px;
    }

    #levelEndDialog .dialog-buttons {
        bottom: 10%;
        max-width: 310px;
        gap: 10px;
    }

    #levelEndDialog .dialog-buttons button {
        font-size: 25px;
        padding: 10px 19px;
    }

    #levelEndDialog #starsContainer {
        top: 25%;
    }

    #levelEndDialog #starsContainer .star {
        width: 20%;
    }
}

@media (min-width: 1440px) and (max-width: 1920px) and (min-height: 900px) and (max-height: 1200px) {
    dialog#levelEndDialog {
        max-width: min(580px, 88vw);
        max-height: 70vh;
    }

    dialog#levelEndDialog form {
        min-width: 400px;
        padding: 40px 32px 22px 32px;
    }

    #levelEndDialog h1 {
        font-size: 34px;
        margin: 40px 0 0 12px;
    }

    #levelEndDialog .dialog-buttons {
        bottom: 16%;
        max-width: 370px;
        gap: 12px;
    }

    #levelEndDialog .dialog-buttons button {
        font-size: 29px;
        padding: 12px 23px;
    }

    #levelEndDialog #starsContainer {
        top: 33%;
    }

    #levelEndDialog #starsContainer .star {
        width: 19%;
    }
}

@media (min-width: 1600px) and (max-width: 1920px) and (min-height: 900px) and (max-height: 1080px) {
    dialog#levelEndDialog {
        max-width: min(560px, 86vw);
        max-height: 68vh;
    }

    dialog#levelEndDialog form {
        min-width: 390px;
        padding: 38px 30px 20px 30px;
    }

    #levelEndDialog h1 {
        font-size: 32px;
        margin: 38px 0 0 14px;
    }

    #levelEndDialog .dialog-buttons {
        bottom: 15%;
        max-width: 360px;
        gap: 11px;
    }

    #levelEndDialog .dialog-buttons button {
        font-size: 28px;
        padding: 11px 22px;
    }

    #levelEndDialog #starsContainer {
        top: 32%;
    }

    #levelEndDialog #starsContainer .star {
        width: 18%;
    }
}

/* Tablets */
@media (min-width: 601px) and (max-width: 1024px) and (min-height: 500px) and (max-height: 800px) {
    dialog#levelEndDialog {
        max-width: min(450px, 85vw);
        max-height: 62vh;
    }

    dialog#levelEndDialog form {
        min-width: 300px;
        padding: 28px 20px 18px 20px;
    }

    #levelEndDialog h1 {
        font-size: 25px;
        margin: 28px 0 0 18px;
    }

    #levelEndDialog .dialog-buttons {
        bottom: 12%;
        max-width: 280px;
        gap: 10px;
    }

    #levelEndDialog .dialog-buttons button {
        font-size: 23px;
        padding: 9px 18px;
    }

    #levelEndDialog #starsContainer {
        top: 29%;
    }

    #levelEndDialog #starsContainer .star {
        width: 17%;
    }
}

/* Small Tablets/Large Phones */
@media (min-width: 481px) and (max-width: 600px) and (min-height: 450px) and (max-height: 750px) {
    dialog#levelEndDialog {
        max-width: min(400px, 90vw);
        max-height: 55vh;
    }

    dialog#levelEndDialog form {
        min-width: 220px;
        padding: 20px 12px 12px 12px;
    }

    #levelEndDialog h1 {
        font-size: 20px;
        margin: 20px 0 0 12px;
    }

    #levelEndDialog .dialog-buttons {
        bottom: 10%;
        max-width: 220px;
        gap: 8px;
    }

    #levelEndDialog .dialog-buttons button {
        font-size: 19px;
        padding: 7px 14px;
    }

    #levelEndDialog #starsContainer {
        top: 27%;
    }

    #levelEndDialog #starsContainer .star {
        width: 16%;
    }
}

/* Large Phones */
@media (min-width: 376px) and (max-width: 480px) and (min-height: 400px) and (max-height: 700px) {
    dialog#levelEndDialog {
        max-width: min(350px, 95vw);
        max-height: 50vh;
    }

    dialog#levelEndDialog form {
        min-width: 180px;
        padding: 15px 8px 8px 8px;
    }

    #levelEndDialog h1 {
        font-size: 17px;
        margin: 15px 0 0 10px;
    }

    #levelEndDialog .dialog-buttons {
        bottom: 8%;
        max-width: 180px;
        gap: 6px;
    }

    #levelEndDialog .dialog-buttons button {
        font-size: 16px;
        padding: 6px 10px;
    }

    #levelEndDialog #starsContainer {
        top: 25%;
    }

    #levelEndDialog #starsContainer .star {
        width: 15%;
    }
}

/* Small Phones */
@media (max-width: 375px) and (min-height: 350px) and (max-height: 700px) {
    dialog#levelEndDialog {
        max-width: 95vw;
        max-height: 45vh;
    }

    dialog#levelEndDialog form {
        min-width: 160px;
        padding: 12px 6px 6px 6px;
    }

    #levelEndDialog h1 {
        font-size: 15px;
        margin: 12px 0 0 8px;
    }

    #levelEndDialog .dialog-buttons {
        bottom: 6%;
        max-width: 150px;
        gap: 5px;
    }

    #levelEndDialog .dialog-buttons button {
        font-size: 14px;
        padding: 5px 8px;
    }

    #levelEndDialog #starsContainer {
        top: 24%;
    }

    #levelEndDialog #starsContainer .star {
        width: 14%;
    }
}

/* Landscape Orientation */
@media (max-height: 500px) {
    dialog#levelEndDialog {
        max-height: 80vh;
    }

    dialog#levelEndDialog form {
        padding: 10px;
        min-width: 150px;
    }

    #levelEndDialog h1 {
        font-size: 14px;
        margin: 10px 0 0 8px;
    }

    #levelEndDialog .dialog-buttons {
        bottom: 5%;
        max-width: 140px;
    }

    #levelEndDialog .dialog-buttons button {
        font-size: 13px;
        padding: 4px 8px;
    }

    #levelEndDialog #starsContainer {
        top: 22%;
    }

    #levelEndDialog #starsContainer .star {
        width: 13%;
    }
}