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

:root {
    --primary-color: #0052cc;
    --primary-hover: #0747a6;
    --secondary-color: #6b778c;
    --success-color: #00875a;
    --danger-color: #de350b;
    --background: #ffffff;
    --surface: #f4f5f7;
    --border: #dfe1e6;
    --text-primary: #172b4d;
    --text-secondary: #5e6c84;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius: 6px;
    --radius-lg: 12px;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
    position: relative;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 400;
}

.lang-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
}

.lang-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
}

.main-content {
    padding: 40px 30px;
}

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

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

.section-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.template-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.template-select:hover {
    border-color: var(--primary-color);
}

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

.code-input {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s;
    background: var(--surface);
}

.code-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--background);
}

.editor-toolbar {
    position: absolute;
    bottom: 10px;
    right: 15px;
    background: var(--background);
    padding: 4px 8px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.char-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.options {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-primary);
}

.option-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.output-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 40px;
}

.output-section h2 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--text-primary);
}

.bookmarklet-info {
    margin-bottom: 25px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.name-input {
    flex: 1;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.bookmarklet-container {
    margin-bottom: 25px;
}

.drag-area {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
}

.bookmarklet-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 15px 30px;
    background: white;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
    cursor: move;
}

.bookmarklet-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.bookmarklet-link .icon {
    font-size: 1.5rem;
}

.drag-hint {
    color: white;
    margin-top: 15px;
    font-size: 0.95rem;
    opacity: 0.95;
}

.code-output {
    margin-bottom: 20px;
}

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

.output-header span {
    font-weight: 500;
    color: var(--text-secondary);
}

.copy-btn {
    padding: 6px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--primary-hover);
}

.copy-btn.success {
    background: var(--success-color);
}

.code-display {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    background: var(--background);
    resize: vertical;
    word-break: break-all;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    padding: 20px;
    background: var(--background);
    border-radius: var(--radius);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-item span:not(.stat-label) {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.instructions {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 30px;
}

.instructions h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.steps {
    list-style: none;
    counter-reset: step-counter;
}

.steps li {
    position: relative;
    padding-left: 50px;
    margin-bottom: 20px;
    counter-increment: step-counter;
    color: var(--text-primary);
}

.steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.footer {
    background: var(--surface);
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .container {
        border-radius: 0;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .lang-selector {
        position: static;
        justify-content: center;
        margin-top: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .template-select {
        width: 100%;
    }
    
    .options {
        flex-direction: column;
        gap: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
}