/* Bunnimoo 6.9.4-beta — TOP-3 (bm-top3.js): calm visit ending + playing in turns */
/* ---------- the soft "sleepy soon" line ---------- */
.bm3-soon { position: fixed; z-index: 8000; top: calc(12px + var(--safe-t)); left: 16px; right: 16px; max-width: 460px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 999px; background: #3f4675; color: #fdfbff; font-size: 18px; box-shadow: 0 10px 30px rgba(40, 44, 90, .3); animation: bm3in .5s ease both; }
.bm3-soon.out { opacity: 0; transform: translateY(-10px); transition: opacity .6s ease, transform .6s ease; }
.bm3-soon-i svg { width: 30px; height: 30px; display: block; }
@keyframes bm3in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- the calm ending ---------- */
html.bm3-night, html.bm3-night body { overflow: hidden; }
.bm3-end { position: fixed; inset: 0; z-index: 9000; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #fbf8ff;
  padding: calc(24px + var(--safe-t)) 22px calc(24px + var(--safe-b));
  background: radial-gradient(120% 70% at 50% 100%, #6d5fa8 0, rgba(109, 95, 168, 0) 60%), linear-gradient(180deg, #1f2247 0%, #2d3166 48%, #4a4789 100%);
  animation: bm3fade 1.2s ease both; overflow: hidden; }
@keyframes bm3fade { from { opacity: 0; } to { opacity: 1; } }
.bm3-sky { position: absolute; inset: 0 0 40% 0; pointer-events: none; }
.bm3-sky i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff8dc; box-shadow: 0 0 6px rgba(255, 248, 220, .9); animation: bm3tw 4.2s ease-in-out infinite; }
@keyframes bm3tw { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.bm3-moon { position: absolute; top: calc(28px + var(--safe-t)); inset-inline-start: 26px; width: 92px; height: 92px; }
.bm3-end-in { position: relative; display: flex; flex-direction: column; align-items: center; max-width: 440px; width: 100%; }
.bm3-sleeper { width: min(86vw, 360px); height: auto; display: block; margin-bottom: 8px; transform-origin: 50% 90%; animation: bm3breathe 4.6s ease-in-out infinite; }
@keyframes bm3breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.03); } }
.bm3-sleeper .bm3-z path { opacity: 0; animation: bm3z 4.5s ease-in-out infinite; }
.bm3-sleeper .bm3-z .z2 { animation-delay: .8s; } .bm3-sleeper .bm3-z .z3 { animation-delay: 1.6s; }
@keyframes bm3z { 0% { opacity: 0; transform: translateY(6px); } 30%, 60% { opacity: .95; } 100% { opacity: 0; transform: translateY(-8px); } }
.bm3-sleeper .bm3-blanket { transition: transform 1.4s cubic-bezier(.3, .7, .2, 1); transform: translateY(40px); }
.bm3-end.tucked .bm3-sleeper .bm3-blanket { transform: none; }
#bm3End.bm3-end h2 { margin: 6px 0 6px; font-size: 30px; font-weight: 400; letter-spacing: .2px; color: #fdfbff !important; text-shadow: 0 2px 12px rgba(20, 20, 60, .5); }
#bm3End .bm3-end-sub { color: #e2ddf6 !important; }
.bm3-end-sub { margin: 0 0 22px; font-size: 19px; line-height: 1.5; color: #e2ddf6; max-width: 340px; }
.bm3-tuck { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; padding: 0 30px; border: 0; border-radius: 999px; font: inherit; font-size: 21px;
  color: #2d2f5c; background: linear-gradient(180deg, #fff8e2, #ffe7b0); box-shadow: 0 10px 30px rgba(255, 224, 150, .25), inset 0 -3px 0 rgba(200, 150, 60, .2); cursor: pointer; }
.bm3-tuck svg { width: 32px; height: 32px; display: block; }
.bm3-tuck:active { transform: scale(.97); }
.bm3-hold { position: absolute; bottom: calc(18px + var(--safe-b)); left: 50%; transform: translateX(-50%); overflow: hidden; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .06); color: rgba(240, 236, 255, .72); font: inherit; font-size: 14px; white-space: nowrap; cursor: pointer;
  touch-action: none; -webkit-user-select: none; user-select: none; }
.bm3-hold span { position: relative; }
.bm3-hold-bar { position: absolute; inset: 0; transform-origin: right center; transform: scaleX(0); background: rgba(255, 240, 200, .28); }
[dir="ltr"] .bm3-hold-bar { transform-origin: left center; }
.bm3-hold.holding .bm3-hold-bar { transform: scaleX(1); transition: transform 3s linear; }
html.rm .bm3-sky i, html.rm .bm3-sleeper, html.rm .bm3-sleeper .bm3-z path { animation: none; }
html.rm .bm3-sleeper .bm3-z path { opacity: .8; }
@media (prefers-reduced-motion: reduce) { .bm3-sky i, .bm3-sleeper, .bm3-sleeper .bm3-z path { animation: none; } .bm3-sleeper .bm3-z path { opacity: .8; } }
@media (max-height: 640px) { .bm3-sleeper { width: min(70vw, 280px); } .bm3-moon { width: 64px; height: 64px; } .bm3-end h2 { font-size: 26px; } }

/* ---------- parent area: visit length ---------- */
.bm3-adm h2 { display: flex; align-items: center; gap: 10px; }
.bm3-adm h2 svg { width: 30px; height: 30px; }
.bm3-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 10px 0; border-radius: 26px; }
.bm3-seg.v5 { grid-template-columns: repeat(4, 1fr); }
.bm3-seg.v5 .seg-btn:first-child { grid-column: 1 / -1; }
.bm3-seg .seg-btn { min-width: 0; }
.bm3-adm .btn svg { width: 22px; height: 22px; }

