* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
    color: #e2e8f0;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Site Header */
.site-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.logo {
    font-size: 2.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 2.5rem;
}

.logo-text {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text .highlight {
    font-weight: 700;
}

.tagline {
    color: #94a3b8;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.panel {
    background: rgba(30, 41, 59, 0.8);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    padding: 24px;
    backdrop-filter: blur(10px);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.panel-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.config-panel .panel-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
}

.preview-panel .panel-icon {
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

.btn-template,
.btn-import,
.btn-validate {
    padding: 6px 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-template:hover,
.btn-import:hover,
.btn-validate:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: #60a5fa;
    color: #60a5fa;
}

.btn-validate.valid {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #10b981;
}

.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    color: #cbd5e1;
    margin-bottom: 6px;
}

.help-text {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    color: #f1f5f9;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

.form-group input,
.form-group textarea {
    -webkit-user-select: text;
    user-select: text;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.form-group textarea {
    min-height: 60px;
    resize: vertical;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.crawler-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.crawler-tag {
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    user-select: none;
    font-family: inherit;
}

.crawler-tag:hover {
    border-color: #60a5fa;
    background: rgba(59, 130, 246, 0.1);
}

.crawler-tag.active {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border-color: transparent;
    color: white;
}

.rules-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 8px;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    transition: all 0.2s ease;
}

.rule-item:hover {
    border-color: rgba(96, 165, 250, 0.3);
}

.rule-item select {
    width: 120px;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 0.85rem;
}

.rule-item input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 0.85rem;
}

.rule-item input::placeholder {
    color: #64748b;
}

.btn-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: #ef4444;
    color: white;
}

.btn-add {
    padding: 12px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

/* Syntax Tips */
.syntax-tips {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 10px;
    padding: 16px;
    margin-top: 20px;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.syntax-tips h4 {
    font-size: 0.85rem;
    color: #cbd5e1;
    margin-bottom: 12px;
}

.syntax-tips ul {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.syntax-tips li {
    font-size: 0.8rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.syntax-tips code {
    background: rgba(96, 165, 250, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    color: #60a5fa;
    font-size: 0.75rem;
}

/* Preview Content with Syntax Highlighting */
.preview-content {
    background: rgba(15, 23, 42, 0.8);
    border-radius: 10px;
    padding: 20px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.preview-content .comment {
    color: #64748b;
}

.preview-content .directive {
    color: #f1f5f9;
}

.preview-content .key {
    color: #60a5fa;
}

.preview-content .value {
    color: #34d399;
}

/* Validation Result */
.validation-result {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
}

.validation-result.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.validation-result.warning {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

.validation-result.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Crawl Test Section */
.crawl-test-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.crawl-test-section .section-title {
    font-size: 0.95rem;
    color: #cbd5e1;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.crawl-test-input {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.crawl-test-input input {
    flex: 1;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    color: #f1f5f9;
    font-size: 0.9rem;
    font-family: inherit;
}

.crawl-test-input input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.crawl-test-input input::placeholder {
    color: #64748b;
}

.btn-test {
    padding: 12px 20px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    white-space: nowrap;
}

.btn-test:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
}

.btn-test:active {
    transform: translateY(0);
}

.crawl-test-result {
    margin-top: 12px;
    padding: 16px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.crawl-test-result.allowed {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.crawl-test-result.blocked {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.crawl-test-result.neutral {
    background: rgba(96, 165, 250, 0.15);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #60a5fa;
}

.crawl-test-result .rule-match {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    color: #94a3b8;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-action {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn-copy {
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    color: white;
}

.btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.btn-download {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    color: white;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
}

.btn-clear {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.btn-clear:hover {
    background: rgba(148, 163, 184, 0.2);
    color: #f1f5f9;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #10b981;
    color: white;
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    touch-action: manipulation;
    max-width: calc(100% - 40px);
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* FAQ Section */
.seo-info {
    margin-top: 40px;
    padding: 30px;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.seo-info h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #f1f5f9;
}

.faq-item {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.faq-item summary {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 500;
    color: #cbd5e1;
    transition: all 0.2s ease;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::before {
    content: "▶";
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.faq-item[open] summary::before {
    transform: rotate(90deg);
}

.faq-item summary:hover {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.1);
}

.faq-item p {
    padding: 0 20px 16px 50px;
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.7;
}

.faq-item ul {
    padding: 0 20px 16px 50px;
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.7;
    list-style: none;
}

.faq-item ul li {
    padding: 6px 0;
    position: relative;
}

.faq-item ul li::before {
    content: "•";
    position: absolute;
    left: -16px;
    color: #60a5fa;
}

.faq-item ul li strong {
    color: #f1f5f9;
}

.faq-item code {
    background: rgba(96, 165, 250, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #60a5fa;
}

.faq-item strong {
    color: #f1f5f9;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(30, 41, 59, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    margin: 10px;
}

.modal-large {
    max-width: 600px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.modal-header h3 {
    font-size: 1.1rem;
    color: #f1f5f9;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.modal-close:hover,
.modal-close:active {
    background: #ef4444;
    color: white;
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-actions {
    margin-top: 16px;
}

/* Template List */
.template-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.template-item {
    padding: 16px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-item:hover {
    border-color: #60a5fa;
    background: rgba(59, 130, 246, 0.1);
}

.template-item h4 {
    font-size: 0.95rem;
    color: #f1f5f9;
    margin-bottom: 4px;
}

.template-item p {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Site Footer */
.site-footer {
    margin-top: 60px;
    padding: 40px 0 30px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(15, 23, 42, 0.4);
}

.friend-links {
    margin-bottom: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.friend-links-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #cbd5e1;
}

.friend-links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    padding: 4px 12px;
    border-radius: 6px;
}

.friend-links a:hover {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
}

.footer-info {
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.footer-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.footer-nav a {
    color: #64748b;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.footer-nav a:hover {
    color: #60a5fa;
}

.footer-nav span {
    color: #475569;
}

.icp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.icp a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.icp a:hover {
    color: #60a5fa;
}

/* Visually Hidden */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ================================
   H5 Responsive & Mobile Optimization
   ================================ */

/* Prevent horizontal scroll and ensure box-sizing */
html {
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

/* Safe area insets for modern mobile devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Tablet Landscape */
@media screen and (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 0 16px;
    }
    
    .main-grid {
        gap: 16px;
    }
    
    .panel {
        padding: 20px;
    }
}

/* Tablet Portrait */
@media screen and (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .logo {
        font-size: 1.8rem;
    }
    
    .logo-icon {
        font-size: 2rem;
    }
    
    .logo-text {
        font-size: 1.6rem;
    }

    .syntax-tips ul {
        grid-template-columns: 1fr;
    }
    
    .panel-header {
        flex-wrap: wrap;
    }
    
    .panel-actions {
        width: 100%;
        justify-content: flex-start;
        margin-top: 8px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-action {
        width: 100%;
    }
}

/* Mobile Landscape */
@media screen and (max-width: 768px) {
    body {
        padding: 16px 12px;
    }
    
    .site-header {
        margin-bottom: 24px;
        padding: 16px 0;
    }
    
    .logo {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 8px;
    }
    
    .logo-icon {
        font-size: 2.2rem;
    }
    
    .tagline {
        font-size: 0.95rem;
    }
    
    .panel {
        padding: 16px;
        border-radius: 12px;
    }
    
    .panel-header {
        padding-bottom: 12px;
        margin-bottom: 16px;
    }
    
    .panel-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .panel-title {
        font-size: 1.1rem;
    }
    
    .section {
        margin-bottom: 20px;
    }
    
    .section-title {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
    
    /* Mobile Form Elements */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 14px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 8px;
    }
    
    .form-group label {
        font-size: 0.85rem;
    }
    
    .help-text {
        font-size: 0.7rem;
        line-height: 1.4;
    }
    
    /* Mobile Crawler Tags */
    .crawler-list {
        gap: 8px;
    }
    
    .crawler-tag {
        padding: 10px 14px;
        font-size: 0.8rem;
        border-radius: 18px;
    }
    
    /* Mobile Rules */
    .rule-item {
        flex-wrap: wrap;
        padding: 12px;
    }
    
    .rule-item select {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .rule-item input {
        flex: 1 1 calc(100% - 44px);
        min-width: 0;
    }
    
    .btn-remove {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    .rules-container {
        max-height: 250px;
    }
    
    /* Mobile Buttons */
    .btn-add {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
    
    .btn-template,
    .btn-import,
    .btn-validate {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    /* Mobile Crawl Test */
    .crawl-test-section {
        margin-top: 20px;
        padding-top: 16px;
    }
    
    .crawl-test-section .section-title {
        font-size: 0.9rem;
    }
    
    .crawl-test-input {
        flex-direction: column;
    }
    
    .crawl-test-input input {
        width: 100%;
    }
    
    .btn-test {
        width: 100%;
        justify-content: center;
    }
    
    /* Mobile Preview */
    .preview-content {
        padding: 14px;
        font-size: 0.85rem;
        min-height: 250px;
        max-height: 350px;
    }
    
    /* Mobile FAQ */
    .seo-info {
        padding: 20px 16px;
        margin-top: 30px;
        border-radius: 12px;
    }
    
    .faq-item summary {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
    
    .faq-item p {
        padding: 0 16px 14px 44px;
        font-size: 0.85rem;
    }
    
    .faq-item ul {
        padding: 0 16px 14px 44px;
    }
    
    /* Mobile Footer */
    .site-footer {
        margin-top: 40px;
        padding: 30px 0 20px;
    }
    
    .friend-links {
        flex-direction: column;
        gap: 12px;
    }
    
    .footer-nav {
        gap: 8px;
    }
    
    .footer-nav span {
        display: none;
    }
}

/* Mobile Portrait */
@media screen and (max-width: 600px) {
    body {
        padding: 12px 10px;
    }
    
    .container {
        padding: 0 8px;
    }
    
    .site-header {
        margin-bottom: 20px;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .logo-icon {
        font-size: 2rem;
    }
    
    .logo-text {
        font-size: 1.4rem;
    }
    
    .tagline {
        font-size: 0.85rem;
    }
    
    .panel {
        padding: 14px;
        border-radius: 10px;
    }
    
    .panel-actions {
        flex-wrap: wrap;
    }
    
    .btn-template,
    .btn-import {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.7rem;
    }
    
    .btn-validate {
        flex: 0 0 auto;
    }
    
    .crawler-tag {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    .preview-content {
        font-size: 0.8rem;
        line-height: 1.6;
    }
    
    .seo-info {
        padding: 16px 12px;
    }
    
    .faq-item summary {
        padding: 12px 14px;
        font-size: 0.85rem;
    }
    
    .faq-item p {
        padding: 0 14px 12px 40px;
        font-size: 0.8rem;
    }
    
    .faq-item ul {
        padding: 0 14px 12px 40px;
    }
    
    /* Toast optimization for mobile */
    .toast {
        left: 20px;
        right: 20px;
        transform: translateX(0) translateY(100px);
        text-align: center;
    }
    
    .toast.show {
        transform: translateX(0) translateY(0);
    }
}

/* Small Mobile Devices */
@media screen and (max-width: 375px) {
    .logo {
        font-size: 1.2rem;
    }
    
    .logo-icon {
        font-size: 1.8rem;
    }
    
    .panel-title {
        font-size: 1rem;
    }
    
    .crawler-tag {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
    
    .rule-item input {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    .btn-add {
        padding: 12px 14px;
        font-size: 0.85rem;
    }
    
    .syntax-tips {
        padding: 12px;
    }
    
    .syntax-tips li {
        font-size: 0.75rem;
    }
}

/* High DPI / Retina optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .panel,
    .modal-content,
    .faq-item {
        border-width: 0.5px;
    }
}

/* Dark mode support for mobile browsers */
@media (prefers-color-scheme: dark) {
    /* Already using dark theme, no changes needed */
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
        padding: 20px;
    }
    
    .panel {
        background: white;
        border: 1px solid #ddd;
        box-shadow: none;
    }
    
    .btn-action,
    .btn-template,
    .btn-import,
    .btn-validate,
    .btn-add,
    .btn-remove,
    .toast,
    .modal {
        display: none !important;
    }
}
