/* Wordle Game Styles */

/* Color Variables */
:root {
    --primary-color: #653a56;        /* Main dark purple for backgrounds */
    --secondary-color: #0e5d64;      /* Teal for borders and accents */
    --tertiary-color: #9a988b;       /* Green-grey for shading */
    --light-bg: #f8f8f8;            /* Light background */
    --light-accent: #e8e8e8;        /* Light accent */
    --light-purple: #f0f0f0;        /* Light neutral */
    
    /* Letter feedback colors - keeping original */
    --correct-color: #6aaa64;       /* Green for correct letters */
    --present-color: #c9b458;       /* Yellow for misplaced letters */
    --absent-color: #787c7e;        /* Grey for absent letters */
    
    /* UI colors */
    --key-bg: #e8e8e8;              /* Light grey for keys */
    --key-text: #000000;            /* Black text on keys */
    --text-primary: #000000;        /* Black text */
    --text-secondary: #ffffff;      /* White text */
}

/* Main Container */
#wordle-game-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--tertiary-color) 100%);
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
}

/* Header */
.wordle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 2px solid var(--secondary-color);
}

.wordle-title {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-secondary);
    margin: 0;
    text-align: center;
    flex-grow: 1;
    letter-spacing: 1px;
}

.wordle-header-buttons {
    display: flex;
    gap: 10px;
}

.wordle-icon-btn {
    background: var(--secondary-color);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.wordle-icon-btn:hover {
    background: var(--tertiary-color);
    transform: scale(1.1);
}

/* Mode Selector */
.wordle-mode-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
}

.mode-btn {
    padding: 8px 20px;
    border: 2px solid var(--secondary-color);
    background: var(--text-secondary);
    color: var(--text-primary);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.mode-btn:hover {
    background: var(--light-accent);
}

.mode-btn.active {
    background: var(--secondary-color);
    color: var(--text-secondary);
    border-color: var(--secondary-color);
}

/* Info Bar */
.wordle-info-bar {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    margin: 10px 0;
    border: 1px solid var(--secondary-color);
}

.wordle-timer, .wordle-attempts {
    font-weight: bold;
    color: var(--text-primary);
}

.timer-label, .attempts-label {
    color: var(--tertiary-color);
    margin-right: 5px;
}

/* Game Board */
.wordle-board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    padding: 10px;
    margin: 20px auto;
}

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

