:root {
  --pn-bg: #141714;
  --pn-bg-soft: #191d19;
  --pn-sidebar: #20251f;
  --pn-surface: #262c25;
  --pn-surface-2: #2d342b;
  --pn-surface-3: #343c31;
  --pn-border: rgba(232, 227, 199, 0.11);
  --pn-border-strong: rgba(232, 227, 199, 0.2);
  --pn-text: #f1edd8;
  --pn-muted: #aaa99d;
  --pn-muted-2: #777b72;
  --pn-green: #8bd05f;
  --pn-green-strong: #75bd49;
  --pn-green-dark: #3d652d;
  --pn-amber: #e0a14a;
  --pn-red: #e4665a;
  --pn-blue: #67b9d2;
  --pn-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  --pn-radius: 14px;
  --pn-radius-sm: 9px;
  --pn-font-ui: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pn-font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-width: 280px;
  min-height: 100%;
  color: var(--pn-text);
  background: var(--pn-bg);
  font-family: var(--pn-font-ui);
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 72% 0%, rgba(117, 189, 73, 0.08), transparent 28rem),
    var(--pn-bg);
}

button,
input,
select { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; }

.pn-app {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100dvh;
}

.pn-sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 22px 16px 18px;
  background: var(--pn-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.035);
  box-shadow: 12px 0 34px rgba(0, 0, 0, 0.12);
}

.pn-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 3px 9px 26px;
  text-decoration: none;
}

.pn-brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 2px solid var(--pn-green);
  border-radius: 9px;
  box-shadow: inset 0 0 0 4px rgba(139, 208, 95, 0.1);
}

.pn-brand-mark::before,
.pn-brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.pn-brand-mark::before {
  inset: 7px;
  border: 2px solid var(--pn-green);
}

.pn-brand-mark::after {
  width: 5px;
  height: 5px;
  left: 50%;
  top: 50%;
  background: var(--pn-text);
  transform: translate(-50%, -50%);
}

.pn-brand-text {
  font-family: var(--pn-font-mono);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.pn-brand-text span { color: var(--pn-green); }

.pn-nav {
  display: grid;
  gap: 7px;
}

.pn-nav-link {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  min-height: 49px;
  padding: 0 12px 0 8px;
  color: var(--pn-muted);
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.pn-nav-link:hover {
  color: var(--pn-text);
  background: rgba(255, 255, 255, 0.045);
}

.pn-nav-link[aria-current="page"] {
  color: var(--pn-text);
  background: var(--pn-surface-3);
  box-shadow: inset 3px 0 var(--pn-green);
}

.pn-nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--pn-green);
  font-family: var(--pn-font-mono);
  font-size: 17px;
  font-weight: 800;
}

.pn-nav-badge {
  min-width: 20px;
  padding: 3px 6px;
  color: #151815;
  background: var(--pn-amber);
  border-radius: 999px;
  font-family: var(--pn-font-mono);
  font-size: 10px;
  line-height: 1;
  text-align: center;
}

.pn-player-card {
  margin-top: auto;
  padding: 12px;
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid var(--pn-border);
  border-radius: 11px;
}

