/* 집찾기. 캔버스에는 배경·줄·집만 그리고, 오리와 표시는 위에 겹친 레이어에
   놓는다 — 캔버스에 그리면 오리가 한 걸음 갈 때마다 그림 전체를 다시 그려야
   하고, 그러면 경로 데이터와 화면이 어긋날 위험이 생긴다. */

.duck-stage {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
    /* 드래그가 스크롤로 새지 않게 한다. 이게 없으면 모바일에서 오리를 끌 수 없다. */
    touch-action: none;
    cursor: grab;
}

.duck-stage:active {
    cursor: grabbing;
}

.duck-stage canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
}

/* 오리 레이어. 포인터 이벤트는 아래 판이 받아야 하므로 통과시킨다. */
.duck-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* 오리는 data URI SVG 로 둔다. JS 는 span 하나만 만들면 되고, Node 하네스가
   SVG 를 흉내낼 필요가 없다. */
.duck-token,
.duck-slot {
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M15 33 L3 25 L13 45 Z' fill='%23f0b429' stroke='%23a9740b' stroke-width='2.5' stroke-linejoin='round'/><ellipse cx='28' cy='42' rx='21' ry='14' fill='%23f7c948' stroke='%23a9740b' stroke-width='2.5'/><path d='M18 41 a13 9 0 0 0 21 3' fill='none' stroke='%23a9740b' stroke-width='2' stroke-linecap='round'/><circle cx='45' cy='21' r='11' fill='%23f7c948' stroke='%23a9740b' stroke-width='2.5'/><path d='M55 17 L63 21.5 L55 26 Z' fill='%23f2760c' stroke='%23a9740b' stroke-width='2' stroke-linejoin='round'/><circle cx='48' cy='17' r='2.2' fill='%233a2a00'/></svg>");
}

.duck-token {
    position: absolute;
    left: var(--duck-x, 50%);
    top: var(--duck-y, 50%);
    width: 11%;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
    transition: left 60ms linear, top 60ms linear;
}

.duck-token--held {
    transform: translate(-50%, -50%) scale(1.12);
}

/* 대기줄. 배달을 마친 자리는 흐려져 몇 마리가 집에 갔는지 한눈에 보인다. */
.duck-queue {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.duck-slot {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
}

.duck-slot--home {
    opacity: 0.28;
    filter: grayscale(1);
}

/* 키보드로 판에 초점이 오면 테두리로 알려 준다. 방향키가 먹는 상태라는 신호다. */
.duck-stage:focus-visible {
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

.duck-stat {
    background: var(--bs-tertiary-bg);
    border-radius: 10px;
    padding: 8px 4px;
}

.duck-stat-label {
    display: block;
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
}

.duck-stat-value {
    display: block;
    font-family: var(--quiz-font-display, inherit);
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.3;
}

.duck-stat-value--lives {
    color: #d9534f;
    letter-spacing: 0.08em;
}

.duck-status {
    min-height: 1.5rem;
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .duck-token {
        transition: none;
    }
}

/* 좁은 화면에서는 대기줄을 판 아래로 눕힌다. 옆에 두면 판이 너무 좁아진다. */
@media (max-width: 575.98px) {
    .duck-queue {
        flex-direction: row;
        justify-content: center;
        margin-top: 12px;
    }
}
