/* Nemoroen Games shared UI (accounts, leaderboard, level grid). Uses the site's theme variables. */
.ng-back {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(16, 19, 28, 0.42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.22s var(--ease);
}
.ng-back.ng-in { opacity: 1; }
.ng-modal {
  position: relative; width: min(440px, 100%); max-height: min(760px, calc(100dvh - 32px)); overflow: auto; overscroll-behavior: contain;
  background: var(--card); color: var(--ink); border: 1.5px solid var(--line); border-radius: 30px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
  transform: translateY(18px) scale(0.96); transition: transform 0.38s var(--spring);
  font-family: var(--sans);
}
.ng-in .ng-modal { transform: none; }
.ng-modal::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 120px; pointer-events: none; border-radius: 30px 30px 0 0;
  background: radial-gradient(120px 80px at 18% 0%, var(--wash-1), transparent 70%), radial-gradient(140px 90px at 85% 10%, var(--wash-2), transparent 70%);
}
.ng-body { position: relative; padding: 26px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.ng-x {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--chip); color: var(--ink); border: 1.5px solid var(--line); cursor: pointer;
}
.ng-x svg { width: 18px; height: 18px; }
.ng-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding-top: 4px; }
.ng-badge {
  width: 58px; height: 58px; border-radius: 20px; display: grid; place-items: center; color: #fff; margin-bottom: 6px;
  background: linear-gradient(135deg, var(--brand), var(--cartoons)); box-shadow: 0 10px 24px rgba(107, 77, 255, 0.32); transform: rotate(-6deg);
}
.ng-badge svg { width: 30px; height: 30px; }
.ng-badge-gold { background: linear-gradient(135deg, #ffb84d, var(--cartoons-2)); box-shadow: 0 10px 24px rgba(255, 122, 61, 0.35); }
.ng-title { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.6rem; letter-spacing: -0.02em; }
.ng-sub { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.4; max-width: 30ch; }
.ng-tabs, .ng-seg { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg-soft); border: 1.5px solid var(--line); }
.ng-tab, .ng-seg-b {
  flex: 1; min-height: 38px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
  font: 800 0.92rem var(--sans); transition: background 0.2s, color 0.2s;
}
.ng-tab[aria-selected="true"], .ng-seg-b[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.ng-form { display: flex; flex-direction: column; gap: 6px; }
.ng-label { font-weight: 800; font-size: 0.88rem; margin-top: 6px; }
.ng-input {
  width: 100%; min-height: 48px; padding: 10px 16px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--bg-soft);
  color: var(--ink); font: 700 1rem var(--sans); outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.ng-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.ng-pw { position: relative; }
.ng-pw .ng-input { padding-right: 52px; }
.ng-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.ng-eye svg { width: 22px; height: 22px; }
.ng-eye.on { color: var(--brand); }
.ng-hint { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.ng-check { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; padding: 10px 12px; border-radius: 16px; background: var(--games-soft); cursor: pointer; }
.ng-check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--games); flex: none; }
.ng-check span { display: flex; flex-direction: column; font-size: 0.9rem; }
.ng-check small { color: var(--muted); font-weight: 700; }
.ng-err { margin: 4px 0 0; min-height: 1.2em; color: var(--cartoons); font-weight: 800; font-size: 0.9rem; }
.ng-err:empty { min-height: 0; margin: 0; }
.ng-primary {
  min-height: 52px; margin-top: 6px; border: 0; border-radius: 999px; cursor: pointer; color: #fff;
  font: 700 1.1rem var(--display); letter-spacing: 0.01em;
  background: linear-gradient(90deg, var(--brand), var(--gaming)); box-shadow: 0 6px 0 var(--brand-deep), 0 14px 26px rgba(107, 77, 255, 0.28);
  transition: transform 0.2s var(--spring), box-shadow 0.2s;
}
[data-theme="dark"] .ng-primary { box-shadow: 0 6px 0 #4a3bb8, 0 14px 26px rgba(0, 0, 0, 0.35); }
.ng-primary:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--brand-deep); }
.ng-primary:disabled { opacity: 0.6; }
.ng-primary.busy { cursor: progress; }
.ng-soft { background: var(--chip); color: var(--ink); border: 1.5px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.ng-danger { background: linear-gradient(90deg, var(--cartoons), var(--cartoons-2)); box-shadow: 0 6px 0 #c23366; }
.ng-link { align-self: center; border: 0; background: none; color: var(--muted); font: 800 0.88rem var(--sans); text-decoration: underline; cursor: pointer; padding: 8px; }
.ng-primary:focus-visible, .ng-tab:focus-visible, .ng-seg-b:focus-visible, .ng-x:focus-visible, .ng-link:focus-visible, .ng-chip:focus-visible, .ng-tile:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.ng-ava {
  --ava: var(--brand); flex: none; width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center;
  background: var(--ava); color: #fff; font: 700 1rem var(--display); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16); transform: rotate(-4deg);
}
.ng-ava-sm { width: 26px; height: 26px; border-radius: 9px; font-size: 0.85rem; }
.ng-ava-xl { width: 72px; height: 72px; border-radius: 24px; font-size: 2.2rem; margin-bottom: 6px; }
.ng-progress-list { display: flex; flex-direction: column; gap: 8px; }
.ng-prow { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 18px; background: var(--bg-soft); border: 1.5px solid var(--line); }
.ng-prow b { font-family: var(--display); font-size: 1.05rem; }
.ng-prow span:not(.ng-stars-pill) { color: var(--muted); font-weight: 700; font-size: 0.9rem; margin-left: auto; }
.ng-stars-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 7px; border-radius: 999px; background: #ffb84d22; color: #e08a00; font-weight: 800; }
[data-theme="dark"] .ng-stars-pill { color: #ffc35c; }
.ng-stars-pill svg { width: 16px; height: 16px; }
.ng-stars-pill i { font-style: normal; }

.ng-lb-controls { display: flex; flex-direction: column; gap: 8px; }
.ng-lb { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.ng-row {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 14px 8px 10px; border-radius: 18px;
  background: var(--bg-soft); border: 1.5px solid transparent;
}
.ng-rank { width: 30px; text-align: center; font: 700 1rem var(--display); color: var(--muted); flex: none; }
.ng-top .ng-rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 0.95rem; }
.ng-top1 .ng-rank { background: linear-gradient(135deg, #ffd24d, #ff9f1a); box-shadow: 0 3px 0 #d47d00; }
.ng-top2 .ng-rank { background: linear-gradient(135deg, #c9d2e6, #8f9bb8); box-shadow: 0 3px 0 #6f7a96; }
.ng-top3 .ng-rank { background: linear-gradient(135deg, #ffb27a, #d9773a); box-shadow: 0 3px 0 #a9541f; }
.ng-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ng-name b { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ng-name small { color: var(--muted); font-weight: 700; font-size: 0.76rem; }
.ng-score { font: 700 1.1rem var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.ng-me { background: var(--brand-soft); border-color: var(--brand); }
.ng-me .ng-name b { color: var(--brand-deep); }
.ng-lb-foot:empty { display: none; }
.ng-lb-foot { position: sticky; bottom: -24px; padding: 8px 0 0; background: linear-gradient(transparent, var(--card) 30%); }
.ng-mine .ng-rank { width: auto; min-width: 30px; font-size: 0.9rem; color: var(--brand-deep); }
.ng-note { margin: 0; text-align: center; color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.ng-empty { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 28px 10px; color: var(--muted); font-weight: 700; text-align: center; }
.ng-empty b { font-family: var(--display); font-size: 1.2rem; color: var(--ink); }
.ng-skel { background: linear-gradient(90deg, var(--bg-soft), var(--line), var(--bg-soft)); background-size: 200% 100%; animation: ng-shimmer 1.1s linear infinite; }
@keyframes ng-shimmer { to { background-position: -200% 0; } }

.ng-toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 1100; transform: translate(-50%, 30px); opacity: 0;
  padding: 12px 20px; border-radius: 999px; background: var(--ink); color: var(--bg); font: 800 0.95rem var(--sans); box-shadow: var(--shadow);
  transition: transform 0.35s var(--spring), opacity 0.25s; pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.ng-toast.show { transform: translate(-50%, 0); opacity: 1; }

.ng-chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 38px; max-width: 170px; padding: 4px 14px 4px 6px; border-radius: 999px;
  background: var(--chip); color: var(--ink); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); cursor: pointer;
  font: 800 0.9rem var(--sans); -webkit-tap-highlight-color: transparent;
}
.ng-chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ng-chip-i { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--cartoons)); }
.ng-chip-i svg { width: 16px; height: 16px; }

/* Level grid */
.ng-world { --wc: var(--brand); margin-bottom: 0.9em; }
.ng-world-h { display: flex; align-items: center; justify-content: space-between; margin: 0 0.2em 0.45em; font: 700 1em var(--display); color: var(--wc); letter-spacing: 0.01em; }
.ng-world-h small { display: inline-flex; align-items: center; gap: 0.25em; color: var(--muted); font: 800 0.8em var(--sans); }
.ng-world-h small svg { width: 1.05em; height: 1.05em; color: #ffb020; }
.ng-world-h small i { font-style: normal; }
.ng-grid { display: grid; grid-template-columns: repeat(var(--per), 1fr); gap: 0.55em; }
.ng-tile {
  position: relative; aspect-ratio: 1 / 1.02; border: 0; border-radius: 1.1em; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15em;
  color: #fff; background: linear-gradient(160deg, color-mix(in srgb, var(--wc) 78%, #fff) 0%, var(--wc) 55%, color-mix(in srgb, var(--wc) 80%, #000) 100%);
  box-shadow: 0 0.3em 0 color-mix(in srgb, var(--wc) 62%, #000), 0 0.6em 1.1em color-mix(in srgb, var(--wc) 30%, transparent);
  transition: transform 0.25s var(--spring);
  -webkit-tap-highlight-color: transparent;
}
.ng-tile::after { content: ""; position: absolute; inset: 0.25em 0.45em auto; height: 32%; border-radius: 0.9em 0.9em 1.4em 1.4em; background: linear-gradient(rgba(255,255,255,0.38), rgba(255,255,255,0)); pointer-events: none; }
.ng-tile:not(.locked):hover { transform: translateY(-0.15em) rotate(-2deg); }
.ng-tile:not(.locked):active { transform: translateY(0.2em); box-shadow: 0 0.1em 0 color-mix(in srgb, var(--wc) 62%, #000); }
.ng-tile-n { font: 700 1.75em/1 var(--display); text-shadow: 0 0.08em 0 rgba(0, 0, 0, 0.22); }
.ng-tile-stars { display: flex; gap: 0.06em; }
.ng-tile-stars i { display: block; width: 0.95em; height: 0.95em; color: rgba(0, 0, 0, 0.22); }
.ng-tile-stars i.on { color: #ffd84d; filter: drop-shadow(0 0.05em 0 rgba(0, 0, 0, 0.25)); }
.ng-tile-stars svg { width: 100%; height: 100%; display: block; }
.ng-tile.locked { cursor: not-allowed; background: var(--bg-soft); color: var(--muted); box-shadow: inset 0 0 0 0.12em var(--line); }
.ng-tile.locked::after { display: none; }
.ng-tile-ln { font: 700 0.78em/1 var(--display); opacity: 0.7; }
.ng-tile-lock svg { width: 1.45em; height: 1.45em; display: block; opacity: 0.75; }
.ng-tile.current { animation: ng-pulse 1.6s ease-in-out infinite; }
.ng-tile.current::before {
  content: "PLAY"; position: absolute; top: -0.55em; left: 50%; transform: translateX(-50%); z-index: 2;
  padding: 0.1em 0.5em; border-radius: 999px; background: var(--ink); color: var(--bg); font: 800 0.62em var(--sans); letter-spacing: 0.06em;
}
@keyframes ng-pulse { 50% { transform: scale(1.06) rotate(-2deg); } }
@media (prefers-reduced-motion: reduce) { .ng-tile.current { animation: none; } .ng-modal, .ng-toast { transition: none; } }
@media (max-width: 520px) {
  .ng-back { align-items: flex-end; padding: 0; }
  .ng-modal { width: 100%; max-height: calc(100dvh - 40px); border-radius: 30px 30px 0 0; padding-bottom: env(safe-area-inset-bottom); transform: translateY(40px); }
  .ng-body { padding: 24px 18px 22px; }
}

.ng-warn { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 12px 14px; border-radius: 18px;
  background: color-mix(in srgb, #ffb84d 18%, var(--card)); border: 1.5px solid color-mix(in srgb, #ffb84d 55%, transparent); }
.ng-warn-i { flex: none; width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #ffc24d, var(--cartoons-2)); transform: rotate(-6deg); }
.ng-warn-i svg { width: 20px; height: 20px; }
.ng-warn span:last-child { display: flex; flex-direction: column; gap: 2px; }
.ng-warn b { font-family: var(--display); font-size: 1.02rem; }
.ng-warn small { color: var(--muted); font-weight: 700; font-size: 0.84rem; line-height: 1.4; }
.ng-hint-c { text-align: center; margin-top: 4px; }
