@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@100;200;300;400;500;600;700;900&display=swap');

html, body {
    font-family: 'Figtree';
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    -webkit-user-select: none;
       -moz-user-select: none;
            user-select: none;
}

:root {
    --cellSize: 50px;
    --cardRotation: 0deg;
    --counter-font-size: 24px;  
    --drawer-width:300px;
    --card-transition-time:0.01s;
    --drawer-top: 50px;
    --nav-top: 50px;
    --logo-mid-size: 70px; /* Default size for bigoctoghost */
    --lock-icon-size: 20px;

    /* Base theme colors */
    --bg-color: #f6f6f6;
    --text-color: #000000;
    --nav-bg: rgb(243, 243, 243);
    --nav-border: rgba(208, 208, 208, 1);
    --drawer-bg: #f4f4f4;
    --painter-drawer-bg: #f8f8f8;
    --button-bg: white;
    --button-border: #555555;
    --card-shadow: rgb(0, 0, 0);
    --grid-lines: grey;
    --counter-color: #000000;
    --counter-color-black: #ffffff;

    /* CMYK Colors - Light Mode */
    --color-cyan: #0ff;
    --color-magenta: #f0f;
    --color-yellow: #ff0;
    --color-black: #000;
    
    /* Alternative Palette - Light Mode (default, will be overridden when palette is active) */
    --color-cyan-alt: #8575fc;
    --color-magenta-alt: #00B487;
    --color-yellow-alt: #FFC548;
    --color-black-alt: #ff852e;
    
    /* Alternative Background Colors - Light Mode */
    --bg-color-alt: #DBC8FE;
    --nav-bg-alt: #B9A6FC; 
    --color-white: #ffffff;
    --color-grey: grey;
    --color-cell: rgb(0, 255, 110);
    --color-always-black: #000000;
    --color-always-white: #ffffff;
    
    /* Link colors */
    --link-color: #0066cc;
    --link-hover-color: #004499;
    --link-visited-color: #663399;

    /* Clue colors - use CSS variables with opacity */
    --clue-opacity: 0.6;
    --clue-black-opacity: 0.6;

    /* Level lock icon */
    --lock-icon-filter: invert(.8);
}

/* Dark mode colors */

[data-theme="dark"] {
    --bg-color: #000;
    --text-color: #ffffff;
    --nav-bg: #1f1f1f;
    --nav-border: #404040;
    --drawer-bg: #2d2d2d;
    --painter-drawer-bg: #2d2d2d;
    --button-bg: #8b8b8b;
    --button-inactive-bg: #555555;
    --button-border: #666666;
    --card-shadow: rgb(0, 0, 0);
    --grid-lines: #404040;
    --counter-color: #ffffff;
    --counter-color-black: #000000;
    --color-always-white: #ffffff;
    
    /* Link colors - Dark Mode */
    --link-color: #66b3ff;
    --link-hover-color: #99ccff;
    --link-visited-color: #cc99ff;

    /* CMYK Colors - Dark Mode */
    --color-cyan: #0ff;
    --color-magenta: #f0f;
    --color-yellow: #ff0;  
    --color-black:  rgb(128, 128, 128);    /* Black */
    
    /* Alternative Palette - Dark Mode */
    --color-cyan-alt: #8575fc;
    --color-magenta-alt: #00B487;
    --color-yellow-alt: #FFC548;
    --color-black-alt: #ff852e;
    
    /* Alternative Background Colors - Dark Mode */
    --bg-color-alt: #484A9D;
    --nav-bg-alt: #373068; /* Will be set later */
    --color-white: #000;
    --color-grey: #666;
    --color-cell: rgb(0, 200, 80);

    /* Clue colors */
    /* .cell[data-clue-color="0"]:not([data-clue-color="-1"]){
    --color-cyan: rgba(0, 0, 255, 0.4);
    }

    .cell[data-clue-color="1"]:not([data-clue-color="-1"]){
    --color-magenta: rgba(255, 0, 0, 0.4);
    }

    .cell[data-clue-color="2"]:not([data-clue-color="-1"]){
    --color-yellow: rgba(0, 255, 0, 0.4);
    } */

    /* Clue colors - dark mode uses same opacity variables */
    --clue-opacity: 0.6;
    --clue-black-opacity: 0.6;

    /* Level lock icon */
    --lock-icon-filter: invert(0);

}

/* Alternative Color Palette */

[data-color-palette="alternative"] {
    --color-cyan: var(--color-cyan-alt);
    --color-magenta: var(--color-magenta-alt);
    --color-yellow: var(--color-yellow-alt);
    --color-black: var(--color-black-alt);
    --bg-color: var(--bg-color-alt);
    --nav-bg: var(--nav-bg-alt);
}

