

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
    width: 100%;
    height: 100%;
}
.home-screen {
    position: fixed;
    min-width: 100vw;
    min-height: 100vh;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeOut 0.7s ease-in-out 4s forwards; 
    padding-left: 3px !important;
    padding-right: 3px !important;
}

.home-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 40px;
    position: relative;
    padding-left: 23px !important;
    padding-right: 23px !important;
}

.logo-row {
    display: flex;
    gap: 5px;
    animation: slideInUp 1s ease-out;
    position: relative;
    z-index: 5;
    padding-left: 3px !important;
    padding-right: 3px !important;
}

.logo-row:nth-child(2) {
    animation-delay: 1s;
}

.logo-cube {
    width: 4rem;
    height: 4rem;
    background-image: url('assets/cube/red.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Noto Sans JP', 'YourCustomFont', Arial, sans-serif;
    font-size: 2.5rem;
    color: #fefefe;
    font-weight: 600;
    letter-spacing: -0.02em;
    text-shadow: 
        -1px 2px 0px #d3999c,
        -2px 2px 0px #d3999c;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-transform: uppercase;
    animation: bounceIn 0.8s ease-out;
    animation-fill-mode: both;
    position: relative;
    z-index: 10;
}


.logo-cube:nth-child(1) { animation-delay: 0.1s; } /* S */
.logo-cube:nth-child(2) { animation-delay: 0.2s; } /* T */
.logo-cube:nth-child(3) { animation-delay: 0.3s; } /* A */
.logo-cube:nth-child(4) { animation-delay: 0.4s; } /* C */
.logo-cube:nth-child(5) { animation-delay: 0.5s; } /* K */
.logo-cube:nth-child(6) { animation-delay: 0.6s; } /* W */
.logo-cube:nth-child(7) { animation-delay: 0.7s; } /* O */
.logo-cube:nth-child(8) { animation-delay: 0.8s; } /* R */
.logo-cube:nth-child(9) { animation-delay: 0.9s; } /* D */

/* Keyframe animations */
@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0) rotate(45deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.2) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

.homelink {
  color: black;
  font-style: normal;
  font-weight: bold;
  font-size: 16px;
}

.loading-text {
    font-family: 'Noto Sans JP', Arial, sans-serif;
    font-size: 1.5rem;
    color: rgb(0, 0, 0);
    font-weight: 600;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

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

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

@keyframes gifSlideIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(1);
    }
}

.cube-face.front {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        height: 100%;
        width: 100%;
        margin-left: -0.4rem;
        margin-top: 0.6rem;
        padding: 0;
        font-size: 1.5rem;

}

.main-border-container {
    border-radius: 18px;
    margin: 0 auto;
    max-width: 65rem;
}


.grid-cell[data-row="2"]{ z-index: 75; top: 2.8rem; }
.grid-cell[data-row="3"] { z-index: 40; top: 2.3rem; }
.grid-cell[data-row="4"] { z-index: 20; top: 1.9rem; }
.grid-cell[data-row="5"] { z-index: 6; top: 1.5rem; }
.grid-cell[data-row="1"]{z-index: 95; top:3.2rem;}
.grid-cell[data-row="0"]{z-index: 100; top:3.7rem;}
.grid-cell[data-row="6"]{z-index: 5;top:1.1rem;}


#mobile-input {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 10px !important;
    opacity: 0.01 !important;
    z-index: 1000 !important;
    border: none !important;
    outline: none !important;
    resize: none !important;
    background: transparent !important;
    pointer-events: auto !important;
}


.instructions-icon img {
    content: url('./assets/score-timer/instruction.png');
    width: 2rem !important;
    height: 2rem !important;
    margin: 0 !important;
    mix-blend-mode: multiply;
    transition: all 0.3s ease;
}

.instructions-icon:hover img {
    content: url('./assets/score-timer/instruction.gif');
}

