@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: #f7f7f8;
    color: #1a1a1a;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
.header {
    background: #fff;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    border-bottom: 1px solid #e8e8ec;
}
.header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #1a1a1a;
}
.header .logo-icon {
    width: 36px;
    height: 36px;
    background: #4f46e5;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}
.header .logo-text {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}
.header .logo-text span {
    color: #4f46e5;
}
.lang-switcher {
    display: flex;
    gap: 4px;
}
.lang-switcher a {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: #6b7280;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.lang-switcher a:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}
.lang-switcher a.active {
    background: #4f46e5;
    color: #fff;
}
.header .nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}
.header .nav-links a {
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s;
    padding: 6px 10px;
    border-radius: 8px;
}
.header .nav-links a:hover { color: #4f46e5; }
.header .nav-links a.active { color: #4f46e5; }
.header .nav-links a.nav-primary {
    color: #4f46e5;
    font-weight: 600;
    background: #eef2ff;
}
.header .nav-links a.nav-primary:hover {
    background: #e0e7ff;
}
.header .nav-links a.nav-primary.active {
    background: #4f46e5;
    color: #fff;
}

/* ===== LANDING PAGE ===== */
.landing {
    max-width: 720px;
    margin: 0 auto;
    padding: 80px 24px 60px;
    text-align: center;
}
.landing h1 {
    font-size: 42px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 16px;
    line-height: 1.15;
    letter-spacing: -0.5px;
}
.landing .subtitle {
    font-size: 18px;
    color: #6b7280;
    margin-bottom: 48px;
    line-height: 1.6;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

/* Format badges */
.format-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 40px;
}
.format-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e8e8ec;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}
.format-badge .ext {
    background: #4f46e5;
    color: #fff;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}
.format-badge .ext.ext-out {
    background: #059669;
}
.format-arrow {
    color: #d1d5db;
    font-size: 22px;
}

/* Upload zone */
.upload-zone {
    background: #fff;
    border: 2px dashed #d1d5db;
    border-radius: 16px;
    padding: 64px 48px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.upload-zone:hover {
    border-color: #4f46e5;
    background: #fafaff;
    box-shadow: 0 0 0 4px rgba(79,70,229,0.08);
}
.upload-zone.dragover {
    border-color: #4f46e5;
    background: #eef2ff;
    box-shadow: 0 0 0 4px rgba(79,70,229,0.12);
}
.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: #eef2ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.upload-icon svg {
    width: 28px;
    height: 28px;
    color: #4f46e5;
}
.upload-zone h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 6px;
}
.upload-zone p {
    font-size: 15px;
    color: #9ca3af;
    margin-bottom: 20px;
}
.upload-zone .browse-btn {
    display: inline-block;
    background: #4f46e5;
    color: #fff;
    padding: 12px 36px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(79,70,229,0.3);
}
.upload-zone .browse-btn:hover {
    background: #4338ca;
    box-shadow: 0 4px 12px rgba(79,70,229,0.35);
}
.upload-zone input[type=file] { display: none; }
.upload-zone .hint {
    font-size: 13px;
    color: #b0b0b0;
    margin-top: 16px;
}

/* Progress */
.progress-wrap {
    display: none;
    margin-top: 32px;
    text-align: left;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e8e8ec;
}
.progress-wrap.active { display: block; }
.progress-bar-bg {
    background: #e8e8ec;
    border-radius: 100px;
    height: 6px;
    overflow: hidden;
}
.progress-bar {
    background: #4f46e5;
    height: 100%;
    width: 0;
    transition: width 0.3s;
    border-radius: 100px;
}
.progress-text {
    font-size: 14px;
    color: #6b7280;
    margin-top: 12px;
    font-weight: 500;
}

/* Error */
.error-msg {
    display: none;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 14px 20px;
    margin-top: 24px;
    font-size: 14px;
    text-align: left;
    font-weight: 500;
}
.error-msg.active { display: block; }

/* Steps */
.steps {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 64px;
    padding-top: 48px;
    border-top: 1px solid #e8e8ec;
}
.step {
    text-align: center;
    max-width: 180px;
}
.step-num {
    width: 36px;
    height: 36px;
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}
.step h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
}
.step p {
    font-size: 13px;
    color: #9ca3af;
    line-height: 1.5;
}

/* ===== VIEWER PAGE ===== */
.viewer-header {
    background: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    border-bottom: 1px solid #e8e8ec;
}
.viewer-header .left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.viewer-header .back-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}
.viewer-header .back-link:hover { color: #4f46e5; }
.viewer-header .divider {
    width: 1px;
    height: 24px;
    background: #e8e8ec;
}
.viewer-header .pattern-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}
.viewer-header .pattern-meta {
    font-size: 13px;
    color: #9ca3af;
    margin-left: 8px;
    font-weight: 400;
}
.viewer-header .right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.main { display: flex; height: calc(100vh - 56px); }