.pn-player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pn-player-name {
  overflow: hidden;
  font-family: var(--pn-font-mono);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pn-level {
  color: var(--pn-green);
  font-family: var(--pn-font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.pn-xp-track {
  height: 4px;
  margin-top: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
}

.pn-xp-fill {
  display: block;
  width: 68%;
  height: 100%;
  background: var(--pn-green);
  border-radius: inherit;
}

/* Zero-shift boot --------------------------------------------------------
   The cached auth state is known before first paint. Reserve the matching
   panel until Supabase has verified the session instead of painting Guest
   first and replacing the complete layout a moment later. */
html.pn-auth-pending.pn-auth-likely body.pn-duel-integrated #duel-auth,
html.pn-auth-pending.pn-auth-likely body.pn-profile-integrated #profile-login,
html.pn-auth-pending.pn-auth-likely.pn-auth-handle body.pn-profile-integrated #profile-setup,
html.pn-auth-pending.pn-auth-likely:not(.pn-auth-handle) body.pn-profile-integrated #profile-content {
  display: none !important;
}

html.pn-auth-pending.pn-auth-likely body.pn-duel-integrated #duel-app,
html.pn-auth-pending.pn-auth-likely.pn-auth-handle body.pn-profile-integrated #profile-content,
html.pn-auth-pending.pn-auth-likely:not(.pn-auth-handle) body.pn-profile-integrated #profile-setup,
html.pn-auth-pending.pn-auth-guest body.pn-profile-integrated #profile-login {
  display: block !important;
}

html.pn-auth-pending body.pn-profile-integrated [data-profile-shell] {
  visibility: visible !important;
}

.pn-player-card,
.pn-account-card,
.pn-account-pill,
.nearo-lobby-account {
  font-variant-numeric: tabular-nums;
}

.pn-player-card {
  min-height: 66px;
}

.pn-player-name { min-width: 0; }

.pn-zero-shift .pn-player-name,
.pn-zero-shift .pn-level,
.pn-zero-shift [data-shell-player-xp] {
  transition: color 120ms ease, width 180ms ease, opacity 120ms ease;
}

.pn-skeleton-row {
  pointer-events: none;
}

.pn-skeleton-row > * {
  color: transparent !important;
  background: rgba(255, 255, 255, 0.055);
  border-radius: 4px;
}

.pn-main {
  min-width: 0;
  min-height: 100dvh;
  padding: clamp(20px, 3vw, 38px);
}

.pn-page {
  width: min(1240px, 100%);
  margin: 0 auto;
}

.pn-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 46px;
  margin-bottom: 24px;
}

.pn-eyebrow {
  margin: 0 0 6px;
  color: var(--pn-green);
  font-family: var(--pn-font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pn-title {
  margin: 0;
  font-family: var(--pn-font-mono);
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.pn-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--pn-muted);
  background: var(--pn-surface);
  border: 1px solid var(--pn-border);
  border-radius: 999px;
  font-family: var(--pn-font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.pn-status-dot {
  width: 7px;
  height: 7px;
  background: var(--pn-green);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(139, 208, 95, 0.55);
}

.pn-lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 18px;
}

.pn-card {
  min-width: 0;
  background: var(--pn-surface);
  border: 1px solid var(--pn-border);
  border-radius: var(--pn-radius);
  box-shadow: var(--pn-shadow);
}

.pn-daily-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.75fr);
  min-height: 340px;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(139, 208, 95, 0.16), transparent 48%),
    var(--pn-surface);
}

.pn-daily-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 4vw, 52px);
}

