/* ============================================================
   Personal Leagues — net-new component styles
   ------------------------------------------------------------
   Loaded AFTER app.css. Everything here is built on existing
   Quantia tokens (--accent, --q-gradient(-h), --border, --radius-*,
   --shadow-*, --fg-*, --bg-*). No new colors/radii/shadows.
   Reuses .qm-* wherever one already exists; only adds what the
   Personal Leagues feature genuinely needs.
   ============================================================ */

/* ---- back button in top bar ---- */
.lg-back {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  transition: background .15s; flex: none;
}
.lg-back:hover { background: rgba(255,255,255,.26); }

/* ---- "Powered by Quantia" guest badge ---- */
.lg-powered { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700;
  color: var(--fg-3); font-family: var(--font-head); letter-spacing: .01em; }
.lg-powered img { height: 13px; opacity: .9; }
.lg-powered.on-dark { color: rgba(255,255,255,.82); }
.lg-powered.on-dark img { opacity: .95; }

/* ---- commissioner pill ---- */
.lg-commish { display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-family: var(--font-head); font-weight: 800; font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--q-gradient-h); padding: 3px 8px; border-radius: var(--radius-pill); }
.lg-commish svg { width: 11px; height: 11px; }
.lg-shield-ic { color: var(--brand-2); flex: none; display: inline-flex; }

/* ============== Screen 1 · Mis Ligas ============== */
.lg-list { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.lg-card { display: flex; align-items: flex-start; gap: 14px; padding: 16px; cursor: pointer;
  transition: transform .16s, box-shadow .2s, border-color .2s; }
.lg-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.lg-card:active { transform: scale(.995); }
.lg-card .ic {
  flex: none; width: 50px; height: 50px; border-radius: var(--radius-md); background: var(--q-gradient);
  display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-accent);
}
.lg-card .body { flex: 1; min-width: 0; }
.lg-card .row1 { display: flex; align-items: flex-start; gap: 10px; }
.lg-card .nm { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; flex: 1; }
.lg-card .nm b { font-family: var(--font-head); font-weight: 800; font-size: 17px; letter-spacing: -.01em;
  color: var(--fg-1); line-height: 1.2; }
.lg-card .meta { font-size: 13px; color: var(--fg-3); line-height: 1.4; margin-top: 4px; }
.lg-card .rankbox { flex: none; margin-left: auto; text-align: right; white-space: nowrap; }
.lg-card .rankbox .r { font-family: var(--font-head); font-weight: 900; font-size: 20px; color: var(--accent); line-height: 1; letter-spacing: -.02em; }
.lg-card .rankbox .p { font-size: 11px; color: var(--fg-3); font-weight: 700; margin-top: 3px; }
.lg-card .strip { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lg-card .strip .lbl { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--q-grey-300); font-family: var(--font-head); }
.lg-card .strip .qm-strip { display: flex !important; }

/* empty state (Screen 1) */
.lg-empty { text-align: center; padding: 30px 18px 8px; }
.lg-empty .art { position: relative; width: 132px; height: 132px; margin: 0 auto 18px; }
.lg-empty .art .blob { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: .9; }
.lg-empty .art .ring { position: absolute; inset: 0; display: grid; place-items: center; }
.lg-empty .art .ring > div { width: 66px; height: 66px; border-radius: var(--radius-lg); background: var(--q-gradient);
  display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-accent); }
.lg-empty h2 { font-family: var(--font-head); font-weight: 800; font-size: 23px; letter-spacing: -.01em; margin: 0; color: var(--fg-1); }
.lg-empty p { font-size: 15px; color: var(--fg-3); line-height: 1.55; margin: 8px auto 22px; max-width: 30ch; }

