html, body.bcc-body { margin: 0; height: 100%; overflow: hidden; background: #0a1215; }
#bcc-app {
	position: fixed; inset: 0; overflow: hidden;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: #e6f4f1; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none;
	--glass: rgba(10, 24, 28, .62); --line: rgba(160, 220, 215, .16); --acc: #5eead4; --acc2: #7dd3fc;
}
#bcc-app * { box-sizing: border-box; }
#bcc-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#bcc-app.is-edit #bcc-canvas { cursor: crosshair; }
#bcc-app.is-edit.hover-item #bcc-canvas { cursor: grab; }
#bcc-app.is-dragging #bcc-canvas { cursor: grabbing; }

#bcc-app button {
	font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line);
	background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
	border-radius: 12px; padding: 8px 12px; line-height: 1.1; transition: background .15s, border-color .15s, transform .1s;
}
#bcc-app button:hover { background: rgba(30, 60, 64, .75); border-color: rgba(160, 230, 220, .35); }
#bcc-app button:active { transform: scale(.96); }
#bcc-app button.is-on { background: rgba(45, 160, 145, .5); border-color: var(--acc); }
#bcc-app button.danger:hover { background: rgba(160, 40, 50, .55); border-color: #f87171; }

/* Top bar */
.bcc-top {
	position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
	gap: 10px; padding: max(12px, env(safe-area-inset-top)) 14px 10px; pointer-events: none;
}
.bcc-top > * { pointer-events: auto; }
.bcc-brand { color: #e6f4f1; text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: .3px; text-shadow: 0 1px 8px rgba(0,0,0,.6); white-space: nowrap; }
.bcc-brand span { font-weight: 400; opacity: .7; }
.bcc-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.bcc-actions button { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.bcc-actions button .ic { font-size: 16px; }

/* Panels */
.bcc-panel {
	position: absolute; top: 64px; right: 14px; width: 310px; max-height: calc(100% - 170px); overflow: auto;
	background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
	border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 16px; display: none;
	box-shadow: 0 10px 40px rgba(0,0,0,.35); user-select: text; -webkit-user-select: text;
}
.bcc-panel.is-open { display: block; animation: bccIn .18s ease-out; }
@keyframes bccIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.bcc-panel h3 { margin: 0 0 10px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.bcc-panel h4 { margin: 14px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; opacity: .6; font-weight: 600; }
.bcc-panel .x { padding: 2px 9px !important; border-radius: 8px !important; font-size: 16px; }
.bcc-panel p { margin: 6px 0; font-size: 13px; opacity: .8; line-height: 1.45; }
.bcc-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.bcc-row .nm { flex: 1; font-size: 14px; }
.bcc-row .nm small { display: block; opacity: .55; font-size: 11px; }
.bcc-row .ct { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.bcc-row button { padding: 4px 11px !important; font-size: 16px; }
.bcc-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.bcc-seg button { flex: 1 1 auto; font-size: 13px; padding: 7px 10px !important; }
.bcc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bcc-grid button { font-size: 13px; }
.bcc-link { width: 100%; margin-top: 8px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.3); color: #cfeee9; font-size: 12px; display: none; }
.bcc-link.show { display: block; }

/* Palette (edit mode) */
.bcc-palette {
	position: absolute; left: 0; right: 0; bottom: 0; display: none; gap: 6px; overflow-x: auto; padding: 10px 14px max(12px, env(safe-area-inset-bottom));
	background: linear-gradient(to top, rgba(5,14,16,.85), rgba(5,14,16,0)); scrollbar-width: thin;
}
#bcc-app.is-edit .bcc-palette { display: flex; }
.bcc-palette button { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 76px; padding: 8px 8px !important; font-size: 12px; }
.bcc-palette button .ic { font-size: 22px; line-height: 1; }

.bcc-seltools {
	position: absolute; left: 50%; transform: translateX(-50%); bottom: 104px; display: none; gap: 6px;
	padding: 6px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.bcc-seltools.show { display: flex; }
.bcc-seltools button { padding: 7px 11px !important; font-size: 15px; background: rgba(255,255,255,.04) !important; }
.bcc-seltools .lbl { align-self: center; font-size: 13px; padding: 0 6px; opacity: .85; white-space: nowrap; }

.bcc-hint {
	position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
	font-size: 13px; opacity: .7; text-shadow: 0 1px 6px rgba(0,0,0,.8); white-space: nowrap; pointer-events: none; transition: opacity .3s;
}
#bcc-app.is-edit .bcc-hint { bottom: 108px; }
#bcc-app.is-edit .bcc-seltools.show ~ .bcc-hint { opacity: 0; }

.bcc-toast {
	position: absolute; left: 50%; top: 70px; transform: translate(-50%, -10px); opacity: 0; pointer-events: none;
	background: rgba(8, 30, 32, .9); border: 1px solid var(--line); padding: 9px 16px; border-radius: 12px; font-size: 14px; transition: opacity .25s, transform .25s;
}
.bcc-toast.show { opacity: 1; transform: translate(-50%, 0); }

.bcc-shared {
	position: absolute; left: 50%; top: 66px; transform: translateX(-50%); display: none; align-items: center; gap: 10px;
	background: rgba(8, 40, 44, .9); border: 1px solid var(--acc); padding: 8px 10px 8px 16px; border-radius: 14px; font-size: 14px; white-space: nowrap;
}
.bcc-shared.show { display: flex; }

.bcc-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: #0a1215; transition: opacity .6s; z-index: 5; }
.bcc-loading.done { opacity: 0; pointer-events: none; }
.bcc-loading p { margin: 0; opacity: .7; font-size: 14px; }
.bcc-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(94,234,212,.2); border-top-color: var(--acc); animation: bccSpin 1s linear infinite; }
@keyframes bccSpin { to { transform: rotate(360deg); } }
.bcc-noscript, .bcc-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 30px; margin: 0; color: #e6f4f1; }

@media (max-width: 720px) {
	.bcc-actions button .tx { display: none; }
	.bcc-actions button { padding: 8px 10px; }
	.bcc-brand span { display: none; }
	.bcc-panel { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; max-height: 62%; }
	#bcc-app.is-edit .bcc-panel { bottom: 100px; }
	.bcc-hint { font-size: 12px; white-space: normal; text-align: center; width: 90%; }
	.bcc-seltools { bottom: 100px; }
	.bcc-seltools .lbl { display: none; }
	.bcc-shared { white-space: normal; width: calc(100% - 20px); font-size: 13px; }
}

/* Khi đang mở panel thì ẩn thanh chỉnh vật để khỏi chồng lên nhau */
#bcc-app.panel-open .bcc-seltools { display: none; }
@media (max-width: 720px) {
	#bcc-app.panel-open .bcc-palette, #bcc-app.panel-open .bcc-hint { display: none; }
	#bcc-app.is-edit.panel-open .bcc-panel { bottom: 10px; }
}

/* ---------- Màn chọn mẫu bể ---------- */
.bcc-picker { position: absolute; inset: 0; z-index: 8; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(3, 10, 12, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.bcc-picker.show { display: flex; animation: bccIn .25s ease-out; }
.bcc-pick-box { width: min(980px, 100%); max-height: 100%; overflow: auto; background: rgba(10, 26, 30, .92); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.bcc-pick-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.bcc-pick-head h2 { margin: 0 0 4px; font-size: 21px; }
.bcc-pick-head p { margin: 0; opacity: .7; font-size: 14px; }
.bcc-pick-warn { margin: 0 0 12px; font-size: 13px; color: #fcd34d; }
.bcc-pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
#bcc-app .bcc-pick { display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 6px; padding: 8px 8px 12px !important; border-radius: 14px; background: rgba(255,255,255,.04); }
#bcc-app .bcc-pick:hover { border-color: var(--acc); background: rgba(45, 160, 145, .18); transform: translateY(-2px); }
.bcc-pick img, .bcc-pick .ph { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 9px; background: linear-gradient(#1d5a63, #06161a); display: block; }
.bcc-pick.is-empty img { filter: saturate(.6) brightness(.85); }
.bcc-pick .nm { font-weight: 600; font-size: 15px; padding: 0 4px; }
.bcc-pick .ds { font-size: 12.5px; opacity: .7; line-height: 1.4; padding: 0 4px; }
.bcc-pick-loading { grid-column: 1 / -1; text-align: center; opacity: .7; padding: 30px 0; }
@media (max-width: 820px) { .bcc-pick-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .bcc-pick-box { padding: 16px; } .bcc-pick .ds { display: none; } }

/* ---------- Panel âm thanh ---------- */
#bcc-app .bcc-master { width: 100%; padding: 10px !important; font-weight: 600; }
#bcc-app .bcc-toggle { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; margin-bottom: 6px; background: rgba(255,255,255,.03); }
#bcc-app .bcc-toggle.is-on { background: rgba(45, 160, 145, .22); }
.bcc-toggle .nm { flex: 1; font-size: 14px; }
.bcc-toggle .nm small { display: block; opacity: .55; font-size: 11px; margin-top: 2px; }
.bcc-toggle .sw { width: 34px; height: 20px; border-radius: 10px; background: rgba(255,255,255,.15); position: relative; flex: 0 0 auto; transition: background .2s; }
.bcc-toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #cfe; transition: transform .2s; }
.bcc-toggle.is-on .sw { background: var(--acc); }
.bcc-toggle.is-on .sw::after { transform: translateX(14px); background: #fff; }
.bcc-sub { margin: 2px 0 10px 12px; padding-left: 10px; border-left: 2px solid var(--line); }
.bcc-range { width: 100%; accent-color: var(--acc); }

/* Nhãn kiểu bể + chọn kiểu cho bể trống */
.bcc-pick .nm .tag { font-style: normal; font-weight: 500; font-size: 11px; margin-left: 6px; padding: 2px 7px; border-radius: 8px; background: rgba(94,234,212,.15); color: #9ff3e3; vertical-align: 2px; }
.bcc-pick.is-empty { border: 1px dashed rgba(160,220,215,.35); border-radius: 14px; padding: 8px 8px 10px; display: flex; flex-direction: column; gap: 6px; background: rgba(255,255,255,.03); }
.bcc-shapes { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 0 2px; }
#bcc-app .bcc-shapes button { font-size: 12px; padding: 6px 4px !important; border-radius: 9px; }
#bcc-app .bcc-shapes button:hover { border-color: var(--acc); }
@media (max-width: 420px) { .bcc-pick.is-empty .ds { display: block; } }