.instructions-icon img {
    width: 2rem !important;
    height: 2rem !important;
    margin: 0 !important;
    transition: all 0.3s ease;
}

        .instructions-overlay {
            position: fixed;
            top: -1rem;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(255, 255, 255, 0.5);
            backdrop-filter: blur(10px);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 2000;
        }

        .instructions-overlay.show {
            display: flex;
        }

        .instructions-box {
            position: relative;
            background: white;
            max-width: 400px;
            border-radius: 5px;
            box-shadow: 0 6px 20px rgba(0,0,0,0.25);
            overflow: visible; 
            font-family: Arial, sans-serif;
            animation: fadeIn 0.3s ease;
            padding-left: 1rem;
            text-align: justify;
        }


        .instructions-header {
            text-align: center;
            background: #BA0406;
            width: 8rem;
            height: 1rem;
            color: white;
            padding: 10px;
            font-weight: bold;
            font-size: 15px;
            letter-spacing: 0.5px;
            position: relative;
            top: 0.5rem;
            left: 7.5rem;
            border-radius: 4px;
        }

        .close-btn {
            position: absolute;
            top: -7px; 
            right: -10px;
            width: 30px;
            height: 30px;
            border: none;
            color: #fff;
            font-size: 18px;
            cursor: pointer;
            font-weight: bold;
            border-radius: 50%;
            background: #bb0406;
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1;
            transition: all 0.3s ease;
        }

        .close-btn:hover {
            background: #990305;
            transform: scale(1.1);
        }

        .instructions-box ol {
            font-family: Arial, Helvetica, sans-serif;
            margin: 0;
            padding: 15px 22px;
            font-size: 14px;
            line-height: 1.6;
            color: #000000;
        }

        .instructions-box li {
            margin-bottom: 10px;
        }

        .highlight {
            font-family: Arial, Helvetica, sans-serif;
            color: #BA0406;
            font-size: 14px;
            font-weight: bold;
        }
