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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --secondary-color: #a78bfa;
    --accent-color: #fbbf24;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    transition: background-color 0.3s;
}

.header-wrapper {
    width: 100%;
    background: var(--card-bg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    gap: 24px;
    flex-wrap: wrap;
    max-width: 1400px;
    margin: 0 auto;
}

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

/* Theme Toggle */
.theme-switch {
    display: flex;
    align-items: center;
}

.theme-toggle-btn {
    width: 44px;
    height: 44px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    background: var(--card-bg);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.theme-icon {
    font-size: 20px;
    position: absolute;
    transition: all 0.3s ease;
}

.theme-icon.sun {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

.theme-icon.moon {
    opacity: 0;
    transform: translateY(20px) rotate(180deg);
}

[data-theme="dark"] .theme-icon.sun {
    opacity: 0;
    transform: translateY(-20px) rotate(-180deg);
}

[data-theme="dark"] .theme-icon.moon {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

/* Language Select */
.lang-switch {
    display: flex;
    gap: 8px;
    align-items: center;
}

.lang-select {
    padding: 8px 36px 8px 12px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.lang-select:hover {
    border-color: var(--primary-color);
}

.lang-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

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

.cta-btn {
    background: var(--primary-color);
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    transition: background 0.3s;
}

.cta-btn:hover {
    background: var(--primary-dark);
    color: white;
}

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

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

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 20px;
    margin-bottom: 32px;
    opacity: 0.95;
}

.hero-features {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.hero-feature {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 500;
}

.hero-cta {
    display: inline-block;
    background: white;
    color: var(--primary-color);
    padding: 16px 40px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 18px;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s, box-shadow 0.3s;
}

.hero-cta:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

[data-theme="dark"] .hero-cta {
    background: var(--card-bg);
}

/* Hero Grid Maker */
.hero-grid-maker {
    margin-top: 40px;
}

.hero-grid-maker .controls-panel {
    background: rgba(255, 255, 255, 0.98);
}

.hero-grid-maker .preview-panel {
    background: rgba(255, 255, 255, 0.98);
}

[data-theme="dark"] .hero-grid-maker .controls-panel {
    background: rgba(30, 41, 59, 0.98);
}

[data-theme="dark"] .hero-grid-maker .preview-panel {
    background: rgba(30, 41, 59, 0.98);
}

/* Section Styles */
section {
    padding: 80px 0;
}

.section-title {
    font-size: 36px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 48px;
    color: var(--text-primary);
}

.section-intro {
    font-size: 18px;
    color: var(--text-secondary);
    text-align: center;
    max-width: 900px;
    margin: 0 auto 40px;
}

/* Features Section */
.features-section {
    background: var(--card-bg);
    transition: background-color 0.3s;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.feature-card {
    background: var(--bg-color);
    padding: 32px;
    border-radius: 16px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.feature-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.feature-desc {
    color: var(--text-secondary);
}

/* How It Works Section */
.how-it-works-section {
    background: var(--bg-color);
}

.highlight-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 32px;
    border-radius: 16px;
    margin: 32px auto;
    max-width: 800px;
    text-align: center;
}

.highlight-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #92400e;
}

.highlight-text {
    color: #78350f;
    font-size: 16px;
}

/* Benefits Section */
.benefits-section {
    background: white;
}

.benefits-list {
    max-width: 800px;
    margin: 0 auto 48px;
    display: grid;
    gap: 16px;
}

.benefit-item {
    padding: 16px 24px;
    background: var(--bg-color);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.use-cases-title {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
}

.use-cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
}

.use-case {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
}

/* Grid Maker Section */
.grid-maker-section {
    background: var(--bg-color);
}

.grid-maker-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 32px;
    max-width: 1100px;
    margin: 0 auto;
}

.controls-panel {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    height: fit-content;
    transition: background-color 0.3s;
}

.control-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: var(--card-bg);
    color: var(--text-primary);
}

.controls-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
}

.control-group {
    margin-bottom: 20px;
}

.control-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.control-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.control-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.color-input {
    height: 44px;
    padding: 4px;
}

.range-input {
    width: 100%;
    margin-top: 8px;
    cursor: pointer;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    -webkit-appearance: none;
    appearance: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: transform 0.2s;
}

.range-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.range-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
}

.range-input::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.control-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
}

.control-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.file-input {
    padding: 10px;
    border: 2px dashed var(--border-color);
    background: var(--bg-color);
    cursor: pointer;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.preview-panel {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    transition: background-color 0.3s;
}

.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background: repeating-conic-gradient(#e2e8f0 0% 25%, #f1f5f9 0% 50%) 50% / 20px 20px;
    border-radius: 12px;
    overflow: auto;
}

[data-theme="dark"] .canvas-container {
    background: repeating-conic-gradient(#1e293b 0% 25%, #0f172a 0% 50%) 50% / 20px 20px;
}

#gridCanvas {
    max-width: 100%;
    height: auto;
}

/* Keywords Section */
.keywords-section {
    background: var(--card-bg);
    padding: 40px 0;
    transition: background-color 0.3s;
}

.keywords-title {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.keyword {
    background: var(--bg-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
}

/* CTA Section */
.cta-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.cta-section .section-title {
    color: white;
}

.cta-text {
    font-size: 18px;
    margin-bottom: 32px;
    opacity: 0.95;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 60px 0 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.footer-text {
    color: rgba(255, 255, 255, 0.8);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-link:hover {
    color: white;
}

.footer-bottom {
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.copyright {
    color: rgba(255, 255, 255, 0.7);
}

/* Responsive */
@media (max-width: 968px) {
    .grid-maker-container {
        grid-template-columns: 1fr;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .section-title {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero {
        padding: 60px 0;
    }
    
    .hero-title {
        font-size: 28px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    section {
        padding: 50px 0;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}