.pn-live-label {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  margin-bottom: 22px;
  color: var(--pn-green);
  font-family: var(--pn-font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pn-daily-copy h2 {
  max-width: 560px;
  margin: 0;
  font-family: var(--pn-font-mono);
  font-size: clamp(32px, 4.2vw, 58px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.pn-daily-copy p {
  max-width: 500px;
  margin: 18px 0 26px;
  color: var(--pn-muted);
  font-size: 15px;
  line-height: 1.55;
}

.pn-primary-btn,
.pn-secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 9px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.pn-primary-btn {
  color: #172014;
  background: var(--pn-green);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 0 #517e38, 0 14px 30px rgba(75, 121, 49, 0.2);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.pn-primary-btn:hover { background: #98dc6e; }

.pn-primary-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #517e38;
}

.pn-secondary-btn {
  color: var(--pn-text);
  background: transparent;
  border: 1px solid var(--pn-border-strong);
}

.pn-hero-action { align-self: flex-start; }

.pn-map-art {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 55% 45%, rgba(139, 208, 95, 0.18), transparent 13rem),
    repeating-radial-gradient(ellipse at 65% 48%, transparent 0 19px, rgba(241, 237, 216, 0.055) 20px 21px),
    linear-gradient(150deg, #2f382d, #20251f);
}

.pn-map-art::before {
  content: "";
  position: absolute;
  width: 142px;
  height: 242px;
  left: 50%;
  top: 50%;
  background: rgba(241, 237, 216, 0.88);
  clip-path: polygon(45% 0, 62% 8%, 65% 23%, 82% 34%, 74% 49%, 96% 65%, 79% 81%, 60% 78%, 51% 100%, 31% 87%, 11% 91%, 18% 65%, 3% 48%, 22% 32%, 20% 15%);
  transform: translate(-50%, -50%) rotate(-5deg);
  filter: drop-shadow(0 0 2px var(--pn-green)) drop-shadow(0 0 20px rgba(139, 208, 95, 0.25));
}

.pn-map-art::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 57%;
  top: 58%;
  background: var(--pn-green);
  border: 4px solid #172014;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(139, 208, 95, 0.28), 0 0 26px rgba(139, 208, 95, 0.6);
}

.pn-side-stack {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
}

.pn-streak-card,
.pn-leader-card { padding: 20px; }

.pn-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.pn-card-heading h3 {
  margin: 0;
  font-family: var(--pn-font-mono);
  font-size: 14px;
  letter-spacing: -0.02em;
}

.pn-card-link {
  color: var(--pn-green);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.pn-week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.pn-day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  color: var(--pn-muted-2);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 7px;
  font-family: var(--pn-font-mono);
  font-size: 10px;
}

.pn-day.is-done {
  color: #182016;
  background: var(--pn-green);
}

.pn-day.is-today {
  color: var(--pn-text);
  outline: 1px solid var(--pn-green);
  outline-offset: -1px;
}

.pn-rank-list {
  display: grid;
  gap: 4px;
}

.pn-rank-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 46px;
  padding: 0 8px;
  border-radius: 8px;
}

.pn-rank-row:hover { background: rgba(255, 255, 255, 0.035); }

.pn-rank-number {
  color: var(--pn-muted-2);
  font-family: var(--pn-font-mono);
  font-size: 11px;
}

.pn-rank-player {
  min-width: 0;
  font-family: var(--pn-font-mono);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pn-rank-player small {
  margin-left: 6px;
  color: var(--pn-green);
  font-size: 9px;
}

.pn-rank-score {
  color: var(--pn-text);
  font-family: var(--pn-font-mono);
  font-size: 11px;
  font-weight: 800;
}

.pn-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.pn-mode-card {
  position: relative;
  min-height: 142px;
  padding: 20px;
  overflow: hidden;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.pn-mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 208, 95, 0.34);
  background: var(--pn-surface-2);
}

.pn-mode-card.is-duel:hover { border-color: rgba(224, 161, 74, 0.45); }

.pn-mode-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  color: var(--pn-green);
  background: rgba(139, 208, 95, 0.1);
  border-radius: 10px;
  font-family: var(--pn-font-mono);
  font-size: 18px;
  font-weight: 900;
}

.pn-mode-card.is-duel .pn-mode-icon {
  color: var(--pn-amber);
  background: rgba(224, 161, 74, 0.1);
}

.pn-mode-card h3 {
  margin: 0 0 7px;
  font-family: var(--pn-font-mono);
  font-size: 17px;
}

.pn-mode-card p {
  margin: 0;
  color: var(--pn-muted);
  font-size: 12px;
  line-height: 1.45;
}

.pn-mode-meta {
  position: absolute;
  right: 16px;
  top: 16px;
  color: var(--pn-muted-2);
  font-family: var(--pn-font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

/* Practice */
.pn-game-main {
  height: 100dvh;
  padding: 18px;
  overflow: hidden;
}

.pn-game-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1440px, 100%);
  height: 100%;
  margin: 0 auto;
}

.pn-game-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 62px;
  padding: 0 4px 14px;
}

.pn-target-label {
  display: block;
  margin-bottom: 3px;
  color: var(--pn-muted-2);
  font-family: var(--pn-font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.pn-target-city {
  margin: 0;
  font-family: var(--pn-font-mono);
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.pn-game-status {
  display: flex;
  align-items: center;
  gap: 9px;
}

.pn-game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 0;
  gap: 14px;
}

.pn-map-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #dfe4de;
  border: 1px solid var(--pn-border-strong);
  border-radius: var(--pn-radius);
  box-shadow: var(--pn-shadow);
}

#pn-map {
  position: absolute;
  inset: 0;
  background: #dfe4de;
}

.pn-map-shell .leaflet-control-attribution {
  margin: 7px 7px 0 0;
  padding: 3px 6px;
  color: rgba(31, 38, 30, 0.62);
  background: rgba(247, 248, 244, 0.78);
  border-radius: 5px;
  font-family: var(--pn-font-mono);
  font-size: 7px;
  line-height: 1;
  white-space: nowrap;
  backdrop-filter: blur(5px);
}

.pn-map-shell .leaflet-control-attribution a { color: inherit; }

