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

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

.container {
    max-width: 1140px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
}

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

h1 {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 8px;
}

.subtitle {
    color: #666;
    font-size: 1rem;
}

.settings-panel {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-group label {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

.setting-group select,
.setting-group input[type="range"] {
    width: 100%;
}

.setting-group select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.editor-container {
    position: relative;
    margin-bottom: 20px;
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

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

.action-btn.primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.action-btn.secondary {
    background: #764ba2;
    color: white;
}

.action-btn.secondary:hover {
    background: #63408a;
    transform: translateY(-2px);
}

.action-btn:not(.primary):not(.secondary) {
    background: #e9ecef;
    color: #495057;
}

.action-btn:not(.primary):not(.secondary):hover {
    background: #dee2e6;
}

#text-editor {
    width: 100%;
    min-height: 300px;
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}

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

.floating-toolbar {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 5px;
    display: flex;
    gap: 5px;
    z-index: 1000;
}

.floating-toolbar button {
    padding: 8px 16px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.floating-toolbar button:hover {
    background: #5568d3;
}

.context-menu {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
}

.menu-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background: #f8f9fa;
}

.menu-item:first-child {
    border-radius: 8px 8px 0 0;
}

.menu-item:last-child {
    border-radius: 0 0 8px 8px;
}

.result-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

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

.result-header h3 {
    color: #333;
}

.result-actions {
    display: flex;
    gap: 10px;
}

.copy-btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.copy-btn:hover {
    background: #5568d3;
}

.result-text {
    background: white;
    padding: 20px;
    border-radius: 8px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.token-info {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.error {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #fcc;
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2rem;
    }

    .settings-panel {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }
}
