/* ═══════════════════════════════════════════════════════════════
   BrainiaClub — site-wide motion & polish layer (fx)
   Loaded LAST on every page. Pure enhancement: removing this file
   and js/core/fx.js restores the previous look. Motion is switched
   off for visitors who prefer reduced motion.
   ═══════════════════════════════════════════════════════════════ */

/* ── Shared keyframes ───────────────────────────────────────── */
@keyframes fxUp     { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fxFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fxBob    { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes fxSheen  { 0% { transform: translateX(-120%) skewX(-18deg); } 55%, 100% { transform: translateX(260%) skewX(-18deg); } }
@keyframes fxShift  { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes fxStripes { from { background-position: 0 0; } to { background-position: 28px 0; } }
@keyframes fxModalIn { from { opacity: 0; transform: translateY(26px) scale(.96); } to { opacity: 1; transform: none; } }

/* ── Scroll reveal (fx.js adds .fx-r then .fx-in) ───────────── */
.fx-r { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); transition-delay: var(--fx-d, 0s); }
.fx-r.fx-in { opacity: 1; transform: none; }

/* ── Buttons: tactile press + light sweep on hover ──────────── */
.neumorphic-btn, .tm2-btn { transition: transform .18s ease, box-shadow .25s ease, filter .25s ease; }
.neumorphic-btn:active, .tm2-btn:active { transform: scale(.97); }
.tm2-btn-primary, .tm2-btn-gold, .neumorphic-btn.primary { position: relative; overflow: hidden; }
.tm2-btn-primary::after, .tm2-btn-gold::after, .neumorphic-btn.primary::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.38), transparent);
    transform: translateX(-120%) skewX(-18deg); pointer-events: none;
}
.tm2-btn-primary:hover::after, .tm2-btn-gold:hover::after, .neumorphic-btn.primary:hover::after { animation: fxSheen .9s ease; }

/* ═══════════════ SETTINGS ═══════════════ */
.settings-section.active { animation: fxUp .4s ease both; }
.settings-nav a, .settings-nav button { transition: background .25s ease, color .25s ease, transform .2s ease; }
.settings-nav a:hover, .settings-nav button:hover { transform: translateX(3px); }

/* ═══════════════ TOURNAMENTS ═══════════════ */
.tm2-title span { background-size: 220% auto !important; animation: fxShift 6s ease-in-out infinite; }
.tm2-hero::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 30%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.25), transparent);
    animation: fxSheen 7s ease-in-out infinite 1.2s; pointer-events: none;
}
body.dark-mode .tm2-hero::after { background: linear-gradient(100deg, transparent, rgba(255,255,255,.06), transparent); }
.tm2-hero-text { animation: fxUp .6s ease both; }
.tm2-stat { transition: transform .25s ease, box-shadow .25s ease; animation: fxUp .55s ease both; }
.tm2-stat:nth-child(1) { animation-delay: .08s; } .tm2-stat:nth-child(2) { animation-delay: .16s; }
.tm2-stat:nth-child(3) { animation-delay: .24s; } .tm2-stat:nth-child(4) { animation-delay: .32s; }
.tm2-stat:hover { transform: translateY(-3px); box-shadow: var(--neumorphic-shadow); }
.tm2-stat-ico { animation: fxBob 3.6s ease-in-out infinite; }
.tm2-stat:nth-child(2) .tm2-stat-ico { animation-delay: .6s; }
.tm2-stat:nth-child(3) .tm2-stat-ico { animation-delay: 1.2s; }
.tm2-stat:nth-child(4) .tm2-stat-ico { animation-delay: 1.8s; }

.tm2-tab { transition: color .25s ease, background .35s ease, box-shadow .35s ease, transform .2s ease; }
.tm2-tab:not(.active):hover { transform: translateY(-1px); }
.tm2-chip { transition: all .2s ease; }
.tm2-chip:hover { transform: translateY(-1px); }

