:root {
    --bg: #0b0c14;
    --surface: #ffffff;
    --surface-alt: #f6f7fb;
    --ink: #14151f;
    --ink-soft: #5b5d6e;
    --border: #e7e8f0;
    --primary: #6d5bff;
    --primary-dark: #5643f5;
    --primary-soft: #efecff;
    --accent: #22d3aa;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-md: 0 12px 30px -14px rgba(20, 21, 31, 0.25);
    --shadow-lg: 0 25px 60px -20px rgba(20, 21, 31, 0.35);
    font-size: 16px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--surface-alt);
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.25rem;
}

.brand-mark {
    font-size: 1.4rem;
}

.main-nav {
    display: flex;
    gap: 28px;
}

.main-nav a {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--ink-soft);
    transition: color 0.15s ease;
}

.main-nav a:hover {
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.92rem;
    padding: 10px 20px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-ghost {
    color: var(--ink);
    background: transparent;
}

.btn-ghost:hover {
    background: var(--surface-alt);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 10px 24px -10px rgba(109, 91, 255, 0.65);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px -10px rgba(109, 91, 255, 0.75);
}

.btn-lg {
    padding: 14px 30px;
    font-size: 1rem;
}

/* Hero */
.hero {
    position: relative;
    background: radial-gradient(120% 160% at 50% -20%, #241f4d 0%, var(--bg) 60%);
    color: #fff;
    padding: 96px 0 80px;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px 300px at 15% 20%, rgba(109, 91, 255, 0.35), transparent 60%),
        radial-gradient(600px 300px at 85% 10%, rgba(34, 211, 170, 0.25), transparent 60%);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.eyebrow {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 24px;
    color: #d9d6ff;
}

.hero h1 {
    font-size: clamp(2.1rem, 4.5vw, 3.4rem);
    line-height: 1.1;
    font-weight: 800;
    max-width: 780px;
    margin: 0 0 20px;
}

.hero-sub {
    max-width: 560px;
    color: #b9bacb;
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0 0 36px;
}

.search-bar {
    width: 100%;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 999px;
    padding: 6px 6px 6px 20px;
    box-shadow: var(--shadow-lg);
}

.search-icon {
    font-size: 1rem;
    opacity: 0.6;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    padding: 12px 0;
    font-family: inherit;
    color: var(--ink);
    background: transparent;
}

.hero-stats {
    display: flex;
    gap: 40px;
    margin-top: 48px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat strong {
    font-size: 1.6rem;
    font-weight: 800;
}

.stat span {
    font-size: 0.85rem;
    color: #9d9eb3;
    margin-top: 2px;
}

/* Sections */
.section {
    padding: 72px 0;
}

.section-heading {
    text-align: center;
    max-width: 560px;
    margin: 0 auto 40px;
}

.section-heading h2 {
    font-size: 1.9rem;
    font-weight: 800;
    margin: 0 0 8px;
}

.section-heading p {
    color: var(--ink-soft);
    margin: 0;
}

.featured {
    padding-bottom: 24px;
}

/* Category filters */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 48px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    color: var(--ink-soft);
    transition: all 0.15s ease;
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-chip.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.empty-state {
    text-align: center;
    color: var(--ink-soft);
    margin-bottom: 24px;
}

/* Category blocks */
.category-block {
    margin-bottom: 56px;
    scroll-margin-top: 96px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.category-icon {
    font-size: 1.8rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.category-header h3 {
    margin: 0 0 2px;
    font-size: 1.3rem;
    font-weight: 800;
}

.category-header p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.empty-category {
    color: var(--ink-soft);
    font-size: 0.9rem;
    font-style: italic;
}

/* Tool grid & cards */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.featured-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.tool-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: transparent;
}

.tool-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tool-icon {
    font-size: 1.8rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
}

.tool-icon-lg {
    font-size: 2.4rem;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
}

.status-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-available {
    background: #e4f9f1;
    color: #0f9d70;
}

.status-beta {
    background: #fff3d9;
    color: #b9790a;
}

.status-coming_soon {
    background: #eef0f6;
    color: var(--ink-soft);
}

.tool-card h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.tool-card p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--ink-soft);
    line-height: 1.5;
    flex-grow: 1;
}

.tool-cta {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
}

/* CTA section */
.cta {
    background: linear-gradient(135deg, var(--primary), #8a3ffc);
    border-radius: var(--radius-lg);
    max-width: 1200px;
    margin: 0 auto 72px;
    color: #fff;
}

.cta-inner {
    text-align: center;
    padding: 24px 0;
}

.cta h2 {
    font-size: 1.8rem;
    margin: 0 0 10px;
    font-weight: 800;
}

.cta p {
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 28px;
}

.cta .btn-primary {
    background: #fff;
    color: var(--primary-dark);
    box-shadow: none;
}

/* Tool detail page */
.back-link {
    display: inline-block;
    margin-bottom: 32px;
    font-weight: 600;
    color: var(--ink-soft);
}

.back-link:hover {
    color: var(--primary);
}

.tool-detail-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 40px;
}

.tool-detail-header h1 {
    margin: 8px 0 8px;
    font-size: 2rem;
}

.tool-detail-header p {
    margin: 0;
    color: var(--ink-soft);
}

.tool-placeholder {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 60px 24px;
    text-align: center;
    color: var(--ink-soft);
    background: #fff;
    margin-bottom: 56px;
}

.tool-placeholder p {
    margin: 0 0 8px;
}

/* Messages */
.messages {
    padding-top: 24px;
}

.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.alert-error {
    background: #fdeaea;
    color: #c1372f;
}

.alert-warning {
    background: #fff3d9;
    color: #b9790a;
}

.alert-success {
    background: #e4f9f1;
    color: #0f9d70;
}

.alert-info {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

/* Tool workspace */
.workspace-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-bottom: 56px;
}

.upload-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.file-drop {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.file-drop:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.file-drop-icon {
    font-size: 2.2rem;
}

.file-drop-text {
    font-weight: 600;
    color: var(--ink-soft);
}

.file-drop input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.field-error {
    color: #c1372f;
    font-weight: 600;
    font-size: 0.88rem;
    margin: -8px 0 0;
}

/* Generic non-file form fields (selects, numbers, sliders, color pickers) */
.form-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.form-group label {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--ink-soft);
}

.form-group select,
.form-group input[type="number"],
.form-group input[type="text"] {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background: #fff;
    color: var(--ink);
}

.form-group input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.form-group input[type="color"] {
    width: 64px;
    height: 44px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: #fff;
}

/* Extraction result */
.result-block {
    width: 100%;
    margin-top: 32px;
    border-top: 1px solid var(--border);
    padding-top: 32px;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.result-header h3 {
    margin: 0;
}

.result-textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface-alt);
}

/* Binary result / success screen */
.result-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 56px 24px;
}

