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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.input-section {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.phone-input-container label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: #555;
    font-size: 1.1rem;
}

.input-group {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

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

.country-prefix {
    background: #f8f9fa;
    padding: 16px 20px;
    font-weight: 600;
    color: #666;
    border-right: 1px solid #e1e5e9;
}

#phoneInput {
    flex: 1;
    padding: 16px 20px;
    border: none;
    outline: none;
    font-size: 1.1rem;
    font-family: 'Monaco', 'Menlo', monospace;
    letter-spacing: 1px;
}

#phoneInput::placeholder {
    color: #999;
    font-family: inherit;
}

.button-group {
    display: flex;
    gap: 12px;
}

button {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.primary {
    background: #667eea;
    color: white;
}

.primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

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

.reference-section {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
}

.reference-section h3 {
    margin-bottom: 25px;
    color: #333;
    font-size: 1.3rem;
}

.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 25px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.key {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.key:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.key .digit {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.key .letters {
    display: block;
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    letter-spacing: 2px;
}

.phone-icon {
    font-size: 3rem;
    opacity: 0.6;
}

.results-section {
    grid-column: 1 / -1;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 30px;
    margin-top: 20px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
    font-size: 1.1rem;
}

.error {
    text-align: center;
    padding: 40px;
    color: #e53e3e;
    background: #fed7d7;
    border-radius: 12px;
    margin: 20px 0;
}

.hidden {
    display: none;
}

.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.result-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.result-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.result-rank {
    font-size: 0.9rem;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 8px;
}

.result-words {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
    font-family: 'Monaco', 'Menlo', monospace;
}

.result-mapping {
    font-size: 0.9rem;
    color: #666;
    font-family: 'Monaco', 'Menlo', monospace;
}

.no-results {
    text-align: center;
    padding: 60px;
    color: #666;
}

.no-results h3 {
    margin-bottom: 12px;
    color: #333;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .input-section,
    .reference-section {
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .keypad-grid {
        max-width: 250px;
        gap: 8px;
    }
    
    .key {
        padding: 12px 8px;
    }
    
    .key .digit {
        font-size: 1.2rem;
    }
    
    .key .letters {
        font-size: 0.8rem;
    }
    
    .results-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}