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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #1e3a8a;
    /* Deep Blue Background */
    padding: 20px;
    color: #333;
    min-height: 100vh;
}

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

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    /* Keep gap for text */
    position: relative;
    /* For absolute logo */
}

.logo {
    position: absolute;
    top: 20px;
    left: 20px;
    max-height: 80px;
    /* Slightly smaller to fit corner */
    width: auto;
    filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    margin: 0;
}


.header h1 {
    font-size: 36px;
    margin: 0;
}

.header p {
    font-size: 18px;
    opacity: 0.95;
}

.controls {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 3px solid #667eea;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-item label {
    font-weight: 700;
    font-size: 14px;
    color: #555;
}

.control-item input,
.control-item select,
.file-input-styled {
    padding: 12px;
    height: 52px;
    /* Fixed height for consistency */
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    /* Ensure full width */
    cursor: pointer;
    background: #fff;
    box-sizing: border-box;
    /* Include padding in height */
    display: flex;
    /* Helps vertically center content in some inputs */
    align-items: center;
}

.control-item small {
    font-size: 12px;
    color: #666;
}

/* File Input Styles */
.file-input-styled {
    padding: 10px;
    height: auto;
    background: #f8f9fa;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    width: 100%;
    cursor: pointer;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-input-styled:hover {
    border-color: #667eea;
    background: #eef2ff;
}

.preset-section {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.preset-section h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
}

/* Tool Form */
.tool-form {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.preset-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 10px 18px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.action-buttons {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    /* Added gap between buttons and visualization */
    flex-wrap: wrap;
}

.page-count-display {
    text-align: center;
    font-size: 14px;
    color: #666;
    font-weight: 600;
    margin-bottom: 30px;
    height: 20px;
    /* Keep space stable */
}

.generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    flex: 1;
    transition: all 0.2s;
    text-align: center;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.download-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    /* Green */
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    flex: 1;
    transition: all 0.2s;
    text-align: center;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}


.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    padding: 30px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-bottom: 3px solid #0ea5e9;
}