/* Cards: stagger, lift, mouse spotlight, icon tilt */
.tm2-card:nth-child(2) { animation-delay: .05s; }  .tm2-card:nth-child(3) { animation-delay: .1s; }
.tm2-card:nth-child(4) { animation-delay: .15s; }  .tm2-card:nth-child(5) { animation-delay: .2s; }
.tm2-card:nth-child(6) { animation-delay: .25s; }  .tm2-card:nth-child(n+7) { animation-delay: .3s; }
.tm2-card { transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease, border-color .2s ease !important; overflow: hidden; }
.tm2-card::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), rgba(79,125,240,.12), transparent 60%);
    opacity: 0; transition: opacity .3s ease;
}
.tm2-card.is-premium::after { background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), rgba(245,176,66,.16), transparent 60%); }
.tm2-card:hover::after { opacity: 1; }
.tm2-card:hover { transform: translateY(-6px) !important; box-shadow: var(--neumorphic-shadow), 0 22px 40px -22px rgba(27,50,94,.45); }
.tm2-card.is-premium:hover { box-shadow: var(--neumorphic-shadow), 0 22px 40px -20px rgba(245,176,66,.55); }
.tm2-card-ico { transition: transform .35s cubic-bezier(.2,.8,.2,1.4); }
.tm2-card:hover .tm2-card-ico { transform: rotate(-8deg) scale(1.1); }

/* Prize value: gentle gold shimmer */
.tm2-prize-val {
    background: linear-gradient(90deg, var(--t2-gold-dark, #c98a1c) 20%, #ffd27a 50%, var(--t2-gold-dark, #c98a1c) 80%);
    background-size: 220% auto;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: fxShift 4.5s ease-in-out infinite;
}
/* Capacity bar: grows in, and stripes move while a tournament is live */
.tm2-cap-bar span { transition: width 1.1s cubic-bezier(.2,.8,.2,1) !important; position: relative; }
.tm2-card:has(.tm2-pill.is-live) .tm2-cap-bar span::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 7px, transparent 7px 14px);
    animation: fxStripes 1s linear infinite;
}
/* How-it-works */
.tm2-how { animation: fxUp .6s ease both .2s; }
.tm2-step-ico { transition: transform .3s ease; }
.tm2-steps > *:hover .tm2-step-ico { transform: scale(1.12) rotate(-6deg); }

/* Detail pop-up */
.detail-modal-backdrop.active { animation: fxFadeIn .25s ease both; }
.detail-modal-backdrop.active .detail-modal { animation: fxModalIn .45s cubic-bezier(.2,.9,.25,1.15) both; }