/* create FAB (mobile) */
.lg-fab {
  position: fixed; right: 16px; bottom: calc(var(--qm-tabbar-h) + 16px); z-index: 46;
  display: inline-flex; align-items: center; gap: 8px; padding: 14px 20px; border-radius: var(--radius-pill);
  background: var(--q-gradient-h); color: #fff; font-family: var(--font-head); font-weight: 800; font-size: 15px;
  box-shadow: 0 12px 28px rgba(120,40,130,.36); transition: transform .16s, filter .16s;
}
.lg-fab:hover { filter: brightness(1.07); transform: translateY(-1px); }
.lg-fab:active { transform: scale(.97); }
.lg-fab[disabled] { background: var(--bg-3); color: var(--fg-3); box-shadow: none; pointer-events: auto; cursor: not-allowed; }
@media (min-width: 880px) { .lg-fab { display: none; } }
.lg-limit-tip { position: fixed; right: 16px; bottom: calc(var(--qm-tabbar-h) + 70px); z-index: 46;
  background: var(--q-plum); color: #fff; font-size: 12px; font-weight: 700; padding: 8px 12px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); }
@media (min-width: 880px) { .lg-limit-tip { bottom: auto; top: 64px; } }

/* ============== Sheet / modal (Screens 2 & 4) ============== */
.lg-sheet-backdrop { position: fixed; inset: 0; z-index: 75; background: rgba(20,12,40,.45);
  backdrop-filter: blur(2px); display: flex; align-items: flex-end; justify-content: center;
  animation: lg-fade .2s ease both; }
@media (min-width: 880px) { .lg-sheet-backdrop { align-items: center; padding: 24px; } }
@keyframes lg-fade { from { opacity: 0; } to { opacity: 1; } }
.lg-sheet {
  width: 100%; max-width: 520px; background: #fff; color: var(--fg-1);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: 0 -10px 40px rgba(20,12,40,.28);
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); animation: lg-up .26s cubic-bezier(.4,0,.2,1) both;
  max-height: 92vh; overflow: auto;
}
@media (min-width: 880px) {
  .lg-sheet { border-radius: var(--radius-xl); box-shadow: 0 24px 60px rgba(20,12,40,.32); padding: 22px 26px 26px; animation: lg-pop .24s cubic-bezier(.4,0,.2,1) both; }
}
@keyframes lg-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes lg-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.lg-sheet .handle { width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 4px auto 14px; }
@media (min-width: 880px) { .lg-sheet .handle { display: none; } }
.lg-sheet h3 { font-family: var(--font-head); font-weight: 800; font-size: 22px; letter-spacing: -.01em; margin: 0; }
.lg-sheet .sub { font-size: 14px; color: var(--fg-3); line-height: 1.5; margin: 6px 0 18px; }
.lg-count { display: block; text-align: right; font-size: 12px; color: var(--fg-3); font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.lg-textbtn { width: 100%; text-align: center; font-family: var(--font-head); font-weight: 700; font-size: 14px;
  color: var(--fg-3); padding: 12px; margin-top: 4px; transition: color .15s; }
.lg-textbtn:hover { color: var(--fg-1); }
.lg-textbtn.accent { color: var(--accent); }

/* success check (create step 2) */
.lg-success { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; margin: 6px auto 4px;
  background: rgba(31,138,91,.12); color: var(--ok); animation: lg-pop .3s cubic-bezier(.34,1.56,.64,1) both .05s; }

/* invite link box */
.lg-invite { display: flex; align-items: center; gap: 10px; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 14px; margin: 4px 0 14px; }
.lg-invite code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; color: var(--fg-2);
  word-break: break-all; flex: 1; line-height: 1.4; }
.lg-invite .copyic { flex: none; width: 34px; height: 34px; border-radius: 9px; background: #fff; border: 1px solid var(--border);
  color: var(--accent); display: grid; place-items: center; transition: all .15s; }
.lg-invite .copyic:hover { border-color: var(--accent); background: rgba(221,49,86,.06); }
.lg-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lg-note { font-size: 12.5px; color: var(--fg-3); text-align: center; margin: 14px 0 2px; line-height: 1.5; }

