

[hidden] {
    display: none !important
}

html {
    font-size: calc(100vw/100);
    overflow-x: hidden;
    touch-action: pan-y;
    overscroll-behavior: none
}

@media (max-width: 2000px) {
    html {
        font-size: 20px;
    }
}

.night {
    color: #ddd;
    background-color: #0e1118;
    background: radial-gradient(circle at center, #252525 0%, #000000 100%);
}

.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 4.5rem 0.5rem  0 0.5rem;
    height:100vh;
    position: relative;
}

:root {
    --stage-h: clamp(300px, 44vh, 520px)
}

@media(max-width:960px) {
    :root {
        --stage-h: clamp(280px, 46vh, 560px)
    }
    #steps{
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(50px, 1fr);
        overflow-x: auto;
        width: 100%;
        max-width: 16rem;
    }
}

@supports(height:1dvh) {
    @media(max-width:960px) {
        :root {
            --stage-h: clamp(280px, 46dvh, 560px)
        }
    }
}

.headdivs{
    position: fixed;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    align-items: center;
    z-index: 9999999;
}

.headdivs h1{
    font-size: 0.8rem;
    color: #888;
}

.headdivs div{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.headdivs a{

}

.stage {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0
}

#canvas-wrap {
    position: relative;
    height: var(--stage-h);
    border-radius: 14px;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

#canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none
}

#canvas-wrap canvas:active {
    cursor: grabbing
}

body.painting #canvas-wrap canvas {
    cursor: crosshair
}

#loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    color: #8d97ab;
    font-size: 13px;
    z-index: 4;
    text-align: center;
    padding: 0 20px;
    line-height: 1.6
}

#loading .spin {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid #2a3450;
    border-top-color: #5b8cff;
    animation: spin 1s linear infinite
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0.5rem;
    width:100%;
    max-width: 16rem;
    align-items: center;
}

.panel {
    background: #171c25;
    border: 1px solid #262e3c;
    border-radius: 6px;
    padding: 0.5rem;
    width: 100%;
    max-width: 16rem;
}


.row {
    display: flex;
    gap: 0.2rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.row.aa{
    display: flex;
    justify-content: flex-start;
}

.row.bb{
    margin-top:0.5rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.row.cc{
    margin-top:10px;
}

.btn {
    background: #232a38;
    color: #e8eaf0;
    border: 1px solid #333d50;
    border-radius: 6px;
    padding: 0.25rem 0.4rem;
    font-size: 0.6rem;
    cursor: pointer;
    transition: .15s;
    touch-action: manipulation;
}

.btn:hover {
    background: #2b3446;
    border-color: #41506b
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed
}

.btn.toggled-on {
    background: #2c4a8f;
    border-color: #5b8cff;
    color: #cfe0ff
}

@media(pointer:coarse) {
  
    .swatch {
        width: 38px;
        height: 38px
    }

    .step {
        padding: 8px 14px;
        font-size: 15px
    }
}

/* ---------- 使用说明弹窗 ---------- */
#guide-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px
}

#guide-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 7, 12, .74);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px)
}

#guide-card {
    position: relative;
    background: #171c25;
    border: 1px solid #2a3446;
    border-radius: 14px;
    max-width: 640px;
    width: 100%;
    max-height: min(84vh, 760px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55)
}

#guide-modal:not([hidden]) #guide-card {
    animation: pop .18s ease-out
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(.96) translateY(10px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

#guide-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid #262e3c;
    flex: 0 0 auto
}

#guide-head b {
    font-size: 16px
}

#guide-body {
    padding: 6px 18px 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    font-size: 13px;
    color: #b9c1d3;
    line-height: 1.75
}

#guide-body p {
    margin: 10px 0
}

#guide-body code {
    background: #232a38;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: ui-monospace, monospace
}

@supports(height:1dvh) {
    #guide-card {
        max-height: min(84dvh, 760px)
    }
}



body.guide-open {
    overflow: hidden
}

/* ---------- 涂色面板（进入涂色后单独出现） ---------- */


.palette {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center
}

.swatch {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 3px;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    position: relative;
    transition: .12s;
    touch-action: manipulation;
    border-radius: 100%;
}

.swatch[data-tool="U"] {
    background: #f5f5f5;
}

.swatch[data-tool="R"] {
    background: #d23445;
}

.swatch[data-tool="F"] {
    background: #2fbf5a;
}

.swatch[data-tool="D"] {
    background: #f7d43b;
}

.swatch[data-tool="L"] {
    background: #f07f2e;
}

.swatch[data-tool="B"] {
    background: #3a63d8;
}

.swatch.eraser {
    border-color: #171c25;
    background: #171c25;
    color: #fff;
}


.swatch:hover {
    filter: brightness(1.15)
}

.swatch.active {
    width: 1rem;
    height: 1rem;
    border-color: #444;
    box-shadow: 0 0 10px rgba(255, 255, 255, .4)
}

@media(max-width:960px) {
    .palette {
        flex-wrap: nowrap;
        justify-content: space-between
    }
}

label.lab {
    font-size: 12px;
    color: #9aa3b5;
    display: block;
    margin-bottom: 6px
}

#steps {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #333d50;
}

.step {
    padding: 0.15rem 0.45rem;
    background: #232a38;
    font-size: 0.6rem;
    border-radius: 3px;
    border: 1px solid #313b4e;
    cursor: pointer;
    transition: .15s;
    color: #dfe4ef;
    touch-action: manipulation;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
}

.step.done {
    opacity: .32;
    text-decoration: line-through
}

.step.cur {
    background: #3572f0;
    border-color: #5b8cff;
    color: #fff;
    box-shadow: 0 0 14px rgba(91, 140, 255, .55);
    transform: scale(1.08)
}

.step:hover {
    border-color: #4a5773
}

.playback {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}