.pn-map-hud {
  position: absolute;
  z-index: 500;
  left: 14px;
  top: 14px;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.pn-map-chip {
  min-height: 34px;
  padding: 9px 12px;
  color: var(--pn-text);
  background: rgba(20, 23, 20, 0.88);
  border: 1px solid rgba(241, 237, 216, 0.16);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
  font-family: var(--pn-font-mono);
  font-size: 10px;
}

.pn-result-chip {
  position: absolute;
  z-index: 520;
  left: 50%;
  bottom: 16px;
  display: none;
  align-items: baseline;
  gap: 9px;
  padding: 10px 14px;
  color: var(--pn-text);
  background: rgba(20, 23, 20, 0.92);
  border: 1px solid rgba(139, 208, 95, 0.4);
  border-radius: 9px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
  font-family: var(--pn-font-mono);
}

.pn-result-chip.is-visible { display: flex; }
.pn-result-score { color: var(--pn-green); font-size: 18px; font-weight: 900; }
.pn-result-distance { color: var(--pn-muted); font-size: 10px; }

.pn-game-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--pn-surface);
  border: 1px solid var(--pn-border);
  border-radius: var(--pn-radius);
}

.pn-panel-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px;
  border-bottom: 1px solid var(--pn-border);
}

.pn-panel-tab {
  min-height: 34px;
  padding: 0 6px;
  color: var(--pn-muted-2);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-family: var(--pn-font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.pn-panel-tab[aria-selected="true"] {
  color: var(--pn-text);
  background: var(--pn-surface-3);
}

.pn-panel-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 20px;
}

.pn-coach-orb {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #172014;
  background: var(--pn-green);
  border-radius: 12px;
  font-family: var(--pn-font-mono);
  font-weight: 900;
  box-shadow: 0 0 0 7px rgba(139, 208, 95, 0.08);
}

.pn-panel-body h2 {
  margin: 20px 0 8px;
  font-family: var(--pn-font-mono);
  font-size: 20px;
}

.pn-panel-body p {
  margin: 0;
  color: var(--pn-muted);
  font-size: 13px;
  line-height: 1.55;
}

.pn-coach-note {
  margin-top: 18px;
  padding: 13px;
  color: var(--pn-muted);
  background: rgba(0, 0, 0, 0.12);
  border-left: 3px solid var(--pn-green);
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  line-height: 1.45;
}

.pn-game-actions {
  display: grid;
  gap: 9px;
  margin-top: auto;
  padding-top: 20px;
}

.pn-game-actions button { width: 100%; }

.pn-map-action-dock { display: none; }

.pn-inline-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.pn-mini-stat {
  padding: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--pn-border);
  border-radius: 8px;
}

.pn-mini-stat span {
  display: block;
  color: var(--pn-muted-2);
  font-family: var(--pn-font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pn-mini-stat strong {
  display: block;
  margin-top: 5px;
  font-family: var(--pn-font-mono);
  font-size: 15px;
}

.pn-daily-ranks { margin-top: 10px; }

.pn-daily-ranks .pn-rank-row {
  min-height: 47px;
  border-bottom: 1px solid var(--pn-border);
}

.pn-daily-run-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 12px;
  background: rgba(139, 208, 95, 0.07);
  border: 1px solid rgba(139, 208, 95, 0.14);
  border-radius: 8px;
  font-family: var(--pn-font-mono);
}

.pn-daily-run-status span { color: var(--pn-muted-2); font-size: 8px; letter-spacing: 0.08em; }
.pn-daily-run-status strong { font-size: 10px; }

/* Duel and profile */
.pn-section-main { padding-block: 28px; }

.pn-section-page {
  display: flex;
  flex-direction: column;
}

.pn-eyebrow-amber { color: var(--pn-amber); }

.pn-amber-btn,
.pn-quiet-btn {
  min-height: 44px;
  padding: 0 17px;
  border-radius: 9px;
  font-family: var(--pn-font-mono);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.pn-amber-btn {
  color: #241a0e;
  background: var(--pn-amber);
  border: 1px solid rgba(255, 224, 176, 0.22);
  box-shadow: 0 5px 0 #946326;
}

.pn-quiet-btn {
  color: var(--pn-muted);
  background: transparent;
  border: 1px solid var(--pn-border-strong);
}

.pn-duel-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 112px;
  padding: 18px 20px;
  color: var(--pn-text);
  background: linear-gradient(110deg, rgba(224, 161, 74, 0.18), rgba(224, 161, 74, 0.055));
  border: 1px solid rgba(224, 161, 74, 0.34);
  border-radius: var(--pn-radius);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18);
}

