#main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
}

/* Game area */
.game-area {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 30px;
    display: flex;
    flex-direction: column;
}

/* Controls */
.game-controls {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* Grid */
.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    /* Example: 12 columns */
    gap: 2px;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
    user-select: none;
}

.grid-cell {
    width: 40px;
    height: 40px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.grid-cell:hover {
    background: #e3f2fd;
}

.grid-cell.selected {
    background: #2196F3;
    color: white;
    transform: scale(1.1);
}

.grid-cell.found {
    background: #4CAF50;
    color: white;
}

/* Grid Placeholder */
.grid-placeholder {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 200px;
    background: linear-gradient(135deg, #f0f4ff, #e6f7ff);
    border: 2px dashed #a3bffa;
    border-radius: 16px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #4a4a4a;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.6s ease-in-out;
}

.grid-placeholder span {

    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.4;
    background: linear-gradient(90deg, #6a5af9, #00c2ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulse 1.5s infinite;
}

.grid-span-element {
    grid-column: 7 / -1;
    /* default for large screens */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Sidebar */
.sidebar {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 25px;
    height: fit-content;
}

.sidebar h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
    width: 100%;
}

/* Word lists */
.word-category {
    margin-bottom: 25px;
}

.category-header {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.word-item {
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.word-item.found {
    background: #4CAF50;
    color: white;
    text-decoration: line-through;
}

/* Score + timer + current word */
.score-section {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 10px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
}

.score-section h3 {
    margin-bottom: 10px;
    margin-top: 0;
    color: #fff;
}

.score {
    font-size: 2rem;
    font-weight: bold;
}

.current-word {
    background: #fff3cd;
    border: 2px solid #ffeaa7;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
}

.current-word h4 {
    color: #856404;
    margin-bottom: 5px;
}

.current-word span {
    font-size: 1.2rem;
    font-weight: bold;
    color: #533;
}

/* Score + Timer row */
.score-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mini-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    text-align: center;
}

.mini-card-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: #fff;
}

.score-box {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: #fff;
}

.time-box {
    background: linear-gradient(45deg, #00b4d8, #0077b6);
    color: #fff;
}

.timer {
    font-size: 1.4rem;
    font-weight: 800;
}

/* Hint highlight */
.hint-highlight {
    outline: 3px solid #FFD54F;
    box-shadow: 0 0 12px #FFD54F;
}

/* Popup */
.puzzle-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.puzzle-popup-content {
    background: #fff;
    padding: 40px 32px;
    border-radius: 16px;
    text-align: center;
    max-width: 460px;
    width: calc(100% - 32px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.popup-title {
    color: #2fa4f5;
    font-size: 42px;
    font-weight: 800;
    margin: 0 0 10px;
    line-height: 1;
}

.popup-sub {
    font-size: 18px;
    color: #222;
    margin: 10px 0;
}

.puzzle-popup-content .popup-btn {
    padding: 12px 24px;
    border: 0;
    border-radius: 10px;
    background: #0d2a4e;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.grid-cell {
    touch-action: none;
    /* scrolling disable while dragging */
}


/* Animations */
@keyframes wordFound {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.word-found-animation {
    animation: wordFound 0.5s ease-in-out;
}

/* Responsive Breakpoints */

/* <=1299px */
@media (max-width: 1299px) {
    #main-container {
        grid-template-columns: 1fr 280px;
        gap: 15px;
    }

    .grid-cell {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

/* <=992px */
@media (max-width: 992px) {
    #main-container {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        align-items: flex-start;
    }

    .grid-container {
        grid-template-columns: repeat(8, 1fr);
    }

    .grid-span-element {
        grid-column: 5 / -1;
        /* Adjust span for smaller screens */
    }

    .grid-cell {
        width: 32px;
        height: 32px;
        font-size: 15px;
    }

    .popup-title {
        font-size: 36px;
    }
}

/* <=768px */
@media (max-width: 768px) {
    #main-container {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 0;
    }
    .hero-section{
        padding-left: 11px !important;
    }
    .game-area {
        padding: 20px 10px;
    }

    .grid-cell {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .puzzle-popup-content {
        padding: 28px 20px;
    }

    .popup-title {
        font-size: 32px;
    }

    .grid-container {
        grid-template-columns: repeat(6, 1fr);
        margin-bottom: 0;
    }

    .grid-span-element {
        grid-column: 4 / -1;
        /* Adjust span for medium-small screens */
    }

    .timer,
    .score {
        font-size: 1.2rem;
    }

    .word-list {
        flex-wrap: nowrap;
        gap: 2px;
    }

    .sidebar {
        padding: 10px;
    }

    .word-category {
        margin-bottom: 15px;
    }
    .mini-card{
        padding: 8px;
    }
    
}


@media (min-width:575px) and (max-width:767px){
     #main-container {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 0;
    }
    .grid-container {
        grid-template-columns: repeat(4, 1fr);
    }

    .grid-span-element {
        grid-column: 3 / -1;
        /* Adjust span for extra small screens */
    }

    .grid-cell {
        width: 40px;
        height: 40px;
    }

    .game-controls {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
    }

    .btn {
        max-width: 200px;
    }

    .puzzle-popup-content {
        padding: 22px 16px;
    }

    .popup-title {
        font-size: 28px;
    }
    .sidebar{
        width: 550px;
    }
    .hero-section{
       padding: 20px 0px !important;
    }
}

@media (min-width:480px) and (max-width:574px) {
      #main-container {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 0;
    }
    .grid-container {
        grid-template-columns: repeat(4, 1fr);
    }

    .grid-span-element {
        grid-column: 3 / -1;
        /* Adjust span for extra small screens */
    }

    .grid-cell {
        width: 30px;
        height: 30px;
    }

    .game-controls {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
    }

    .btn {
        max-width: 200px;
    }

    .puzzle-popup-content {
        padding: 22px 16px;
    }

    .popup-title {
        font-size: 28px;
    }
    .sidebar{
        width: 100%;
    }
   
}


/* <=600px */ 
@media (max-width: 600px) {
    #main-container {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 0;
    }
    .grid-container {
        grid-template-columns: repeat(4, 1fr);
    }

    .grid-span-element {
        grid-column: 3 / -1;
        /* Adjust span for extra small screens */
    }

    .grid-cell {
        width: 30px;
        height: 30px;
    }

    .game-controls {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
    }

    .btn {
        max-width: 200px;
    }

    .puzzle-popup-content {
        padding: 22px 16px;
    }

    .popup-title {
        font-size: 28px;
    }
    /* .sidebar{
        width: 550px;
    } */
    .hero-section{
       padding:20px 0px !important;
    }
}

/* <=480px */
@media (max-width: 480px) {
     #main-container {
        grid-template-columns: 1fr;  
        gap: 10px;
        padding: 0px;
    }
    .sidebar {
        padding: 15px;
        /* width: 450px; */
        width: 100%;
    }

    .grid-cell {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }

    .popup-title {
        font-size: 24px;
    }

    .grid-container {
        grid-template-columns: repeat(3, 1fr);
          /* grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));  */
        gap: 2px;
    }

    .grid-span-element {
        grid-column: 2 / -1;
        /* Adjust span for smallest screens */
    }
}


@media (max-width:400px) {
    .hero-section{
        margin: 0px;
    }
}

@media (min-width:380px) and (max-width:480px) {
      .grid-container {
        grid-template-columns: repeat(6, 1fr);
    }

    .game-area {
        padding: 15px;
        width: 360px;
    }

    .sidebar {
        padding: 15px;
       width: 360px;
    }
}

@media (min-width:360px) and (max-width:379px) {
     .grid-container {
        grid-template-columns: repeat(6, 1fr);
    }

    .grid-cell {
        width: 25px;
        height: 25px;
    }

    .game-area {
        padding: 15px 5px;
        width: 350px;
    }
    .game-controls{
        gap: 3px;
    }
    .btn{
        padding: 12px 20px;
    }

    .sidebar {
        padding: 15px;
       width: 100%;
    }
}

@media (max-width: 350px) {
    .grid-container {
        grid-template-columns: repeat(6, 1fr);
        padding: 10px 5px;
    }

    .grid-cell {
        width: 24px;
        height: 24px;
    }

    .game-area {
        padding: 5px;
        width: 333px;
    }

    .sidebar {
        padding: 15px;
    }
    .btn{
        padding: 12px 20px;
    }
    .game-controls{
        flex-wrap: nowrap !important;
        margin-top: 10px;
        gap: 5px;
    }
}

@media (max-width: 320px) {
    .grid-cell {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .popup-title {
        font-size: 20px;
    }
    .grid-container {
        padding: 10px 5px !important;
    }
    .game-area , .sidebar{
        width: 315px !important;
    }
    .game-controls{
        gap: 2px;
        flex-wrap: nowrap !important;
    }

    
}