.sidebar {
    width: 280px;
    background: #fff;
    padding: 16px;
    overflow-y: auto;
    border-right: 1px solid #e8e8ec;
    flex-shrink: 0;
}
.sidebar-section {
    margin-bottom: 20px;
}
.sidebar-section h3 {
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.color-entry {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    margin: 1px 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
    color: #4b5563;
}
.color-entry:hover { background: #f3f4f6; }
.color-entry.active { background: #eef2ff; }

.color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    margin-right: 10px;
    border: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.color-info {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}
.color-code {
    color: #4f46e5;
    font-weight: 600;
}

.canvas-wrap {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
    background: #f0f0f3;
}
.canvas-wrap.grabbing { cursor: grabbing; }
canvas { position: absolute; top: 0; left: 0; image-rendering: pixelated; }

.toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 6px 10px;
    border-radius: 10px;
    display: flex;
    gap: 6px;
    align-items: center;
    z-index: 10;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.05);
}
.toolbar button {
    background: transparent;
    border: 1px solid #e8e8ec;
    color: #4b5563;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}
.toolbar button:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}
.toolbar .zoom-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    min-width: 44px;
    text-align: center;
    padding: 0 4px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #4f46e5;
    border: none;
    color: #fff;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(79,70,229,0.25);
}
.download-btn:hover {
    background: #4338ca;
    box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}
.download-btn svg {
    width: 16px;
    height: 16px;
}

.stats {
    font-size: 12px;
    color: #9ca3af;
}
.stats div {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}
.stats .stat-label { color: #6b7280; }
.stats .stat-val { color: #1a1a1a; font-weight: 500; font-variant-numeric: tabular-nums; }

.controls label {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    cursor: pointer;
    color: #4b5563;
}
.controls input[type=checkbox] {
    accent-color: #4f46e5;
    width: 15px;
    height: 15px;
}

/* No-data fallback */
.no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
    gap: 12px;
}
.no-data h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
}
.no-data p { color: #6b7280; font-size: 15px; }
.no-data a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 600;
}
.no-data a:hover { text-decoration: underline; }

/* ===== CONTENT PAGES (FAQ, Contact, Article) ===== */
.page-content {
    max-width: 720px;
    margin: 0 auto;
    padding: 60px 24px 80px;
}
.page-content h1 {
    font-size: 36px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 16px;
    line-height: 1.2;
    letter-spacing: -0.3px;
}
.page-intro {
    font-size: 17px;
    color: #6b7280;
    line-height: 1.7;
    margin-bottom: 40px;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.faq-item {
    background: #fff;
    border: 1px solid #e8e8ec;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.faq-item[open] {
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.faq-item summary {
    padding: 20px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: "+";
    font-size: 20px;
    font-weight: 400;
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.faq-item[open] summary::after {
    content: "\2212";
    color: #4f46e5;
}
.faq-item p {
    padding: 0 24px 20px;
    font-size: 15px;
    color: #6b7280;
    line-height: 1.7;
}

/* Contact */
.content-card {
    background: #fff;
    border: 1px solid #e8e8ec;
    border-radius: 12px;
    padding: 28px 28px 24px;
    margin-bottom: 20px;
}
.content-card h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 10px;
}
.content-card p {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.7;
    margin-bottom: 8px;
}
.content-card p.note {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 12px;
    margin-bottom: 0;
}
.content-card ul {
    margin: 12px 0 0 20px;
    color: #6b7280;
    font-size: 15px;
    line-height: 1.8;
}
/* Contact form */
.contact-form {
    margin-top: 16px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e8e8ec;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #1a1a1a;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus {
    border-color: #4f46e5;
}
.form-group textarea {
    resize: vertical;
    min-height: 100px;
}
.send-btn {
    display: inline-block;
    background: #4f46e5;
    color: #fff;
    padding: 12px 36px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(79,70,229,0.3);
}
.send-btn:hover {
    background: #4338ca;
    box-shadow: 0 4px 12px rgba(79,70,229,0.35);
}
.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.form-status {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
}
.form-status.success { color: #059669; }
.form-status.error { color: #dc2626; }

/* Article */
.article-section {
    margin-bottom: 36px;
}
.article-section h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 10px;
}
.article-section p {
    font-size: 16px;
    color: #4b5563;
    line-height: 1.75;
}
.article-cta {
    background: #eef2ff;
    border-radius: 16px;
    padding: 40px 36px;
    text-align: center;
    margin-top: 48px;
}
.article-cta h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
}
.article-cta p {
    font-size: 16px;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 24px;
}
.cta-btn {
    display: inline-block;
    background: #4f46e5;
    color: #fff;
    padding: 14px 40px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(79,70,229,0.3);
}
.cta-btn:hover {
    background: #4338ca;
    box-shadow: 0 4px 12px rgba(79,70,229,0.35);
}