/* ---------- playing in turns ---------- */
.bm3-tn { padding-bottom: 24px; }
.bm3-tn .head-row h1 { font-size: 26px; font-weight: 400; }
.bm3-lead { margin: 2px 4px 14px; color: var(--ink-2); font-size: 18px; }
.bm3-player { padding: 16px; margin-bottom: 12px; }
.bm3-player h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 20px; font-weight: 400; }
.bm3-num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--lilac); color: #5a5590; font-size: 17px; }
.bm3-pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.bm3-an { aspect-ratio: 1; min-height: 48px; padding: 4px; border: 0; border-radius: 18px; background: var(--pb); box-shadow: inset 0 0 0 2px rgba(61, 65, 89, .08); cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.bm3-an svg { width: 100%; height: 100%; display: block; }
.bm3-an.sel { box-shadow: inset 0 0 0 3px var(--pc), 0 6px 14px rgba(61, 65, 89, .16); transform: scale(1.06); }
.bm3-an:disabled { opacity: .3; filter: grayscale(.6); }
.bm3-name { margin: 12px 0 0; }
.bm3-name input { width: 100%; min-height: 50px; font-size: 18px; }
.bm3-tn .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.bm3-same { text-align: center; margin: 4px 0 14px; }
.bm3-go { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 62px; font-size: 21px; }
.bm3-go svg { width: 28px; height: 28px; }
[dir="rtl"] .bm3-go .ic-flip, [dir="rtl"] .bm3-setup .bm3-go svg { transform: scaleX(-1); }

.bm3-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 10px; }
.bm3-chip { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 22px; background: #fff; box-shadow: var(--shadow); opacity: .62; transition: opacity .3s ease, box-shadow .3s ease, transform .3s ease; }
.bm3-chip.on { opacity: 1; box-shadow: 0 8px 20px rgba(61, 65, 89, .14), inset 0 0 0 3px var(--pc); transform: translateY(-2px); background: linear-gradient(180deg, #fff, var(--pb)); }
.bm3-av { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; background: var(--pb); padding: 3px; }
.bm3-av svg { width: 100%; height: 100%; display: block; }
.bm3-chip-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.bm3-chip-t b { font-weight: 400; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm3-chip-t small { font-size: 14px; color: var(--ink-2); }
.bm3-pairs { position: absolute; bottom: -5px; inset-inline-end: 12px; display: flex; gap: 3px; }
.bm3-pairs i { width: 9px; height: 9px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 2px #fff; }
.bm3-turnline { margin: 6px 0 12px; text-align: center; font-size: 21px; min-height: 30px; color: var(--ink); }
.bm3-turnline::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--pc); margin-inline-end: 8px; vertical-align: middle; }
.bm3-board { display: grid; gap: 10px; }
.bm3-board.c3 { grid-template-columns: repeat(3, 1fr); }
.bm3-board.c4 { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bm3-card { position: relative; aspect-ratio: 1 / 1.05; border: 0; padding: 0; background: none; cursor: pointer; touch-action: manipulation; }
.bm3-back, .bm3-face { position: absolute; inset: 0; border-radius: 20px; display: grid; place-items: center; }
.bm3-back { background: linear-gradient(160deg, #cfc4f5, #a594e0); box-shadow: 0 6px 14px rgba(90, 70, 140, .18), inset 0 0 0 3px rgba(255, 255, 255, .45); }
.bm3-back svg { width: 40%; height: 40%; display: block; opacity: .9; }
.bm3-face { visibility: hidden; background: linear-gradient(180deg, #fffdf8, #fff3e6); box-shadow: 0 6px 14px rgba(90, 70, 140, .14), inset 0 0 0 2px #f1e6d6; }
.bm3-card.up .bm3-face { visibility: visible; }
.bm3-card.up .bm3-back { visibility: hidden; }
.bm3-card.fresh { animation: bm3flip .32s ease-out both; }
@keyframes bm3flip { 0% { transform: scaleX(.05); } 100% { transform: scaleX(1); } }
.bm3-face > svg { width: 62%; height: 62%; display: block; }
.bm3-card.got .bm3-face { box-shadow: 0 4px 10px rgba(90, 70, 140, .12), inset 0 0 0 4px var(--pc); }
.bm3-card:disabled { cursor: default; opacity: 1; }
.bm3-mark { position: absolute; top: 5px; inset-inline-end: 5px; width: 30%; height: 30%; }
.bm3-mark svg { width: 100%; height: 100%; display: block; }
.bm3-hand { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(61, 65, 89, .28); animation: bm3fade .25s ease both; cursor: pointer; }
.bm3-hand-in { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 28px; margin: 0 24px; border-radius: 30px; background: linear-gradient(180deg, #fff, var(--pb)); box-shadow: 0 20px 50px rgba(61, 65, 89, .3), inset 0 0 0 3px var(--pc); text-align: center; animation: bm3pop .35s cubic-bezier(.3, 1.4, .5, 1) both; }
.bm3-hand-in b { font-weight: 400; font-size: 23px; }
.bm3-hand-av { width: 96px; height: 96px; }
.bm3-hand-av svg { width: 100%; height: 100%; display: block; }
@keyframes bm3pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.bm3-win { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 6px; }
.bm3-win-av { display: flex; gap: 6px; }
.bm3-win-av svg { width: 96px; height: 96px; display: block; }
.bm3-win h2 { margin: 8px 0 0; font-size: 26px; font-weight: 400; }
.bm3-win p { margin: 0 0 10px; color: var(--ink-2); }
.bm3-win .bm3-chips { width: 100%; margin-bottom: 16px; }
.bm3-win .bm3-chip { opacity: 1; }
.bm3-win .btn-ghost { margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; }
.bm3-win .btn-ghost svg { width: 22px; height: 22px; }
html.rm .bm3-card.fresh { animation: none; }
.hub-tile.ht-turns { background: linear-gradient(180deg, #fff6ea, #f3e9ff); }

/* the last minutes: the room dims a little (warm, not dark) */
html.bm3-dusk body::after { content: ''; position: fixed; inset: 0; z-index: 40; pointer-events: none; background: linear-gradient(180deg, rgba(48, 40, 96, .16), rgba(70, 50, 110, .24)); animation: bm3fade 3s ease both; }
.bm3-star { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 999px; background: #fff5d9; color: #6b5420 !important; margin: 0 0 14px !important; }
.bm3-star svg { width: 26px; height: 26px; display: block; }

#bm3End button:focus { outline: none; }
#bm3End button:focus-visible { outline: 2px solid rgba(255, 240, 200, .7); outline-offset: 3px; }