/* ============== Screen 3 · League View ============== */
.lg-lv-head { display: flex; align-items: flex-start; gap: 12px; }
.lg-lv-head .grow { flex: 1; min-width: 0; }
.lg-tabs { margin-top: 18px; }
.lg-info-note { display: flex; align-items: center; gap: 9px; margin-top: 16px; padding: 11px 14px; border-radius: var(--radius-md);
  background: var(--q-mist); color: var(--brand-2); font-size: 13px; line-height: 1.45; font-weight: 600; }
.lg-info-note svg { flex: none; }

/* empty-league callout (only commissioner) */
.lg-callout { text-align: center; padding: 30px 20px; margin-top: 16px; border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg); background: var(--bg-2); }
.lg-callout .em { font-size: 40px; }
.lg-callout b { display: block; font-family: var(--font-head); font-weight: 800; font-size: 17px; margin: 10px 0 4px; color: var(--fg-1); }
.lg-callout p { font-size: 14px; color: var(--fg-3); margin: 0 auto 18px; max-width: 30ch; line-height: 1.5; }

/* ============== Screen 4 · Manage ============== */
.lg-sec { margin-top: 22px; }
.lg-sec:first-of-type { margin-top: 6px; }
.lg-sec > .h { font-family: var(--font-head); font-weight: 800; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg-3); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.lg-mem { display: flex; align-items: center; gap: 11px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.lg-mem:last-child { border-bottom: none; }
.lg-mem .info { flex: 1; min-width: 0; }
.lg-mem .info .n { font-family: var(--font-head); font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 7px; }
.lg-mem .info .n .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-mem .pts { font-family: var(--font-head); font-weight: 800; font-size: 13px; color: var(--fg-3); white-space: nowrap; }
.lg-mem .rm { flex: none; width: 30px; height: 30px; border-radius: 8px; background: #fff; border: 1px solid var(--border);
  color: var(--fg-3); display: grid; place-items: center; transition: all .15s; }
.lg-mem .rm:hover { background: var(--accent); color: #fff; border-color: transparent; }
.lg-warn { font-size: 12px; color: var(--fg-3); margin-top: 8px; line-height: 1.5; }
.lg-danger { width: 100%; margin-top: 10px; font-family: var(--font-head); font-weight: 800; font-size: 14px; color: var(--accent);
  padding: 12px; border-radius: var(--radius-md); border: 1.5px solid rgba(221,49,86,.4); background: #fff; transition: all .15s; }
.lg-danger:hover { background: rgba(221,49,86,.07); border-color: var(--accent); }
.lg-rename-row { display: flex; gap: 8px; }
.lg-rename-row .qm-input { flex: 1; }

/* confirm dialog */
.lg-confirm-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(20,12,40,.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px; animation: lg-fade .16s ease both; }
.lg-confirm { width: 100%; max-width: 360px; background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); padding: 22px; text-align: center; animation: lg-pop .2s cubic-bezier(.4,0,.2,1) both; }
.lg-confirm b { font-family: var(--font-head); font-weight: 800; font-size: 18px; }
.lg-confirm p { font-size: 14px; color: var(--fg-3); line-height: 1.5; margin: 8px 0 18px; }

/* ============== Screen 5 · Guest landing ============== */
.lg-land { min-height: 100vh; background: var(--bg-2); }
.lg-hero { background: var(--q-mesh); color: #fff; position: relative; overflow: hidden; padding: 26px 22px 56px; text-align: center; }
.lg-hero .blob { position: absolute; right: -56px; top: -70px; width: 240px; opacity: .14; pointer-events: none; }
.lg-hero .toprow { display: flex; align-items: center; gap: 10px; position: relative; z-index: 2; }
.lg-hero .ball { font-size: 60px; line-height: 1; margin: 18px 0 12px; position: relative; z-index: 2; filter: drop-shadow(0 3px 8px rgba(0,0,0,.25)); }
.lg-hero h1 { font-family: var(--font-head); font-weight: 900; font-size: 28px; letter-spacing: -.02em; margin: 0; position: relative; z-index: 2; }
.lg-hero .by { color: rgba(255,255,255,.74); font-size: 14px; font-weight: 600; margin-top: 6px; position: relative; z-index: 2; }
.lg-hero .members { display: inline-flex; align-items: center; gap: 9px; margin-top: 16px; position: relative; z-index: 2;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); padding: 6px 14px 6px 6px; border-radius: var(--radius-pill); }
.lg-hero .members span { font-size: 12.5px; font-weight: 700; color: rgba(255,255,255,.92); }

.lg-avstack { display: flex; }
.lg-avstack > * { margin-left: -8px; box-shadow: 0 0 0 2px var(--q-plum); }
.lg-avstack > *:first-child { margin-left: 0; }
.lg-avstack.on-light > * { box-shadow: 0 0 0 2px #fff; }
.lg-avmore { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.22); color: #fff;
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; font-size: 11px; flex: none; }

.lg-land-card { background: #fff; border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-lg);
  margin-top: -28px; position: relative; z-index: 3; padding: 26px 22px 26px; }
@media (min-width: 880px) {
  .lg-hero { padding-bottom: 80px; }
  .lg-land-card { max-width: 460px; margin: -36px auto 0; border-radius: var(--radius-xl); }
  .lg-hero h1 { font-size: 40px; }
  .lg-hero .ball { font-size: 76px; }
}
.lg-land-card h2 { font-family: var(--font-head); font-weight: 800; font-size: 22px; letter-spacing: -.01em; margin: 0 0 16px; }
.lg-bullets { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.lg-bullet { display: flex; align-items: center; gap: 11px; font-size: 14.5px; color: var(--fg-2); line-height: 1.4; }
.lg-bullet .bk { flex: none; width: 26px; height: 26px; border-radius: 50%; background: rgba(31,138,91,.12); color: var(--ok); display: grid; place-items: center; }
.lg-land-foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border); font-size: 11.5px; color: var(--fg-3); text-align: center; }
.lg-land-foot img { height: 14px; opacity: .85; }

/* ============== Screen 6 · Guest register additions ============== */
.lg-check { display: flex; align-items: flex-start; gap: 11px; padding: 4px 0; cursor: pointer; }
.lg-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.lg-check .box { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-strong);
  background: #fff; display: grid; place-items: center; color: #fff; margin-top: 1px; transition: all .15s; }
.lg-check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.lg-check.err .box { border-color: var(--error); box-shadow: 0 0 0 3px rgba(221,49,86,.12); }
.lg-check .lbl { font-size: 13.5px; color: var(--fg-2); line-height: 1.45; }
.lg-check .lbl a { color: var(--accent); font-weight: 700; }
.lg-check.req .lbl b { color: var(--fg-1); font-weight: 700; }
@keyframes lg-shake { 0%,100%{ transform: translateX(0);} 20%,60%{ transform: translateX(-5px);} 40%,80%{ transform: translateX(5px);} }
.lg-shake { animation: lg-shake .4s; }

/* ---- generic: hide app chrome when embedded as a frame ---- */
.lg-framehide .qm-demo-fab, .lg-framehide .qm-demo-panel { display: none !important; }

/* ---- guest auth (email-first join) shared bits ---- */
.lg-rh { font-family: var(--font-head); font-weight: 800; font-size: 22px; letter-spacing: -.01em; color: var(--fg-1); }
.lg-rp { font-size: 14px; color: var(--fg-3); margin: 6px 0 18px; line-height: 1.5; }
.lg-rp b { color: var(--fg-2); }
.lg-ferr { font-size: 12px; color: var(--error); font-weight: 700; margin-top: 6px; display: block; }

/* ---- prototype reliability ----
   Entrance animations (qm-fadein → keyframes from opacity:0, fill:both) stay
   stuck at opacity 0 while a frame is offscreen/throttled (the animation
   timeline is paused). This runner is embedded in many device iframes, so we
   force the visible END state as the base — content always paints. Only
   loaded here; production app.css is unaffected. */
.qm-fadein { animation: none !important; opacity: 1 !important; transform: none !important; }
