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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.lang-btn {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s;
}

.lang-btn:hover {
    background: #f0f4ff;
    transform: translateY(-2px);
}

.lang-btn.active {
    background: #667eea;
    color: white;
}

@media (max-width: 768px) {
    .language-selector {
        position: static;
        margin-bottom: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .lang-btn {
        padding: 8px 12px;
        font-size: 0.8em;
    }
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
        border-radius: 15px;
    }
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
        margin-bottom: 15px;
    }
}

.game-info {
    background: #f0f4ff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.game-info p {
    color: #555;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .game-info {
        padding: 15px;
        margin-bottom: 15px;
    }

    .game-info p {
        font-size: 0.9em;
    }
}

.rules {
    background: #fff9e6;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.rules h3 {
    color: #333;
    margin-bottom: 15px;
}

.rules ul {
    list-style: none;
    padding-left: 0;
}

.rules li {
    padding: 8px 0;
    color: #555;
}

.rules strong {
    color: #667eea;
}

@media (max-width: 768px) {
    .rules {
        padding: 15px;
        margin-bottom: 20px;
    }

    .rules h3 {
        font-size: 1.1em;
    }

    .rules li {
        font-size: 0.9em;
        padding: 6px 0;
    }
}

.input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .input-section {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 20px;
    }
}

#guessInput {
    flex: 1;
    padding: 15px;
    font-size: 1.2em;
    border: 2px solid #ddd;
    border-radius: 10px;
    text-align: center;
    letter-spacing: 10px;
}

#guessInput:focus {
    outline: none;
    border-color: #667eea;
}

@media (max-width: 768px) {
    #guessInput {
        width: 100%;
        padding: 16px;
        font-size: 1.3em;
        letter-spacing: 8px;
    }
}

button {
    padding: 15px 30px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 48px;
}

@media (max-width: 768px) {
    button {
        width: 100%;
        padding: 16px 20px;
        font-size: 1.1em;
        min-height: 52px;
    }
}

#submitBtn {
    background: #667eea;
    color: white;
}

#submitBtn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

#resetBtn {
    background: #ff6b6b;
    color: white;
}

#resetBtn:hover {
    background: #ee5555;
    transform: translateY(-2px);
}

.attempts {
    text-align: center;
    margin-bottom: 20px;
}

.attempts h3 {
    color: #333;
}

#attemptCount {
    color: #667eea;
    font-size: 1.3em;
}

@media (max-width: 768px) {
    .attempts h3 {
        font-size: 1.1em;
    }

    #attemptCount {
        font-size: 1.2em;
    }
}

.results {
    max-height: 400px;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .results {
        max-height: 300px;
    }
}

.result-item {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

@media (max-width: 768px) {
    .result-item {
        padding: 12px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

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

.result-guess {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    letter-spacing: 5px;
}

@media (max-width: 768px) {
    .result-guess {
        font-size: 1.2em;
        letter-spacing: 3px;
    }
}

.result-feedback {
    font-size: 1.1em;
    color: #667eea;
    font-weight: bold;
}

@media (max-width: 768px) {
    .result-feedback {
        font-size: 1em;
    }
}

.success {
    background: #d4edda;
    border: 2px solid #28a745;
}

.success .result-feedback {
    color: #28a745;
}

.game-over {
    background: #d4edda;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    margin-top: 20px;
    animation: celebrate 0.5s ease;
}

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

.game-over h2 {
    color: #28a745;
    font-size: 2em;
    margin-bottom: 10px;
}

.game-over p {
    color: #555;
    font-size: 1.2em;
}

@media (max-width: 768px) {
    .game-over {
        padding: 20px;
        margin-top: 15px;
    }

    .game-over h2 {
        font-size: 1.5em;
    }

    .game-over p {
        font-size: 1em;
    }
}

.share-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 1em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

@media (max-width: 768px) {
    .share-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 1.05em;
    }
}

.share-icon {
    font-size: 1.2em;
}

/* AdSense 광고 - 오른쪽 하단 */
.ad-container-bottom-right {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 336px;
}

/* 모바일에서는 하단 중앙에 배치 */
@media (max-width: 768px) {
    .ad-container-bottom-right {
        bottom: 5px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        max-width: calc(100% - 20px);
        padding: 8px;
    }
}

/* 작은 모바일 화면 추가 최적화 */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.5em;
    }

    .game-info p,
    .rules li {
        font-size: 0.85em;
    }

    #guessInput {
        font-size: 1.1em;
        padding: 14px;
    }

    button {
        font-size: 1em;
        padding: 14px 16px;
    }
}
