/* Wordle (Kelime Oyunu) Stylesheet */

.wordle-page-main {
    max-width: 800px;
    margin: 30px auto;
    padding: 0 15px;
}

.wordle-header-wrap {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
}

.wordle-header-wrap .red-bar {
    display: block;
    width: 60px;
    height: 4px;
    background-color: var(--primary-red);
    margin: 0 auto 10px auto;
}

.wordle-header-wrap h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0 0 5px 0;
    letter-spacing: 1px;
}

.wordle-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0;
}

.wordle-game-container {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Top bar (help, modes, stats) */
.wordle-top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.wordle-icon-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wordle-icon-btn:hover {
    background-color: var(--bg-color);
    color: var(--primary-red);
}

.wordle-mode-selector {
    display: flex;
    background-color: var(--bg-color);
    padding: 4px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.mode-btn {
    background: none;
    border: none;
    padding: 6px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.mode-btn.active {
    background-color: var(--surface-color);
    color: var(--primary-red);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Toast Container */
.wordle-toast-container {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.wordle-toast {
    background-color: #111827;
    color: #f9fafb;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wordle-toast.show {
    opacity: 1;
    transform: scale(1);
}

body.dark-mode .wordle-toast {
    background-color: #f9fafb;
    color: #111827;
}

/* Board Grid */
.wordle-board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    width: 330px;
    max-width: 100%;
    aspect-ratio: 5 / 6;
    margin: 10px 0;
}

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

.tile {
    width: 100%;
    height: 100%;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    font-weight: bold;
    text-transform: uppercase;
    user-select: none;
    color: var(--text-main);
    background-color: transparent;
    transition: background-color 0.5s ease, border-color 0.5s ease, color 0.5s ease;
}

/* Tile state styles */
.tile.t-active {
    border-color: #878a8c;
    animation: tilePop 0.1s ease-out;
}

body.dark-mode .tile.t-active {
    border-color: #d7dadc;
}

.tile.correct {
    background-color: #6aaa64 !important;
    border-color: #6aaa64 !important;
    color: #ffffff !important;
}

.tile.present {
    background-color: #c9b458 !important;
    border-color: #c9b458 !important;
    color: #ffffff !important;
}

.tile.absent {
    background-color: #787c7e !important;
    border-color: #787c7e !important;
    color: #ffffff !important;
}

body.dark-mode .tile.correct {
    background-color: #538d4e !important;
    border-color: #538d4e !important;
}

body.dark-mode .tile.present {
    background-color: #b59f3b !important;
    border-color: #b59f3b !important;
}

body.dark-mode .tile.absent {
    background-color: #3a3a3c !important;
    border-color: #3a3a3c !important;
}

/* Animations */
@keyframes tilePop {
    0% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

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

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

.tile.flip {
    animation: flipIn 0.5s ease-in-out forwards;
}

@keyframes flipIn {
    0% { transform: rotateX(0deg); }
    45% { transform: rotateX(90deg); }
    55% { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}

/* Keyboard */
.wordle-keyboard {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

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

.key {
    background-color: #d3d6da;
    color: #1a1a1a;
    border: none;
    border-radius: 4px;
    padding: 0;
    height: 58px;
    flex: 1;
    font-size: 1.1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    text-transform: uppercase;
    transition: background-color 0.2s ease, transform 0.05s ease;
}

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

.key.wide-key {
    flex: 1.5;
    font-size: 0.85rem;
}

body.dark-mode .key {
    background-color: #818384;
    color: #ffffff;
}

/* Key Color States */
.key.correct {
    background-color: #6aaa64 !important;
    color: #ffffff !important;
}

.key.present {
    background-color: #c9b458 !important;
    color: #ffffff !important;
}

.key.absent {
    background-color: #787c7e !important;
    color: #ffffff !important;
}

body.dark-mode .key.correct {
    background-color: #538d4e !important;
}

body.dark-mode .key.present {
    background-color: #b59f3b !important;
}

body.dark-mode .key.absent {
    background-color: #3a3a3c !important;
}

/* Modal Overlay */
.wordle-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.wordle-modal.show {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.wordle-modal-content {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
    animation: scaleUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--text-main);
}

@keyframes scaleUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

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

.wordle-modal h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.wordle-modal h3 {
    font-size: 1.1rem;
    margin-top: 20px;
    margin-bottom: 10px;
}

.wordle-modal ul {
    padding-left: 20px;
    margin-bottom: 20px;
}

.wordle-modal li {
    margin-bottom: 8px;
    line-height: 1.4;
}

/* Examples inside Help Modal */
.help-example {
    margin-bottom: 15px;
}

.help-example .example-row {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
    height: 40px;
}

.help-example .tile {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
}

.help-example p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Stats Modal details */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    text-align: center;
    margin-bottom: 25px;
}

.stat-box {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 3px;
    letter-spacing: 0.5px;
}

/* Guess Distribution */
.dist-title {
    text-align: center;
    margin-bottom: 15px;
}

.guess-distribution {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 25px;
}

.dist-row {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: bold;
}

.dist-number {
    width: 20px;
}

.dist-bar-wrap {
    flex: 1;
    margin-left: 8px;
}

.dist-bar {
    background-color: #878a8c;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 3px;
    text-align: right;
    min-width: 24px;
    box-sizing: border-box;
}

.dist-row.highlight .dist-bar {
    background-color: #6aaa64;
}

body.dark-mode .dist-row.highlight .dist-bar {
    background-color: #538d4e;
}

body.dark-mode .dist-bar {
    background-color: #565758;
}

/* Game over actions (next word) */
.game-over-actions {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    margin-top: 15px;
}

.next-word-wrap {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

#daily-countdown-wrap {
    text-align: center;
}

#daily-countdown-wrap span {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
}

.daily-timer {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: monospace;
}

.btn-primary-game {
    background-color: #6aaa64;
    color: #ffffff;
    border: none;
    border-radius: 30px;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(106, 170, 100, 0.3);
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.btn-primary-game:hover {
    background-color: #5f995a;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(106, 170, 100, 0.4);
}

.btn-primary-game:active {
    transform: translateY(0);
}

body.dark-mode .btn-primary-game {
    background-color: #538d4e;
    box-shadow: 0 4px 10px rgba(83, 141, 78, 0.3);
}

body.dark-mode .btn-primary-game:hover {
    background-color: #4a7e46;
    box-shadow: 0 6px 14px rgba(83, 141, 78, 0.4);
}

/* Responsive adjustment for small screens */
@media (max-width: 480px) {
    .wordle-board {
        width: 100%;
        max-width: 290px;
    }
    
    .tile {
        font-size: 1.4rem;
        border-width: 1.5px;
    }
    
    .key {
        height: 52px;
        font-size: 0.95rem;
    }
    
    .key.wide-key {
        font-size: 0.75rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .wordle-top-bar {
        padding-bottom: 10px;
    }
}