[data-theme="dark"][data-color-palette="alternative"] {
    --color-cyan: var(--color-cyan-alt);
    --color-magenta: var(--color-magenta-alt);
    --color-yellow: var(--color-yellow-alt);
    --color-black: var(--color-black-alt);
    --bg-color: var(--bg-color-alt);
    --nav-bg: var(--nav-bg-alt);
}

@media screen and (max-width: 690px) {
    :root {
        --grid-top: 12%;
        --stack-top: 12%;
        --grid-margin-bottom: 2%;
    }
    .drawer {
        right: auto; 
        bottom: -100%;
        height: 50%;
        transition: bottom 0.3s ease;
        border-left: none;
        border-top: 1px solid #ddd;
    }

    .drawer.open {
        bottom: 0;
    }
}

@media screen and (min-width: 690px) and (max-width: 940px){
    :root {
        --grid-top: 12%;
        --stack-top: 12%;
        --grid-margin-bottom: 2%;
    }
}

@media screen and (min-width: 940px) {
    :root {
        --grid-top: 12%;
        --stack-top: 12%;
        --grid-margin-bottom: 1%;
    }
}

@media screen and (max-height: 720px) {
    :root {
        --logo-size: 100px;
        --logo-mid-size:50px;
        --grid-container-margin: 50px auto;
        --grid-top: 12%;
        --stack-top: 12%;
        --grid-margin-bottom: 1%;
    }
}

@media screen and (min-height: 721px) and (max-height: 849px) {
    :root {
        --logo-size: 140px;
        --logo-mid-size:70px;
        --grid-container-margin: 75px auto;
        --grid-top: 12%;
        --stack-top: 12%;
        --grid-margin-bottom: 1%;
    }
}

@media screen and (min-height: 850px) {
    :root {
        --logo-size: 200px;
        --logo-mid-size:80px;
        --grid-container-margin: 120px auto;
        --grid-margin-bottom: 2%;
    }
}

#grid {
    position: relative;
    /* top: var(--grid-top); */
    top: max(calc(var(--cellSize)), calc(var(--grid-top))); /* Never closer than 10px from the top */
    border: 1px solid var(--text-color);
     background-image:
        linear-gradient(to right, var(--grid-lines) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-lines) 1px, transparent 1px);
    background-size: var(--cellSize) var(--cellSize);
    margin: 0 auto; 
    margin-bottom: var(--grid-margin-bottom);
    opacity: 0;
}

#grid, #stack {
    transition: top 0.3s ease-out;
}

.card {
    position: relative;
    box-shadow: 1px 1px 2px var(--card-shadow);
    background-color: var(--color-grey);
    transition: box-shadow 0.3s ease;
}

.card-no-shadow {
    box-shadow: none;
}

.card:hover:not(.dragging) {
    box-shadow: 2px 2px 5px var(--card-shadow);
    transform: rotate(0deg) scale(1.02);
    transition: transform 0.3s ease;
}

.card .card-inner {
    position: relative;
    transform-origin: var(--cellSize) var(--cellSize);
    rotate: var(--cardRotation);
}

.card.disabled {
    pointer-events: none;
}

.placeholder {
    transition: all 0.3s ease;
    opacity: 0.5;
    pointer-events: none;
    background-color: transparent;
    border: none;
    box-shadow: none;
}

.cell {
    position: absolute;
    background-color: var(--color-cell);
    width: var(--cellSize);
    height: var(--cellSize);
}

/* Clue colors now fill the entire cell via ::before pseudo-element and JavaScript backgroundColor */

.cell::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1; /* Ensure it appears above the cell background */
    pointer-events: none; /* Prevent interference with card pickup */
}

.cell .card-counter {
    pointer-events: none;
    width: 100%;
    height: 100%;
    z-index: 2; /* Ensure counter appears above corner colors */
    line-height: var(--cellSize);
    position: absolute;
    text-align: center;
    vertical-align: middle;
    font-size: var(--counter-font-size);  
    -webkit-user-select: none;  
       -moz-user-select: none;  
            user-select: none;
    z-index: 100;
    color: var(--counter-color);
    font-family: 'Figtree';
    font-weight: 400;
}

.cell .card-counter.black {
   color: var(--counter-color-black);
}

.card .cell {
    pointer-events: none;
}

#hold {
    width: 15px;
    height: 15px;
    pointer-events: none;
    position: absolute;
    z-index: 200;
}

#hold .card {
    margin: calc(-1 * var(--cellSize)) calc(-1 * var(--cellSize));
    box-shadow: 4px 4px 7px black;
    transition: var(--card-transition-time) ease-out, box-shadow 1s ease-out;
    /* opacity: .96; */
}

#stack {
    position: relative; 
    top: var(--stack-top);
    margin: 0 auto 0 auto;
    background-color: rgba(200, 200, 200, 0.20);
    border-radius: 5px;
    padding: 10px;
    max-width: 920px;
    opacity: 0;
}