.pn-duel-cross {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  color: var(--pn-amber);
  background: rgba(224, 161, 74, 0.11);
  border: 1px solid rgba(224, 161, 74, 0.25);
  border-radius: 12px;
  font-family: var(--pn-font-mono);
  font-size: 28px;
  font-weight: 900;
  transform: rotate(45deg);
}

.pn-duel-kicker {
  color: var(--pn-amber);
  font-family: var(--pn-font-mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.pn-duel-alert h2,
.pn-duel-list-card h2,
.pn-create-duel h2,
.pn-mastery-card h2,
.pn-trophy-card h2,
.pn-weak-cities h2 {
  margin: 5px 0 0;
  font-family: var(--pn-font-mono);
  font-size: 19px;
}

.pn-duel-alert p { margin: 7px 0 0; color: var(--pn-muted); font-size: 12px; }
.pn-duel-alert-actions { display: flex; gap: 8px; }

.pn-duel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(270px, 0.7fr);
  gap: 14px;
  min-height: 0;
  margin-top: 14px;
}

.pn-duel-list-card,
.pn-create-duel,
.pn-mastery-card,
.pn-trophy-card,
.pn-weak-cities { padding: 19px; }

.pn-duel-list { margin-top: 10px; }

.pn-duel-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 61px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--pn-border);
}

.pn-duel-row.is-action { color: var(--pn-text); }
.pn-duel-row.is-complete { opacity: 0.7; }

.pn-duel-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--pn-amber);
  background: rgba(224, 161, 74, 0.09);
  border: 1px solid rgba(224, 161, 74, 0.17);
  border-radius: 9px;
  font-family: var(--pn-font-mono);
  font-size: 9px;
  font-weight: 900;
}

.pn-duel-row h3 { margin: 0; font-family: var(--pn-font-mono); font-size: 12px; }
.pn-duel-row p { margin: 5px 0 0; color: var(--pn-muted-2); font-size: 10px; }
.pn-duel-row > strong { color: var(--pn-amber); font-family: var(--pn-font-mono); font-size: 10px; }

.pn-list-footer {
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  color: var(--pn-muted);
  background: transparent;
  border: 0;
  font-family: var(--pn-font-mono);
  font-size: 9px;
  text-align: left;
  cursor: pointer;
}

.pn-list-footer span { float: right; color: var(--pn-muted-2); }
.pn-create-duel > p { margin: 9px 0 18px; color: var(--pn-muted); font-size: 11px; line-height: 1.45; }
.pn-field-label { display: block; margin-bottom: 7px; color: var(--pn-muted-2); font-family: var(--pn-font-mono); font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase; }

.pn-search-field { display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 46px; padding: 0 12px; background: rgba(0, 0, 0, 0.13); border: 1px solid var(--pn-border-strong); border-radius: 9px; }
.pn-search-field input { min-width: 0; color: var(--pn-text); background: transparent; border: 0; outline: 0; font-family: var(--pn-font-mono); font-size: 12px; }
.pn-search-field span { color: var(--pn-amber); font-family: var(--pn-font-mono); }

.pn-create-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 10px; }
.pn-create-options button { min-height: 58px; padding: 8px; color: var(--pn-muted); background: rgba(255, 255, 255, 0.025); border: 1px solid var(--pn-border); border-radius: 8px; cursor: pointer; }
.pn-create-options span { display: block; color: var(--pn-muted-2); font-family: var(--pn-font-mono); font-size: 7px; text-transform: uppercase; }
.pn-create-options strong { display: block; margin-top: 6px; color: var(--pn-text); font-family: var(--pn-font-mono); font-size: 10px; }
.pn-create-submit { width: 100%; margin-top: 12px; }

