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

body {
    font-family: "Microsoft YaHei", system-ui, sans-serif;
    background: #f5f7fa;
    color: #333
}

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

h1 {
    text-align: center;
    margin: 30px 0;
    color: #2563eb;
    font-size: 28px
}

.upload-area {
    border: 4px dashed #3b82f6;
    border-radius: 16px;
    padding: 100px 20px;
    text-align: center;
    background: #eff6ff;
    cursor: pointer;
    transition: .3s;
    font-size: 19px;
}

.upload-area:hover {
    background: #dbeafe
}

.hidden {
    display: none
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
}

.toolbar select,
.toolbar input[type="color"] {
    padding: 11px 16px;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-size: 15px;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
}

.btn-group button {
    background: #2563eb;
    color: #fff;
    padding: 11px 18px;
    border-radius: 10px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    min-width: 110px;
}

.btn-group button:hover {
    background: #1d4ed8
}

.btn-group button:disabled {
    opacity: 0.6;
    cursor: not-allowed
}

.canvas-box {
    position: relative;
    width: 520px;
    height: 680px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    background: #fff;
}

#canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: grab
}

#canvas:active {
    cursor: grabbing
}

#frame {
    position: absolute;
    border: 3px solid rgba(59, 130, 246, 0.8);
    pointer-events: none;
    box-shadow: inset 0 0 0 3px #fff;
}

#loading {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

.tip {
    text-align: center;
    margin-top: 25px;
    color: #64748b;
    font-size: 15px
}

@media (max-width:600px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch
    }

    .btn-group {
        justify-content: center
    }

    .btn-group button {
        font-size: 16px !important;
        padding: 14px !important
    }
}