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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: #fff;
    color: #000;
    line-height: 1.6;
}

.card {
    border: 1px solid #ddd;
    background: #fff;
    padding: 24px;
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.section-header p {
    font-size: 13px;
    color: #666;
}

.mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.mode-tab {
    appearance: none;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #666;
    padding: 0 0 12px;
    margin-bottom: -1px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.mode-tab.is-active {
    color: #000;
    border-color: #000;
}

.mode-tab:hover {
    color: #000;
}

.mode-panel {
    display: none;
    gap: 16px;
}

.mode-panel.is-active {
    display: grid;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: #333;
}

textarea {
    width: 100%;
    min-height: 180px;
    border: 1px solid #ccc;
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: #fff;
}

textarea:focus {
    outline: none;
    border-color: #999;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.04);
}

.file-input {
    display: none;
}

.upload-drop {
    border: 2px dashed #d1d5db;
    background: #fafafa;
    padding: 48px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-drop:hover,
.upload-drop:focus-visible,
.upload-drop.is-dragover {
    border-color: #000;
    background: #f4f4f4;
    outline: none;
}

.drop-message {
    display: grid;
    gap: 6px;
}

.drop-title {
    font-size: 17px;
    font-weight: 600;
    color: #000;
    word-break: break-word;
}

.drop-desc {
    font-size: 13px;
    color: #666;
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.status {
    min-height: 20px;
    margin-top: 16px;
    font-size: 13px;
    color: #555;
}

.status.is-error {
    color: #b30000;
}

.status.is-success {
    color: #1a7f37;
}

.preview-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.canvas-wrap {
    width: min(100%, 200px);
    min-height: 200px;
    margin: 0 auto;
    position: relative;
    display: grid;
    place-items: center;
    background: #fff;
}

.canvas-wrap.is-empty canvas {
    opacity: 0;
}

.empty-state {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 12px;
    border: 1px dashed #ddd;
    background: #fafafa;
    transition: opacity 0.2s ease;
}

.canvas-wrap:not(.is-empty) .empty-state {
    opacity: 0;
    pointer-events: none;
}

.empty-state strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #000;
}

.empty-state span {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #666;
    line-height: 1.6;
}

canvas {
    width: 200px;
    height: 200px;
    display: block;
    background: #fff;
    border: 1px solid #eee;
    image-rendering: pixelated;
}

.preview-actions {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.preview-content {
    display: grid;
    gap: 4px;
    margin-top: 12px;
    justify-items: center;
    text-align: center;
}

.meta-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.meta-value {
    font-size: 14px;
    color: #000;
    line-height: 1.6;
    word-break: break-all;
    white-space: pre-wrap;
    text-align: center;
}

.hidden-canvas {
    display: none;
}

@media (max-width: 768px) {
    .card {
        padding: 20px;
    }

    .section-header {
        flex-direction: column;
    }

    .mode-tabs {
        flex-direction: column;
    }

    .mode-tab {
        width: 100%;
    }

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

    .preview-stage {
        padding: 16px;
    }

    .canvas-wrap {
        width: min(100%, 200px);
        min-height: 200px;
    }

    .actions-row {
        flex-direction: column;
    }

    .actions-row .btn,
    .preview-actions .btn {
        width: 100%;
    }
}
