/* The design list that opens when a piece is held. Positioned in the document, beside the piece. */
.ph-panel {
    position: absolute;
    z-index: 2000;
    min-width: 208px;
    max-width: 260px;
    padding: 6px;
    border-radius: 12px;
    background: var(--ng-surface, #121C2F);
    border: 1px solid var(--ng-border, #24304A);
    box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
    color: var(--ng-text, #E8ECF3);
    font-size: .86rem;
}

.ph-head {
    padding: 6px 8px 8px;
    font-weight: 700;
    font-size: .74rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ng-muted, #8FA0BD);
}

.ph-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.ph-row:hover, .ph-row:focus-visible { background: rgba(255, 255, 255, .06); }
.ph-row.is-on { border-color: #5BC8DC; background: rgba(91, 200, 220, .12); }

/* The squares the board actually draws, so the sample is the thing itself. */
.ph-sample { display: flex; border-radius: 6px; overflow: hidden; flex: 0 0 auto; }
.ph-sample img { width: 26px; height: 26px; object-fit: contain; background: #f0d9b5; }
.ph-sample img:nth-child(2) { background: #b58863; }

.ph-name { font-weight: 600; }

.ph-foot {
    display: block;
    padding: 8px;
    font-size: .78rem;
    color: var(--ng-muted, #8FA0BD);
    text-decoration: none;
}
.ph-foot:hover { color: var(--ng-text, #E8ECF3); text-decoration: underline; }

.ph-note { padding: 10px 12px; max-width: 260px; }

/* While a piece is being held, so the wait is visible rather than mysterious. */
img.ph-holding { animation: ph-pulse 3s linear forwards; }
@keyframes ph-pulse {
    0%   { filter: none; }
    100% { filter: drop-shadow(0 0 7px rgba(91, 200, 220, .95)); }
}
@media (prefers-reduced-motion: reduce) {
    img.ph-holding { animation: none; filter: drop-shadow(0 0 5px rgba(91, 200, 220, .8)); }
}

/* ---------------------------------------------------------------- the full list, over the board */

.ph-modal-back {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(6, 11, 22, .62);
}

.ph-modal {
    width: min(460px, 100%);
    max-height: min(78vh, 680px);
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: var(--ng-surface, #121C2F);
    border: 1px solid var(--ng-border, #24304A);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
    color: var(--ng-text, #E8ECF3);
    overflow: hidden;
}

.ph-modal-head {
    position: relative;
    padding: 16px 48px 12px 16px;
    border-bottom: 1px solid var(--ng-border, #24304A);
}
.ph-modal-head h2 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.ph-modal-head p { margin: 2px 0 0; font-size: .82rem; color: var(--ng-muted, #8FA0BD); }

.ph-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ng-muted, #8FA0BD);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.ph-modal-close:hover, .ph-modal-close:focus-visible { background: rgba(255,255,255,.08); color: var(--ng-text, #E8ECF3); }

.ph-modal-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; }

.ph-modal-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.ph-modal-row:hover, .ph-modal-row:focus-visible { background: rgba(255, 255, 255, .06); }
.ph-modal-row.is-on { border-color: #5BC8DC; background: rgba(91, 200, 220, .12); }

.ph-sample-lg img { width: 34px; height: 34px; }
.ph-sample-lg img:nth-child(3) { background: #f0d9b5; }
.ph-sample-lg img:nth-child(4) { background: #b58863; }

.ph-modal-words { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ph-desc { font-size: .78rem; color: var(--ng-muted, #8FA0BD); }

.ph-in-use { margin-left: auto; font-size: .72rem; font-weight: 800; color: #5BC8DC; white-space: nowrap; }

@media (max-width: 480px) {
    .ph-modal { width: 100%; max-height: 82vh; }
    .ph-sample-lg img { width: 28px; height: 28px; }
}

/* The quiet way in, on boards that have no toolbar of their own. Deliberately small: it is a preference, not a
   thing to do during a game. */
.ph-cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 6px 0 0 auto;
    padding: 3px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ng-muted, #8FA0BD);
    font: 600 12px system-ui, -apple-system, "Segoe UI", sans-serif;
    cursor: pointer;
    opacity: .75;
}
.ph-cta:hover, .ph-cta:focus-visible { opacity: 1; color: var(--ng-text, #E8ECF3); background: rgba(255,255,255,.06); }
.ph-cta img { width: 15px; height: 15px; object-fit: contain; }
