* {
    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;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 800px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

.custom-text-container {
    margin-top: 40px;
    margin-bottom: 25px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 20px;
    border: 1px solid #dee2e6;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.custom-text-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
}

.custom-text-container label {
    display: block;
    margin-bottom: 15px;
    color: #495057;
    font-weight: 700;
    font-size: 1.1rem;
    position: relative;
    padding-left: 20px;
}

.custom-text-container label::before {
    content: "✏️";
    position: absolute;
    left: 0;
    top: 0;
}

#custom-text-input {
    width: 100%;
    padding: 18px;
    font-size: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: vertical;
    min-height: 90px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    background: white;
    line-height: 1.6;
}

#custom-text-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

#custom-text-input::placeholder {
    color: #adb5bd;
    font-style: italic;
}

#apply-custom-text {
    padding: 12px 25px;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

#apply-custom-text:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

#apply-custom-text:active {
    transform: translateY(0);
}

.stats-container {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.text-container {
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
    min-height: 80px;
    display: flex;
    align-items: flex-start;
}

.target-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #333;
    font-family: 'Courier New', monospace;
    user-select: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.target-text span {
    display: inline;
    box-sizing: border-box;
    vertical-align: baseline;
}

.target-text .correct {
    background-color: #d4edda;
    color: #155724;
    border-radius: 2px;
}

.target-text .incorrect {
    background-color: #f8d7da;
    color: #721c24;
    border-radius: 2px;
}

.target-text .current {
    background-color: #667eea;
    color: white;
    animation: blink 1s infinite;
    border-radius: 2px;
    box-shadow: 0 0 0 1px #667eea;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.input-container {
    margin-bottom: 25px;
}

#typing-input {
    width: 100%;
    padding: 20px;
    font-size: 1.1rem;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.3s ease;
}

#typing-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#typing-input:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn.secondary {
    background: #6c757d;
    color: white;
}

.btn.secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn.kakao {
    background: #FEE500;
    color: #3C1E1E;
    border: 1px solid #FEE500;
}

.btn.kakao:hover {
    background: #FAD400;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(254, 229, 0, 0.3);
}

.btn.facebook {
    background: #1877F2;
    color: white;
    border: 1px solid #1877F2;
}

.btn.facebook:hover {
    background: #166FE5;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(24, 119, 242, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.result-container {
    margin-top: 30px;
    padding: 30px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-radius: 15px;
    color: white;
    text-align: center;
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-container h2 {
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.final-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

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

.final-stat .label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.final-stat .value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
}

/* 언어 선택 버튼 스타일 */
#language-selector {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#language-selector button {
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #374151;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#language-selector button:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

#language-selector button.active {
    background: #667eea !important;
    color: white !important;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    #language-selector {
        position: fixed;
        top: 10px;
        right: 10px;
        padding: 6px;
        gap: 3px;
        transform: scale(0.9);
        transform-origin: top right;
    }
    
    #language-selector button {
        padding: 4px 6px;
        font-size: 10px;
        min-width: auto;
    }
    
    .container {
        padding: 15px;
        margin: 5px 0;
        margin-top: 60px; /* 언어 선택 버튼 공간 확보 */
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .text-container {
        padding: 20px 15px;
        min-height: 70px;
    }
    
    .target-text {
        font-size: 1.1rem;
        line-height: 1.7;
    }
    
    .stats-container {
        flex-direction: row;
        gap: 8px;
        padding: 15px 10px;
        justify-content: space-between;
    }
    
    .stat {
        padding: 8px 4px;
        flex: 1;
        min-width: 0;
    }
    
    .stat-value {
        font-size: 1.4rem;
        white-space: nowrap;
    }
    
    .stat-label {
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .final-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 200px;
    }

    .custom-text-container {
        margin-top: 30px;
        padding: 20px;
    }

    .custom-text-container label {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    #custom-text-input {
        min-height: 70px;
        padding: 15px;
    }

    #apply-custom-text {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
        display: block;
    }

    .share-buttons {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .btn.kakao,
    .btn.facebook {
        width: 100%;
        max-width: 200px;
    }
}

/* 매우 작은 화면 (아이폰 SE 등) */
@media (max-width: 480px) {
    #language-selector {
        top: 8px;
        right: 8px;
        transform: scale(0.8);
    }
    
    #language-selector button {
        padding: 3px 5px;
        font-size: 9px;
    }
    
    .container {
        margin-top: 50px;
        padding: 12px;
    }
    
    .stats-container {
        gap: 5px;
        padding: 12px 8px;
    }
    
    .stat {
        padding: 6px 2px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    header h1 {
        font-size: 1.6rem;
    }
} 