.result-check {
    font-size: 2.4rem;
    margin-bottom: 8px;
}

.result-filename-label {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    color: var(--ink-soft);
    margin: 0;
}

.result-extra-info {
    color: var(--ink-soft);
    margin: 0 0 20px;
}

.result-success .btn {
    margin-top: 10px;
}

.result-preview-image {
    max-width: 100%;
    max-height: 360px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin: 8px 0;
    object-fit: contain;
}

.result-again-link {
    margin-top: 16px;
    margin-bottom: 0;
}

/* Footer */
.site-footer {
    background: var(--bg);
    color: #b9bacb;
    padding-top: 56px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-brand {
    max-width: 280px;
}

.footer-brand .brand-mark,
.footer-brand .brand-name {
    color: #fff;
}

.footer-brand p {
    margin-top: 12px;
    font-size: 0.88rem;
    line-height: 1.5;
}

.footer-links {
    display: flex;
    gap: 64px;
}

.footer-links h4 {
    color: #fff;
    font-size: 0.9rem;
    margin: 0 0 16px;
}

.footer-links a {
    display: block;
    font-size: 0.88rem;
    margin-bottom: 10px;
    color: #b9bacb;
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: #fff;
}

.footer-bottom {
    padding: 20px 0;
    font-size: 0.8rem;
    text-align: center;
    color: #7d7f92;
}

/* Responsive */
@media (max-width: 860px) {
    .main-nav {
        display: none;
    }
}

@media (max-width: 640px) {
    .header-actions .btn-ghost {
        display: none;
    }
    .hero {
        padding: 64px 0 56px;
    }
    .hero-stats {
        gap: 24px;
    }
    .footer-inner {
        flex-direction: column;
    }
}
