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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-light: #64748b;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image:
    linear-gradient(to right, rgba(11, 11, 11, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
background-size: 20px 20px;
background-position: 0 0, 0 0;
}

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

/* Header */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 24px 0;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-title {
    flex: 1;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.logo img{
    width: 40px;
    height: 40px;
    display: inline-block;
    vertical-align: middle;
}

.catchphrase {
    color: var(--text-light);
    font-size: 0.95rem;
}

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

.nav-link {
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

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

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

/* Main Content */
main {
    flex: 1;
    padding: 32px 20px;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.section-header {
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

/* Editor Section */
.editor-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--background);
}

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

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #eef2ff;
    transform: scale(1.02);
}

.upload-content svg {
    color: var(--primary-color);
    margin-bottom: 16px;
}

.upload-content p {
    margin: 8px 0;
    color: var(--text);
    font-weight: 500;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--text-light);
}

.upload-formats {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 12px;
}

/* Canvas Container */
.canvas-container {
    margin-bottom: 20px;
}

#mainCanvas {
    width: 100%;
    max-width: 512px;
    aspect-ratio: 1;
    height: auto;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    cursor: crosshair;
    display: block;
    margin: 0 auto;
    box-shadow: var(--shadow);
}

#mainCanvas.transparent-bg {
    background-image:
        repeating-conic-gradient(#f0f0f0 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
}

.canvas-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

/* Tool Panel */
.tool-panel {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: 20px;
}

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

.tool-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.tool-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tool-btn {
    padding: 12px 16px;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

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

#brushSize {
    width: 100%;
    margin: 8px 0;
}

#brushSizeValue {
    display: inline-block;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-left: 8px;
}

#colorPicker {
    width: 100%;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* Background Selector */
.bg-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.bg-select-btn {
    padding: 8px 16px;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

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

.bg-select-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

#customBgColor {
    width: 50px;
    height: 36px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.bg-selector.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.bg-select-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#customBgColor:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Text Input */
#textInput {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    margin-top: 4px;
}

#textInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

#fontSize {
    width: 100%;
    margin: 8px 0;
}

#fontSizeValue {
    display: inline-block;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-left: 8px;
}

/* Preview Section */
.preview-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 20px;
}

.section-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

/* Size Selection */
.size-selection {
    margin-bottom: 24px;
}

.size-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.size-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface);
}

.size-option:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.size-option input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.size-option input[type="checkbox"]:checked+span {
    color: var(--primary-color);
    font-weight: 600;
}

.size-option:has(input:checked) {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

/* Preview Area */
.preview-area {
    margin-bottom: 24px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.preview-item {
    text-align: center;
}

.preview-size {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 8px;
    font-weight: 500;
}

.preview-box {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        repeating-conic-gradient(#f8f8f8 0% 25%, white 0% 50%) 50% / 20px 20px;
    overflow: hidden;
}

.preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.download-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Footer */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: auto;
    text-align: center;
}

footer p {
    color: var(--text-light);
    font-size: 0.875rem;
    margin: 4px 0;
}

.footer-links {
    margin-top: 8px;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .preview-section {
        position: static;
    }
}

@media (max-width: 640px) {
    header h1 {
        font-size: 1.5rem;
    }

    .size-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .preview-grid {
        grid-template-columns: 1fr;
    }

    .tool-buttons {
        flex-wrap: wrap;
    }
}

/* Page Content Styles */
.page-content {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

.page-content h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.page-description {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 32px;
}

.content-section {
    background: var(--surface);
    border-radius: 8px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.content-section section {
    margin-bottom: 32px;
}

.content-section section:last-child {
    margin-bottom: 0;
}

.content-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.content-section h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    margin-top: 16px;
}

.content-section p {
    margin-bottom: 12px;
    line-height: 1.8;
}

.content-section ul,
.content-section ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

.content-section li {
    margin-bottom: 8px;
    line-height: 1.8;
}

.content-section strong {
    color: var(--text);
    font-weight: 600;
}

.required {
    color: #ef4444;
}

/* Contact Form */
.contact-form-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-top: 32px;
}

.contact-form {
    background: var(--surface);
    border-radius: 8px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.contact-info {
    background: var(--surface);
    border-radius: 8px;
    padding: 32px;
    box-shadow: var(--shadow);
    height: fit-content;
}

.contact-info h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

/* Code Block */
.code-block {
    background: #1e293b;
    border-radius: 6px;
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
}

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

.code-block code {
    color: #e2e8f0;
}

/* Step List */
.step-list {
    counter-reset: step-counter;
    list-style: none;
    margin-left: 0;
}

.step-list li {
    counter-increment: step-counter;
    margin-bottom: 24px;
    padding-left: 48px;
    position: relative;
}

.step-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--primary-color);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.step-list li strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.step-list li ul {
    margin-top: 8px;
    margin-left: 24px;
}

/* Tool Guide */
.tool-guide {
    background: var(--background);
    border-left: 4px solid var(--primary-color);
    padding: 16px 20px;
    margin-bottom: 16px;
    border-radius: 4px;
}

.tool-guide h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.tool-guide p {
    margin-bottom: 0;
}

/* FAQ */
.faq-item {
    background: var(--background);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
}

.faq-item h4 {
    margin-top: 0;
    color: var(--primary-color);
}

.faq-item p {
    margin-bottom: 0;
}

.last-updated {
    text-align: right;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .contact-form-container {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 0 16px;
    }

    .content-section {
        padding: 24px;
    }

    .main-nav {
        margin-top: 16px;
        width: 100%;
    }
}