/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #ffffff;
    color: #1a1a1b;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #d3d6da;
}

.title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a1b;
    margin: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-selector label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a1a1b;
}

#language-select {
    padding: 8px 12px;
    border: 2px solid #d3d6da;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

#language-select:focus {
    outline: none;
    border-color: #538d4e;
}

.keyboard-indicator {
    background-color: #f8f9fa;
    border: 1px solid #d3d6da;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 1.5rem;
    font-weight: 500;
    color: #1a1a1b;
    transition: all 0.2s ease;
}

.keyboard-indicator.active {
    background-color: #538d4e;
    color: white;
    border-color: #538d4e;
}

.keyboard-indicator.disabled {
    background-color: #f1f3f4;
    color: #9aa0a6;
    border-color: #dadce0;
}

/* Game Container */
.game-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 20px;
}

#game-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
    width: auto;
    margin-left: auto;
    margin-right: auto;
}

.game-grid:focus {
    outline: 2px solid #538d4e;
    outline-offset: 2px;
    border-radius: 4px;
}

.grid-row {
    display: grid;
    grid-template-columns: repeat(6, 45px); /* 6 columns, fixed width */
    gap: 5px;
}

/* Remove or override any language-specific column count for grid rows */
.grid-row[data-lang="marathi"],
.grid-row[data-lang="hindi"] {
  grid-template-columns: repeat(6, 45px) !important;
}

.tile {
    width: 45px;
    height: 45px;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #d3d6da;
    border-radius: 5px;
    background: #f3f3f3;
    font-weight: bold;
    text-align: center;
    box-sizing: border-box;
}

.tile.filled {
    border-color: #878a8c;
}

.tile.correct {
    background-color: #538d4e;
    border-color: #538d4e;
    color: white;
}

.tile.present {
    background-color: #b59f3b;
    border-color: #b59f3b;
    color: white;
}

.tile.absent {
    background-color: #3a3a3c;
    border-color: #3a3a3c;
    color: white;
}

.tile.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.tile.flip {
    animation: flip 0.6s ease-in-out;
}

@keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

/* Hint Section */
.hint-section {
    background-color: #f8f9fa;
    border: 1px solid #d3d6da;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.hint-section.hidden {
    display: none;
}

.hint-text {
    font-size: 0.9rem;
    color: #1a1a1b;
    font-weight: 500;
    margin: 0;
    flex: 1 1 auto;
    text-align: left;
}

.tries-left {
    flex: 0 0 auto;
    color: #888;
    font-weight: bold;
    margin-left: 10px;
    border-left: 1px solid #ccc;
    padding-left: 10px;
}

/* Virtual Keyboard */
.keyboard-container {
    margin-top: auto;
    padding-bottom: 20px;
}

.virtual-keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.key {
    min-width: 48px;
    height: 54px;
    font-size: 1.5rem;
    font-weight: 800;
    border-radius: 6px;
    margin: 2px 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f3f3f3;
    color: #222;
    border: 1.5px solid #bbb;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.key:hover {
    background-color: #c4c7ca;
}

.key:active {
    transform: scale(0.95);
}

.key.correct {
    background-color: #538d4e;
    color: white;
}

.key.present {
    background-color: #b59f3b;
    color: white;
}

.key.absent {
    background-color: #3a3a3c;
    color: white;
}

.key.special {
    min-width: 65px;
    font-size: 1.5rem;
}

.key-large {
    min-width: 100px;
    height: 54px;
    font-size: 1.5rem;
    font-weight: 900;
}

/* General Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Modal Content Box */
.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
    animation-name: animatetop;
    animation-duration: 0.4s;
    font-family: sans-serif;
}

/* Add Animation */
@keyframes animatetop {
    from {top: -300px; opacity: 0}
    to {top: 0; opacity: 1}
}

.modal-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.modal-content ul {
    list-style-type: '✅';
    padding-left: 20px;
}
.modal-content li {
    padding-left: 10px;
    margin-bottom: 8px;
}

.example-word {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 2px;
    margin-top: 5px;
    padding: 10px;
    background-color: #eee;
    border-radius: 5px;
}

