/* ===== Mèo Bom table: felt, seats (positioned by --x / --y from meo-bom-table-render.js), deck,
   discard, danger meter, direction ring, my hand area, reaction bar, prompts, peek. ===== */
.mb-table-wrap { display: grid; gap: 10px; }
/* Height also fits the screen: --mb-fit-h = viewport height left above the docked hand (set by the table render),
   so table + hand + Play / Draw fit without scrolling; never below 300px (240px on phones) so seats keep room. */
.mb-table { position: relative; height: max(300px, min(62vw, 460px, var(--mb-fit-h, 460px))); }
/* Felt: fine noise texture over the green gradient, two-tone wooden rim (border-box gradient) */
.mb-felt { position: absolute; inset: 9% 6%; border-radius: 50% / 46%; border: 7px solid transparent;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") padding-box,
        radial-gradient(ellipse at 50% 38%, #3A7D5D, var(--mb-felt) 45%, var(--mb-felt-2)) padding-box,
        linear-gradient(160deg, #9A6534, #5C3A1E 38%, #82552C 62%, #4A2E17) border-box;
    box-shadow: inset 0 0 0 2px var(--mb-felt-line), inset 0 10px 30px rgba(0, 0, 0, .35), 0 0 0 2px #3A2414, 0 16px 30px -16px rgba(0, 0, 0, .65);
    transition: outline-color .2s; outline: 4px dashed transparent; outline-offset: 5px; }
/* Ambient tension: red vignette grows with the bomb ratio (--mb-danger-ratio on #mb-table, set by the table render) */
.mb-felt::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(150, 12, 24, .6));
    opacity: min(1, calc(var(--mb-danger-ratio, 0) * 2.2)); transition: opacity .8s var(--mb-ease); }
.mb-table.is-drop-target .mb-felt { outline-color: var(--mb-playable); }
.mb-direction { position: absolute; inset: 14%; border-radius: 50%; border: 2px dashed var(--mb-felt-line); }
.mb-direction::after { content: "➜"; position: absolute; top: -13px; left: 50%; transform: translateX(-50%); color: rgba(255, 248, 236, .55); font-size: 18px; }
.mb-direction.is-ccw::after { transform: translateX(-50%) scaleX(-1); }
.mb-center { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; }
.mb-pile { display: flex; gap: 14px; align-items: center; }