.pn-profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.pn-profile-identity { display: flex; align-items: center; gap: 15px; }
.pn-profile-mark { display: grid; place-items: center; width: 58px; height: 58px; color: #172014; background: var(--pn-green); border-radius: 14px; font-family: var(--pn-font-mono); font-size: 16px; font-weight: 900; box-shadow: 0 0 0 7px rgba(139, 208, 95, 0.08); }
.pn-profile-identity h1 { margin: 3px 0 2px; font-family: var(--pn-font-mono); font-size: 28px; }
.pn-profile-identity > div > span { color: var(--pn-muted-2); font-size: 10px; }

.pn-level-hero {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  align-items: center;
  gap: 28px;
  min-height: 128px;
  padding: 20px 23px;
  background: linear-gradient(105deg, rgba(139, 208, 95, 0.12), var(--pn-surface) 46%);
}

.pn-level-hero > div:first-child { display: flex; align-items: center; gap: 13px; }
.pn-level-big { color: var(--pn-green); font-family: var(--pn-font-mono); font-size: 48px; font-weight: 900; line-height: 1; }
.pn-level-hero h2 { margin: 5px 0 0; font-family: var(--pn-font-mono); font-size: 17px; }
.pn-level-progress > div:first-child { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--pn-muted); font-family: var(--pn-font-mono); font-size: 8px; }
.pn-level-progress strong { color: var(--pn-green); }
.pn-xp-track-large { height: 8px; }
.pn-profile-kpis { display: flex; gap: 23px; }
.pn-profile-kpis div { min-width: 54px; }
.pn-profile-kpis strong { display: block; font-family: var(--pn-font-mono); font-size: 17px; }
.pn-profile-kpis span { display: block; margin-top: 4px; color: var(--pn-muted-2); font-size: 8px; text-transform: uppercase; }

.pn-profile-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.7fr); gap: 14px; margin-top: 14px; }
.pn-mastery-list { display: grid; gap: 11px; margin-top: 16px; }
.pn-mastery-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) 30px; align-items: center; gap: 10px; font-family: var(--pn-font-mono); font-size: 9px; }
.pn-mastery-row > div { height: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.06); border-radius: 999px; }
.pn-mastery-row i { display: block; height: 100%; background: var(--pn-green); border-radius: inherit; }
.pn-mastery-row strong { color: var(--pn-muted); text-align: right; }
.pn-mastery-row.is-weak { color: var(--pn-amber); }
.pn-mastery-row.is-weak i { background: var(--pn-amber); }

.pn-trophy-feature { display: flex; align-items: center; gap: 13px; margin-top: 16px; padding: 12px; background: rgba(224, 161, 74, 0.07); border: 1px solid rgba(224, 161, 74, 0.13); border-radius: 9px; }
.pn-trophy-symbol { display: grid; place-items: center; width: 38px; height: 45px; color: #2b200f; background: var(--pn-amber); clip-path: polygon(15% 0,85% 0,100% 72%,50% 100%,0 72%); font-family: var(--pn-font-mono); font-weight: 900; }
.pn-trophy-feature strong { font-family: var(--pn-font-mono); font-size: 10px; }
.pn-trophy-feature p { margin: 4px 0 0; color: var(--pn-muted-2); font-size: 9px; }
.pn-trophy-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 11px; }
.pn-trophy-counts div { padding: 9px; text-align: center; background: rgba(255, 255, 255, 0.02); border-radius: 8px; }
.pn-trophy-counts span { display: block; width: 9px; height: 9px; margin: 0 auto 5px; border-radius: 50%; }
.pn-trophy-counts .is-gold { background: #d6af52; }.pn-trophy-counts .is-silver { background: #aeb3b3; }.pn-trophy-counts .is-bronze { background: #a56e45; }
.pn-trophy-counts strong { display: block; font-family: var(--pn-font-mono); font-size: 12px; }
.pn-trophy-counts small { color: var(--pn-muted-2); font-size: 7px; text-transform: uppercase; }

.pn-weak-cities { margin-top: 14px; }
.pn-city-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 13px; }
.pn-city-strip a { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px; min-height: 48px; padding: 8px 11px; color: inherit; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--pn-border); border-radius: 8px; text-decoration: none; }
.pn-city-strip span { color: var(--pn-amber); font-family: var(--pn-font-mono); font-size: 8px; }
.pn-city-strip strong { font-family: var(--pn-font-mono); font-size: 10px; }
.pn-city-strip small { color: var(--pn-muted-2); font-family: var(--pn-font-mono); font-size: 8px; }

.pn-mobile-nav { display: none; }