.color-examples {
    margin-top: 15px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-examples .tile {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 2em;
    height: 2em;
    margin-right: 10px;
    color: white;
    font-weight: bold;
}

.modal-button {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    background-color: #4CAF50; /* Green */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-button:hover {
    background-color: #45a049;
}

/* Styles for Game Over Modal */
#game-over-modal .modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#target-word-display {
    font-weight: bold;
    margin: 10px 0;
    font-size: 1.2em;
}

#new-game-btn {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    background-color: #337ab7;
    color: white;
    border: none;
    border-radius: 5px;
}

#new-game-btn:hover {
    background-color: #286090;
}

#game-over-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

h1, h2, h3, p {
  margin: 0 0 10px;
}

/* Instructions */
.instructions {
    margin-top: 20px;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #d3d6da;
}

.instructions p {
    font-size: 0.85rem;
    color: #1a1a1b;
    margin-bottom: 8px;
}

.instructions p:last-child {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .language-selector {
        width: 100%;
        justify-content: space-between;
    }
    
    .keyboard-indicator {
        align-self: flex-start;
    }
    
    .title {
        font-size: 1.75rem;
    }
    
    .tile {
        font-size: 1.75rem;
    }
    
    .key {
        min-width: 35px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .key.special {
        min-width: 55px;
        font-size: 0.7rem;
    }
    
    .keyboard-row {
        gap: 4px;
    }
    
    .modal-content {
        padding: 20px;
        margin: 20px;
    }
}

@media (max-width: 360px) {
    .tile {
        font-size: 1.5rem;
    }
    
    .key {
        min-width: 30px;
        height: 45px;
        font-size: 0.75rem;
    }
    
    .key.special {
        min-width: 50px;
        font-size: 0.65rem;
    }
}

/* Language-specific adjustments for better character display */
.tile[data-lang="hindi"],
.tile[data-lang="marathi"] {
    font-size: 1.5rem;
}

.key[data-lang="hindi"],
.key[data-lang="marathi"] {
    font-size: 1.5rem;
    min-width: 35px;
}

@media (max-width: 480px) {
    .tile[data-lang="hindi"],
    .tile[data-lang="marathi"] {
        font-size: 1.25rem;
    }
    
    .key[data-lang="hindi"],
    .key[data-lang="marathi"] {
        font-size: 0.7rem;
        min-width: 30px;
    }
}

.key-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.matra-bar {
    display: flex;
    gap: 2px;
    margin-bottom: 2px;
    z-index: 2;
}

.matra-btn {
    background: #f8f9fa;
    border: 1px solid #d3d6da;
    border-radius: 3px;
    font-size: 0.9rem;
    padding: 0 4px;
    cursor: pointer;
    color: #1a1a1b;
    transition: background 0.2s, border 0.2s;
    min-width: 20px;
    min-height: 24px;
    margin: 0 1px;
}
.matra-btn:hover {
    background: #e0e0e0;
    border-color: #b59f3b;
}

/* Ensure the keyboard row layout doesn't break */
.keyboard-row {
    align-items: flex-end;
}

.matra-popup {
    display: flex;
    gap: 4px;
    background: #fff;
    border: 1px solid #d3d6da;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    padding: 4px 6px;
    position: absolute;
    z-index: 1001;
}
.matra-popup .matra-btn {
    min-width: 28px;
    min-height: 32px;
    font-size: 1.1rem;
    background: #f8f9fa;
    border: 1px solid #d3d6da;
    border-radius: 4px;
    color: #1a1a1b;
    margin: 0 2px;
    transition: background 0.2s, border 0.2s;
}
.matra-popup .matra-btn:hover {
    background: #e0e0e0;
    border-color: #b59f3b;
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 600px) {
    body {
        font-size: 14px;
    }

    .container {
        padding: 5px;
    }

    .title {
        font-size: 1.8rem;
    }

    /* Make modals take up more space */
    .modal-content {
        width: 95%;
        padding: 20px 15px;
    }

    .modal-title {
        font-size: 1.3rem;
    }
    
    .tile {
        width: 45px;
        height: 45px;
        font-size: 1.8rem;
    }

    /* New Mobile Keyboard Styles */
    #virtual-keyboard {
        width: 100%;
        padding: 5px 0;
        margin-top: 15px;
    }

    .keyboard-grid {
        display: grid;
        grid-template-columns: repeat(11, 1fr);
        gap: 5px;
    }

    .key {
        height: 45px;
        font-size: 1.1rem;
        padding: 0;
    }

    .key-separator {
        display: flex;
        align-items: center;
        justify-content: center;
        color: #888;
        font-size: 1.5rem;
    }

    .keyboard-action-row {
        display: flex;
        gap: 5px;
        margin-top: 10px;
    }

    #backspace-key {
        flex-basis: 30%;
    }
    #enter-key {
        flex-grow: 1;
        background-color: #538d4e;
    }

    /* Sticky input row for mobile */
    .sticky-input-row {
        position: sticky;
        top: 0;
        z-index: 1002;
        background: #fff;
        border-bottom: 2px solid #d3d6da;
        padding: 8px 0 4px 0;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 55px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    }
}

