/* Kill everything from base */
html { background-color: #fff !important; scrollbar-width: none !important; }
html::-webkit-scrollbar { display: none !important; }
body {
  padding-top: 0 !important;
  background-color: #fff !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
body::-webkit-scrollbar { display: none !important; width: 0 !important; }
.mw-nav { display: none !important; }
main.container { max-width: none !important; padding: 0 !important; margin: 0 !important; }

/* The tall section that creates scroll room */
#drawSection {
  position: relative;
  height: 1000vh;
}

/* Sticky canvas locks the SVG to viewport while section scrolls behind */
#stickyCanvas {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#logoSvg {
  width: 60vmin;
  max-width: 500px;
}
#logoSvg .s {
  fill: none;
  stroke: #000;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 9999;
  stroke-dashoffset: 9999;
}

/* Scroll cue */
#cue {
  position: absolute;
  bottom: 10vh;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 34px;
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  opacity: 0.3;
}
#cue::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 6px;
  border-radius: 2px;
  background: rgba(0,0,0,0.15);
  transform: translateX(-50%);
  animation: dot 2s ease-in-out infinite;
}
/* Landing dot — first thing anonymous users see */
#landDot {
  position:fixed; bottom:42vh; left:50%; transform:translateX(-50%);
  width:32px; height:32px; border-radius:50%; background:transparent;
  z-index:600; cursor:var(--cur-pointer, pointer); transition:opacity 0.5s;
  opacity:0; pointer-events:none;
}
/* Visible dot centered inside the larger tap target */
#landDot::before {
  content:''; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
  width:8px; height:8px; border-radius:50%; background:rgba(0,0,0,0.25);
}
#landDot::after {
  content:''; position:absolute; bottom:2px; left:50%; transform:translateX(-50%);
  width:40px; height:1px; background:rgba(0,0,0,0.08);
}
@keyframes landBounce {
  0%,100% { transform:translateX(-50%) translateY(0); }
  50% { transform:translateX(-50%) translateY(6px); }
}
#landDot.bouncing { animation:landBounce 2s ease-in-out infinite; }

