/* Community: groups hub, invite page, a group's race board, goal and feed. --ga = the group's colour. */

/* ───────── hub ───────── */
.cm-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cm-guest { max-width: 560px; margin: 8vh auto 0; }

.gt-ic, .gx-ic { display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--ga, #fff) 15%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ga, #fff) 35%, transparent); }
.gt-goal { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.gt-goal i { display: block; height: 100%; background: var(--text); }

.cm-hero { position: relative; text-align: center; padding: 56px 24px 40px; border-radius: var(--radius); overflow: hidden; }
.cm-hero h2 { font-size: 26px; letter-spacing: -.02em; margin: 26px 0 8px; font-weight: 600; }
.cm-hero p { max-width: 520px; margin: 0 auto; }
.cm-hero-acts { margin: 22px 0; }
.cm-feats { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; color: var(--text-2); font-size: 13px; }
.cm-feats li { display: flex; gap: 7px; align-items: center; }

.gx-ic { width: 40px; height: 40px; border-radius: 12px; font-size: 21px; }

/* ───────── invite ───────── */
@keyframes gjPulse { 50% { opacity: .55; transform: scale(1.08); } }

/* ───────── a group ───────── */

.gp-goal { padding: 16px 20px 14px; border-radius: var(--radius); margin-bottom: var(--gap); display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: center; }
.gg-k { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); display: flex; gap: 7px; align-items: center; }
.gg-v { text-align: right; font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.gg-v .dim { font-weight: 400; font-size: 13px; letter-spacing: 0; }
.gg-bar { grid-column: 1 / -1; position: relative; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .07); margin: 10px 0 6px; }
.gg-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; background: linear-gradient(90deg, color-mix(in srgb, var(--ga) 35%, transparent), var(--ga)); box-shadow: 0 0 18px color-mix(in srgb, var(--ga) 55%, transparent); animation: ggGrow 1.2s var(--ease) both; }
.gg-bar span { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--ga) 35%, transparent), 0 0 16px var(--ga); animation: ggDot 1.2s var(--ease) both; }
@keyframes ggGrow { from { width: 0; } }
@keyframes ggDot { from { left: 0; } }
.gg-s { grid-column: 1 / -1; font-size: 12px; }
.gp-goal.done .gg-bar i { background: linear-gradient(90deg, rgba(255, 255, 255, .5), #fff, rgba(255, 255, 255, .5)); background-size: 200% 100%; animation: ggGold 2.5s linear infinite; }
@keyframes ggGold { to { background-position: -200% 0; } }

.gp-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.gp-totals > div { padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line-2); min-width: 0; }
.gp-totals em { display: block; font-style: normal; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.gp-totals b { display: block; font-size: 17px; font-weight: 600; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-totals b .dim { font-weight: 400; }

/* the race: every row carries a bar as long as its share of the biggest P&L */
.gp-rows { display: flex; flex-direction: column; gap: 6px; }
.gr { position: relative; display: grid; grid-template-columns: 26px auto minmax(0, 1fr) 42px auto 108px minmax(96px, auto); align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border-radius: 14px; text-align: left; background: rgba(255, 255, 255, .025); border: 1px solid var(--line-2); overflow: hidden; transition: transform .25s var(--ease), border-color .2s; animation: grIn .5s var(--ease) both; }
.gr:nth-child(2) { animation-delay: .04s; }
.gr:nth-child(3) { animation-delay: .08s; }
.gr:nth-child(4) { animation-delay: .12s; }
.gr:nth-child(n+5) { animation-delay: .16s; }
@keyframes grIn { from { opacity: 0; transform: translateY(6px); } }
.gr:hover { border-color: rgba(255, 255, 255, .16); transform: translateX(3px); }
.gr > :not(.gr-race) { position: relative; }
.gr-race { position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); pointer-events: none; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07)); border-right: 2px solid rgba(255, 255, 255, .22); animation: raceIn 1.1s var(--ease) both; }
.gr-race.pos { background: linear-gradient(90deg, transparent 20%, color-mix(in srgb, var(--pos) 15%, transparent)); border-right-color: color-mix(in srgb, var(--pos) 65%, transparent); }
.gr-race.neg { background: linear-gradient(90deg, transparent 20%, color-mix(in srgb, var(--neg) 15%, transparent)); border-right-color: color-mix(in srgb, var(--neg) 55%, transparent); }
@keyframes raceIn { from { width: 0; } }
.gr-rank { font-weight: 700; font-size: 14px; text-align: center; color: var(--text-3); display: grid; place-items: center; }
.gr.r1 .gr-rank { color: var(--text); }
.gr.r2 .gr-rank { color: #e5e7eb; }
.gr.r3 .gr-rank { color: var(--text-2); }
.gr.r1 { border-color: rgba(255, 255, 255, .18); background: linear-gradient(90deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02)); }
.gr.me { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ga) 40%, transparent); }
.gr-nm { display: grid; min-width: 0; }
.gr-nm .lk-name { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-nm i { font-style: normal; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-streak { display: flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.gr-streak .ic { color: var(--text); }
.gr-spark { display: block; }
.gr-spark .pos { fill: var(--pos); }
.gr-spark .neg { fill: var(--neg); }
.gr-spark .flat { fill: var(--text-3); }
.gr-meta { font-size: 12px; color: var(--text-3); text-align: right; white-space: nowrap; }
.gr-pnl { text-align: right; font-size: 16px; font-weight: 650; letter-spacing: -.02em; white-space: nowrap; }
.gr.idle { opacity: .5; }
.gr.idle .gr-pnl { font-size: 12px; font-weight: 400; letter-spacing: 0; }

/* feed */
#gp-posts { overflow-y: auto; flex: 1; min-height: 120px; margin: 0 -8px; padding: 0 8px; }
.gp-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #34d399; animation: pulse 2.4s infinite; margin-right: 4px; vertical-align: 1px; }
#gp-picked { flex: 1; min-width: 0; }
#gp-picked .chip button { display: grid; margin-left: 2px; opacity: .7; }
@keyframes ptShine { 0%, 60% { background-position: 150% 0; } 100% { background-position: -100% 0; } }

/* picking a trade to share */
.pick-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.pick-t { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; text-align: left; }
.pick-t:hover { background: var(--hover); }
.pick-t .grow { display: grid; }
.pick-t .dim { font-size: 12px; }
.pick-row { display: flex; align-items: center; gap: 6px; }
.pick-row .pick-t { flex: 1; min-width: 0; }
.pick-card { flex: none; }

/* you vs them */
.vs { --la: #fff; text-align: center; }
.vs-top { display: flex; justify-content: center; align-items: center; gap: 22px; margin-top: 6px; }
.vs-p { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; max-width: 160px; }
.vs-p .lk-name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; margin-top: 4px; }
.vs-p .dim { font-size: 12px; }
.vs-x { font-weight: 800; font-size: 24px; font-style: italic; letter-spacing: .02em; background: linear-gradient(180deg, #fff, #7d7f88); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 14px rgba(255, 255, 255, .25)); }
.vs-k { font-size: 12px; margin: 16px 0 8px; }
.vs-rows { display: grid; gap: 4px; }
.vs-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, .03); }
.vs-row:has(> span:first-child) { display: flex; justify-content: space-between; }
.vs-row span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.vs-row b { font-weight: 600; font-size: 14px; color: var(--text-2); }
.vs-row b:first-child { text-align: left; }
.vs-row b:last-child { text-align: right; }
.vs-row b.win { color: var(--text); text-shadow: 0 0 14px rgba(255, 255, 255, .35); }
.btn.danger { color: #fca5a5; }
.btn.danger.sure { background: rgba(248, 113, 113, .16); color: #fecaca; }

/* invite + group settings */

@media (hover: none) { .rx-plus, .post-del { opacity: 1; } }
@media (max-width: 1100px) {
  #gp-posts { overflow: visible; }
}
@media (max-width: 760px) {
  .cm-actions, .cm-code { width: 100%; }
  .gp-goal { grid-template-columns: minmax(0, 1fr); }
  .gg-v { text-align: left; }
  .gp-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gr { grid-template-columns: 22px auto minmax(0, 1fr) auto auto; gap: 9px; padding: 9px 10px; }
  .gr-pnl { font-size: 14.5px; }
}
