 :root {
     --primary-color: #667eea;
     --secondary-color: #764ba2;
     --success-color: #28a745;
     --error-color: #dc3545;
     --warning-color: #ffc107;
     --info-color: #17a2b8;
     --dark-color: #2c3e50;
 }

 * {
     margin: 0;
     padding: 0;
     box-sizing: border-box;
 }

 body {
     font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
     line-height: 1.6;
     background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
     min-height: 100vh;
     padding: 20px;
     padding-top: 60px;
 }

 /* Back Button */
 .back-button {
     position: fixed;
     top: 10px;
     left: 20px;
     background: rgba(255, 255, 255, 0.95);
     color: #333;
     padding: 10px 20px;
     border-radius: 30px;
     text-decoration: none;
     font-weight: 600;
     font-size: 0.95rem;
     border: none;
     cursor: pointer;
     z-index: 1000;
     box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
     transition: all 0.2s;
 }

 .back-button:hover {
     background: white;
     transform: translateX(-3px);
     box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
 }

 /* Breadcrumb */
 .breadcrumb-nav {
     max-width: 1000px;
     margin: 0 auto;
     padding: 0 20px 10px;
 }

 .breadcrumb {
     list-style: none;
     display: flex;
     gap: 8px;
     font-size: 0.9rem;
     flex-wrap: wrap;
 }

 .breadcrumb li {
     display: flex;
     align-items: center;
     color: rgba(255, 255, 255, 0.9);
 }

 .breadcrumb li:not(:last-child)::after {
     content: '›';
     margin-left: 8px;
     color: rgba(255, 255, 255, 0.6);
     font-size: 1.2rem;
 }

 .breadcrumb a {
     color: white;
     text-decoration: none;
     transition: opacity 0.2s;
 }

 .breadcrumb a:hover {
     opacity: 0.8;
     text-decoration: underline;
 }

 .breadcrumb [aria-current="page"] {
     color: white;
     font-weight: 600;
 }

 /* Tool Switcher */
 .tool-switcher {
     display: flex;
     align-items: center;
     gap: 8px;
     flex-wrap: wrap;
     background: rgba(255, 255, 255, 0.12);
     border: 1px solid rgba(255, 255, 255, 0.2);
     border-radius: 14px;
     padding: 10px 16px;
     margin: 0 auto 16px;
     max-width: 1000px;
 }

 .tool-switcher-label {
     color: rgba(255, 255, 255, 0.7);
     font-size: 0.8rem;
     font-weight: 600;
     text-transform: uppercase;
     letter-spacing: 0.5px;
     margin-right: 4px;
     white-space: nowrap;
 }

 .tool-switch-btn {
     color: rgba(255, 255, 255, 0.85);
     text-decoration: none;
     font-size: 0.85rem;
     font-weight: 500;
     padding: 6px 14px;
     border-radius: 20px;
     border: 1px solid rgba(255, 255, 255, 0.2);
     background: rgba(255, 255, 255, 0.1);
     transition: all 0.2s;
     white-space: nowrap;
     display: inline-block;
 }

 .tool-switch-btn:hover {
     background: rgba(255, 255, 255, 0.25);
     color: white;
 }

 .tool-switch-btn.active {
     background: white;
     color: #667eea;
     font-weight: 700;
     border-color: white;
     pointer-events: none;
 }

 /* Container */
 .container {
     max-width: 1000px;
     margin: 0 auto 40px;
     background: white;
     border-radius: 15px;
     box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
     overflow: hidden;
 }

 /* Header */
 .header {
     background: var(--dark-color);
     color: white;
     padding: 25px;
     text-align: center;
 }

 .header h1 {
     font-size: 2rem;
     margin-bottom: 8px;
 }

 /* Main content */
 .main-content {
     padding: 30px;
 }

 /* Upload Box */
 .upload-box {
     border: 3px dashed var(--primary-color);
     border-radius: 10px;
     padding: 50px 20px;
     text-align: center;
     transition: all 0.2s;
     background: #f8f9fa;
     cursor: pointer;
     margin-bottom: 25px;
 }

 .upload-box:hover {
     border-color: var(--secondary-color);
     background: #e9ecef;
 }

 .upload-box.dragover {
     border-color: var(--success-color);
     background: #d4edda;
 }

 .upload-icon {
     font-size: 3rem;
     margin-bottom: 15px;
     color: var(--primary-color);
 }

 .browse-button {
     background: var(--primary-color);
     color: white;
     padding: 10px 25px;
     border: none;
     border-radius: 20px;
     font-size: 1rem;
     cursor: pointer;
     transition: all 0.2s;
     margin-top: 12px;
     font-weight: 600;
 }

 .browse-button:hover {
     background: var(--secondary-color);
     transform: translateY(-2px);
 }

 #fileInput {
     display: none;
 }

 /* File Info */
 .file-info {
     margin-bottom: 20px;
     padding: 14px 18px;
     background: #e9ecef;
     border-radius: 8px;
     display: none;
     font-size: 0.9rem;
 }

 .file-info.show {
     display: block;
 }

 .file-details {
     display: grid;
     grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
     gap: 10px;
     margin-top: 8px;
 }

 .file-detail strong {
     color: var(--dark-color);
 }

 /* Messages */
 .message {
     padding: 12px;
     border-radius: 6px;
     margin-bottom: 15px;
     display: none;
     font-size: 0.9rem;
 }

 .message.show {
     display: block;
 }

 .error-message {
     background: #f8d7da;
     color: var(--error-color);
     border: 1px solid #f5c6cb;
 }

 .warning-message {
     background: #fff3cd;
     color: #856404;
     border: 1px solid #ffeaa7;
 }

 .info-message {
     background: #d1ecf1;
     color: #0c5460;
     border: 1px solid #bee5eb;
 }

 /* Split Options */
 .split-options {
     background: #f8f9fa;
     border-radius: 10px;
     padding: 25px;
     margin-bottom: 25px;
     display: none;
 }

 .split-options.show {
     display: block;
 }

 .split-options h3 {
     margin-bottom: 20px;
     color: var(--dark-color);
 }

 /* Tabs */
 .options-tabs {
     display: flex;
     gap: 8px;
     margin-bottom: 20px;
     border-bottom: 2px solid #e9ecef;
     padding-bottom: 12px;
     flex-wrap: wrap;
 }

 .tab-button {
     background: none;
     border: 2px solid #dee2e6;
     padding: 8px 18px;
     border-radius: 20px;
     cursor: pointer;
     font-weight: 600;
     font-size: 0.88rem;
     transition: all 0.2s;
     color: #6c757d;
 }

 .tab-button.active {
     background: var(--primary-color);
     color: white;
     border-color: var(--primary-color);
 }

 .tab-button:hover:not(.active) {
     border-color: var(--primary-color);
     color: var(--primary-color);
 }

 .tab-content {
     display: none;
 }

 .tab-content.active {
     display: block;
 }

 .option-group {
     margin-bottom: 18px;
 }

 .option-label {
     display: block;
     margin-bottom: 8px;
     font-weight: 600;
     color: var(--dark-color);
     font-size: 0.9rem;
 }

 .option-input,
 .option-textarea {
     width: 100%;
     padding: 12px;
     border: 2px solid #e9ecef;
     border-radius: 8px;
     font-size: 0.9rem;
     transition: all 0.2s;
     background: white;
 }

 .option-input:focus,
 .option-textarea:focus {
     border-color: var(--primary-color);
     outline: none;
 }

 .option-textarea {
     height: 90px;
     resize: vertical;
     font-family: 'Courier New', monospace;
 }

 .help-text {
     font-size: 0.8rem;
     color: #6c757d;
     margin-top: 5px;
 }

 /* Selection controls */
 .selection-controls {
     display: flex;
     gap: 8px;
     margin-bottom: 10px;
 }

 .selection-btn {
     background: var(--primary-color);
     color: white;
     border: none;
     padding: 6px 14px;
     border-radius: 15px;
     cursor: pointer;
     font-size: 0.82rem;
     font-weight: 600;
     transition: all 0.2s;
 }

 .selection-btn:hover {
     background: var(--secondary-color);
 }

 /* Page Preview Grid */
 .page-preview-section {
     margin-top: 20px;
     padding: 20px;
     background: white;
     border-radius: 8px;
     border: 2px solid #e9ecef;
 }

 .preview-title {
     font-weight: 600;
     color: var(--dark-color);
     margin-bottom: 14px;
     display: flex;
     justify-content: space-between;
     align-items: center;
 }

 .preview-grid {
     display: grid;
     grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
     gap: 10px;
     max-height: 360px;
     overflow-y: auto;
     padding: 4px;
 }

 /* Page Thumbnail — real canvas rendering */
 .page-thumbnail {
     width: 100%;
     aspect-ratio: 3/4;
     background: white;
     border: 2px solid #dee2e6;
     border-radius: 6px;
     display: flex;
     flex-direction: column;
     align-items: center;
     justify-content: flex-end;
     cursor: pointer;
     transition: all 0.2s;
     overflow: hidden;
     position: relative;
     box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
 }

 .page-thumbnail canvas {
     position: absolute;
     top: 0;
     left: 0;
     width: 100%;
     height: calc(100% - 22px);
     object-fit: contain;
 }

 .page-thumbnail .thumb-loading {
     position: absolute;
     top: 50%;
     left: 50%;
     transform: translate(-50%, -60%);
     font-size: 1.5rem;
     color: #adb5bd;
 }

 .page-thumb-label {
     position: relative;
     z-index: 2;
     width: 100%;
     text-align: center;
     background: #f8f9fa;
     border-top: 1px solid #dee2e6;
     font-size: 0.72rem;
     font-weight: 700;
     color: var(--dark-color);
     padding: 3px 0;
 }

 .page-thumbnail:hover {
     border-color: var(--primary-color);
     transform: translateY(-2px);
     box-shadow: 0 4px 10px rgba(102, 126, 234, 0.2);
 }

 .page-thumbnail.selected {
     border-color: var(--success-color);
     box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
 }

 .page-thumbnail.selected .page-thumb-label {
     background: #d4edda;
     color: var(--success-color);
 }

 /* Split Preview */
 .split-preview {
     margin-top: 20px;
     padding: 18px;
     background: #e8f5e8;
     border-radius: 8px;
     border-left: 4px solid var(--success-color);
     display: none;
 }

 .split-preview h4 {
     color: var(--dark-color);
     margin-bottom: 12px;
 }

 .preview-list {
     max-height: 220px;
     overflow-y: auto;
 }

 .preview-item {
     padding: 9px 12px;
     background: white;
     border-radius: 6px;
     margin-bottom: 6px;
     border-left: 3px solid var(--primary-color);
     font-size: 0.88rem;
 }

 /* Progress */
 .progress-section {
     display: none;
     margin: 20px 0;
     text-align: center;
 }

 .progress-section.show {
     display: block;
 }

 .progress-bar {
     width: 100%;
     height: 8px;
     background: #e9ecef;
     border-radius: 4px;
     overflow: hidden;
     margin: 15px 0;
 }

 .progress-fill {
     height: 100%;
     background: var(--success-color);
     border-radius: 4px;
     transition: width 0.3s ease;
     width: 0%;
 }

 .progress-text {
     font-size: 0.9rem;
     color: #6c757d;
 }

 /* Results */
 .result-section {
     display: none;
     margin: 20px 0;
 }

 .result-section.show {
     display: block;
 }

 .result-section h3 {
     text-align: center;
     margin-bottom: 18px;
     color: var(--dark-color);
 }

 .result-grid {
     display: grid;
     grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
     gap: 14px;
 }

 .result-item {
     background: white;
     border: 2px solid #e9ecef;
     border-radius: 10px;
     padding: 16px;
     text-align: center;
     transition: all 0.2s;
 }

 .result-item:hover {
     border-color: var(--primary-color);
     transform: translateY(-2px);
     box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
 }

 .result-item.failed {
     border-color: var(--error-color);
     opacity: 0.7;
 }

 .result-icon {
     font-size: 2rem;
     margin-bottom: 8px;
 }

 .result-name {
     font-weight: 600;
     margin-bottom: 4px;
     word-break: break-word;
     font-size: 0.85rem;
 }

 .result-size {
     font-size: 0.78rem;
     color: #6c757d;
     margin-bottom: 10px;
 }

 .download-btn {
     background: var(--success-color);
     color: white;
     border: none;
     padding: 8px 14px;
     border-radius: 15px;
     cursor: pointer;
     font-size: 0.82rem;
     font-weight: 600;
     transition: all 0.2s;
     width: 100%;
 }

 .download-btn:hover {
     background: #218838;
 }

 .download-btn:disabled {
     background: #6c757d;
     cursor: not-allowed;
 }

 .batch-download {
     text-align: center;
     margin-top: 22px;
 }

 .batch-download-btn {
     background: var(--primary-color);
     color: white;
     padding: 12px 26px;
     border: none;
     border-radius: 22px;
     cursor: pointer;
     font-weight: 600;
     font-size: 0.95rem;
     transition: all 0.2s;
     display: inline-flex;
     align-items: center;
     gap: 8px;
 }

 .batch-download-btn:hover:not(:disabled) {
     background: var(--secondary-color);
     transform: translateY(-2px);
 }

 .batch-download-btn:disabled {
     background: #6c757d;
     cursor: not-allowed;
     opacity: 0.6;
 }

 /* Action Buttons */
 .action-buttons {
     display: flex;
     gap: 15px;
     justify-content: center;
     margin-top: 25px;
     flex-wrap: wrap;
 }

 .action-button {
     color: white;
     padding: 14px 30px;
     border: none;
     border-radius: 25px;
     cursor: pointer;
     font-weight: 600;
     font-size: 1rem;
     transition: all 0.2s;
     display: inline-flex;
     align-items: center;
     gap: 8px;
 }

 .action-button:hover:not(:disabled) {
     transform: translateY(-2px);
     box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
 }

 .action-button:disabled {
     background: #6c757d !important;
     cursor: not-allowed;
     transform: none;
     box-shadow: none;
 }

 .btn-split {
     background: var(--success-color);
 }

 .btn-split:hover:not(:disabled) {
     background: #218838;
 }

 .btn-reset {
     background: var(--warning-color);
     color: #333;
 }

 .btn-reset:hover:not(:disabled) {
     background: #e0a800;
 }

 /* Features */
 .features {
     display: grid;
     grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
     gap: 20px;
     padding: 30px;
     background: #f8f9fa;
 }

 .feature {
     text-align: center;
     padding: 20px;
 }

 .feature-icon {
     font-size: 2.2rem;
     margin-bottom: 12px;
     color: var(--primary-color);
 }

 /* SEO Content */
 .seo-content {
     padding: 30px;
     border-top: 1px solid #eee;
 }

 .seo-content h2 {
     font-size: 1.2rem;
     color: #2c3e50;
     margin: 20px 0 8px;
 }

 .seo-content h2:first-child {
     margin-top: 0;
 }

 .seo-content p {
     font-size: 0.95rem;
     color: #555;
     line-height: 1.7;
 }

 .seo-content ul {
     margin: 8px 0 14px 20px;
 }

 .seo-content ul li {
     margin-bottom: 6px;
     font-size: 0.95rem;
     color: #555;
 }

 /* FAQ */
 .faq-section {
     padding: 30px;
     background: #f8f9fa;
     border-top: 1px solid #eee;
 }

 .faq-section h2 {
     text-align: center;
     margin-bottom: 24px;
     color: #333;
     font-size: 1.5rem;
 }

 .faq-grid {
     display: grid;
     grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
     gap: 16px;
 }

 .faq-item {
     background: white;
     padding: 15px 20px;
     border-radius: 8px;
     box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
 }

 .faq-item summary {
     font-weight: 600;
     color: #333;
     cursor: pointer;
     padding: 5px 0;
 }

 .faq-item summary:hover {
     color: var(--primary-color);
 }

 .faq-item p {
     margin-top: 10px;
     color: #555;
     line-height: 1.6;
     font-size: 0.95rem;
 }

 /* Related Tools */
 .related-tools {
     padding: 30px;
     text-align: center;
     border-top: 1px solid #eee;
 }

 .related-tools h2 {
     margin-bottom: 20px;
     color: #333;
     font-size: 1.4rem;
 }

 .related-links {
     display: flex;
     flex-wrap: wrap;
     justify-content: center;
     gap: 12px;
 }

 .related-link {
     display: inline-block;
     padding: 10px 20px;
     background: #e9ecef;
     color: #333;
     text-decoration: none;
     border-radius: 25px;
     font-weight: 500;
     font-size: 0.9rem;
     transition: all 0.2s;
 }

 .related-link:hover {
     background: var(--primary-color);
     color: white;
     transform: translateY(-2px);
 }

 /* Footer */
 footer {
     background: rgba(0, 0, 0, 0.3);
     color: rgba(255, 255, 255, 0.85);
     padding: 20px;
     text-align: center;
     font-size: 0.9rem;
     border-radius: 0 0 15px 15px;
 }

 footer a {
     color: white;
     text-decoration: none;
 }

 footer a:hover {
     text-decoration: underline;
 }

 /* Responsive */
 @media (max-width: 768px) {
     body {
         padding-top: 55px;
     }

     .back-button {
         top: 8px;
         left: 10px;
         padding: 8px 16px;
         font-size: 0.85rem;
     }

     .main-content {
         padding: 20px;
     }

     .upload-box {
         padding: 30px 15px;
     }

     .action-buttons {
         flex-direction: column;
         align-items: stretch;
     }

     .action-button {
         justify-content: center;
     }

     .result-grid {
         grid-template-columns: 1fr 1fr;
     }

     .faq-grid {
         grid-template-columns: 1fr;
     }

     .related-links {
         flex-direction: column;
         align-items: stretch;
     }

     .related-link {
         text-align: center;
     }

     .preview-grid {
         max-height: 220px;
     }
 }

 @media (max-width: 600px) {
     .tool-switcher {
         gap: 6px;
         padding: 8px 12px;
     }

     .tool-switch-btn {
         font-size: 0.78rem;
         padding: 5px 10px;
     }

     .result-grid {
         grid-template-columns: 1fr;
     }
 }