*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.view-page {
    max-width: 960px;
}

/* ===== Landing ===== */

.landing {
    background: #fff;
}

.hero {
    background: linear-gradient(135deg, #1a2a3a 0%, #2c3e50 100%);
    color: #fff;
    text-align: center;
    padding: 3.5rem 1.5rem 3rem;
}

.hero .container {
    max-width: 800px;
    padding: 0 1rem;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 1rem;
}

.hero-accent {
    color: #5dade2;
}

.hero-sub {
    font-size: 1.1rem;
    color: #b0c4d8;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Upload section */

.upload-section {
    background: #f5f7fa;
    padding: 2.5rem 0;
}

.upload-section .container {
    max-width: 640px;
}

.upload-area {
    border: 2px dashed #bdc3c7;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    text-align: center;
    background: #fff;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
    margin-bottom: 1rem;
}

.upload-area.drag-over {
    border-color: #3498db;
    background: #ebf5fb;
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.upload-area p {
    margin-bottom: 0.75rem;
    color: #7f8c8d;
}

.upload-area input[type="file"] {
    display: none;
}

.file-info {
    font-size: 0.9rem;
    margin-top: 0.75rem;
    font-weight: 500;
}

.drawing-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.types-col {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem;
    border: 1px solid #ecf0f1;
}

.types-col h3 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.types-good h3 { color: #27ae60; }
.types-bad h3 { color: #c0392b; }

.types-col ul {
    list-style: none;
    padding: 0;
}

.types-col li {
    font-size: 0.82rem;
    padding: 0.2rem 0;
    color: #555;
}

.types-good li::before {
    content: "\2713\00a0";
    color: #27ae60;
    font-weight: 700;
}

.types-bad li::before {
    content: "\2717\00a0";
    color: #c0392b;
    font-weight: 700;
}

/* How it works */

.how-it-works {
    padding: 3rem 0;
    text-align: center;
    background: #fff;
}

.how-it-works .container {
    max-width: 820px;
}

.how-it-works h2 {
    font-size: 1.6rem;
    color: #2c3e50;
    margin-bottom: 2rem;
}

.how-it-works h2 strong {
    color: #3498db;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    text-align: center;
}

.hw-step {
    position: relative;
}

.hw-num {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #3498db;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
}

.hw-step h3 {
    font-size: 0.95rem;
    color: #2c3e50;
    margin-bottom: 0.35rem;
}

.hw-step p {
    font-size: 0.82rem;
    color: #7f8c8d;
    line-height: 1.4;
}

/* Features */

.features {
    padding: 3rem 0;
    background: #f5f7fa;
}

.features .container {
    max-width: 820px;
}

.features h2 {
    font-size: 1.6rem;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 0.5rem;
}

.features-sub {
    text-align: center;
    color: #7f8c8d;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    text-align: center;
}

.feature {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem 1rem;
    border: 1px solid #ecf0f1;
}

.feature-icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.feature h3 {
    font-size: 0.95rem;
    color: #2c3e50;
    margin-bottom: 0.3rem;
}

.feature p {
    font-size: 0.82rem;
    color: #7f8c8d;
    line-height: 1.4;
}

/* FAQ */

.faq-section {
    padding: 3rem 0;
    background: #f5f7fa;
}

.faq-section .container {
    max-width: 720px;
}

.faq-section h2 {
    font-size: 1.6rem;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 2rem;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.faq-item {
    border: 1px solid #dde3ea;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.06);
    transition: box-shadow 0.2s;
}

.faq-item:hover {
    box-shadow: 0 3px 10px rgba(44, 62, 80, 0.1);
}

.faq-item summary {
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: #2c3e50;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    color: #3498db;
    font-weight: 400;
    flex-shrink: 0;
    margin-left: 1rem;
    transition: transform 0.2s;
    line-height: 1;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item[open] summary {
    border-bottom: 1px solid #dde3ea;
}

.faq-item p {
    padding: 0.85rem 1.25rem;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
    margin: 0;
}

/* CTA */

.cta-section {
    padding: 3rem 0;
    text-align: center;
    background: linear-gradient(135deg, #2c3e50 0%, #1a2a3a 100%);
    color: #fff;
}

.cta-section h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.cta-section p {
    color: #b0c4d8;
    margin-bottom: 1.5rem;
}

.btn-cta {
    display: inline-block;
    padding: 0.9rem 2.5rem;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-cta:hover {
    background: #219a52;
}

/* ===== Shared buttons ===== */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s, opacity 0.2s;
}

.btn-primary {
    background: #3498db;
    color: #fff;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #d5dbdb;
}

.btn-generate {
    display: block;
    width: 100%;
    background: #27ae60;
    color: #fff;
    font-size: 1.1rem;
    padding: 1rem;
}

.btn-generate:hover {
    background: #219a52;
}

.btn-generate:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.error-msg {
    background: #fdecea;
    color: #c0392b;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    text-align: center;
}

/* ===== Wait page ===== */

.wait-page header {
    text-align: center;
    margin-bottom: 2rem;
}

.wait-page header h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.wait-page header h1 a {
    color: inherit;
    text-decoration: none;
}

.wait-block {
    background: #fff;
    border-radius: 12px;
    padding: 2rem 2rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.wait-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #ecf0f1;
}

.wait-header h2 {
    color: #2c3e50;
    font-size: 1.25rem;
    margin-bottom: 0.2rem;
}

.wait-hint {
    font-size: 0.85rem;
    text-align: center;
    color: #95a5a6;
    margin-top: 0.75rem;
}

.wait-elapsed {
    text-align: center;
    font-size: 0.9rem;
    color: #7f8c8d;
    font-variant-numeric: tabular-nums;
    margin-top: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border: 3px solid #ecf0f1;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-error {
    animation: none;
    border-top-color: #e74c3c;
    border-color: #e74c3c;
    opacity: 0.4;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Pipeline steps timeline */

.pipeline-steps {
    position: relative;
    padding: 0;
    margin: 0 0 1.5rem;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    position: relative;
    opacity: 0.4;
    transition: opacity 0.3s, transform 0.3s;
}

.step-optional {
    display: none;
}

.step-active,
.step-done,
.step-skipped,
.step-error {
    opacity: 1;
}

.step-active {
    transform: translateX(4px);
}

.step-skipped {
    opacity: 0.3;
}

.step-marker {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ecf0f1;
    z-index: 1;
    transition: background 0.3s, box-shadow 0.3s;
}

.step-icon {
    font-size: 0.7rem;
    color: #95a5a6;
    line-height: 1;
    transition: color 0.3s;
}

.step-active .step-marker {
    background: #ebf5fb;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.step-active .step-icon {
    color: #3498db;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.step-done .step-marker {
    background: #d5f5e3;
}

.step-done .step-icon {
    color: #27ae60;
    font-size: 0.85rem;
}

.step-error .step-marker {
    background: #fdecea;
}

.step-error .step-icon {
    color: #e74c3c;
    font-size: 0.85rem;
}

.step-skipped .step-marker {
    background: #f5f5f5;
}

.step-skipped .step-icon {
    color: #ccc;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 13px;
    top: 36px;
    bottom: -8px;
    width: 2px;
    background: #ecf0f1;
    z-index: 0;
}

.step-done:not(:last-child)::after {
    background: #a9dfbf;
}

.step-active:not(:last-child)::after {
    background: linear-gradient(to bottom, #a9dfbf, #ecf0f1);
}

.step-body {
    flex: 1;
    min-width: 0;
    padding-top: 3px;
}

.step-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    transition: color 0.3s;
}

.step-active .step-label {
    color: #2c3e50;
}

.step-done .step-label {
    color: #27ae60;
}

.step-error .step-label {
    color: #e74c3c;
}

.step-time {
    font-size: 0.78rem;
    color: #b0b0b0;
    font-variant-numeric: tabular-nums;
    padding-top: 5px;
    min-width: 3rem;
    text-align: right;
}

.step-active .step-time {
    color: #3498db;
    font-weight: 500;
}

.step-done .step-time {
    color: #7f8c8d;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #ecf0f1;
    border-radius: 2px;
    margin-top: 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ===== View page ===== */

.view-page header {
    text-align: center;
    margin-bottom: 2rem;
}

.view-page header h1 {
    font-size: 2rem;
    color: #2c3e50;
}

.view-page header h1 a {
    color: inherit;
    text-decoration: none;
}

.viewer-wrapper {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

#viewer3d {
    width: 100%;
    height: 500px;
}

.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.actions .btn {
    min-width: 180px;
}

.btn-share {
    background: #8e44ad;
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-share:hover {
    background: #7d3c98;
}

.share-hint {
    text-align: center;
    font-size: 0.85rem;
    color: #27ae60;
    margin-top: 0.5rem;
    min-height: 1.2em;
    opacity: 0;
    transition: opacity 0.3s;
}

.share-hint-visible {
    opacity: 1;
}

/* ===== Footer ===== */

footer {
    text-align: center;
    padding: 1.5rem 0;
    color: #95a5a6;
    font-size: 0.85rem;
}

.landing footer {
    background: #1a2a3a;
    color: #7f8c8d;
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.6rem;
    }
    .hero-sub {
        font-size: 0.95rem;
    }
    .steps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 1.5rem 1rem;
    }
    .hero {
        padding: 2.5rem 1rem 2rem;
    }
    .hero h1 {
        font-size: 1.4rem;
    }
    .steps-grid,
    .features-grid {
        grid-template-columns: 1fr;
    }
    .drawing-types {
        grid-template-columns: 1fr;
    }
    .wait-block {
        padding: 1.25rem 1rem 1rem;
    }
    .wait-header {
        gap: 0.75rem;
    }
    .wait-header h2 {
        font-size: 1.1rem;
    }
    .step-time {
        display: none;
    }
    #viewer3d {
        height: 350px;
    }
    .actions {
        flex-direction: column;
    }
    .actions .btn {
        width: 100%;
    }
}
