/* Bùm! Bóng nước – toàn bộ CSS của trò (tiền tố bn-). Nạp sau style.css.
   Khung cảnh: sân trường buổi ra chơi, trời xanh, tường vôi vàng, sân xi măng. Sân chơi vẽ bằng canvas, cỡ ô tính bằng JS (px). */
body[data-scene="bongnuoc"] {
  background-color: #cfe9f7;
  background-image:
    linear-gradient(180deg, #bfe3f6 0, #e3f3fb 38vh, #f1d98a 38vh, #e8c362 calc(38vh + 6px), #e8c362 70vh, #b9b2a3 70vh, #a9a294 100%),
    radial-gradient(rgba(60, 60, 40, .06) 1px, transparent 1.5px);
  background-size: auto, 7px 7px;
  background-attachment: fixed, scroll;
}
body[data-scene="bongnuoc"] .bn-backlink { color: #173a6b; background: none; border: 0; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.art-bongnuoc { background: #bfe3f6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96'%3E%3Crect width='96' height='96' fill='%23d8d3c5'/%3E%3Cpath d='M0 0h96v96H0z' fill='none' stroke='%23c3bba8' stroke-width='2'/%3E%3Cpath d='M48 10v76M10 48h76' stroke='%235ec2f2' stroke-width='16' stroke-linecap='round' opacity='.85'/%3E%3Cpath d='M48 14v68M14 48h68' stroke='%23d7f2ff' stroke-width='6' stroke-linecap='round'/%3E%3Cpath d='M48 24c15 0 16 26 0 27-16-1-15-27 0-27z' fill='%232f6fd6' stroke='%231c4597' stroke-width='2'/%3E%3Cpath d='M45 21h6l-3 4z' fill='%231c4597'/%3E%3Cellipse cx='43' cy='32' rx='3' ry='5' fill='%23fff' opacity='.8' transform='rotate(-25 43 32)'/%3E%3Ccircle cx='24' cy='26' r='4' fill='%237fd0f7'/%3E%3Ccircle cx='72' cy='70' r='5' fill='%237fd0f7'/%3E%3Ccircle cx='70' cy='22' r='3' fill='%237fd0f7'/%3E%3C/svg%3E") center / cover no-repeat; }

/* ================= Màn chọn, phòng chờ ================= */
.bn-setup { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); max-width: 660px; }
.bn-head, .bn-lhead { display: flex; gap: 14px; align-items: center; color: #173a6b; }
.bn-headart { display: block; width: 76px; height: 76px; flex: none; border-radius: 12px; border: 3px solid #1c4597; box-shadow: 0 3px 0 rgba(0, 0, 0, .2); }
.bn-lhead .bn-headart { width: 56px; height: 56px; }
.bn-h1, .bn-lhead h1 { margin: 0; font: 700 2.3rem/1.25 "Mali", var(--f-hand); color: #173a6b; text-wrap: balance; padding-top: .08em; }
.bn-lhead h1 { font-size: 1.7rem; }
.bn-head p, .bn-lhead p { margin: 4px 0 0; color: #23466f; font-size: .95rem; }
.bn-box { background: #fdfdf7; border: 2px solid #1c4597; border-radius: 14px; padding: 14px 16px 16px; display: grid; gap: 14px; box-shadow: 0 5px 0 rgba(28, 69, 151, .22); min-width: 0; }
.bn-box h1 { margin: 0; font: 700 1.6rem/1.3 "Mali", var(--f-hand); color: #173a6b; }
.bn-field { display: grid; gap: 6px; min-width: 0; }
.bn-field h2 { margin: 0; font: 400 1.3rem/1.3 var(--f-hand); color: #1c4597; }
.bn-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.bn-seg button { font: 600 .92rem/1.3 var(--f-body); min-height: 44px; padding: .4em .95em; border-radius: 999px; border: 1.5px solid #3a6fc4; background: #fff; color: #1c4597; cursor: pointer; }
.bn-seg button[aria-checked="true"] { background: #1c4597; border-color: #1c4597; color: #fff; }
.bn-chk { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: .95rem; cursor: pointer; }
.bn-chk input { width: 22px; height: 22px; accent-color: #1c4597; }
.bn-online { gap: 10px; }
.bn-join { display: grid; gap: 6px; margin-top: 4px; }
.bn-join label { font: 400 1.2rem/1.3 var(--f-hand); color: #c3262c; }
.bn-joinrow { display: flex; gap: 8px; min-width: 0; }
.bn-joinrow input { flex: 1 1 auto; min-width: 0; font: 600 1.1rem/1.2 var(--f-body); letter-spacing: .12em; text-transform: uppercase; padding: .55em .7em; border: 2px solid #c3262c; border-radius: 10px; min-height: 44px; }
.bn-joinrow .btn { flex: none; }
.bn-netnote { color: #52607a; }
.bn-stat { color: #3d4a66; margin: 0; }
.bn-rules { background: #fdfdf7; border: 2px solid #1c4597; border-radius: 14px; padding: 10px 16px; }
.bn-rules summary { cursor: pointer; font: 400 1.25rem/1.6 var(--f-hand); color: #1c4597; min-height: 44px; display: flex; align-items: center; }
.bn-rules ul { padding-left: 1.2em; }
.bn-rules li { margin: .3em 0; }
.bn-note { font-size: .85rem; color: #5d5b78; }
.bn-seats { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bn-seats li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: #f2f6fd; border-left: 6px solid var(--c); min-height: 44px; min-width: 0; }
.bn-seats .bn-nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bn-seats em { font-size: .82rem; color: #52607a; font-style: normal; flex: none; }
.bn-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); flex: none; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2); }
.bn-status { margin: 0; font-weight: 600; color: #173a6b; }
.bn-lobby .code-big { margin: 0; }

/* ================= Màn chơi ================= */
.bn-game { display: grid; gap: 6px; justify-items: stretch; max-width: 980px; margin: 0 auto; min-width: 0; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.bn-bar { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bn-back, .bn-ic { flex: none; min-width: 44px; height: 44px; border-radius: 10px; border: 2px solid #1c4597; background: #fff; color: #1c4597; font: 700 1.1rem/1 var(--f-body); cursor: pointer; padding: 0 8px; }
.bn-title { flex: 1 1 auto; min-width: 0; font: 700 1.05rem/1.25 "Mali", var(--f-hand); color: #173a6b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-clock { flex: none; font: 700 .95rem/1 var(--f-body); color: #173a6b; background: #fff; border: 1.5px solid #8aa6d8; border-radius: 99px; padding: 6px 10px; font-variant-numeric: tabular-nums; min-width: 3.6em; text-align: center; }
.bn-clock:empty { visibility: hidden; }
.bn-clock.hurry { background: #fdecea; border-color: #c3262c; color: #c3262c; }
.bn-hud { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 5px; min-width: 0; }
.bn-chip { display: flex; align-items: center; gap: 6px; min-width: 0; background: rgba(255, 255, 255, .92); border: 1.5px solid var(--c); border-radius: 99px; padding: 3px 8px 3px 5px; font-size: .82rem; line-height: 1.2; }
.bn-chip.me { box-shadow: 0 0 0 2px var(--c); font-weight: 700; }
.bn-chip.out { opacity: .55; background: #e3f1fa; }
.bn-chip .bn-nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-stars { display: flex; gap: 2px; flex: none; }
.bn-stars i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--c); }
.bn-stars i.on { background: var(--c); }
.bn-mid { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "stage stage stage" "pad . side"; align-items: center; gap: 8px 10px; min-width: 0; }
.bn-stage { grid-area: stage; position: relative; justify-self: center; line-height: 0; touch-action: none; }
.bn-cv { display: block; border-radius: 8px; box-shadow: 0 4px 0 rgba(30, 40, 70, .25), 0 0 0 3px #fff; background: #d8d3c5; }
.bn-pad { grid-area: pad; display: none; position: relative; width: 136px; height: 136px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .85) 0 30%, rgba(255, 255, 255, .55) 31% 100%); border: 3px solid #1c4597; touch-action: none; }
.bn-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: #1c4597; box-shadow: 0 3px 0 rgba(0, 0, 0, .25), inset 0 -4px 0 rgba(0, 0, 0, .2); pointer-events: none; }
.bn-pad i { position: absolute; width: 0; height: 0; border: 9px solid transparent; pointer-events: none; opacity: .55; }
.bn-pad .u { left: calc(50% - 9px); top: 6px; border-bottom-color: #1c4597; }
.bn-pad .d { left: calc(50% - 9px); bottom: 6px; border-top-color: #1c4597; }
.bn-pad .l { top: calc(50% - 9px); left: 6px; border-right-color: #1c4597; }
.bn-pad .r { top: calc(50% - 9px); right: 6px; border-left-color: #1c4597; }
.bn-pad[data-d="1"] .u, .bn-pad[data-d="2"] .r, .bn-pad[data-d="3"] .d, .bn-pad[data-d="4"] .l { opacity: 1; }
.bn-side { grid-area: side; display: grid; justify-items: center; gap: 6px; }
.bn-me { display: flex; flex-wrap: wrap; gap: 4px 8px; justify-content: center; font: 600 .9rem/1.3 var(--f-body); color: #173a6b; background: rgba(255, 255, 255, .85); border-radius: 10px; padding: 3px 8px; }
.bn-me:empty { display: none; }
.bn-fire { display: none; width: 84px; height: 84px; border-radius: 50%; border: 3px solid #1c4597; background: radial-gradient(circle at 38% 32%, #9fd8ff 0, #3a8fe0 45%, #1c4597 100%); color: #fff; font: 700 1rem/1 "Mali", var(--f-body); box-shadow: 0 5px 0 #12306b; touch-action: none; cursor: pointer; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.bn-fire.on { transform: translateY(3px); box-shadow: 0 2px 0 #12306b; }
.bn-touch .bn-pad { display: block; }
.bn-touch .bn-fire { display: block; }
.bn-game:not(.bn-touch) .bn-mid { grid-template-areas: "stage stage stage" ". side ."; }
.bn-netline { margin: 0; text-align: center; color: #23466f; min-height: 1.2em; }
.bn-netline:empty { display: none; }
/* điện thoại nằm ngang: cần điều khiển bên trái, nút bóng bên phải, sân ở giữa */
.bn-land .bn-mid { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "pad stage side"; }
.bn-land .bn-hud { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bn-land .bn-chip { font-size: .76rem; padding: 2px 6px 2px 4px; }
.bn-land .bn-bar .bn-back, .bn-land .bn-ic { height: 40px; }
@media (orientation: landscape) and (max-height: 540px) {
  body[data-scene="bongnuoc"] #app { padding-block: 4px 4px; }
  .bn-game { gap: 4px; }
}
.bn-over { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 8px; background: rgba(20, 40, 80, .28); border-radius: 8px; line-height: 1.5; z-index: 2; overflow: auto; }
.bn-card { background: #fffef8; border: 2.5px solid #1c4597; border-radius: 14px; padding: 12px 16px; max-width: min(92%, 420px); text-align: center; box-shadow: 0 5px 0 rgba(0, 0, 0, .2); display: grid; gap: 8px; }
.bn-card h2 { margin: 0; font: 700 1.25rem/1.3 "Mali", var(--f-hand); color: #173a6b; text-wrap: balance; }
.bn-card p { margin: 0; font-size: .95rem; }
.bn-card .bn-rules { text-align: left; border-width: 1.5px; padding: 4px 10px; max-height: 40vh; overflow: auto; font-size: .9rem; }
.bn-round.win h2 { color: #c3262c; }
.bn-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; text-align: left; }
.bn-board li { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; background: #f2f6fd; border-left: 5px solid var(--c); min-width: 0; }
.bn-board b { margin-left: auto; flex: none; }
.bn-card .res-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.bn-card .res-actions .btn { min-height: 44px; }
.bn-card.bn-result { padding: 0; border: 0; background: none; box-shadow: none; }
.bn-card .res-card { background: #fffef8; border: 2.5px solid #1c4597; border-radius: 14px; padding: 12px 16px; display: grid; gap: 10px; box-shadow: 0 5px 0 rgba(0, 0, 0, .2); }
@media (max-width: 360px) {
  .bn-bar { gap: 4px; flex-wrap: wrap; }
  .bn-back, .bn-ic { min-width: 40px; padding: 0 6px; }
  .bn-clock { padding: 5px 7px; min-width: 3.2em; }
  .bn-bar .rot-btn { padding-inline: 6px; }
  .bn-pad { width: 120px; height: 120px; }
  .bn-fire { width: 76px; height: 76px; }
  .bn-h1 { font-size: 1.9rem; }
  .bn-hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .bn-fire.on { transform: none; }
}