#stack .card {
    margin: 5px;
    display: inline-block;
}

#grid-cards .card {
    position: absolute;
}

.push-to-front {
    position:relative;
    z-index: 50;
}

@keyframes shake {
    0% { transform: translateX(0); }
    12.5% { transform: translateX(-10px); }
    25% { transform: translateX(10px); }
    37.5% { transform: translateX(-7px); }
    50% { transform: translateX(7px); }
    62.5% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
    87.5% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

.card.shake {
    animation: shake .7s;
    box-shadow: 3px 3px 20px red;
    transition: box-shadow 0.1s ease;
}

.card-animating {
    transition: 
        transform var(--card-transition-time) cubic-bezier(0.4, 0, 0.2, 1),
        rotate 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* clueCards */

#clueStack {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: max(40px, calc(var(--grid-top) - 100px)); /* Never closer than 10px from the top */
    margin: 0;
    padding: 10px 0px;
    max-width: 300px;
    width: calc(5* var(--cellSize));
    height: 50px;
    opacity: 1;
    transition: ease-out 0.3s;
    z-index: 10;
}

.clue-tool {
    position: relative;
    width: var(--cellSize);
    height: var(--cellSize);
    /* margin: 5px; */
    /* border-radius: 5px; */
    display:inline-block;
    cursor: pointer;
    line-height: var(--cellSize);
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.clue-tool:hover {
    transform: scale(1.1);
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
}

.clue-tool:hover::after {
    transform: translate(-50%, -50%) scale(1); /* Keep checkmark in place */
}

.clue-tool.remove-tool {
    background-color: transparent;
    border: 2px solid var(--text-color);
    position: relative;
    box-sizing: border-box;
}

.clue-tool.remove-tool::before {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em;
    font-weight: bold;
    color: var(--text-color);
    line-height: 1;
}

.clue-tool.remove-tool.active::before {
    font-weight: 900;
    font-size: 1.4em;
}

.clue-tool.active::after {
    content: '✚'; /* Crosshair */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1em;
    font-weight: bolder;
    color: #000; /* Black checkmark */
    transition: none;
}

.clue-tool.remove-tool.active::after {
    content: none; /* Hide the pencil icon for remove tool */
}

.clue-tool[data-color="3"].active::after {
    color: rgb(255, 255, 255); /* For light backgrounds */
}

/* In case of using patterns on clue colors,  can also be modified to data-cell-color to affect all card's cells  */

/* .cell[data-clue-color="0"]:not([data-clue-color="-1"]){
    background-image:
    repeating-linear-gradient(
        45deg,
        transparent,
        transparent 23px,
        rgba(0, 230, 230, 0.5) 23px,
        rgba(0, 230, 230, 0.5) 46px
    ),
    repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 23px,
        rgba(255, 255, 255, 0.5) 23px,
        rgba(255, 255, 255, 0.5) 46px
    );
    transform: rotate(calc(-1 * var(--cardRotation, 0deg)));
}

.cell[data-clue-color="1"]:not([data-clue-color="-1"]){
    background-image:
    repeating-linear-gradient(
        90deg,
        transparent,
        transparent 15px,
        rgba(255, 255, 255, 0.5) 25px,
        rgba(255, 255, 255, 0.5) 50px
    ),
    repeating-linear-gradient(
        0deg,
        transparent,
        transparent 15px,
        rgba(255, 255, 255, 0.5) 25px,
        rgba(255, 255, 255, 0.5) 50px
    );
    background-size: 50px 50px;
    transform: rotate(calc(-1 * var(--cardRotation, 0deg)));
}

.cell[data-clue-color="2"]:not([data-clue-color="-1"]){
    background-image: repeating-linear-gradient(
        90deg,
        rgba(255, 255, 0, 0.6),
        rgb(210, 210, 0) 25px,
        transparent 25px,
        transparent 25px
    );
    transform: rotate(calc(-1 * var(--cardRotation, 0deg)));
}

.cell[data-clue-color="3"]:not([data-clue-color="-1"]){
    background-image:
    repeating-radial-gradient(
        circle at 50% 50%,
        rgba(70, 70, 70, 0.8),
        rgba(70, 70, 70, 0.8) 5px,
        transparent 5px,
        transparent 15px
    );
    transform: rotate(calc(-1 * var(--cardRotation, 0deg)));
} */

/* Full cell clue colors - each color fills the entire cell */

.cell[data-clue-color="0"]:not([data-clue-color="-1"])::before {
    background-color: var(--color-cyan);
    opacity: var(--clue-opacity);
}

.cell[data-clue-color="1"]:not([data-clue-color="-1"])::before {
    background-color: var(--color-magenta);
    opacity: var(--clue-opacity);
}

.cell[data-clue-color="2"]:not([data-clue-color="-1"])::before {
    background-color: var(--color-yellow);
    opacity: var(--clue-opacity);
}

.cell[data-clue-color="3"]:not([data-clue-color="-1"])::before {
    background-color: var(--color-black);
    opacity: var(--clue-black-opacity);
}

.display {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 960px;
    margin: 0 auto; 
}

.displayLevels {
    margin-top: 60px;
    padding: 20px;
}

/* landingPage */

.button {
    background-color: var(--button-bg);
    color: var(--color-always-black);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
    padding: 15px 32px;
    border: 2px solid var(--button-border);
    text-align: center;
    font-size: 16px;
    font-family: 'Figtree';
    margin: 40px auto 0 auto;
    cursor: pointer;
    align-self: center;
    position: relative;
    overflow: hidden;
}

.button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.button:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: rotate(0deg) scale(1.02);
    transition: transform 0.3s ease;
}

.button:hover::before {
    left: 100%;
}

h1{
    font-size: 60px;
    font-weight:900;
    margin-bottom: 0px;
}

.logoBig {
    width: var(--logo-size); 
    height: var(--logo-size);
    transition: width 0.5s ease, height 0.5s ease;
}

.bigoctoghost {
    width: var(--logo-mid-size); 
    height: var(--logo-mid-size);
    transition: width 0.5s ease, height 0.5s ease;
    margin: 10px;
    fill: var(--text-color);
}

#cmyk-landing-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

#cmyk-landing-page .grid-container {
    display: flex;
    position: relative;
    justify-content: space-around;
    width: 50%;
    margin: var(--grid-container-margin);
    min-width: 400px;
    max-width: 400px;
    transition: margin 0.5s ease;
}

