/* BroPro Chain Burst — black and gold, built for phones first. */
:root {
    --bg: #07080c;
    --bg2: #0d0f16;
    --panel: rgba(255, 255, 255, 0.035);
    --panel2: rgba(255, 255, 255, 0.06);
    --line: rgba(226, 179, 71, 0.2);
    --line2: rgba(255, 255, 255, 0.08);
    --gold: #e2b347;
    --gold2: #fff3c4;
    --text: #f5f1e8;
    --muted: #a9a294;
    --danger: #ff4d6d;
    --radius: 18px;
    --top: 60px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.cb {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 80% -10%, rgba(226, 179, 71, 0.12), transparent 60%), radial-gradient(900px 500px at -10% 30%, rgba(167, 139, 250, 0.08), transparent 60%), var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-tap-highlight-color: transparent;
}
html[lang="hi"] body.cb { font-family: 'Noto Sans Devanagari', 'Outfit', system-ui, sans-serif; }
button { font: inherit; color: inherit; }
.cb-hidden { display: none !important; }
.cb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.cb-top {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 10px;
    height: var(--top); padding: 0 14px; padding-top: env(safe-area-inset-top);
    background: rgba(7, 8, 12, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line2);
}
.cb-top-right { margin-left: auto; display: flex; gap: 8px; }
.cb-icon {
    display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 8px;
    border-radius: 12px; border: 1px solid var(--line2); background: var(--panel);
    color: var(--text); text-decoration: none; font-size: 17px; font-weight: 700; cursor: pointer;
}
.cb-icon:hover { border-color: var(--line); }
.cb-icon:focus-visible, .cb-btn:focus-visible, .cb-mode:focus-visible, .cb-seg-b:focus-visible, .cb-node:focus-visible, .cb-tool:focus-visible, .cb-pred-b:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cb-logo { border-radius: 50%; object-fit: cover; }

/* Screens */
.cb-screen { max-width: 980px; margin: 0 auto; padding: 18px 16px 40px; }
.cb-head { margin: 6px 0 16px; }
.cb-h1 { margin: 0; font-family: 'Cormorant Garamond', Georgia, serif; font-size: clamp(30px, 6vw, 42px); line-height: 1.1; color: var(--gold2); }
html[lang="hi"] .cb-h1 { font-family: 'Noto Sans Devanagari', sans-serif; font-size: clamp(26px, 5vw, 36px); }
.cb-sub { margin: 6px 0 0; color: var(--muted); }
.cb-eyebrow { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--gold); }
html[lang="hi"] .cb-eyebrow { letter-spacing: 0; font-size: 13px; }
.cb-label { display: flex; justify-content: space-between; margin: 26px 2px 10px; font-size: 12px; font-weight: 800; letter-spacing: 1.6px; color: var(--muted); }
html[lang="hi"] .cb-label { letter-spacing: 0; font-size: 14px; }
.cb-note { color: var(--muted); font-size: 14px; text-align: center; margin: 14px 0; }
.cb-hint { color: var(--muted); font-size: 13px; margin: -4px 0 14px; line-height: 1.5; }
.cb-link { background: none; border: 0; color: var(--gold); font-weight: 700; cursor: pointer; padding: 6px; text-decoration: underline; text-underline-offset: 3px; }

