/* =========================================================================
   stamps.css — 和歌スタンプ (js/stamps.js): palette grid, the bubbles beside
   seats / players, the poem detail. Everything else is Bootstrap (card,
   nav-pills, form-switch, modal). Bubbles are fixed-position above the table
   and the effects layer (and a modal backdrop), below dialogs and toasts.
   ========================================================================= */

/* The palette: a popup card under the stamp button (position/max-height set by stamps.js). */
.stamp-palette {
    position: fixed;
    z-index: 1045; /* over the navbar and panels, under a modal backdrop (1050) */
    width: min(400px, calc(100vw - 16px));
    display: flex;
    flex-direction: column;
}
.stamp-palette[hidden] { display: none; }
.stamp-palette-body { min-height: 0; flex: 1 1 auto; }
.stamp-palette .stamp-grid { min-height: 0; }

.stamp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    align-content: start;
    gap: .5rem;
}
.stamp-grid-heading { grid-column: 1 / -1; margin-top: .25rem; }
.stamp-choice { padding: .25rem; }
.stamp-choice img { width: 72px; height: 72px; display: block; margin: 0 auto; }
.stamp-choice-gloss { font-size: .75rem; line-height: 1.2; margin-top: .15rem; }
@media (orientation: landscape) and (max-height: 540px) {
    .stamp-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: .35rem; }
    .stamp-choice img { width: 56px; height: 56px; }
}

.stamp-bubble {
    position: fixed;
    z-index: 1054; /* above a modal backdrop (1050), below the dialog (1055) */
    width: 104px;
    padding: 4px 4px 2px;
    border: 0;
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
    cursor: pointer;
    animation: stamp-pop .2s ease-out;
}
/* While the winner's waka cut-in is up (effects.js, .fx-layer at 1040), stamps go behind it. */
body:has(.fx-waka) .stamp-bubble { z-index: 1039; }
.stamp-bubble img { width: 96px; height: 96px; display: block; }
.stamp-bubble-name { display: block; font-size: .7rem; line-height: 1.2; color: #333; }
.stamp-bubble-out { opacity: 0; transition: opacity .18s; pointer-events: none; }
.stamp-bubble.stamp-bubble-sm { width: 80px; border-radius: 14px; }
.stamp-bubble-sm img { width: 72px; height: 72px; }
@media (orientation: landscape) and (max-height: 540px) {
    .stamp-bubble { width: 80px; border-radius: 14px; }
    .stamp-bubble img { width: 72px; height: 72px; }
}

@keyframes stamp-pop {
    from { transform: scale(.6); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .stamp-bubble { animation: none; }
}

.stamp-detail-img { width: 120px; height: 120px; flex-shrink: 0; }
.stamp-detail-poem { font-family: 'Hiragino Mincho ProN', 'Yu Mincho', 'YuMincho', serif; line-height: 1.7; }