#cmyk-landing-page .grid-section {
    position: relative;
    text-align: center;
    top: 0%;
}

#cmyk-landing-page .grid {
    position: relative;
    top: 10%;
    border: 1px black solid;
    background-image:
        linear-gradient(to right, grey 1px, transparent 1px),
        linear-gradient(to bottom, grey 1px, transparent 1px);
    background-size: var(--cellSize) var(--cellSize);
    margin: 0 auto 0 auto;
}

#cmyk-landing-page .stack-container {
    display: flex;
    position: relative;
    top: 0%;
    margin: 0 auto 0 auto;
}

#cmyk-landing-page #stack {
    position: relative;
    top: 10%;
    margin: 0 auto 0 auto;
    width: 100%;
    background-color: transparent;
}

/* levelSelect */

#levelSelect {
    overflow:auto;
}

/* navigation bar */

nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-top);
    background-color: var(--nav-bg);
    padding: 10px;
    border-bottom: 1px solid var(--nav-border);
    z-index: 1000;
    box-sizing: border-box;
    display: flex; 
    justify-content: space-between;
}

nav h1 {
    margin: 0;
    font-size: 16px;
}

.logo-title {
    position: absolute;
    left: 50%; /* Move .logo-title horizontally to the center of the nav */
    transform: translateX(-50%); /* Offset by half its width to center it */
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    max-width: 200px;
    /* transform: translateX(-12%); */
    gap: 20px; /* Space between the logo and the title */
}

.logo {
    width: 20px;
    height: 20px; 
    vertical-align: middle;
}

.minioctoghost {
    width: 25px;
    height: 25px; 
    vertical-align: middle;
    fill: var(--text-color);
}

.drawerIcons {
    width: 35px; 
    height: 35px; 
    vertical-align: middle;
}

.drawerIcons2 {
    width: 30px; 
    height: 30px; 
    vertical-align: middle;
}

.drawerIcons3 {
    width: 20; 
    height: 20px; 
    vertical-align: middle;
}

/* Dark mode: invert drawer icons (black to white) */

/* Exclude CMYK logo and icons with colored elements (they will have all colors inverted) */

html[data-theme="dark"] img.drawerIcons:not([src*="CMYKLogoPlain"]),
html[data-theme="dark"] img.drawerIcons2:not([src*="CMYKLogoPlain"]) {
    filter: invert(1) !important;
}

nav button {
    font-size: 12px;
    border: none;
    cursor: pointer;
    color: var(--text-color);
}

nav button:hover {
     color: var(--text-color);
     opacity: 0.7;
}

.arrow-button {
    font-size: 12px;
    color: var(--text-color);
    border: none;
    padding: 5px 12px;
    border-radius: 8px;
    background-color: transparent;
    font-weight: 200;
    font-family: 'Figtree';
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-right {
    display: flex;
    align-items: center;
}

/* Level Styles */

.level-group {
    display: flex;
    flex-direction: column;
    gap: 0px;
    align-items: center;
}

.level-group h2 {
    margin: 0;
    padding: 10px;
    font-size: 1.5em;
    border-bottom: 2px solid var(--nav-border);
    max-width: 1000px;
}

.level-grid {
    display: grid;              
    grid-template-columns: repeat(4, 1fr); 
    gap: 0px;
    max-width: 200px;
    min-width: 200px;
    margin: 0 auto;
    padding: 20px;
}

.level-card {
    width: 50px;
    height: 50px;
    background-color: var(--button-bg);
    border-radius: 0px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0px;
    cursor: pointer;
    transition: box-shadow 0.3s ease;
    box-sizing: border-box;  
    color: var(--color-always-black);
}

.level-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: rotate(0deg) scale(1.02);
    transition: transform 0.3s ease;
}