/* Hero */
.cb-hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: center; padding: 18px 0 8px; }
.cb-hero-title { margin: 10px 0 10px; font-family: 'Cormorant Garamond', Georgia, serif; font-size: clamp(36px, 7.5vw, 62px); line-height: 1.02; color: var(--gold2); text-wrap: balance; }
html[lang="hi"] .cb-hero-title { font-family: 'Noto Sans Devanagari', sans-serif; font-size: clamp(30px, 6vw, 48px); line-height: 1.25; }
.cb-hero-p { margin: 0; color: #cfc9bd; font-size: 16px; line-height: 1.6; max-width: 520px; }
.cb-hero-art {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; aspect-ratio: 1; max-width: 300px; justify-self: center; width: 100%;
    padding: 12px; border-radius: 24px; border: 1px solid var(--line); background: linear-gradient(150deg, rgba(226, 179, 71, 0.08), rgba(255, 255, 255, 0.01));
    box-shadow: 0 30px 80px -30px rgba(226, 179, 71, 0.35);
}
.cb-hero-cell { position: relative; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.05); display: grid; place-items: center; }
.cb-hero-orb {
    position: absolute; width: 26%; aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(circle at 32% 30%, #fff 0, var(--c) 34%, color-mix(in srgb, var(--c) 55%, #000) 100%);
    box-shadow: 0 0 16px color-mix(in srgb, var(--c) 60%, transparent);
    animation: cb-orbit 5s linear infinite;
}
.cb-hero-cell[data-n="1"] .cb-hero-orb { animation: cb-breathe 3s ease-in-out infinite; }
.cb-hero-cell[data-n="2"] .cb-hero-orb:nth-child(1) { --o: 0deg; }
.cb-hero-cell[data-n="2"] .cb-hero-orb:nth-child(2) { --o: 180deg; }
.cb-hero-cell[data-n="3"] .cb-hero-orb:nth-child(1) { --o: 0deg; }
.cb-hero-cell[data-n="3"] .cb-hero-orb:nth-child(2) { --o: 120deg; }
.cb-hero-cell[data-n="3"] .cb-hero-orb:nth-child(3) { --o: 240deg; }
.cb-hero-cell.hot { box-shadow: inset 0 0 30px rgba(242, 193, 78, 0.25); }
.cb-hero-cell.hot .cb-hero-orb { animation-duration: 1.2s; }
@keyframes cb-orbit { from { transform: rotate(var(--o, 0deg)) translateX(55%) rotate(calc(-1 * var(--o, 0deg))); } to { transform: rotate(calc(var(--o, 0deg) + 360deg)) translateX(55%) rotate(calc(-1 * var(--o, 0deg) - 360deg)); } }
@keyframes cb-breathe { 50% { transform: scale(1.12); } }

/* Level strip */
.cb-level { margin-top: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line2); }
.cb-level-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.cb-level-top b { color: var(--gold2); font-size: 18px; }
.cb-level-top span { color: var(--muted); font-size: 14px; }
.cb-meter { height: 8px; margin: 10px 0; border-radius: 99px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.cb-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #b8862b, var(--gold), var(--gold2)); transition: width 0.6s ease; }
.cb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cb-chip { padding: 5px 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line2); font-size: 13px; color: #ddd6c7; }
.cb-chip.gold { border-color: var(--line); color: var(--gold2); }

/* Mode cards */
.cb-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cb-mode {
    display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer;
    padding: 16px; border-radius: var(--radius); border: 1px solid var(--line2); background: var(--panel);
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.cb-mode:hover { transform: translateY(-2px); border-color: var(--line); background: var(--panel2); }
.cb-mode:active { transform: translateY(0) scale(0.99); }
.cb-mode.is-hero { border-color: var(--line); background: linear-gradient(135deg, rgba(226, 179, 71, 0.14), rgba(255, 255, 255, 0.02)); }
.cb-mode-ic { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 14px; font-size: 24px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line2); }
.cb-mode-tx { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cb-mode-tx b { font-size: 17px; }
.cb-mode-tx span { color: #cfc9bd; font-size: 14px; }
.cb-mode-tx em { font-style: normal; color: var(--gold); font-size: 12.5px; font-weight: 600; }
.cb-mode-go { margin-left: auto; color: var(--gold); font-size: 20px; }

.cb-memory-card {
    margin-top: 18px; padding: 20px; border-radius: 22px; border: 1px solid rgba(167, 139, 250, 0.3);
    background: radial-gradient(500px 200px at 100% 0, rgba(167, 139, 250, 0.2), transparent 70%), var(--panel);
}
.cb-memory-card .cb-eyebrow { color: #c4b5fd; }
.cb-memory-card h2 { margin: 6px 0 6px; font-size: 22px; }
.cb-memory-card p { margin: 0 0 14px; color: #cfc9bd; line-height: 1.55; }

/* Buttons */
.cb-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.cb-col { display: flex; flex-direction: column; gap: 10px; }
.cb-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
    border-radius: 14px; border: 1px solid transparent; cursor: pointer; font-weight: 800; font-size: 15px;
    color: #1a1406; background: linear-gradient(180deg, var(--gold2), var(--gold)); box-shadow: 0 10px 26px -12px rgba(226, 179, 71, 0.7);
}
.cb-btn:hover { filter: brightness(1.05); }
.cb-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.cb-btn.ghost { color: var(--text); background: var(--panel); border-color: var(--line2); box-shadow: none; }
.cb-btn.danger { color: #fff; background: rgba(255, 77, 109, 0.14); border-color: rgba(255, 77, 109, 0.4); box-shadow: none; }
.cb-btn.big { width: 100%; min-height: 54px; font-size: 17px; margin-top: 14px; }

/* Setup */
.cb-card { padding: 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line2); margin-bottom: 14px; }
.cb-card.center { text-align: center; }
.cb-card h3 { margin: 0 0 8px; font-size: 18px; }
.cb-field { margin-bottom: 16px; }
.cb-field-l { display: block; font-weight: 700; margin-bottom: 8px; font-size: 14px; color: #ddd6c7; }
.cb-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.cb-seg-b {
    flex: 1 1 0; min-width: 52px; min-height: 44px; padding: 6px 10px; border-radius: 12px; cursor: pointer;
    border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.03); font-weight: 700; font-size: 14px;
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.cb-seg-b small { font-size: 11px; color: var(--muted); font-weight: 600; }
.cb-seg-b.on { border-color: var(--gold); background: rgba(226, 179, 71, 0.16); color: var(--gold2); }

/* Play */
body.cb-playing { overflow: hidden; height: 100dvh; }
body.cb-playing .bp-about, body.cb-playing #bhaiFloatingWidget { display: none !important; }
.cb-play { display: flex; flex-direction: column; height: calc(100dvh - var(--top) - env(safe-area-inset-top)); max-width: 760px; margin: 0 auto; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.cb-hud { flex: none; }
.cb-players { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.cb-players::-webkit-scrollbar { display: none; }
.cb-pl {
    position: relative; display: inline-flex; align-items: center; gap: 7px; flex: 1 0 auto; min-width: 0; padding: 7px 10px;
    border-radius: 12px; border: 1px solid var(--line2); background: var(--panel); font-size: 13px; transition: all 0.2s ease;
}
.cb-pl.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); box-shadow: 0 0 0 1px var(--c), 0 6px 20px -8px var(--c); }
.cb-pl.out { opacity: 0.35; text-decoration: line-through; }
.cb-pl-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, #fff, var(--c) 45%); box-shadow: 0 0 8px var(--c); }
.cb-pl-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-pl-n { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--gold2); }
.cb-bubble { position: absolute; top: -18px; right: 4px; font-size: 24px; animation: cb-pop 2.2s ease forwards; pointer-events: none; }
@keyframes cb-pop { 0% { transform: translateY(8px) scale(0.4); opacity: 0; } 15% { transform: translateY(0) scale(1.15); opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-14px); opacity: 0; } }
.cb-status { display: flex; align-items: center; gap: 10px; padding: 6px 4px 8px; font-weight: 700; font-size: 15px; }
.cb-status > span { color: var(--c); }
.cb-timer { margin-left: auto; min-width: 42px; text-align: center; padding: 2px 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); font-variant-numeric: tabular-nums; }
.cb-timer.low { background: rgba(255, 77, 109, 0.2); color: #ffb3c1; }
.cb-mem-tag { margin-left: auto; font-style: normal; font-size: 12px; padding: 3px 9px; border-radius: 99px; border: 1px solid rgba(167, 139, 250, 0.4); color: #ddd6fe; }
.cb-timer + .cb-mem-tag { margin-left: 0; }
.cb-board-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: grid; place-items: center; }
.cb-board { display: block; border-radius: 14px; background: rgba(255, 255, 255, 0.015); touch-action: manipulation; cursor: pointer; outline: none; }
.cb-board:focus-visible { box-shadow: 0 0 0 2px var(--gold); }
.cb-float { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); pointer-events: none; width: max-content; max-width: 92%; }
.cb-say { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; background: rgba(13, 15, 22, 0.92); border: 1px solid var(--line); font-size: 14px; box-shadow: 0 12px 30px -10px #000; animation: cb-in 0.3s ease; }
.cb-say img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
@keyframes cb-in { from { transform: translateY(-6px); opacity: 0; } }
.cb-bar { flex: none; display: flex; gap: 8px; align-items: center; padding-top: 8px; }
.cb-tool { min-width: 46px; height: 46px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line2); background: var(--panel); cursor: pointer; font-weight: 700; font-size: 15px; }
.cb-tool.wide { flex: 1; }
.cb-tool:disabled { opacity: 0.4; }
.cb-reacts { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
.cb-react { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel); font-size: 20px; cursor: pointer; flex: none; }
body.cb-offline .cb-status::after { content: '⚠︎'; color: var(--danger); }

/* Sheet (dialogs) */
.cb-sheet { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; justify-items: center; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); animation: cb-fade 0.2s ease; }
@keyframes cb-fade { from { opacity: 0; } }
.cb-sheet-card {
    width: min(560px, 100%); max-height: 88dvh; overflow-y: auto; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0; background: linear-gradient(180deg, #151823, #0c0e15); border: 1px solid var(--line); border-bottom: 0;
    animation: cb-up 0.28s cubic-bezier(.2, .9, .3, 1.2);
}
@media (min-width: 640px) { .cb-sheet { align-items: center; } .cb-sheet-card { border-radius: 24px; border-bottom: 1px solid var(--line); } }
@keyframes cb-up { from { transform: translateY(40px); opacity: 0; } }
.cb-sheet-title { margin: 0 0 10px; font-size: 24px; text-align: center; color: var(--gold2); }
.cb-sheet-p { text-align: center; color: #cfc9bd; margin: 0 0 14px; line-height: 1.55; }
.cb-win-orb { display: block; width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 50%; background: radial-gradient(circle at 32% 30%, #fff, var(--c) 40%, #000 130%); box-shadow: 0 0 40px var(--c); animation: cb-breathe 2s ease-in-out infinite; }
.cb-pred { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.cb-pred-b { height: 64px; border-radius: 16px; border: 1px solid var(--line); background: rgba(226, 179, 71, 0.08); font-size: 26px; font-weight: 900; cursor: pointer; color: var(--gold2); }
.cb-pred-b:hover { background: rgba(226, 179, 71, 0.18); }
.cb-sheet-card > .cb-btn.ghost { width: 100%; }
.cb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 10px 0; }
.cb-stat { padding: 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line2); text-align: center; }
.cb-stat b { display: block; font-size: 22px; color: var(--gold2); font-variant-numeric: tabular-nums; }
.cb-stat span { font-size: 12.5px; color: var(--muted); }
.cb-xp { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 10px; }
.cb-xp b { font-size: 22px; color: var(--gold); }
.cb-xp span { font-size: 13px; color: var(--muted); }
.cb-xp .cb-up { color: #a3e635; font-weight: 700; font-size: 15px; }
.cb-ach-new { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.cb-result .cb-link { display: block; margin: 12px auto 0; }
.cb-steps { margin: 0; padding-left: 22px; line-height: 1.6; color: #ddd6c7; }
.cb-steps li { margin-bottom: 10px; }
.cb-caps { display: grid; grid-template-columns: repeat(3, 34px); gap: 4px; margin: 8px 0 4px; }
.cb-caps span { display: grid; place-items: center; height: 34px; border-radius: 8px; background: rgba(226, 179, 71, 0.1); border: 1px solid var(--line); font-weight: 800; color: var(--gold2); }
.cb-rules .cb-btn { width: 100%; margin-top: 8px; }

/* Toast */
.cb-toast {
    position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 60; transform: translate(-50%, 20px);
    max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 14px; background: rgba(21, 24, 35, 0.96); border: 1px solid var(--line);
    font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: all 0.25s ease; text-align: center;
}
.cb-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Puzzle Path */
.cb-path { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.cb-node { aspect-ratio: 1; border-radius: 16px; border: 1px solid var(--line2); background: var(--panel); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.cb-node b { font-size: 20px; }
.cb-node span { font-size: 11px; color: var(--muted); }
.cb-node.done { border-color: var(--line); background: rgba(226, 179, 71, 0.08); }
.cb-node.tier { box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.5); }
.cb-node.locked { opacity: 0.45; }

/* Stats */
.cb-stats.wide { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin-top: 14px; }
.cb-ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cb-ach-i { padding: 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line2); opacity: 0.45; display: flex; flex-direction: column; gap: 2px; }
.cb-ach-i span { font-size: 24px; filter: grayscale(1); }
.cb-ach-i small { color: var(--muted); font-size: 12px; }
.cb-ach-i.got { opacity: 1; border-color: var(--line); }
.cb-ach-i.got span { filter: none; }

/* Online */
.cb-join { display: flex; gap: 8px; }
.cb-input { flex: 1; min-width: 0; height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(0, 0, 0, 0.3); color: var(--text); font: 800 20px/1 'Outfit', monospace; letter-spacing: 4px; text-transform: uppercase; }
.cb-input:focus { outline: 2px solid var(--gold); border-color: transparent; }
.cb-code { margin: 6px 0 4px; font-size: clamp(34px, 9vw, 48px); font-weight: 900; letter-spacing: 8px; color: var(--gold2); font-variant-numeric: tabular-nums; }
.cb-seat { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line2); }
.cb-seat:last-child { border-bottom: 0; }
.cb-seat.empty { color: var(--muted); }
.cb-seat.empty .cb-pl-dot { opacity: 0.35; }
.cb-kick { margin-left: auto; width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line2); background: none; cursor: pointer; color: var(--muted); }

@media (max-width: 640px) {
    .cb-hero { grid-template-columns: 1fr; }
    .cb-hero-art { max-width: 200px; order: -1; }
    .cb-top { padding: 0 10px; gap: 6px; }
    .cb-icon { min-width: 38px; height: 38px; }
    .cb-pl-name { max-width: 72px; }
}
@media (prefers-reduced-motion: reduce) {
    .cb-hero-orb, .cb-win-orb, .cb-bubble, .cb-sheet-card, .cb-say { animation: none !important; }
    .cb-mode, .cb-meter i, .cb-toast { transition: none; }
}
