/* ============================================================
   The 3D Hub (public/js/hub/hub.js) and its rooms (hub-rooms.js).
   Approved designs: Hub, PoolHall, Arena, ShopFloor, ClubHouse, PotBoard.
   ============================================================ */
.hub-shell .main { background: #120E26; }
.hub3d { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #120E26; }
.hub3d-root { position: absolute; inset: 0; overflow: hidden; user-select: none; -webkit-user-select: none; }
.hub-canvas { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.hub-canvas:active { cursor: grabbing; }
.hub-canvas canvas { display: block; }

/* name tags over heads */
.hub-tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hub-tag { position: absolute; left: 0; top: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 8px 4px; border-radius: 8px; background: rgba(7, 11, 22, .84); border: 1px solid rgba(255, 255, 255, .06); font-size: 11px; font-weight: 700; line-height: 1.15; white-space: nowrap; transform-origin: 50% 100%; will-change: transform; }
.hub-tag.framed { border-color: var(--fr); box-shadow: 0 0 10px -2px var(--fr); }
.hub-tag .hn { color: #E9EDF8; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.hub-tag .hr { font-size: 8.5px; letter-spacing: .6px; }
.hub-tag .ht { font-size: 8.5px; color: var(--gold); background: var(--gold-deep); border-radius: 4px; padding: 0 4px; }
.hub-tag .hc { position: absolute; right: -6px; top: -7px; font-size: 8px; background: #2A1F12; color: #E8C27A; border-radius: 5px; padding: 1px 4px; }
.hub-tag .he { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%) scale(.4); opacity: 0; transition: transform .18s ease, opacity .18s; background: #070B16; border-radius: 14px; padding: 5px; display: flex; pointer-events: none; }
.hub-tag.emoting .he { transform: translateX(-50%) scale(1); opacity: 1; }
.hub-tag.me { background: transparent; border: 0; pointer-events: none; }
.hub-tag.me:not(.emoting) { visibility: hidden; }
.hub-tag.me > :not(.he) { visibility: hidden; }

/* the top: where you are, balances */
.hub-top { position: absolute; left: 12px; right: 12px; top: calc(12px + var(--safe-top)); display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.hub-top > * { pointer-events: auto; }
.hub-pill { background: rgba(7, 11, 22, .9); border-radius: 14px; padding: 8px 12px; font-size: 12px; }
.hub-pill .t { font-weight: 700; }
.hub-pill .s { color: var(--muted); }
.hub-bal { display: flex; gap: 6px; }
.hub-bal > * { background: rgba(7, 11, 22, .9); border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 600; }
.hub-bal .g { color: var(--green); }
.hub-bal .p { color: var(--purple); }

/* challenge banners */
.hub-banner { position: absolute; left: 12px; right: 12px; top: calc(66px + var(--safe-top)); max-width: 440px; background: #070B16; border: 1px solid var(--line2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: hubIn .22s ease; z-index: 5; }
.hub-banner.inc { border-color: #3DDC97; }
.hub-banner.inc b { color: var(--green); }
.hub-banner .cd { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 4px; }
.hub-banner .bt { display: flex; gap: 8px; }
.hub-banner .bt .btn { height: 40px; font-size: 14px; border-radius: 12px; }
@keyframes hubIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

.hub-hint { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); width: min(300px, calc(100% - 40px)); text-align: center; background: rgba(7, 11, 22, .86); border: 1px solid var(--line2); border-radius: 14px; padding: 12px 14px; font-size: 13px; color: var(--text); pointer-events: none; transition: opacity .6s; }
.hub-hint.out { opacity: 0; }
.hub-load { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 13px; background: #120E26; }

/* the thumb stick (phones) */
.hub-stick { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; display: none; }
.is-phone .hub-stick { display: block; }
.hub-stick::before { content: ''; position: absolute; left: 0; top: 0; width: 112px; height: 112px; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(7, 11, 22, .72); border: 2px solid #2B3866; }
.hub-stick i { position: absolute; left: 0; top: 0; width: 46px; height: 46px; border-radius: 50%; background: #2B3866; transform: translate(-50%, -50%); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .08); }
.hub-stick.on i { background: #3A4A85; }
.hub-stick:not(.on) { left: 78px; top: auto; bottom: 78px; opacity: .8; transform: none !important; }
.driving .hub-stick { display: none !important; }

/* driving: steer left / right, brake and boost (phones) */
.hub-steer, .hub-pedals { display: none; }
.driving.is-phone .hub-steer { display: flex; position: absolute; left: 16px; bottom: 18px; gap: 10px; }
.driving.is-phone .hub-pedals { display: flex; flex-direction: column-reverse; position: absolute; right: 112px; bottom: 18px; gap: 10px; }
.hub-pedal { width: 74px; height: 74px; border-radius: 24px; background: rgba(7, 11, 22, .86); border: 2px solid #2B3866; color: #E9EDF8; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; touch-action: none; transition: transform .06s; }
.hub-pedal.down { transform: scale(.94); background: #1B2440; }
.hub-pedal.brake { border-color: #E2463B; color: #FF8A80; }
.hub-pedal.gas { border-color: #3DDC97; color: #3DDC97; width: 74px; height: 60px; border-radius: 20px; }

/* the context button (Enter the Pool Hall) */
.hub-ctx { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); animation: hubIn .2s ease; }
.hub-ctx .btn { width: auto; height: 48px; padding: 0 22px; font-size: 15px; white-space: nowrap; box-shadow: 0 0 0 2px var(--pc, var(--gold)), 0 8px 24px rgba(0, 0, 0, .45); }
.driving .hub-ctx { bottom: 112px; }

/* right side: drive, emotes, and the Play button */
.hub-side { position: absolute; right: 22px; bottom: 116px; display: flex; flex-direction: column-reverse; gap: 10px; align-items: center; }
.hub-round { width: 60px; height: 60px; border-radius: 20px; background: rgba(7, 11, 22, .88); border: 1px solid var(--line2); color: #E9EDF8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 700; }
.hub-round.on { border-color: var(--flame); color: var(--flame); }
.hub-emotes { position: absolute; right: 92px; bottom: 116px; display: grid; grid-template-columns: repeat(4, 46px); gap: 6px; background: rgba(7, 11, 22, .94); border: 1px solid var(--line2); border-radius: 16px; padding: 8px; animation: hubIn .18s ease; }
.hub-emotes button { width: 46px; height: 46px; border-radius: 12px; background: var(--card); display: flex; align-items: center; justify-content: center; }
.hub-emotes button:active { transform: scale(.94); }
.hub-play { position: absolute; right: 18px; bottom: 18px; width: 86px; height: 86px; border-radius: 28px; background: var(--gold); color: var(--gold-ink); font-family: Sora, sans-serif; font-weight: 800; font-size: 19px; box-shadow: 0 10px 28px rgba(245, 184, 61, .28); }
.hub-play:active { transform: scale(.96); }
.driving.is-phone .hub-side { bottom: 116px; }

/* the player card */
.hub-card .hc-top { display: flex; gap: 14px; align-items: center; }
.hub-card .hc-name { font-family: Sora, sans-serif; font-weight: 800; font-size: 20px; overflow: hidden; text-overflow: ellipsis; }
.hub-card .hc-rank { font-size: 13px; color: var(--muted); }
.hub-card .hc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0 12px; }
.hub-card .hc-stats div { background: var(--card); border-radius: 12px; padding: 8px 4px; text-align: center; }
.hub-card .hc-stats b { display: block; font-family: Sora, sans-serif; font-size: 16px; }
.hub-card .hc-stats span { font-size: 11px; color: var(--muted); }
.hub-card .label { margin-top: 2px; }
.hub-card .hc-games { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.hub-card .hc-games button { flex-shrink: 0; border-radius: 999px; background: var(--card); padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.hub-card .hc-games button.on { background: var(--gold); color: var(--gold-ink); }
.hub-card .fine { font-size: 12px; color: var(--muted); margin: 6px 0 12px; }

@media (min-width: 900px) {
  .hub-bal { display: none; }
  .hub-top { top: 14px; }
  .hub-banner { top: 72px; left: 18px; }
  .hub-ctx { bottom: 40px; }
  .hub-side { right: 26px; bottom: 124px; }
  .hub-play { right: 22px; bottom: 22px; }
}

/* ------------------------------------------------------------ rooms */
.btn.blue { background: #2F5BD9; color: #fff; }
.btn.line-green { background: transparent; border: 2px solid #3DDC97; color: #3DDC97; height: 54px; }
.hub-room .main { background: var(--room-bg, #0A0E0C); }
.hub-room .scroll { background: var(--room-bg, #0A0E0C); }
.hr-stage { position: relative; flex-shrink: 0; overflow: hidden; }
.hr-head { position: absolute; left: 16px; right: 16px; top: calc(14px + var(--safe-top)); display: flex; justify-content: space-between; align-items: center; gap: 10px; z-index: 3; }
.hr-head .back.on-card { background: #070B16; }
.hr-title { background: #070B16; border-radius: 12px; padding: 6px 12px; font-family: Sora, sans-serif; font-size: 14px; font-weight: 800; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.hr-intro { font-size: 12px; color: var(--muted); margin: 0; }
.hr-grid { display: grid; gap: 10px; }
.hr-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hr-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hr-tile { text-align: left; border-radius: 16px; padding: 14px; border: 1px solid; }
.hr-tile .n { font-family: Sora, sans-serif; font-weight: 800; font-size: 15px; }
.hr-tile .s { font-size: 11px; margin-top: 2px; }
.hr-tile.green { background: #0F2A1E; border-color: #1D5A40; } .hr-tile.green .s { color: #A7E8C9; }
.hr-tile.blue { background: #101C40; border-color: #22356E; text-align: center; padding: 12px 6px; } .hr-tile.blue .n { font-size: 12.5px; font-family: Inter, sans-serif; font-weight: 700; } .hr-tile.blue .s { color: #85B7EB; }
.hr-tile.purple { background: #1E1638; border-color: #3B2D6B; } .hr-tile.purple .s { color: #B7A6DE; }
.hr-tile.soon { opacity: .55; }
.hr-tile:active { transform: scale(.98); }
.hr-row { background: #111A31; border-radius: 14px; padding: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; width: 100%; text-align: left; }
.hr-row b.g, .hr-body b.g { color: var(--green); }
.hr-row .gold, .hr-body .gold { color: var(--gold); }
.hr-body .flame { color: var(--flame); }
.hr-body .purple { color: var(--purple); }

/* Pool Hall */
.room-pool { --room-bg: #0A0E0C; }
.hr-stage.pool { height: 340px; background: #101A15; }
.hr-lamps { position: absolute; left: 30px; right: 30px; top: calc(70px + var(--safe-top)); display: flex; justify-content: space-between; }
.hr-lamps i { position: relative; width: 28%; height: 6px; border-radius: 3px; background: var(--gold); box-shadow: 0 0 14px rgba(245, 184, 61, .6); }
.hr-lamps i::after { content: ''; position: absolute; left: -8%; right: -8%; top: 6px; height: 46px; background: radial-gradient(ellipse at 50% 0, rgba(245, 184, 61, .2), transparent 70%); }
.hr-tables { position: absolute; left: 16px; right: 16px; top: calc(112px + var(--safe-top)); display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hr-felt { position: relative; height: 96px; background: radial-gradient(circle at 50% 40%, #127048, #0F5A3E 70%); border: 8px solid #5A3A1E; border-radius: 14px; color: #A7E8C9; font-size: 12px; font-weight: 600; }
.hr-felt .b { position: absolute; width: 12px; height: 12px; border-radius: 50%; box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .25); }
.hr-felt .b.w { background: #F4F1E8; } .hr-felt .b.r { background: #E2463B; } .hr-felt .b.k { background: #141414; } .hr-felt .b.y { background: #F5B83D; }
.hr-felt .chip { position: absolute; right: 6px; bottom: 6px; background: #070B16; color: #9AA3BF; font-size: 10px; font-weight: 700; padding: 3px 8px; }
.hr-felt .chip.live { color: var(--green); }
.hr-felt.open { background: #13241C; border: 2px dashed #2A5A43; }
.hr-chess { height: 96px; background: #1A1430; border: 2px solid #3B2D6B; border-radius: 14px; padding: 10px 12px; text-align: left; }
.hr-chess .k { font-size: 10px; font-weight: 700; color: var(--purple); letter-spacing: 1px; }
.hr-chess .board { display: grid; grid-template-columns: repeat(4, 1fr); width: 48px; height: 48px; margin-top: 8px; }
.hr-chess .board i { background: #DCE1EC; } .hr-chess .board i.d { background: #6F7CA3; }

/* Arena */
.room-arena { --room-bg: #070B1E; }
.hr-stage.arena { height: 320px; background: #070B1E; }
.hr-stage.arena .stands { position: absolute; left: -40px; right: -40px; top: calc(96px + var(--safe-top)); height: 260px; background: #0E1A3D; border-radius: 50% 50% 0 0; }
.hr-stage.arena .stands::before { content: ''; position: absolute; left: 20px; right: 20px; top: 40px; height: 40px; background: repeating-linear-gradient(90deg, #1C2C5E 0 10px, #24386F 10px 20px); opacity: .8; border-radius: 50% 50% 0 0; }
.hr-stage.arena .field { position: absolute; left: 40px; right: 40px; top: calc(178px + var(--safe-top)); height: 128px; background: repeating-linear-gradient(90deg, #0F5A3E 0 28px, #127048 28px 56px); border: 3px solid #E9EDF8; border-radius: 6px; }
.field .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: #E9EDF8; }
.field .circ { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border: 2px solid #E9EDF8; border-radius: 50%; }
.field .box { position: absolute; top: 34px; width: 30px; height: 56px; border: 2px solid #E9EDF8; }
.field .box.l { left: 0; border-left: 0; } .field .box.r { right: 0; border-right: 0; }
.field .ball { position: absolute; left: 38%; top: 46%; width: 10px; height: 10px; border-radius: 50%; background: #F4F1E8; }
.hr-stage.arena .screen { position: absolute; left: 60px; right: 60px; top: calc(82px + var(--safe-top)); height: 78px; background: #050816; border: 2px solid #2F5BD9; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 0 28px rgba(47, 91, 217, .35); z-index: 2; padding: 0 8px; text-align: center; }
.screen .k { font-size: 10px; font-weight: 700; color: #85B7EB; letter-spacing: 1px; }
.screen .v { font-family: Sora, sans-serif; font-weight: 800; font-size: 16px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen .s { font-size: 10px; color: var(--green); }

/* Shop floor */
.room-shop { --room-bg: #120D22; }
.hr-stage.shop { height: 360px; background: #1E1638; }
.hr-stage.shop .window { position: absolute; left: 20px; right: 20px; top: calc(66px + var(--safe-top)); height: 192px; background: radial-gradient(ellipse at 50% 80%, #4C3B8C, #2A1F4E 70%); border: 2px solid #B9A4FF; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 10px 0 12px; box-shadow: 0 0 30px rgba(185, 164, 255, .18); }
.window .k { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--purple); }
.window .car { flex: 1; display: flex; align-items: center; }
.window .t b { font-family: Sora, sans-serif; font-weight: 800; }
.window .t span { color: var(--purple); font-weight: 700; font-size: 13px; margin-left: 4px; }
.hr-stage.shop .shelf { position: absolute; left: 20px; right: 20px; top: calc(272px + var(--safe-top)); display: flex; justify-content: space-between; }
.shelf > i { width: 17%; height: 70px; border-radius: 10px; background: #2A1F4E; display: flex; align-items: center; justify-content: center; gap: 3px; font-style: normal; }
.shelf .cue::after { content: ''; width: 6px; height: 50px; border-radius: 3px; background: var(--gold); }
.shelf .cart::after { content: ''; width: 30px; height: 40px; border-radius: 10px 10px 4px 4px; background: var(--flame); }
.shelf .trail b { border-radius: 50%; background: var(--green); width: 6px; height: 6px; } .shelf .trail b + b { width: 10px; height: 10px; } .shelf .trail b + b + b { width: 14px; height: 14px; }
.shelf .gg { font-family: Sora, sans-serif; font-weight: 800; color: var(--gold); }
.shelf .cloth::after { content: ''; width: 34px; height: 24px; border-radius: 4px; background: #0F5A3E; border: 3px solid #5A3A1E; }

/* Club House */
.room-club { --room-bg: #14100A; }
.hr-stage.club { height: 280px; background: #2A1F12; }
.hr-stage.club > .k { position: absolute; left: 24px; top: calc(72px + var(--safe-top)); font-size: 12px; font-weight: 700; letter-spacing: 1px; color: #C9B27A; }
.hr-stage.club .wall { position: absolute; left: 24px; right: 24px; top: calc(98px + var(--safe-top)); height: 150px; background: #3A2B18; border-radius: 10px; display: flex; align-items: flex-end; justify-content: space-around; padding: 0 10px 12px; }
.wall .cup { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.wall .cup i { width: 36px; height: var(--h, 46px); background: var(--c, #F5B83D); border-radius: 6px 6px 16px 16px; box-shadow: 0 0 16px -4px var(--c, #F5B83D); }
.wall .cup span { font-size: 10px; color: #C9B27A; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall .cup.empty i { background: transparent; border: 2px dashed #6A5434; box-shadow: none; height: 44px; }
.room-club .hr-card { background: #221A0E; border: 1px solid #4A3920; border-radius: 16px; padding: 14px; }
.room-club .hr-card .k { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: #C9B27A; }
.room-club .hr-card .k.flame { color: var(--flame); }
.room-club .war { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.room-club .war b { font-family: Sora, sans-serif; font-weight: 800; font-size: 26px; min-width: 40px; }
.room-club .war b:last-child { text-align: right; }
.room-club .war span { font-size: 12px; color: #C9B27A; text-align: center; }
.room-club .people { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.room-club .hr-row { background: #221A0E; border: 1px solid #4A3920; }

/* Pot Board */
.room-pots { --room-bg: #050A08; }
.pots-wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: calc(14px + var(--safe-top)) 16px calc(18px + var(--safe-bottom)); background: #050A08; }
.hr-head.plain { position: static; justify-content: flex-start; gap: 12px; }
.hr-head.plain .back.on-card { background: #111A31; }
.hr-head .kick { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--green); }
.hr-head .title { font-size: 22px; }
.pot-big { margin-top: 16px; background: #0B1A14; border: 2px solid #1D9E75; border-radius: 18px; padding: 14px; flex-shrink: 0; }
.pot-big .k { font-size: 11px; color: #A7E8C9; }
.pot-big .v { font-family: Sora, sans-serif; font-weight: 800; font-size: 30px; color: var(--green); }
.pot-big .s { font-size: 12px; color: #A7E8C9; }
.pot-chips { display: flex; gap: 8px; margin-top: 14px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.pot-chips button { flex-shrink: 0; background: #111A31; border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 600; }
.pot-chips button.on { background: var(--green); color: var(--green-ink); }
.pot-rows { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.pot-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #0B1A14; border: 1px solid #16352A; border-radius: 14px; padding: 10px 12px; }
.pot-row .n { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pot-row .s { font-size: 11px; color: var(--muted); }
.pot-row button { flex-shrink: 0; font-weight: 700; font-size: 13px; border-radius: 10px; padding: 8px 12px; }
.pot-row button.stake { background: var(--green); color: var(--green-ink); }
.pot-row button.free { background: var(--purple); color: var(--purple-ink); }
.pot-row .pot { color: var(--green); font-family: Sora, sans-serif; font-weight: 800; }
.pot-rows .label { margin-top: 8px; }
.pot-cta { flex-shrink: 0; padding-top: 8px; }

@media (min-width: 900px) {
  .hub-room .hr-stage { max-width: var(--cw); width: 100%; margin: 0 auto; border-radius: 0 0 22px 22px; }
  .hub-room .hr-head { top: 14px; }
  .hr-lamps { top: 70px; } .hr-tables { top: 112px; }
  .hr-stage.arena .stands { top: 96px; } .hr-stage.arena .field { top: 178px; } .hr-stage.arena .screen { top: 82px; left: 25%; right: 25%; }
  .hr-stage.shop .window { top: 66px; left: 20%; right: 20%; } .hr-stage.shop .shelf { top: 272px; left: 20%; right: 20%; }
  .hr-stage.club > .k { top: 72px; } .hr-stage.club .wall { top: 98px; }
  .pots-wrap { width: 100%; max-width: 760px; margin: 0 auto; padding-top: 22px; }
  .hub-room .cta-wrap { width: 100%; max-width: var(--cw); margin: 0 auto; }
}
.driving.is-phone .hub-ctx { bottom: 186px; }
