/* Bắn tàu – toàn bộ CSS của trò (tiền tố bt-). Nạp sau style.css.
   Khung cảnh: trang vở ô ly, biển kẻ ô 10 × 10, tàu vẽ bút bi xanh, trúng gạch X bút đỏ, trượt chấm một chấm. */
body[data-scene="bantau"] {
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 22px, var(--margin) 22px, var(--margin) 23.5px, transparent 23.5px),
    repeating-linear-gradient(180deg, transparent 0 7px, var(--rule) 7px 8px),
    repeating-linear-gradient(90deg, transparent 0 31px, var(--rule-strong) 31px 32px),
    repeating-linear-gradient(180deg, transparent 0 31px, var(--rule-strong) 31px 32px);
}
@media (min-width: 700px) { body[data-scene="bantau"] { background-image: linear-gradient(90deg, transparent 38px, var(--margin) 38px, var(--margin) 39.5px, transparent 39.5px), repeating-linear-gradient(180deg, transparent 0 7px, var(--rule) 7px 8px), repeating-linear-gradient(90deg, transparent 0 31px, var(--rule-strong) 31px 32px), repeating-linear-gradient(180deg, transparent 0 31px, var(--rule-strong) 31px 32px); } body[data-scene="bantau"] #app { padding-left: 56px; } }
body[data-scene="bantau"] .bt-backlink { color: var(--ink); background: none; border: 0; cursor: pointer; padding: 0; }
.art-bantau { background: #fcfcf7 url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2096%2096%22%3E%3Crect%20width%3D%2296%22%20height%3D%2296%22%20fill%3D%22%23fcfcf7%22%2F%3E%3Cg%20stroke%3D%22%237060c4%22%20stroke-opacity%3D%22.16%22%3E%3Cpath%20d%3D%22M0%206H96%22%2F%3E%3Cpath%20d%3D%22M0%2018H96%22%2F%3E%3Cpath%20d%3D%22M0%2030H96%22%2F%3E%3Cpath%20d%3D%22M0%2042H96%22%2F%3E%3Cpath%20d%3D%22M0%2054H96%22%2F%3E%3Cpath%20d%3D%22M0%2066H96%22%2F%3E%3Cpath%20d%3D%22M0%2078H96%22%2F%3E%3Cpath%20d%3D%22M0%2090H96%22%2F%3E%3C%2Fg%3E%3Cg%20stroke%3D%22%237060c4%22%20stroke-opacity%3D%22.42%22%3E%3Cpath%20d%3D%22M0%200H96M0%200V96%22%2F%3E%3Cpath%20d%3D%22M0%2012H96M12%200V96%22%2F%3E%3Cpath%20d%3D%22M0%2024H96M24%200V96%22%2F%3E%3Cpath%20d%3D%22M0%2036H96M36%200V96%22%2F%3E%3Cpath%20d%3D%22M0%2048H96M48%200V96%22%2F%3E%3Cpath%20d%3D%22M0%2060H96M60%200V96%22%2F%3E%3Cpath%20d%3D%22M0%2072H96M72%200V96%22%2F%3E%3Cpath%20d%3D%22M0%2084H96M84%200V96%22%2F%3E%3Cpath%20d%3D%22M0%2096H96M96%200V96%22%2F%3E%3C%2Fg%3E%3Cpath%20d%3D%22M14%207.5L14%2088%22%20stroke%3D%22%23d64056%22%20stroke-width%3D%221.3%22%20opacity%3D%22.7%22%2F%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%231c3ca8%22%20stroke-linejoin%3D%22round%22%20stroke-linecap%3D%22round%22%3E%3Cpath%20d%3D%22M26%2027Q26%2025%2028%2025L76%2025Q83%2027%2086%2030Q83%2033%2076%2035L28%2035Q26%2035%2026%2033Z%22%20fill%3D%22rgba(28%2C60%2C168%2C.1)%22%20stroke-width%3D%221.6%22%2F%3E%3Cpath%20d%3D%22M26%2027Q26%2025%2028%2025L76%2025Q83%2027%2086%2030Q83%2033%2076%2035L28%2035Q26%2035%2026%2033Z%22%20stroke-width%3D%22.7%22%20opacity%3D%22.45%22%20transform%3D%22translate(.7%20-.5)%22%2F%3E%3Cpath%20d%3D%22M30%2030H70%22%20stroke-dasharray%3D%223%202.4%22%20stroke-width%3D%221.1%22%2F%3E%3Crect%20x%3D%2262%22%20y%3D%2226.5%22%20width%3D%226%22%20height%3D%223%22%20stroke-width%3D%221%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%231c3ca8%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M20%2051Q16%2051%2016.5%2056L16.5%2079Q16.5%2084%2020%2084Q23.5%2084%2023.5%2079L23.5%2056Q24%2051%2020%2051Z%22%20fill%3D%22rgba(28%2C60%2C168%2C.1)%22%20stroke-width%3D%221.5%22%2F%3E%3Crect%20x%3D%2217.6%22%20y%3D%2264%22%20width%3D%224.8%22%20height%3D%227%22%20rx%3D%222%22%20stroke-width%3D%221%22%2F%3E%3C%2Fg%3E%3Cg%20stroke%3D%22%23c3262c%22%20stroke-width%3D%222.3%22%20stroke-linecap%3D%22round%22%3E%3Cpath%20d%3D%22M39%2026L45%2034M45%2026L39%2034%22%2F%3E%3Cpath%20d%3D%22M51%2026L57%2034M57%2026L51%2034%22%2F%3E%3Cpath%20d%3D%22M15.5%2074L24.5%2082M24.5%2074L15.5%2082%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22%231c3ca8%22%3E%3Ccircle%20cx%3D%2254%22%20cy%3D%2266%22%20r%3D%221.9%22%2F%3E%3Ccircle%20cx%3D%2278%22%20cy%3D%2254%22%20r%3D%221.9%22%2F%3E%3Ccircle%20cx%3D%2242%22%20cy%3D%2278%22%20r%3D%221.9%22%2F%3E%3Ccircle%20cx%3D%2266%22%20cy%3D%2290%22%20r%3D%221.9%22%2F%3E%3Ccircle%20cx%3D%2230%22%20cy%3D%226%22%20r%3D%221.9%22%2F%3E%3Ccircle%20cx%3D%2278%22%20cy%3D%2218%22%20r%3D%221.9%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%233b8fd9%22%20stroke-linecap%3D%22round%22%20stroke-width%3D%221.1%22%3E%3Ccircle%20cx%3D%2266%22%20cy%3D%2266%22%20r%3D%223.4%22%2F%3E%3Ccircle%20cx%3D%2266%22%20cy%3D%2266%22%20r%3D%226.2%22%20opacity%3D%22.6%22%2F%3E%3Cpath%20d%3D%22M66%2057.5v-2.5M72%2060l2-2M60%2060l-2-2M74.5%2066h2.5M57.5%2066h-2.5%22%2F%3E%3C%2Fg%3E%3Ccircle%20cx%3D%2266%22%20cy%3D%2266%22%20r%3D%221.9%22%20fill%3D%22%231c3ca8%22%2F%3E%3Cg%20font-family%3D%22Patrick%20Hand%2Ccursive%22%20font-size%3D%227%22%20fill%3D%22%231c3ca8%22%20opacity%3D%22.8%22%3E%3Ctext%20x%3D%2216%22%20y%3D%225.5%22%3EA%3C%2Ftext%3E%3Ctext%20x%3D%2228%22%20y%3D%225.5%22%3E%20%3C%2Ftext%3E%3Ctext%20x%3D%222%22%20y%3D%2220%22%3E1%3C%2Ftext%3E%3Ctext%20x%3D%222%22%20y%3D%2244%22%3E3%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fsvg%3E") center/cover no-repeat; }

/* ================= Màn chọn ================= */
.bt-setup { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); max-width: 640px; }
.bt-head { display: flex; gap: 14px; align-items: center; }
.bt-headart { display: block; width: 76px; height: 76px; flex: none; border-radius: 12px; border: 2px solid var(--ink); box-shadow: 3px 4px 0 rgba(28, 60, 168, .15); }
.bt-h1 { margin: 0; font: 700 2.6rem/1.25 "Mali", var(--f-hand); color: var(--ink); text-wrap: balance; padding-top: .08em; }
.bt-head p { margin: 4px 0 0; color: var(--text); font-size: .95rem; }
.bt-box { background: rgba(255, 255, 255, .92); border: 2px solid var(--ink); border-radius: 16px; padding: 14px 16px 16px; display: grid; gap: 14px; box-shadow: 3px 5px 0 rgba(28, 60, 168, .14); min-width: 0; }
.bt-field { display: grid; gap: 6px; min-width: 0; }
.bt-field h2 { margin: 0; font: 400 1.35rem/1.3 var(--f-hand); color: var(--ink); }
.bt-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.bt-seg button { font: 600 .9rem/1.3 var(--f-body); min-height: 40px; padding: .4em .95em; border-radius: 999px; border: 1.5px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; max-width: 100%; text-align: center; }
.bt-seg button[aria-checked="true"] { background: var(--ink); color: #fff; }
.bt-chk { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: .95rem; cursor: pointer; }
.bt-chk input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; }
.bt-chk:has(input:disabled) { opacity: .5; cursor: default; }
.bt-lvhint, .bt-rnote { min-height: 1.3em; }
.bt-stat { color: var(--ink); }
.bt-rules { background: rgba(255, 255, 255, .9); border: 1.5px dashed var(--ink); border-radius: 14px; padding: 12px 18px; }
.bt-rules summary { font-family: var(--f-hand); font-size: 1.4rem; line-height: 1.4; color: var(--ink); cursor: pointer; min-height: 40px; display: list-item; }
.bt-rules p, .bt-rules li { font-size: .95rem; }
.bt-rules ul { padding-left: 1.2em; }
.bt-note { color: var(--muted); font-size: .86rem !important; }
.bt-resume { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; padding: 12px 14px; background: #fff4c9; border: 2px solid #d9b740; border-radius: 14px; }
.bt-resume > div:first-child { display: grid; gap: 2px; min-width: 0; }
.bt-resume b { font: 400 1.35rem/1.3 var(--f-hand); color: var(--ink); }
.bt-resume span { font-size: .88rem; }
.bt-resume-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================= Màn chơi ================= */
.bt-play { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); position: relative; }
.bt-bar { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bt-bar .back { font-size: 1.7rem; padding: 0 10px; margin-left: -10px; justify-content: center; color: var(--ink); }
.bt-title { flex: 1; min-width: 0; display: grid; }
.bt-title b { font: 700 1.45rem/1.2 "Mali", var(--f-hand); color: var(--ink); }
.bt-title span { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.bt-field2 { display: grid; gap: 10px 12px; grid-template-columns: minmax(0, 46fr) minmax(0, 54fr); grid-template-areas: "own info" "tgt tgt"; align-items: start; }
.bt-own { grid-area: own; } .bt-info { grid-area: info; } .bt-tgt { grid-area: tgt; }
.bt-side { min-width: 0; margin: 0; }
.bt-cap { margin: 0 0 2px; font: 400 1.12rem/1.25 var(--f-hand); color: var(--ink); text-wrap: balance; }
.bt-own .bt-cap { font-size: .98rem; }
.bt-tgt .bt-cap { color: var(--red); }

/* Ô biển */
.bt-gb { display: grid; grid-template-columns: 1.35em minmax(0, 1fr); grid-template-rows: 1.35em auto; font: 400 15px/1 var(--f-hand); color: var(--ink); }
.bt-own .bt-gb { font-size: 11px; }
.bt-colh { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); align-items: end; text-align: center; padding-bottom: 2px; }
.bt-rowh { display: grid; grid-template-rows: repeat(10, minmax(0, 1fr)); align-items: center; text-align: right; padding-right: 3px; }
.bt-sea { position: relative; background-color: #fdfdf8; border: 2px solid var(--ink); border-radius: 3px;
  background-image: linear-gradient(90deg, rgba(112, 96, 196, .42) 1px, transparent 1px), linear-gradient(180deg, rgba(112, 96, 196, .42) 1px, transparent 1px), linear-gradient(180deg, rgba(112, 96, 196, .14) 1px, transparent 1px);
  background-size: 10% 10%, 10% 10%, 10% 5%; background-position: -1px -1px; box-shadow: 2px 3px 0 rgba(28, 60, 168, .12); }
/* hình vuông bằng padding-top thay cho aspect-ratio (Safari iOS < 15 chưa có) */
.bt-sea::before { content: ""; display: block; padding-top: 100%; }
.bt-shipl, .bt-cells, .bt-prev { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.bt-shipl { z-index: 1; } .bt-cells { z-index: 2; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); grid-template-rows: repeat(10, minmax(0, 1fr)); } .bt-prev { z-index: 3; pointer-events: none; }
.bt-cell { position: relative; display: block; margin: 0; padding: 0; border: 0; background: transparent; min-width: 0; min-height: 0; font: inherit; color: inherit; border-radius: 2px; -webkit-tap-highlight-color: transparent; }
button.bt-cell { cursor: default; }
.bt-can button.bt-cell[data-st=""], .bt-can button.bt-cell:not([data-st]) { cursor: crosshair; }
@media (hover: hover) { .bt-can button.bt-cell[data-st=""]:hover, .bt-can button.bt-cell:not([data-st]):hover { background: rgba(195, 38, 44, .1); box-shadow: inset 0 0 0 2px rgba(195, 38, 44, .45); } }
button.bt-cell:focus-visible { outline: 3px solid #ffd23f; outline-offset: -2px; z-index: 1; }
.bt-tgt:not(.bt-can) .bt-cells { cursor: default; }
.bt-mk { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.bt-sure { opacity: .8; }
.bt-ship { position: absolute; padding: 0; }
.bt-ship-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bt-ship.bt-ghost { opacity: .5; }
.bt-ship.bt-lift { opacity: .25; }
.bt-pv { position: absolute; border-radius: 4px; }
.bt-pv.ok { background: rgba(43, 150, 80, .18); box-shadow: inset 0 0 0 2px rgba(43, 150, 80, .7); }
.bt-pv.bad { background: rgba(195, 38, 44, .14); box-shadow: inset 0 0 0 2px rgba(195, 38, 44, .65); }
.bt-drag { position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; opacity: .9; filter: drop-shadow(2px 4px 3px rgba(28, 60, 168, .3)); }
.bt-drag.bad { opacity: .6; filter: drop-shadow(2px 4px 3px rgba(195, 38, 44, .35)) grayscale(.3); }
.bt-aim::after { content: ""; position: absolute; top: 12%; right: 12%; bottom: 12%; left: 12%; border: 2px dashed var(--red); border-radius: 50%; animation: bt-spin 1.2s linear infinite; }

/* Hiệu ứng bắn: nét bút gạch X, tia nước, ngòi nổ, nét gạch tàu chìm */
.bt-fresh .bt-x1, .bt-fresh .bt-x2 { stroke-dasharray: 100; stroke-dashoffset: 100; animation: bt-draw .17s ease-out forwards; }
.bt-fresh .bt-x2 { animation-delay: .17s; }
.bt-fresh .bt-splash { transform-origin: 20px 20px; animation: bt-splash .7s ease-out forwards; }
.bt-fresh .bt-dot { transform-origin: 20px 20px; animation: bt-pop .28s ease-out; }
.bt-fresh .bt-boom { transform-origin: 20px 20px; animation: bt-boom .55s ease-out forwards; }
.bt-new .bt-scrib { stroke-dasharray: 100; stroke-dashoffset: 100; animation: bt-draw .45s .25s ease-out forwards; }
.bt-new { animation: bt-pop .35s ease-out; }
@keyframes bt-draw { to { stroke-dashoffset: 0; } }
@keyframes bt-splash { 0% { transform: scale(.3); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes bt-boom { 0% { transform: scale(.3) rotate(0); opacity: 1; } 100% { transform: scale(1.45) rotate(20deg); opacity: 0; } }
@keyframes bt-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes bt-spin { to { transform: rotate(360deg); } }
@keyframes bt-shake { 0%, 100% { translate: 0; } 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
.bt-shake { animation: bt-shake .25s 2; }
@media (prefers-reduced-motion: reduce) { .bt-fresh *, .bt-new, .bt-new *, .bt-shake, .bt-aim::after { animation: none !important; stroke-dashoffset: 0 !important; } .bt-splash, .bt-boom { display: none; } }

/* Thông tin bên cạnh */
.bt-info { display: grid; gap: 8px; min-width: 0; align-content: start; }
.bt-status { margin: 0; font: 400 1.05rem/1.3 var(--f-hand); color: var(--text); min-height: 3.9em; text-wrap: pretty; }
.bt-tally { min-width: 0; }
.bt-tt { margin: 0 0 2px; font: 600 .8rem/1.3 var(--f-body); color: var(--ink); }
.bt-tally-them .bt-tt { color: var(--red); }
.bt-tally ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 9px; }
.bt-tally li { display: flex; gap: 6px; align-items: baseline; font-size: .78rem; line-height: 1.3; min-width: 0; }
.bt-tally li { position: relative; }
.bt-tally li > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bt-pips { flex: none; color: var(--ink); letter-spacing: -1px; font-size: .8rem; }
.bt-tally li.bt-dead { color: var(--red); text-decoration: line-through; }
.bt-tally li.bt-dead .bt-pips { color: var(--red); opacity: .6; }
.bt-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.bt-acts:empty { display: none; }
.bt-log { list-style: none; margin: 0; padding: 0; font: 400 1rem/1.35 var(--f-hand); color: var(--muted); display: grid; gap: 0; }
.bt-log:empty { display: none; }
.bt-log li:first-child { color: var(--text); }
.bt-banner { margin: 0; }
.bt-verify.ok { color: #1f7a4d; } .bt-verify.bad { color: var(--red); font-weight: 600; }

/* Xếp tàu */
.bt-dockwrap { display: grid; gap: 10px; min-width: 0; }
.bt-ban .bt-dockwrap, .bt-xep .bt-info, .bt-xep .bt-tgt, .bt-xep .bt-acts, .bt-xep .bt-log { display: none; }
.bt-xep .bt-field2 { grid-template-columns: minmax(0, 1fr); grid-template-areas: "own"; }
.bt-xep .bt-own { max-width: 460px; width: 100%; justify-self: center; }
.bt-xep .bt-own .bt-gb { font-size: 15px; }
.bt-xep .bt-own .bt-cap { font-size: 1.12rem; }
.bt-xep .bt-sea { touch-action: none; }
.bt-xep .bt-ship { cursor: grab; }
.bt-dock { display: flex; flex-wrap: wrap; gap: 8px; }
.bt-dship { display: grid; justify-items: start; gap: 3px; padding: 6px 8px; min-height: 48px; border: 1.5px dashed var(--ink); border-radius: 10px; background: rgba(255, 255, 255, .85); color: var(--ink); cursor: grab; touch-action: none; font: 500 .8rem/1.2 var(--f-body); max-width: 100%; }
.bt-dship[aria-pressed="true"] { border-style: solid; background: #e7ecfb; box-shadow: 0 0 0 3px #ffd23f; }
.bt-dimg { display: block; }
.bt-dname { white-space: nowrap; }
.bt-placeacts { display: flex; flex-wrap: wrap; gap: 8px; }
.bt-placeacts .btn { flex: 1 1 auto; }
.bt-dockhint { min-height: 2.6em; color: var(--text); }

@media (min-width: 860px) {
  .bt-field2 { grid-template-columns: minmax(0, 520px) minmax(0, 1fr); grid-template-areas: "tgt own" "tgt info"; gap: 12px 26px; }
  .bt-own { max-width: 320px; }
  .bt-own .bt-gb { font-size: 13px; }
  .bt-tgt .bt-gb { font-size: 17px; }
  .bt-tally ul { display: grid; gap: 1px; }
  .bt-tally li { font-size: .86rem; }
  .bt-tally li > span:last-child { position: static; width: auto; height: auto; clip: auto; min-width: 0; text-overflow: ellipsis; }
  .bt-pips { width: 3.4em; font-size: .72rem; }
  .bt-status { font-size: 1.15rem; min-height: 2.7em; }
  .bt-play.bt-xep { grid-template-columns: minmax(0, 500px) minmax(0, 1fr); column-gap: 28px; align-items: start; }
  .bt-play.bt-xep > .bt-bar, .bt-play.bt-xep > .bt-banner { grid-column: 1 / -1; }
  .bt-play.bt-xep .bt-dockwrap { padding-top: 26px; }
  .bt-xep .bt-own { max-width: none; }
}
@media (max-width: 380px) { .bt-gb { font-size: 13px; } .bt-status { font-size: 1rem; } }
