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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 30px 0;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

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

main {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.input-section {
    margin-bottom: 40px;
}

.input-section h2 {
    margin-bottom: 20px;
    color: #4a5568;
}

#textInput {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1em;
    resize: vertical;
    transition: border-color 0.3s;
}

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

.generate-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

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

.generate-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

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

.results-section {
    display: none;
    margin-bottom: 40px;
}

.results-section.active {
    display: block;
}

.results-section h2 {
    margin-bottom: 20px;
    color: #4a5568;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.emoji-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: #f7fafc;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

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

.emoji-item.selected {
    background: #e9d8fd;
    border-color: #764ba2;
}

.emoji-char {
    font-size: 2.5em;
    margin-bottom: 8px;
}

.emoji-label {
    font-size: 0.85em;
    color: #718096;
    text-align: center;
}

.emoji-score {
    font-size: 0.75em;
    color: #a0aec0;
    margin-top: 4px;
}

.emotion-analysis {
    margin-bottom: 30px;
}

.emotion-analysis h3 {
    margin-bottom: 15px;
    color: #4a5568;
}

.emotion-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.emotion-bar {
    display: flex;
    align-items: center;
    gap: 15px;
}

.emotion-label {
    min-width: 100px;
    font-size: 0.9em;
    color: #4a5568;
}

.emotion-progress {
    flex: 1;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.emotion-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.6s ease;
}

.emotion-value {
    min-width: 50px;
    text-align: right;
    font-size: 0.9em;
    color: #718096;
}

.quick-copy h3 {
    margin-bottom: 15px;
    color: #4a5568;
}

.copy-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.copy-btn {
    padding: 10px 20px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95em;
    color: #4a5568;
}

.copy-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.copy-btn.copied {
    background: #c6f6d5;
    border-color: #9ae6b4;
    color: #276749;
}

.presets-section {
    margin-bottom: 40px;
}

.presets-section h2 {
    margin-bottom: 20px;
    color: #4a5568;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.preset-btn {
    padding: 15px 20px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    font-size: 0.95em;
    color: #4a5568;
}

.preset-btn:hover {
    background: #edf2f7;
    border-color: #667eea;
    transform: translateY(-2px);
}

.history-section h2 {
    margin-bottom: 20px;
    color: #4a5568;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.history-item {
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.history-item:hover {
    background: #edf2f7;
}

.history-text {
    font-size: 0.9em;
    color: #4a5568;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-emojis {
    font-size: 1.2em;
}

.history-time {
    font-size: 0.75em;
    color: #a0aec0;
    margin-top: 5px;
}

.clear-btn {
    padding: 10px 20px;
    background: #fc8181;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
}

.clear-btn:hover {
    background: #f56565;
}

footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    padding: 20px 0;
    font-size: 0.9em;
    opacity: 0.8;
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    background: #48bb78;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .preset-grid {
        grid-template-columns: 1fr;
    }
    
    .copy-options {
        flex-direction: column;
    }
    
    .copy-btn {
        width: 100%;
    }
}