@media (max-width: 1040px) {
  .pn-app { grid-template-columns: 78px minmax(0, 1fr); }
  .pn-sidebar { padding-inline: 10px; }
  .pn-brand { justify-content: center; padding-inline: 0; }
  .pn-brand-text,
  .pn-nav-label,
  .pn-nav-badge,
  .pn-player-card { display: none; }
  .pn-nav-link { display: grid; grid-template-columns: 1fr; padding: 0; }
  .pn-nav-icon { margin: auto; }
  .pn-game-layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .pn-duel-grid { grid-template-columns: minmax(0, 1.2fr) 280px; }
  .pn-profile-grid { grid-template-columns: minmax(0, 1.2fr) 280px; }
  .pn-level-hero { gap: 17px; }
  .pn-profile-kpis { gap: 12px; }
}

/* Touch tablets use the game-first mobile layout too: no side rail competes with the map. */
@media (max-width: 760px), (hover: none) and (pointer: coarse) and (max-width: 1180px) {
  body { padding-bottom: 64px; }
  .pn-app { display: block; min-height: calc(100dvh - 64px); }
  .pn-sidebar { display: none; }
  .pn-main { min-height: auto; padding: 18px 14px 24px; }
  .pn-page { display: flex; flex-direction: column; }
  .pn-topbar { margin-bottom: 16px; }
  .pn-title { font-size: 27px; }
  .pn-status-pill { min-height: 30px; padding-inline: 9px; font-size: 9px; }
  .pn-lobby-grid { display: contents; }
  .pn-daily-hero { display: block; order: 2; min-height: 286px; }
  .pn-daily-copy { min-height: 286px; padding: 24px 20px; }
  .pn-daily-copy h2 { max-width: 270px; font-size: 34px; }
  .pn-daily-copy p { max-width: 270px; margin-block: 13px 21px; font-size: 13px; }
  .pn-map-art {
    position: absolute;
    inset: 0 0 0 54%;
    min-height: 0;
    opacity: 0.64;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 55%);
    mask-image: linear-gradient(90deg, transparent, #000 55%);
  }
  .pn-map-art::before { width: 96px; height: 178px; }
  .pn-side-stack { order: 4; grid-template-columns: 1fr; margin-top: 14px; }
  .pn-streak-card { display: none; }
  .pn-leader-card { padding: 17px; box-shadow: none; }
  .pn-mode-grid { order: 3; grid-template-columns: 1fr; gap: 9px; margin-top: 14px; }
  .pn-mode-card { min-height: 84px; padding: 13px 16px 13px 64px; box-shadow: none; }
  .pn-mode-icon { position: absolute; left: 15px; top: 50%; margin: 0; transform: translateY(-50%); }
  .pn-mode-card h3 { font-size: 15px; }
  .pn-mode-card p { max-width: 240px; font-size: 11px; }
  .pn-mode-meta { top: 12px; }
  .pn-mobile-nav {
    position: fixed;
    z-index: 1000;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 54px;
    padding: 5px;
    background: rgba(32, 37, 31, 0.95);
    border: 1px solid var(--pn-border-strong);
    border-radius: 13px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px);
  }
  .pn-mobile-link {
    display: grid;
    place-items: center;
    color: var(--pn-muted-2);
    border-radius: 9px;
    font-family: var(--pn-font-mono);
    font-size: 15px;
    font-weight: 900;
    text-decoration: none;
  }
  .pn-mobile-link[aria-current="page"] { color: var(--pn-green); background: rgba(139, 208, 95, 0.09); }

  .pn-game-main { height: calc(100dvh - 64px); padding: 8px; }
  .pn-game-page { grid-template-rows: auto minmax(0, 1fr); }
  .pn-game-topbar { min-height: 64px; padding: 2px 4px 9px; }
  .pn-target-city { max-width: 210px; overflow: hidden; font-size: 23px; text-overflow: ellipsis; white-space: nowrap; }
  .pn-game-status .pn-status-pill:first-child { display: none; }
  .pn-game-layout { display: block; position: relative; min-height: 0; }
  .pn-map-shell { position: absolute; inset: 0; border-radius: 12px; }
  .pn-game-panel {
    position: absolute;
    z-index: 700;
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-height: min(230px, 42%);
    background: rgba(38, 44, 37, 0.96);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(12px);
    transform: translateY(calc(100% - 48px));
    transition: transform 180ms ease;
  }
  .pn-game-panel.is-open { transform: translateY(0); }
  .pn-panel-tabs { height: 48px; }
  .pn-panel-body { overflow: auto; padding: 14px; }
  .pn-panel-body h2 { margin: 10px 0 6px; font-size: 16px; }
  .pn-panel-body p { font-size: 11px; }
  .pn-coach-orb { display: none; }
  .pn-coach-note { margin-top: 10px; padding: 9px; font-size: 10px; }
  .pn-inline-stats { display: none; }
  .pn-game-actions { grid-template-columns: 1fr 1fr; padding-top: 12px; }
  .pn-game-actions .pn-primary-btn,
  .pn-game-actions .pn-secondary-btn { min-height: 42px; padding-inline: 10px; font-size: 12px; }
  .pn-map-hud { left: 9px; top: 9px; }
  .pn-map-chip { min-height: 29px; padding: 7px 9px; font-size: 8px; }
  .pn-map-action-dock {
    position: absolute;
    z-index: 690;
    left: 8px;
    right: 8px;
    bottom: 60px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    pointer-events: none;
  }
  .pn-map-action-dock button {
    min-height: 42px;
    padding: 8px 12px;
    pointer-events: auto;
    box-shadow: 0 9px 28px rgba(0, 0, 0, 0.32);
  }
  .pn-map-action-dock .pn-secondary-btn {
    color: var(--pn-text);
    background: rgba(20, 23, 20, 0.9);
    border-color: rgba(241, 237, 216, 0.2);
  }
  .pn-game-actions { display: none; }
  .pn-result-chip { bottom: 112px; padding: 8px 10px; }
  .pn-result-score { font-size: 15px; }
  .pn-map-shell .leaflet-control-attribution { margin: 5px 5px 0 0; font-size: 6px; }

  .pn-section-main { padding-top: 18px; }
  .pn-section-page { display: block; }
  .pn-section-main .pn-topbar { align-items: flex-end; }
  .pn-section-main .pn-topbar .pn-title { font-size: 30px; }
  .pn-section-main .pn-topbar > button { min-height: 39px; padding-inline: 12px; font-size: 9px; }
  .pn-duel-alert { grid-template-columns: 42px minmax(0, 1fr); gap: 12px; padding: 15px; }
  .pn-duel-cross { width: 40px; height: 40px; font-size: 22px; }
  .pn-duel-alert h2 { font-size: 15px; }
  .pn-duel-alert p { font-size: 10px; line-height: 1.4; }
  .pn-duel-alert-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; }
  .pn-duel-alert-actions button { min-height: 39px; }
  .pn-duel-grid { display: block; }
  .pn-create-duel { margin-top: 12px; }
  .pn-duel-list-card,
  .pn-create-duel,
  .pn-mastery-card,
  .pn-trophy-card,
  .pn-weak-cities { padding: 15px; box-shadow: none; }
  .pn-duel-row { min-height: 56px; }

  .pn-profile-head { margin-bottom: 14px; }
  .pn-profile-mark { width: 48px; height: 48px; border-radius: 12px; }
  .pn-profile-identity h1 { font-size: 21px; }
  .pn-level-hero { display: block; padding: 17px; box-shadow: none; }
  .pn-level-big { font-size: 38px; }
  .pn-level-progress { margin-top: 17px; }
  .pn-profile-kpis { justify-content: space-between; margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--pn-border); }
  .pn-profile-grid { display: block; }
  .pn-trophy-card { margin-top: 12px; }
  .pn-city-strip { grid-template-columns: 1fr; }
}

@media (min-width: 761px) and (max-height: 800px) {
  .pn-main { padding-block: 22px; }
  .pn-topbar { margin-bottom: 16px; }
  .pn-mode-grid { gap: 12px; margin-top: 14px; }
  .pn-mode-card { min-height: 124px; padding: 17px 18px; }
  .pn-mode-icon { width: 34px; height: 34px; margin-bottom: 12px; }
  .pn-mode-card p { line-height: 1.35; }
}

@media (max-width: 360px) {
  .pn-main { padding-inline: 10px; }
  .pn-daily-copy { padding-inline: 19px; }
  .pn-daily-copy h2 { font-size: 34px; }
  .pn-primary-btn,
  .pn-secondary-btn { min-height: 45px; }
  .pn-game-main { padding: 6px; }
  .pn-game-topbar { min-height: 58px; }
  .pn-target-city { max-width: 170px; font-size: 20px; }
  .pn-game-status { gap: 5px; }
  .pn-status-pill { padding-inline: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
