:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-light);
    font-size: 1.1rem;
}

.generator-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    border: 1px solid var(--border);
    margin-bottom: 3rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background-color: #eff6ff;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-light);
}

.upload-placeholder svg {
    color: var(--primary);
}

.upload-text strong {
    color: var(--primary);
}

.upload-hint {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Preview Section */
.preview-section {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    animation: fadeIn 0.3s ease;
}

@media (max-width: 640px) {
    .preview-section {
        grid-template-columns: 1fr;
    }
}

.preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: var(--bg);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.preview-box {
    width: 256px;
    /* CSS display size, canvas is usually larger logic */
    height: 256px;
    background-image:
        linear-gradient(45deg, #ddd 25%, transparent 25%),
        linear-gradient(-45deg, #ddd 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ddd 75%),
        linear-gradient(-45deg, transparent 75%, #ddd 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

#preview-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.control-group label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.toggle-group {
    display: flex;
    gap: 0.5rem;
    background: var(--bg);
    padding: 0.25rem;
    border-radius: 8px;
}

.toggle-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
}

.toggle-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="color"] {
    appearance: none;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border);
    border-radius: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    margin: 0 !important;
}

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

.primary-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

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

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.error-msg {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    text-align: center;
}

.info-section {
    text-align: center;
    margin-bottom: 3rem;
}

.features-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    color: var(--text-light);
}

/* FAQ Section */
.faq-section {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    border: 1px solid var(--border);
    margin-bottom: 3rem;
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.faq-item {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.faq-item p {
    color: var(--text-light);
    line-height: 1.6;
}

footer {
    margin-top: auto;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.footer-links {
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    margin: 0 1rem;
}

.footer-links a:hover {
    color: var(--primary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* How-To / Content Section */
.how-to-section {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    border: 1px solid var(--border);
    margin-bottom: 3rem;
}

.how-to-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.how-to-section h2:first-child {
    margin-top: 0;
}

.how-to-section p {
    color: var(--text-light);
    line-height: 1.75;
    margin-bottom: 1rem;
}

.install-steps {
    color: var(--text-light);
    line-height: 1.75;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.install-steps li {
    margin-bottom: 0.5rem;
}

.install-steps code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    font-size: 0.875em;
    font-family: 'Courier New', Courier, monospace;
    color: var(--text);
}

.code-block {
    background: #0f172a;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin: 1rem 0 1.5rem;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
}

.code-block code {
    color: #e2e8f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre;
}

/* Favicon Sizes Table */
.sizes-table-wrapper {
    overflow-x: auto;
    margin: 1rem 0 1.5rem;
}

.sizes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.sizes-table th {
    background: var(--bg);
    color: var(--text);
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border);
}

.sizes-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-light);
}

.sizes-table tr:last-child td {
    border-bottom: none;
}

.sizes-table tr:hover td {
    background: var(--bg);
}

/* Legal / About / Contact Pages */
.legal-page {
    display: flex;
    flex-direction: column;
}

.legal-header {
    margin-bottom: 2rem;
}

.legal-header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-top: 0.75rem;
    margin-bottom: 0;
    color: var(--text);
}

.legal-meta {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity: 0.75;
}

.legal-content {
    flex: 1;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 3rem;
}

.legal-content h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.legal-content h2:first-child {
    margin-top: 0;
}

.legal-content p {
    color: var(--text-light);
    line-height: 1.75;
    margin-bottom: 1rem;
}

.legal-content ul,
.legal-content ol {
    color: var(--text-light);
    line-height: 1.75;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.legal-content li {
    margin-bottom: 0.4rem;
}

.legal-content a {
    color: var(--primary);
    text-decoration: none;
}

.legal-content a:hover {
    text-decoration: underline;
}

.legal-content code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    font-size: 0.875em;
    font-family: 'Courier New', Courier, monospace;
    color: var(--text);
}

/* Contact Card */
.contact-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1.5rem 0 2rem;
}

.contact-icon {
    color: var(--primary);
    flex-shrink: 0;
}

.contact-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin: 0 0 0.25rem !important;
}

.contact-email {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--primary) !important;
    text-decoration: none;
}

.contact-email:hover {
    text-decoration: underline !important;
}