/* Pips - Domino Styles */
/* Rewritten for tactile interactions */

.domino {
    display: flex;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: grab;
    user-select: none;
    touch-action: none;
    flex-shrink: 0;
    scroll-snap-align: start;
    will-change: transform, box-shadow;
}

.domino:active {
    cursor: grabbing;
}

/* Orientation */
.domino.horizontal {
    flex-direction: row;
    width: 80px;
    height: 40px;
}

.domino.vertical {
    flex-direction: column;
    width: 40px;
    height: 80px;
}

.domino.in-tray {
    flex-direction: row;
    width: 80px;
    height: 40px;
}

/* ========== INTERACTION STATES ========== */

/* Lifting - initial touch feedback */
.domino.lifting {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

/* Dragging - being moved */
.domino.dragging {
    cursor: grabbing;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    opacity: 0.95;
    z-index: 1000;
}

/* Rotating animation */
.domino.rotating {
    animation: rotate-pulse 150ms ease;
}

@keyframes rotate-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* Shake animation (can't rotate) */
.domino.shake {
    animation: shake 300ms ease;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-4px);
    }
    40% {
        transform: translateX(4px);
    }
    60% {
        transform: translateX(-4px);
    }
    80% {
        transform: translateX(4px);
    }
}

/* Ghost preview */
.domino.ghost {
    pointer-events: none;
    opacity: 0.4;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: none;
    border: 2px dashed var(--accent);
    z-index: 900;
}

/* Placed on board */
.domino.placed {
    position: absolute;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.domino.placed.horizontal {
    width: calc(200% + 2px);
    height: 100%;
}

.domino.placed.vertical {
    width: 100%;
    height: calc(200% + 2px);
}

/* ========== DOMINO HALVES ========== */

.domino-half {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    border: 1px solid #e0e0e0;
}

.domino.horizontal .domino-half:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    border-right: none;
}

.domino.horizontal .domino-half:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-left: 1px solid #d0d0d0;
}

.domino.vertical .domino-half:first-child {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border-bottom: none;
}

.domino.vertical .domino-half:last-child {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    border-top: 1px solid #d0d0d0;
}

/* ========== PIP DOTS ========== */

.pip-container {
    width: 100%;
    height: 100%;
    display: grid;
    padding: 4px;
    gap: 2px;
}

.pip-dot {
    background: radial-gradient(circle at 30% 30%, #555, #222);
    border-radius: 50%;
    width: 100%;
    height: 100%;
    max-width: 8px;
    max-height: 8px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Pip layouts for 0-6 */
.pip-0 {
    /* Empty */
}

.pip-1 {
    place-items: center;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.pip-2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    align-items: center;
}

.pip-2 .pip-dot:first-child {
    justify-self: start;
}

.pip-2 .pip-dot:last-child {
    justify-self: end;
}

.pip-3 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr;
    place-items: center;
}

.pip-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    place-items: center;
}

.pip-5 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}

.pip-5 .pip-dot:nth-child(1) {
    grid-area: 1 / 1;
    place-self: start;
}

.pip-5 .pip-dot:nth-child(2) {
    grid-area: 1 / 3;
    place-self: start end;
}

.pip-5 .pip-dot:nth-child(3) {
    grid-area: 2 / 2;
    place-self: center;
}

.pip-5 .pip-dot:nth-child(4) {
    grid-area: 3 / 1;
    place-self: end start;
}

.pip-5 .pip-dot:nth-child(5) {
    grid-area: 3 / 3;
    place-self: end;
}

.pip-6 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    place-items: center;
}

/* Smaller pips for placed dominoes */
.domino.placed .pip-dot {
    max-width: 6px;
    max-height: 6px;
}

.domino.placed .pip-container {
    padding: 2px;
    gap: 1px;
}