.level-card-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 95%;                  
    height: 100%;  
    box-sizing: border-box;   
}

.level-info {
    display: flex;
    align-items: center;
}

/* .level-icon {
    width: 32px;
    height: 32px;
    margin-right: 12px;
} */

.level-details h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    
}

/* .level-details p {
    margin: 0px 0 0;
    font-size: 12px;
    color: var(--text-color);
    opacity: 0.6;
} */

/* .chevron-right {
    width: 20px;
    height: 20px;
    color: var(--text-color);
    opacity: 0.5;
} */

.level-card {
    border-left: 5px solid var(--nav-border);
}

.level-card.easy {
    border-left: 5px solid var(--color-cyan);
}

.level-card.medium {
    border-left: 5px solid var(--color-magenta);
}

.level-card.hard {
    border-left: 5px solid var(--color-yellow);
}

.level-card.boss {
    border-left: 5px solid var(--color-always-black);
    border-radius: 0px;
}

/* change cards when level is completed  */

.level-card.completed {
    border-left: 5px solid var(--nav-border);
    background: linear-gradient(135deg, var(--color-white), var(--nav-border));
    background-size: 400% 400%;
    animation: shimmer 10s ease infinite;
    
}

.level-card.easy.completed {
    border-left: 5px solid var(--color-cyan);
    background: var(--color-cyan);
    background-size: 400% 400%;
    animation: shimmer 10s ease infinite;
    color: var(--color-always-black);
}

.level-card.medium.completed {
    border-left: 5px solid var(--color-magenta);
    background: var(--color-magenta);
    background-size: 400% 400%;
    animation: shimmer 10s ease infinite;
     color: var(--color-always-black);
}

.level-card.hard.completed {
    border-left: 5px solid var(--color-yellow);
    background: var(--color-yellow);
    background-size: 400% 400%;
    animation: shimmer 10s ease infinite;
     color: var(--color-always-black);
}

.level-card.boss.completed {
    border-left: 5px solid var(--color-always-black);
    background: var(--color-always-black);
    background-size: 400% 400%;
    animation: shimmer 10s ease infinite;
    color: var(--color-always-white);
}

.level-card.boss.completed p{
    color: var(--text-color);
}

/* .level-card.boss .chevron-right {
    color: var(--color-always-white);
} */

@keyframes shimmer {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.level-card.locked {
    opacity: 0.4;
    position: relative;
    background-color: var(--button-inactive-bg);
    color: var(--text-color);
}

/* Placeholder for lock icon on locked level cards */

.level-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.level-lock-icon {
    width: var(--lock-icon-size);
    height: var(--lock-icon-size);
    filter: var(--lock-icon-filter);
    
}

/* copyrightstuff */

.author {
    position: fixed;
    bottom: 0;
    right: 0;
    padding: 10px 20px;
    font-size: 0.6em;
    color: var(--text-color);
    opacity: 0.6;
    font-family: 'Figtree';
    display: none;
}

.author2 {
    position: fixed;
    bottom: 0;
    left: 0;
    padding: 10px 20px;
    font-size: 0.6em;
    color: var(--text-color);
    opacity: 0.6;
    font-family: 'Figtree';
    display: none;
}

.blackHeart {
    width: 1em;
    height: 1em; 
    vertical-align: middle;
    fill: var(--text-color);
}

.author-mobile {
    bottom: 0;
    align-self: flex-start;
    padding: 10px 0px;
    font-size: 10px;
    color: var(--text-color);
    opacity: 0.6;
    font-family: 'Figtree';
}

/* Animations when changing pages */

.blur-fade {
    opacity: 1;
    filter: blur(0px);
    transition: filter 0.5s ease-out, opacity 0.5s ease-out;
}

.blur-fade.active {
    opacity: 0;
    filter: blur(5px);
}

/* Drawer Styles */

.drawer {
    position: fixed;
    right: calc(-1 * var(--drawer-width)); /* Off-screen initially */
    top: var(--drawer-top);
    width: var(--drawer-width);
    height: calc(100% - var(--drawer-top) ); 
    background-color: var(--drawer-bg);
    border-left: 1px solid var(--nav-border);
    /* border-top: none; */
    transition: right 0.3s ease;
    z-index: 1000;
    font-family: 'Figtree';
    overflow-y: auto;
    -webkit-user-select:none;
       -moz-user-select:none;
            user-select:none;
    box-shadow: none;
    display: none;
}

.drawer--with-shadow {
    box-shadow: 0 -4px 6px -1px rgba(0,0,0,0.1), 0 -2px 4px -1px rgba(0,0,0,0.06);
}

.drawer.open {
    right: 0;
}

.drawer-content {
    padding: 20px;
    overflow-y: auto;
}

.drawer h2 {
    margin: 10px 0;
    font-size: 18px;
    color: var(--text-color);
    font-weight:bolder;
}

.drawer h3 {
    margin: 10px 0;
    font-size: 14px;
    color: var(--text-color);
    font-weight:bold;
}

.drawer p {
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.8;
}

.instruction {
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-color);
}

