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

body {
    font-family: 'Noto Sans', sans-serif;
    background: white;
    color: #333;
    line-height: 1.6;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

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

.header h1 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #1a1a1a;
}

.subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 0;
}

.main {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.generator-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.generator-section h2 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.generate-btn {
    background: #1a1a1a;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.generate-btn:hover {
    background: #333;
    transform: translateY(-1px);
}

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

.language-display {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    animation: fadeIn 0.5s ease;
}

.language-display h2 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: #1a1a1a;
}

.language-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.detail-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.detail-section h3 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #1a1a1a;
}

.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
    margin-bottom: 15px;
}

.alphabet-item {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    font-family: 'Space Mono', monospace;
    font-size: 18px;
    border: 1px solid #e9ecef;
}

.phonetic {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.grammar-rules {
    list-style: none;
}

.grammar-rules li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.grammar-rules li:last-child {
    border-bottom: none;
}

.phonetic-rules {
    list-style: none;
}

.phonetic-rules li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.phonetic-rules li:last-child {
    border-bottom: none;
}

.phonetic-display {
    margin-top: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: #666;
}

.phonetic-text {
    font-style: italic;
}

.vocabulary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.vocab-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.vocab-word {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: #1a1a1a;
}

.vocab-translation {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.translator-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    animation: fadeIn 0.5s ease;
}

.translator-section h2 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.translator-container {
    width: 100%;
}

.translation-panel {
    background: white;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.panel-header label {
    font-weight: 500;
    color: #333;
}

.swap-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
}

.swap-btn:hover {
    background: #e9ecef;
}

.text-areas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.text-area-container {
    position: relative;
}

.text-area-container textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.text-area-container textarea:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.translate-btn,
.copy-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: #1a1a1a;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.translate-btn:hover,
.copy-btn:hover {
    background: #333;
}

.text-area-buttons {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.speak-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.speak-btn:hover {
    background: #357abd;
}

.saved-languages {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.saved-languages h2 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.language-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.language-card-content {
    flex: 1;
}

.language-card-content h3 {
    font-family: 'Cal Sans', sans-serif;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.language-card-content p {
    color: #666;
    font-size: 14px;
}

.save-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.save-btn:hover {
    background: #357abd;
    transform: translateY(-1px);
}

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

.delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1a1a1a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-overlay p {
    font-size: 18px;
    color: #666;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@media (max-width: 768px) {
    .text-areas {
        grid-template-columns: 1fr;
    }
    
    .language-details {
        grid-template-columns: 1fr;
    }
    
    .panel-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .app {
        padding: 15px;
    }

    .text-area-buttons {
        position: static;
        margin-top: 10px;
        justify-content: flex-end;
    }
}

.language-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.add-vocab-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-vocab-btn:hover {
    background: #357abd;
    transform: translateY(-1px);
}

.add-vocab-btn:active {
    transform: translateY(0);
}

.cipher-section {
    background: #f0f8ff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #b8e0ff;
}

.cipher-section h2 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.cipher-display {
    background: #f0f8ff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #b8e0ff;
    animation: fadeIn 0.5s ease;
}

.cipher-display h2 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: #1a1a1a;
}

.cipher-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.cipher-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.cipher-translator-section {
    background: #f0f8ff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #b8e0ff;
    animation: fadeIn 0.5s ease;
}

.cipher-translator-section h2 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.saved-ciphers {
    background: #f0f8ff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #b8e0ff;
}

.saved-ciphers h2 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.cipher-mapping {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-bottom: 15px;
}

.cipher-mapping-item {
    background: #e6f3ff;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    border: 1px solid #b8e0ff;
}

.cipher-mapping-item .original {
    font-weight: bold;
    color: #1a1a1a;
}

.cipher-mapping-item .arrow {
    color: #666;
    margin: 2px 0;
}

.cipher-mapping-item .cipher {
    color: #4a90e2;
    font-weight: bold;
}