*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    color: #1a1a2e; background: #f5f6fa; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
a:focus-visible, button:focus-visible, .filter-btn:focus-visible, .btn:focus-visible {
    outline: 3px solid #5436FF; outline-offset: 2px; border-radius: 4px;
}
ul { list-style: none; }
img { max-width: 100%; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; scroll-margin-top: 80px; }
.section-alt { background: #fff; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    html { scroll-behavior: auto; }
}

/* ===== Header ===== */
.site-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: rgba(255,255,255,0.88); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(0,0,0,0.06); transition: box-shadow .3s;
}
.site-header.scrolled { box-shadow: 0 2px 32px rgba(0,0,0,0.06); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo { line-height: 1; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.logo-img { height: 50px; width: auto; display: block; transition: transform .3s; }
.logo:hover .logo-img { transform: scale(1.03); }
.logo-text {
    font-size: 1.05rem; font-weight: 300; color: #555;
    white-space: nowrap; letter-spacing: 1px;
    position: relative; padding-left: 12px; margin-left: 4px;
}
.logo-text::before {
    content: ''; position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 1px; height: 20px; background: #ddd;
}
.main-nav ul { display: flex; gap: 32px; }
.main-nav a {
    font-size: 0.95rem; font-weight: 500; color: #555;
    position: relative; transition: color .3s; padding: 4px 0;
}
.main-nav a::after {
    content: ''; position: absolute; bottom: -2px; left: 0; width: 0; height: 2px;
    background: #5436FF; transition: width .3s; border-radius: 2px;
}
.main-nav a:hover { color: #5436FF; }
.main-nav a:hover::after { width: 100%; }
.lang-switch {
    padding: 2px 10px; border-radius: 6px; border: 1.5px solid #5436FF;
    font-size: 0.83rem; font-weight: 600; color: #5436FF;
}
.lang-switch::after { display: none !important; }
.menu-toggle {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer; padding: 4px;
}
.menu-toggle span {
    display: block; width: 24px; height: 2px; background: #1a1a2e;
    border-radius: 2px; transition: all .3s;
}
.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

/* ===== Hero ===== */
.hero {
    padding: 150px 0 80px; text-align: center;
    background: linear-gradient(135deg, #f5f6fa 0%, #eef2ff 40%, #f0eaff 100%);
    position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; top: -40%; right: -15%; width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(84,54,255,0.07) 0%, transparent 70%);
    border-radius: 50%; pointer-events: none;
}
.hero::after {
    content: ''; position: absolute; bottom: -25%; left: -10%; width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255,107,53,0.05) 0%, transparent 70%);
    border-radius: 50%; pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }
.hero h1 { font-size: 3rem; font-weight: 800; line-height: 1.15; margin-bottom: 16px; }
.gradient-text {
    background: linear-gradient(135deg, #5436FF, #FF6B35);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p { font-size: 1.15rem; color: #666; max-width: 560px; margin: 0 auto 32px; }

.search-box {
    max-width: 500px; margin: 0 auto 28px;
}
.search-box input {
    width: 100%; padding: 14px 40px 14px 48px; border-radius: 50px;
    border: 2px solid #e0e0e0; background: #fff; font-size: 1rem;
    outline: none; transition: border-color .3s, box-shadow .3s;
}
.search-box input:focus { border-color: #5436FF; box-shadow: 0 0 0 4px rgba(84,54,255,0.1); }
.search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 1.2rem; pointer-events: none; }

.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 14px 32px; border-radius: 12px; font-weight: 600;
    font-size: 1rem; transition: all .3s; cursor: pointer; border: 2px solid transparent;
}
.btn-primary { background: #5436FF; color: #fff; box-shadow: 0 4px 20px rgba(84,54,255,0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(84,54,255,0.35); }
.btn-outline { border-color: #5436FF; color: #5436FF; background: transparent; }
.btn-outline:hover { background: #5436FF; color: #fff; }

.hero-stats { display: flex; justify-content: center; gap: 48px; margin-top: 48px; flex-wrap: wrap; }
.stat-item { text-align: center; }
.stat-num { font-size: 2.4rem; font-weight: 800; color: #5436FF; display: block; }
.stat-label { font-size: 0.9rem; color: #888; margin-top: 4px; }

/* ===== Section Header ===== */
.section-header { text-align: center; margin-bottom: 40px; }
.section-header h2 { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }
.section-header p { color: #888; font-size: 1.05rem; }

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 32px;
}
.filter-btn {
    padding: 8px 20px; border-radius: 20px; border: 1.5px solid #e8e8e8;
    background: #fff; font-size: 0.9rem; font-weight: 500; color: #666;
    cursor: pointer; transition: all .25s; -webkit-tap-highlight-color: transparent;
}
.filter-btn:hover { border-color: #5436FF; color: #5436FF; background: #f8f7ff; }
.filter-btn.active { background: #5436FF; color: #fff; border-color: #5436FF; }
.filter-btn:active { transform: scale(0.95); }

/* ===== Search clear ===== */
.search-box { position: relative; }
.search-clear {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; font-size: 1rem; color: #999;
    padding: 4px 8px; display: none; line-height: 1; z-index: 2;
}
.search-clear:hover { color: #333; }
.search-box input:not(:placeholder-shown) ~ .search-clear { display: block; }

/* ===== Filter transitions ===== */
.js-ready .tool-card.filtered, .js-ready .template-card.filtered { opacity: 0; pointer-events: none; }
.js-ready .tool-card, .js-ready .template-card { transition: all .3s cubic-bezier(0.22, 1, 0.36, 1), opacity .25s; }

/* ===== Result count ===== */
.result-count {
    text-align: center; font-size: 0.85rem; color: #999; padding: 8px 0 0;
    grid-column: 1 / -1; animation: fadeIn .3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Card reveal ===== */
.js-ready .tool-card, .js-ready .template-card {
    opacity: 0; transform: translateY(20px);
    transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1), transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.js-ready .tool-card.revealed, .js-ready .template-card.revealed {
    opacity: 1; transform: translateY(0);
}

/* ===== Tool Grid ===== */
.tool-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
}
.tool-card {
    background: #fff; border-radius: 14px; padding: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03), 0 1px 2px rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.04);
    transition: all .3s cubic-bezier(0.22, 1, 0.36, 1); position: relative; overflow: hidden;
    display: flex; flex-direction: column;
}
.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.03);
    border-color: rgba(84,54,255,0.08);
}
.card-badge {
    position: absolute; top: 12px; right: 12px;
    padding: 3px 12px; border-radius: 10px; font-size: 0.72rem; font-weight: 600; z-index: 2;
}
.card-badge.hot { background: #fee8e8; color: #c0392b; }
.card-badge.new { background: #e6f7e6; color: #27ae60; }
.card-icon {
    width: 100%; height: 76px; border-radius: 14px 14px 0 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; color: #fff; position: relative;
}
.card-icon::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 30px; background: linear-gradient(transparent, rgba(255,255,255,0.08));
}
.card-body { padding: 14px 18px 0; flex: 1; }
.card-body .title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body h3 { font-size: 1.05rem; font-weight: 700; }
.card-price {
    padding: 2px 10px; border-radius: 6px;
    font-size: 0.7rem; font-weight: 600; flex-shrink: 0;
}
.price-free { background: #e6f7e6; color: #27ae60; }
.price-freemium { background: #fef6e0; color: #d68910; }
.price-paid { background: #fde8e8; color: #c0392b; }
.card-body p {
    font-size: 0.85rem; color: #777; line-height: 1.5; margin: 10px 0 12px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: calc(1.5em * 2);
}
.card-tags {
    display: flex; gap: 6px; flex-wrap: wrap;
    min-height: 1.6em;
}
.card-tags span {
    padding: 2px 10px; border-radius: 8px; background: #f0f2ff; color: #5436FF;
    font-size: 0.72rem; font-weight: 500;
}
.card-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 18px 14px; border-top: 1px solid #f0f0f0;
}
.rating { font-size: 0.85rem; color: #f39c12; font-weight: 600; }
.btn-visit {
    padding: 6px 16px; border-radius: 8px; background: #f0f2ff; color: #5436FF;
    font-size: 0.83rem; font-weight: 600; transition: all .25s;
}
.btn-visit:hover { background: #5436FF; color: #fff; transform: translateX(2px); }

/* No results */
.no-results {
    display: none; text-align: center; padding: 60px 20px;
    color: #999; font-size: 1.1rem;
}
.no-results.show { display: block; grid-column: 1 / -1; }

/* ===== Template Grid ===== */
.template-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
}
.template-card {
    background: #fff; border-radius: 14px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.04);
    transition: all .3s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex; flex-direction: column;
}
.template-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.03);
    border-color: rgba(84,54,255,0.08);
}
.template-preview {
    height: 160px; display: flex; align-items: center; justify-content: center; position: relative;
    overflow: hidden; flex-shrink: 0;
}
.template-preview::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(transparent 60%, rgba(0,0,0,0.03));
    pointer-events: none;
}
.template-type {
    position: absolute; top: 12px; left: 12px;
    padding: 4px 14px; border-radius: 10px; background: rgba(255,255,255,0.9);
    font-size: 0.78rem; font-weight: 600; color: #333; backdrop-filter: blur(4px);
}
.preview-icon { font-size: 3rem; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1)); }
.template-info {
    padding: 16px 20px 20px;
    display: flex; flex-direction: column; flex: 1;
}
.template-info h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.template-info p { font-size: 0.85rem; color: #888; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex-shrink: 0; }
.template-meta { display: flex; gap: 20px; font-size: 0.82rem; color: #999; margin-bottom: 14px; flex-shrink: 0; }
.btn-download {
    display: block; text-align: center; padding: 10px; border-radius: 10px;
    background: #f0f2ff; color: #5436FF; font-weight: 600; font-size: 0.9rem; transition: all .25s;
    margin-top: auto;
}
.btn-download:hover { background: #5436FF; color: #fff; }

/* ===== Newsletter ===== */
.newsletter-section { background: linear-gradient(135deg, #5436FF 0%, #6c3fe0 50%, #764ba2 100%); }
.newsletter-inner { text-align: center; color: #fff; max-width: 520px; margin: 0 auto; }
.newsletter-inner h2 { font-size: 1.8rem; font-weight: 700; margin-bottom: 8px; }
.newsletter-inner p { font-size: 1rem; opacity: 0.9; margin-bottom: 28px; }
.newsletter-form { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.newsletter-form input {
    flex: 1; min-width: 220px; padding: 14px 20px; border-radius: 12px;
    border: none; font-size: 1rem; outline: none; background: rgba(255,255,255,0.95);
}
.newsletter-form input:focus { box-shadow: 0 0 0 3px rgba(255,255,255,0.3); }
.newsletter-form .btn { box-shadow: 0 4px 15px rgba(0,0,0,0.15); }

/* ===== About ===== */
.about-content {
    max-width: 720px; margin: 0 auto; text-align: center;
    font-size: 1rem; color: #666; line-height: 1.8;
}
.about-content p + p { margin-top: 16px; }

/* ===== Footer ===== */
.site-footer {
    background: #1a1a2e; color: #bbb; padding: 60px 0 0;
}
.footer-inner {
    display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; padding-bottom: 40px;
}
.footer-col h4 { color: #fff; font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; }
.footer-col p { font-size: 0.9rem; color: #999; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col a { font-size: 0.9rem; color: #999; transition: color .3s; }
.footer-col a:hover { color: #fff; }
.footer-logo { height: 34px; width: auto; }
.footer-bottom {
    grid-column: 1 / -1; text-align: center; padding: 20px 0;
    border-top: 1px solid rgba(255,255,255,0.06); font-size: 0.85rem; color: #666;
}

/* ===== Back to Top ===== */
.back-to-top {
    position: fixed; bottom: 30px; right: 30px; z-index: 999;
    width: 44px; height: 44px; border-radius: 50%;
    background: #5436FF; color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; box-shadow: 0 4px 20px rgba(84,54,255,0.3);
    opacity: 0; visibility: hidden; transform: translateY(10px) scale(0.9);
    transition: all .3s; -webkit-tap-highlight-color: transparent;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.back-to-top:hover { transform: translateY(-3px) scale(1.05); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .hero h1 { font-size: 2.4rem; }
    .hero-stats { gap: 32px; }
    .stat-num { font-size: 2rem; }
    .footer-inner { gap: 28px; }
}
@media (max-width: 768px) {
    .hero { padding: 120px 0 60px; }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    .hero-stats { gap: 24px; }
    .stat-num { font-size: 1.8rem; }
    .section { padding: 60px 0; }
    .section-header h2 { font-size: 1.6rem; }
    .tool-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .template-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .footer-inner { grid-template-columns: 1fr; text-align: center; gap: 24px; }
    .main-nav {
        position: fixed; top: 72px; left: 0; right: 0; background: #fff;
        padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        transform: translateY(-120%); opacity: 0; transition: all .3s;
        border-radius: 0 0 16px 16px;
    }
    .main-nav.open { transform: translateY(0); opacity: 1; }
    .main-nav ul { flex-direction: column; gap: 16px; align-items: center; }
    .menu-toggle { display: flex; }
    .filter-bar { gap: 6px; overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
    .filter-btn { font-size: 0.8rem; padding: 5px 12px; white-space: nowrap; }
    .card-body { padding: 10px 14px 0; }
    .card-body p { font-size: 0.82rem; margin: 8px 0 10px; }
    .card-tags span { font-size: 0.68rem; padding: 1px 8px; }
    .card-footer { padding: 8px 14px 12px; flex-wrap: wrap; gap: 6px; }
    .card-icon { height: 60px; font-size: 1.6rem; }
    .template-preview { height: 120px; }
    .preview-icon { font-size: 2.2rem; }
    .template-info { padding: 12px 16px 16px; }
    .template-info p { font-size: 0.82rem; }
    .search-box input { font-size: 0.9rem; padding: 12px 38px 12px 42px; }
    .search-clear { padding: 6px 10px; font-size: 1.1rem; right: 8px; }
    .search-icon { left: 14px; font-size: 1rem; }
    .back-to-top { bottom: 20px; right: 20px; width: 40px; height: 40px; font-size: 1.1rem; }
    .newsletter-form { flex-direction: column; }
    .newsletter-form input { min-width: auto; }
    .newsletter-inner h2 { font-size: 1.5rem; }
    .container { padding: 0 16px; }
}
@media (max-width: 480px) {
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 0.92rem; }
    .hero-actions { flex-direction: column; align-items: center; }
    .hero-actions .btn { width: 100%; max-width: 100%; padding: 12px 24px; }
    .hero-stats { gap: 16px; }
    .stat-num { font-size: 1.5rem; }
    .stat-label { font-size: 0.78rem; }
    .tool-grid { grid-template-columns: 1fr; gap: 14px; }
    .template-grid { grid-template-columns: 1fr; gap: 14px; }
    .card-body { padding: 8px 12px 0; }
    .card-body p { font-size: 0.8rem; }
    .card-footer { padding: 6px 12px 10px; }
    .card-icon { height: 52px; font-size: 1.4rem; }
    .template-preview { height: 100px; }
    .template-info { padding: 10px 14px 14px; }
    .template-type { font-size: 0.72rem; padding: 3px 10px; top: 8px; left: 8px; }
    .section-header h2 { font-size: 1.4rem; }
    .section { padding: 48px 0; }
    .section-header { margin-bottom: 24px; }
    .filter-btn { font-size: 0.75rem; padding: 4px 10px; }
    .logo-text { display: none; }
    .btn { padding: 12px 24px; font-size: 0.9rem; }
    .newsletter-inner h2 { font-size: 1.3rem; }
    .container { padding: 0 12px; }
}
@media (max-width: 360px) {
    .hero h1 { font-size: 1.3rem; }
    .stat-num { font-size: 1.3rem; }
    .filter-btn { font-size: 0.7rem; padding: 3px 8px; }
    .card-body h3 { font-size: 0.95rem; }
    .template-info h3 { font-size: 0.95rem; }
}
