* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff7ee;
    color: #3a2b1d;
    font-family: "Nunito", -apple-system, system-ui, sans-serif;
    padding: 28px 16px 40px;
}

header {
    text-align: center;
    margin-bottom: 18px;
}

h1 {
    margin: 0;
    font-size: 56px;
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1;
}

header p {
    margin: 8px 0 0;
    font-weight: 700;
    color: #9a8268;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 520px;
}

.stage {
    position: relative;
    width: 100%;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(58, 43, 29, 0.18);
    line-height: 0;
}

.stage canvas {
    width: 100%;
    height: auto;
    cursor: grab;
    touch-action: none;
}

.stage canvas:active {
    cursor: grabbing;
}

#g {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    pointer-events: none;
}

.drophint {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 247, 238, 0.85);
    font-size: 28px;
    font-weight: 900;
    line-height: 1.2;
    pointer-events: none;
}

.stage.dragging .drophint {
    display: flex;
}

.controls {
    width: 100%;
    background: #ffffff;
    border-radius: 24px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 10px 30px rgba(58, 43, 29, 0.08);
}

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

.btn {
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    background: #f3e9dc;
    color: #3a2b1d;
    transition: transform 0.1s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: scale(0.97);
}

.btn.primary {
    background: #ffc83d;
}

.btn.dark {
    background: #3a2b1d;
    color: #fff7ee;
    margin-left: auto;
}

.group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.label {
    font-weight: 900;
    font-size: 14px;
    color: #9a8268;
    width: 70px;
}

.hint {
    font-size: 12px;
    font-weight: 700;
    color: #c4b09a;
}

input[type="range"] {
    flex: 1;
    min-width: 120px;
    accent-color: #ffc83d;
}

.swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.swatch {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    line-height: 1;
}

.swatch:hover {
    transform: scale(1.1);
}

.swatch.selected {
    border-color: #3a2b1d;
}

footer {
    margin-top: 28px;
    font-size: 13px;
    font-weight: 700;
    color: #c4b09a;
}

.confetti {
    position: fixed;
    top: -40px;
    font-size: 28px;
    pointer-events: none;
    animation: fall linear forwards;
    z-index: 99;
}

@keyframes fall {
    to {
        transform: translateY(110vh) rotate(540deg);
    }
}
