* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: #f5f6f8;
    color: #1f2328
}

.page-header {
    background: transparent;
    padding: 24px 16px 20px;
    border: 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
}

.product-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1f2328;
    display: flex;
    align-items: center;
    gap: 8px
}

.author-tag {
    font-size: 16px;
    color: #57606a;
    font-weight: normal;
    margin-left: 4px;
}

.title-icon {
    font-size: 26px
}

.product-subtitle {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    color: #57606a
}

.app {
    display: flex;
    gap: 16px;
    max-width: 1200px;
    margin: 20px auto 24px;
    padding: 0 16px
}

.panel {
    flex: 1
}

.left {
    max-width: 420px
}

.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(31, 35, 40, .08);
    padding: 24px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column
}

.card.full-height {
    height: 100%;
}

.section-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-divider {
    height: 1px;
    background: #e1e4e8;
    margin: 24px 0;
    width: 100%;
}

.card-title {
    font-weight: 600;
    margin-bottom: 12px
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0b5bd3;
    color: #fff;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 500;
    transition: background .2s
}

.upload-btn:hover {
    background: #094cb3
}

.upload-btn.large {
    display: flex;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px;
    width: auto;
    min-width: 160px;
}

.upload-btn input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0
}

.upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    border: 1px dashed #d0d7de;
    border-radius: 8px;
    background: #f6f8fa;
}

.file-info {
    margin-top: 0;
    font-size: 13px;
    color: #57606a
}

.file-info.empty {
    color: #8c959f
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.icon-btn {
    background: transparent;
    border: 0;
    padding: 4px;
    color: #57606a;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.icon-btn:hover {
    background: #f3f4f6;
    color: #1f2328;
}

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

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

.inline {
    display: flex;
    align-items: center;
    gap: 6px
}

.unit {
    color: #6e7781
}

input[type=number],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    background: #fff;
    font-size: 14px
}

input[type=color] {
    width: 100%;
    padding: 4px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    height: 40px;
    cursor: pointer
}

textarea {
    resize: vertical
}

.actions {
    display: flex;
    gap: 12px;
    margin-top: 12px
}

button {
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer
}

.primary {
    background: #0b5bd3;
    color: #fff
}

.ghost {
    background: #eef2f7;
    color: #0b5bd3
}

.right {
    flex: 1
}

.preview {
    border-radius: 12px;
    background: #f6f8fa;
    border: 1px dashed #d0d7de;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 480px;
    overflow: hidden
}

#previewCanvas {
    max-width: 100%;
    height: auto;
    display: block
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: #2da44e;
    color: #fff;
    padding: 10px 16px;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .15);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s
}

.toast.show {
    opacity: 1
}

.warn {
    margin-top: 8px;
    color: #d1242f;
    font-size: 12px;
    min-height: 16px
}

.color-field {
    width: 100%;
    height: 36px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    cursor: pointer;
    position: relative
}

.checker {
    background-image: linear-gradient(45deg, #e6e8ea 25%, transparent 25%), linear-gradient(-45deg, #e6e8ea 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e6e8ea 75%), linear-gradient(-45deg, transparent 75%, #e6e8ea 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0
}

.color-overlay {
    position: absolute;
    inset: 0;
    border-radius: 8px
}

.hidden-color {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none
}

.color-host {
    position: relative
}

.popover {
    position: absolute;
    z-index: 20;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
    padding: 12px;
    min-width: 260px
}

.popover.hidden {
    display: none
}

.popover .row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
    flex-direction: column
}

.popover .row.slider-row {
    flex-direction: row;
    align-items: center
}

.popover .row.end {
    justify-content: flex-end;
    margin-bottom: 0
}

.color-picker-gradient {
    width: 100%;
    height: 150px;
    background: linear-gradient(to bottom, transparent, #000), linear-gradient(to right, #fff, red);
    border-radius: 6px;
    position: relative;
    cursor: crosshair;
    margin-bottom: 10px
}

.color-picker-hue {
    width: 100%;
    height: 12px;
    background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    margin-bottom: 10px
}

.picker-cursor {
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0, 0, 0, .5);
    position: absolute;
    pointer-events: none;
    transform: translate(-50%, -50%)
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px
}

.slider-row .label-text {
    color: #6e7781;
    font-size: 13px;
    min-width: 50px
}

.slider-row .value-text {
    color: #6e7781;
    font-size: 13px;
    min-width: 35px;
    text-align: right
}

.slider-row input[type=range] {
    flex: 1
}

.rgb-inputs {
    display: flex;
    gap: 8px
}

.rgb-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px
}

.rgb-input-group label {
    font-size: 11px;
    color: #6e7781;
    text-align: center;
    font-weight: 600
}

.rgb-input-group input {
    width: 100%;
    padding: 6px 4px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    text-align: center;
    font-size: 13px
}

@media (max-width:980px) {
    .app {
        flex-direction: column
    }

    .left {
        max-width: none
    }
}