/* Friends Wordle CSS */
:root {
    --friends-orange: #ff6b35;
    --friends-purple: #8b5a96;
    --friends-yellow: #ffd23f;
    --friends-cream: #f4f1de;
    --friends-brown: #8b4513;
    --friends-green: #90c695;
    --correct-color: #6aaa64;
    --present-color: #c9b458;
    --absent-color: #787c7e;
    --key-bg: #d3d6da;
    --key-bg-light: #f6f7f8;
    --border-color: #d3d6da;
    --text-color: #1a1a1b;
    --bg-color: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--friends-cream) 0%, #fff 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.container {
    max-width: 500px;
    width: 100%;
    background: var(--bg-color);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 20px;
    border: 2px solid var(--friends-orange);
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--friends-purple);
}

header h1 {
    font-size: 3rem;
    font-weight: bold;
    font-family: 'Arial Black', Arial, sans-serif;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
    position: relative;
    text-shadow: 3px 3px 0px #000;
}

.friends-title {
    display: inline-block;
    position: relative;
}

.friends-title .letter {
    display: inline-block;
    position: relative;
    margin: 0 2px;
}

.friends-title .letter.f { color: #ff6b35; }
.friends-title .letter.r { color: #ffd23f; }
.friends-title .letter.i { color: #90c695; }
.friends-title .letter.e { color: #ff6b35; }
.friends-title .letter.n { color: #8b5a96; }
.friends-title .letter.d { color: #ff6b35; }
.friends-title .letter.s { color: #ffd23f; }

.friends-title .letter.w { color: #90c695; }
.friends-title .letter.o { color: #8b5a96; }
.friends-title .letter.r2 { color: #ff6b35; }
.friends-title .letter.d2 { color: #ffd23f; }
.friends-title .letter.l { color: #90c695; }
.friends-title .letter.e2 { color: #8b5a96; }

.friends-title .letter::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
}

.friends-title .letter.f::after { background-color: #ffd23f; }
.friends-title .letter.r::after { background-color: #90c695; }
.friends-title .letter.i::after { background-color: #ff6b35; }
.friends-title .letter.e::after { background-color: #8b5a96; }
.friends-title .letter.n::after { background-color: #ffd23f; }
.friends-title .letter.d::after { background-color: #90c695; }
.friends-title .letter.s::after { background-color: #ff6b35; }

.friends-title .letter.w::after { background-color: #8b5a96; }
.friends-title .letter.o::after { background-color: #ffd23f; }
.friends-title .letter.r2::after { background-color: #90c695; }
.friends-title .letter.d2::after { background-color: #8b5a96; }
.friends-title .letter.l::after { background-color: #ff6b35; }
.friends-title .letter.e2::after { background-color: #ffd23f; }

.subtitle {
    font-size: 1rem;
    color: var(--friends-brown);
    font-style: italic;
}

/* Difficulty Selector Styles */
.difficulty-selector {
    text-align: center;
    margin-bottom: 30px;
}

.difficulty-selector h2 {
    color: var(--friends-purple);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.difficulty-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.difficulty-option {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.difficulty-option:hover {
    border-color: var(--friends-orange);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.difficulty-option.selected {
    border-color: var(--friends-purple);
    background: var(--friends-cream);
}

.difficulty-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 1.5rem;
}

.difficulty-option h3 {
    color: var(--friends-purple);
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.difficulty-option p {
    color: var(--friends-brown);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.difficulty-details {
    font-size: 0.8rem;
    color: var(--friends-orange);
    font-weight: bold;
}

/* Current Difficulty Display */
.current-difficulty {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.difficulty-badge {
    background: var(--friends-purple);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.difficulty-badge.easy { background: #90c695; }
.difficulty-badge.medium { background: #ffd23f; color: var(--friends-brown); }
.difficulty-badge.hard { background: #ff6b35; }
.difficulty-badge.expert { background: #8b5a96; }

.hints-remaining {
    background: var(--friends-yellow);
    color: var(--friends-brown);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
}

.timer {
    background: var(--friends-orange);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
}

.timer.warning {
    background: #d9534f;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
    min-width: 50px;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--friends-purple);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--friends-brown);
    text-transform: uppercase;
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: var(--friends-orange);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn:hover {
    background: var(--friends-purple);
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--friends-purple);
}

.btn-primary:hover {
    background: var(--friends-orange);
}

.game-container {
    margin-bottom: 20px;
}

.game-grid {
    display: grid;
    gap: 5px;
    margin: 0 auto 20px;
    justify-content: center;
}

.grid-row {
    display: contents;
}

.tile {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    background: var(--bg-color);
    transition: all 0.3s ease;
    border-radius: 4px;
}

.tile.filled {
    border-color: var(--friends-brown);
    background: var(--friends-cream);
}

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

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

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

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

.message {
    text-align: center;
    font-weight: bold;
    min-height: 24px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.message.success {
    background: var(--friends-green);
    color: white;
}

.message.error {
    background: var(--friends-orange);
    color: white;
}

.message.info {
    background: var(--friends-yellow);
    color: var(--friends-brown);
}

.keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

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

.key {
    min-width: 35px;
    height: 45px;
    border: none;
    border-radius: 6px;
    background: var(--key-bg);
    color: var(--text-color);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.key:hover {
    background: var(--friends-cream);
    transform: scale(1.05);
}

.key-large {
    min-width: 60px;
    font-size: 0.8rem;
}

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

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

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

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--bg-color);
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    border: 3px solid var(--friends-orange);
    animation: slideIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    color: var(--friends-brown);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 15px;
}

.close:hover {
    color: var(--friends-orange);
}

.modal h2 {
    color: var(--friends-purple);
    margin-bottom: 20px;
    text-align: center;
}

.stats-detail {
    margin-bottom: 20px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.guess-distribution h3 {
    color: var(--friends-brown);
    margin-bottom: 15px;
}

.distribution-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.distribution-label {
    width: 20px;
    text-align: center;
    font-weight: bold;
}

.distribution-fill {
    background: var(--friends-orange);
    height: 20px;
    margin-left: 10px;
    border-radius: 4px;
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

#storyContent {
    background: var(--friends-cream);
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
    border-left: 4px solid var(--friends-purple);
    line-height: 1.6;
}

#storyContent h3 {
    color: var(--friends-orange);
    margin-bottom: 10px;
}

#storyContent p {
    margin-bottom: 10px;
}

.story-quote {
    font-style: italic;
    color: var(--friends-brown);
    background: white;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 3px solid var(--friends-yellow);
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 15px;
        margin: 5px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .stats {
        justify-content: center;
    }
    
    .tile {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .key {
        min-width: 30px;
        height: 40px;
        font-size: 0.8rem;
    }
    
    .key-large {
        min-width: 50px;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 20px;
    }
}

@media (max-width: 400px) {
    .tile {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .key {
        min-width: 28px;
        height: 38px;
    }
}