.stat-box {
    background: white;
    padding: 18px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.stat-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.stat-box .label {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-box .value {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.visualization {
    padding: 10px;
    /* Reduced outer padding */
}

.sheet {
    margin-bottom: 40px;
    border: 2px solid #667eea;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    background: white;
    width: 98%;
    /* Almost full width */
    max-width: 1800px;
    /* Allow very wide screens */
    margin-left: auto;
    margin-right: auto;
}

.sheet-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    font-weight: 700;
    font-size: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sheet-body {
    display: flex;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
    /* Wrap on small screens */
}

.sheet-side {
    padding: 20px;
    background: #fafafa;
    flex: 1;
    min-width: 300px;
    /* Base width */
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid #eee;
}

.sheet-side:last-child {
    border-right: none;
}

.side-label {
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 12px;
}

.side-label .badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 700;
}

.grid {
    display: grid;
    gap: 0;
    /* No gap, lines will overlap */
    background: white;
    padding: 0;
    /* Edge to edge */
    border: 2px solid #333;
    /* Sheet border */
    width: 100%;
    /* Fill side */
}

.cell {
    border-right: 1px dashed #999;
    border-bottom: 1px dashed #999;
    border-radius: 0;
    /* Sharp corners */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    position: relative;
    transition: all 0.2s;
    cursor: pointer;
    width: 100%;
    aspect-ratio: 0.707;
    margin: 0;
}

.cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    z-index: 10;
}

.cell.odd {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    border-color: #22c55e;
}

.cell.even {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-color: #3b82f6;
}

.cell.blank {
    visibility: hidden;
    border: none;
    background: transparent;
}

.cell .page-num {
    font-size: 2em;
    font-weight: 900;
}

.cell .page-label {
    font-size: 0.7em;
    font-weight: 700;
    margin-top: 4px;
    opacity: 0.75;
    letter-spacing: 0.5px;
}

.cell .position {
    position: absolute;
    top: 5px;
    left: 5px;
    background: white;
    border: 1px solid #333;
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    z-index: 20;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cell .pair-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.6em;
    font-weight: 700;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.legend {
    padding: 30px;
    background: #fff9f0;
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.legend-box {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    border: 3px solid;
}

.legend-box.odd {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #22c55e;
}

.legend-box.even {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
}

.legend-box.blank {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-color: #d1d5db;
    border-style: dashed;
}

.legend-text {
    font-weight: 700;
    color: #333;
    font-size: 16px;
}

.info-panel {
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-top: 30px;
    border-radius: 12px;
}

.info-panel h3 {
    margin-bottom: 18px;
    color: white;
    font-size: 22px;
    font-weight: 800;
}

.info-panel ul {
    margin-left: 25px;
    line-height: 2;
}

.info-panel li {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
}

.info-panel strong {
    color: #fef3c7;
    font-weight: 700;
}

.cutting-guide {
    margin: 30px 40px;
    padding: 25px;
    background: #f0fdf4;
    border: 3px solid #22c55e;
    border-radius: 12px;
}

.cutting-guide h3 {
    color: #166534;
    margin-bottom: 15px;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cutting-guide p {
    color: #14532d;
    line-height: 1.8;
    font-size: 15px;
}

@media (max-width: 768px) {
    .cell .page-num {
        font-size: 24px;
    }

    .grid {
        gap: 8px;
        padding: 12px;
    }

    /* Fix Logo Overlap */
    .logo {
        position: static;
        margin-bottom: 10px;
        max-height: 60px;
    }

    .header {
        padding-top: 20px;
    }



    /* Hero Adjustments */
    .hero {
        padding: 60px 20px;
    }

    .hero h1 {
        font-size: 2rem;
        /* Smaller font */
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .hero-buttons .cta-button,
    .hero-buttons .secondary-button {
        width: 100%;
        text-align: center;
        margin-left: 0 !important;
        box-sizing: border-box;
    }

    /* Container Padding */
    .container {
        border-radius: 0;
        /* Full edge on mobile */
    }

    .content-section,
    .page-content {
        padding: 30px 20px;
        margin: 30px auto;
    }

    /* Stack features */
    .feature-card {
        width: 100%;
    }

    .features-grid {
        grid-template-columns: 1fr !important;
    }

    /* Fix Grid and Buttons */
    .control-grid {
        grid-template-columns: 1fr;
    }

    .preset-buttons {
        justify-content: center;
    }

    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .generate-btn,
    .download-btn {
        width: 100%;
        padding: 12px 20px;
    }
}



/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 80px 40px;
    text-align: center;
    margin-bottom: 40px;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 24px;
    font-weight: 400;
    opacity: 0.9;
    margin-bottom: 25px;
}

.hero-description {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 35px;
    opacity: 0.85;
}

.cta-button {
    display: inline-block;
    background: #4ade80;
    /* Bright Green */
    color: #064e3b;
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 800;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(74, 222, 128, 0.4);
}

/* Features Section */
.features-section {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 0 40px 60px;
    flex-wrap: wrap;
}

.feature-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 300px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #edf2f7;
    text-align: center;
}

.feature-card h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 20px;
}

.feature-card p {
    color: #718096;
    line-height: 1.5;
}

/* Tool Section Wrapper */
.tool-wrapper {
    background: white;
    border-top: 1px solid #eaeaea;
    padding-top: 40px;
}

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

/* Themed Tool Header */
.header-tool {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
}

.header-tool h2 {
    font-size: 32px;
    color: white;
    margin-bottom: 10px;
    font-weight: 800;
}

.header-tool p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
}

.tool-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
    padding-top: 0;
    overflow: hidden;
    /* For header corners */
}

/* Content Pages (About, Privacy, Contact) */
.page-content {
    max-width: 900px;
    margin: 60px auto;
    padding: 0 20px;
}

.page-content h1 {
    font-size: 42px;
    color: #1a202c;
    margin-bottom: 30px;
    border-bottom: 4px solid #667eea;
    display: inline-block;
}

.page-content h2 {
    font-size: 28px;
    color: #2d3748;
    margin-top: 40px;
    margin-bottom: 15px;
}

.page-content p {
    font-size: 18px;
    line-height: 1.8;
    color: #4a5568;
    margin-bottom: 20px;
}

.page-content ul {
    margin-left: 20px;
    margin-bottom: 20px;
}

.page-content li {
    font-size: 18px;
    color: #4a5568;
    margin-bottom: 10px;
    line-height: 1.6;
}

.content-section {
    max-width: 1000px;
    margin: 40px auto;
    padding: 40px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 5px solid #667eea;
}

.content-section h2 {
    color: #2d3748;
    margin-bottom: 20px;
}

.content-section p {
    color: #4a5568;
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 20px;
}








@media (max-width: 768px) {



    /* Mobile Hero */
    .hero {
        padding: 40px 20px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero-subtitle {
        font-size: 18px;
    }

    /* Mobile Features */
    .features-section {
        padding: 0 20px 40px;
        gap: 20px;
    }

    .feature-card {
        width: 100%;
    }

    /* Mobile Content */
    .page-content,
    .content-section {
        padding: 20px;
        margin: 20px auto;
    }

    .page-content h1 {
        font-size: 32px;
    }

    .tool-form {
        padding: 20px;
    }

    .tool-wrapper {
        padding: 20px 10px;
    }
}