/* Fade-in animation */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.container {
    display: flex;
    max-width: 1200px;
    width: 100%;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.puzzle-area {
    flex: 0 1 auto; 
    width: fit-content;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.crossword-grid {
    display: inline-block;
    line-height: 0; 
    max-width: 55rem;
    margin-top: -2rem;
    transform: translateX(-1.9rem);

}
        .copyright-link {
            text-align: left;
            margin-top: 1.7rem;
            margin-bottom: -2.2rem;
            font-size: 14px;
            color: #000000;
            font-family: 'customFont';
        }
        
        .copyright-link a {
            color: #000000;
            text-decoration: none;
            transition: color 0.3s ease;
        }
        
        .copyright-link a:hover {
            color: #333;
            text-decoration: underline;
        }

.grid-row {
    display: flex;
    margin-top: 0rem;
    line-height: 0;
    position: relative;
}


.grid-cell {
    width: 3.4rem;
    height: 3.4rem;
    position: relative;
    margin-right: -8px;
    cursor: pointer;
    background-image: url('assets/cube/red.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18rem;
    text-transform: uppercase;
    color: white;
    text-shadow: 1.5px 1.5px 2px #d29ca0;
    transition: all 0.3s ease;
    opacity: 1;
    
}
@keyframes gridCellFall {
    0% {
        transform: translateY(-100vh) rotateX(180deg);
        opacity: 0;
    }
    70% {
        transform: translateY(10px) rotateX(0deg);
        opacity: 1;
    }
    85% {
        transform: translateY(-5px) rotateX(0deg);
    }
    100% {
        transform: translateY(0) rotateX(0deg);
        opacity: 1;
    }
}

.grid-cell.animate-fall {
    animation: gridCellFall 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    opacity: 0;
}
@font-face {
  font-family: 'YourCustomFont';
  src: url('./assets/font/NotoSansJP-SemiBold.ttf') format('truetype'),
       url('assets/font/NotoSansJP-SemiBold.ttf') format('truetype');
  font-weight: 600; 
  font-style: normal;
  font-display: swap;
}

.grid-cell, .grid-cell .cube-face.front {
  font-family: 'Noto Sans JP', 'YourCustomFont', Arial, sans-serif;
  font-size: 2.1rem;
  color: #fefefe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  letter-spacing: -0.02em;
  
text-shadow: 
    2px 0px 0px #d3999c,
    1px 0px 0px #d3999c;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  }

.grid-cell.black {
    background: #2c3e50;
    background-image: none;
}

.grid-cell.active.highlighted {
   background-image: 
    url('assets/cube/current.png'),
    url('assets/cube/orange.png');
   transform: scale(1.07);
}
.grid-cell.highlighted{
    background-image:url('assets/cube/orange.png'); 
    transform: scale(1.07);
}


.grid-cell.correct {
    background-image: url('assets/cube/green.png');
    filter: brightness(1.0);
}

.grid-cell.incorrect {
    background-image: url('assets/cube/black.png');
}
.grid-cell.fixed {
    background-image: url('assets/cube/maroon.png');
}

.grid-cell.revealed {
    background-image: url('assets/cube/grey.png') !important;
    filter: brightness(0.9);
    opacity: 0.8;
}


.grid-cell.revealed.correct {
    background-image: url('assets/cube/grey.png') !important;
}


.grid-cell:hover:not(.black) {
    transform: scale(1.08);
}

.cell-number {
   display: none;
}

.grid-cell input {
    position: absolute;
    width: 100%;
    height: 100%;
    background: transparent;
    margin-right: 8px;
    margin-left: 8px;
    z-index: 100;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    z-index: 5;
}


.controls {
    margin-top: 35px;
    display: flex;
    flex-wrap: nowrap;
    padding: 12px;
    border-radius: 20px;
    max-width: 80rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 35px;
}
.row {
  display: flex;
  gap: 0.5rem;
}

.row:nth-child(2) {
  justify-content: center;
}
.control-btn span {
    white-space: nowrap;
    display: inline-block;
}

.control-btn {
    white-space: nowrap;
    padding: 14px 20px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    justify-content: center;
    flex-wrap: nowrap;
    max-height: 3.5rem;
}


.revert-btn, 
.check-btn,
.reveal-btn,
.reveal-all-btn,
.solution-btn,
.button-common {
    background: white;     
    color: #000;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid #cdcdcd;
    border-radius: 5px;           
    outline: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
    min-width: 7.3rem;
    height: 2.4rem;
    padding: 0 8px;
}

.revert-btn:hover,
.check-btn:hover,
.reveal-btn:hover,
.reveal-all-btn:hover,
.solution-btn:hover,
.button-common:hover {
    border-color: #4c9abe;  
    transform: translateY(-2px);
}

.clues-section {
    background: white;
    color: #000;
    border: 2px solid #cdcdcd;
    top: 0.5rem;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 15px 10px 10px 10px;
    max-width: 20rem;
    height: 33rem;
    border-radius: 8px;
    position: relative;
}

.clues-container {
    border-radius: 10rem;
    background: transparent;
    border-radius: 5px;
    overflow: hidden;
    width: 100%;
    position: relative;
    z-index: 1;
}

.clues-header {
    display: flex;
    justify-content: center;
    padding: 1px 12px 30px 12px;
    background: transparent;
    margin-bottom: 2.5px;
}

.clues-tab {
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    color:  #BA0406;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 6rem;
}

.clues-tab:hover {
    transform: translateY(-1px);
}

.clues-tab.active {
    font-family: Arial, Helvetica, sans-serif;
    background: #bb0303;
    border: 1px solid #cbcece;
    border-radius: 4px;   
    color: #ffffff;
    font-size: 1rem;
    pointer-events: none;
}

/* Clue list container */
.clues-content {
    padding: 18px 0 22px 0;
    overflow-y: auto;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    scrollbar-width: thin;
    scrollbar-color: #dc2626 #f0f0f0;
    backdrop-filter: blur(2px);
}

.clues-content::-webkit-scrollbar {
    width: 6px;
}

.clues-content::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.clues-content::-webkit-scrollbar-thumb {
    background: #dc2626;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.clues-content::-webkit-scrollbar-thumb:hover {
    background: #b91c1c;
}

/* Clue item */
.clue-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin-bottom: 1px;
    border: 2px solid transparent;
}

.clue-item.active {
    border-left: 4px solid #e7000b;
    background-color: #fef2f2;
    border-radius: 1px;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.1);
    padding-left: 6px;
}

.clue-item.active .clue-text,
.clue-item.active .clue-number {
    color: #d0363b;
    font-weight: 600;
}

.clue-text {
    font-family: 'CustomFont';
    font-size: 16px;
    flex: 1;
    color: #000000;
    word-break: break-word;
    font-weight:400;
    line-height: 1.3;
}

.clue-number {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #000000;
    line-height: 1.3;
    min-width: 2rem;
    text-align: right;
}

.clue-number::after {
    content: '.';
}

.clue-item.completed .clue-text,
.clue-item.completed .clue-number {
  opacity: 0.8;
  text-decoration: line-through;
  text-decoration-color: rgba(88, 85, 85, 0.6);
}

.grid-cell.correct {
    animation: glowCorrect 0.8s ease-in-out;
}


.mute-button.muted::before,
.mute-button.muted::after {
    content: none !important;
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    background: none !important;
}

.final-animation {
    width: 15rem;
    height: 15rem;
    position: fixed;
    top: 25%;
    left: 30%;
    z-index: 10000;
    pointer-events: none;
}
.full-puzzle-gif {
  width: 15rem;
  height: 15rem;
  position: fixed;
  top: 25%;
  left: 30%;
  z-index: 10000;
  pointer-events: none;
}

.celebration-gif {
    width: 10rem;
    height: 10rem;
    position: fixed;
    left: 45%;
    top: 13% !important;
    transform: translate(-50%, -50%);
    z-index: 200;
    pointer-events: none;
}

.revert-btn img {
    content: url('./assets/buttons/revert.png');
    transition: all 0.3s ease;
}

.check-btn img {
    content: url('./assets/buttons/check.png');
    mix-blend-mode: multiply;
    transition: all 0.3s ease;
}

.reveal-btn img {
    content: url('./assets/buttons/reveal-word.png');
    transition: all 0.3s ease;
}

.reveal-all-btn img {
    content: url('./assets/buttons/reveal-all.png');
    mix-blend-mode: multiply;
    transition: all 0.3s ease;
}

.solution-btn img {
    content: url('./assets/buttons/solution.png');
    mix-blend-mode: multiply;
    transition: all 0.3s ease;
}


.revert-btn:hover img {
    content: url('./assets/buttons/revert.gif');
}

.check-btn:hover img {
    content: url('./assets/buttons/check.gif');
}

.reveal-btn:hover img {
    content: url('./assets/buttons/reveal-word.gif');
}

.reveal-all-btn:hover img {
    content: url('./assets/buttons/reveal-all.gif');
}

.solution-btn:hover img {
    content: url('./assets/buttons/solution.gif');
}

.grid-cell.active.highlighted:not(.fixed) {
   background-image: 
    url('assets/cube/current.png'),
    url('assets/cube/orange.png');
   transform: scale(1.07);
}

.grid-cell.highlighted:not(.fixed) {
    background-image: url('assets/cube/orange.png'); 
    transform: scale(1.07);
}

.grid-cell.fixed {
    background-image: url('assets/cube/maroon.png') !important;
}

.grid-cell.fixed.active {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}
.mobile-only{
    display: none;
    z-index: -10;
}

.game-header {
    display: flex !important;
    justify-content: center;
    align-items: center;
    padding: 0.6rem 1rem !important;
    max-width: 800px !important;
    margin: 0 auto 0.5rem auto !important;
    position: relative !important;
    white-space: nowrap;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
    left: 2.3rem;
    top: 1.2rem;
    padding-left: 5px;
    z-index: 10 !important;
}
.game-header > * {
    flex-shrink: 0;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    transform: none !important;
    float: none !important;
}

.game-header .mute-button {
    order: 1;
    margin-right: 1rem;
}

.game-header .timer-display {
    order: 2;
    margin-right: 2rem;
}

.game-header .instructions-icon {
    order: 3;
    margin-right: 1rem;
}

.game-header .score-display {
    order: 4;
}

.instructions-icon {
    background: #ffffff !important;
    border: 2px solid #cdcdcd !important;
    border-radius: 5px !important;
    width: 1.9rem !important;
    height: 1.2rem !important;
    padding: 8px !important;
    font-weight: bold !important;
    color: #333 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    margin: 0 !important;
    left: -1.2rem !important;
}

.instructions-icon:hover {
    border-color: #4c9abe !important;
    transform: translateY(-2px) !important;
}

.instructions-icon img {
    width: 2rem !important;
    height: 2rem !important;
    margin: 0 !important;
    mix-blend-mode: multiply !important;
    transition: all 0.3s ease !important;
}

.timer-display {
    font-family: Arial, Helvetica, sans-serif !important;
    background: #ffffff !important;
    border: 2px solid #cdcdcd !important;
    border-radius: 5px !important;
    width: 3.6rem !important;
    height: 1.2rem !important;
    padding: 8px 16px !important;
    font-weight: bold !important;
    color:#9f0712 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    margin: 0 !important;
    left: -5.7rem !important;
}

.score-display {
    font-family: Arial, Helvetica, sans-serif !important;
    background: #ffffff !important;
    border: 2px solid #cdcdcd !important;
    border-radius: 5px !important;
    width: 3.4rem !important;
    height: 1.2rem !important;
    padding: 8px 16px !important;
    font-weight: bold !important;
    color: #333 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    margin: 0 !important;
    left: -1rem !important;
}

.timer-display img,
.score-display img {
    height: 2rem !important;
    width: 1.8rem !important;
    margin: 0 !important;
    vertical-align: middle !important;
}

.timer-display:hover img {
    content: url('./assets/score-timer/clock.gif');
}

.score-display:hover img {
    content: url('./assets/score-timer/coin.gif');
}

.timer-display span,
.score-display span {
    font-size: 1.0rem !important;
    margin: 0 !important;
    color:#9f0712 !important;
    font-weight: bold !important;
}

.mute-button {
    cursor: pointer !important;
    padding: 8px !important;
    background: #ffffff !important;
    border: 2px solid #cdcdcd !important;
    border-radius: 5px !important;
    width: 1.2rem !important;
    height: 1.2rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    margin: 0 !important;
    left: -6rem !important;
}

.mute-button img {
    width: 2rem !important;
    height: 2rem !important;
    transition: opacity 0.3s ease !important;
}

.mute-button:hover {
    border-color: #4c9abe !important;
    transform: translateY(-2px) !important;
}
.grid-cell.fixed {
    background-image: url('assets/cube/maroon.png') !important;
}

.grid-cell.fixed.active {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}


.grid-cell.correct-flash {
    animation: correctFlash 1s ease-in-out;
}

.grid-cell.incorrect-flash {
    animation: incorrectFlash 1s ease-in-out;
}

@keyframes correctFlash {
    0%, 100% { 
        transform: scale(1); 
        background-image: url('assets/cube/red.png'); 
    }
    50% { 
        transform: scale(1.1); 
        background-image: url('assets/cube/green.png'); 
        filter: brightness(1.2);
    }
}

@keyframes incorrectFlash {
    0%, 100% { 
        transform: scale(1); 
        background-image: url('assets/cube/red.png'); 
    }
    50% { 
        transform: scale(1.1); 
        background-image: url('assets/cube/black.png'); 
        filter: brightness(0.8);
    }
}

/* black disappear */


@keyframes incorrectFadeOut {
    0% {
        background-image: url('assets/cube/black.png');
        opacity: 1;
    }
    85% {
        background-image: url('assets/cube/black.png');
        opacity: 1;
    }
    100% {
        background-image: url('assets/cube/red.png');
        opacity: 1;
    }
}

@keyframes textFadeOut {
    0% {
        opacity: 1;
        color: white;
    }
    85% {
        opacity: 1;
        color: white;
    }
    100% {
        opacity: 0;
        color: white;
    }
}

.grid-cell.incorrect {
    animation: incorrectFadeOut 2s ease-in-out forwards;
}

.grid-cell.incorrect .cube-face.front {
    animation: textFadeOut 2s ease-in-out forwards;
}

        .menu-section {
            display: none;
            flex-shrink: 0;
            position: relative;
        }

        .menu-button {
            width: 1.8rem;
            height: 1.8rem;
            background: white;
            border: 1px solid #000000;
            border-radius: 5px;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 3px;
            padding: 2px;
            transition: all 0.3s ease;
            position: relative;
            right:4.8rem;
        }


        .menu-button span {
            width: 16px;
            height: 2px;
            background: #333;
            border-radius: 1px;
            transition: all 0.3s ease;
            display: block;
        }


        /* Menu Dropdown */
        .menu-dropdown {
            position: absolute;
            top: 116%;
            right: 1.3rem;
            background: white;
            border: 1px solid #4e4d4d;
            border-radius: 5px;
            min-width: 100px;
            display: none;
            flex-direction: column;
            z-index: 2000;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            opacity: 0;
            transform: translateY(-10px);
            transition: all 0.3s ease;
            pointer-events: none;
            padding: 8px 12px;
        }

        .menu-dropdown.active {
            display: flex;
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto;
            gap:0.3rem;
        }

        .menu-item {
            cursor: pointer;
            transition: all 0.2s ease;
            border: none;
            background: transparent;
            text-align: left;
            font-size: 14px;
            color: #333;
            font-weight: 500;
            width: 100%;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: -1px 12px;
            box-sizing: border-box;
            font-family: Arial, Helvetica, sans-serif;
        }

        .menu-item:first-child {
            border-radius: 5px 5px 0 0;
        }

        .menu-item:last-child {
            border-radius: 0 0 5px 5px;
        }


        .menu-item:active {
            background: #efefef;
        }

        .menu-item.instruction-menu-btn{
            box-sizing: border-box;
            min-width:4rem;
            height: 1.8rem;
            font-size: 0.8rem;
            gap: 1px !important;
            border-radius: 3px !important;
            border: 1px solid #747171 !important;  
            font-family: 'customFont';
        }
        .menu-dropdown .control-btn {
            width: 100%;
            min-width: auto;
            height: auto;
            padding: -1px 16px;
            border: none;
            border-radius: 0;
            background: transparent;
            justify-content: flex-start;
            text-align: left;
            font-size: 0.8rem;
            font-family: 'customFont';
        }


        .menu-dropdown .control-btn:active {
            background: #efefef;
        }

        .menu-dropdown .control-btn:first-child {
            border-radius: 5px 5px 0 0;
        }

        .menu-dropdown .control-btn:last-child {
            border-radius: 0 0 5px 5px;
        }

        .menu-dropdown .control-btn img,
        .menu-dropdown .menu-item img {
            width: 1.6rem !important;
            height: 1.6rem !important;
            vertical-align: middle;
            mix-blend-mode: multiply;
        }

    .play-btn {
    display: block;
    margin: 20px auto;
    padding: 10px 30px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    background-color: #BA0406;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s ease;
    }



@media (max-width: 992px) {
     html, body {
        margin: 0 !important;
        padding: 0 !important;
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative;
    }

    .main-border-container {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .container {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
.full-puzzle-gif {
    width: 13rem;
    height: 13rem;
    top: 40%;
    left: 20%;
  }
    
    .grid-cell[data-row="2"]{ z-index: 75; top: 3.1rem; }
    .grid-cell[data-row="3"] { z-index: 40; top: 2.8rem; }
    .grid-cell[data-row="4"] { z-index: 20; top: 2.6rem; }
    .grid-cell[data-row="5"] { z-index: 6; top: 2.3rem; }
    .grid-cell[data-row="1"]{z-index: 95; top:3.4rem;}
    .grid-cell[data-row="0"]{z-index: 100; top:3.7rem;}
    .grid-cell[data-row="6"]{z-index: 5;top:2rem;}

     .home-logo{
        padding: auto;
    }
    .logo-cube {
        width: 2.1rem;
        height: 2.1rem;
        font-size: 1.3rem;
    }
    
    .logo-row {
        gap: 1px;
    }
    
    
    .loading-text {
        font-size: 1.2rem;
    }
    
    .background-gif img {
        max-width: 280px;
        max-height: 200px;
    }
    
    .instructions-box {
        position: absolute;
        width: 16rem;
        top: 3rem;
        padding: 2rem;
    }

    .instructions-header {
        font-size: 15px;
        width: 7rem;
        letter-spacing: 0.1px;
        left: 3.8rem;
        top: -2.9rem;
        padding: 8px;
        align-items: center;
        justify-content: center; 
        border-radius: 6px;
    }

    .instructions-box ol {
        font-size: 13px;
        color: #000;
        padding: 0 0.5rem;
        margin-top: -2rem;
    }
     .highlight {
            font-family: Arial, Helvetica, sans-serif;
            color: #BA0406;
            font-size: 13px;
            font-weight: bold;
        }

    .instructions-icon {
        position: relative;
        left: 11.3rem;
        top: 13rem;
        width: 1rem;
        height: 1rem;
        font-size: 18px;
    }

    .close-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
        top: -0.7rem;
        left: 19rem !important;
    }



    .grid-container {
        position: relative;
        margin: 0 auto;
        width: 100%;
        max-width: 320px;
        display: flex;
        justify-content: center;
        top: -2rem;
        left: -0.9rem;
        padding-left: 5px;
    }

    .grid-cell {
        width: 3.1rem;
        height: 2.8rem;
        position: relative;
        margin-right: -8px;
        cursor: pointer;
        background-image: url('assets/cube/red.png');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 18rem;
        text-transform: uppercase;
        color: white;
        text-shadow: 1.5px 1.5px 2px #d29ca0;
        transition: all 0.3s ease;
    }
    
    .grid-cell input {
        font-size: 16px;
        text-align: center;
    }
    
    .grid-row {
        margin-bottom: 0;
    }

    @font-face {
        font-family: 'YourCustomFont';
        src: url('./assets/font/NotoSansJP-SemiBold.ttf') format('truetype'),
            url('assets/font/NotoSansJP-SemiBold.ttf') format('truetype');
        font-weight: 600;
        font-style: normal;
        font-display: swap;
    }

    .grid-cell, 
    .grid-cell .cube-face.front {
        font-family: 'Noto Sans JP', 'YourCustomFont', Arial, sans-serif;
        font-size: 1.5rem;
        color: #fefefe;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        letter-spacing: -0.02em;
        line-height: 1;
        text-align: center;
        text-shadow: 
            2px 0px 0px #d3999c,
            1px 0px 0px #d3999c;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        transform: translateX(-2.5px);
        padding-top: 2px;
        padding-right: 1.5px;
    }
    
    .crossword-grid {
        display: block;
        width: 100%;
        width: 25rem;
        transform: translateX(1rem);
        padding-bottom: 0;
    }
        .copyright-link {
            font-family: 'customFont';
            text-align: center;
            margin-bottom: -2.5rem;
            margin-top: 0.2rem;
            font-size: 14px;
            color: #000000;
            z-index: 999999;
        }
        
        .copyright-link a {
            color: #000000;
            text-decoration: none;
            transition: color 0.3s ease;
        }
        
        .copyright-link a:hover {
            color: #333;
            text-decoration: underline;
        }

    .mobile-only {
    display: block;
    z-index: -10;
  }
.mobile-clue-bottom {
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1001 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        /* margin: 0 !important;
        padding: 0 !important; */
        pointer-events: none;
        display: flex;
        flex-direction: column;
        box-sizing: border-box !important;
        transform: none !important;
        top: 3rem !important;
    }
    @font-face {
        font-family: 'CustomFont';
        src: url('assets/font/Lato-Bold.ttf') format('truetype');
        font-weight: normal;
        font-style: normal;
    }
    #current-clue-display-bottom {
        background: #121111 !important;
        padding: 0px 50px !important;
        margin: 0 !important;
        font-family: 'customFont' !important;
        font-size: 14px !important;
        font-weight: semi-bold;
        line-height: 1.5 !important;
        color: #ffffff !important;
        display: none !important;
        transform: translateY(20px) !important;
        opacity: 0 !important;
        transition: all 0.3s ease !important;
        pointer-events: auto !important;
        border-radius: 0 !important;
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        border: 1px solid #000000 !important;
        box-sizing: border-box !important;
        position: relative !important;
        min-height: 48px !important;
        left: 0 !important;
        right: 0 !important;
    }

    #current-clue-display-bottom.ready {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #current-clue-display-bottom.visible {
        display: flex !important;
        transform: none !important; 
        opacity: 1 !important;
    }

    #current-clue-display-bottom .current-clue-text {
        font-weight: 400 !important;
        color: #ffffff !important;
        word-wrap: break-word !important;
        margin: 0 !important;
        text-align: center !important;
        padding: 0 !important;
        flex: 1 !important;
    }

    #current-clue-display-bottom .clue-nav-prev {
        position: absolute !important;
        background: transparent !important;
        left: 12px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        border: none !important;
        padding: 0 !important;
    }

    #current-clue-display-bottom .clue-nav-next {
        position: absolute !important;
        background: transparent !important;
        right: 12px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        border: none !important;
        padding: 0 !important;
    }

    #current-clue-display-bottom .clue-nav-btn {
        width: 32px !important;
        height: 32px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        font-size: 20px !important;
        font-weight: 300 !important;
        transition: all 0.2s ease !important;
        user-select: none !important;
        color: #ffffff !important;
        background: transparent !important;
        border: none !important;
    }

    #current-clue-display-bottom .clue-nav-btn:active {
        opacity: 0.6 !important;
    }

    #current-clue-display-bottom .clue-nav-btn.disabled {
        opacity: 0.3 !important;
        cursor: not-allowed !important;
        pointer-events: none !important;
    }

    .mobile-input-container {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        background: white;
        border-top: 1px solid #ddd;
        z-index: 998 !important;
        padding: 0 !important;
        margin: 0 !important;
        transform: translateY(0);
        transition: transform 0.3s ease-in-out;
    }



   .controls {
       max-width: 460px !important;
       padding: 8px;
       gap: 0.3rem;
       top: -0.2rem;
       position: relative;
       left: -0.5rem;
       transform: none;
       display: none;
   }
   
   .row {
       gap: 0.2rem;
   }
   
   .control-btn,
   .revert-btn,  
   .check-btn, 
   .reveal-btn, 
   .reveal-all-btn, 
   .solution-btn, 
   .button-common {
    min-width:4rem;
    height: 1.8rem;
    font-size: 0.70rem;
    gap: 1px !important;
    border-radius: 3px !important;
    border: 1px solid #747171 !important;
   }
   
   .control-btn img, 
   .revert-btn img, 
   .check-btn img, 
   .reveal-btn img, 
   .reveal-all-btn img, 
   .solution-btn img {     
       width: 14px;
       height: 14px;
   }

    .cube-face.front {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
        font-size: 16px;
    }

    .instructions-icon {
        position: relative;
        top: 6rem;
        width: 1.2rem;
        height: 1.2rem;
        font-size: 18px;
        background: white;  
        border: 1px solid #4e4d4d;
        left: 1rem;
    }

    .close-btn{
        left: 13.2rem;
    }

    .celebration-gif{
        position: fixed;
        left: 70%;
        top: -5%;
        z-index: 999 !important;
    }