.wordle-tile {
    width: 62px;
    height: 62px;
    border: 2px solid var(--secondary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    font-weight: bold;
    text-transform: uppercase;
    background: var(--text-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.wordle-tile.filled {
    animation: pop 0.1s ease-in-out;
    border-color: var(--tertiary-color);
    background: var(--light-bg);
}

.wordle-tile.correct {
    background: var(--correct-color);
    border-color: var(--correct-color);
    color: white;
    animation: flip 0.5s ease-in-out;
}

.wordle-tile.present {
    background: var(--present-color);
    border-color: var(--present-color);
    color: white;
    animation: flip 0.5s ease-in-out;
}

.wordle-tile.absent {
    background: var(--absent-color);
    border-color: var(--absent-color);
    color: white;
    animation: flip 0.5s ease-in-out;
}

@keyframes pop {
    50% {
        transform: scale(1.1);
    }
}

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

@keyframes shake {
    10%, 90% {
        transform: translateX(-1px);
    }
    20%, 80% {
        transform: translateX(2px);
    }
    30%, 50%, 70% {
        transform: translateX(-4px);
    }
    40%, 60% {
        transform: translateX(4px);
    }
}

.wordle-row.shake {
    animation: shake 0.5s;
}

/* Message Display */
.wordle-message {
    text-align: center;
    min-height: 30px;
    margin: 10px 0;
    font-weight: bold;
    color: var(--text-secondary);
}

.wordle-message.error {
    color: #dc3545;
}

.wordle-message.success {
    color: var(--correct-color);
}

/* Keyboard */
.wordle-keyboard {
    margin: 20px 0;
}

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

.key {
    padding: 0;
    width: 43px;
    height: 58px;
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    background: var(--key-bg);
    color: var(--key-text);
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.key:hover:not(:disabled) {
    background: var(--tertiary-color);
    color: var(--text-secondary);
    transform: scale(1.05);
}

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

.key.key-wide {
    width: 65px;
    font-size: 12px;
}

.key.correct {
    background: var(--correct-color);
    color: white;
}

.key.present {
    background: var(--present-color);
    color: white;
}

.key.absent {
    background: var(--absent-color);
    color: white;
}

/* Modals */
.wordle-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.wordle-modal.show {
    display: block;
}

.modal-content {
    background: var(--text-secondary);
    margin: 5% auto;
    padding: 30px;
    border: 2px solid var(--secondary-color);
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
}

.close-modal {
    color: var(--tertiary-color);
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--secondary-color);
}

/* Examples in Help Modal */
.example {
    margin: 20px 0;
}

.example-row {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.example-tile {
    width: 40px;
    height: 40px;
    border: 2px solid var(--secondary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2em;
    background: var(--text-secondary);
    color: var(--text-primary);
}

.example-tile.correct {
    background: var(--correct-color);
    border-color: var(--correct-color);
    color: white;
}

.example-tile.present {
    background: var(--present-color);
    border-color: var(--present-color);
    color: white;
}

.example-tile.absent {
    background: var(--absent-color);
    border-color: var(--absent-color);
    color: white;
}

/* Buttons */
.wordle-btn {
    background: var(--secondary-color);
    color: var(--text-secondary);
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    margin: 5px;
    transition: all 0.3s ease;
}

.wordle-btn:hover {
    background: var(--tertiary-color);
    transform: scale(1.05);
}

/* Name Input */
.name-input-section {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(14, 93, 100, 0.1) 0%, rgba(154, 152, 139, 0.1) 100%);
    border-radius: 10px;
    border: 2px solid var(--secondary-color);
}

.congrats-message {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--correct-color);
    text-align: center;
    margin-bottom: 15px;
    animation: pulse 1s ease-in-out;
}

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

#leaderboard-status {
    margin: 15px 0;
    padding: 10px;
    text-align: center;
    font-weight: bold;
}

#leaderboard-status.qualified {
    color: var(--correct-color);
}

#leaderboard-status.not-qualified {
    color: var(--tertiary-color);
}

.name-input-section label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: bold;
}

.name-input-section input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--secondary-color);
    border-radius: 5px;
    font-size: 16px;
    margin-bottom: 15px;
    background: var(--text-secondary);
    color: var(--text-primary);
}

.name-input-section input:focus {
    outline: none;
    border-color: var(--tertiary-color);
}

/* Statistics */
#wordle-stats-content {
    text-align: center;
}

.stat-container {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: var(--secondary-color);
}

.stat-label {
    font-size: 0.9em;
    color: var(--tertiary-color);
}

.guess-distribution {
    margin: 20px 0;
}

.distribution-row {
    display: flex;
    align-items: center;
    margin: 5px 0;
}

.distribution-label {
    width: 20px;
    text-align: right;
    margin-right: 10px;
    font-weight: bold;
    color: var(--text-primary);
}

.distribution-bar {
    background: var(--secondary-color);
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 3px;
    min-width: 20px;
    text-align: right;
}

/* High Scores Table */
.scores-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.scores-table th,
.scores-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--secondary-color);
}

.scores-table th {
    background: var(--primary-color);
    color: var(--text-secondary);
}

.scores-table tr:nth-child(even) {
    background: rgba(14, 93, 100, 0.05);
}

/* Responsive Design */
@media (max-width: 600px) {
    .wordle-title {
        font-size: 1.2em;
    }
    
    .wordle-tile {
        width: 50px;
        height: 50px;
        font-size: 1.5em;
    }
    
    .key {
        width: 32px;
        height: 48px;
        font-size: 11px;
    }
    
    .key.key-wide {
        width: 50px;
    }
}

@media (max-width: 400px) {
    .wordle-title {
        font-size: 1em;
    }
    
    .wordle-tile {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
    
    .key {
        width: 26px;
        height: 40px;
        font-size: 10px;
    }
    
    .key.key-wide {
        width: 42px;
    }
}