/* Deck: back card that pulses faster as the bomb ratio rises (--mb-pulse, set by JS) */
.mb-deck { position: relative; }
.mb-deck .mb-card { box-shadow: 3px 3px 0 #3A2618, 6px 6px 0 #2B1B12; border-radius: 8px; }
.mb-deck.is-hot .mb-card { animation: mb-pulse var(--mb-pulse, 2s) ease-in-out infinite; }
.mb-deck.is-empty .mb-card { opacity: .3; }
.mb-deck-count { position: absolute; display: inline-block; bottom: -8px; right: -10px; min-width: 26px; padding: 2px 6px; border-radius: 999px; background: var(--mb-ink); color: #fff;
    font-size: 12px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.mb-discard { position: relative; display: grid; place-items: center; min-width: var(--mb-card-w-table); aspect-ratio: 5 / 7; padding: 0; border: 2px dashed var(--mb-felt-line);
    border-radius: 8px; background: transparent; cursor: pointer; }
.mb-discard .mb-card { pointer-events: none; }
.mb-discard[data-count]:not([data-count="0"])::after { content: attr(data-count); position: absolute; bottom: -8px; right: -10px; min-width: 22px; padding: 2px 6px;
    border-radius: 999px; background: rgba(255, 248, 236, .9); color: var(--mb-ink); font-size: 11px; font-weight: 800; }
/* Pending card during a reaction window: countdown ring round the discard pile (--mb-pending 1 → 0, set by panels) */
.mb-discard.is-pending::before { content: ""; position: absolute; inset: -8px; padding: 4px; border-radius: 13px; pointer-events: none;
    background: conic-gradient(var(--mb-reaction) calc(var(--mb-pending, 1) * 360deg), rgba(255, 248, 236, .18) 0);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.mb-discard.is-pending.is-noped::before { background: conic-gradient(var(--mb-danger) calc(var(--mb-pending, 1) * 360deg), rgba(255, 248, 236, .18) 0); }
.mb-discard.is-pending.is-noped .mb-card { filter: grayscale(.75) brightness(.85); }
.mb-discard-empty { color: rgba(255, 248, 236, .6); font-size: 11px; text-align: center; padding: 6px; }

.mb-danger { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, .28); color: #FFF8EC; font-size: 12px; font-weight: 700; }
.mb-danger-bar { width: 70px; height: 7px; border-radius: 999px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.mb-danger-bar span { display: block; height: 100%; background: #FACC15; transform-origin: left; transition: transform .4s var(--mb-ease); }
.mb-danger[data-level="2"] .mb-danger-bar span { background: #FB923C; }
.mb-danger[data-level="3"] .mb-danger-bar span { background: #EF4444; }
.mb-danger-text { font-variant-numeric: tabular-nums; }

/* Seats */
.mb-seats { position: absolute; inset: 0; pointer-events: none; }
.mb-seat { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); width: 92px; display: grid; justify-items: center; gap: 2px;
    text-align: center; pointer-events: auto; transition: left .4s var(--mb-ease), top .4s var(--mb-ease); }
.mb-seat-avatar { position: relative; width: 50px; height: 50px; display: grid; place-items: center; }
.mb-seat-initial { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--mb-ink);
    box-sizing: border-box; transition: box-shadow .35s var(--mb-ease); }
/* Cat-face avatar tinted by --hue; the initial sits on a tag under the chin */
.mb-cat { position: absolute; left: -5px; top: -6px; width: calc(100% + 10px); height: calc(100% + 10px); overflow: visible; }
.mb-cat-head, .mb-cat-ear { fill: hsl(var(--hue, 25) 55% 52%); stroke: var(--mb-ink); stroke-width: 2.2; stroke-linejoin: round; }
.mb-cat-ear-in { fill: hsl(var(--hue, 25) 70% 80%); }
.mb-cat-eyes { fill: var(--mb-ink); transform-box: fill-box; transform-origin: center; animation: mb-blink 4.6s infinite var(--blink-delay, 0s); }
.mb-cat-x { display: none; fill: none; stroke: #F3F4F6; stroke-width: 2; stroke-linecap: round; }
.mb-cat-nose { fill: #F472B6; }
.mb-cat-whisk { fill: none; stroke: var(--mb-ink); stroke-width: 1; stroke-linecap: round; opacity: .65; }
.mb-seat-letter { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); min-width: 16px; padding: 0 3px; border-radius: 6px;
    background: var(--mb-paper); border: 1.5px solid var(--mb-ink); font-size: 10px; line-height: 13px; font-weight: 800; text-align: center; box-sizing: border-box; }
.mb-seat.is-exploded .mb-cat-head, .mb-seat.is-exploded .mb-cat-ear { fill: #374151; }
.mb-seat.is-exploded .mb-cat-eyes { display: none; }
.mb-seat.is-exploded .mb-cat-x { display: block; }
@keyframes mb-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.mb-ring { position: absolute; inset: 0; width: 50px; height: 50px; transform: rotate(-90deg); }
.mb-ring circle { fill: none; stroke-width: 4; }
.mb-ring-track { stroke: transparent; }
.mb-ring-fill { stroke: transparent; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.mb-seat.is-timed .mb-ring-track { stroke: rgba(255, 255, 255, .35); }
.mb-seat.is-timed .mb-ring-fill { stroke: #FACC15; }
.mb-seat.is-urgent .mb-ring-fill { stroke: #EF4444; }
.mb-seat-time { position: absolute; right: -6px; top: -4px; display: none; min-width: 20px; padding: 1px 4px; border-radius: 999px; background: var(--mb-ink); color: #fff;
    font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mb-seat.is-timed .mb-seat-time { display: block; }
.mb-seat.is-urgent .mb-seat-time { background: #DC2626; }
.mb-seat-name { max-width: 100%; padding: 1px 6px; border-radius: 8px; background: var(--mb-paper); color: var(--mb-ink); font-size: 12px; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-sizing: border-box; border: 2px solid var(--mb-ink);
    transition: background-color .35s var(--mb-ease), color .35s; }
.mb-seat-meta { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.mb-seat-cards, .mb-owed { padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.mb-seat-cards { display: inline-block; background: rgba(0, 0, 0, .55); color: #fff; font-variant-numeric: tabular-nums; }
.mb-owed { background: var(--mb-turn); color: #fff; }
.mb-seat-note { min-height: 0; font-size: 11px; font-weight: 700; color: #FDE68A; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.mb-seat.is-current .mb-seat-initial { box-shadow: 0 0 0 4px var(--mb-seat-active), 0 0 18px var(--mb-seat-active); }
.mb-seat.is-current .mb-seat-name { background: var(--mb-seat-active); color: #fff; }
.mb-seat.is-me .mb-seat-name { border-color: var(--op-accent-dark); }
.mb-seat.is-out { opacity: .5; filter: grayscale(.8); }
.mb-seat.is-exploded .mb-seat-initial { background: #4B5563; }
.mb-seat.is-winner { opacity: 1; filter: none; }
.mb-seat.is-away .mb-seat-name { border-style: dashed; }

/* My area */
.mb-myarea { background: var(--op-bg-card); border: 1px solid var(--op-border-card); border-radius: var(--lm-r-lg, 18px); padding: 8px 10px 12px;
    box-shadow: 0 -10px 24px -18px rgba(43, 27, 18, .45); }
.mb-combo { min-height: 20px; margin: 0; font-size: 13px; font-weight: 700; color: var(--op-text-2); text-align: center; }
.mb-combo.is-valid { color: var(--op-accent-dark); }
.mb-hand-empty { margin: 8px auto; color: var(--op-text-muted); font-size: 13px; }
.mb-actions--play { justify-content: center; }
.mb-actions--play .lm-btn { min-width: 128px; min-height: 48px; font-size: 15px; }
.mb-my-turn .mb-btn-draw:not(:disabled) { box-shadow: 0 0 0 3px #FACC15; }
.mb-hint { min-height: 18px; margin: 6px 0 0; text-align: center; font-size: 13px; color: var(--op-text-2); }

/* Reaction bar + prompts: sticky so they stay reachable on phones */
/* Dock (hand + live panels) sticks to the bottom of the viewport */
.mb-dock { position: sticky; bottom: 0; z-index: 25; padding-bottom: 8px; }
.mb-dock-panels { position: absolute; left: 0; right: 0; bottom: 100%; display: grid; gap: 8px; padding-bottom: 8px;
    max-height: 62dvh; overflow-y: auto; pointer-events: none; }
.mb-dock-panels > * { pointer-events: auto; }
.mb-reaction, .mb-prompt, .mb-peek { position: relative; z-index: 20; padding: 10px 12px; border-radius: 16px; background: var(--mb-paper);
    border: 3px solid var(--mb-ink); box-shadow: 0 14px 28px -14px rgba(0, 0, 0, .55); }
.mb-reaction { border-color: var(--mb-reaction); }
.mb-reaction.is-noped { background: var(--mb-reaction-soft); }
.mb-reaction-title, .mb-prompt-title { margin: 0 0 4px; font-weight: 800; font-size: 14px; }
.mb-reaction-state, .mb-reaction-hint { margin: 0 0 6px; font-size: 12.5px; color: var(--op-text-2); }
.mb-drain { height: 6px; margin-bottom: 8px; border-radius: 999px; background: rgba(106, 52, 181, .15); overflow: hidden; }
.mb-drain span { display: block; height: 100%; background: var(--mb-reaction); transform-origin: left; transition: transform .1s linear; }
.mb-btn-nope { background: var(--mb-reaction); color: #fff; font-weight: 800; }
.mb-btn-reflect { background: var(--mb-turn); color: #fff; }
.mb-prompt[data-type="defuse"] { border-color: var(--mb-danger); background: var(--mb-danger-soft); text-align: center; }
.mb-btn-defuse { min-width: 200px; min-height: 56px !important; font-size: 18px; background: linear-gradient(135deg, var(--mb-rescue), #0F5A36); }
.mb-range { width: 100%; min-height: 44px; accent-color: var(--mb-danger); }
.mb-range-label { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.mb-prompt .mb-actions { margin-top: 6px; }
.mb-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.mb-card--mini { --mb-card-w: 64px; }

/* Floating feed of the latest moves (bottom-left of the table: free in every seat layout) */
.mb-feed { position: absolute; left: 2%; bottom: 1%; z-index: 5; display: grid; gap: 3px; max-width: 36%; margin: 0; padding: 0; list-style: none; pointer-events: none; }
.mb-feed-item { padding: 3px 8px; border-radius: 10px; background: rgba(20, 12, 6, .74); color: #FFF8EC; font-size: 11.5px; font-weight: 600; line-height: 1.3;
    animation: mb-feed-in .25s var(--mb-ease), mb-feed-out .4s ease-in 2.9s forwards; }
.mb-feed-item.mb-log--bomb_drawn, .mb-feed-item.mb-log--exploded { background: rgba(200, 30, 50, .88); }
.mb-feed-item.mb-log--game_over, .mb-feed-item.mb-log--defused { background: rgba(22, 121, 74, .88); }
@keyframes mb-feed-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes mb-feed-out { to { opacity: 0; } }

/* Log */
.mb-log-wrap { font-size: 13px; }
.mb-log-wrap summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; color: var(--op-text-2); font-weight: 700; }
.mb-log { margin: 4px 0 0; padding-left: 18px; max-height: 180px; overflow-y: auto; color: var(--op-text-2); line-height: 1.6; }
.mb-log--bomb_drawn, .mb-log--exploded { color: var(--mb-danger); font-weight: 700; }
.mb-log--game_over { color: var(--op-text); font-weight: 800; }

@media (max-width: 480px) {
    .mb-table { height: max(240px, min(340px, var(--mb-fit-h, 340px))); margin: 0 -6px; }   /* short phones: shrink rather than hide under the hand */
    .mb-felt { inset: 12% 4%; }
    .mb-seat { width: 76px; }
    .mb-seat.is-me { width: 120px; }   /* bottom-centre seat has room for the name + "Bạn" tag */
    .mb-seat-avatar, .mb-ring { width: 44px; height: 44px; }
    .mb-seat-initial { width: 34px; height: 34px; font-size: 15px; }
    .mb-actions--play .lm-btn { flex: 1; min-width: 0; }
    .mb-danger-bar { width: 48px; }
    .mb-feed { max-width: calc(50% - 66px); }   /* stay clear of my bottom-centre seat (120px wide) */
    .mb-feed-item:nth-last-child(n+3) { display: none; }
}