.control-btn, .solution-btn, .reveal-btn, .reveal-all-btn, .check-btn, .revert-btn {
    touch-action: manipulation !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.control-btn.touch-active, 
.solution-btn.touch-active, 
.reveal-btn.touch-active, 
.reveal-all-btn.touch-active, 
.check-btn.touch-active, 
.revert-btn.touch-active {
    opacity: 0.7 !important;
    transform: scale(0.95) !important;
}
    
    .puzzle-area {
        order: 1;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
    }


}


/* mobile screens */
@media (max-width: 992px) {
    .game-header {
        display: flex !important;
        padding: 0.4rem !important;
        max-width: 50vw !important;
        width: 50vw !important;
        position: relative !important;
        z-index: 10 !important;
        visibility: visible !important;
        opacity: 1 !important;
        top: 0rem !important;
        left: 0.8rem !important;
        padding-left: 15px !important;
    }
    .menu-section {
                display: flex !important;
            }
    
    .game-header .mute-button {
        margin-right: 0.1rem !important;
    }
    
    .game-header .timer-display {
        margin-right: 0.6rem !important;
    }
    
    .game-header .instructions-icon {
        margin-right: 0.3rem !important;
    }
    
    .instructions-icon,
    .mute-button {
        background: white;  
        border: 1px solid #4e4d4d !important;
        border-radius: 5px;  
        width: 1.8rem !important;
        height: 1.5rem !important;
        padding: 2px !important;
    }
       .instructions-icon{
        left:-2rem !important;
       }
   
    .timer-display,
    .score-display {
        background: white;  
        border: 1px solid #4e4d4d !important;
        border-radius: 5px;  
        width: 2.7rem !important;
        height: 1.3rem !important;
        padding: 4px 10px !important;
        gap: 2px !important;
    }
   .timer-display{
        left: -6rem !important;
    }
    .score-display{
        width: 2rem !important;
        left: 0.5rem !important;
    }

    
    .timer-display img,
    .score-display img {
        height: 1.3rem !important;
        width: 1.3rem !important;
    }
    
    .timer-display span,
    .score-display span {
        font-size: 0.8rem !important;
    }
    
    .instructions-icon img,
    .mute-button img {
        width: 1.5rem !important;
        height: 1.5rem !important;
    }
     .instructions-icon {
        left: 1rem !important;
    }

}


