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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.compact-header {
    text-align: center;
    color: white;
    margin-bottom: 1.5rem;
    padding: 1rem;
}

.compact-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.content {
    display: grid;
    grid-template-columns: minmax(450px, 1fr) minmax(400px, 1fr);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1200px) {
    .content {
        grid-template-columns: 1fr;
    }
}

.form-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-left: 4px solid var(--primary-color);
    position: relative;
}

.form-container::before {
    content: "左侧";
    position: absolute;
    top: -10px;
    left: 20px;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.output-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #10b981;
    position: relative;
}

@media (min-width: 1201px) {
    .output-container {
        position: sticky;
        top: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
}

.output-container::before {
    content: "右侧";
    position: absolute;
    top: -10px;
    left: 20px;
    background: #10b981;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

@media (max-width: 1200px) {
    .form-container::before,
    .output-container::before {
        display: none;
    }
}

h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-container h2::before {
    content: "⚙️";
    font-size: 1.5rem;
}

.output-container h2::before {
    content: "📄";
    font-size: 1.5rem;
}

h3 {
    font-size: 1.1rem;
    margin: 1rem 0 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.collapsible-section h3:hover {
    color: var(--primary-color);
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    margin-right: 0.5rem;
}

.toggle-icon.rotated {
    transform: rotate(-90deg);
}

.form-group {
    margin-bottom: 1rem;
}

.compact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.compact-item {
    display: flex;
    flex-direction: column;
}

.compact-item label {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compact-item input[type="range"] {
    flex: 1;
    min-width: 80px;
}

.section-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-section {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input[type="range"] {
    width: calc(100% - 60px);
    margin-right: 10px;
    vertical-align: middle;
}

.priority-value {
    display: inline-block;
    width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.simple-limit-section {
    background: linear-gradient(135deg, #fff5e6 0%, #ffe6cc 100%);
    padding: 1rem;
    border-radius: 8px;
    margin: 0 0 1rem 0;
    border: 2px solid #ff9800;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.15);
}

.simple-limit-section h3 {
    color: #e65100;
    margin: 0;
    font-size: 1.1rem;
    cursor: pointer;
    user-select: none;
    padding: 0.25rem 0;
    border-bottom: none;
}

.simple-limit-section h3:hover {
    color: #bf360c;
}

.simple-limit-section .section-content {
    margin-top: 0.75rem;
}

.section-desc {
    color: #f57c00;
    margin: 0 0 0.75rem 0;
    font-size: 0.85rem;
}

.simple-limit-section textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ff9800;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Monaco', 'Menlo', monospace;
    transition: all 0.3s ease;
    resize: vertical;
}

.simple-limit-section textarea:focus {
    outline: none;
    border-color: #e65100;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
}

.quick-examples {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
}

.btn-example {
    padding: 0.4rem 0.8rem;
    margin: 0.25rem;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-example:hover {
    background: #f57c00;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.simple-limit-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-generate-simple {
    padding: 0.6rem 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-generate-simple:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

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

.simple-output {
    margin-top: 1rem;
    background: #fff;
    border: 2px solid #10b981;
    border-radius: 8px;
    padding: 1rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.simple-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.simple-output-header strong {
    color: #059669;
    font-size: 0.95rem;
}

.btn-copy-simple {
    padding: 0.4rem 1rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-copy-simple:hover {
    background: #059669;
    transform: translateY(-1px);
}

.simple-output-code {
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #1e293b;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
}

.priority-section {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
}

.compact-checkboxes {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.compact-checkboxes h3 {
    margin: 0 0 0.75rem 0;
}

.checkbox-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}

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

.pcq-section-compact {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 2px solid #0ea5e9;
}

.pcq-section-compact h3 {
    margin: 0 0 0.5rem 0;
}

.pcq-config-compact {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #cbd5e1;
}

.inline-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.inline-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

.inline-group select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.inline-group input[type="number"] {
    padding: 0.4rem;
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
}

.inline-group input[type="text"] {
    padding: 0.4rem;
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    font-size: 0.9rem;
}

.pcq-generate-actions {
    margin-top: 1rem;
    text-align: center;
}

.btn-generate-pcq {
    padding: 0.6rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-generate-pcq:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

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

.pcq-output {
    margin-top: 1rem;
    background: #fff;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    padding: 1rem;
    animation: slideDown 0.3s ease;
}

.pcq-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.pcq-output-header strong {
    color: #2563eb;
}

.btn-copy-pcq {
    padding: 0.4rem 1rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-copy-pcq:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.pcq-output-code {
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #1e293b;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
}

.checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    cursor: pointer;
}

.btn-generate {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

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

.output-header h2 {
    margin-bottom: 0;
    border-bottom: none;
}

.output-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-send-telegram {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #0088cc 0%, #006699 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-send-telegram:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

.btn-send-telegram:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-send-telegram svg {
    flex-shrink: 0;
}

.btn-copy {
    padding: 0.5rem 1rem;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
}

.btn-copy:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.output-code {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    max-height: calc(100vh - 280px);
    min-height: 300px;
    overflow-y: auto;
    margin: 1rem 0;
    border: 1px solid #334155;
}

.output-code::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.output-code::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 4px;
}

.output-code::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.output-code::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.info-box {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.info-box h3 {
    margin-top: 0;
    font-size: 1rem;
}

.info-box ol,
.info-box ul {
    margin-left: 1.5rem;
    color: var(--text-secondary);
}

.info-box li {
    margin-bottom: 0.5rem;
}

.success-message {
    background: #d1fae5;
    color: #065f46;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--success-color);
    display: none;
}

.success-message.show {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

