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

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #21222c;
}

::-webkit-scrollbar-thumb {
    background: #44475a;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6272a4;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #282a36;
    min-height: 100vh;
    overflow: auto;
    color: #f8f8f2;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    margin: 0;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    width: 1120px;
    height: auto;
}

.header-section {
    padding: 30px 35px 20px 35px;
    background: #282a36;
    position: relative;
}

.separator-line {
    height: 2px;
    background: #44475a;
    width: 100%;
}

.main-wrapper {
    display: grid;
    grid-template-columns: 350px 420px 350px;
    flex: none;
    gap: 0;
    overflow: hidden;
    border-left: 2px solid #44475a;
    border-right: 2px solid #44475a;
}

.tutorial-panel {
    background: #21222c;
    padding: 25px 30px 25px 35px;
    overflow-y: auto;
    border-right: 2px solid #44475a;
    display: flex;
    flex-direction: column;
}

.form-panel {
    background: #282a36;
    padding: 25px 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 2px solid #44475a;
}

.form-content {
    display: flex;
    flex-direction: column;
}

.preview-panel {
    background: #21222c;
    padding: 25px 35px 25px 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

h1 {
    text-align: center;
    color: #ff79c6;
    font-size: 28px;
    margin-bottom: 8px;
    margin-top: 0;
}

.subtitle {
    text-align: center;
    color: #6272a4;
    margin-bottom: 0;
    font-size: 14px;
}

.tutorial-panel h2,
.form-panel h2,
.preview-panel h2 {
    color: #ff79c6;
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
    margin-top: 0;
}

.form-section {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #f8f8f2;
    font-size: 14px;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 350px;
    padding: 8px 12px;
    border: 2px solid #44475a;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
    background: #21222c;
    color: #f8f8f2;
}

input[type="color"] {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 2px solid #44475a;
    border-radius: 6px;
    background: #21222c;
    cursor: pointer;
}

input[type="color"]:focus {
    outline: none;
    border-color: #bd93f9;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.color-label {
    font-size: 12px;
    color: #6272a4;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #bd93f9;
}

textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 100px;
    font-family: 'Consolas', 'Courier New', monospace;
}

.preview-panel input[type="text"] {
    width: 100%;
}

.radio-group {
    display: flex;
    gap: 25px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
    color: #f8f8f2;
    font-size: 14px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
    color: #f8f8f2;
    font-size: 14px;
}

.radio-label input[type="radio"] {
    width: auto;
    cursor: pointer;
    accent-color: #ff79c6;
    transform: scale(1.2);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
    accent-color: #ff79c6;
    transform: scale(1.2);
}

.inline-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.inline-group input {
    width: 165px;
}

.inline-group span {
    font-weight: bold;
    font-size: 16px;
}

.preview-container {
    width: 100%;
    height: 280px;
    margin: 8px 0;
    border: 2px solid #44475a;
    border-radius: 4px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
}

#preview-canvas {
    width: 100%;
    height: 100%;
    image-rendering: auto;
}

.preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
}

.preview-modal.is-open {
    display: flex;
}