.instruction.highlight {
    background-color: var(--color-white);
    font-size: 14px;
    font-weight:bold;
}

.instruction-header{
    margin-bottom: 20px;
    font-size: 16px;
    color: var(--text-color);
    font-weight:bold;
}

.instruction-footer {
    bottom: 0px;
    position: fixed;
    background-color: var(--drawer-bg);
    padding-bottom: 10px;
    font-size: 14px;
    color: var(--text-color);
    text-align: center;
    font-weight: bold;
    z-index: 1;
}

.instruction-footer-mobile {
    bottom: 0;
    background-color: var(--drawer-bg);
    padding: 30px 0px 0px 0px;
    font-size: 14px;
    color: var(--text-color);
    align-self: flex-start;
    font-weight: bold;
    z-index: 1;
}

.drawer-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-color);
    padding: 0;
    z-index: 1001; /* Ensure it stays on top of the drawer */
    transition: right 0.3s ease; /* Smooth transition when moving */
    /* Fixed width and height to prevent layout shift */
    width: 40px;
    height: 40px;
}

.drawer-toggle svg{
    width: 20px;
    height: 20px;
    padding-top: 5px;
    color: inherit;
    fill: var(--text-color);
    -webkit-user-select: none;
       -moz-user-select: none;
            user-select: none;
    pointer-events: none;
}

.drawer-toggle svg:hover{
    fill: var(--text-color);
    opacity: 0.7;
}

.drawer-button {
    color: var(--text-color);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
    font-size: 10px;
    font-family: 'Figtree';
    cursor: pointer;
    width: 70%;
    padding: 5px, 0px;
    margin-bottom: 20px;
    background-color: var(--drawer-bg);
}

.drawer-button:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: rotate(0deg) scale(1.02);
    transition: transform 0.3s ease;
    color: var(--color-grey);
}

/* dropdown within drawer */

.data-management-dropdown {
    margin-top: 20px;
}

.dropdown-toggle {
    width: 100%;
    border: none;
    text-align:left;
    cursor: pointer;
    background-color: var(--drawer-bg);
    color: var(--text-color);
    padding: 0;
    font-family: 'Figtree';
}

.dropdown-content {
    display: none;
    margin-top: 10px;
    background-color: var(--drawer-bg);
}

.dropdown-content.show {
    display: block;
}

/* buttons after completing the level */

#nextLevel {
    position: relative;
    display: none;
    align-items: center;
    justify-content: center;
    top: var(--stack-top);
    max-width: 200px;
    margin: 50px auto; 
    animation: slideInFromBottom 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    transform: translateY(30px);
    opacity: 0;
}