/* ═══════════════ SIGN UP (login.html) ═══════════════ */
.su-perks { display: grid; gap: 8px; margin: 0 0 18px; padding: 14px; border-radius: 16px; background: var(--primary-bg); box-shadow: var(--neumorphic-inset); animation: fxUp .45s ease both; }
.su-perk { display: flex; align-items: center; gap: 10px; font-size: .8rem; line-height: 1.35; color: var(--text-dark); }
.su-perk i { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 9px; font-size: .78rem; color: #fff; background: linear-gradient(135deg, var(--primary-accent), var(--primary-dark)); }
.su-rules { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; }
.su-rules li { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .7rem; font-weight: 600; color: var(--text-muted, #6b7689); background: rgba(27,50,94,.07); transition: color .25s ease, background .25s ease, transform .25s ease; }
.su-rules li::before { content: "\25CB"; font-size: .7rem; }
.su-rules li.ok { color: #1f9d57; background: rgba(31,157,87,.12); transform: scale(1.03); }
.su-rules li.ok::before { content: "\2713"; font-weight: 800; }
body.dark-mode .su-rules li, html.dark-mode .su-rules li { background: rgba(255,255,255,.06); color: #b8c2d6; }
body.dark-mode .su-rules li.ok, html.dark-mode .su-rules li.ok { color: #4ade80; background: rgba(74,222,128,.12); }
.su-steps { list-style: none; margin: 4px 0 16px; padding: 0; display: grid; gap: 8px; counter-reset: none; }
.su-steps li { display: flex; gap: 10px; align-items: flex-start; }
.su-step-n { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 50%; font-size: .72rem; font-weight: 800; color: var(--primary-accent); background: var(--primary-bg); box-shadow: var(--neumorphic-shadow); }
.su-steps p { margin: 0; font-size: .74rem; line-height: 1.4; color: var(--text-muted, #6b7689); }
.su-steps strong { display: block; font-size: .8rem; color: var(--text-dark); }
.otp-help { display: flex; gap: 8px; align-items: flex-start; margin: 4px auto 6px; max-width: 340px; font-size: .74rem; line-height: 1.45; text-align: left; color: var(--text-muted, #6b7689); }
.otp-help i { margin-top: 2px; color: var(--primary-accent); }

/* ═══════════════ WELCOME (first visit after sign-up) ═══════════════ */
.bc-welcome { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; padding: 16px; background: rgba(8,12,26,.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: fxFadeIn .3s ease both; }
.bc-welcome-card { position: relative; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; border-radius: 26px; background: var(--primary-bg, #e0e5ec); color: var(--text-dark, #2b3445); box-shadow: 0 30px 80px -20px rgba(0,0,0,.55); animation: fxModalIn .55s cubic-bezier(.2,.9,.25,1.2) both; }
.bc-welcome-head { position: relative; overflow: hidden; padding: 30px 26px 22px; text-align: center; color: #fff; background: linear-gradient(120deg, #0F1E3A, #1B325E 40%, #3B5A92 75%, #1B325E); background-size: 240% 240%; animation: fxShift 8s ease-in-out infinite; }
.bc-welcome-badge { width: 66px; height: 66px; margin: 0 auto 12px; display: grid; place-items: center; font-size: 1.8rem; border-radius: 20px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); animation: fxBob 3s ease-in-out infinite; }
.bc-welcome-head h2 { margin: 0 0 6px; font-size: 1.45rem; font-weight: 800; color: #fff; }
.bc-welcome-head p { margin: 0; font-size: .86rem; color: rgba(255,255,255,.85); }
.bc-welcome-body { padding: 20px 22px 22px; display: grid; gap: 10px; }
.bc-welcome-act { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; text-decoration: none; color: inherit; background: var(--primary-bg, #e0e5ec); box-shadow: var(--neumorphic-shadow); transition: transform .2s ease; animation: fxUp .45s ease both; }
.bc-welcome-act:nth-child(2) { animation-delay: .08s; } .bc-welcome-act:nth-child(3) { animation-delay: .16s; } .bc-welcome-act:nth-child(4) { animation-delay: .24s; }
.bc-welcome-act:hover { transform: translateY(-2px); }
.bc-welcome-act i { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #1B325E, #3B5A92); }
.bc-welcome-act strong { display: block; font-size: .9rem; }
.bc-welcome-act span { font-size: .76rem; opacity: .75; }
.bc-welcome-close { width: 100%; margin-top: 4px; padding: 13px; border: 0; border-radius: 14px; cursor: pointer; font: 700 .9rem 'Poppins', sans-serif; color: #fff; background: linear-gradient(135deg, #1B325E, #3B5A92); }
.bc-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 5001; overflow: hidden; }
.bc-confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: fxFall linear forwards; }
@keyframes fxFall { to { transform: translateY(110vh) rotate(720deg); opacity: .9; } }


/* ═══════════════ TOURNAMENT HOST CONSOLE (lobby, admins only) ═══════════════ */
.host-console { margin: 0 0 22px; padding: 20px; border-radius: 24px; background: var(--primary-bg); box-shadow: var(--neumorphic-shadow); border-top: 4px solid #f5b042; animation: fxUp .45s ease both; }
.hc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.hc-head h2 { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--text-dark); }
.hc-head p { margin: 2px 0 0; font-size: .8rem; opacity: .7; }
.hc-crown { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 14px; color: #1a1a1a; background: linear-gradient(135deg, #ffd27a, #f5b042); box-shadow: 0 8px 18px -8px rgba(245,176,66,.8); animation: fxBob 3s ease-in-out infinite; }
.hc-status { margin-left: auto; padding: 5px 12px; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }
.hc-status.is-live { color: #fff; background: #16a34a; animation: fxPulseG 2s infinite; }
.hc-status.is-paused { color: #1a1a1a; background: #f5b042; }
.hc-status.is-lobby { color: var(--primary-accent); background: rgba(27,50,94,.1); }
@keyframes fxPulseG { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); } 70% { box-shadow: 0 0 0 8px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.hc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.hc-stats > div { padding: 12px; border-radius: 16px; text-align: center; box-shadow: var(--neumorphic-inset); }
.hc-stats strong { display: block; font-size: 1.35rem; font-weight: 800; color: var(--text-dark); font-variant-numeric: tabular-nums; }
.hc-stats span { font-size: .68rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; opacity: .65; }
.hc-body { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 16px; }
.hc-q { padding: 16px; border-radius: 18px; background: linear-gradient(135deg, #0F1E3A, #1B325E 60%, #2B4470); color: #fff; min-height: 150px; }
.hc-q-empty { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: rgba(255,255,255,.9); }
.hc-q-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .74rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: rgba(255,255,255,.75); }
.hc-time { padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: .95rem; color: #fff; font-variant-numeric: tabular-nums; }
.hc-time.is-low { background: #d6334a; animation: fxBump .6s ease infinite; }
@keyframes fxBump { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.hc-q-img { width: 100%; max-height: 160px; object-fit: cover; border-radius: 12px; margin: 10px 0 0; }
.hc-q-text { margin: 10px 0 12px; font-size: 1.02rem; font-weight: 700; line-height: 1.4; }
.hc-opts { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hc-opts li { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; font-size: .82rem; background: rgba(255,255,255,.1); }
.hc-opts li span { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 6px; font-weight: 800; font-size: .72rem; background: rgba(255,255,255,.2); }
.hc-answered { display: flex; align-items: center; gap: 10px; font-size: .8rem; }
.hc-bar { flex: 1; height: 8px; border-radius: 999px; background: rgba(255,255,255,.18); overflow: hidden; }
.hc-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4ade80, #16a34a); transition: width .5s ease; }
.hc-top { padding: 14px; border-radius: 18px; box-shadow: var(--neumorphic-inset); }
.hc-top h3 { margin: 0 0 8px; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; opacity: .7; }
.hc-top ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.hc-top li { display: flex; align-items: center; gap: 8px; font-size: .8rem; }
.hc-rank { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 50%; font-size: .7rem; font-weight: 800; color: #fff; background: var(--primary-accent); }
.hc-top li:nth-child(1) .hc-rank { background: #f5b042; color: #1a1a1a; }
.hc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hc-score { font-size: .72rem; opacity: .7; white-space: nowrap; }
.hc-none { opacity: .6; }
.hc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hc-btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border: 0; border-radius: 12px; cursor: pointer; text-decoration: none; font: 700 .82rem 'Poppins', sans-serif; color: var(--text-dark); background: var(--primary-bg); box-shadow: var(--neumorphic-shadow); transition: transform .15s ease, filter .2s ease; }
.hc-btn:hover { transform: translateY(-1px); } .hc-btn:active { transform: scale(.96); } .hc-btn:disabled { opacity: .5; cursor: wait; }
.hc-primary { color: #fff; background: linear-gradient(135deg, #1B325E, #3B5A92); }
.hc-gold { color: #1a1a1a; background: linear-gradient(135deg, #ffd27a, #f5b042); }
.hc-danger { color: #d6334a; background: transparent; box-shadow: inset 0 0 0 2px currentColor; }
.hc-toast { position: fixed; left: 50%; bottom: 24px; z-index: 6000; transform: translate(-50%, 30px); opacity: 0; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: .86rem; color: #fff; background: #1B325E; box-shadow: 0 14px 30px -12px rgba(0,0,0,.5); transition: all .3s ease; pointer-events: none; }
.hc-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) {
    .host-console { padding: 16px; border-radius: 20px; }
    .hc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hc-body { grid-template-columns: 1fr; }
    .hc-opts { grid-template-columns: 1fr; }
    .hc-actions .hc-btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
}

/* ── Reduced motion: switch everything off ─────────────────── */
@media (prefers-reduced-motion: reduce) {
    .fx-r { opacity: 1 !important; transform: none !important; transition: none !important; }
    .host-console, .hc-crown, .hc-status.is-live, .hc-time.is-low,
    .su-perks, .bc-welcome, .bc-welcome-card, .bc-welcome-head, .bc-welcome-badge, .bc-welcome-act,
    .settings-section.active, .tm2-title span, .tm2-hero::after, .tm2-hero-text, .tm2-stat, .tm2-stat-ico, .tm2-prize-val,
    .tm2-card:has(.tm2-pill.is-live) .tm2-cap-bar span::after, .tm2-how,
    .detail-modal-backdrop.active, .detail-modal-backdrop.active .detail-modal { animation: none !important; }
    .tm2-btn-primary:hover::after, .tm2-btn-gold:hover::after, .neumorphic-btn.primary:hover::after { animation: none !important; }
}