/* Tooltip card — mirrors #cfmCard (carousel confirm) */
#landTip {
  position:fixed; bottom:42vh; left:50%; transform:translateX(-50%);
  z-index:601; opacity:0; pointer-events:none; transition:opacity 0.35s;
}
#landTip.show { opacity:1; pointer-events:auto; }
.land-card {
  display:flex; width:320px; border:2px solid rgba(0,0,0,0.12); border-radius:10px; overflow:hidden;
}
.land-btn {
  flex:1; padding:0.5rem 0.8rem; font-size:0.7rem; font-weight:700;
  text-transform:uppercase; letter-spacing:1px; cursor:var(--cur-pointer, pointer);
  transition:all 0.2s; text-align:center; text-decoration:none;
  border:none;
}
.land-scroll {
  background:transparent; color:rgba(0,0,0,0.35);
}
.land-scroll:hover { background:#e9c46a; color:#1a1a1a; }
.land-div { width:0; border-left:2px solid rgba(0,0,0,0.12); }
.land-login {
  display:block; background:rgba(0,0,0,0.04); color:#000;
}
.land-login:hover { background:#e9c46a; color:#1a1a1a; }

/* Auth modal — matches profile-modal settings sub-modal pattern */
.auth-overlay {
  display:none; position:fixed; inset:0; z-index:9000;
  background:rgba(0,0,0,0.88); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
  align-items:center; justify-content:center;
  font-family:'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;
}
.auth-overlay.active { display:flex; animation:authFade 0.2s ease; }
@keyframes authFade { from{opacity:0} to{opacity:1} }
.auth-modal {
  width:420px; max-width:92vw;
  background:#1a1f2e; border-radius:16px; border:1px solid rgba(255,255,255,0.06);
  box-shadow:0 12px 60px rgba(0,0,0,0.7);
  overflow:hidden; display:flex; flex-direction:column;
  animation:authSlide 0.4s cubic-bezier(0.22,0.68,0.35,1);
  font-family:inherit;
}
@keyframes authSlide { from{transform:translateY(60px) scale(0.96);opacity:0} to{transform:translateY(0) scale(1);opacity:1} }

/* Header — mirrors .pm-sub-head */
.auth-head {
  padding:1rem 1.2rem 0.8rem; text-align:center;
  border-bottom:1px solid rgba(255,255,255,0.06); flex-shrink:0;
}
.auth-head-icon { font-size:1.3rem; margin-bottom:0.15rem; line-height:1; }
.auth-head h3 {
  font-size:1rem; font-weight:800; color:#e9c46a;
  letter-spacing:2px; text-transform:uppercase; margin:0;
  font-family:inherit;
}

/* Body — mirrors .pm-sub-body */
.auth-body { padding:1.2rem 1.2rem 1rem; display:flex; flex-direction:column; gap:0.6rem; }
.auth-input {
  width:100%; padding:0.6rem 0.8rem; box-sizing:border-box;
  background:#252b3d; border:1px solid rgba(255,255,255,0.1); border-radius:8px;
  color:#f0f0f0; font-size:0.85rem; font-family:inherit;
  outline:none; transition:border-color 0.2s, background 0.2s;
}
.auth-input::placeholder { color:#6b7280; }
.auth-input:focus { border-color:#e9c46a; background:#2a3146; }
.auth-forgot {
  display:inline-block; align-self:flex-end;
  margin-top:0.15rem; padding:0.15rem 0.25rem;
  font-size:0.62rem; font-weight:700; color:#9ca3af;
  text-transform:uppercase; letter-spacing:1px; text-decoration:none;
  font-family:inherit; transition:color 0.2s;
  background:none; border:none; cursor:var(--cur-pointer, pointer);
}
.auth-forgot:hover { color:#e9c46a; }

/* Social login buttons */
.auth-divider {
  display:flex; align-items:center; gap:0.75rem;
  margin:0.15rem 0 0.3rem;
  font-size:0.62rem; font-weight:600; text-transform:uppercase;
  letter-spacing:1px; color:#6b7280;
}
.auth-divider::before, .auth-divider::after {
  content:''; flex:1; height:1px; background:rgba(255,255,255,0.08);
}
.auth-social { display:flex; flex-direction:column; gap:0.45rem; }
.auth-social-btn {
  display:flex; align-items:center; justify-content:center; gap:0.5rem;
  padding:0.55rem 1rem; border-radius:8px;
  font-size:0.78rem; font-weight:600; text-decoration:none;
  transition:background 0.2s; font-family:inherit;
}
.auth-social-google {
  background:#fff; color:#1a1a1a; border:1px solid rgba(255,255,255,0.12);
}
.auth-social-google:hover { background:#f7f8f8; }
.auth-social-github {
  background:#24292e; color:#f0f0f0; border:1px solid rgba(255,255,255,0.08);
}
.auth-social-github:hover { background:#2f363d; }

/* Reset-password nested overlay — sits on top of the sign-in overlay */
#resetOverlay { z-index:9100; background:rgba(0,0,0,0.65); }
.auth-msg {
  font-size:0.8rem; color:#9ca3af; line-height:1.55;
  text-align:center; margin:0 0 0.3rem; font-family:inherit;
}
.auth-msg a { color:#e9c46a; text-decoration:none; }
.auth-msg a:hover { text-decoration:underline; }
.auth-error {
  background:rgba(231,111,81,0.08); border:1px solid rgba(231,111,81,0.25);
  border-radius:8px; padding:0.5rem 0.75rem;
  font-size:0.72rem; color:#e76f51; line-height:1.45;
  font-family:inherit; text-align:center;
}
.auth-success-icon {
  font-size:2.2rem; color:#e9c46a; text-align:center;
  margin:0.3rem 0 0.2rem; line-height:1;
}

/* Footer — mirrors .pm-sub-foot */
.auth-foot {
  padding:0.6rem 1.2rem 0.9rem; border-top:1px solid rgba(255,255,255,0.06);
  display:flex; gap:0.5rem; justify-content:center; flex-shrink:0;
}
.auth-btn {
  padding:0.5rem 2rem; border-radius:8px; cursor:var(--cur-pointer, pointer);
  font-size:0.8rem; font-weight:700; font-family:inherit;
  text-transform:uppercase; letter-spacing:1px;
  transition:all 0.2s;
}
.auth-btn-back {
  background:none; border:1px solid rgba(255,255,255,0.08); color:#9ca3af;
}
.auth-btn-back:hover { border-color:rgba(255,255,255,0.18); color:#f0f0f0; }
.auth-btn-go {
  background:#e9c46a; border:1px solid #e9c46a; color:#1a1a1a;
}
.auth-btn-go:hover { filter:brightness(1.1); transform:scale(1.02); }

@keyframes dot {
  0%,100% { transform: translateX(-50%) translateY(0); opacity: .5; }
  50% { transform: translateX(-50%) translateY(10px); opacity: .1; }
}
/* Nationality badges — no hover effects, only positional classes */
.nb { flex:0 0 auto; width:80px; display:flex; flex-direction:column; align-items:center; gap:8px;
  cursor:var(--cur-default, default); user-select:none; pointer-events:none; transition:opacity .4s,filter .4s; opacity:.12; filter:saturate(.3) brightness(.6); }
.nb.c1 { opacity:.38; filter:saturate(.55) brightness(.85); }
.nb.c0 { opacity:1; filter:none; pointer-events:auto; cursor:var(--cur-pointer, pointer); z-index:5; }
.nb.c0 .country-badge-wrapper { transform:scale(1.22); transition:transform .4s cubic-bezier(.25,.1,.25,1); }
.nb .country-badge-wrapper { transition:transform .4s cubic-bezier(.25,.1,.25,1); }
/* Kill global badge hover effects inside carousel — pointer-events off so :hover never fires */
.nb .country-badge-wrapper { pointer-events:none !important; }

/* Confirm buttons — gold bg + white text on hovered button only */
#cfmCancel:hover { background:#e9c46a !important; color:#fff !important; }
#cfmOk:hover { background:#e9c46a !important; color:#fff !important; }
.nb.c3 { opacity:0; pointer-events:none; }
.nb .nn { font-size:.65rem; letter-spacing:1.2px; text-transform:uppercase; white-space:nowrap; opacity:0; color:#666; transition:opacity .3s; }
.nb.c0 .nn { opacity:1; }

/* Piece wrappers — positioning + transitions */
.pi-wrap {
  position:absolute; width:28vmin; height:28vmin; min-width:150px; min-height:150px;
  opacity:0; cursor:var(--cur-pointer, pointer); transition:all 1.2s cubic-bezier(.25,.1,.25,1);
  will-change:transform;
}
.pi-wrap [data-balatro-tilt] { width:100%; height:100%; }
.pi-img {
  width:100%; height:100%; object-fit:contain;
  filter:invert(1) sepia(1) saturate(2) hue-rotate(-10deg) brightness(0.85);
  transition:filter 0.3s ease;
}
.pi-wrap:hover .pi-img {
  filter:invert(1) sepia(1) saturate(3) hue-rotate(-10deg) brightness(1)
    drop-shadow(0 0 20px rgba(233,196,106,0.5));
}
.pi-wrap.pi-dimmed {
  opacity:0.15 !important; pointer-events:none;
}
.pi-wrap.pi-dimmed .pi-img {
  filter:invert(1) sepia(0.5) saturate(1) hue-rotate(-10deg) brightness(0.5);
}
.pi-wrap.pi-active { z-index:10; }
.pi-wrap.pi-active .pi-img {
  filter:invert(1) sepia(1) saturate(3) hue-rotate(-10deg) brightness(1)
    drop-shadow(0 0 24px rgba(233,196,106,0.6));
}
.pi-favicon { position:absolute; width:24vmin; height:24vmin; min-width:160px; min-height:160px; object-fit:contain; opacity:0; transition:opacity 1.5s ease; }

/* Piece info panel */
.pi-info {
  position:absolute; top:50%; width:280px; opacity:0; pointer-events:none;
  transition:all 0.5s cubic-bezier(.25,.1,.25,1);
  color:#f0f0f0; font-family:inherit;
}
.pi-info.pi-info-right { left:calc(50% + 16vmin + 20px); transform:translateY(-50%) translateX(20px); text-align:left; }
.pi-info.pi-info-left  { right:calc(50% + 16vmin + 20px); transform:translateY(-50%) translateX(-20px); text-align:right; }
.pi-info.pi-info-show { opacity:1; pointer-events:auto; }
/* When shown, shift panel toward viewport center by half-composite-offset
   so (active piece + panel) sits symmetric around screen center. */
.pi-info.pi-info-show.pi-info-right { transform:translateY(-50%) translateX(calc(-1vmin - 150px)); }
.pi-info.pi-info-show.pi-info-left  { transform:translateY(-50%) translateX(calc(1vmin + 150px)); }
.pi-info.pi-info-left .pi-info-back { float:right; }
.pi-info-name { font-size:1.4rem; font-weight:700; color:#FFFDD2; margin-bottom:0.5rem; letter-spacing:1px; }
.pi-info-desc { font-size:0.85rem; color:#9ca3af; line-height:1.6; margin-bottom:1.2rem; }
.pi-info-back {
  background:transparent; border:1px solid rgba(255,255,255,0.12); color:#9ca3af;
  padding:0.45rem 1.4rem; border-radius:8px; font-size:0.7rem; font-weight:700;
  text-transform:uppercase; letter-spacing:1px; cursor:var(--cur-pointer, pointer); transition:all 0.2s;
}
.pi-info-btns { display:flex; gap:0.6rem; }
.pi-info-left .pi-info-btns { justify-content:flex-end; }
.pi-info-back:hover { background:rgba(255,253,210,0.12); color:#FFFDD2; border-color:rgba(255,253,210,0.3); }
.pi-info-confirm {
  background:#FFFDD2; border:none; color:#1a1a1a;
  padding:0.45rem 1.4rem; border-radius:8px; font-size:0.7rem; font-weight:700;
  text-transform:uppercase; letter-spacing:1px; cursor:var(--cur-pointer, pointer); transition:all 0.2s;
}
.pi-info-confirm:hover { filter:brightness(1.1); transform:scale(1.02); }

/* Navigation loader — fires the moment Enter is clicked, persists until browser unloads home.
   Mirrors the sim_loader visual so the handoff to destination loaders feels seamless. */
.home-nav-loader {
  position:fixed; inset:0; z-index:99999;
  background:rgba(12,14,22,0.94);
  backdrop-filter:blur(28px) saturate(1.25);
  -webkit-backdrop-filter:blur(28px) saturate(1.25);
  opacity:0; pointer-events:none;
  transition:opacity 0.35s cubic-bezier(.4,0,.2,1);
}
.home-nav-loader.active { opacity:1; pointer-events:auto; transition:none; }
.home-nav-loader-wrap {
  position:absolute; top:50%; left:50%;
  transform:translate(-50%,-50%);
  width:140px; height:140px;
}
.home-nav-loader-glow {
  position:absolute; top:50%; left:50%;
  width:180px; height:180px; margin:-90px 0 0 -90px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(233,196,106,0.4) 0%, rgba(233,196,106,0.1) 45%, transparent 72%);
  animation:hnlPulse 1.8s ease-in-out infinite;
  pointer-events:none;
}
.home-nav-loader-inner {
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
}
.home-nav-loader-icon {
  width:80px; height:80px;
  filter:invert(1) drop-shadow(0 0 14px rgba(233,196,106,0.75)) drop-shadow(0 0 28px rgba(233,196,106,0.35));
  transform-origin:center center;
  will-change:transform;
}
.home-nav-loader-icon.anim-shake     { animation:hnlShake 0.7s cubic-bezier(.36,.07,.19,.97) infinite; }
.home-nav-loader-icon.anim-hop       { animation:hnlHop 0.85s cubic-bezier(.5,0,.5,1) infinite; }
.home-nav-loader-icon.anim-swing     { animation:hnlSwing 1.4s ease-in-out infinite; }
.home-nav-loader-icon.anim-spin      { animation:hnlSpin 1.6s cubic-bezier(.7,0,.3,1) infinite; }
.home-nav-loader-icon.anim-float     { animation:hnlFloat 2.2s ease-in-out infinite; }
.home-nav-loader-icon.anim-knight    { animation:hnlKnight 1.3s cubic-bezier(.5,0,.5,1) infinite; }
.home-nav-loader-icon.anim-tumble    { animation:hnlTumble 1.5s cubic-bezier(.45,.05,.55,.95) infinite; }
.home-nav-loader-icon.anim-heartbeat { animation:hnlHeartbeat 1.1s ease-out infinite; }
.home-nav-loader-icon.anim-wobble    { animation:hnlWobble 1.2s ease-in-out infinite; }
.home-nav-loader-icon.anim-drop      { animation:hnlDrop 1.1s cubic-bezier(.5,.05,.5,.95) infinite; }
@keyframes hnlPulse {
  0%,100% { opacity:0.55; transform:scale(0.9); }
  50%     { opacity:1; transform:scale(1.12); }
}
@keyframes hnlShake {
  0%,100% { transform:translate(0,0) rotate(0deg); }
  15% { transform:translate(-3px,-1px) rotate(-4deg); }
  30% { transform:translate(3px,1px) rotate(4deg); }
  45% { transform:translate(-3px,1px) rotate(-3deg); }
  60% { transform:translate(3px,-1px) rotate(3deg); }
  75% { transform:translate(-1px,0) rotate(-1deg); }
}
@keyframes hnlHop {
  0%,100% { transform:translateY(0) scaleY(1) scaleX(1); }
  20% { transform:translateY(0) scaleY(0.85) scaleX(1.1); }
  50% { transform:translateY(-18px) scaleY(1.1) scaleX(0.92); }
  80% { transform:translateY(0) scaleY(0.9) scaleX(1.08); }
}
@keyframes hnlSwing {
  0%,100% { transform:rotate(0deg); }
  25% { transform:rotate(14deg); }
  75% { transform:rotate(-14deg); }
}
@keyframes hnlSpin {
  0%   { transform:rotate(0deg) scale(1); }
  40%  { transform:rotate(180deg) scale(1.05); }
  100% { transform:rotate(360deg) scale(1); }
}
@keyframes hnlFloat {
  0%,100% { transform:translateY(0) rotate(-2deg); }
  50%     { transform:translateY(-10px) rotate(2deg); }
}
@keyframes hnlKnight {
  0%   { transform:translate(0,0); }
  25%  { transform:translate(0,-14px); }
  50%  { transform:translate(10px,-14px); }
  75%  { transform:translate(10px,0); }
  100% { transform:translate(0,0); }
}
@keyframes hnlTumble {
  0%   { transform:rotate(0deg) translateY(0); }
  25%  { transform:rotate(90deg) translateY(-6px); }
  50%  { transform:rotate(180deg) translateY(0); }
  75%  { transform:rotate(270deg) translateY(-6px); }
  100% { transform:rotate(360deg) translateY(0); }
}
@keyframes hnlHeartbeat {
  0%,50%,100% { transform:scale(1); }
  15% { transform:scale(1.18); }
  30% { transform:scale(0.95); }
}
@keyframes hnlWobble {
  0%,100% { transform:translateX(0) rotate(0deg); }
  15% { transform:translateX(-10px) rotate(-6deg); }
  30% { transform:translateX(8px) rotate(5deg); }
  45% { transform:translateX(-6px) rotate(-4deg); }
  60% { transform:translateX(4px) rotate(3deg); }
  75% { transform:translateX(-2px) rotate(-1deg); }
}
@keyframes hnlDrop {
  0%   { transform:translateY(-20px) scale(1,0.8); opacity:0.6; }
  40%  { transform:translateY(0) scale(1.12,0.88); opacity:1; }
  55%  { transform:translateY(-6px) scale(0.96,1.08); }
  80%  { transform:translateY(0) scale(1.04,0.96); }
  100% { transform:translateY(0) scale(1,1); }
}
.home-nav-loader-icon.anim-nod     { animation: hnlNod 1.8s ease-in-out infinite; }
.home-nav-loader-icon.anim-peek    { animation: hnlPeek 2.4s ease-in-out infinite; }
.home-nav-loader-icon.anim-breathe { animation: hnlBreathe 2.6s ease-in-out infinite; }
.home-nav-loader-icon.anim-wiggle  { animation: hnlWiggle 1.4s ease-in-out infinite; }
.home-nav-loader-icon.anim-tiptoe  { animation: hnlTiptoe 1.6s ease-in-out infinite; }
.home-nav-loader-icon.anim-nuzzle  { animation: hnlNuzzle 2s ease-in-out infinite; }
@keyframes hnlNod {
    0%, 100% { transform: rotate(0) translateY(0); }
    30%      { transform: rotate(3deg) translateY(-3px); }
    60%      { transform: rotate(-2deg) translateY(-1px); }
}
@keyframes hnlPeek {
    0%, 100% { transform: translateX(0) rotate(0); }
    25%      { transform: translateX(5px) rotate(3deg); }
    50%      { transform: translateX(0) rotate(0); }
    75%      { transform: translateX(-5px) rotate(-3deg); }
}
@keyframes hnlBreathe {
    0%, 100% { transform: scale(1) translateY(0); }
    50%      { transform: scale(1.06) translateY(-3px); }
}
@keyframes hnlWiggle {
    0%, 100% { transform: rotate(0); }
    20%      { transform: rotate(5deg); }
    40%      { transform: rotate(-4deg); }
    60%      { transform: rotate(3deg); }
    80%      { transform: rotate(-2deg); }
}
@keyframes hnlTiptoe {
    0%, 100% { transform: translateY(0) scaleY(1); }
    40%      { transform: translateY(-6px) scaleY(1.03); }
    55%      { transform: translateY(-4px) scaleY(1); }
    70%      { transform: translateY(-6px) scaleY(1.02); }
}
@keyframes hnlNuzzle {
    0%, 100% { transform: translate(0,0) rotate(0); }
    20%      { transform: translate(3px,-2px) rotate(4deg); }
    50%      { transform: translate(-2px,-3px) rotate(-3deg); }
    80%      { transform: translate(1px,-1px) rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .home-nav-loader-icon, .home-nav-loader-glow { animation:none !important; }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  /* Lock viewport — kill overscroll/bounce while scroll mechanic still works */
  html, body { overscroll-behavior: none; }

  /* Fix wordmark drifting upward: 100vh includes area behind mobile address bar,
     so top:50% sits above visible center. 100dvh = actual visible viewport. */
  #stickyCanvas { height: 100dvh; }

  /* Wordmark sweep: mask to letter shapes so shine doesn't leak through
     transparent areas. Static in CSS to avoid JS repaint flicker. */
  #wmWrap { -webkit-backface-visibility:hidden; backface-visibility:hidden;
    border-radius:1px;
    -webkit-mask-image: url("/static/chess/assets/icons/wordmark.473e49262de6.png");
    mask-image: url("/static/chess/assets/icons/wordmark.473e49262de6.png");
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center; }

  /* Landing tooltip: equal-width buttons, symmetrical layout */
  .land-card { width:280px; max-width:90vw; }
  .land-btn { flex:1; min-width:0; padding:0.5rem 0.6rem; font-size:0.6rem;
    min-height:44px; display:flex; align-items:center; justify-content:center; text-align:center; }
  .land-login { line-height:1.3; }

  /* Pieces hub: smaller for mobile, no hover glow */
  .pi-wrap { min-width:56px; min-height:56px; width:13vw; height:13vw; }
  .pi-favicon { min-width:70px; min-height:70px; }
  .pi-wrap:hover .pi-img { filter:invert(1) sepia(1) saturate(2) hue-rotate(-10deg) brightness(0.85); }

  /* Active piece: elevate clearly above siblings */
  .pi-wrap.pi-active { z-index: 20 !important; transform: scale(1.15); }

  /* Info panel: position below center on mobile, z-index below pi-active (20) so piece receives taps */
  .pi-info { width:min(240px, 80vw); position:fixed; top:auto; bottom:10vh; left:50% !important; right:auto !important;
    transform:translateX(-50%) translateY(20px) !important; text-align:center; padding:0.8rem 1rem; z-index:15; }
  .pi-info-name { font-size:1.1rem; margin-bottom:0.3rem; }
  .pi-info-desc { font-size:0.75rem; line-height:1.45; margin-bottom:0.7rem; }
  .pi-info-btns { gap:0.5rem; }
  .pi-info.pi-info-show,
  .pi-info.pi-info-show.pi-info-right,
  .pi-info.pi-info-show.pi-info-left { transform:translateX(-50%) translateY(0) !important; }
  .pi-info-btns { justify-content:center; }
  .pi-info-left .pi-info-btns { justify-content:center; }
  .pi-info-back, .pi-info-confirm { min-height:40px; display:flex; align-items:center;
    padding:0.35rem 1rem; font-size:0.65rem; border-radius:6px; }

  /* Auth modal: larger touch targets + 16px to prevent iOS zoom */
  .auth-input { padding:0.75rem 0.9rem; font-size:16px; }
  .auth-btn { padding:0.7rem 2rem; font-size:0.82rem; min-height:44px; }
  .auth-social-btn { padding:0.7rem 1rem; font-size:0.82rem; min-height:44px; }


  /* Nationality carousel: smaller badges */
  .nb { width:60px; gap:6px; }
  .nb .nn { font-size:0.55rem; }

  /* Carousel confirm buttons: equal width, symmetrical */
  #cfmCard { width:240px; max-width:80vw; }
  #cfmCard button { flex:1; min-height:44px; padding:0.7rem 0; font-size:0.7rem; }
}

@media (max-width: 480px) {
  /* Pieces: compact but still readable */
  .pi-wrap { min-width:44px; min-height:44px; width:11vw; height:11vw; }
  .pi-favicon { min-width:60px; min-height:60px; }

  /* Info panel: tighter text */
  .pi-info { width:min(220px, 90vw); bottom:8vh; }
  .pi-info-name { font-size:1.1rem; }
  .pi-info-desc { font-size:0.78rem; margin-bottom:0.8rem; }

  /* Draw section: less scroll needed on small phones */
  #drawSection { height:600vh; }

  /* Auth modal: full width */
  .auth-modal { max-width:95vw; }
  .auth-body { padding:1rem; }
  .auth-head { padding:0.8rem 1rem 0.6rem; }
  .auth-foot { padding:0.5rem 1rem 0.7rem; }
}

@keyframes shake {
  0%,100% { transform: translate(-50%,-50%); }
  15% { transform: translate(-50.12%,-50.06%); }
  45% { transform: translate(-49.9%,-50.1%); }
  75% { transform: translate(-50.1%,-49.92%); }
}

/* === Background effects layer === */
#homeGlow {
  position: fixed; inset: 0; z-index: 498; pointer-events: none;
  opacity: 0; transition: opacity 0.8s ease;
}
#homeGlow .hg-cursor {
  position: absolute;
  width: 180px; height: 180px;
  left: var(--hg-x, 50%); top: var(--hg-y, 50%);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.015) 40%, transparent 70%);
  opacity: 0;
}
#homeDustCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
}

/* === Background aurora streaks — drawn on #homeStreakCanvas === */
#homeStreakCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
