/* 在线涂色画板 - 作用域样式（仅影响 .coloring-app 内） */
.coloring-app {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%
}

.coloring-app * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent
}

.coloring-app button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit
}

.coloring-app {
    --ink: #453a30;
    --muted: #8a7a6b;
    --coral: #ff7a59;
    --coral-d: #f2613c;
    --paper: #ffffff;
    --bg1: #fff8e7;
    --bg2: #ffedf3;
    --shadow: 0 10px 30px rgba(120, 90, 60, .12);
}

.coloring-app .wrap {
    max-width: 100%;
    margin: 0 auto;
    padding: 0
}

.coloring-app .chip {
    background: #fff;
    border: 2px solid #ffe0cf;
    border-radius: 999px;
    padding: 5px 15px;
    font-size: 14px;
    font-weight: 600;
    transition: .15s;
}

.coloring-app .chip:hover {
    transform: translateY(-2px)
}

.coloring-app .chip:active {
    transform: translateY(1px);
    box-shadow: none
}

.coloring-app .panel {
    background: var(--paper);
    border-radius: 0.6em;
    box-shadow: var(--shadow);
    border: 2px solid #fff;
}

.coloring-app .gallery {
    padding: 14px 16px 16px;
    margin-bottom: 16px
}

.coloring-app .gallery-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.coloring-app .section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 900;
    margin: 0
}

.coloring-app .section-title small {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
    margin-left: 6px
}

.coloring-app .gallery-nav {
    display: flex;
    gap: 9px;
    flex: 0 0 auto
}

.coloring-app .cards {
    min-width: 0;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 16px 14px 12px;
    scrollbar-width: thin;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    cursor: grab;
}

.coloring-app .cards:active {
    cursor: grabbing
}

.coloring-app .card {
    flex: 0 0 118px;
    background: #fffdf8;
    border: 2px solid #f3e8dd;
    border-radius: 10px;
    padding: 8px 8px 10px;
    text-align: center;
    transition: .18s;
    position: relative;
    scroll-snap-align: start;
    user-select: none;
    outline: none;
}

.coloring-app .card:hover {
    transform: translateY(-4px);
    border-color: #ffc9ae
}

.coloring-app .card.active {
    border-color: var(--coral);
    background: #fff6f1;
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(255, 122, 89, .25)
}

.coloring-app .card.active::after {
    content: "✓";
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--coral);
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    display: grid;
    place-items: center;
    box-shadow: 0 2px 6px rgba(255, 122, 89, .5);
}

.coloring-app .card img {
    width: 100%;
    height: 86px;
    display: block;
    object-fit: contain;
    pointer-events: none
}

.coloring-app .card span {
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-top: 6px;
    white-space: nowrap
}

.coloring-app .workspace {
    display: grid;
    grid-template-columns:minmax(0, 1fr) 296px;
    gap: 16px;
    align-items: start;
    min-width: 0;
    width: 100%
}

.coloring-app .canvas-panel {
    padding: 14px;
    position: relative;
    overflow: hidden;
    min-width: 0
}

.coloring-app .canvas-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding: 0 4px;
}

.coloring-app .canvas-name {
    font-size: 16px;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 8px;
}

.coloring-app .badge {
    font-size: 12px;
    background: #eaf8ff;
    color: #1b93bd;
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 600;
}

.coloring-app .canvas-box {
    min-width: 0;
    background: radial-gradient(#f6eee6 1px, transparent 1px) 0 0 / 18px 18px, #fff;
    border: 2px dashed #f0dfd0;
    border-radius: 7px;
    display: grid;
    place-items: center;
    padding: 8px;
    min-height: 320px;
}

.coloring-app #stage {
    width: 100%;
    max-width: 680px;
    height: auto;
    display: block;
    touch-action: manipulation;
    user-select: none;
    border-radius: 6px
}

.coloring-app .hint {
    margin: 10px 4px 0;
    font-size: 13px;
    color: var(--muted);
    font-weight: 700;
    text-align: center;
    min-height: 18px
}

.coloring-app .tools {
    padding: 16px;
    position: sticky;
    top: 14px
}

.coloring-app .tool-sec {
    margin-bottom: 18px
}

.coloring-app .tool-sec:last-child {
    margin-bottom: 0
}

.coloring-app .label {
    font-size: 13px;
    font-weight: 900;
    color: #7b6a5b;
    margin-bottom: 13px;
    display: flex;
    align-items: center;
    gap: 6px
}

.coloring-app .swatches {
    display: grid;
    grid-template-columns:repeat(8, 1fr);
    gap: 7px
}

.coloring-app .swatch {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
    transition: .14s;
    position: relative;
}

.coloring-app .swatch:hover {
    transform: scale(1.12)
}

.coloring-app .swatch.active {
    box-shadow: 0 0 0 2px var(--ink), 0 2px 8px rgba(0, 0, 0, .2);
    transform: scale(1.12)
}

.coloring-app .swatch.custom {
    background: conic-gradient(#ff595e, #ffca3a, #8ac926, #1982c4, #6a4c93, #ff595e);
    overflow: hidden
}

.coloring-app .swatch.custom input {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer
}

.coloring-app .swatch.custom::after {
    content: "+";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
    font-size: 16px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .4);
    pointer-events: none
}

.coloring-app .mode-row {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 8px
}

.coloring-app .mode {
    border: 2px solid #f0e4d8;
    background: #fffdf8;
    border-radius: 8px;
    padding: 10px 2px 8px;
    text-align: center;
    transition: .15s;
    font-size: 12px;
    font-weight: 600;
}

.coloring-app .mode i {
    display: block;
    font-size: 22px;
    font-style: normal;
    line-height: 1.2
}

.coloring-app .mode:hover {
    transform: translateY(-2px)
}

.coloring-app .mode.active {
    background: #fff0e9;
    border-color: var(--coral);
    color: var(--coral-d);
}

.coloring-app .actions {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 8px
}

.coloring-app .act {
    border: 2px solid #eee2d5;
    background: #fffdf8;
    border-radius: 8px;
    padding: 10px 4px;
    font-size: 12px;
    font-weight: 800;
    transition: .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.coloring-app .act i {
    font-size: 19px;
    font-style: normal
}

.coloring-app .act:hover {
    transform: translateY(-2px);
    border-color: #ffc9ae;
    background: #fff7f2
}

.coloring-app .act:active {
    transform: translateY(1px)
}

.coloring-app .act:disabled {
    opacity: .38;
    cursor: not-allowed;
    transform: none
}

.coloring-app .act.magic {
    background: linear-gradient(135deg, #fff0c2, #ffe3ef);
    border-color: #ffd98a
}

.coloring-app .act.save {
    background: linear-gradient(135deg, #dff6ff, #e9e2ff);
    border-color: #bde6f7
}

@media (max-width: 900px) {
    .coloring-app .workspace {
        grid-template-columns:1fr
    }

    .coloring-app .tools {
        position: static
    }

    .coloring-app .swatches {
        grid-template-columns:repeat(10, 1fr)
    }
}

@media (max-width: 560px) {
    .coloring-app .wrap {
        padding: 0
    }

    .coloring-app .gallery, .coloring-app .tools, .coloring-app .canvas-panel {
        padding: 12px
    }

    .coloring-app .card {
        flex-basis: 100px
    }

    .coloring-app .card img {
        height: 72px
    }

    .coloring-app .swatches {
        grid-template-columns:repeat(8, 1fr)
    }

    .coloring-app .section-title small {
        display: none
    }
}