/* Main game area */
#game-container {
    width: 100%; /* Ensure container takes full width to center its content */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

/* Manual dark mode toggle: duplicate all dark mode rules under .dark-mode */
.dark-mode, .dark-mode body {
  background: #181a1b !important;
  color: #f1f1f1 !important;
  transition: background 0.3s, color 0.3s;
}
.dark-mode .container {
  background: #232526 !important;
}
.dark-mode .header, .dark-mode .header-right, .dark-mode .title {
  background: #181a1b !important;
  color: #f1f1f1 !important;
}
.dark-mode .modal-content {
  background: #232526 !important;
  color: #f1f1f1 !important;
  border-color: #333 !important;
}
.dark-mode .modal {
  background-color: rgba(0,0,0,0.85) !important;
}
.dark-mode .tile {
  background: #232526 !important;
  color: #f1f1f1 !important;
  border-color: #444 !important;
}
.dark-mode .tile.filled {
  background: #333 !important;
}
.dark-mode .tile.correct {
  background: #388e3c !important;
  color: #fff !important;
}
.dark-mode .tile.present {
  background: #b59f3b !important;
  color: #fff !important;
}
.dark-mode .tile.absent {
  background: #444 !important;
  color: #bbb !important;
}
.dark-mode .keyboard-row, .dark-mode .special-row {
  background: #181a1b !important;
}
.dark-mode .key {
  background: #232526 !important;
  color: #f1f1f1 !important;
  border: 1px solid #444 !important;
  transition: background 0.2s, color 0.2s;
}
.dark-mode .key.special, .dark-mode .key-large {
  background: #232526 !important;
  color: #f1f1f1 !important;
}
.dark-mode .key-enter {
  background: #388e3c !important;
  color: #fff !important;
}
.dark-mode .key-backspace {
  background: #e74c3c !important;
  color: #fff !important;
}
.dark-mode .key:active, .dark-mode .key:hover {
  background: #333 !important;
  color: #fff !important;
}
.dark-mode .hint-section {
  background: #232526 !important;
  color: #f1f1f1 !important;
  border-color: #444 !important;
}
.dark-mode .tries-left {
  color: #bbb !important;
  border-left: 1px solid #444 !important;
}
.dark-mode .matra-popup {
  background: #232526 !important;
  color: #f1f1f1 !important;
  border: 1px solid #444 !important;
}
.dark-mode .matra-btn {
  background: #333 !important;
  color: #f1f1f1 !important;
  border: 1px solid #444 !important;
}
.dark-mode .matra-btn:hover {
  background: #388e3c !important;
  color: #fff !important;
}
.dark-mode .sticky-input-row {
  background: #232526 !important;
  border-bottom: 2px solid #444 !important;
}
.dark-mode .example-word {
  background: #333 !important;
  color: #fff !important;
  border: 1px solid #444 !important;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.3em;
  cursor: pointer;
  margin-left: 8px;
  color: inherit;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}
.icon-btn:hover {
  background: #eee;
}
.dark-mode .icon-btn:hover {
  background: #222;
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.help-lang-select {
  font-size: 1em;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #ccc;
}

.action-row {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
} 