/* Chợ Nổi — dùng chung nút, bảng, sảnh của /style.css; ở đây chỉ phần riêng của game */
body.cn {
  --sea: #cfe6dc; --sea-deep: #9ccbbb; --river: #5fa8a0; --river-2: #3f8c88; --wood: #8a5a33;
  background: linear-gradient(180deg, var(--sea) 0%, var(--sea-deep) 100%) fixed;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.cn { --sea: #12352f; --sea-deep: #0b2420; --river: #1d5b57; --river-2: #154844; }
}
:root[data-theme="dark"] body.cn { --sea: #12352f; --sea-deep: #0b2420; --river: #1d5b57; --river-2: #154844; }

.cn-home .back { color: var(--ink-soft); font-size: 14px; text-decoration: none; align-self: flex-start; }
.cn-logo svg { width: 120px; height: 60px; display: block; margin: 0 auto; filter: drop-shadow(0 4px 6px rgba(0,0,0,.2)); }

.cn-game { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; min-height: 100%; }
.cn-game h3 { font: 700 15px/1.2 var(--font-display); margin: 0 0 4px; display: flex; align-items: baseline; gap: 8px; }
.cn-game h3 small { font: 500 11.5px var(--font-body); color: var(--ink-soft); }
.cn-game section { padding: 0 8px; }
.status .tools { display: flex; gap: 4px; }
.status .tools .btn { padding: 4px 8px; min-height: 32px; }
.status .lr { color: var(--danger); }

/* người chơi */
.cn-pl .pl .stats { display: block; }
.cn-pl .pl .bon { display: flex; gap: 2px; margin-top: 3px; }
.cn-pl .pl .bon i { font-style: normal; font-size: 10px; font-weight: 700; min-width: 15px; height: 15px; line-height: 15px; text-align: center; border-radius: 4px; background: var(--g); color: #fff; }
.cn-pl .pl .bon i.z { opacity: .25; }
.pl.bump { animation: cnBump .6s ease-out; }
@keyframes cnBump { 30% { transform: scale(1.06); } }

/* sông */
.river { background: linear-gradient(180deg, var(--river) 0%, var(--river-2) 100%); margin: 0 6px; padding: 8px 6px 6px !important; border-radius: 16px; position: relative; overflow: hidden; color: #fff; }
.river h3 small { color: rgba(255,255,255,.8); }
.river::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(100deg, transparent 0 22px, rgba(255,255,255,.08) 22px 26px); animation: cnWave 6s linear infinite; pointer-events: none; }
@keyframes cnWave { to { background-position: 120px 0; } }
.river.flowing .boat { animation: cnDrift 1s ease-out; }
@keyframes cnDrift { from { transform: translateX(-30%); opacity: .4; } }
.boats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; position: relative; }
.boat { position: relative; background: var(--panel); color: var(--ink); border: 2px solid transparent; border-radius: 12px; padding: 4px 3px 5px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 112px; font: inherit; cursor: pointer; }
.boat.t2 { background: linear-gradient(180deg, var(--panel) 60%, color-mix(in srgb, var(--g) 18%, var(--panel))); }
.boat.t3 { background: linear-gradient(180deg, color-mix(in srgb, var(--sun) 25%, var(--panel)), var(--panel)); }
.boat.ok { border-color: var(--sun); box-shadow: 0 0 0 2px rgba(255,201,60,.35); }
.boat.sel, .order.sel, .basket.sel { border-color: var(--ink); box-shadow: 0 0 0 3px var(--sun); transform: translateY(-2px); }
.boat.new, .basket.new { animation: cnNew .9s ease-out; }
@keyframes cnNew { from { box-shadow: 0 0 0 8px rgba(255,255,255,.8); } }
.boat.empty { color: rgba(255,255,255,.7); background: rgba(255,255,255,.08); border: 2px dashed rgba(255,255,255,.35); justify-content: center; font-size: 11px; }
.boat .bt { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 0 2px; }
.boat .bi { font-size: 18px; }
.boat .bp { font: 800 18px/1 var(--font-display); color: var(--ink); }
.boat .hull svg { width: 48px; height: 22px; display: block; }
.boat .cost { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.boat .off { position: absolute; top: -6px; left: -4px; background: var(--danger); color: #fff; font: 700 11px/1 var(--font-body); padding: 3px 5px; border-radius: 999px; }
.boat .drift { position: absolute; bottom: -1px; left: 0; right: 0; font-size: 9px; color: var(--danger); font-weight: 700; }
.flowhint { display: flex; justify-content: space-between; gap: 6px; font-size: 10px; color: rgba(255,255,255,.85); margin-top: 4px; }
.flowhint span:nth-child(2) { text-align: center; flex: 1; }

/* hàng */
.gc { display: inline-flex; align-items: center; gap: 1px; font-size: 11.5px; font-weight: 700; padding: 1px 4px 1px 2px; border-radius: 999px; background: color-mix(in srgb, var(--g) 22%, var(--panel)); color: var(--ink); line-height: 1.2; }
.gc i { font-style: normal; font-size: 12px; }
.gc.miss { outline: 1.5px solid var(--danger); }
.free { font-size: 11px; color: #1a9c5c; font-weight: 700; }

/* đơn khách */
.ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.order { background: #fff8e6; color: #3b2a12; border: 2px dashed #c9a35a; border-radius: 10px; padding: 5px 4px; display: flex; flex-direction: column; gap: 3px; align-items: center; font: inherit; cursor: pointer; }
.order .op { font-size: 13px; }
.order .op b { font: 800 16px var(--font-display); }
.order .cost { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; }
.order .gc { background: rgba(0,0,0,.06); color: #3b2a12; }
.order.ok { border-style: solid; border-color: #e0a100; box-shadow: 0 0 0 2px rgba(255,201,60,.35); }
.order.empty { opacity: .5; justify-content: center; font-size: 12px; cursor: default; }

/* bến hàng */
.bl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.basket { background: color-mix(in srgb, var(--wood) 16%, var(--panel)); border: 2px solid transparent; border-radius: 12px; padding: 6px 4px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; color: var(--ink); cursor: pointer; }
.basket .items { font-size: 19px; letter-spacing: -2px; min-height: 24px; }
.basket .bk { font-size: 11px; color: var(--ink-soft); font-weight: 600; }

/* khay của mình */
.cn-tray { margin-top: auto; background: var(--panel); border-radius: 18px 18px 0 0; padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -4px 14px rgba(0,0,0,.12); position: sticky; bottom: 0; z-index: 5; }
.mine { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.mg { display: flex; flex-direction: column; align-items: center; background: color-mix(in srgb, var(--g, #999) 15%, var(--panel-2)); border-radius: 10px; padding: 3px 0 2px; }
.mg .mi { font-size: 18px; }
.mg b { font: 800 18px/1 var(--font-display); }
.mg small { font-size: 10px; color: var(--ink-soft); font-weight: 700; }
.mg.tot { --g: transparent; }
.cn-tray .wait { margin: 8px 2px 0; font-size: 13.5px; text-align: center; color: var(--ink-soft); min-height: 44px; display: flex; align-items: center; justify-content: center; }
.act-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.act-row > span { flex: 1; font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.act-row em { font-style: normal; font-size: 12px; color: var(--ink-soft); width: 100%; display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.act-row .btn { flex: none; }

ol.rules { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.sheet p { font-size: 14px; }
.rank { padding-left: 22px; }
.rank li { margin: 6px 0; }
.rank li b { color: var(--pc); margin-right: 6px; }
@media (min-width: 560px) { .cn-game { max-width: 560px; margin: 0 auto; width: 100%; } }
