/* =========================================
   Pips (Domino Puzzle) Styles
   ========================================= */

.pips-hint {
    font-size: 0.85rem;
    color: var(--depths);
    opacity: 0.8;
    margin-bottom: 4px;
}

.pips-instructions {
    font-size: 0.75rem;
    color: var(--depths);
    opacity: 0.6;
    line-height: 1.4;
}

/* ---- Toast ---- */
#pips-toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.pips-toast {
    background: var(--navy);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 1;
    transition: opacity 0.4s ease;
    white-space: nowrap;
}

.pips-toast.fade-out {
    opacity: 0;
}

/* ---- Conditions Legend ---- */
#pips-conditions {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.condition-card {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 2px solid;
    color: var(--navy);
    transition: box-shadow 0.3s ease;
}

.condition-card .cond-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.condition-card .cond-check {
    margin-left: 2px;
    font-size: 0.75rem;
}

/* ---- Board ---- */
#pips-board {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 0 auto 20px;
    padding: 0 4px;
}

.board-slot {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 60px;
    flex-shrink: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Horizontal (rotated 90°) board slot — cells appear side-by-side */
.board-slot.rotated {
    flex-direction: row;
    width: 90px;
}

/* Cells in a flex-row have no intrinsic width, so they collapse to 0.
   flex: 1 makes each cell grow to fill half the slot, giving aspect-ratio
   something to work with so the cells become visible square tiles. */
.board-slot.rotated .board-cell {
    flex: 1;
}

/* Fix border-radius and divider for horizontal orientation */
.board-slot.rotated .board-cell:first-child {
    border-radius: 10px 0 0 10px;
    border-bottom-width: 2px;  /* restore full bottom border */
    border-right-width: 1px;   /* right edge = internal divider */
}

.board-slot.rotated .board-cell:last-child {
    border-radius: 0 10px 10px 0;
    border-top-width: 2px;     /* restore full top border */
    border-left-width: 1px;    /* left edge = internal divider */
}

.board-slot.rotated .board-cell.filled:first-child {
    border-bottom: 2px solid var(--navy);
    border-right: 1px solid var(--depths);
}

.board-slot.rotated .board-cell.filled:last-child {
    border-top: 2px solid var(--navy);
    border-left: 1px solid var(--depths);
}

.board-cell {
    aspect-ratio: 1;
    border: 2px dashed rgba(27, 42, 74, 0.15);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.board-cell:first-child {
    border-radius: 10px 10px 0 0;
    border-bottom-width: 1px;
}

.board-cell:last-child {
    border-radius: 0 0 10px 10px;
    border-top-width: 1px;
}

/* Filled cells (domino placed) */
.board-cell.filled {
    border-style: solid;
    border-color: var(--navy);
    background-blend-mode: overlay;
}

.board-cell.filled:first-child {
    border-bottom: 1px solid var(--depths);
}

.board-cell.filled:last-child {
    border-top: 1px solid var(--depths);
}

/* Region color indicator */
.region-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0.6;
    z-index: 2;
    pointer-events: none;
}

/* ---- Pip Dots ---- */
.domino-face {
    position: relative;
    width: 100%;
    height: 100%;
}

.pip {
    position: absolute;
    width: 20%;
    height: 20%;
    border-radius: 50%;
    background: var(--navy);
}

.pip-tl { top: 14%; left: 14%; }
.pip-tr { top: 14%; right: 14%; }
.pip-ml { top: 50%; left: 14%; transform: translateY(-50%); }
.pip-mc { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.pip-mr { top: 50%; right: 14%; transform: translateY(-50%); }
.pip-bl { bottom: 14%; left: 14%; }
.pip-br { bottom: 14%; right: 14%; }

/* ---- Tray ---- */
#pips-tray-label {
    text-align: center;
    font-size: 0.75rem;
    color: var(--depths);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#pips-tray {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    min-height: 150px;
    align-items: flex-start;
}

.tray-domino {
    width: 60px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border-radius: 10px;
    border: 2px solid var(--drift);
    background: var(--white);
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tray-domino:active {
    transform: scale(0.96);
}

.tray-domino.selected {
    border-color: var(--navy);
    box-shadow: 0 4px 16px rgba(27, 42, 74, 0.35);
    transform: translateY(-6px);
}

.tray-domino .domino-half {
    width: 100%;
    aspect-ratio: 1;
    position: relative;
}

.tray-domino .domino-divider {
    height: 2px;
    background: var(--drift);
    flex-shrink: 0;
}

.tray-domino.selected .domino-divider {
    background: var(--navy);
}

/* ---- Horizontal (rotated 90°) tray domino ---- */
.tray-domino.rotated {
    flex-direction: row;
    width: 90px;
}

.tray-domino.rotated .domino-half {
    flex: 1;
    width: auto;
    aspect-ratio: 1;
}

.tray-domino.rotated .domino-divider {
    width: 2px;
    height: auto;
    align-self: stretch;
}

/* ---- Actions ---- */
#pips-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.pips-btn {
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.pips-btn.primary {
    background: var(--depths);
    color: var(--white);
}

.pips-btn.primary:active {
    background: var(--navy);
}

.pips-btn.secondary {
    background: var(--white);
    color: var(--depths);
    border: 2px solid var(--drift);
}

.pips-btn.secondary:disabled {
    opacity: 0.4;
    cursor: default;
}

.pips-btn.secondary:not(:disabled):active {
    background: var(--breeze);
}

/* ---- Shake animation ---- */
@keyframes pipsShake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-4px); }
    40%      { transform: translateX(4px); }
    60%      { transform: translateX(-3px); }
    80%      { transform: translateX(3px); }
}

.board-slot.shake {
    animation: pipsShake 0.3s ease;
}

/* ---- Win state ---- */
#pips-actions.hidden {
    display: none;
}

.board-cell.correct {
    border-color: var(--success) !important;
    border-style: solid !important;
}

/* ---- Code reveal ---- */
#pips-code-reveal {
    text-align: center;
    margin-top: 20px;
    animation: pipsReveal 0.6s ease;
}

#pips-code-reveal .code-label {
    font-size: 0.9rem;
    color: var(--depths);
    margin-bottom: 8px;
    font-weight: 500;
}

#pips-code-reveal .code-digits {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: 12px;
    text-indent: 12px;
}

@keyframes pipsReveal {
    0%   { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}