@keyframes slideInFromBottom {
    0% {
        transform: translateY(30px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.nextLevel-button {
    background-color: var(--button-bg);
    color: var(--color-always-black);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
    padding: 15px 32px;
    border: 2px solid var(--button-border);
    text-align: center;
    font-size: 16px;
    font-family: 'Figtree';
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: center;
}

.nextLevel-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.nextLevel-button:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: rotate(0deg) scale(1.02);
    transition: transform 0.3s ease;
}

.nextLevel-button:hover::before {
    left: 100%;
}

.nextLevel-button:active {
    transform: translateY(0) scale(1.02);
    transition: all 0.1s;
}

.nextLevel-button span:last-child {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.nextLevel-button:hover span:last-child {
    transform: translateX(4px);
}

/* Pulse animation for attention - matching start button style */

@keyframes pulse {
    0% {
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    50% {
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    100% {
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
}

.nextLevel-button {
    animation: pulse 2s infinite, celebration 0.6s ease-out 0.3s;
}

/* Celebration animation when button first appears */

@keyframes celebration {
    0% {
        transform: scale(0.8) rotate(-5deg);
    }
    25% {
        transform: scale(1.1) rotate(2deg);
    }
    50% {
        transform: scale(0.95) rotate(-1deg);
    }
    75% {
        transform: scale(1.05) rotate(1deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Sparkle effect */

.nextLevel-button::after {
    content: '✨';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 12px;
    animation: sparkle 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.5) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

/* Keep the shimmer effect but remove the glow */

/* undo and restart buttons */

.side-buttons {
    position:absolute;
    top: var(--grid-top); /* Adjust to align with the top of the nav bar */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Adjust position by half of the element's width */
    align-items: flex-start; /* Align buttons to the top */
    width: 100%;
    max-width: 960px;
    margin: 0 auto; 
    display: flex;
    justify-content: space-between;
    z-index: 1;
    transition: transform 0.2s ease;
    pointer-events: none;
    -webkit-user-select: none;
       -moz-user-select: none;
            user-select: none;
}

.left-buttons {
    display: flex;
    flex-direction: column;
    gap: 5px;
    pointer-events: auto;
    align-self: start;
}

.right-buttons {
    display: flex;
    flex-direction: column;
    gap: 5px;
    pointer-events: auto;
}

/* Style for game buttons to appear like they are coming out from the side */

.game-button {
    pointer-events: auto;
    top: var(--grid-top); /* Adjust to align with the top of the nav bar */
    background-color: var(--color-white);
    border: 1px solid var(--nav-border);
    padding: 10px;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--cellSize);
    height: var(--cellSize);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    outline: none;
   
}

.game-button svg{
    fill: var(--text-color);
}

/* Specific styling for Restart and Undo buttons with rounded corners on the right */

#restart-button {
    border-radius: 0 15px 15px 0;
}

#undo-button {
    border-radius: 0 15px 15px 0;
}

/* Specific styling for painter button with rounded corners on the left */

.painter-button-icon {
    width: 24px;
    height: 24px;
}

#painter-button {
    border-radius: 15px 0 0 15px;
}

/* SVG icon size within the button */

.game-button svg {
    width: var(--cellSize);
    height: var(--cellSize);
}

/* Button press effect */

.game-button.pressed {
    transform: scale(0.95);
}

/* Disabled button styling */

.game-button.disabled {
    cursor: not-allowed;
    filter:invert(.4)  brightness(1.5);

}

.card-returning {
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    pointer-events: none;
    z-index: 1000;
    will-change: transform;
}

.contact-container {
    position: absolute;
    top: 0%;
    right: 0%;
    margin: 5px;
    display: flex;
    flex-direction: column;
    align-items: end;

}

.contact-container-left {
    position: absolute;
    top: 0%;
    left: 0%;
    margin: 5px;
    max-width: 38px;
}

.logo-social {
    width: 30px;
    height: 30px; 
    vertical-align: middle;
    pointer-events: all;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.logo-social:hover {
    opacity: 0.7;
}

/* Ensure social media icons use theme-aware colors */

.logo-social {
    color: var(--text-color);
    transition: color 0.3s ease;
}

.logo-social svg {
    color: inherit;
}

.logo-social path {
    fill: currentColor;
}

#game-status {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    margin-bottom: 10px;
    background-color: var(--drawer-bg);
    padding: 10px;
    border-radius: 5px;
    top: 10%;
    left: 50%; 
    transform: translateX(-50%);
    width: 150px;
}

.status-item {
    font-weight: bold;
}

#game-over-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0,0,0,0.7);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    z-index: 1000;
}

/* Theme Toggle */

.theme-toggle {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: var(--text-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

/* Override nav button hover effect for theme toggle */

.theme-toggle:hover {
    color: var(--text-color) !important;
    background: none !important;
}

/* Palette toggle button - same styling as theme toggle */

.palette-toggle {
    background: none;
    border: none;
    padding: 0px;
    cursor: pointer;
    color: var(--text-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, transform 0.3s;
    margin-left: 0;
}

/* For play.html, position palette toggle closer to left */

.contact-container-left .palette-toggle {
    margin-left: 8px;
    margin-right: 0;
}

/* Add 10px margin for palette-toggle on play.html page only */

#cmyk-landing-page .palette-toggle {
    margin: 10px;
}

.palette-toggle:hover {
    color: var(--text-color) !important;
    background: none !important;
    transform: scale(1.1);
}

.palette-toggle-icon {
    width: 24px;
    height: 24px;
    transition: transform 0.3s;
}

/* Show alternative palette preview when standard is active */

.palette-toggle-icon .palette-alternative {
    display: block;
}

.palette-toggle-icon .palette-standard {
    display: none;
}

/* Show standard palette preview when alternative is active */

[data-color-palette="alternative"] .palette-toggle-icon .palette-alternative {
    display: none;
}

[data-color-palette="alternative"] .palette-toggle-icon .palette-standard {
    display: block;
}

/* When alternative palette is active, override standard preview to use base standard colors */

[data-color-palette="alternative"] .palette-toggle-icon .palette-standard rect:nth-child(1) {
    fill: #0ff; /* Standard cyan */
}

[data-color-palette="alternative"] .palette-toggle-icon .palette-standard rect:nth-child(2) {
    fill: #f0f; /* Standard magenta */
}

[data-color-palette="alternative"] .palette-toggle-icon .palette-standard rect:nth-child(3) {
    fill: #ff0; /* Standard yellow */
}

[data-color-palette="alternative"] .palette-toggle-icon .palette-standard rect:nth-child(4) {
    fill: #000; /* Standard black */
}

/* Dark mode: standard black is grey */

[data-theme="dark"][data-color-palette="alternative"] .palette-toggle-icon .palette-standard rect:nth-child(4) {
    fill: rgb(128, 128, 128); /* Standard black in dark mode */
}

.palette-toggle--clicked {
    animation: palette-click 0.5s ease;
}

@keyframes palette-click {
    0% { transform: scale(1); }
    50% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.theme-toggle-icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2px;
    fill: none;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle-icon .sun {
    fill: currentColor;
    transform-origin: center center;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle-icon .sun-beams {
    stroke: currentColor;
    stroke-width: 2px;
    transform-origin: center center;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .theme-toggle-icon {
    transform: rotate(40deg);
}

[data-theme="dark"] .theme-toggle-icon .sun {
    transform: scale(1);
}

[data-theme="dark"] .theme-toggle-icon .sun-beams {
    opacity: 0;
    transform: rotate(45deg);
}

[data-theme="dark"] .theme-toggle-icon circle {
    -webkit-mask: url(#moon-mask);
            mask: url(#moon-mask);
}

/* Hide moon in light theme, show sun */

[data-theme="light"] .theme-toggle-icon .moon {
    display: none !important;
}

[data-theme="light"] .theme-toggle-icon .sun,
[data-theme="light"] .theme-toggle-icon .sun-beams {
    display: block !important;
}

/* Hide sun in dark theme, show moon */

[data-theme="dark"] .theme-toggle-icon .sun,
[data-theme="dark"] .theme-toggle-icon .sun-beams {
    display: none !important;
}

[data-theme="dark"] .theme-toggle-icon .moon {
    display: block !important;
}

/* Default state - show sun in light theme, moon in dark theme */

.theme-toggle-icon .moon {
    display: none;
}

.theme-toggle-icon .sun,
.theme-toggle-icon .sun-beams {
    display: block;
}

.painter-drawer {
    position: absolute;
    top: calc(var(--cellSize) + 10px); /* below the painter button with some spacing */
    right: 0;
    display: flex;
    flex-direction: column;
    background: var(--painter-drawer-bg);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    padding: 8px 8px;
    z-index: 1002;
    opacity: 1;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: auto;
    min-width: 48px;
    gap: 6px;
}

.painter-drawer.closed {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

.painter-drawer.closing {
    animation: drawerFadeOut 0.57s ease-out forwards;
    background: transparent;
    box-shadow: none;
}

.painter-drawer.closing .clue-tool {
    animation: toolCascadeUp 0.15s ease-out forwards;
}

.painter-drawer.closing .clue-tool:nth-child(5) { animation-delay: 0ms; }

/* Remove tool (bottom) */

.painter-drawer.closing .clue-tool:nth-child(4) { animation-delay: 80ms; }

/* Black (4th) */

.painter-drawer.closing .clue-tool:nth-child(3) { animation-delay: 160ms; }

/* Yellow (3rd) */

.painter-drawer.closing .clue-tool:nth-child(2) { animation-delay: 240ms; }

/* Magenta (2nd) */

.painter-drawer.closing .clue-tool:nth-child(1) { animation-delay: 320ms; }

/* Cyan (top) */

@keyframes drawerFadeOut {
    0% {
        opacity: 1;
    }
    80% {
        opacity: .2;
    }
    100% {
        opacity: 0;
        pointer-events: none;
    }
}

@keyframes toolCascadeUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    60% {
        opacity: 0.8;
        transform: translateY(-8px);
    }
    100% {
        opacity: 0;
        transform: translateY(-16px);
    }
}

.painter-drawer.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.painter-drawer .clue-tool {
    margin: 0 auto;
    display: block;
}

/* Custom cursor for candidate painting mode */

/* body.painting-mode {
    cursor: crosshair;
}

body.painting-mode .cell {
    cursor: crosshair;
}

body.painting-mode .card {
    cursor: grab;
} */

/* Colored square cursors for different tools - now handled dynamically via JavaScript */

/* Cursor colors are set via JavaScript using CSS variables */

/* Hyperlink styles */

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

a:visited {
    color: var(--link-visited-color);
}

a:active {
    color: var(--link-hover-color);
}

/* Hide number input spinners for builder controls */

#grid-width-input::-webkit-inner-spin-button,
#grid-width-input::-webkit-outer-spin-button,
#grid-height-input::-webkit-inner-spin-button,
#grid-height-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

#grid-width-input[type="number"],
#grid-height-input[type="number"] {
    -moz-appearance: textfield;
    -webkit-appearance: textfield;
            appearance: textfield;
}