.grid-cell.active.highlighted:not(.correct):not(.fixed) {
   background-image: 
    url('assets/cube/current.png'),
    url('assets/cube/orange.png');
   transform: scale(1.07);
}
.grid-cell.highlighted:not(.correct):not(.fixed){
    background-image:url('assets/cube/orange.png'); 
    transform: scale(1.07);
}


.menu-section.left-align {
    left: 10rem;
    order: 10;
}

@media (max-width: 992px) {
  .check-header-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: white !important;
    border: 1px solid #4e4d4d !important;
    border-radius: 5px !important;
    padding: 2px 6px !important;
    height: 1.5rem !important;
    position: relative !important;
    left: 7.7rem !important;
     z-index: 100000;
     font-family: 'customFont';
  }

  .check-header-btn .check-btn {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    background: transparent !important;
    border: none !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    color: #333 !important;
    font-family: 'Noto Sans JP', sans-serif !important;
    cursor: pointer !important;
    padding: 0 !important;
    z-index: 100000;
    font-family: 'customFont';
  }

  .check-header-btn .check-btn img {
    width: 1.4rem !important;
    height: 1.4rem !important;
    mix-blend-mode: multiply !important;
  }

 
  .check-header-btn .check-btn:active {
    transform: scale(0.95);
  }

  @media (min-width: 993px) {
    .check-header-btn {
      display: none !important;
    }
  }
   .instructions-icon {
        visibility: hidden !important;
    }
}

.instruction-menu-btn img {
    width: 1.6rem;
    height: 1.6rem;
    vertical-align: middle;
    mix-blend-mode: multiply;
}
