* {
    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-color: #f8f9fa;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

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

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    display: grid;
    gap: 30px;
}

section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

section h2 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.text-editor {
    min-height: 200px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    font-size: 16px;
    line-height: 1.6;
    background: #fff;
    transition: border-color 0.3s ease;
    outline: none;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    cursor: text;
}

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

.text-editor[contenteditable]:empty::before {
    content: attr(placeholder);
    color: #6c757d;
    font-style: italic;
}

.words-list {
    min-height: 100px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.word-item {
    display: inline-block;
    background: #e7f3ff;
    color: #0066cc;
    padding: 8px 12px;
    margin: 5px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #b3d9ff;
    position: relative;
}

.word-item .remove-btn {
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.word-item .remove-btn:hover {
    background: #ff3742;
}

.word-type {
    font-size: 12px;
    color: #6c757d;
    font-weight: normal;
    margin-left: 8px;
}

.text-output {
    min-height: 120px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 15px;
    white-space: normal;
    word-wrap: break-word;
}

.text-output h1, .text-editor h1 {
    font-size: 1.8em;
    font-weight: bold;
    margin: 0.5em 0;
    color: #333;
    display: block;
}

.text-output h2, .text-editor h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0.4em 0;
    color: #444;
    display: block;
}

.text-output h3, .text-editor h3 {
    font-size: 1.3em;
    font-weight: bold;
    margin: 0.3em 0;
    color: #555;
    display: block;
}

.text-output strong, .text-editor strong,
.text-output b, .text-editor b {
    font-weight: bold;
}

.text-output em, .text-editor em,
.text-output i, .text-editor i {
    font-style: italic;
}

.text-output ul, .text-editor ul {
    list-style-type: disc;
    margin: 1em 0;
    padding-left: 2em;
    display: block;
}

.text-output ol, .text-editor ol {
    list-style-type: decimal;
    margin: 1em 0;
    padding-left: 2em;
    display: block;
}

.text-output li, .text-editor li {
    margin: 0.2em 0;
    display: list-item;
}

.text-output p, .text-editor p {
    margin: 0.8em 0;
    display: block;
}

.text-output blockquote, .text-editor blockquote {
    border-left: 4px solid #ddd;
    margin: 1em 0;
    padding-left: 1em;
    color: #666;
    font-style: italic;
    display: block;
}

.text-output div, .text-editor div {
    display: block;
}

.text-output br, .text-editor br {
    display: block;
    margin: 0.5em 0;
    content: "";
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

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

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

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.empty-state {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

.info-box {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 1px solid #90caf9;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.4;
    color: #1565c0;
}

.selection-popup {
    position: fixed;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    padding: 0;
    z-index: 1000;
    display: none;
    min-width: 220px;
    overflow: hidden;
}

.popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.popup-main-options, .popup-gender-options {
    padding: 8px 0;
}

.popup-option {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #495057;
}

.popup-option:hover {
    background: #f8f9fa;
    color: #667eea;
}

.popup-option:active {
    background: #e9ecef;
}

.popup-back {
    padding: 8px 16px;
    font-size: 12px;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.popup-back:hover {
    background: #f8f9fa;
    color: #667eea;
}

.gender-title {
    padding: 12px 16px 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
}

.gender-option {
    font-size: 15px;
}

.highlighted-word {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 3px;
    padding: 1px 3px;
}

.anonymized-word {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 3px;
    padding: 1px 3px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    section {
        padding: 20px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}