.preview-modal-content {
    position: relative;
    background: #1b1c25;
    border: 2px solid #44475a;
    border-radius: 10px;
    padding: 16px;
    max-width: min(90vw, 900px);
    max-height: min(90vh, 900px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-modal-content img {
    width: min(900px, 90vw);
    height: min(900px, 90vh);
    object-fit: contain;
    image-rendering: pixelated;
}

.preview-modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: #44475a;
    color: #f8f8f2;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 32px;
}

.preview-modal-close:hover {
    background: #ff79c6;
    color: #282a36;
}

.button-group {
    display: flex;
    justify-content: stretch;
    gap: 10px;
    margin: 18px 0 12px 0;
}

.btn-primary {
    background: linear-gradient(135deg, #ff79c6 0%, #bd93f9 100%);
    color: #282a36;
    border: none;
    padding: 8px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(255, 121, 198, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#progress-section {
    margin: 12px 0;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #44475a;
    border: 2px solid #6272a4;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #ff79c6 0%, #bd93f9 100%);
    width: 0%;
    transition: width 0.3s;
}

.status-text {
    text-align: left;
    color: #6272a4;
    font-size: 13px;
}

.tutorial-content {
    margin-bottom: auto;
    flex: 1;
}

.step {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.step-number {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #ff79c6 0%, #bd93f9 100%);
    color: #282a36;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.step-text {
    flex: 1;
}

.step-text strong {
    color: #8be9fd;
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.step-text p {
    color: #6272a4;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

code {
    background: #44475a;
    color: #50fa7b;
    padding: 3px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 11px;
    white-space: nowrap;
    display: inline-block;
}

.jimi-link {
    position: fixed;
    top: 15px;
    right: 15px;
    opacity: 0.7;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

.jimi-link:hover {
    opacity: 1;
    transform: scale(1.05);
}

.jimi-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #44475a;
    transition: border-color 0.3s;
    background: #44475a;
}

.jimi-link:hover .jimi-img {
    border-color: #ff79c6;
}

small {
    display: block;
    margin-top: 6px;
    color: #6272a4;
    font-size: 12px;
}

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

input[type="file"] {
    width: 350px;
    padding: 8px;
    border: 2px dashed #bd93f9;
    border-radius: 4px;
    background: #21222c;
    color: #f8f8f2;
    cursor: pointer;
    font-size: 13px;
}

input[type="file"]:hover {
    background: #44475a;
    border-color: #ff79c6;
}

input[type="file"]::file-selector-button {
    background: #44475a;
    color: #f8f8f2;
    border: 1px solid #6272a4;
    padding: 5px 12px;
    border-radius: 3px;
    cursor: pointer;
    margin-right: 10px;
    font-size: 13px;
}

input[type="file"]::file-selector-button:hover {
    background: #6272a4;
}

.uploaded-fonts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.font-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: linear-gradient(135deg, #ff79c6 0%, #bd93f9 100%);
    color: #282a36;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
}

.font-badge-remove {
    cursor: pointer;
    font-weight: bold;
    padding: 0 4px;
    border-radius: 50%;
    background: rgba(40, 42, 54, 0.3);
    transition: background 0.2s;
}

.font-badge-remove:hover {
    background: rgba(40, 42, 54, 0.6);
}

.queue-list {
    max-height: 150px;
    min-height: 50px;
    overflow-y: auto;
    border: 1px solid #44475a;
    border-radius: 6px;
    padding: 8px;
    background: #282a36;
    margin-bottom: 12px;
}

.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #21222c;
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 13px;
}

.queue-item:last-child {
    margin-bottom: 0;
}

.queue-item-text {
    flex: 1;
    color: #f8f8f2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-item-remove {
    background: #ff5555;
    color: #f8f8f2;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
    line-height: 1;
}

.queue-item-remove:hover {
    background: #ff6e6e;
}

.btn-secondary {
    background: #6272a4;
    color: #f8f8f2;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-secondary:hover {
    background: #7586b8;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(98, 114, 164, 0.4);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-secondary:disabled {
    background: #44475a;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-danger {
    background: #ff5555;
    color: #f8f8f2;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #ff6e6e;
}

.btn-success {
    background: #50fa7b;
    color: #282a36;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-success:hover {
    background: #6bff92;
}

.btn-success:disabled {
    background: #44475a;
    color: #6272a4;
    cursor: not-allowed;
}

@media (max-width: 1024px) {
    .main-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        overflow: visible;
    }
    
    .tutorial-panel {
        border-right: none;
        border-bottom: 2px solid #44475a;
    }

    .form-panel {
        border-right: none;
        border-bottom: 2px solid #44475a;
    }

    .preview-panel {
        border-right: none;
    }

    .tutorial-panel,
    .form-panel,
    .preview-panel {
        overflow: visible;
    }

    .page-wrapper {
        width: 100%;
    }

    input[type="text"],
    input[type="number"],
    select,
    textarea,
    input[type="file"] {
        width: 100%;
    }

    .inline-group input {
        width: 100%;
        flex: 1;
    }

    .preview-container {
        height: 240px;
    }
    
    body {
        overflow-y: auto;
    }
}
