/* Shake animation for duplicate guess prevention */
.shake {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
  100% { transform: translateX(0); }
}
/* Guess history popover styles */
.guess-history-popover {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #bbb;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
    min-width: 60px;
    max-width: 120px;
    font-size: 1.1rem;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.chips-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 8px;
    width: 100%;
    align-items: center;
    justify-items: center;
}
.guess-chip {
    background: #e8eaf6;
    color: #6200ea;
    border-radius: 50%;
    width: 2em;
    height: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    border: 1px solid #bdbdbd;
    transition: background 0.2s, color 0.2s;
}
.chip-correct {
    background: #c8e6c9 !important;
    color: #1b5e20 !important;
    border-color: #388e3c !important;
}
.chip-hint {
    background: #ffeb3b !important;
    color: #f57f17 !important;
    border-color: #fbc02d !important;
}
.chip-incorrect {
    background: #ffcdd2 !important;
    color: #b71c1c !important;
    border-color: #b71c1c !important;
}
.guess-history-empty {
    color: #aaa;
    font-size: 0.95em;
}

@media (max-width: 768px) {
    .guess-history-popover {
        font-size: 1.2rem;
        min-width: 40px;
        max-width: 90px;
        padding: 8px 6px;
    }
    .guess-chip {
        width: 1.7em;
        height: 1.7em;
        font-size: 1em;
    }
}
/* General Styles */
body {
    font-family: 'Nunito', sans-serif;
    background: #f0f0f0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: #333;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 1000px; /* Increase max-width to accommodate two columns */
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    width: 100%;
    background: #6200ea;
    color: #ffffff;
    padding: 20px;
    text-align: center;
}

.header .title {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.header .status {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.header .timer,
.header .errors {
    font-size: 1rem;
}

.guess-icon {
    margin: 0 2px;
}

.main {
    display: flex;
    width: 100%;
    padding: 20px;
    background: #e8eaf6;
    flex-wrap: nowrap;
    align-items: flex-start;
}

.clues-section {
    width: 30%; /* Fixed width for clues section */
    background: #ffffff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    height: 500px; /* Fixed height */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.content {
    width: 100%;
}

.tabs {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.tab-button {
    background: #f0f0f0;
    border: none;
    padding: 10px;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 1rem;
    width: 50%;
    border-bottom: 2px solid #6200ea;
}

.tab-button:hover {
    background: #e0e0e0;
}

.tab-button.active {
    background: #6200ea;
    color: #ffffff;
    border-bottom: none;
}

#row-clues tr, #col-clues tr {
    font-size: .75rem;
}

.clues-table {
    width: 100%;
    border-collapse: collapse;
    flex-grow: 1;
}

table#clues-table td, table#clues-table th {
    text-align: center;
}

.clues-table th, .clues-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.clues-table th {
    background: #6200ea;
    color: #ffffff;
    text-transform: uppercase;
}

.clues-table tbody tr:nth-child(even) {
    background: #f0f0f0;
}

.game-rules-section {
    display: none; /* Initially hidden */
    padding: 0 20px;
    text-align: center; /* Center the content horizontally */
}

.game-rules-section h2 {
    text-align: center; /* Center the content horizontally */
}

.rules-content {
    text-align: left; /* Align text to the left */
    font-size: 1rem;
}

.rules-content p {
    margin: 10px 0;
}

.rules-content .emoji-explanation {
    display: flex;
    align-items: center;
    margin: 5px 0;
}

.rules-content .emoji-explanation span {
    margin-left: 10px;
    font-size: 1rem;
    color: #333;
}

.grid-section {
    width: 70%; /* Remaining width for grid section */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.grid-cells {
    display: grid;
    grid-template-columns: auto repeat(4, minmax(75px, 1fr)) auto; /* Adjust to add extra column for labels */
    grid-template-rows: auto repeat(4, minmax(75px, 1fr)) auto; /* Adjust to add extra row for labels */
    gap: 8px;
}

.grid-cell, .row-label, .column-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #6200ea;
    padding: 2px; /* Reduce padding */
    margin: 0; /* Remove margin */
}

.grid-cell {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background: #bbdefb;
    border-radius: 5px;
    transition: background 0.3s, transform 0.3s;
}

.grid-cell {
    position: relative;
    outline: 2px solid transparent; /* Add border to the cell */
}

.duplicate-message {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: red;
    color: white;
    padding: 2px 5px;
    font-size: 0.75rem;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 1;
    pointer-events: none;
}

.grid-cell-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.grid-cell input {
    width: 100%;
    height: 100%;
    font-size: 2.5rem;
    border: none;
    background: transparent;
    text-align: center;
    outline: none;
    box-sizing: border-box;
}

.grid-cell.preset .grid-cell-content {
    background: #80d8ff;
    color: #01579b;
}

.grid-cell.correct .grid-cell-content {
    background: #c8e6c9;
    color: #1b5e20;
}

.grid-cell.incorrect .grid-cell-content {
    background: #ffcdd2;
    color: #b71c1c;
}

.grid-cell.hint .grid-cell-content {
    background: #ffeb3b;
    color: #f57f17;
}

.grid-cell.revealed .grid-cell-content {
    background: #ffcc80; /* Light orange background */
    color: #d84315; /* Dark orange text */
}

.controls-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}

.button {
    padding: 10px 20px;
    background: #6200ea;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
    font-size: 1rem;
    font-weight: 600;
    margin: 10px 0;
}

/* Hover state */
.button:hover {
    background: #3700b3;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

/* Active state */
.button:active {
    background: #6200ea;
    transform: scale(1);
    box-shadow: none;
}

/* Disabled state */
.button:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

.result {
    margin-top: 15px;
    font-size: 1rem;
    text-align: center;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .container {
        width: 100%;
        min-width: 0;
        max-width: 100vw;
        border-radius: 0;
        box-shadow: none;
    }

    .main {
        flex-direction: column;
        padding: 8px;
    }

    section#clues-container {
        order: 2;
        height: auto;
    }

    .clues-section, .game-rules-section, .grid-section, .controls-section {
        width: 100%;
        margin-right: 0;
        margin-bottom: 20px;
    }

    .grid-cells {
        grid-template-columns: auto repeat(4, minmax(44px, 1fr)) auto;
        grid-template-rows: auto repeat(4, minmax(44px, 1fr)) auto;
        gap: 4px;
    }

    .grid-cell, .row-label, .column-label {
        font-size: 1rem;
        padding: 0;
    }

    .grid-cell-content, .grid-cell input {
        font-size: 1.3rem;
    }

    .button {
        font-size: 0.95rem;
        padding: 8px 12px;
        margin: 6px 0;
    }

    #share-options {
        flex-direction: column;
        gap: 6px;
    }
}
